--- /srv/reproducible-results/rbuild-debian/r-b-build.ZBXlKqfi/b1/libtorrent-rasterbar_2.0.11-1_i386.changes +++ /srv/reproducible-results/rbuild-debian/r-b-build.ZBXlKqfi/b2/libtorrent-rasterbar_2.0.11-1_i386.changes ├── Files │ @@ -1,7 +1,7 @@ │ │ 51f33d3a912a93e2fa3cc2dd217cc7ad 366336 libdevel optional libtorrent-rasterbar-dev_2.0.11-1_i386.deb │ - 5f03c49517eee6590b97f1ed381ed0c2 1669664 doc optional libtorrent-rasterbar-doc_2.0.11-1_all.deb │ + 309141f3d0b3ff382a63bf7eefdc7db0 1670072 doc optional libtorrent-rasterbar-doc_2.0.11-1_all.deb │ 9a7c17bd57218f562b913ac3e1817dcf 50338544 debug optional libtorrent-rasterbar2.0t64-dbgsym_2.0.11-1_i386.deb │ 7406e5fd716490f6d40bf74ff16c044a 1827628 libs optional libtorrent-rasterbar2.0t64_2.0.11-1_i386.deb │ 9680b93ebc80cf36bca5423b4ed03a37 13037772 debug optional python3-libtorrent-dbgsym_2.0.11-1_i386.deb │ a14637baa1e8b0ed62f65398d4804078 733268 python optional python3-libtorrent_2.0.11-1_i386.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 1665844 2025-01-28 14:33:12.000000 data.tar.xz │ │ +-rw-r--r-- 0 0 0 3632 2025-01-28 14:33:12.000000 control.tar.xz │ │ +-rw-r--r-- 0 0 0 1666248 2025-01-28 14:33:12.000000 data.tar.xz │ ├── control.tar.xz │ │ ├── control.tar │ │ │ ├── ./md5sums │ │ │ │ ├── ./md5sums │ │ │ │ │┄ Files differ │ ├── data.tar.xz │ │ ├── data.tar │ │ │ ├── file list │ │ │ │ @@ -73,43 +73,43 @@ │ │ │ │ -rw-r--r-- 0 root (0) root (0) 428300 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) 27434 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) 27441 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) 88956 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) 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) 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) 102462 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) 129829 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) 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) 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) 55643 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) 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) 1274809 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) 1274771 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 │ │ │ │ @@ -100,15 +100,15 @@ │ │ │ │ the session, it contains the main loop that serves all torrents.

│ │ │ │

The basic usage is as follows:

│ │ │ │ │ │ │ │ │ │ │ │
  • torrent_removed_alert
  • │ │ │ │
  • read_piece_alert
  • │ │ │ │
  • file_completed_alert
  • │ │ │ │
  • file_renamed_alert │ │ │ │
  • │ │ │ │
  • file_rename_failed_alert
  • │ │ │ │
  • performance_alert │ │ │ │
  • │ │ │ │ @@ -191,20 +191,20 @@ │ │ │ │ │ │ │ │ │ │ │ │
  • dht_get_peers_reply_alert
  • │ │ │ │
  • dht_direct_response_alert
  • │ │ │ │
  • picker_log_alert
  • │ │ │ │
  • session_error_alert
  • │ │ │ │
  • dht_live_nodes_alert │ │ │ │
  • │ │ │ │
  • session_stats_header_alert
  • │ │ │ │
  • dht_sample_infohashes_alert │ │ │ │
  • │ │ │ │
  • block_uploaded_alert
  • │ │ │ │
  • alerts_dropped_alert
  • │ │ │ │
  • socks5_alert
  • │ │ │ │ @@ -442,17 +442,17 @@ │ │ │ │ char const* old_name () const; │ │ │ │ char const* new_name () const; │ │ │ │ │ │ │ │ static constexpr alert_category_t static_category = alert_category::storage; │ │ │ │ file_index_t const index; │ │ │ │ }; │ │ │ │ │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    old_name() new_name()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    new_name() old_name()

    │ │ │ │
    │ │ │ │  char const* old_name () const;
    │ │ │ │  char const* new_name () const;
    │ │ │ │  
    │ │ │ │

    returns the new and previous file name, respectively.

    │ │ │ │ [report issue]
    │ │ │ │
    index
    │ │ │ │ @@ -1178,26 +1178,26 @@ │ │ │ │ torrent_handle::move_storage. This is useful to synchronize with the │ │ │ │ actual disk. The storage_path() member return the new path of the │ │ │ │ storage.

    │ │ │ │
    │ │ │ │  struct storage_moved_alert final : torrent_alert
    │ │ │ │  {
    │ │ │ │     std::string message () const override;
    │ │ │ │ -   char const* storage_path () const;
    │ │ │ │     char const* old_path () const;
    │ │ │ │ +   char const* storage_path () const;
    │ │ │ │  
    │ │ │ │     static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │

    storage_path() old_path()

    │ │ │ │
    │ │ │ │ -char const* storage_path () const;
    │ │ │ │  char const* old_path () const;
    │ │ │ │ +char const* storage_path () const;
    │ │ │ │  
    │ │ │ │

    the path the torrent was moved to and from, respectively.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │
    │ │ │ │

    storage_moved_failed_alert

    │ │ │ │

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ @@ -2842,17 +2842,17 @@ │ │ │ │ int num_nodes () const; │ │ │ │ std::vector<std::pair<sha1_hash, udp::endpoint>> nodes () const; │ │ │ │ │ │ │ │ static constexpr alert_category_t static_category = alert_category::dht; │ │ │ │ sha1_hash node_id; │ │ │ │ }; │ │ │ │ │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    nodes() num_nodes()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    num_nodes() nodes()

    │ │ │ │
    │ │ │ │  int num_nodes () const;
    │ │ │ │  std::vector<std::pair<sha1_hash, udp::endpoint>> nodes () const;
    │ │ │ │  
    │ │ │ │

    the number of nodes in the routing table and the actual nodes.

    │ │ │ │ [report issue]
    │ │ │ │
    node_id
    │ │ │ │ @@ -2896,17 +2896,17 @@ │ │ │ │ static constexpr alert_category_t static_category = alert_category::dht_operation; │ │ │ │ sha1_hash node_id; │ │ │ │ aux::noexcept_movable<udp::endpoint> endpoint; │ │ │ │ time_duration const interval; │ │ │ │ int const num_infohashes; │ │ │ │ }; │ │ │ │ │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    num_samples() samples()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    samples() num_samples()

    │ │ │ │
    │ │ │ │  std::vector<sha1_hash> samples () const;
    │ │ │ │  int num_samples () 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().

    │ │ │ │ @@ -3308,16 +3308,16 @@ │ │ │ │

    maps an operation id (from peer_error_alert and peer_disconnected_alert) │ │ │ │ to its name. See operation_t for the constants

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    alert_cast()

    │ │ │ │

    Declared in "libtorrent/alert.hpp"

    │ │ │ │
    │ │ │ │ -template <typename T> T* alert_cast (alert* a);
    │ │ │ │  template <typename T> T const* alert_cast (alert const* a);
    │ │ │ │ +template <typename T> T* alert_cast (alert* a);
    │ │ │ │  
    │ │ │ │

    When you get an alert, you can use alert_cast<> to attempt to cast the │ │ │ │ pointer to a specific alert type, in order to query it for more │ │ │ │ information.

    │ │ │ │
    │ │ │ │

    Note

    │ │ │ │

    alert_cast<> can only cast to an exact alert type, not a base class

    │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -9,15 +9,15 @@ │ │ │ │ │ * _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 │ │ │ │ │ * _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 │ │ │ │ │ * _f_i_l_e___r_e_n_a_m_e_d___a_l_e_r_t │ │ │ │ │ - o _o_l_d___n_a_m_e_(_)_ _n_e_w___n_a_m_e_(_) │ │ │ │ │ + o _n_e_w___n_a_m_e_(_)_ _o_l_d___n_a_m_e_(_) │ │ │ │ │ * _f_i_l_e___r_e_n_a_m_e___f_a_i_l_e_d___a_l_e_r_t │ │ │ │ │ * _p_e_r_f_o_r_m_a_n_c_e___a_l_e_r_t │ │ │ │ │ o _e_n_u_m_ _p_e_r_f_o_r_m_a_n_c_e___w_a_r_n_i_n_g___t │ │ │ │ │ * _s_t_a_t_e___c_h_a_n_g_e_d___a_l_e_r_t │ │ │ │ │ * _t_r_a_c_k_e_r___e_r_r_o_r___a_l_e_r_t │ │ │ │ │ o _f_a_i_l_u_r_e___r_e_a_s_o_n_(_) │ │ │ │ │ * _t_r_a_c_k_e_r___w_a_r_n_i_n_g___a_l_e_r_t │ │ │ │ │ @@ -114,18 +114,18 @@ │ │ │ │ │ o _p_k_t___b_u_f_(_) │ │ │ │ │ o _e_n_u_m_ _d_i_r_e_c_t_i_o_n___t │ │ │ │ │ * _d_h_t___g_e_t___p_e_e_r_s___r_e_p_l_y___a_l_e_r_t │ │ │ │ │ * _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_(_) │ │ │ │ │ + o _n_u_m___n_o_d_e_s_(_)_ _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 _n_u_m___s_a_m_p_l_e_s_(_)_ _s_a_m_p_l_e_s_(_) │ │ │ │ │ + o _s_a_m_p_l_e_s_(_)_ _n_u_m___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 │ │ │ │ │ @@ -319,15 +319,15 @@ │ │ │ │ │ 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] │ │ │ │ │ -********** oolldd__nnaammee(()) nneeww__nnaammee(()) ********** │ │ │ │ │ +********** nneeww__nnaammee(()) oolldd__nnaammee(()) ********** │ │ │ │ │ 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] │ │ │ │ │ @@ -946,24 +946,24 @@ │ │ │ │ │ The storage_moved_alert is generated when all the disk IO has completed and the │ │ │ │ │ files have been moved, as an effect of a call to torrent_handle::move_storage. │ │ │ │ │ This is useful to synchronize with the actual disk. The storage_path() member │ │ │ │ │ return the new path of the storage. │ │ │ │ │ struct storage_moved_alert final : torrent_alert │ │ │ │ │ { │ │ │ │ │ std::string mmeessssaaggee () const override; │ │ │ │ │ - char const* ssttoorraaggee__ppaatthh () const; │ │ │ │ │ char const* oolldd__ppaatthh () const; │ │ │ │ │ + char const* ssttoorraaggee__ppaatthh () const; │ │ │ │ │ │ │ │ │ │ static constexpr alert_category_t ssttaattiicc__ccaatteeggoorryy = alert_category:: │ │ │ │ │ storage; │ │ │ │ │ }; │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ ********** ssttoorraaggee__ppaatthh(()) oolldd__ppaatthh(()) ********** │ │ │ │ │ -char const* ssttoorraaggee__ppaatthh () const; │ │ │ │ │ char const* oolldd__ppaatthh () const; │ │ │ │ │ +char const* ssttoorraaggee__ppaatthh () const; │ │ │ │ │ the path the torrent was moved to and from, respectively. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ ************ ssttoorraaggee__mmoovveedd__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" │ │ │ │ │ The storage_moved_failed_alert is generated when an attempt to move the │ │ │ │ │ storage, via _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_m_o_v_e___s_t_o_r_a_g_e_(_), fails. │ │ │ │ │ struct storage_moved_failed_alert final : torrent_alert │ │ │ │ │ @@ -2206,15 +2206,15 @@ │ │ │ │ │ int nnuumm__nnooddeess () const; │ │ │ │ │ std::vector> nnooddeess () const; │ │ │ │ │ │ │ │ │ │ static constexpr alert_category_t ssttaattiicc__ccaatteeggoorryy = alert_category::dht; │ │ │ │ │ sha1_hash node_id; │ │ │ │ │ }; │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** nnooddeess(()) nnuumm__nnooddeess(()) ********** │ │ │ │ │ +********** nnuumm__nnooddeess(()) nnooddeess(()) ********** │ │ │ │ │ int nnuumm__nnooddeess () const; │ │ │ │ │ std::vector> nnooddeess () const; │ │ │ │ │ the number of nodes in the routing table and the actual nodes. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ node_id │ │ │ │ │ the local DHT node's node-ID this routing table belongs to │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ @@ -2250,15 +2250,15 @@ │ │ │ │ │ dht_operation; │ │ │ │ │ sha1_hash node_id; │ │ │ │ │ aux::noexcept_movable endpoint; │ │ │ │ │ time_duration const interval; │ │ │ │ │ int const num_infohashes; │ │ │ │ │ }; │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** nnuumm__ssaammpplleess(()) ssaammpplleess(()) ********** │ │ │ │ │ +********** ssaammpplleess(()) nnuumm__ssaammpplleess(()) ********** │ │ │ │ │ std::vector ssaammpplleess () const; │ │ │ │ │ int nnuumm__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; │ │ │ │ │ @@ -2580,16 +2580,16 @@ │ │ │ │ │ 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" │ │ │ │ │ char const* ooppeerraattiioonn__nnaammee (operation_t op); │ │ │ │ │ maps an operation id (from _p_e_e_r___e_r_r_o_r___a_l_e_r_t and _p_e_e_r___d_i_s_c_o_n_n_e_c_t_e_d___a_l_e_r_t) to its │ │ │ │ │ name. See _o_p_e_r_a_t_i_o_n___t for the constants │ │ │ │ │ [_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 T* aalleerrtt__ccaasstt (alert* a); │ │ │ │ │ template T const* aalleerrtt__ccaasstt (alert const* a); │ │ │ │ │ +template T* aalleerrtt__ccaasstt (alert* 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] │ │ │ │ │ ************ eennuumm ooppeerraattiioonn__tt ************ │ │ │ │ │ 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" │ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Bdecoding.html │ │ │ │ @@ -30,23 +30,23 @@ │ │ │ │ │ │ │ │

    home

    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │

    bdecode_node

    │ │ │ │

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │

    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 │ │ │ │ non_owning() member function.

    │ │ │ │ -

    There are 5 different types of nodes, see type_t.

    │ │ │ │ +

    There are 5 different types of nodes, see type_t.

    │ │ │ │
    │ │ │ │  struct bdecode_node
    │ │ │ │  {
    │ │ │ │     bdecode_node () = default;
    │ │ │ │     bdecode_node (bdecode_node const&);
    │ │ │ │     bdecode_node (bdecode_node&&) noexcept;
    │ │ │ │ -   bdecode_node& operator= (bdecode_node const&) &;
    │ │ │ │     bdecode_node& operator= (bdecode_node&&) & = default;
    │ │ │ │ +   bdecode_node& operator= (bdecode_node const&) &;
    │ │ │ │     type_t type () const noexcept;
    │ │ │ │     explicit operator bool () const noexcept;
    │ │ │ │     bdecode_node non_owning () const;
    │ │ │ │     std::ptrdiff_t data_offset () const noexcept;
    │ │ │ │     span<char const> data_section () const noexcept;
    │ │ │ │ -   string_view list_string_value_at (int i
    │ │ │ │ -      , string_view default_val = string_view()) const;
    │ │ │ │ -   int list_size () const;
    │ │ │ │     std::int64_t list_int_value_at (int i
    │ │ │ │        , std::int64_t default_val = 0) const;
    │ │ │ │     bdecode_node list_at (int i) const;
    │ │ │ │ -   bdecode_node dict_find_int (string_view key) const;
    │ │ │ │ +   string_view list_string_value_at (int i
    │ │ │ │ +      , string_view default_val = string_view()) const;
    │ │ │ │ +   int list_size () const;
    │ │ │ │     string_view dict_find_string_value (string_view key
    │ │ │ │        , string_view default_value = string_view()) const;
    │ │ │ │ -   std::pair<bdecode_node, bdecode_node> dict_at_node (int i) const;
    │ │ │ │ -   bdecode_node dict_find_string (string_view key) const;
    │ │ │ │ -   bdecode_node dict_find_dict (string_view key) const;
    │ │ │ │ -   bdecode_node dict_find (string_view key) const;
    │ │ │ │ -   std::pair<string_view, bdecode_node> dict_at (int i) const;
    │ │ │ │ -   int dict_size () const;
    │ │ │ │     std::int64_t dict_find_int_value (string_view key
    │ │ │ │        , std::int64_t default_val = 0) const;
    │ │ │ │ +   std::pair<string_view, bdecode_node> dict_at (int i) const;
    │ │ │ │     bdecode_node dict_find_list (string_view key) const;
    │ │ │ │ +   bdecode_node dict_find (string_view key) const;
    │ │ │ │ +   bdecode_node dict_find_int (string_view key) const;
    │ │ │ │ +   std::pair<bdecode_node, bdecode_node> dict_at_node (int i) const;
    │ │ │ │ +   bdecode_node dict_find_dict (string_view key) const;
    │ │ │ │ +   bdecode_node dict_find_string (string_view key) const;
    │ │ │ │ +   int dict_size () const;
    │ │ │ │     std::int64_t int_value () const;
    │ │ │ │     std::ptrdiff_t string_offset () const;
    │ │ │ │ +   int string_length () const;
    │ │ │ │     string_view string_value () const;
    │ │ │ │     char const* string_ptr () const;
    │ │ │ │ -   int string_length () const;
    │ │ │ │     void clear ();
    │ │ │ │     void swap (bdecode_node& n);
    │ │ │ │     void reserve (int tokens);
    │ │ │ │     void switch_underlying_buffer (char const* buf) noexcept;
    │ │ │ │     bool has_soft_error (span<char> error) const;
    │ │ │ │  
    │ │ │ │     enum type_t
    │ │ │ │ @@ -116,40 +116,40 @@
    │ │ │ │  
    │ │ │ │ [report issue]
    │ │ │ │

    bdecode_node()

    │ │ │ │
    │ │ │ │  bdecode_node () = default;
    │ │ │ │  
    │ │ │ │

    creates a default constructed node, it will have the type none_t.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    bdecode_node() operator=()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    operator=() bdecode_node()

    │ │ │ │
    │ │ │ │  bdecode_node (bdecode_node const&);
    │ │ │ │  bdecode_node (bdecode_node&&) noexcept;
    │ │ │ │ -bdecode_node& operator= (bdecode_node const&) &;
    │ │ │ │  bdecode_node& operator= (bdecode_node&&) & = default;
    │ │ │ │ +bdecode_node& operator= (bdecode_node const&) &;
    │ │ │ │  
    │ │ │ │

    For owning nodes, the copy will create a copy of the tree, but the │ │ │ │ underlying buffer remains the same.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    type()

    │ │ │ │
    │ │ │ │  type_t type () const noexcept;
    │ │ │ │  
    │ │ │ │ -

    the type of this node. See type_t.

    │ │ │ │ +

    the type of this node. See type_t.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    bool()

    │ │ │ │
    │ │ │ │  explicit operator bool () const noexcept;
    │ │ │ │  
    │ │ │ │ -

    returns true if type() != none_t.

    │ │ │ │ +

    returns true if type() != none_t.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    non_owning()

    │ │ │ │
    │ │ │ │  bdecode_node non_owning () const;
    │ │ │ │  
    │ │ │ │

    return a non-owning reference to this node. This is useful to refer to │ │ │ │ @@ -164,57 +164,57 @@ │ │ │ │ │ │ │ │

    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.

    │ │ │ │ - │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    list_int_value_at() list_size() list_at() list_string_value_at()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    list_size() list_int_value_at() list_at() list_string_value_at()

    │ │ │ │
    │ │ │ │ -string_view list_string_value_at (int i
    │ │ │ │ -      , string_view default_val = string_view()) const;
    │ │ │ │ -int list_size () const;
    │ │ │ │  std::int64_t list_int_value_at (int i
    │ │ │ │        , std::int64_t default_val = 0) const;
    │ │ │ │  bdecode_node list_at (int i) const;
    │ │ │ │ +string_view list_string_value_at (int i
    │ │ │ │ +      , string_view default_val = string_view()) const;
    │ │ │ │ +int list_size () 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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dict_find_string_value() dict_at() dict_find_dict() dict_find_int_value() dict_at_node() dict_size() dict_find_string() dict_find_int() dict_find_list() dict_find()

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dict_size() dict_find_dict() dict_find_string() dict_find_int() dict_find_int_value() dict_find() dict_at_node() dict_at() dict_find_string_value() dict_find_list()

    │ │ │ │
    │ │ │ │ -bdecode_node dict_find_int (string_view key) const;
    │ │ │ │  string_view dict_find_string_value (string_view key
    │ │ │ │        , string_view default_value = string_view()) const;
    │ │ │ │ -std::pair<bdecode_node, bdecode_node> dict_at_node (int i) const;
    │ │ │ │ -bdecode_node dict_find_string (string_view key) const;
    │ │ │ │ -bdecode_node dict_find_dict (string_view key) const;
    │ │ │ │ -bdecode_node dict_find (string_view key) const;
    │ │ │ │ -std::pair<string_view, bdecode_node> dict_at (int i) const;
    │ │ │ │ -int dict_size () const;
    │ │ │ │  std::int64_t dict_find_int_value (string_view key
    │ │ │ │        , std::int64_t default_val = 0) const;
    │ │ │ │ +std::pair<string_view, bdecode_node> dict_at (int i) const;
    │ │ │ │  bdecode_node dict_find_list (string_view key) const;
    │ │ │ │ +bdecode_node dict_find (string_view key) const;
    │ │ │ │ +bdecode_node dict_find_int (string_view key) const;
    │ │ │ │ +std::pair<bdecode_node, bdecode_node> dict_at_node (int i) const;
    │ │ │ │ +bdecode_node dict_find_dict (string_view key) const;
    │ │ │ │ +bdecode_node dict_find_string (string_view key) const;
    │ │ │ │ +int dict_size () 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 bdecode_node.

    │ │ │ │ @@ -230,24 +230,24 @@ │ │ │ │

    int_value()

    │ │ │ │
    │ │ │ │  std::int64_t int_value () const;
    │ │ │ │  
    │ │ │ │

    this function is only valid if type() == int_t. It returns the │ │ │ │ value of the integer.

    │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    string_value() string_ptr() string_length() string_offset()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    string_value() string_offset() string_length() string_ptr()

    │ │ │ │
    │ │ │ │  std::ptrdiff_t string_offset () const;
    │ │ │ │ +int string_length () const;
    │ │ │ │  string_view string_value () const;
    │ │ │ │  char const* string_ptr () const;
    │ │ │ │ -int string_length () const;
    │ │ │ │  
    │ │ │ │

    these functions are only valid if type() == string_t. They return │ │ │ │ the string values. Note that string_ptr() is not 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.

    │ │ │ │ [report issue]
    │ │ │ │ @@ -345,22 +345,22 @@ │ │ │ │

    print the bencoded structure in a human-readable format to a string │ │ │ │ that's returned.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    bdecode()

    │ │ │ │

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │
    │ │ │ │ -bdecode_node bdecode (span<char const> buffer
    │ │ │ │ +int bdecode (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 bdecode (span<char const> buffer
    │ │ │ │ -   , int depth_limit = 100, int token_limit = 2000000);
    │ │ │ │ -int bdecode (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 bdecode (span<char const> buffer
    │ │ │ │ +   , 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 │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,25 +1,25 @@ │ │ │ │ │ > │ │ │ │ │ _[_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 │ │ │ │ │ * _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 _o_p_e_r_a_t_o_r_=_(_)_ _b_d_e_c_o_d_e___n_o_d_e_(_) │ │ │ │ │ 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___v_a_l_u_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___v_a_l_u_e_(_)_ _d_i_c_t___a_t___n_o_d_e_(_)_ _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___i_n_t_(_)_ _d_i_c_t___f_i_n_d___l_i_s_t_(_)_ _d_i_c_t___f_i_n_d_(_) │ │ │ │ │ + o _l_i_s_t___s_i_z_e_(_)_ _l_i_s_t___i_n_t___v_a_l_u_e___a_t_(_)_ _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___s_i_z_e_(_)_ _d_i_c_t___f_i_n_d___d_i_c_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_(_) │ │ │ │ │ + _d_i_c_t___f_i_n_d___i_n_t___v_a_l_u_e_(_)_ _d_i_c_t___f_i_n_d_(_)_ _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___v_a_l_u_e_(_)_ _d_i_c_t___f_i_n_d___l_i_s_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___p_t_r_(_)_ _s_t_r_i_n_g___l_e_n_g_t_h_(_)_ _s_t_r_i_n_g___o_f_f_s_e_t_(_) │ │ │ │ │ + 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 _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_(_) │ │ │ │ │ @@ -32,44 +32,44 @@ │ │ │ │ │ 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 const&) &; │ │ │ │ │ bdecode_node& ooppeerraattoorr== (bdecode_node&&) & = default; │ │ │ │ │ + bdecode_node& ooppeerraattoorr== (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 ddaattaa__sseeccttiioonn () const noexcept; │ │ │ │ │ - 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 lliisstt__aatt (int i) const; │ │ │ │ │ - bdecode_node ddiicctt__ffiinndd__iinntt (string_view key) const; │ │ │ │ │ + string_view lliisstt__ssttrriinngg__vvaalluuee__aatt (int i │ │ │ │ │ + , string_view default_val = string_view()) const; │ │ │ │ │ + int lliisstt__ssiizzee () const; │ │ │ │ │ string_view ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee (string_view key │ │ │ │ │ , string_view default_value = string_view()) const; │ │ │ │ │ - std::pair ddiicctt__aatt__nnooddee (int i) const; │ │ │ │ │ - bdecode_node ddiicctt__ffiinndd__ssttrriinngg (string_view key) const; │ │ │ │ │ - bdecode_node ddiicctt__ffiinndd__ddiicctt (string_view key) const; │ │ │ │ │ - bdecode_node ddiicctt__ffiinndd (string_view key) const; │ │ │ │ │ - std::pair ddiicctt__aatt (int i) const; │ │ │ │ │ - int ddiicctt__ssiizzee () const; │ │ │ │ │ std::int64_t ddiicctt__ffiinndd__iinntt__vvaalluuee (string_view key │ │ │ │ │ , std::int64_t default_val = 0) const; │ │ │ │ │ + std::pair ddiicctt__aatt (int i) const; │ │ │ │ │ bdecode_node ddiicctt__ffiinndd__lliisstt (string_view key) const; │ │ │ │ │ + bdecode_node ddiicctt__ffiinndd (string_view key) const; │ │ │ │ │ + bdecode_node ddiicctt__ffiinndd__iinntt (string_view key) const; │ │ │ │ │ + std::pair ddiicctt__aatt__nnooddee (int i) const; │ │ │ │ │ + bdecode_node ddiicctt__ffiinndd__ddiicctt (string_view key) const; │ │ │ │ │ + bdecode_node ddiicctt__ffiinndd__ssttrriinngg (string_view key) const; │ │ │ │ │ + int ddiicctt__ssiizzee () const; │ │ │ │ │ std::int64_t iinntt__vvaalluuee () const; │ │ │ │ │ std::ptrdiff_t ssttrriinngg__ooffffsseett () const; │ │ │ │ │ + int ssttrriinngg__lleennggtthh () const; │ │ │ │ │ string_view ssttrriinngg__vvaalluuee () const; │ │ │ │ │ char const* ssttrriinngg__ppttrr () 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 error) const; │ │ │ │ │ │ │ │ │ │ enum type_t │ │ │ │ │ @@ -82,19 +82,19 @@ │ │ │ │ │ }; │ │ │ │ │ }; │ │ │ │ │ [_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==(()) ********** │ │ │ │ │ +********** ooppeerraattoorr==(()) bbddeeccooddee__nnooddee(()) ********** │ │ │ │ │ bbddeeccooddee__nnooddee (bdecode_node const&); │ │ │ │ │ bbddeeccooddee__nnooddee (bdecode_node&&) noexcept; │ │ │ │ │ -bdecode_node& ooppeerraattoorr== (bdecode_node const&) &; │ │ │ │ │ bdecode_node& ooppeerraattoorr== (bdecode_node&&) & = default; │ │ │ │ │ +bdecode_node& ooppeerraattoorr== (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(()) ********** │ │ │ │ │ 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 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; │ │ │ │ │ -int lliisstt__ssiizzee () const; │ │ │ │ │ +********** lliisstt__ssiizzee(()) lliisstt__iinntt__vvaalluuee__aatt(()) lliisstt__aatt(()) lliisstt__ssttrriinngg__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; │ │ │ │ │ +string_view lliisstt__ssttrriinngg__vvaalluuee__aatt (int i │ │ │ │ │ + , string_view default_val = string_view()) const; │ │ │ │ │ +int lliisstt__ssiizzee () 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__vvaalluuee(()) ddiicctt__aatt(()) ddiicctt__ffiinndd__ddiicctt(()) ddiicctt__ffiinndd__iinntt__vvaalluuee(()) │ │ │ │ │ -ddiicctt__aatt__nnooddee(()) ddiicctt__ssiizzee(()) ddiicctt__ffiinndd__ssttrriinngg(()) ddiicctt__ffiinndd__iinntt(()) ddiicctt__ffiinndd__lliisstt(()) │ │ │ │ │ -ddiicctt__ffiinndd(()) ********** │ │ │ │ │ -bdecode_node ddiicctt__ffiinndd__iinntt (string_view key) const; │ │ │ │ │ +********** ddiicctt__ssiizzee(()) ddiicctt__ffiinndd__ddiicctt(()) ddiicctt__ffiinndd__ssttrriinngg(()) ddiicctt__ffiinndd__iinntt(()) │ │ │ │ │ +ddiicctt__ffiinndd__iinntt__vvaalluuee(()) ddiicctt__ffiinndd(()) ddiicctt__aatt__nnooddee(()) ddiicctt__aatt(()) │ │ │ │ │ +ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee(()) ddiicctt__ffiinndd__lliisstt(()) ********** │ │ │ │ │ string_view ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee (string_view key │ │ │ │ │ , string_view default_value = string_view()) const; │ │ │ │ │ -std::pair ddiicctt__aatt__nnooddee (int i) const; │ │ │ │ │ -bdecode_node ddiicctt__ffiinndd__ssttrriinngg (string_view key) const; │ │ │ │ │ -bdecode_node ddiicctt__ffiinndd__ddiicctt (string_view key) const; │ │ │ │ │ -bdecode_node ddiicctt__ffiinndd (string_view key) const; │ │ │ │ │ -std::pair ddiicctt__aatt (int i) const; │ │ │ │ │ -int ddiicctt__ssiizzee () const; │ │ │ │ │ std::int64_t ddiicctt__ffiinndd__iinntt__vvaalluuee (string_view key │ │ │ │ │ , std::int64_t default_val = 0) const; │ │ │ │ │ +std::pair ddiicctt__aatt (int i) const; │ │ │ │ │ bdecode_node ddiicctt__ffiinndd__lliisstt (string_view key) const; │ │ │ │ │ +bdecode_node ddiicctt__ffiinndd (string_view key) const; │ │ │ │ │ +bdecode_node ddiicctt__ffiinndd__iinntt (string_view key) const; │ │ │ │ │ +std::pair ddiicctt__aatt__nnooddee (int i) const; │ │ │ │ │ +bdecode_node ddiicctt__ffiinndd__ddiicctt (string_view key) const; │ │ │ │ │ +bdecode_node ddiicctt__ffiinndd__ssttrriinngg (string_view key) const; │ │ │ │ │ +int ddiicctt__ssiizzee () 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__ppttrr(()) ssttrriinngg__lleennggtthh(()) ssttrriinngg__ooffffsseett(()) ********** │ │ │ │ │ +********** ssttrriinngg__vvaalluuee(()) ssttrriinngg__ooffffsseett(()) ssttrriinngg__lleennggtthh(()) ssttrriinngg__ppttrr(()) ********** │ │ │ │ │ std::ptrdiff_t ssttrriinngg__ooffffsseett () const; │ │ │ │ │ +int ssttrriinngg__lleennggtthh () const; │ │ │ │ │ string_view ssttrriinngg__vvaalluuee () const; │ │ │ │ │ char const* ssttrriinngg__ppttrr () 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] │ │ │ │ │ ********** 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" │ │ │ │ │ -bdecode_node bbddeeccooddee (span buffer │ │ │ │ │ +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 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 buffer │ │ │ │ │ + , 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 @@ │ │ │ │

      │ │ │ │
    • entry │ │ │ │
    • │ │ │ │ @@ -69,44 +69,44 @@ │ │ │ │

      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 type () const;
      │ │ │ │ -   entry (dictionary_type);
      │ │ │ │     entry (integer_type);
      │ │ │ │ +   entry (dictionary_type);
      │ │ │ │     entry (preformatted_type);
      │ │ │ │ -   entry (span<char const>);
      │ │ │ │     entry (list_type);
      │ │ │ │ +   entry (span<char const>);
      │ │ │ │     entry (U v);
      │ │ │ │     entry (data_type t);
      │ │ │ │     entry (bdecode_node const& n);
      │ │ │ │ -   entry& operator= (list_type) &;
      │ │ │ │     entry& operator= (entry const&) &;
      │ │ │ │ -   entry& operator= (entry&&) & noexcept;
      │ │ │ │ -   entry& operator= (preformatted_type) &;
      │ │ │ │ -   entry& operator= (dictionary_type) &;
      │ │ │ │     entry& operator= (span<char const>) &;
      │ │ │ │ +   entry& operator= (list_type) &;
      │ │ │ │     entry& operator= (integer_type) &;
      │ │ │ │ +   entry& operator= (entry&&) & noexcept;
      │ │ │ │ +   entry& operator= (preformatted_type) &;
      │ │ │ │     entry& operator= (bdecode_node const&) &;
      │ │ │ │ +   entry& operator= (dictionary_type) &;
      │ │ │ │     entry& operator= (U v) &;
      │ │ │ │ -   integer_type& integer ();
      │ │ │ │ -   integer_type const& integer () const;
      │ │ │ │ -   preformatted_type& preformatted ();
      │ │ │ │ -   dictionary_type const& dict () const;
      │ │ │ │ -   dictionary_type& dict ();
      │ │ │ │     preformatted_type const& preformatted () const;
      │ │ │ │     string_type& string ();
      │ │ │ │ -   list_type const& list () const;
      │ │ │ │ -   string_type const& string () const;
      │ │ │ │ +   dictionary_type const& dict () const;
      │ │ │ │     list_type& list ();
      │ │ │ │ +   preformatted_type& preformatted ();
      │ │ │ │ +   integer_type& integer ();
      │ │ │ │ +   string_type const& string () const;
      │ │ │ │ +   list_type const& list () const;
      │ │ │ │ +   integer_type const& integer () const;
      │ │ │ │ +   dictionary_type& dict ();
      │ │ │ │     void swap (entry& e);
      │ │ │ │ -   entry& operator[] (string_view key);
      │ │ │ │     entry const& operator[] (string_view key) const;
      │ │ │ │ +   entry& operator[] (string_view key);
      │ │ │ │     entry* find_key (string_view key);
      │ │ │ │     entry const* find_key (string_view key) const;
      │ │ │ │     std::string to_string (bool single_line = false) const;
      │ │ │ │  
      │ │ │ │     enum data_type
      │ │ │ │     {
      │ │ │ │        int_t,
      │ │ │ │ @@ -124,19 +124,19 @@
      │ │ │ │  data_type type () const;
      │ │ │ │  
      │ │ │ │

      returns the concrete type of the entry

      │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    entry()

    │ │ │ │
    │ │ │ │ -entry (dictionary_type);
    │ │ │ │  entry (integer_type);
    │ │ │ │ +entry (dictionary_type);
    │ │ │ │  entry (preformatted_type);
    │ │ │ │ -entry (span<char const>);
    │ │ │ │  entry (list_type);
    │ │ │ │ +entry (span<char const>);
    │ │ │ │  
    │ │ │ │

    constructors directly from a specific type. │ │ │ │ The content of the argument is copied into the │ │ │ │ newly constructed entry

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    entry()

    │ │ │ │ @@ -152,43 +152,43 @@ │ │ │ │ entry (bdecode_node const& n); │ │ │ │ │ │ │ │

    construct from bdecode_node parsed form (see bdecode())

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    operator=()

    │ │ │ │
    │ │ │ │ -entry& operator= (list_type) &;
    │ │ │ │  entry& operator= (entry const&) &;
    │ │ │ │ -entry& operator= (entry&&) & noexcept;
    │ │ │ │ -entry& operator= (preformatted_type) &;
    │ │ │ │ -entry& operator= (dictionary_type) &;
    │ │ │ │  entry& operator= (span<char const>) &;
    │ │ │ │ +entry& operator= (list_type) &;
    │ │ │ │  entry& operator= (integer_type) &;
    │ │ │ │ +entry& operator= (entry&&) & noexcept;
    │ │ │ │ +entry& operator= (preformatted_type) &;
    │ │ │ │  entry& operator= (bdecode_node const&) &;
    │ │ │ │ +entry& operator= (dictionary_type) &;
    │ │ │ │  
    │ │ │ │

    copies the structure of the right hand side into this │ │ │ │ entry.

    │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    preformatted() integer() string() dict() list()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    list() dict() preformatted() integer() string()

    │ │ │ │
    │ │ │ │ -integer_type& integer ();
    │ │ │ │ -integer_type const& integer () const;
    │ │ │ │ -preformatted_type& preformatted ();
    │ │ │ │ -dictionary_type const& dict () const;
    │ │ │ │ -dictionary_type& dict ();
    │ │ │ │  preformatted_type const& preformatted () const;
    │ │ │ │  string_type& string ();
    │ │ │ │ -list_type const& list () const;
    │ │ │ │ -string_type const& string () const;
    │ │ │ │ +dictionary_type const& dict () const;
    │ │ │ │  list_type& list ();
    │ │ │ │ +preformatted_type& preformatted ();
    │ │ │ │ +integer_type& integer ();
    │ │ │ │ +string_type const& string () const;
    │ │ │ │ +list_type const& list () const;
    │ │ │ │ +integer_type const& integer () const;
    │ │ │ │ +dictionary_type& dict ();
    │ │ │ │  
    │ │ │ │

    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 │ │ │ │ @@ -232,16 +232,16 @@ │ │ │ │ void swap (entry& e); │ │ │ │ │ │ │ │

    swaps the content of this with e.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    operator[]()

    │ │ │ │
    │ │ │ │ -entry& operator[] (string_view key);
    │ │ │ │  entry const& operator[] (string_view key) const;
    │ │ │ │ +entry& operator[] (string_view key);
    │ │ │ │  
    │ │ │ │

    All of these functions requires the entry 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.

    │ │ │ │ ├── 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 _p_r_e_f_o_r_m_a_t_t_e_d_(_)_ _i_n_t_e_g_e_r_(_)_ _s_t_r_i_n_g_(_)_ _d_i_c_t_(_)_ _l_i_s_t_(_) │ │ │ │ │ + o _l_i_s_t_(_)_ _d_i_c_t_(_)_ _p_r_e_f_o_r_m_a_t_t_e_d_(_)_ _i_n_t_e_g_e_r_(_)_ _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 │ │ │ │ │ * _o_p_e_r_a_t_o_r_<_<_(_) │ │ │ │ │ * _b_e_n_c_o_d_e_(_) │ │ │ │ │ @@ -35,44 +35,44 @@ │ │ │ │ │ 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 (integer_type); │ │ │ │ │ + eennttrryy (dictionary_type); │ │ │ │ │ eennttrryy (preformatted_type); │ │ │ │ │ - eennttrryy (span); │ │ │ │ │ eennttrryy (list_type); │ │ │ │ │ + eennttrryy (span); │ │ │ │ │ eennttrryy (U v); │ │ │ │ │ eennttrryy (data_type t); │ │ │ │ │ eennttrryy (bdecode_node const& n); │ │ │ │ │ - entry& ooppeerraattoorr== (list_type) &; │ │ │ │ │ entry& ooppeerraattoorr== (entry const&) &; │ │ │ │ │ - entry& ooppeerraattoorr== (entry&&) & noexcept; │ │ │ │ │ - entry& ooppeerraattoorr== (preformatted_type) &; │ │ │ │ │ - entry& ooppeerraattoorr== (dictionary_type) &; │ │ │ │ │ entry& ooppeerraattoorr== (span) &; │ │ │ │ │ + entry& ooppeerraattoorr== (list_type) &; │ │ │ │ │ entry& ooppeerraattoorr== (integer_type) &; │ │ │ │ │ + entry& ooppeerraattoorr== (entry&&) & noexcept; │ │ │ │ │ + entry& ooppeerraattoorr== (preformatted_type) &; │ │ │ │ │ entry& ooppeerraattoorr== (bdecode_node const&) &; │ │ │ │ │ + entry& ooppeerraattoorr== (dictionary_type) &; │ │ │ │ │ entry& ooppeerraattoorr== (U v) &; │ │ │ │ │ - integer_type& iinntteeggeerr (); │ │ │ │ │ - integer_type const& iinntteeggeerr () const; │ │ │ │ │ - preformatted_type& pprreeffoorrmmaatttteedd (); │ │ │ │ │ - dictionary_type const& ddiicctt () const; │ │ │ │ │ - dictionary_type& ddiicctt (); │ │ │ │ │ preformatted_type const& pprreeffoorrmmaatttteedd () const; │ │ │ │ │ string_type& ssttrriinngg (); │ │ │ │ │ - list_type const& lliisstt () const; │ │ │ │ │ - string_type const& ssttrriinngg () const; │ │ │ │ │ + dictionary_type const& ddiicctt () const; │ │ │ │ │ list_type& lliisstt (); │ │ │ │ │ + preformatted_type& pprreeffoorrmmaatttteedd (); │ │ │ │ │ + integer_type& iinntteeggeerr (); │ │ │ │ │ + string_type const& ssttrriinngg () const; │ │ │ │ │ + list_type const& lliisstt () const; │ │ │ │ │ + integer_type const& iinntteeggeerr () const; │ │ │ │ │ + dictionary_type& ddiicctt (); │ │ │ │ │ void sswwaapp (entry& e); │ │ │ │ │ - entry& ooppeerraattoorr[[]] (string_view key); │ │ │ │ │ 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, │ │ │ │ │ @@ -85,52 +85,52 @@ │ │ │ │ │ }; │ │ │ │ │ [_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 (integer_type); │ │ │ │ │ +eennttrryy (dictionary_type); │ │ │ │ │ eennttrryy (preformatted_type); │ │ │ │ │ -eennttrryy (span); │ │ │ │ │ eennttrryy (list_type); │ │ │ │ │ +eennttrryy (span); │ │ │ │ │ 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== (list_type) &; │ │ │ │ │ entry& ooppeerraattoorr== (entry const&) &; │ │ │ │ │ -entry& ooppeerraattoorr== (entry&&) & noexcept; │ │ │ │ │ -entry& ooppeerraattoorr== (preformatted_type) &; │ │ │ │ │ -entry& ooppeerraattoorr== (dictionary_type) &; │ │ │ │ │ entry& ooppeerraattoorr== (span) &; │ │ │ │ │ +entry& ooppeerraattoorr== (list_type) &; │ │ │ │ │ entry& ooppeerraattoorr== (integer_type) &; │ │ │ │ │ +entry& ooppeerraattoorr== (entry&&) & noexcept; │ │ │ │ │ +entry& ooppeerraattoorr== (preformatted_type) &; │ │ │ │ │ entry& ooppeerraattoorr== (bdecode_node const&) &; │ │ │ │ │ +entry& ooppeerraattoorr== (dictionary_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] │ │ │ │ │ -********** pprreeffoorrmmaatttteedd(()) iinntteeggeerr(()) ssttrriinngg(()) ddiicctt(()) lliisstt(()) ********** │ │ │ │ │ -integer_type& iinntteeggeerr (); │ │ │ │ │ -integer_type const& iinntteeggeerr () const; │ │ │ │ │ -preformatted_type& pprreeffoorrmmaatttteedd (); │ │ │ │ │ -dictionary_type const& ddiicctt () const; │ │ │ │ │ -dictionary_type& ddiicctt (); │ │ │ │ │ +********** lliisstt(()) ddiicctt(()) pprreeffoorrmmaatttteedd(()) iinntteeggeerr(()) ssttrriinngg(()) ********** │ │ │ │ │ preformatted_type const& pprreeffoorrmmaatttteedd () const; │ │ │ │ │ string_type& ssttrriinngg (); │ │ │ │ │ -list_type const& lliisstt () const; │ │ │ │ │ -string_type const& ssttrriinngg () const; │ │ │ │ │ +dictionary_type const& ddiicctt () const; │ │ │ │ │ list_type& lliisstt (); │ │ │ │ │ +preformatted_type& pprreeffoorrmmaatttteedd (); │ │ │ │ │ +integer_type& iinntteeggeerr (); │ │ │ │ │ +string_type const& ssttrriinngg () const; │ │ │ │ │ +list_type const& lliisstt () const; │ │ │ │ │ +integer_type const& iinntteeggeerr () const; │ │ │ │ │ +dictionary_type& ddiicctt (); │ │ │ │ │ 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. │ │ │ │ │ @@ -161,16 +161,16 @@ │ │ │ │ │ _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& ooppeerraattoorr[[]] (string_view key); │ │ │ │ │ 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. │ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Core.html │ │ │ │ @@ -30,45 +30,45 @@ │ │ │ │ │ │ │ │

    home

    │ │ │ │
    │ │ │ │

    Table of contents

    │ │ │ │
    │ │ │ │ [report issue]
    │ │ │ │

    info_hash_t

    │ │ │ │

    Declared in "libtorrent/info_hash.hpp"

    │ │ │ │ @@ -78,21 +78,21 @@ │ │ │ │

    Note

    │ │ │ │

    If has_v2() is false then the v1 hash might actually be a truncated │ │ │ │ v2 hash

    │ │ │ │
    │ │ │ │
    │ │ │ │  struct info_hash_t
    │ │ │ │  {
    │ │ │ │ +   info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;
    │ │ │ │ +   info_hash_t () noexcept = default;
    │ │ │ │     explicit info_hash_t (sha1_hash h1) noexcept;
    │ │ │ │     explicit info_hash_t (sha256_hash h2) noexcept;
    │ │ │ │ -   info_hash_t () noexcept = default;
    │ │ │ │ -   info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;
    │ │ │ │ -   bool has (protocol_version v) const;
    │ │ │ │     bool has_v1 () const;
    │ │ │ │     bool has_v2 () const;
    │ │ │ │ +   bool has (protocol_version v) const;
    │ │ │ │     sha1_hash get (protocol_version v) const;
    │ │ │ │     sha1_hash get_best () const;
    │ │ │ │     friend bool operator!= (info_hash_t const& lhs, info_hash_t const& rhs);
    │ │ │ │     friend bool operator== (info_hash_t const& lhs, info_hash_t const& rhs) noexcept;
    │ │ │ │     template <typename F> void for_each (F f) const;
    │ │ │ │     bool operator< (info_hash_t const& o) const;
    │ │ │ │     friend std::ostream& operator<< (std::ostream& os, info_hash_t const& ih);
    │ │ │ │ @@ -100,33 +100,33 @@
    │ │ │ │     sha1_hash v1;
    │ │ │ │     sha256_hash v2;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ [report issue]
    │ │ │ │

    info_hash_t()

    │ │ │ │
    │ │ │ │ +info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;
    │ │ │ │ +info_hash_t () noexcept = default;
    │ │ │ │  explicit info_hash_t (sha1_hash h1) noexcept;
    │ │ │ │  explicit info_hash_t (sha256_hash h2) noexcept;
    │ │ │ │ -info_hash_t () noexcept = default;
    │ │ │ │ -info_hash_t (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 implicit conversion from a │ │ │ │ v1 hash, but the implicitness is deprecated.

    │ │ │ │ │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    has_v1() has() has_v2()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    has_v1() has_v2() has()

    │ │ │ │
    │ │ │ │ -bool has (protocol_version v) const;
    │ │ │ │  bool has_v1 () const;
    │ │ │ │  bool has_v2 () const;
    │ │ │ │ +bool has (protocol_version v) const;
    │ │ │ │  
    │ │ │ │

    returns true if the corresponding info hash is present in this │ │ │ │ object.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    get()

    │ │ │ │
    │ │ │ │ @@ -148,14 +148,50 @@
    │ │ │ │  template <typename F> void for_each (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);
    │ │ │ │  
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    peer_request

    │ │ │ │ +

    Declared in "libtorrent/peer_request.hpp"

    │ │ │ │ +

    represents a byte range within a piece. Internally this is is used for │ │ │ │ +incoming piece requests.

    │ │ │ │ +
    │ │ │ │ +struct peer_request
    │ │ │ │ +{
    │ │ │ │ +   bool operator== (peer_request const& r) const;
    │ │ │ │ +
    │ │ │ │ +   piece_index_t piece;
    │ │ │ │ +   int start;
    │ │ │ │ +   int length;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    operator==()

    │ │ │ │ +
    │ │ │ │ +bool operator== (peer_request const& r) const;
    │ │ │ │ +
    │ │ │ │ +

    returns true if the right hand side peer_request refers to the same │ │ │ │ +range as this does.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    piece
    │ │ │ │ +
    The index of the piece in which the range starts.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    start
    │ │ │ │ +
    The byte offset within that piece where the range starts.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    length
    │ │ │ │ +
    The size of the range, in bytes.
    │ │ │ │ +
    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │
    │ │ │ │

    peer_info

    │ │ │ │

    Declared in "libtorrent/peer_info.hpp"

    │ │ │ │

    holds information and statistics about one peer │ │ │ │ that libtorrent is connected to

    │ │ │ │ @@ -643,111 +679,33 @@ │ │ │ │
    │ │ │ │
    │ │ │ │

    piece_block

    │ │ │ │

    Declared in "libtorrent/piece_block.hpp"

    │ │ │ │
    │ │ │ │  struct piece_block
    │ │ │ │  {
    │ │ │ │ -   piece_block () = default;
    │ │ │ │     piece_block (piece_index_t p_index, int b_index);
    │ │ │ │ +   piece_block () = default;
    │ │ │ │     bool operator< (piece_block const& b) const;
    │ │ │ │     bool operator== (piece_block const& b) const;
    │ │ │ │     bool operator!= (piece_block const& b) const;
    │ │ │ │  
    │ │ │ │     static const piece_block invalid;
    │ │ │ │     piece_index_t piece_index {0};
    │ │ │ │     int block_index  = 0;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    peer_request

    │ │ │ │ -

    Declared in "libtorrent/peer_request.hpp"

    │ │ │ │ -

    represents a byte range within a piece. Internally this is is used for │ │ │ │ -incoming piece requests.

    │ │ │ │ -
    │ │ │ │ -struct peer_request
    │ │ │ │ -{
    │ │ │ │ -   bool operator== (peer_request const& r) const;
    │ │ │ │ -
    │ │ │ │ -   piece_index_t piece;
    │ │ │ │ -   int start;
    │ │ │ │ -   int length;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    operator==()

    │ │ │ │ -
    │ │ │ │ -bool operator== (peer_request const& r) const;
    │ │ │ │ -
    │ │ │ │ -

    returns true if the right hand side peer_request refers to the same │ │ │ │ -range as this does.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    piece
    │ │ │ │ -
    The index of the piece in which the range starts.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    start
    │ │ │ │ -
    The byte offset within that piece where the range starts.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    length
    │ │ │ │ -
    The size of the range, in bytes.
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    load_torrent_file() load_torrent_buffer() load_torrent_parsed()

    │ │ │ │ -

    Declared in "libtorrent/load_torrent.hpp"

    │ │ │ │ -
    │ │ │ │ -add_torrent_params load_torrent_parsed (
    │ │ │ │ -   bdecode_node const& torrent_file, load_torrent_limits const& cfg);
    │ │ │ │ -add_torrent_params load_torrent_buffer (
    │ │ │ │ -   span<char const> buffer, load_torrent_limits const& cfg);
    │ │ │ │ -add_torrent_params load_torrent_file (
    │ │ │ │ -   std::string const& filename);
    │ │ │ │ -add_torrent_params load_torrent_parsed (
    │ │ │ │ -   bdecode_node const& torrent_file);
    │ │ │ │ -add_torrent_params load_torrent_buffer (
    │ │ │ │ -   span<char const> buffer);
    │ │ │ │ -add_torrent_params load_torrent_file (
    │ │ │ │ -   std::string const& filename, load_torrent_limits const& cfg);
    │ │ │ │ -
    │ │ │ │ -

    These functions load the content of a .torrent file into an │ │ │ │ -add_torrent_params object. │ │ │ │ -The immutable part of a torrent file (the info-dictionary) is stored in │ │ │ │ -the ti field in the add_torrent_params object (as a torrent_info │ │ │ │ -object). │ │ │ │ -The returned object is suitable to be:

    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    truncate_files()

    │ │ │ │ -

    Declared in "libtorrent/truncate.hpp"

    │ │ │ │ -
    │ │ │ │ -void truncate_files (file_storage const& fs, std::string const& save_path, storage_error& ec);
    │ │ │ │ -
    │ │ │ │ -

    Truncates files larger than specified in the file_storage, saved under │ │ │ │ -the specified save_path.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    make_magnet_uri()

    │ │ │ │

    Declared in "libtorrent/magnet_uri.hpp"

    │ │ │ │
    │ │ │ │ +std::string make_magnet_uri (torrent_handle const& handle);
    │ │ │ │  std::string make_magnet_uri (add_torrent_params const& atp);
    │ │ │ │  std::string make_magnet_uri (torrent_info const& info);
    │ │ │ │ -std::string make_magnet_uri (torrent_handle const& handle);
    │ │ │ │  
    │ │ │ │

    Generates a magnet URI from the specified torrent.

    │ │ │ │

    Several fields from the add_torrent_params objects are recorded in the │ │ │ │ magnet link. In order to not include them, they have to be cleared before │ │ │ │ calling make_magnet_uri(). These fields are used:

    │ │ │ │
    │ │ │ │ ti, info_hashes, url_seeds, dht_nodes, │ │ │ │ @@ -767,68 +725,134 @@ │ │ │ │ an empty string is returned.

    │ │ │ │

    For more information about magnet links, see magnet links.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    parse_magnet_uri()

    │ │ │ │

    Declared in "libtorrent/magnet_uri.hpp"

    │ │ │ │
    │ │ │ │ -void parse_magnet_uri (string_view uri, add_torrent_params& p, error_code& ec);
    │ │ │ │ -add_torrent_params parse_magnet_uri (string_view uri);
    │ │ │ │  add_torrent_params parse_magnet_uri (string_view uri, error_code& ec);
    │ │ │ │ +add_torrent_params parse_magnet_uri (string_view uri);
    │ │ │ │ +void parse_magnet_uri (string_view uri, add_torrent_params& p, error_code& ec);
    │ │ │ │  
    │ │ │ │

    This function parses out information from the magnet link and populates the │ │ │ │ add_torrent_params 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    torrent_peer_equal()

    │ │ │ │ +

    Declared in "libtorrent/torrent_peer.hpp"

    │ │ │ │ +
    │ │ │ │ +inline bool torrent_peer_equal (torrent_peer const* lhs, torrent_peer const* rhs);
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    load_torrent_file() load_torrent_buffer() load_torrent_parsed()

    │ │ │ │ +

    Declared in "libtorrent/load_torrent.hpp"

    │ │ │ │ +
    │ │ │ │ +add_torrent_params load_torrent_file (
    │ │ │ │ +   std::string const& filename, load_torrent_limits const& cfg);
    │ │ │ │ +add_torrent_params load_torrent_buffer (
    │ │ │ │ +   span<char const> buffer);
    │ │ │ │ +add_torrent_params load_torrent_buffer (
    │ │ │ │ +   span<char const> buffer, load_torrent_limits const& cfg);
    │ │ │ │ +add_torrent_params load_torrent_file (
    │ │ │ │ +   std::string const& filename);
    │ │ │ │ +add_torrent_params load_torrent_parsed (
    │ │ │ │ +   bdecode_node const& torrent_file);
    │ │ │ │ +add_torrent_params load_torrent_parsed (
    │ │ │ │ +   bdecode_node const& torrent_file, load_torrent_limits const& cfg);
    │ │ │ │ +
    │ │ │ │ +

    These functions load the content of a .torrent file into an │ │ │ │ +add_torrent_params object. │ │ │ │ +The immutable part of a torrent file (the info-dictionary) is stored in │ │ │ │ +the ti field in the add_torrent_params object (as a torrent_info │ │ │ │ +object). │ │ │ │ +The returned object is suitable to be:

    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    truncate_files()

    │ │ │ │ +

    Declared in "libtorrent/truncate.hpp"

    │ │ │ │ +
    │ │ │ │ +void truncate_files (file_storage const& fs, std::string const& save_path, storage_error& ec);
    │ │ │ │ +
    │ │ │ │ +

    Truncates files larger than specified in the file_storage, saved under │ │ │ │ +the specified save_path.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    version()

    │ │ │ │

    Declared in "libtorrent/version.hpp"

    │ │ │ │
    │ │ │ │  char const* version ();
    │ │ │ │  
    │ │ │ │

    returns the libtorrent version as string form in this format: │ │ │ │ "<major>.<minor>.<tiny>.<tag>"

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    torrent_peer_equal()

    │ │ │ │ -

    Declared in "libtorrent/torrent_peer.hpp"

    │ │ │ │ -
    │ │ │ │ -inline bool torrent_peer_equal (torrent_peer const* lhs, torrent_peer const* rhs);
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum protocol_version

    │ │ │ │ -

    Declared in "libtorrent/info_hash.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum socket_type_t

    │ │ │ │ +

    Declared in "libtorrent/socket_type.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │
    namevaluedescription
    V1
    tcp0The original BitTorrent version, using SHA-1 hashes 
    V2
    socks51Version 2 of the BitTorrent protocol, using SHA-256 hashes 
    NUM
    http2 
    utp3 
    i2p4 
    tcp_ssl5 
    socks5_ssl6 
    http_ssl7 
    utp_ssl8 
    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    enum event_t

    │ │ │ │

    Declared in "libtorrent/tracker_manager.hpp"

    │ │ │ │ │ │ │ │ @@ -862,153 +886,129 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    paused4 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum connection_type

    │ │ │ │ -

    Declared in "libtorrent/peer_connection.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum portmap_transport

    │ │ │ │ +

    Declared in "libtorrent/portmap.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ │ │ │ │
    namevaluedescription
    bittorrent
    natpmp0 natpmp can be NAT-PMP or PCP
    url_seed
    upnp1 
    http_seed2 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum socket_type_t

    │ │ │ │ -

    Declared in "libtorrent/socket_type.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum portmap_protocol

    │ │ │ │ +

    Declared in "libtorrent/portmap.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ │ │ │ │
    namevaluedescription
    tcp
    none0 
    socks5
    tcp1 
    http
    udp2 
    utp3 
    i2p4 
    tcp_ssl5 
    socks5_ssl6 
    http_ssl7 
    utp_ssl8 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum portmap_transport

    │ │ │ │ -

    Declared in "libtorrent/portmap.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum protocol_version

    │ │ │ │ +

    Declared in "libtorrent/info_hash.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    namevaluedescription
    natpmp
    V10natpmp can be NAT-PMP or PCPThe original BitTorrent version, using SHA-1 hashes
    upnp
    V21Version 2 of the BitTorrent protocol, using SHA-256 hashes
    NUM2 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum portmap_protocol

    │ │ │ │ -

    Declared in "libtorrent/portmap.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum connection_type

    │ │ │ │ +

    Declared in "libtorrent/peer_connection.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    namevaluedescription
    none
    bittorrent0 
    tcp
    url_seed1 
    udp
    http_seed2 
    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │ @@ -1027,41 +1027,14 @@ │ │ │ │
    low_priority
    │ │ │ │
    The lowest priority for files and pieces.
    │ │ │ │
    │ │ │ │
    │ │ │ │
    top_priority
    │ │ │ │
    The highest priority for files and pieces.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    pex_flags_t

    │ │ │ │ -

    Declared in "libtorrent/pex_flags.hpp"

    │ │ │ │ -
    │ │ │ │ -
    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
    │ │ │ │ -
    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    int

    │ │ │ │

    Declared in "libtorrent/version.hpp"

    │ │ │ │
    │ │ │ │
    version_major
    │ │ │ │
    the major, minor and tiny versions of libtorrent
    │ │ │ │ @@ -1206,15 +1179,15 @@ │ │ │ │ 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 add_torrent_params.

    │ │ │ │

    The stop-when-ready flag fixes the inherent race condition of waiting │ │ │ │ -for the state_changed_alert and then call pause(). The download/seeding │ │ │ │ +for the state_changed_alert and then call pause(). The download/seeding │ │ │ │ will most likely start in between posting the alert 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

    │ │ │ │ │ │ │ │ @@ -1304,14 +1277,41 @@ │ │ │ │ URL. │ │ │ │
    │ │ │ │
    │ │ │ │
    all
    │ │ │ │
    all torrent flags combined. Can conveniently be used when creating masks │ │ │ │ for flags
    │ │ │ │
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    pex_flags_t

    │ │ │ │ +

    Declared in "libtorrent/pex_flags.hpp"

    │ │ │ │ +
    │ │ │ │ +
    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
    │ │ │ │ +
    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    char const*

    │ │ │ │

    Declared in "libtorrent/version.hpp"

    │ │ │ │
    │ │ │ │
    version_str
    │ │ │ │
    the libtorrent version in string form
    │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,84 +1,84 @@ │ │ │ │ │ > │ │ │ │ │ _[_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 │ │ │ │ │ * _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_(_)_ _h_a_s___v_2_(_) │ │ │ │ │ + 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___r_e_q_u_e_s_t │ │ │ │ │ + o _o_p_e_r_a_t_o_r_=_=_(_) │ │ │ │ │ * _p_e_e_r___i_n_f_o │ │ │ │ │ o _i_2_p___d_e_s_t_i_n_a_t_i_o_n_(_) │ │ │ │ │ * _p_i_e_c_e___b_l_o_c_k │ │ │ │ │ - * _p_e_e_r___r_e_q_u_e_s_t │ │ │ │ │ - o _o_p_e_r_a_t_o_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___b_u_f_f_e_r_(_)_ _l_o_a_d___t_o_r_r_e_n_t___p_a_r_s_e_d_(_) │ │ │ │ │ - * _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_(_) │ │ │ │ │ - * _v_e_r_s_i_o_n_(_) │ │ │ │ │ * _t_o_r_r_e_n_t___p_e_e_r___e_q_u_a_l_(_) │ │ │ │ │ - * _e_n_u_m_ _p_r_o_t_o_c_o_l___v_e_r_s_i_o_n │ │ │ │ │ - * _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 │ │ │ │ │ + * _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_(_)_ _l_o_a_d___t_o_r_r_e_n_t___p_a_r_s_e_d_(_) │ │ │ │ │ + * _t_r_u_n_c_a_t_e___f_i_l_e_s_(_) │ │ │ │ │ + * _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_ _p_r_o_t_o_c_o_l___v_e_r_s_i_o_n │ │ │ │ │ + * _e_n_u_m_ _c_o_n_n_e_c_t_i_o_n___t_y_p_e │ │ │ │ │ * _d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y___t │ │ │ │ │ - * _p_e_x___f_l_a_g_s___t │ │ │ │ │ * _i_n_t │ │ │ │ │ * _t_o_r_r_e_n_t___f_l_a_g_s___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 │ │ │ │ │ [_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 (sha1_hash h1, sha256_hash h2) noexcept; │ │ │ │ │ + iinnffoo__hhaasshh__tt () noexcept = default; │ │ │ │ │ explicit iinnffoo__hhaasshh__tt (sha1_hash h1) noexcept; │ │ │ │ │ explicit iinnffoo__hhaasshh__tt (sha256_hash h2) noexcept; │ │ │ │ │ - iinnffoo__hhaasshh__tt () noexcept = default; │ │ │ │ │ - iinnffoo__hhaasshh__tt (sha1_hash h1, sha256_hash h2) noexcept; │ │ │ │ │ - bool hhaass (protocol_version v) const; │ │ │ │ │ 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 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 (sha1_hash h1, sha256_hash h2) noexcept; │ │ │ │ │ +iinnffoo__hhaasshh__tt () noexcept = default; │ │ │ │ │ explicit iinnffoo__hhaasshh__tt (sha1_hash h1) noexcept; │ │ │ │ │ explicit iinnffoo__hhaasshh__tt (sha256_hash h2) noexcept; │ │ │ │ │ -iinnffoo__hhaasshh__tt () noexcept = default; │ │ │ │ │ -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] │ │ │ │ │ -********** hhaass__vv11(()) hhaass(()) hhaass__vv22(()) ********** │ │ │ │ │ -bool hhaass (protocol_version v) const; │ │ │ │ │ +********** hhaass__vv11(()) hhaass__vv22(()) 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] │ │ │ │ │ ********** 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(()) ********** │ │ │ │ │ @@ -88,14 +88,41 @@ │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ ********** ffoorr__eeaacchh(()) ********** │ │ │ │ │ template 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__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] │ │ │ │ │ ************ 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; │ │ │ │ │ │ │ │ │ │ @@ -468,86 +495,30 @@ │ │ │ │ │ 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] │ │ │ │ │ ************ 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); │ │ │ │ │ + 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] │ │ │ │ │ -************ 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] │ │ │ │ │ -************ llooaadd__ttoorrrreenntt__ffiillee(()) llooaadd__ttoorrrreenntt__bbuuffffeerr(()) 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__ppaarrsseedd ( │ │ │ │ │ - bdecode_node const& torrent_file, load_torrent_limits const& cfg); │ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr ( │ │ │ │ │ - span buffer, load_torrent_limits const& cfg); │ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__ffiillee ( │ │ │ │ │ - std::string const& filename); │ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__ppaarrsseedd ( │ │ │ │ │ - bdecode_node const& torrent_file); │ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr ( │ │ │ │ │ - span buffer); │ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__ffiillee ( │ │ │ │ │ - std::string const& filename, 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 (torrent_handle const& handle); │ │ │ │ │ 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 │ │ │ │ │ @@ -562,59 +533,62 @@ │ │ │ │ │ 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] │ │ │ │ │ ************ 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); │ │ │ │ │ +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] │ │ │ │ │ -************ 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: │ │ │ │ │ -"..." │ │ │ │ │ -[_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); │ │ │ │ │ [_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_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +************ llooaadd__ttoorrrreenntt__ffiillee(()) llooaadd__ttoorrrreenntt__bbuuffffeerr(()) 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, load_torrent_limits const& cfg); │ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr ( │ │ │ │ │ + span buffer); │ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr ( │ │ │ │ │ + span buffer, load_torrent_limits const& cfg); │ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__ffiillee ( │ │ │ │ │ + std::string const& filename); │ │ │ │ │ +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_(_) │ │ │ │ │ [_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_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +************ 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] │ │ │ │ │ -************ 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_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +************ 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: │ │ │ │ │ +"..." │ │ │ │ │ [_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_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ @@ -622,14 +596,24 @@ │ │ │ │ │ |_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 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] │ │ │ │ │ @@ -637,41 +621,42 @@ │ │ │ │ │ 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 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] │ │ │ │ │ ************ 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] │ │ │ │ │ -************ 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] │ │ │ │ │ ************ 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 │ │ │ │ │ @@ -849,14 +834,29 @@ │ │ │ │ │ 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] │ │ │ │ │ +************ 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] │ │ │ │ │ ************ 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" │ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Create_Torrents.html │ │ │ │ @@ -41,22 +41,22 @@ │ │ │ │
  • set_creation_date()
  • │ │ │ │
  • set_hash()
  • │ │ │ │
  • set_hash2()
  • │ │ │ │
  • add_http_seed() add_url_seed()
  • │ │ │ │
  • add_node()
  • │ │ │ │
  • add_tracker()
  • │ │ │ │
  • set_root_cert()
  • │ │ │ │ -
  • set_priv() priv()
  • │ │ │ │ +
  • priv() set_priv()
  • │ │ │ │
  • num_pieces()
  • │ │ │ │
  • piece_range()
  • │ │ │ │
  • file_range()
  • │ │ │ │
  • file_piece_range()
  • │ │ │ │
  • total_size()
  • │ │ │ │ -
  • piece_length() piece_size()
  • │ │ │ │ -
  • add_collection() add_similar_torrent()
  • │ │ │ │ +
  • piece_size() piece_length()
  • │ │ │ │ +
  • add_similar_torrent() add_collection()
  • │ │ │ │ │ │ │ │ │ │ │ │
  • add_files()
  • │ │ │ │
  • set_piece_hashes()
  • │ │ │ │ │ │ │ │
    │ │ │ │

    This section describes the functions and classes that are used │ │ │ │ @@ -105,32 +105,32 @@ │ │ │ │

    This class holds state for creating a torrent. After having added │ │ │ │ all information to it, call create_torrent::generate() to generate │ │ │ │ the torrent. The entry that's returned can then be bencoded into a │ │ │ │ .torrent file using bencode().

    │ │ │ │
    │ │ │ │  struct create_torrent
    │ │ │ │  {
    │ │ │ │ -   explicit create_torrent (torrent_info const& ti);
    │ │ │ │     explicit create_torrent (file_storage& fs, int piece_size = 0
    │ │ │ │        , create_flags_t flags = {});
    │ │ │ │ +   explicit create_torrent (torrent_info const& ti);
    │ │ │ │     std::vector<char> generate_buf () const;
    │ │ │ │     entry generate () const;
    │ │ │ │     file_storage const& files () const;
    │ │ │ │     void set_comment (char const* str);
    │ │ │ │     void set_creator (char const* str);
    │ │ │ │     void set_creation_date (std::time_t timestamp);
    │ │ │ │     void set_hash (piece_index_t index, sha1_hash const& h);
    │ │ │ │     void set_hash2 (file_index_t file, piece_index_t::diff_type piece, sha256_hash const& h);
    │ │ │ │ -   void add_http_seed (string_view url);
    │ │ │ │     void add_url_seed (string_view url);
    │ │ │ │ +   void add_http_seed (string_view url);
    │ │ │ │     void add_node (std::pair<std::string, int> node);
    │ │ │ │     void add_tracker (string_view url, int tier = 0);
    │ │ │ │     void set_root_cert (string_view cert);
    │ │ │ │ -   bool priv () const;
    │ │ │ │     void set_priv (bool p);
    │ │ │ │ +   bool priv () const;
    │ │ │ │     bool is_v2_only () const;
    │ │ │ │     bool is_v1_only () const;
    │ │ │ │     int num_pieces () const;
    │ │ │ │     piece_index_t end_piece () const;
    │ │ │ │     index_range<piece_index_t> piece_range () const noexcept;
    │ │ │ │     file_index_t end_file () const;
    │ │ │ │     index_range<file_index_t> file_range () const noexcept;
    │ │ │ │ @@ -149,17 +149,17 @@
    │ │ │ │     static constexpr create_flags_t no_attributes  = 8_bit;
    │ │ │ │     static constexpr create_flags_t canonical_files_no_tail_padding  = 9_bit;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ [report issue]
    │ │ │ │

    create_torrent()

    │ │ │ │
    │ │ │ │ -explicit create_torrent (torrent_info const& ti);
    │ │ │ │  explicit create_torrent (file_storage& fs, int piece_size = 0
    │ │ │ │        , create_flags_t flags = {});
    │ │ │ │ +explicit create_torrent (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 │ │ │ │ @@ -277,16 +277,16 @@ │ │ │ │ This function will throw std::system_error if it is called on an │ │ │ │ object constructed with the v1_only flag.

    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    add_http_seed() add_url_seed()

    │ │ │ │
    │ │ │ │ -void add_http_seed (string_view url);
    │ │ │ │  void add_url_seed (string_view url);
    │ │ │ │ +void add_http_seed (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.

    │ │ │ │ @@ -320,21 +320,21 @@ │ │ │ │ │ │ │ │

    This function sets an X.509 certificate in PEM format to the torrent. This makes the │ │ │ │ torrent an SSL torrent. 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 ssl torrents.

    │ │ │ │

    The string is not the path to the cert, it's the actual content of the │ │ │ │ certificate.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_priv() priv()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    priv() set_priv()

    │ │ │ │
    │ │ │ │ -bool priv () const;
    │ │ │ │  void set_priv (bool p);
    │ │ │ │ +bool priv () 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.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │ @@ -369,29 +369,29 @@ │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    total_size()

    │ │ │ │
    │ │ │ │  std::int64_t total_size () const;
    │ │ │ │  
    │ │ │ │

    the total number of bytes of all files and pad files

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    piece_length() piece_size()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    piece_size() piece_length()

    │ │ │ │
    │ │ │ │  int piece_size (piece_index_t i) const;
    │ │ │ │  int piece_length () 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 file_storage.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_collection() add_similar_torrent()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_similar_torrent() add_collection()

    │ │ │ │
    │ │ │ │  void add_collection (string_view c);
    │ │ │ │  void add_similar_torrent (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 │ │ │ │ @@ -482,28 +482,28 @@ │ │ │ │

    The flags argument should be the same as the flags passed to the create_torrent │ │ │ │ constructor.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    set_piece_hashes()

    │ │ │ │

    Declared in "libtorrent/create_torrent.hpp"

    │ │ │ │
    │ │ │ │ +inline void set_piece_hashes (create_torrent& t, std::string const& p, error_code& ec);
    │ │ │ │ +inline void set_piece_hashes (create_torrent& t, std::string const& p);
    │ │ │ │  inline void set_piece_hashes (create_torrent& t, std::string const& p
    │ │ │ │ +   , settings_interface const& settings
    │ │ │ │     , std::function<void(piece_index_t)> const& f);
    │ │ │ │ -inline void set_piece_hashes (create_torrent& t, std::string const& p);
    │ │ │ │  void set_piece_hashes (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 set_piece_hashes (create_torrent& t, std::string const& p
    │ │ │ │ -   , settings_interface const& settings
    │ │ │ │     , std::function<void(piece_index_t)> const& f);
    │ │ │ │ -inline void set_piece_hashes (create_torrent& t, std::string const& p, error_code& ec);
    │ │ │ │  void set_piece_hashes (create_torrent& t, std::string const& p
    │ │ │ │     , settings_interface const& settings
    │ │ │ │     , std::function<void(piece_index_t)> const& f, error_code& ec);
    │ │ │ │  void set_piece_hashes (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:

    │ │ │ │
    │ │ │ │ ├── html2text {}
    │ │ │ │ │ @@ -12,22 +12,22 @@
    │ │ │ │ │            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 _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_(_)
    │ │ │ │ │ +          o _p_i_e_c_e___s_i_z_e_(_)_ _p_i_e_c_e___l_e_n_g_t_h_(_)
    │ │ │ │ │ +          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.
    │ │ │ │ │     2. the torrent properties are set, such as tracker url, web seeds, DHT nodes
    │ │ │ │ │ @@ -66,33 +66,33 @@
    │ │ │ │ │  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 ggeenneerraattee__bbuuff () const;
    │ │ │ │ │     entry ggeenneerraattee () 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__hhttttpp__sseeeedd (string_view url);
    │ │ │ │ │     void aadddd__nnooddee (std::pair 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 pprriivv () const;
    │ │ │ │ │     bool iiss__vv22__oonnllyy () const;
    │ │ │ │ │     bool iiss__vv11__oonnllyy () const;
    │ │ │ │ │     int nnuumm__ppiieecceess () const;
    │ │ │ │ │     piece_index_t eenndd__ppiieeccee () const;
    │ │ │ │ │     index_range ppiieeccee__rraannggee () const noexcept;
    │ │ │ │ │     file_index_t eenndd__ffiillee () const;
    │ │ │ │ │     index_range ffiillee__rraannggee () const noexcept;
    │ │ │ │ │ @@ -109,17 +109,17 @@
    │ │ │ │ │     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
    │ │ │ │ │ @@ -199,16 +199,16 @@
    │ │ │ │ │  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__hhttttpp__sseeeedd (string_view url);
    │ │ │ │ │  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]
    │ │ │ │ │ @@ -235,17 +235,17 @@
    │ │ │ │ │  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(()) **********
    │ │ │ │ │ -bool pprriivv () const;
    │ │ │ │ │ +********** pprriivv(()) sseett__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.
    │ │ │ │ │ @@ -263,22 +263,22 @@
    │ │ │ │ │  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(()) **********
    │ │ │ │ │ +********** ppiieeccee__ssiizzee(()) ppiieeccee__lleennggtthh(()) **********
    │ │ │ │ │  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(()) **********
    │ │ │ │ │ +********** aadddd__ssiimmiillaarr__ttoorrrreenntt(()) aadddd__ccoolllleeccttiioonn(()) **********
    │ │ │ │ │  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.
    │ │ │ │ │ @@ -348,29 +348,29 @@
    │ │ │ │ │  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"
    │ │ │ │ │ +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);
    │ │ │ │ │  inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
    │ │ │ │ │ +   , settings_interface const& settings
    │ │ │ │ │     , std::function const& f);
    │ │ │ │ │ -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, disk_io_constructor_type disk_io
    │ │ │ │ │     , std::function const& f, error_code& ec);
    │ │ │ │ │  inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
    │ │ │ │ │ -   , settings_interface const& settings
    │ │ │ │ │     , std::function 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
    │ │ │ │ │     , std::function const& f, 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 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
    │ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Custom_Storage.html
    │ │ │ │ @@ -32,15 +32,15 @@
    │ │ │ │  
    │ │ │ │

    Table of contents

    │ │ │ │
    │ │ │ │

    You have some control over session configuration through the session::apply_settings() │ │ │ │ member function. To change one or more configuration options, create a settings_pack │ │ │ │ object and fill it with the settings to be set and pass it in to session::apply_settings().

    │ │ │ │

    The settings_pack object is a collection of settings updates that are applied │ │ │ │ @@ -199,18 +199,18 @@ │ │ │ │

    remove_torrent()

    │ │ │ │
    │ │ │ │  virtual void remove_torrent (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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    async_write() async_read()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    async_read() async_write()

    │ │ │ │
    │ │ │ │  virtual void async_read (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 async_write (storage_index_t storage, peer_request const& r
    │ │ │ │        , char const* buf, std::shared_ptr<disk_observer> o
    │ │ │ │        , std::function<void(storage_error const&)> handler
    │ │ │ │ @@ -469,64 +469,27 @@
    │ │ │ │  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 session, this holder is destructed and will
    │ │ │ │  inform the disk object.

    │ │ │ │
    │ │ │ │  struct storage_holder
    │ │ │ │  {
    │ │ │ │ -   storage_holder () = default;
    │ │ │ │     ~storage_holder ();
    │ │ │ │     storage_holder (storage_index_t idx, disk_interface& disk_io);
    │ │ │ │ +   storage_holder () = default;
    │ │ │ │     explicit operator bool () const;
    │ │ │ │     operator storage_index_t () const;
    │ │ │ │     void reset ();
    │ │ │ │ -   storage_holder (storage_holder const&) = delete;
    │ │ │ │     storage_holder& operator= (storage_holder const&) = delete;
    │ │ │ │ +   storage_holder (storage_holder const&) = delete;
    │ │ │ │     storage_holder (storage_holder&& rhs) noexcept;
    │ │ │ │     storage_holder& operator= (storage_holder&& rhs) noexcept;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    settings_interface

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ -

    the common interface to settings_pack and the internal representation of │ │ │ │ -settings.

    │ │ │ │ -
    │ │ │ │ -struct settings_interface
    │ │ │ │ -{
    │ │ │ │ -   virtual bool has_val (int name) const = 0;
    │ │ │ │ -   virtual void set_bool (int name, bool val) = 0;
    │ │ │ │ -   virtual void set_int (int name, int val) = 0;
    │ │ │ │ -   virtual void set_str (int name, std::string val) = 0;
    │ │ │ │ -   virtual int get_int (int name) const = 0;
    │ │ │ │ -   virtual std::string const& get_str (int name) const = 0;
    │ │ │ │ -   virtual bool get_bool (int name) const = 0;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    disk_observer

    │ │ │ │ -

    Declared in "libtorrent/disk_observer.hpp"

    │ │ │ │ -
    │ │ │ │ -struct disk_observer
    │ │ │ │ -{
    │ │ │ │ -   virtual void on_disk () = 0;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    on_disk()

    │ │ │ │ -
    │ │ │ │ -virtual void on_disk () = 0;
    │ │ │ │ -
    │ │ │ │ -

    called when the disk cache size has dropped │ │ │ │ -below the low watermark again and we can │ │ │ │ -resume downloading from peers

    │ │ │ │ [report issue]
    │ │ │ │ -
    │ │ │ │
    │ │ │ │

    buffer_allocator_interface

    │ │ │ │

    Declared in "libtorrent/disk_buffer_holder.hpp"

    │ │ │ │

    the interface for freeing disk buffers, used by the disk_buffer_holder. │ │ │ │ when implementing disk_interface, this must also be implemented in order │ │ │ │ to return disk buffers back to libtorrent

    │ │ │ │
    │ │ │ │ @@ -542,18 +505,18 @@
    │ │ │ │  

    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& operator= (disk_buffer_holder&&) & noexcept;
    │ │ │ │     disk_buffer_holder (disk_buffer_holder&&) noexcept;
    │ │ │ │ -   disk_buffer_holder& operator= (disk_buffer_holder const&) = delete;
    │ │ │ │ +   disk_buffer_holder& operator= (disk_buffer_holder&&) & noexcept;
    │ │ │ │     disk_buffer_holder (disk_buffer_holder const&) = delete;
    │ │ │ │ +   disk_buffer_holder& operator= (disk_buffer_holder const&) = delete;
    │ │ │ │     disk_buffer_holder (buffer_allocator_interface& alloc
    │ │ │ │        , char* buf, int sz) noexcept;
    │ │ │ │     disk_buffer_holder () noexcept = default;
    │ │ │ │     ~disk_buffer_holder ();
    │ │ │ │     char* data () const noexcept;
    │ │ │ │     void reset ();
    │ │ │ │     void swap (disk_buffer_holder& h) noexcept;
    │ │ │ │ @@ -618,16 +581,53 @@
    │ │ │ │  
    │ │ │ │

    bool()

    │ │ │ │
    │ │ │ │  explicit operator bool () const noexcept;
    │ │ │ │  
    │ │ │ │

    implicitly convertible to true if the object is currently holding a │ │ │ │ buffer

    │ │ │ │ -[report issue]
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    disk_observer

    │ │ │ │ +

    Declared in "libtorrent/disk_observer.hpp"

    │ │ │ │ +
    │ │ │ │ +struct disk_observer
    │ │ │ │ +{
    │ │ │ │ +   virtual void on_disk () = 0;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    on_disk()

    │ │ │ │ +
    │ │ │ │ +virtual void on_disk () = 0;
    │ │ │ │ +
    │ │ │ │ +

    called when the disk cache size has dropped │ │ │ │ +below the low watermark again and we can │ │ │ │ +resume downloading from peers

    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ +
    │ │ │ │ +

    settings_interface

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ +

    the common interface to settings_pack and the internal representation of │ │ │ │ +settings.

    │ │ │ │ +
    │ │ │ │ +struct settings_interface
    │ │ │ │ +{
    │ │ │ │ +   virtual void set_bool (int name, bool val) = 0;
    │ │ │ │ +   virtual bool has_val (int name) const = 0;
    │ │ │ │ +   virtual void set_str (int name, std::string val) = 0;
    │ │ │ │ +   virtual void set_int (int name, int val) = 0;
    │ │ │ │ +   virtual bool get_bool (int name) const = 0;
    │ │ │ │ +   virtual std::string const& get_str (int name) const = 0;
    │ │ │ │ +   virtual int get_int (int name) const = 0;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │

    file_open_mode_t

    │ │ │ │

    Declared in "libtorrent/disk_interface.hpp"

    │ │ │ │
    │ │ │ │
    read_only
    │ │ │ │
    open the file for reading only
    │ │ │ │
    │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -3,15 +3,15 @@ │ │ │ │ │ VVeerrssiioonn:: 2.0.11 │ │ │ │ │ _h_o_m_e │ │ │ │ │ Table of contents │ │ │ │ │ * _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___w_r_i_t_e_(_)_ _a_s_y_n_c___r_e_a_d_(_) │ │ │ │ │ + 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_(_) │ │ │ │ │ @@ -20,27 +20,27 @@ │ │ │ │ │ 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 │ │ │ │ │ - * _d_i_s_k___o_b_s_e_r_v_e_r │ │ │ │ │ - o _o_n___d_i_s_k_(_) │ │ │ │ │ * _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_(_) │ │ │ │ │ + * _s_e_t_t_i_n_g_s___i_n_t_e_r_f_a_c_e │ │ │ │ │ * _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 │ │ │ │ │ @@ -159,15 +159,15 @@ │ │ │ │ │ [_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__wwrriittee(()) aassyynncc__rreeaadd(()) ********** │ │ │ │ │ +********** aassyynncc__rreeaadd(()) aassyynncc__wwrriittee(()) ********** │ │ │ │ │ virtual void aassyynncc__rreeaadd (storage_index_t storage, peer_request const& r │ │ │ │ │ , std::function 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 o │ │ │ │ │ , std::function handler │ │ │ │ │ , disk_job_flags_t flags = {}) = 0; │ │ │ │ │ @@ -361,53 +361,26 @@ │ │ │ │ │ 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 (); │ │ │ │ │ ssttoorraaggee__hhoollddeerr (storage_index_t idx, disk_interface& disk_io); │ │ │ │ │ + ssttoorraaggee__hhoollddeerr () = default; │ │ │ │ │ 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 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 bool hhaass__vvaall (int name) const = 0; │ │ │ │ │ - virtual void sseett__bbooooll (int name, bool val) = 0; │ │ │ │ │ - virtual void sseett__iinntt (int name, int val) = 0; │ │ │ │ │ - virtual void sseett__ssttrr (int name, std::string val) = 0; │ │ │ │ │ - virtual int ggeett__iinntt (int name) const = 0; │ │ │ │ │ - virtual std::string const& ggeett__ssttrr (int name) const = 0; │ │ │ │ │ - virtual bool ggeett__bbooooll (int name) const = 0; │ │ │ │ │ -}; │ │ │ │ │ -[_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] │ │ │ │ │ ************ 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 │ │ │ │ │ { │ │ │ │ │ @@ -418,18 +391,18 @@ │ │ │ │ │ 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; │ │ │ │ │ - disk_buffer_holder& ooppeerraattoorr== (disk_buffer_holder const&) = delete; │ │ │ │ │ + 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; │ │ │ │ │ @@ -469,14 +442,41 @@ │ │ │ │ │ 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] │ │ │ │ │ +************ 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] │ │ │ │ │ +************ 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__bbooooll (int name, bool val) = 0; │ │ │ │ │ + virtual bool hhaass__vvaall (int name) const = 0; │ │ │ │ │ + virtual void sseett__ssttrr (int name, std::string val) = 0; │ │ │ │ │ + virtual void sseett__iinntt (int name, int 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] │ │ │ │ │ ************ 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 │ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-DHT.html │ │ │ │ @@ -47,16 +47,16 @@ │ │ │ │
  • put_mutable_item()
  • │ │ │ │
  • get_infohashes_sample()
  • │ │ │ │
  • tick()
  • │ │ │ │
  • counters()
  • │ │ │ │ │ │ │ │ │ │ │ │
  • dht_state
  • │ │ │ │ -
  • sign_mutable_item()
  • │ │ │ │ -
  • dht_default_storage_constructor()
  • │ │ │ │ +
  • dht_default_storage_constructor()
  • │ │ │ │ +
  • sign_mutable_item()
  • │ │ │ │
  • announce_flags_t
  • │ │ │ │ │ │ │ │
    │ │ │ │ [report issue]
    │ │ │ │

    dht_storage_counters

    │ │ │ │

    Declared in "libtorrent/kademlia/dht_storage.hpp"

    │ │ │ │

    This structure hold the relevant counters for the storage

    │ │ │ │ @@ -309,14 +309,25 @@ │ │ │ │
    nodes
    │ │ │ │
    the bootstrap nodes saved from the buckets node
    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    nodes6
    │ │ │ │
    the bootstrap nodes saved from the IPv6 buckets node
    │ │ │ │
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_default_storage_constructor()

    │ │ │ │ +

    Declared in "libtorrent/kademlia/dht_storage.hpp"

    │ │ │ │ +
    │ │ │ │ +std::unique_ptr<dht_storage_interface> dht_default_storage_constructor (
    │ │ │ │ +   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.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    sign_mutable_item()

    │ │ │ │

    Declared in "libtorrent/kademlia/item.hpp"

    │ │ │ │
    │ │ │ │  signature sign_mutable_item (
    │ │ │ │     span<char const> v
    │ │ │ │ @@ -327,25 +338,14 @@
    │ │ │ │  
    │ │ │ │

    given a byte range v and an optional byte range salt, a │ │ │ │ sequence number, public key pk (must be 32 bytes) and a secret key │ │ │ │ sk (must be 64 bytes), this function produces a signature which │ │ │ │ is written into a 64 byte buffer pointed to by sig. The caller │ │ │ │ is responsible for allocating the destination buffer that's passed in │ │ │ │ as the sig argument. Typically it would be allocated on the stack.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_default_storage_constructor()

    │ │ │ │ -

    Declared in "libtorrent/kademlia/dht_storage.hpp"

    │ │ │ │ -
    │ │ │ │ -std::unique_ptr<dht_storage_interface> dht_default_storage_constructor (
    │ │ │ │ -   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.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    announce_flags_t

    │ │ │ │

    Declared in "libtorrent/kademlia/announce_flags.hpp"

    │ │ │ │
    │ │ │ │
    seed
    │ │ │ │
    announce to DHT as a seed
    │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -14,16 +14,16 @@ │ │ │ │ │ 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 │ │ │ │ │ - * _s_i_g_n___m_u_t_a_b_l_e___i_t_e_m_(_) │ │ │ │ │ * _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__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 │ │ │ │ │ { │ │ │ │ │ @@ -210,36 +210,36 @@ │ │ │ │ │ [_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 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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ ************ ssiiggnn__mmuuttaabbllee__iitteemm(()) ************ │ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_i_t_e_m_._h_p_p" │ │ │ │ │ signature ssiiggnn__mmuuttaabbllee__iitteemm ( │ │ │ │ │ span v │ │ │ │ │ , span salt │ │ │ │ │ , sequence_number seq │ │ │ │ │ , public_key const& pk │ │ │ │ │ , secret_key const& sk); │ │ │ │ │ given a byte range v and an optional byte range salt, a sequence number, public │ │ │ │ │ key pk (must be 32 bytes) and a secret key sk (must be 64 bytes), this function │ │ │ │ │ produces a signature which is written into a 64 byte buffer pointed to by sig. │ │ │ │ │ The caller is responsible for allocating the destination buffer that's passed │ │ │ │ │ in as the sig argument. Typically it would be allocated on the stack. │ │ │ │ │ [_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 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ ************ aannnnoouunnccee__ffllaaggss__tt ************ │ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_a_n_n_o_u_n_c_e___f_l_a_g_s_._h_p_p" │ │ │ │ │ seed │ │ │ │ │ announce to DHT as a seed │ │ │ │ │ implied_port │ │ │ │ │ announce to DHT with the implied-port flag set. This tells the network to │ │ │ │ │ use your source UDP port as your listen port, rather than the one │ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Error_Codes.html │ │ │ │ @@ -33,44 +33,44 @@ │ │ │ │

    Table of contents

    │ │ │ │ │ │ │ │
    │ │ │ │ [report issue]
    │ │ │ │

    storage_error

    │ │ │ │

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │

    used by storage to return errors │ │ │ │ also includes which underlying file the │ │ │ │ error happened on

    │ │ │ │
    │ │ │ │  struct storage_error
    │ │ │ │  {
    │ │ │ │     explicit operator bool () const;
    │ │ │ │ -   file_index_t file () const;
    │ │ │ │     void file (file_index_t f);
    │ │ │ │ +   file_index_t file () const;
    │ │ │ │  
    │ │ │ │     error_code ec;
    │ │ │ │     operation_t operation;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ [report issue]
    │ │ │ │

    bool()

    │ │ │ │ @@ -79,31 +79,54 @@ │ │ │ │ │ │ │ │

    explicitly converts to true if this object represents an error, and │ │ │ │ false if it does not.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    file()

    │ │ │ │
    │ │ │ │ -file_index_t file () const;
    │ │ │ │  void file (file_index_t f);
    │ │ │ │ +file_index_t file () const;
    │ │ │ │  
    │ │ │ │

    set and query the index (in the torrent) of the file this error │ │ │ │ occurred on. This may also have special values defined in │ │ │ │ torrent_status.

    │ │ │ │ [report issue]
    │ │ │ │
    ec
    │ │ │ │
    the error that occurred
    │ │ │ │
    │ │ │ │ [report issue]
    │ │ │ │
    operation
    │ │ │ │
    A code from operation_t enum, indicating what │ │ │ │ kind of operation failed.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ +
    │ │ │ │ +

    i2p_category()

    │ │ │ │ +

    Declared in "libtorrent/i2p_stream.hpp"

    │ │ │ │ +
    │ │ │ │ +boost::system::error_category& i2p_category ();
    │ │ │ │ +
    │ │ │ │ +

    returns the error category for I2P errors

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    bdecode_category()

    │ │ │ │ +

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ +
    │ │ │ │ +boost::system::error_category& bdecode_category ();
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    socks_category()

    │ │ │ │ +

    Declared in "libtorrent/socks5_stream.hpp"

    │ │ │ │ +
    │ │ │ │ +boost::system::error_category& socks_category ();
    │ │ │ │ +
    │ │ │ │ +

    returns the error_category for SOCKS5 errors

    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │

    libtorrent_category()

    │ │ │ │

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │
    │ │ │ │  boost::system::error_category& libtorrent_category ();
    │ │ │ │  
    │ │ │ │

    return the instance of the libtorrent_error_category which │ │ │ │ @@ -112,63 +135,217 @@ │ │ │ │

    │ │ │ │

    http_category()

    │ │ │ │

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │
    │ │ │ │  boost::system::error_category& http_category ();
    │ │ │ │  
    │ │ │ │

    returns the error_category for HTTP errors

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    pcp_category()

    │ │ │ │ -

    Declared in "libtorrent/natpmp.hpp"

    │ │ │ │ -
    │ │ │ │ -boost::system::error_category& pcp_category ();
    │ │ │ │ -
    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    upnp_category()

    │ │ │ │

    Declared in "libtorrent/upnp.hpp"

    │ │ │ │
    │ │ │ │  boost::system::error_category& upnp_category ();
    │ │ │ │  
    │ │ │ │

    the boost.system error category for UPnP errors

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    pcp_category()

    │ │ │ │ +

    Declared in "libtorrent/natpmp.hpp"

    │ │ │ │ +
    │ │ │ │ +boost::system::error_category& pcp_category ();
    │ │ │ │ +
    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    gzip_category()

    │ │ │ │

    Declared in "libtorrent/gzip.hpp"

    │ │ │ │
    │ │ │ │  boost::system::error_category& gzip_category ();
    │ │ │ │  
    │ │ │ │

    get the error_category for zip errors

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    socks_category()

    │ │ │ │ -

    Declared in "libtorrent/socks5_stream.hpp"

    │ │ │ │ -
    │ │ │ │ -boost::system::error_category& socks_category ();
    │ │ │ │ -
    │ │ │ │ -

    returns the error_category for SOCKS5 errors

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    i2p_category()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum i2p_error_code

    │ │ │ │

    Declared in "libtorrent/i2p_stream.hpp"

    │ │ │ │ -
    │ │ │ │ -boost::system::error_category& i2p_category ();
    │ │ │ │ -
    │ │ │ │ -

    returns the error category for I2P errors

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    bdecode_category()

    │ │ │ │ -

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ -
    │ │ │ │ -boost::system::error_category& bdecode_category ();
    │ │ │ │ -
    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    no_error0 
    parse_failed1 
    cant_reach_peer2 
    i2p_error3 
    invalid_key4 
    invalid_id5 
    timeout6 
    key_not_found7 
    duplicated_id8 
    num_errors9 
    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    enum error_code_enum

    │ │ │ │ +

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    no_error0Not an error
    expected_digit1expected digit in bencoded string
    expected_colon2expected colon in bencoded string
    unexpected_eof3unexpected end of file in bencoded string
    expected_value4expected value (list, dict, int or string) in bencoded string
    depth_exceeded5bencoded recursion depth limit exceeded
    limit_exceeded6bencoded item count limit exceeded
    overflow7integer overflow
    error_code_max8the number of error codes
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum socks_error_code

    │ │ │ │ +

    Declared in "libtorrent/socks5_stream.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    no_error0 
    unsupported_version1 
    unsupported_authentication_method2 
    unsupported_authentication_version3 
    authentication_error4 
    username_required5 
    general_failure6 
    command_not_supported7 
    no_identd8 
    identd_error9 
    num_errors10 
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum error_code_enum

    │ │ │ │

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -991,14 +1168,83 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    service_unavailable503 
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum error_code_enum

    │ │ │ │ +

    Declared in "libtorrent/upnp.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    no_error0No error
    invalid_argument402One of the arguments in the request is invalid
    action_failed501The request failed
    value_not_in_array714The specified value does not exist in the array
    source_ip_cannot_be_wildcarded715The source IP address cannot be wild-carded, but │ │ │ │ +must be fully specified
    external_port_cannot_be_wildcarded716The external port cannot be a wildcard, but must │ │ │ │ +be specified
    port_mapping_conflict718The port mapping entry specified conflicts with a │ │ │ │ +mapping assigned previously to another client
    internal_port_must_match_external724Internal and external port value must be the same
    only_permanent_leases_supported725The NAT implementation only supports permanent │ │ │ │ +lease times on port mappings
    remote_host_must_be_wildcard726RemoteHost must be a wildcard and cannot be a │ │ │ │ +specific IP address or DNS name
    external_port_must_be_wildcard727ExternalPort must be a wildcard and cannot be a │ │ │ │ +specific port
    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    enum pcp_errors

    │ │ │ │

    Declared in "libtorrent/natpmp.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1067,84 +1313,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    pcp_excessive_remote_peers13 
    │ │ │ │ [report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum error_code_enum

    │ │ │ │ -

    Declared in "libtorrent/upnp.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    no_error0No error
    invalid_argument402One of the arguments in the request is invalid
    action_failed501The request failed
    value_not_in_array714The specified value does not exist in the array
    source_ip_cannot_be_wildcarded715The source IP address cannot be wild-carded, but │ │ │ │ -must be fully specified
    external_port_cannot_be_wildcarded716The external port cannot be a wildcard, but must │ │ │ │ -be specified
    port_mapping_conflict718The port mapping entry specified conflicts with a │ │ │ │ -mapping assigned previously to another client
    internal_port_must_match_external724Internal and external port value must be the same
    only_permanent_leases_supported725The NAT implementation only supports permanent │ │ │ │ -lease times on port mappings
    remote_host_must_be_wildcard726RemoteHost must be a wildcard and cannot be a │ │ │ │ -specific IP address or DNS name
    external_port_must_be_wildcard727ExternalPort must be a wildcard and cannot be a │ │ │ │ -specific port
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ +
    │ │ │ │

    enum error_code_enum

    │ │ │ │

    Declared in "libtorrent/gzip.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1223,191 +1400,14 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    error_code_max16the number of error codes
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum socks_error_code

    │ │ │ │ -

    Declared in "libtorrent/socks5_stream.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    no_error0 
    unsupported_version1 
    unsupported_authentication_method2 
    unsupported_authentication_version3 
    authentication_error4 
    username_required5 
    general_failure6 
    command_not_supported7 
    no_identd8 
    identd_error9 
    num_errors10 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum i2p_error_code

    │ │ │ │ -

    Declared in "libtorrent/i2p_stream.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    no_error0 
    parse_failed1 
    cant_reach_peer2 
    i2p_error3 
    invalid_key4 
    invalid_id5 
    timeout6 
    key_not_found7 
    duplicated_id8 
    num_errors9 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum error_code_enum

    │ │ │ │ -

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    no_error0Not an error
    expected_digit1expected digit in bencoded string
    expected_colon2expected colon in bencoded string
    unexpected_eof3unexpected end of file in bencoded string
    expected_value4expected value (list, dict, int or string) in bencoded string
    depth_exceeded5bencoded recursion depth limit exceeded
    limit_exceeded6bencoded item count limit exceeded
    overflow7integer overflow
    error_code_max8the number of error codes
    │ │ │ │
    │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │ -
    │ │ │ │ -

    on_dont_have() on_choke() on_have() on_have_none() on_not_interested() on_interested() on_bitfield() on_allowed_fast() on_request() on_unchoke() on_have_all()

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_unchoke() on_bitfield() on_choke() on_have_none() on_have_all() on_have() on_request() on_interested() on_not_interested() on_dont_have() on_allowed_fast()

    │ │ │ │
    │ │ │ │ -virtual bool on_bitfield (bitfield const& /*bitfield*/);
    │ │ │ │  virtual bool on_choke ();
    │ │ │ │ -virtual bool on_unchoke ();
    │ │ │ │ -virtual bool on_request (peer_request const&);
    │ │ │ │ -virtual bool on_have_all ();
    │ │ │ │ +virtual bool on_have (piece_index_t);
    │ │ │ │ +virtual bool on_bitfield (bitfield const& /*bitfield*/);
    │ │ │ │  virtual bool on_have_none ();
    │ │ │ │  virtual bool on_dont_have (piece_index_t);
    │ │ │ │ -virtual bool on_have (piece_index_t);
    │ │ │ │  virtual bool on_interested ();
    │ │ │ │ +virtual bool on_request (peer_request const&);
    │ │ │ │ +virtual bool on_unchoke ();
    │ │ │ │ +virtual bool on_have_all ();
    │ │ │ │  virtual bool on_allowed_fast (piece_index_t);
    │ │ │ │  virtual bool on_not_interested ();
    │ │ │ │  
    │ │ │ │

    returning true from any of the message handlers │ │ │ │ indicates that the plugin has handled the message. │ │ │ │ it will break the plugin chain traversing and not let │ │ │ │ anyone else handle the message, including the default │ │ │ │ @@ -615,25 +615,25 @@ │ │ │ │ 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.

    │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    sent_piece() sent_have() sent_not_interested() sent_interested() sent_unchoke()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    sent_piece() sent_have() sent_unchoke() sent_interested() sent_not_interested()

    │ │ │ │
    │ │ │ │ -virtual void sent_have (piece_index_t);
    │ │ │ │ -virtual void sent_not_interested ();
    │ │ │ │  virtual void sent_unchoke ();
    │ │ │ │  virtual void sent_interested ();
    │ │ │ │  virtual void sent_piece (peer_request const&);
    │ │ │ │ +virtual void sent_have (piece_index_t);
    │ │ │ │ +virtual void sent_not_interested ();
    │ │ │ │  
    │ │ │ │

    called after a choke message has been sent to the peer

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    sent_payload()

    │ │ │ │
    │ │ │ │  virtual void sent_payload (int /* bytes */);
    │ │ │ │ @@ -669,18 +669,18 @@
    │ │ │ │  
    │ │ │ │

    on_unknown_message()

    │ │ │ │
    │ │ │ │  virtual bool on_unknown_message (int /*length*/, int /*msg*/,
    │ │ │ │        span<char const> /*body*/);
    │ │ │ │  
    │ │ │ │

    this is not called for web seeds

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_piece_failed() on_piece_pass()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_piece_pass() on_piece_failed()

    │ │ │ │
    │ │ │ │  virtual void on_piece_failed (piece_index_t);
    │ │ │ │  virtual void on_piece_pass (piece_index_t);
    │ │ │ │  
    │ │ │ │

    called when a piece that this peer participated in either │ │ │ │ fails or passes the hash_check

    │ │ │ │ [report issue]
    │ │ │ │ @@ -703,16 +703,16 @@ │ │ │ │
    │ │ │ │
    │ │ │ │

    crypto_plugin

    │ │ │ │

    Declared in "libtorrent/extensions.hpp"

    │ │ │ │
    │ │ │ │  struct crypto_plugin
    │ │ │ │  {
    │ │ │ │ -   virtual void set_incoming_key (span<char const> key) = 0;
    │ │ │ │     virtual void set_outgoing_key (span<char const> key) = 0;
    │ │ │ │ +   virtual void set_incoming_key (span<char const> key) = 0;
    │ │ │ │     encrypt (span<span<char>> /*send_vec*/) = 0;
    │ │ │ │     virtual std::tuple<int, int, int> decrypt (span<span<char>> /*receive_vec*/) = 0;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ [report issue]
    │ │ │ │

    decrypt()

    │ │ │ │
    │ │ │ │ @@ -744,33 +744,33 @@
    │ │ │ │     void add_extension (std::shared_ptr<peer_plugin>);
    │ │ │ │     bool is_seed () const;
    │ │ │ │     bool upload_only () const;
    │ │ │ │     peer_id const& pid () const;
    │ │ │ │     bool has_piece (piece_index_t i) const;
    │ │ │ │     bool is_choked () const;
    │ │ │ │     bool is_interesting () const;
    │ │ │ │ -   bool has_peer_choked () const;
    │ │ │ │     bool is_peer_interested () const;
    │ │ │ │ -   void choke_this_peer ();
    │ │ │ │ +   bool has_peer_choked () const;
    │ │ │ │     void maybe_unchoke_this_peer ();
    │ │ │ │ +   void choke_this_peer ();
    │ │ │ │     void get_peer_info (peer_info& p) const;
    │ │ │ │     torrent_handle associated_torrent () const;
    │ │ │ │     tcp::endpoint const& remote () const;
    │ │ │ │     tcp::endpoint local_endpoint () const;
    │ │ │ │ +   bool is_outgoing () const;
    │ │ │ │     bool is_disconnecting () const;
    │ │ │ │ +   bool is_connecting () const;
    │ │ │ │     void disconnect (error_code const& ec, operation_t op
    │ │ │ │        , disconnect_severity_t = peer_connection_interface::normal);
    │ │ │ │ -   bool is_connecting () const;
    │ │ │ │ -   bool is_outgoing () const;
    │ │ │ │ -   bool ignore_unchoke_slots () const;
    │ │ │ │     bool on_local_network () const;
    │ │ │ │ +   bool ignore_unchoke_slots () const;
    │ │ │ │     bool failed () const;
    │ │ │ │ -   bool should_log (peer_log_alert::direction_t direction) const;
    │ │ │ │     void peer_log (peer_log_alert::direction_t direction
    │ │ │ │        , char const* event, char const* fmt = "", ...) const TORRENT_FORMAT(4,5);
    │ │ │ │ +   bool should_log (peer_log_alert::direction_t direction) const;
    │ │ │ │     bool can_disconnect (error_code const& ec) const;
    │ │ │ │     bool has_metadata () const;
    │ │ │ │     bool in_handshake () const;
    │ │ │ │     void send_buffer (char const* begin, int size);
    │ │ │ │     time_point time_of_last_unchoke () const;
    │ │ │ │     std::time_t last_seen_complete () const;
    │ │ │ │     bool operator< (peer_connection_handle const& o) const;
    │ │ │ │ @@ -789,19 +789,33 @@
    │ │ │ │  
    │ │ │ │  struct bt_peer_connection_handle : peer_connection_handle
    │ │ │ │  {
    │ │ │ │     explicit bt_peer_connection_handle (peer_connection_handle pc);
    │ │ │ │     bool packet_finished () const;
    │ │ │ │     bool support_extensions () const;
    │ │ │ │     bool supports_encryption () const;
    │ │ │ │ -   void switch_recv_crypto (std::shared_ptr<crypto_plugin> crypto);
    │ │ │ │     void switch_send_crypto (std::shared_ptr<crypto_plugin> crypto);
    │ │ │ │ +   void switch_recv_crypto (std::shared_ptr<crypto_plugin> crypto);
    │ │ │ │     std::shared_ptr<bt_peer_connection> native_handle () const;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    create_ut_pex_plugin()

    │ │ │ │ +

    Declared in "libtorrent/extensions/ut_pex.hpp"

    │ │ │ │ +
    │ │ │ │ +std::shared_ptr<torrent_plugin> create_ut_pex_plugin (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 session constructor.

    │ │ │ │ +

    This can either be passed in the add_torrent_params::extensions field, or │ │ │ │ +via torrent_handle::add_extension().

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    create_ut_metadata_plugin()

    │ │ │ │

    Declared in "libtorrent/extensions/ut_metadata.hpp"

    │ │ │ │
    │ │ │ │  std::shared_ptr<torrent_plugin> create_ut_metadata_plugin (torrent_handle const&, client_data_t);
    │ │ │ │  
    │ │ │ │ @@ -822,28 +836,14 @@ │ │ │ │ │ │ │ │

    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 torrent_handle::add_extension().

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    create_ut_pex_plugin()

    │ │ │ │ -

    Declared in "libtorrent/extensions/ut_pex.hpp"

    │ │ │ │ -
    │ │ │ │ -std::shared_ptr<torrent_plugin> create_ut_pex_plugin (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 session constructor.

    │ │ │ │ -

    This can either be passed in the add_torrent_params::extensions field, or │ │ │ │ -via torrent_handle::add_extension().

    │ │ │ │
    │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │
    │ │ │ │

    generate_fingerprint()

    │ │ │ │

    Declared in "libtorrent/fingerprint.hpp"

    │ │ │ │
    │ │ │ │  std::string generate_fingerprint (std::string name
    │ │ │ │     , int major, int minor = 0, int revision = 0, int tag = 0);
    │ │ │ │  
    │ │ │ │ @@ -5202,14 +5154,62 @@ │ │ │ │ Tribler │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

    There's an informal directory of client id's here.

    │ │ │ │

    The major, minor, revision and tag parameters are used to │ │ │ │ identify the version of your client.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    high_performance_seed() min_memory_usage()

    │ │ │ │ +

    Declared in "libtorrent/session.hpp"

    │ │ │ │ +
    │ │ │ │ +settings_pack high_performance_seed ();
    │ │ │ │ +settings_pack min_memory_usage ();
    │ │ │ │ +
    │ │ │ │ +

    The default values of the session settings are set for a regular │ │ │ │ +bittorrent client running on a desktop system. There are functions that │ │ │ │ +can set the session 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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    setting_by_name() name_for_setting()

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ +
    │ │ │ │ +char const* name_for_setting (int s);
    │ │ │ │ +int setting_by_name (string_view name);
    │ │ │ │ +
    │ │ │ │ +

    converts a setting integer (from the enums string_types, int_types or │ │ │ │ +bool_types) to a string, and vice versa.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    default_settings()

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ +
    │ │ │ │ +settings_pack default_settings ();
    │ │ │ │ +
    │ │ │ │ +

    returns a settings_pack with every setting set to its default value

    │ │ │ │
    │ │ │ │ │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │
    │ │ │ │ │ │ │ │
    │ │ │ │

    stats_metric

    │ │ │ │

    Declared in "libtorrent/session_stats.hpp"

    │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -13,23 +13,23 @@ │ │ │ │ │ ************ 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) ; │ │ │ │ │ + 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 ooppeerraattoorr[[]] (int i) const ; │ │ │ │ │ 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 │ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Storage.html │ │ │ │ @@ -28,85 +28,63 @@ │ │ │ │ 2.0.11 │ │ │ │ │ │ │ │ │ │ │ │

    home

    │ │ │ │
    │ │ │ │

    Table of contents

    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -

    storage_params

    │ │ │ │ -

    Declared in "libtorrent/storage_defs.hpp"

    │ │ │ │ -

    a parameter pack used to construct the storage for a torrent, used in │ │ │ │ -disk_interface

    │ │ │ │ -
    │ │ │ │ -struct storage_params
    │ │ │ │ -{
    │ │ │ │ -   storage_params (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* mapped_files  = nullptr;
    │ │ │ │ -   std::string const& path;
    │ │ │ │ -   storage_mode_t mode {storage_mode_sparse};
    │ │ │ │ -   aux::vector<download_priority_t, file_index_t> const& priorities;
    │ │ │ │ -   sha1_hash info_hash;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ +[report issue]
    │ │ │ │

    file_slice

    │ │ │ │

    Declared in "libtorrent/file_storage.hpp"

    │ │ │ │

    represents a window of a file in a torrent.

    │ │ │ │

    The file_index refers to the index of the file (in the torrent_info). │ │ │ │ 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 │ │ │ │ @@ -139,70 +117,70 @@ │ │ │ │ size. Everything necessary to interpret a regular bittorrent storage │ │ │ │ file structure.

    │ │ │ │
    │ │ │ │  class file_storage
    │ │ │ │  {
    │ │ │ │     bool is_valid () const;
    │ │ │ │     void reserve (int num_files);
    │ │ │ │ +   void add_file (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 add_file_borrow (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 add_file_borrow (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 add_file (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 add_file (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 rename_file (file_index_t index, std::string const& new_filename);
    │ │ │ │     std::vector<file_slice> map_block (piece_index_t piece, std::int64_t offset
    │ │ │ │        , std::int64_t size) const;
    │ │ │ │     peer_request map_file (file_index_t file, std::int64_t offset, int size) const;
    │ │ │ │     int num_files () const noexcept;
    │ │ │ │     file_index_t end_file () const noexcept;
    │ │ │ │     index_range<file_index_t> file_range () const noexcept;
    │ │ │ │     std::int64_t total_size () const;
    │ │ │ │ -   void set_num_pieces (int n);
    │ │ │ │     int num_pieces () const;
    │ │ │ │ +   void set_num_pieces (int n);
    │ │ │ │     piece_index_t end_piece () const;
    │ │ │ │     piece_index_t last_piece () const;
    │ │ │ │     index_range<piece_index_t> piece_range () const noexcept;
    │ │ │ │     void set_piece_length (int l);
    │ │ │ │     int piece_length () const;
    │ │ │ │     int piece_size (piece_index_t index) const;
    │ │ │ │     int piece_size2 (piece_index_t index) const;
    │ │ │ │     int blocks_in_piece2 (piece_index_t index) const;
    │ │ │ │     int blocks_per_piece () const;
    │ │ │ │     std::string const& name () const;
    │ │ │ │     void set_name (std::string const& n);
    │ │ │ │     void swap (file_storage& ti) noexcept;
    │ │ │ │     void canonicalize ();
    │ │ │ │ -   sha1_hash hash (file_index_t index) const;
    │ │ │ │ -   string_view file_name (file_index_t index) const;
    │ │ │ │ -   char const* root_ptr (file_index_t const index) const;
    │ │ │ │ +   std::int64_t file_offset (file_index_t index) const;
    │ │ │ │     std::time_t mtime (file_index_t index) const;
    │ │ │ │ +   string_view file_name (file_index_t index) const;
    │ │ │ │     sha256_hash root (file_index_t index) const;
    │ │ │ │ -   bool pad_file_at (file_index_t index) const;
    │ │ │ │ +   char const* root_ptr (file_index_t const index) const;
    │ │ │ │     std::string symlink (file_index_t index) const;
    │ │ │ │ -   std::int64_t file_size (file_index_t index) const;
    │ │ │ │ -   std::int64_t file_offset (file_index_t index) const;
    │ │ │ │     std::string file_path (file_index_t index, std::string const& save_path = "") const;
    │ │ │ │ -   int file_num_pieces (file_index_t index) const;
    │ │ │ │ +   sha1_hash hash (file_index_t index) const;
    │ │ │ │ +   std::int64_t file_size (file_index_t index) const;
    │ │ │ │ +   bool pad_file_at (file_index_t index) const;
    │ │ │ │     int file_num_blocks (file_index_t index) const;
    │ │ │ │     index_range<piece_index_t::diff_type> file_piece_range (file_index_t) const;
    │ │ │ │ -   int file_first_piece_node (file_index_t index) const;
    │ │ │ │ +   int file_num_pieces (file_index_t index) const;
    │ │ │ │     int file_first_block_node (file_index_t index) const;
    │ │ │ │ +   int file_first_piece_node (file_index_t index) const;
    │ │ │ │     std::uint32_t file_path_hash (file_index_t index, std::string const& save_path) const;
    │ │ │ │     void all_path_hashes (std::unordered_set<std::uint32_t>& table) const;
    │ │ │ │     file_flags_t file_flags (file_index_t index) const;
    │ │ │ │     bool file_absolute_path (file_index_t index) const;
    │ │ │ │     file_index_t file_index_at_offset (std::int64_t offset) const;
    │ │ │ │     file_index_t file_index_at_piece (piece_index_t piece) const;
    │ │ │ │     file_index_t file_index_for_root (sha256_hash const& root_hash) const;
    │ │ │ │ @@ -230,33 +208,33 @@
    │ │ │ │  

    reserve()

    │ │ │ │
    │ │ │ │  void reserve (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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_file() add_file_borrow()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_file_borrow() add_file()

    │ │ │ │
    │ │ │ │ +void add_file (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 add_file_borrow (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 add_file_borrow (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 add_file (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 add_file (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 │ │ │ │ @@ -363,16 +341,16 @@ │ │ │ │ │ │ │ │

    returns the total number of bytes all the files in this torrent spans

    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    num_pieces() set_num_pieces()

    │ │ │ │
    │ │ │ │ -void set_num_pieces (int n);
    │ │ │ │  int num_pieces () const;
    │ │ │ │ +void set_num_pieces (int n);
    │ │ │ │  
    │ │ │ │

    set and get the number of pieces in the torrent

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    end_piece()

    │ │ │ │
    │ │ │ │  piece_index_t end_piece () const;
    │ │ │ │ @@ -460,37 +438,37 @@
    │ │ │ │  
    │ │ │ │

    canonicalize()

    │ │ │ │
    │ │ │ │  void canonicalize ();
    │ │ │ │  
    │ │ │ │

    arrange files and padding to match the canonical form required │ │ │ │ by BEP 52

    │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ - │ │ │ │ + │ │ │ │ -
    │ │ │ │ -

    file_num_pieces() file_piece_range() file_num_blocks()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_num_blocks() file_piece_range() file_num_pieces()

    │ │ │ │
    │ │ │ │ -int file_num_pieces (file_index_t index) const;
    │ │ │ │  int file_num_blocks (file_index_t index) const;
    │ │ │ │  index_range<piece_index_t::diff_type> file_piece_range (file_index_t) const;
    │ │ │ │ +int file_num_pieces (file_index_t index) const;
    │ │ │ │  
    │ │ │ │

    Returns the number of pieces or blocks the file at index 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.

    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    file_first_block_node() file_first_piece_node()

    │ │ │ │
    │ │ │ │ -int file_first_piece_node (file_index_t index) const;
    │ │ │ │  int file_first_block_node (file_index_t index) const;
    │ │ │ │ +int file_first_piece_node (file_index_t index) const;
    │ │ │ │  
    │ │ │ │

    index of first piece node in the merkle tree

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    file_path_hash()

    │ │ │ │
    │ │ │ │  std::uint32_t file_path_hash (file_index_t index, std::string const& save_path) const;
    │ │ │ │ @@ -629,46 +607,68 @@
    │ │ │ │  
    this file has the executable attribute set.
    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    flag_symlink
    │ │ │ │
    this file is a symbolic link. It should have a link │ │ │ │ target string associated with it.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    default_disk_io_constructor()

    │ │ │ │ -

    Declared in "libtorrent/session.hpp"

    │ │ │ │ +
    │ │ │ │ +

    storage_params

    │ │ │ │ +

    Declared in "libtorrent/storage_defs.hpp"

    │ │ │ │ +

    a parameter pack used to construct the storage for a torrent, used in │ │ │ │ +disk_interface

    │ │ │ │
    │ │ │ │ -std::unique_ptr<disk_interface> default_disk_io_constructor (
    │ │ │ │ +struct storage_params
    │ │ │ │ +{
    │ │ │ │ +   storage_params (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* mapped_files  = nullptr;
    │ │ │ │ +   std::string const& path;
    │ │ │ │ +   storage_mode_t mode {storage_mode_sparse};
    │ │ │ │ +   aux::vector<download_priority_t, file_index_t> const& priorities;
    │ │ │ │ +   sha1_hash info_hash;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    mmap_disk_io_constructor()

    │ │ │ │ +

    Declared in "libtorrent/mmap_disk_io.hpp"

    │ │ │ │ +
    │ │ │ │ +std::unique_ptr<disk_interface> mmap_disk_io_constructor (
    │ │ │ │     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.

    │ │ │ │ +

    constructs a memory mapped file disk I/O object.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    posix_disk_io_constructor()

    │ │ │ │

    Declared in "libtorrent/posix_disk_io.hpp"

    │ │ │ │
    │ │ │ │  std::unique_ptr<disk_interface> posix_disk_io_constructor (
    │ │ │ │     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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    mmap_disk_io_constructor()

    │ │ │ │ -

    Declared in "libtorrent/mmap_disk_io.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    default_disk_io_constructor()

    │ │ │ │ +

    Declared in "libtorrent/session.hpp"

    │ │ │ │
    │ │ │ │ -std::unique_ptr<disk_interface> mmap_disk_io_constructor (
    │ │ │ │ +std::unique_ptr<disk_interface> default_disk_io_constructor (
    │ │ │ │     io_context& ios, settings_interface const&, counters& cnt);
    │ │ │ │  
    │ │ │ │ -

    constructs a memory mapped file disk I/O object.

    │ │ │ │ +

    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.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    disabled_disk_io_constructor()

    │ │ │ │

    Declared in "libtorrent/disabled_disk_io.hpp"

    │ │ │ │
    │ │ │ │  std::unique_ptr<disk_interface> disabled_disk_io_constructor (
    │ │ │ │     io_context& ios, settings_interface const&, counters& cnt);
    │ │ │ │ ├── html2text {}
    │ │ │ │ │ @@ -1,18 +1,17 @@
    │ │ │ │ │  >
    │ │ │ │ │  _[_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___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 _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_(_)
    │ │ │ │ │ @@ -24,54 +23,36 @@
    │ │ │ │ │            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 _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_(_)_ _f_i_l_e___n_a_m_e_(_)_ _m_t_i_m_e_(_)_ _f_i_l_e___s_i_z_e_(_)_ _f_i_l_e___p_a_t_h_(_)_ _r_o_o_t___p_t_r
    │ │ │ │ │ -            _(_)_ _p_a_d___f_i_l_e___a_t_(_)_ _r_o_o_t_(_)_ _s_y_m_l_i_n_k_(_)_ _h_a_s_h_(_)
    │ │ │ │ │ -          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 _s_y_m_l_i_n_k_(_)_ _f_i_l_e___n_a_m_e_(_)_ _f_i_l_e___s_i_z_e_(_)_ _p_a_d___f_i_l_e___a_t_(_)_ _r_o_o_t_(_)_ _r_o_o_t___p_t_r_(_)
    │ │ │ │ │ +            _h_a_s_h_(_)_ _f_i_l_e___o_f_f_s_e_t_(_)_ _m_t_i_m_e_(_)_ _f_i_l_e___p_a_t_h_(_)
    │ │ │ │ │ +          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_(_)
    │ │ │ │ │ -    * _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_(_)
    │ │ │ │ │ +    * _s_t_o_r_a_g_e___p_a_r_a_m_s
    │ │ │ │ │      * _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_(_)
    │ │ │ │ │ +    * _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_(_)
    │ │ │ │ │      * _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
    │ │ │ │ │ -_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 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 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
    │ │ │ │ │ @@ -96,73 +77,73 @@
    │ │ │ │ │  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 (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__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__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 (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 rreennaammee__ffiillee (file_index_t index, std::string const& new_filename);
    │ │ │ │ │     std::vector 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 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 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 ();
    │ │ │ │ │ -   sha1_hash hhaasshh (file_index_t index) const;
    │ │ │ │ │ -   string_view ffiillee__nnaammee (file_index_t index) const;
    │ │ │ │ │ -   char const* rroooott__ppttrr (file_index_t const index) const;
    │ │ │ │ │ +   std::int64_t ffiillee__ooffffsseett (file_index_t index) const;
    │ │ │ │ │     std::time_t mmttiimmee (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;
    │ │ │ │ │ +   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;
    │ │ │ │ │     std::string ffiillee__ppaatthh (file_index_t index, std::string const& save_path =
    │ │ │ │ │  "") const;
    │ │ │ │ │ -   int ffiillee__nnuumm__ppiieecceess (file_index_t index) const;
    │ │ │ │ │ +   sha1_hash hhaasshh (file_index_t index) const;
    │ │ │ │ │ +   std::int64_t ffiillee__ssiizzee (file_index_t index) const;
    │ │ │ │ │ +   bool ppaadd__ffiillee__aatt (file_index_t index) const;
    │ │ │ │ │     int ffiillee__nnuumm__bblloocckkss (file_index_t index) const;
    │ │ │ │ │     index_range ffiillee__ppiieeccee__rraannggee (file_index_t) const;
    │ │ │ │ │ -   int ffiillee__ffiirrsstt__ppiieeccee__nnooddee (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& 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;
    │ │ │ │ │ @@ -185,29 +166,29 @@
    │ │ │ │ │  [_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(()) aadddd__ffiillee__bboorrrrooww(()) **********
    │ │ │ │ │ +********** aadddd__ffiillee__bboorrrrooww(()) aadddd__ffiillee(()) **********
    │ │ │ │ │ +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__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__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 (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);
    │ │ │ │ │  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 +262,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(()) **********
    │ │ │ │ │ @@ -342,27 +323,27 @@
    │ │ │ │ │  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(()) ffiillee__nnaammee(()) mmttiimmee(()) ffiillee__ssiizzee(()) ffiillee__ppaatthh(()) rroooott__ppttrr(())
    │ │ │ │ │ -ppaadd__ffiillee__aatt(()) rroooott(()) ssyymmlliinnkk(()) hhaasshh(()) **********
    │ │ │ │ │ -sha1_hash hhaasshh (file_index_t index) const;
    │ │ │ │ │ -string_view ffiillee__nnaammee (file_index_t index) const;
    │ │ │ │ │ -char const* rroooott__ppttrr (file_index_t const index) const;
    │ │ │ │ │ +********** ssyymmlliinnkk(()) ffiillee__nnaammee(()) ffiillee__ssiizzee(()) ppaadd__ffiillee__aatt(()) rroooott(()) rroooott__ppttrr(()) hhaasshh(())
    │ │ │ │ │ +ffiillee__ooffffsseett(()) mmttiimmee(()) ffiillee__ppaatthh(()) **********
    │ │ │ │ │ +std::int64_t ffiillee__ooffffsseett (file_index_t index) const;
    │ │ │ │ │  std::time_t mmttiimmee (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;
    │ │ │ │ │ +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;
    │ │ │ │ │  std::string ffiillee__ppaatthh (file_index_t index, std::string const& save_path = "")
    │ │ │ │ │  const;
    │ │ │ │ │ +sha1_hash hhaasshh (file_index_t index) const;
    │ │ │ │ │ +std::int64_t ffiillee__ssiizzee (file_index_t index) const;
    │ │ │ │ │ +bool ppaadd__ffiillee__aatt (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
    │ │ │ │ │ @@ -375,26 +356,26 @@
    │ │ │ │ │  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(()) **********
    │ │ │ │ │ -int ffiillee__nnuumm__ppiieecceess (file_index_t index) const;
    │ │ │ │ │ +********** ffiillee__nnuumm__bblloocckkss(()) ffiillee__ppiieeccee__rraannggee(()) ffiillee__nnuumm__ppiieecceess(()) **********
    │ │ │ │ │  int ffiillee__nnuumm__bblloocckkss (file_index_t index) const;
    │ │ │ │ │  index_range ffiillee__ppiieeccee__rraannggee (file_index_t) 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__ppiieeccee__nnooddee (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;
    │ │ │ │ │  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]
    │ │ │ │ │ @@ -450,35 +431,54 @@
    │ │ │ │ │    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]
    │ │ │ │ │ -************ 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 ddeeffaauulltt__ddiisskk__iioo__ccoonnssttrruuccttoorr (
    │ │ │ │ │ +************ 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 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 const& priorities;
    │ │ │ │ │ +   sha1_hash info_hash;
    │ │ │ │ │ +};
    │ │ │ │ │ +[_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 mmmmaapp__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.
    │ │ │ │ │ +constructs a memory mapped file disk I/O object.
    │ │ │ │ │  [_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 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]
    │ │ │ │ │ -************ 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 mmmmaapp__ddiisskk__iioo__ccoonnssttrruuccttoorr (
    │ │ │ │ │ +************ 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 ddeeffaauulltt__ddiisskk__iioo__ccoonnssttrruuccttoorr (
    │ │ │ │ │     io_context& ios, settings_interface const&, counters& cnt);
    │ │ │ │ │ -constructs a memory mapped file disk I/O object.
    │ │ │ │ │ +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 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.
    │ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Handle.html
    │ │ │ │ @@ -41,49 +41,49 @@
    │ │ │ │  
  • torrent_handle │ │ │ │
  • │ │ │ │ @@ -254,110 +254,110 @@ │ │ │ │ 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 invalid_handle.

    │ │ │ │
    │ │ │ │

    Warning

    │ │ │ │

    All operations on a torrent_handle may throw system_error │ │ │ │ exception, in case the handle is no longer referring to a torrent. │ │ │ │ -There is one exception is_valid() will never throw. Since the torrents │ │ │ │ +There is one exception is_valid() 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.

    │ │ │ │
    │ │ │ │
    │ │ │ │  struct torrent_handle
    │ │ │ │  {
    │ │ │ │     friend std::size_t hash_value (torrent_handle const& th);
    │ │ │ │     torrent_handle () noexcept = default;
    │ │ │ │ -   void add_piece (piece_index_t piece, std::vector<char> data, add_piece_flags_t flags = {}) const;
    │ │ │ │     void add_piece (piece_index_t piece, char const* data, add_piece_flags_t flags = {}) const;
    │ │ │ │ +   void add_piece (piece_index_t piece, std::vector<char> data, add_piece_flags_t flags = {}) const;
    │ │ │ │     void read_piece (piece_index_t piece) const;
    │ │ │ │     bool have_piece (piece_index_t piece) const;
    │ │ │ │ -   void get_peer_info (std::vector<peer_info>& v) const;
    │ │ │ │     void post_peer_info () const;
    │ │ │ │ -   torrent_status status (status_flags_t flags = status_flags_t::all()) const;
    │ │ │ │ +   void get_peer_info (std::vector<peer_info>& v) const;
    │ │ │ │     void post_status (status_flags_t flags = status_flags_t::all()) const;
    │ │ │ │ -   void post_download_queue () const;
    │ │ │ │ -   std::vector<partial_piece_info> get_download_queue () const;
    │ │ │ │ +   torrent_status status (status_flags_t flags = status_flags_t::all()) const;
    │ │ │ │     void get_download_queue (std::vector<partial_piece_info>& queue) const;
    │ │ │ │ +   std::vector<partial_piece_info> get_download_queue () const;
    │ │ │ │ +   void post_download_queue () const;
    │ │ │ │     void set_piece_deadline (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;
    │ │ │ │ -   void reset_piece_deadline (piece_index_t index) const;
    │ │ │ │     void clear_piece_deadlines () const;
    │ │ │ │ -   void file_progress (std::vector<std::int64_t>& progress, file_progress_flags_t flags = {}) const;
    │ │ │ │ +   void reset_piece_deadline (piece_index_t index) const;
    │ │ │ │     void post_file_progress (file_progress_flags_t flags) const;
    │ │ │ │ +   void file_progress (std::vector<std::int64_t>& progress, file_progress_flags_t flags = {}) const;
    │ │ │ │     std::vector<std::int64_t> file_progress (file_progress_flags_t flags = {}) const;
    │ │ │ │     std::vector<open_file_state> file_status () const;
    │ │ │ │     void clear_error () const;
    │ │ │ │ -   void add_tracker (announce_entry const&) const;
    │ │ │ │     void replace_trackers (std::vector<announce_entry> const&) const;
    │ │ │ │     void post_trackers () const;
    │ │ │ │ +   void add_tracker (announce_entry const&) const;
    │ │ │ │     std::vector<announce_entry> trackers () const;
    │ │ │ │ -   void remove_url_seed (std::string const& url) const;
    │ │ │ │     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;
    │ │ │ │     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;
    │ │ │ │     void add_extension (
    │ │ │ │        std::function<std::shared_ptr<torrent_plugin>(torrent_handle const&, client_data_t)> const& ext
    │ │ │ │        , client_data_t userdata = client_data_t{});
    │ │ │ │     bool set_metadata (span<char const> metadata) const;
    │ │ │ │     bool is_valid () const;
    │ │ │ │ -   void resume () const;
    │ │ │ │     void pause (pause_flags_t flags = {}) const;
    │ │ │ │ +   void resume () const;
    │ │ │ │ +   void unset_flags (torrent_flags_t flags) const;
    │ │ │ │     void set_flags (torrent_flags_t flags) const;
    │ │ │ │     void set_flags (torrent_flags_t flags, torrent_flags_t mask) const;
    │ │ │ │     torrent_flags_t flags () const;
    │ │ │ │ -   void unset_flags (torrent_flags_t flags) const;
    │ │ │ │     void flush_cache () const;
    │ │ │ │     void force_recheck () const;
    │ │ │ │     void save_resume_data (resume_data_flags_t flags = {}) const;
    │ │ │ │ -   bool need_save_resume_data (resume_data_flags_t flags) const;
    │ │ │ │     bool need_save_resume_data () const;
    │ │ │ │ -   void queue_position_top () const;
    │ │ │ │ -   void queue_position_bottom () const;
    │ │ │ │ -   queue_position_t queue_position () const;
    │ │ │ │ +   bool need_save_resume_data (resume_data_flags_t flags) const;
    │ │ │ │     void queue_position_down () const;
    │ │ │ │ +   void queue_position_bottom () const;
    │ │ │ │ +   void queue_position_top () const;
    │ │ │ │     void queue_position_up () const;
    │ │ │ │ +   queue_position_t queue_position () const;
    │ │ │ │     void queue_position_set (queue_position_t p) const;
    │ │ │ │ -   void set_ssl_certificate_buffer (std::string const& certificate
    │ │ │ │ -      , std::string const& private_key
    │ │ │ │ -      , std::string const& dh_params);
    │ │ │ │     void set_ssl_certificate (std::string const& certificate
    │ │ │ │        , std::string const& private_key
    │ │ │ │        , std::string const& dh_params
    │ │ │ │        , std::string const& passphrase = "");
    │ │ │ │ +   void set_ssl_certificate_buffer (std::string const& certificate
    │ │ │ │ +      , std::string const& private_key
    │ │ │ │ +      , std::string const& dh_params);
    │ │ │ │     std::shared_ptr<const torrent_info> torrent_file () const;
    │ │ │ │     std::shared_ptr<torrent_info> torrent_file_with_hashes () const;
    │ │ │ │     std::vector<std::vector<sha256_hash>> piece_layers () const;
    │ │ │ │     void post_piece_availability () const;
    │ │ │ │     void piece_availability (std::vector<int>& avail) const;
    │ │ │ │ -   void piece_priority (piece_index_t index, download_priority_t priority) const;
    │ │ │ │ -   void prioritize_pieces (std::vector<std::pair<piece_index_t, download_priority_t>> const& pieces) const;
    │ │ │ │ +   void prioritize_pieces (std::vector<download_priority_t> const& pieces) const;
    │ │ │ │     std::vector<download_priority_t> get_piece_priorities () const;
    │ │ │ │     download_priority_t piece_priority (piece_index_t index) const;
    │ │ │ │ -   void prioritize_pieces (std::vector<download_priority_t> const& pieces) const;
    │ │ │ │ +   void prioritize_pieces (std::vector<std::pair<piece_index_t, download_priority_t>> const& pieces) const;
    │ │ │ │ +   void piece_priority (piece_index_t index, download_priority_t priority) const;
    │ │ │ │ +   void file_priority (file_index_t index, download_priority_t priority) const;
    │ │ │ │     void prioritize_files (std::vector<download_priority_t> const& files) const;
    │ │ │ │ -   std::vector<download_priority_t> get_file_priorities () const;
    │ │ │ │     download_priority_t file_priority (file_index_t index) const;
    │ │ │ │ -   void file_priority (file_index_t index, download_priority_t priority) const;
    │ │ │ │ -   void force_reannounce (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
    │ │ │ │ +   std::vector<download_priority_t> get_file_priorities () const;
    │ │ │ │     void force_dht_announce () const;
    │ │ │ │     void force_lsd_announce () const;
    │ │ │ │ +   void force_reannounce (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
    │ │ │ │     void scrape_tracker (int idx = -1) const;
    │ │ │ │ -   int upload_limit () const;
    │ │ │ │ -   int download_limit () const;
    │ │ │ │     void set_download_limit (int limit) const;
    │ │ │ │ +   int download_limit () const;
    │ │ │ │ +   int upload_limit () const;
    │ │ │ │     void set_upload_limit (int limit) const;
    │ │ │ │     void connect_peer (tcp::endpoint const& adr, peer_source_flags_t source = {}
    │ │ │ │        , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const;
    │ │ │ │     void clear_peers ();
    │ │ │ │     int max_uploads () const;
    │ │ │ │     void set_max_uploads (int max_uploads) const;
    │ │ │ │ -   int max_connections () const;
    │ │ │ │     void set_max_connections (int max_connections) const;
    │ │ │ │ +   int max_connections () const;
    │ │ │ │     void move_storage (std::string const& save_path
    │ │ │ │        , move_flags_t flags = move_flags_t::always_replace_files
    │ │ │ │        ) const;
    │ │ │ │     void rename_file (file_index_t index, std::string const& new_name) const;
    │ │ │ │     sha1_hash info_hash () const;
    │ │ │ │     info_hash_t info_hashes () const;
    │ │ │ │     bool operator< (const torrent_handle& h) const;
    │ │ │ │ @@ -393,21 +393,21 @@
    │ │ │ │  
    │ │ │ │ [report issue]
    │ │ │ │

    torrent_handle()

    │ │ │ │
    │ │ │ │  torrent_handle () noexcept = default;
    │ │ │ │  
    │ │ │ │

    constructs a torrent handle that does not refer to a torrent. │ │ │ │ -i.e. is_valid() will return false.

    │ │ │ │ +i.e. is_valid() will return false.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    add_piece()

    │ │ │ │
    │ │ │ │ -void add_piece (piece_index_t piece, std::vector<char> data, add_piece_flags_t flags = {}) const;
    │ │ │ │  void add_piece (piece_index_t piece, char const* data, add_piece_flags_t flags = {}) const;
    │ │ │ │ +void add_piece (piece_index_t piece, std::vector<char> data, add_piece_flags_t flags = {}) const;
    │ │ │ │  
    │ │ │ │

    This function will write data to the storage as piece piece, │ │ │ │ as if it had been downloaded from a peer.

    │ │ │ │

    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 │ │ │ │ @@ -449,16 +449,16 @@ │ │ │ │

    Returns true if this piece has been completely downloaded and written │ │ │ │ to disk, and false otherwise.

    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    get_peer_info() post_peer_info()

    │ │ │ │
    │ │ │ │ -void get_peer_info (std::vector<peer_info>& v) const;
    │ │ │ │  void post_peer_info () const;
    │ │ │ │ +void get_peer_info (std::vector<peer_info>& v) const;
    │ │ │ │  
    │ │ │ │

    Query information about connected peers for this torrent. If the │ │ │ │ torrent_handle is invalid, it will throw a system_error exception.

    │ │ │ │

    post_peer_info() is asynchronous and will trigger the posting of │ │ │ │ a peer_info_alert. The alert contain a list of peer_info objects, one │ │ │ │ for each connected peer.

    │ │ │ │

    get_peer_info() is synchronous and takes a reference to a vector │ │ │ │ @@ -467,16 +467,16 @@ │ │ │ │ the vector contains information about that particular peer. See │ │ │ │ peer_info.

    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    status() post_status()

    │ │ │ │
    │ │ │ │ -torrent_status status (status_flags_t flags = status_flags_t::all()) const;
    │ │ │ │  void post_status (status_flags_t flags = status_flags_t::all()) const;
    │ │ │ │ +torrent_status status (status_flags_t flags = status_flags_t::all()) const;
    │ │ │ │  
    │ │ │ │

    status() will return a structure with information about the status │ │ │ │ of this torrent. If the torrent_handle is invalid, it will throw │ │ │ │ system_error exception. See torrent_status. The flags │ │ │ │ argument filters what information is returned in the torrent_status. │ │ │ │ Some information in there is relatively expensive to calculate, and if │ │ │ │ you're not interested in it (and see performance issues), you can │ │ │ │ @@ -486,38 +486,38 @@ │ │ │ │ instead call post_status(). It will trigger posting of a │ │ │ │ state_update_alert with a single torrent_status 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 include are defined in this class.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    get_download_queue() post_download_queue()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    post_download_queue() get_download_queue()

    │ │ │ │
    │ │ │ │ -void post_download_queue () const;
    │ │ │ │ -std::vector<partial_piece_info> get_download_queue () const;
    │ │ │ │  void get_download_queue (std::vector<partial_piece_info>& queue) const;
    │ │ │ │ +std::vector<partial_piece_info> get_download_queue () const;
    │ │ │ │ +void post_download_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 partial_piece_info for the │ │ │ │ fields in the returned vector.

    │ │ │ │ │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    clear_piece_deadlines() reset_piece_deadline() set_piece_deadline()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    clear_piece_deadlines() set_piece_deadline() reset_piece_deadline()

    │ │ │ │
    │ │ │ │  void set_piece_deadline (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;
    │ │ │ │ -void reset_piece_deadline (piece_index_t index) const;
    │ │ │ │  void clear_piece_deadlines () const;
    │ │ │ │ +void reset_piece_deadline (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 │ │ │ │ @@ -533,16 +533,16 @@ │ │ │ │

    clear_piece_deadlines() removes deadlines on all pieces in │ │ │ │ the torrent. As if reset_piece_deadline() was called on all pieces.

    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    file_progress() post_file_progress()

    │ │ │ │
    │ │ │ │ -void file_progress (std::vector<std::int64_t>& progress, file_progress_flags_t flags = {}) const;
    │ │ │ │  void post_file_progress (file_progress_flags_t flags) const;
    │ │ │ │ +void file_progress (std::vector<std::int64_t>& progress, file_progress_flags_t flags = {}) const;
    │ │ │ │  std::vector<std::int64_t> file_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 │ │ │ │ torrent_info.

    │ │ │ │

    This operation is not very cheap. Its complexity is O(n + mj). │ │ │ │ @@ -572,24 +572,24 @@ │ │ │ │

    │ │ │ │

    clear_error()

    │ │ │ │
    │ │ │ │  void clear_error () 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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    trackers() add_tracker() post_trackers() replace_trackers()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    replace_trackers() post_trackers() trackers() add_tracker()

    │ │ │ │
    │ │ │ │ -void add_tracker (announce_entry const&) const;
    │ │ │ │  void replace_trackers (std::vector<announce_entry> const&) const;
    │ │ │ │  void post_trackers () const;
    │ │ │ │ +void add_tracker (announce_entry const&) const;
    │ │ │ │  std::vector<announce_entry> trackers () const;
    │ │ │ │  
    │ │ │ │

    trackers() returns the list of trackers for this torrent. The │ │ │ │ announce entry contains both a string url which specify the │ │ │ │ announce url for the tracker as well as an int 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 │ │ │ │ @@ -602,38 +602,38 @@ │ │ │ │

    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.

    │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    url_seeds() add_url_seed() remove_url_seed()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    remove_url_seed() url_seeds() add_url_seed()

    │ │ │ │
    │ │ │ │ -void remove_url_seed (std::string const& url) const;
    │ │ │ │  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;
    │ │ │ │  
    │ │ │ │

    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.

    │ │ │ │ - │ │ │ │ │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_http_seed() http_seeds() remove_http_seed()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    http_seeds() remove_http_seed() add_http_seed()

    │ │ │ │
    │ │ │ │  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;
    │ │ │ │  
    │ │ │ │

    These functions are identical as the *_url_seed() variants, but │ │ │ │ they operate on BEP 17 web seeds instead of BEP 19.

    │ │ │ │ @@ -673,27 +673,27 @@ │ │ │ │

    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 session AND destructed.

    │ │ │ │

    To tell if the torrent_handle is in the session, use │ │ │ │ torrent_handle::in_session(). This will return true before │ │ │ │ session_handle::remove_torrent() is called, and false │ │ │ │ afterward.

    │ │ │ │ -

    Clients should only use is_valid() to determine if the result of │ │ │ │ +

    Clients should only use is_valid() to determine if the result of │ │ │ │ session::find_torrent() was successful.

    │ │ │ │ -

    Unlike other member functions which return a value, is_valid() │ │ │ │ +

    Unlike other member functions which return a value, is_valid() │ │ │ │ completes immediately, without blocking on a result from the │ │ │ │ network thread. Also unlike other functions, it never throws │ │ │ │ the system_error exception.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    pause() resume()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    resume() pause()

    │ │ │ │
    │ │ │ │ -void resume () const;
    │ │ │ │  void pause (pause_flags_t flags = {}) const;
    │ │ │ │ +void resume () 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 │ │ │ │ file_error_alert.

    │ │ │ │ @@ -704,24 +704,24 @@ │ │ │ │
    │ │ │ │

    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 session. For more information, see queuing.

    │ │ │ │
    │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    flags() set_flags() unset_flags()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    unset_flags() flags() set_flags()

    │ │ │ │
    │ │ │ │ +void unset_flags (torrent_flags_t flags) const;
    │ │ │ │  void set_flags (torrent_flags_t flags) const;
    │ │ │ │  void set_flags (torrent_flags_t flags, torrent_flags_t mask) const;
    │ │ │ │  torrent_flags_t flags () const;
    │ │ │ │ -void unset_flags (torrent_flags_t flags) const;
    │ │ │ │  
    │ │ │ │

    sets and gets the torrent state flags. See torrent_flags_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 │ │ │ │ @@ -858,16 +858,16 @@ │ │ │ │ report that they don't need to save resume data again, and skipped by │ │ │ │ the initial loop, and thwart the counter otherwise.

    │ │ │ │
    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    need_save_resume_data()

    │ │ │ │
    │ │ │ │ -bool need_save_resume_data (resume_data_flags_t flags) const;
    │ │ │ │  bool need_save_resume_data () const;
    │ │ │ │ +bool need_save_resume_data (resume_data_flags_t flags) const;
    │ │ │ │  
    │ │ │ │

    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 flags let you ask if specific categories │ │ │ │ of properties have changed. These flags have the same behavior as in │ │ │ │ the save_resume_data() call.

    │ │ │ │

    This is a blocking call. It will wait for a response from │ │ │ │ @@ -877,27 +877,27 @@ │ │ │ │

    │ │ │ │

    Note

    │ │ │ │

    A torrent's resume data is considered saved as soon as the │ │ │ │ save_resume_data_alert is posted. It is important to make sure this │ │ │ │ alert is received and handled in order for this function to be │ │ │ │ meaningful.

    │ │ │ │
    │ │ │ │ - │ │ │ │ - │ │ │ │ │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    queue_position_down() queue_position() queue_position_bottom() queue_position_top() queue_position_up()

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    queue_position_bottom() queue_position() queue_position_down() queue_position_up() queue_position_top()

    │ │ │ │
    │ │ │ │ -void queue_position_top () const;
    │ │ │ │ -void queue_position_bottom () const;
    │ │ │ │ -queue_position_t queue_position () const;
    │ │ │ │  void queue_position_down () const;
    │ │ │ │ +void queue_position_bottom () const;
    │ │ │ │ +void queue_position_top () const;
    │ │ │ │  void queue_position_up () const;
    │ │ │ │ +queue_position_t queue_position () 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 │ │ │ │ @@ -916,26 +916,26 @@ │ │ │ │

    queue_position_set()

    │ │ │ │
    │ │ │ │  void queue_position_set (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

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_ssl_certificate_buffer() set_ssl_certificate()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_ssl_certificate() set_ssl_certificate_buffer()

    │ │ │ │
    │ │ │ │ -void set_ssl_certificate_buffer (std::string const& certificate
    │ │ │ │ -      , std::string const& private_key
    │ │ │ │ -      , std::string const& dh_params);
    │ │ │ │  void set_ssl_certificate (std::string const& certificate
    │ │ │ │        , std::string const& private_key
    │ │ │ │        , std::string const& dh_params
    │ │ │ │        , std::string const& passphrase = "");
    │ │ │ │ +void set_ssl_certificate_buffer (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 set_ssl_certificate_buffer() 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 │ │ │ │ @@ -1014,25 +1014,25 @@ │ │ │ │ that libtorrent uses in order to prefer picking rare pieces.

    │ │ │ │

    post_piece_availability() will trigger a piece_availability_alert │ │ │ │ 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.

    │ │ │ │ - │ │ │ │ │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    get_piece_priorities() prioritize_pieces() piece_priority()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    prioritize_pieces() get_piece_priorities() piece_priority()

    │ │ │ │
    │ │ │ │ -void piece_priority (piece_index_t index, download_priority_t priority) const;
    │ │ │ │ -void prioritize_pieces (std::vector<std::pair<piece_index_t, download_priority_t>> const& pieces) const;
    │ │ │ │ +void prioritize_pieces (std::vector<download_priority_t> const& pieces) const;
    │ │ │ │  std::vector<download_priority_t> get_piece_priorities () const;
    │ │ │ │  download_priority_t piece_priority (piece_index_t index) const;
    │ │ │ │ -void prioritize_pieces (std::vector<download_priority_t> const& pieces) const;
    │ │ │ │ +void prioritize_pieces (std::vector<std::pair<piece_index_t, download_priority_t>> const& pieces) const;
    │ │ │ │ +void piece_priority (piece_index_t index, download_priority_t priority) 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 │ │ │ │ @@ -1054,24 +1054,24 @@ │ │ │ │ Invalid entries, 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 file priorities by setting the │ │ │ │ priorities for the affected pieces. Care has to be taken when mixing │ │ │ │ usage of file- and piece priorities.

    │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_priority() prioritize_files() get_file_priorities()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    get_file_priorities() prioritize_files() file_priority()

    │ │ │ │
    │ │ │ │ +void file_priority (file_index_t index, download_priority_t priority) const;
    │ │ │ │  void prioritize_files (std::vector<download_priority_t> const& files) const;
    │ │ │ │ -std::vector<download_priority_t> get_file_priorities () const;
    │ │ │ │  download_priority_t file_priority (file_index_t index) const;
    │ │ │ │ -void file_priority (file_index_t index, download_priority_t priority) const;
    │ │ │ │ +std::vector<download_priority_t> get_file_priorities () 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 entry is the priority of that │ │ │ │ file. The function sets the priorities of all the pieces in the │ │ │ │ torrent based on the vector.

    │ │ │ │ @@ -1094,23 +1094,23 @@ │ │ │ │ file_prio_alert.

    │ │ │ │

    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 after it has already │ │ │ │ been created, it will not be moved into the partfile.

    │ │ │ │ - │ │ │ │ │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    force_dht_announce() force_lsd_announce() force_reannounce()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    force_lsd_announce() force_dht_announce() force_reannounce()

    │ │ │ │
    │ │ │ │ -void force_reannounce (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
    │ │ │ │  void force_dht_announce () const;
    │ │ │ │  void force_lsd_announce () const;
    │ │ │ │ +void force_reannounce (int seconds = 0, int idx = -1, reannounce_flags_t = {}) 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 │ │ │ │ @@ -1134,24 +1134,24 @@ │ │ │ │ idx is >= 0, the tracker with the specified index will scraped.

    │ │ │ │

    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 torrent_status struct once it │ │ │ │ completes. When it completes, it will generate a scrape_reply_alert. │ │ │ │ If it fails, it will generate a scrape_failed_alert.

    │ │ │ │ - │ │ │ │ - │ │ │ │ │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    download_limit() set_download_limit() set_upload_limit() upload_limit()

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_upload_limit() download_limit() upload_limit() set_download_limit()

    │ │ │ │
    │ │ │ │ -int upload_limit () const;
    │ │ │ │ -int download_limit () const;
    │ │ │ │  void set_download_limit (int limit) const;
    │ │ │ │ +int download_limit () const;
    │ │ │ │ +int upload_limit () const;
    │ │ │ │  void set_upload_limit (int limit) 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 │ │ │ │ @@ -1184,18 +1184,18 @@ │ │ │ │

    clear_peers()

    │ │ │ │
    │ │ │ │  void clear_peers ();
    │ │ │ │  
    │ │ │ │

    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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_max_uploads() max_uploads()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    max_uploads() set_max_uploads()

    │ │ │ │
    │ │ │ │  int max_uploads () const;
    │ │ │ │  void set_max_uploads (int max_uploads) const;
    │ │ │ │  
    │ │ │ │

    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 │ │ │ │ @@ -1203,16 +1203,16 @@ │ │ │ │ settings_pack.

    │ │ │ │

    max_uploads() returns the current settings.

    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    max_connections() set_max_connections()

    │ │ │ │
    │ │ │ │ -int max_connections () const;
    │ │ │ │  void set_max_connections (int max_connections) const;
    │ │ │ │ +int max_connections () 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 │ │ │ │ @@ -1275,18 +1275,18 @@ │ │ │ │

    rename_file()

    │ │ │ │
    │ │ │ │  void rename_file (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 file_renamed_alert or │ │ │ │ file_rename_failed_alert is posted.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    info_hash() info_hashes()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    info_hashes() info_hash()

    │ │ │ │
    │ │ │ │  sha1_hash info_hash () const;
    │ │ │ │  info_hash_t info_hashes () 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. │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -10,51 +10,51 @@ │ │ │ │ │ * _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 _s_t_a_t_u_s_(_)_ _p_o_s_t___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 _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 _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 _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 _t_r_a_c_k_e_r_s_(_)_ _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_(_) │ │ │ │ │ - o _u_r_l___s_e_e_d_s_(_)_ _a_d_d___u_r_l___s_e_e_d_(_)_ _r_e_m_o_v_e___u_r_l___s_e_e_d_(_) │ │ │ │ │ - o _a_d_d___h_t_t_p___s_e_e_d_(_)_ _h_t_t_p___s_e_e_d_s_(_)_ _r_e_m_o_v_e___h_t_t_p___s_e_e_d_(_) │ │ │ │ │ + o _r_e_p_l_a_c_e___t_r_a_c_k_e_r_s_(_)_ _p_o_s_t___t_r_a_c_k_e_r_s_(_)_ _t_r_a_c_k_e_r_s_(_)_ _a_d_d___t_r_a_c_k_e_r_(_) │ │ │ │ │ + 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 _p_a_u_s_e_(_)_ _r_e_s_u_m_e_(_) │ │ │ │ │ - o _f_l_a_g_s_(_)_ _s_e_t___f_l_a_g_s_(_)_ _u_n_s_e_t___f_l_a_g_s_(_) │ │ │ │ │ + o _r_e_s_u_m_e_(_)_ _p_a_u_s_e_(_) │ │ │ │ │ + o _u_n_s_e_t___f_l_a_g_s_(_)_ _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___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___b_o_t_t_o_m_(_) │ │ │ │ │ - _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___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___d_o_w_n_(_) │ │ │ │ │ + _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_(_) │ │ │ │ │ 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 _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 _g_e_t___p_i_e_c_e___p_r_i_o_r_i_t_i_e_s_(_)_ _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_(_) │ │ │ │ │ - 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___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_(_)_ _f_o_r_c_e___r_e_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_(_)_ _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_(_) │ │ │ │ │ + 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___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_(_) │ │ │ │ │ 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___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_(_)_ _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___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___u_p_l_o_a_d_s_(_)_ _s_e_t___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_(_)_ _i_n_f_o___h_a_s_h_e_s_(_) │ │ │ │ │ + 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] │ │ │ │ │ @@ -175,111 +175,111 @@ │ │ │ │ │ the handle is no longer referring to a torrent. There is one exception _i_s___v_a_l_i_d │ │ │ │ │ _(_) 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. │ │ │ │ │ struct torrent_handle │ │ │ │ │ { │ │ │ │ │ friend std::size_t hhaasshh__vvaalluuee (torrent_handle const& th); │ │ │ │ │ ttoorrrreenntt__hhaannddllee () noexcept = default; │ │ │ │ │ - void aadddd__ppiieeccee (piece_index_t piece, std::vector data, │ │ │ │ │ -add_piece_flags_t flags = {}) const; │ │ │ │ │ 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 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& v) const; │ │ │ │ │ void ppoosstt__ppeeeerr__iinnffoo () const; │ │ │ │ │ - torrent_status ssttaattuuss (status_flags_t flags = status_flags_t::all()) const; │ │ │ │ │ + void ggeett__ppeeeerr__iinnffoo (std::vector& v) const; │ │ │ │ │ void ppoosstt__ssttaattuuss (status_flags_t flags = status_flags_t::all()) const; │ │ │ │ │ - void ppoosstt__ddoowwnnllooaadd__qquueeuuee () const; │ │ │ │ │ - std::vector ggeett__ddoowwnnllooaadd__qquueeuuee () const; │ │ │ │ │ + torrent_status ssttaattuuss (status_flags_t flags = status_flags_t::all()) const; │ │ │ │ │ void ggeett__ddoowwnnllooaadd__qquueeuuee (std::vector& queue) const; │ │ │ │ │ + std::vector ggeett__ddoowwnnllooaadd__qquueeuuee () const; │ │ │ │ │ + void ppoosstt__ddoowwnnllooaadd__qquueeuuee () 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 rreesseett__ppiieeccee__ddeeaaddlliinnee (piece_index_t index) const; │ │ │ │ │ + void ppoosstt__ffiillee__pprrooggrreessss (file_progress_flags_t flags) const; │ │ │ │ │ void ffiillee__pprrooggrreessss (std::vector& progress, │ │ │ │ │ file_progress_flags_t flags = {}) const; │ │ │ │ │ - void ppoosstt__ffiillee__pprrooggrreessss (file_progress_flags_t flags) const; │ │ │ │ │ std::vector ffiillee__pprrooggrreessss (file_progress_flags_t flags = {}) │ │ │ │ │ const; │ │ │ │ │ std::vector ffiillee__ssttaattuuss () const; │ │ │ │ │ void cclleeaarr__eerrrroorr () const; │ │ │ │ │ - void aadddd__ttrraacckkeerr (announce_entry const&) const; │ │ │ │ │ void rreeppllaaccee__ttrraacckkeerrss (std::vector const&) const; │ │ │ │ │ void ppoosstt__ttrraacckkeerrss () const; │ │ │ │ │ + void aadddd__ttrraacckkeerr (announce_entry const&) const; │ │ │ │ │ std::vector ttrraacckkeerrss () const; │ │ │ │ │ - void rreemmoovvee__uurrll__sseeeedd (std::string const& url) const; │ │ │ │ │ void aadddd__uurrll__sseeeedd (std::string const& url) const; │ │ │ │ │ + void rreemmoovvee__uurrll__sseeeedd (std::string const& url) const; │ │ │ │ │ std::set uurrll__sseeeeddss () const; │ │ │ │ │ void aadddd__hhttttpp__sseeeedd (std::string const& url) const; │ │ │ │ │ void rreemmoovvee__hhttttpp__sseeeedd (std::string const& url) const; │ │ │ │ │ std::set hhttttpp__sseeeeddss () const; │ │ │ │ │ void aadddd__eexxtteennssiioonn ( │ │ │ │ │ std::function(torrent_handle const&, │ │ │ │ │ client_data_t)> const& ext │ │ │ │ │ , client_data_t userdata = client_data_t{}); │ │ │ │ │ bool sseett__mmeettaaddaattaa (span metadata) const; │ │ │ │ │ bool iiss__vvaalliidd () const; │ │ │ │ │ - void rreessuummee () const; │ │ │ │ │ void ppaauussee (pause_flags_t flags = {}) const; │ │ │ │ │ + void rreessuummee () const; │ │ │ │ │ + void uunnsseett__ffllaaggss (torrent_flags_t flags) const; │ │ │ │ │ void sseett__ffllaaggss (torrent_flags_t flags) const; │ │ │ │ │ void sseett__ffllaaggss (torrent_flags_t flags, torrent_flags_t mask) const; │ │ │ │ │ torrent_flags_t ffllaaggss () const; │ │ │ │ │ - void uunnsseett__ffllaaggss (torrent_flags_t flags) 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__ttoopp () const; │ │ │ │ │ - void qquueeuuee__ppoossiittiioonn__bboottttoomm () const; │ │ │ │ │ - queue_position_t qquueeuuee__ppoossiittiioonn () const; │ │ │ │ │ + bool nneeeedd__ssaavvee__rreessuummee__ddaattaa (resume_data_flags_t flags) const; │ │ │ │ │ void qquueeuuee__ppoossiittiioonn__ddoowwnn () const; │ │ │ │ │ + void qquueeuuee__ppoossiittiioonn__bboottttoomm () const; │ │ │ │ │ + void qquueeuuee__ppoossiittiioonn__ttoopp () const; │ │ │ │ │ void qquueeuuee__ppoossiittiioonn__uupp () const; │ │ │ │ │ + queue_position_t qquueeuuee__ppoossiittiioonn () 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 = ""); │ │ │ │ │ + void sseett__ssssll__cceerrttiiffiiccaattee__bbuuffffeerr (std::string const& certificate │ │ │ │ │ + , std::string const& private_key │ │ │ │ │ + , std::string const& dh_params); │ │ │ │ │ std::shared_ptr ttoorrrreenntt__ffiillee () const; │ │ │ │ │ std::shared_ptr ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess () const; │ │ │ │ │ std::vector> ppiieeccee__llaayyeerrss () const; │ │ │ │ │ void ppoosstt__ppiieeccee__aavvaaiillaabbiilliittyy () const; │ │ │ │ │ void ppiieeccee__aavvaaiillaabbiilliittyy (std::vector& avail) const; │ │ │ │ │ - void ppiieeccee__pprriioorriittyy (piece_index_t index, download_priority_t priority) │ │ │ │ │ + void pprriioorriittiizzee__ppiieecceess (std::vector const& pieces) │ │ │ │ │ const; │ │ │ │ │ - void pprriioorriittiizzee__ppiieecceess (std::vector> const& pieces) const; │ │ │ │ │ std::vector ggeett__ppiieeccee__pprriioorriittiieess () const; │ │ │ │ │ download_priority_t ppiieeccee__pprriioorriittyy (piece_index_t index) const; │ │ │ │ │ - void pprriioorriittiizzee__ppiieecceess (std::vector const& pieces) │ │ │ │ │ + void pprriioorriittiizzee__ppiieecceess (std::vector> const& pieces) const; │ │ │ │ │ + void ppiieeccee__pprriioorriittyy (piece_index_t index, download_priority_t priority) │ │ │ │ │ const; │ │ │ │ │ + void ffiillee__pprriioorriittyy (file_index_t index, download_priority_t priority) const; │ │ │ │ │ void pprriioorriittiizzee__ffiilleess (std::vector const& files) const; │ │ │ │ │ - std::vector ggeett__ffiillee__pprriioorriittiieess () const; │ │ │ │ │ download_priority_t ffiillee__pprriioorriittyy (file_index_t index) 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; │ │ │ │ │ + std::vector ggeett__ffiillee__pprriioorriittiieess () const; │ │ │ │ │ void ffoorrccee__ddhhtt__aannnnoouunnccee () const; │ │ │ │ │ void ffoorrccee__llssdd__aannnnoouunnccee () const; │ │ │ │ │ + void ffoorrccee__rreeaannnnoouunnccee (int seconds = 0, int idx = -1, reannounce_flags_t = │ │ │ │ │ +{}) const; │ │ │ │ │ void ssccrraappee__ttrraacckkeerr (int idx = -1) const; │ │ │ │ │ - int uuppllooaadd__lliimmiitt () const; │ │ │ │ │ - int ddoowwnnllooaadd__lliimmiitt () const; │ │ │ │ │ void sseett__ddoowwnnllooaadd__lliimmiitt (int limit) const; │ │ │ │ │ + int ddoowwnnllooaadd__lliimmiitt () const; │ │ │ │ │ + int uuppllooaadd__lliimmiitt () const; │ │ │ │ │ void sseett__uuppllooaadd__lliimmiitt (int limit) 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; │ │ │ │ │ @@ -315,18 +315,18 @@ │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ ********** ttoorrrreenntt__hhaannddllee(()) ********** │ │ │ │ │ ttoorrrreenntt__hhaannddllee () noexcept = default; │ │ │ │ │ constructs a torrent handle that does not refer to a torrent. i.e. _i_s___v_a_l_i_d_(_) │ │ │ │ │ will return false. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ ********** aadddd__ppiieeccee(()) ********** │ │ │ │ │ -void aadddd__ppiieeccee (piece_index_t piece, std::vector data, add_piece_flags_t │ │ │ │ │ -flags = {}) const; │ │ │ │ │ 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 data, add_piece_flags_t │ │ │ │ │ +flags = {}) const; │ │ │ │ │ This function will write data to the storage as piece piece, as if it had been │ │ │ │ │ downloaded from a peer. │ │ │ │ │ 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. │ │ │ │ │ Since the data is written asynchronously, you may know that is passed or failed │ │ │ │ │ @@ -355,29 +355,29 @@ │ │ │ │ │ [_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& v) const; │ │ │ │ │ void ppoosstt__ppeeeerr__iinnffoo () const; │ │ │ │ │ +void ggeett__ppeeeerr__iinnffoo (std::vector& 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, │ │ │ │ │ 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] │ │ │ │ │ ********** 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; │ │ │ │ │ +torrent_status 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 │ │ │ │ │ issues), you can filter them out. │ │ │ │ │ The status() function will block until the internal libtorrent thread responds │ │ │ │ │ @@ -385,29 +385,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 ppoosstt__ddoowwnnllooaadd__qquueeuuee () const; │ │ │ │ │ -std::vector ggeett__ddoowwnnllooaadd__qquueeuuee () const; │ │ │ │ │ +********** ppoosstt__ddoowwnnllooaadd__qquueeuuee(()) ggeett__ddoowwnnllooaadd__qquueeuuee(()) ********** │ │ │ │ │ void ggeett__ddoowwnnllooaadd__qquueeuuee (std::vector& queue) const; │ │ │ │ │ +std::vector ggeett__ddoowwnnllooaadd__qquueeuuee () const; │ │ │ │ │ +void ppoosstt__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] │ │ │ │ │ -********** cclleeaarr__ppiieeccee__ddeeaaddlliinneess(()) rreesseett__ppiieeccee__ddeeaaddlliinnee(()) sseett__ppiieeccee__ddeeaaddlliinnee(()) ********** │ │ │ │ │ +********** cclleeaarr__ppiieeccee__ddeeaaddlliinneess(()) sseett__ppiieeccee__ddeeaaddlliinnee(()) rreesseett__ppiieeccee__ddeeaaddlliinnee(()) ********** │ │ │ │ │ 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 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, │ │ │ │ │ @@ -416,17 +416,17 @@ │ │ │ │ │ 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 ppoosstt__ffiillee__pprrooggrreessss (file_progress_flags_t flags) const; │ │ │ │ │ void ffiillee__pprrooggrreessss (std::vector& progress, file_progress_flags_t │ │ │ │ │ flags = {}) const; │ │ │ │ │ -void ppoosstt__ffiillee__pprrooggrreessss (file_progress_flags_t flags) const; │ │ │ │ │ std::vector 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 │ │ │ │ │ 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 │ │ │ │ │ @@ -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] │ │ │ │ │ -********** ttrraacckkeerrss(()) aadddd__ttrraacckkeerr(()) ppoosstt__ttrraacckkeerrss(()) rreeppllaaccee__ttrraacckkeerrss(()) ********** │ │ │ │ │ -void aadddd__ttrraacckkeerr (announce_entry const&) const; │ │ │ │ │ +********** rreeppllaaccee__ttrraacckkeerrss(()) ppoosstt__ttrraacckkeerrss(()) ttrraacckkeerrss(()) aadddd__ttrraacckkeerr(()) ********** │ │ │ │ │ void rreeppllaaccee__ttrraacckkeerrss (std::vector const&) const; │ │ │ │ │ void ppoosstt__ttrraacckkeerrss () const; │ │ │ │ │ +void aadddd__ttrraacckkeerr (announce_entry const&) const; │ │ │ │ │ std::vector 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,27 +470,27 @@ │ │ │ │ │ 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(()) aadddd__uurrll__sseeeedd(()) rreemmoovvee__uurrll__sseeeedd(()) ********** │ │ │ │ │ -void rreemmoovvee__uurrll__sseeeedd (std::string const& url) const; │ │ │ │ │ +********** 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 uurrll__sseeeeddss () 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(()) hhttttpp__sseeeeddss(()) rreemmoovvee__hhttttpp__sseeeedd(()) ********** │ │ │ │ │ +********** hhttttpp__sseeeeddss(()) rreemmoovvee__hhttttpp__sseeeedd(()) aadddd__hhttttpp__sseeeedd(()) ********** │ │ │ │ │ void aadddd__hhttttpp__sseeeedd (std::string const& url) const; │ │ │ │ │ void rreemmoovvee__hhttttpp__sseeeedd (std::string const& url) const; │ │ │ │ │ std::set 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] │ │ │ │ │ @@ -524,36 +524,36 @@ │ │ │ │ │ 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] │ │ │ │ │ -********** ppaauussee(()) rreessuummee(()) ********** │ │ │ │ │ -void rreessuummee () const; │ │ │ │ │ +********** rreessuummee(()) ppaauussee(()) ********** │ │ │ │ │ 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. │ │ │ │ │ For possible values of the flags parameter, see pause_flags_t. │ │ │ │ │ To know if a torrent is paused or not, call torrent_handle::flags() and check │ │ │ │ │ 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(()) sseett__ffllaaggss(()) uunnsseett__ffllaaggss(()) ********** │ │ │ │ │ +********** uunnsseett__ffllaaggss(()) ffllaaggss(()) sseett__ffllaaggss(()) ********** │ │ │ │ │ +void uunnsseett__ffllaaggss (torrent_flags_t flags) const; │ │ │ │ │ void sseett__ffllaaggss (torrent_flags_t flags) const; │ │ │ │ │ void sseett__ffllaaggss (torrent_flags_t flags, torrent_flags_t mask) const; │ │ │ │ │ torrent_flags_t ffllaaggss () const; │ │ │ │ │ -void uunnsseett__ffllaaggss (torrent_flags_t flags) 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 │ │ │ │ │ @@ -663,35 +663,35 @@ │ │ │ │ │ Note how outstanding_resume_data 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_l_e_r_t, 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ ********** nneeeedd__ssaavvee__rreessuummee__ddaattaa(()) ********** │ │ │ │ │ -bool nneeeedd__ssaavvee__rreessuummee__ddaattaa (resume_data_flags_t flags) const; │ │ │ │ │ bool nneeeedd__ssaavvee__rreessuummee__ddaattaa () const; │ │ │ │ │ +bool nneeeedd__ssaavvee__rreessuummee__ddaattaa (resume_data_flags_t flags) const; │ │ │ │ │ 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 │ │ │ │ │ flags let you ask if specific categories of properties have changed. These │ │ │ │ │ flags have the same behavior as in the _s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_) call. │ │ │ │ │ This is a bblloocckkiinngg call. It will wait for a response from libtorrent's main │ │ │ │ │ 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__bboottttoomm(()) │ │ │ │ │ -qquueeuuee__ppoossiittiioonn__ttoopp(()) qquueeuuee__ppoossiittiioonn__uupp(()) ********** │ │ │ │ │ -void qquueeuuee__ppoossiittiioonn__ttoopp () const; │ │ │ │ │ -void qquueeuuee__ppoossiittiioonn__bboottttoomm () const; │ │ │ │ │ -queue_position_t qquueeuuee__ppoossiittiioonn () const; │ │ │ │ │ +********** qquueeuuee__ppoossiittiioonn__bboottttoomm(()) qquueeuuee__ppoossiittiioonn(()) qquueeuuee__ppoossiittiioonn__ddoowwnn(()) │ │ │ │ │ +qquueeuuee__ppoossiittiioonn__uupp(()) qquueeuuee__ppoossiittiioonn__ttoopp(()) ********** │ │ │ │ │ void qquueeuuee__ppoossiittiioonn__ddoowwnn () const; │ │ │ │ │ +void qquueeuuee__ppoossiittiioonn__bboottttoomm () const; │ │ │ │ │ +void qquueeuuee__ppoossiittiioonn__ttoopp () const; │ │ │ │ │ void qquueeuuee__ppoossiittiioonn__uupp () const; │ │ │ │ │ +queue_position_t qquueeuuee__ppoossiittiioonn () 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__bbuuffffeerr(()) sseett__ssssll__cceerrttiiffiiccaattee(()) ********** │ │ │ │ │ -void sseett__ssssll__cceerrttiiffiiccaattee__bbuuffffeerr (std::string const& certificate │ │ │ │ │ - , std::string const& private_key │ │ │ │ │ - , std::string const& dh_params); │ │ │ │ │ +********** sseett__ssssll__cceerrttiiffiiccaattee(()) sseett__ssssll__cceerrttiiffiiccaattee__bbuuffffeerr(()) ********** │ │ │ │ │ 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. │ │ │ │ │ @@ -782,21 +782,21 @@ │ │ │ │ │ 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 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(()) pprriioorriittiizzee__ppiieecceess(()) ppiieeccee__pprriioorriittyy(()) ********** │ │ │ │ │ -void ppiieeccee__pprriioorriittyy (piece_index_t index, download_priority_t priority) const; │ │ │ │ │ -void pprriioorriittiizzee__ppiieecceess (std::vector> const& pieces) const; │ │ │ │ │ +********** pprriioorriittiizzee__ppiieecceess(()) ggeett__ppiieeccee__pprriioorriittiieess(()) ppiieeccee__pprriioorriittyy(()) ********** │ │ │ │ │ +void pprriioorriittiizzee__ppiieecceess (std::vector const& pieces) const; │ │ │ │ │ std::vector ggeett__ppiieeccee__pprriioorriittiieess () const; │ │ │ │ │ download_priority_t ppiieeccee__pprriioorriittyy (piece_index_t index) const; │ │ │ │ │ -void pprriioorriittiizzee__ppiieecceess (std::vector const& pieces) const; │ │ │ │ │ +void pprriioorriittiizzee__ppiieecceess (std::vector> const& pieces) const; │ │ │ │ │ +void ppiieeccee__pprriioorriittyy (piece_index_t index, download_priority_t priority) 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(()) ********** │ │ │ │ │ +********** ggeett__ffiillee__pprriioorriittiieess(()) pprriioorriittiizzee__ffiilleess(()) ffiillee__pprriioorriittyy(()) ********** │ │ │ │ │ +void ffiillee__pprriioorriittyy (file_index_t index, download_priority_t priority) const; │ │ │ │ │ void pprriioorriittiizzee__ffiilleess (std::vector const& files) const; │ │ │ │ │ -std::vector ggeett__ffiillee__pprriioorriittiieess () const; │ │ │ │ │ download_priority_t ffiillee__pprriioorriittyy (file_index_t index) const; │ │ │ │ │ -void ffiillee__pprriioorriittyy (file_index_t index, download_priority_t priority) const; │ │ │ │ │ +std::vector 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 │ │ │ │ │ @@ -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__ddhhtt__aannnnoouunnccee(()) ffoorrccee__llssdd__aannnnoouunnccee(()) ffoorrccee__rreeaannnnoouunnccee(()) ********** │ │ │ │ │ -void ffoorrccee__rreeaannnnoouunnccee (int seconds = 0, int idx = -1, reannounce_flags_t = {}) │ │ │ │ │ -const; │ │ │ │ │ +********** ffoorrccee__llssdd__aannnnoouunnccee(()) ffoorrccee__ddhhtt__aannnnoouunnccee(()) ffoorrccee__rreeaannnnoouunnccee(()) ********** │ │ │ │ │ void ffoorrccee__ddhhtt__aannnnoouunnccee () const; │ │ │ │ │ void ffoorrccee__llssdd__aannnnoouunnccee () const; │ │ │ │ │ +void ffoorrccee__rreeaannnnoouunnccee (int seconds = 0, int idx = -1, reannounce_flags_t = {}) │ │ │ │ │ +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,19 +877,19 @@ │ │ │ │ │ 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__ddoowwnnllooaadd__lliimmiitt(()) sseett__uuppllooaadd__lliimmiitt(()) uuppllooaadd__lliimmiitt(()) │ │ │ │ │ +********** sseett__uuppllooaadd__lliimmiitt(()) ddoowwnnllooaadd__lliimmiitt(()) uuppllooaadd__lliimmiitt(()) sseett__ddoowwnnllooaadd__lliimmiitt(()) │ │ │ │ │ ********** │ │ │ │ │ -int uuppllooaadd__lliimmiitt () const; │ │ │ │ │ -int ddoowwnnllooaadd__lliimmiitt () const; │ │ │ │ │ void sseett__ddoowwnnllooaadd__lliimmiitt (int limit) const; │ │ │ │ │ +int ddoowwnnllooaadd__lliimmiitt () const; │ │ │ │ │ +int uuppllooaadd__lliimmiitt () const; │ │ │ │ │ void sseett__uuppllooaadd__lliimmiitt (int limit) 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 │ │ │ │ │ @@ -913,26 +913,26 @@ │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ ********** cclleeaarr__ppeeeerrss(()) ********** │ │ │ │ │ void cclleeaarr__ppeeeerrss (); │ │ │ │ │ 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** sseett__mmaaxx__uuppllooaaddss(()) mmaaxx__uuppllooaaddss(()) ********** │ │ │ │ │ +********** mmaaxx__uuppllooaaddss(()) sseett__mmaaxx__uuppllooaaddss(()) ********** │ │ │ │ │ int mmaaxx__uuppllooaaddss () const; │ │ │ │ │ void sseett__mmaaxx__uuppllooaaddss (int max_uploads) const; │ │ │ │ │ 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] │ │ │ │ │ ********** mmaaxx__ccoonnnneeccttiioonnss(()) sseett__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,15 +982,15 @@ │ │ │ │ │ [_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. │ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Info.html │ │ │ │ @@ -43,20 +43,20 @@ │ │ │ │

  • torrent_info()
  • │ │ │ │
  • ~torrent_info()
  • │ │ │ │
  • files() orig_files()
  • │ │ │ │
  • rename_file()
  • │ │ │ │
  • remap_files()
  • │ │ │ │
  • trackers() add_tracker() clear_trackers()
  • │ │ │ │
  • collections() similar_torrents()
  • │ │ │ │ -
  • add_http_seed() web_seeds() add_url_seed() set_web_seeds()
  • │ │ │ │ +
  • web_seeds() set_web_seeds() add_http_seed() add_url_seed()
  • │ │ │ │
  • total_size()
  • │ │ │ │
  • num_pieces() piece_length()
  • │ │ │ │
  • blocks_per_piece()
  • │ │ │ │ -
  • last_piece() end_piece() piece_range()
  • │ │ │ │ -
  • info_hash() info_hashes()
  • │ │ │ │ +
  • end_piece() piece_range() last_piece()
  • │ │ │ │ +
  • info_hashes() info_hash()
  • │ │ │ │
  • v2() v1()
  • │ │ │ │
  • num_files()
  • │ │ │ │
  • map_block()
  • │ │ │ │
  • map_file()
  • │ │ │ │
  • ssl_cert()
  • │ │ │ │
  • is_valid()
  • │ │ │ │
  • priv()
  • │ │ │ │ @@ -154,15 +154,15 @@ │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    extra_headers
    │ │ │ │
    Any extra HTTP headers that need to be passed to the web seed
    │ │ │ │
    │ │ │ │ [report issue]
    │ │ │ │
    type
    │ │ │ │ -
    The type of web seed (see type_t)
    │ │ │ │ +
    The type of web seed (see type_t)
    │ │ │ │
    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │
    │ │ │ │

    load_torrent_limits

    │ │ │ │

    Declared in "libtorrent/torrent_info.hpp"

    │ │ │ │

    this object holds configuration options for limits to use when loading │ │ │ │ @@ -197,56 +197,56 @@ │ │ │ │

    │ │ │ │

    torrent_info

    │ │ │ │

    Declared in "libtorrent/torrent_info.hpp"

    │ │ │ │

    the torrent_info class holds the information found in a .torrent file.

    │ │ │ │
    │ │ │ │  class torrent_info
    │ │ │ │  {
    │ │ │ │ +   torrent_info (torrent_info const& t);
    │ │ │ │     explicit torrent_info (std::string const& filename);
    │ │ │ │ -   torrent_info (bdecode_node const& torrent_file, error_code& ec);
    │ │ │ │ +   torrent_info (span<char const> buffer, load_torrent_limits const& cfg, from_span_t);
    │ │ │ │     torrent_info (std::string const& filename, load_torrent_limits const& cfg);
    │ │ │ │ -   explicit torrent_info (bdecode_node const& torrent_file);
    │ │ │ │ -   explicit torrent_info (span<char const> buffer, from_span_t);
    │ │ │ │ +   torrent_info (char const* buffer, int size, error_code& ec);
    │ │ │ │ +   torrent_info (std::string const& filename, error_code& ec);
    │ │ │ │ +   torrent_info (span<char const> buffer, error_code& ec, from_span_t);
    │ │ │ │     torrent_info (char const* buffer, int size);
    │ │ │ │     torrent_info (bdecode_node const& torrent_file, load_torrent_limits const& cfg);
    │ │ │ │     explicit torrent_info (info_hash_t const& info_hash);
    │ │ │ │ -   torrent_info (std::string const& filename, error_code& ec);
    │ │ │ │ -   torrent_info (span<char const> buffer, load_torrent_limits const& cfg, from_span_t);
    │ │ │ │ -   torrent_info (char const* buffer, int size, error_code& ec);
    │ │ │ │ -   torrent_info (torrent_info const& t);
    │ │ │ │ -   torrent_info (span<char const> buffer, error_code& ec, from_span_t);
    │ │ │ │ +   torrent_info (bdecode_node const& torrent_file, error_code& ec);
    │ │ │ │ +   explicit torrent_info (bdecode_node const& torrent_file);
    │ │ │ │ +   explicit torrent_info (span<char const> buffer, from_span_t);
    │ │ │ │     ~torrent_info ();
    │ │ │ │     file_storage const& files () const;
    │ │ │ │     file_storage const& orig_files () const;
    │ │ │ │     void rename_file (file_index_t index, std::string const& new_filename);
    │ │ │ │     void remap_files (file_storage const& f);
    │ │ │ │ -   void add_tracker (std::string const& url, int tier = 0);
    │ │ │ │     void add_tracker (std::string const& url, int tier
    │ │ │ │        , announce_entry::tracker_source source);
    │ │ │ │ -   void clear_trackers ();
    │ │ │ │ +   void add_tracker (std::string const& url, int tier = 0);
    │ │ │ │     std::vector<announce_entry> const& trackers () const;
    │ │ │ │ -   std::vector<std::string> collections () const;
    │ │ │ │ +   void clear_trackers ();
    │ │ │ │     std::vector<sha1_hash> similar_torrents () const;
    │ │ │ │ +   std::vector<std::string> collections () const;
    │ │ │ │ +   void set_web_seeds (std::vector<web_seed_entry> seeds);
    │ │ │ │     void add_http_seed (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 add_url_seed (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& web_seeds () const;
    │ │ │ │ -   void set_web_seeds (std::vector<web_seed_entry> seeds);
    │ │ │ │     std::int64_t total_size () const;
    │ │ │ │     int num_pieces () const;
    │ │ │ │     int piece_length () const;
    │ │ │ │     int blocks_per_piece () const;
    │ │ │ │     index_range<piece_index_t> piece_range () const;
    │ │ │ │ -   piece_index_t last_piece () const;
    │ │ │ │     piece_index_t end_piece () const;
    │ │ │ │ -   sha1_hash info_hash () const noexcept;
    │ │ │ │ +   piece_index_t last_piece () const;
    │ │ │ │     info_hash_t const& info_hashes () const;
    │ │ │ │ +   sha1_hash info_hash () const noexcept;
    │ │ │ │     bool v1 () const;
    │ │ │ │     bool v2 () const;
    │ │ │ │     int num_files () const;
    │ │ │ │     std::vector<file_slice> map_block (piece_index_t const piece
    │ │ │ │        , std::int64_t offset, int size) const;
    │ │ │ │     peer_request map_file (file_index_t const file, std::int64_t offset, int size) const;
    │ │ │ │     string_view ssl_cert () const;
    │ │ │ │ @@ -269,27 +269,27 @@
    │ │ │ │     span<char const> piece_layer (file_index_t) const;
    │ │ │ │     void free_piece_layers ();
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ [report issue]
    │ │ │ │

    torrent_info()

    │ │ │ │
    │ │ │ │ +torrent_info (torrent_info const& t);
    │ │ │ │  explicit torrent_info (std::string const& filename);
    │ │ │ │ -torrent_info (bdecode_node const& torrent_file, error_code& ec);
    │ │ │ │ +torrent_info (span<char const> buffer, load_torrent_limits const& cfg, from_span_t);
    │ │ │ │  torrent_info (std::string const& filename, load_torrent_limits const& cfg);
    │ │ │ │ -explicit torrent_info (bdecode_node const& torrent_file);
    │ │ │ │ -explicit torrent_info (span<char const> buffer, from_span_t);
    │ │ │ │ +torrent_info (char const* buffer, int size, error_code& ec);
    │ │ │ │ +torrent_info (std::string const& filename, error_code& ec);
    │ │ │ │ +torrent_info (span<char const> buffer, error_code& ec, from_span_t);
    │ │ │ │  torrent_info (char const* buffer, int size);
    │ │ │ │  torrent_info (bdecode_node const& torrent_file, load_torrent_limits const& cfg);
    │ │ │ │  explicit torrent_info (info_hash_t const& info_hash);
    │ │ │ │ -torrent_info (std::string const& filename, error_code& ec);
    │ │ │ │ -torrent_info (span<char const> buffer, load_torrent_limits const& cfg, from_span_t);
    │ │ │ │ -torrent_info (char const* buffer, int size, error_code& ec);
    │ │ │ │ -torrent_info (torrent_info const& t);
    │ │ │ │ -torrent_info (span<char const> buffer, error_code& ec, from_span_t);
    │ │ │ │ +torrent_info (bdecode_node const& torrent_file, error_code& ec);
    │ │ │ │ +explicit torrent_info (bdecode_node const& torrent_file);
    │ │ │ │ +explicit torrent_info (span<char const> buffer, from_span_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 bdecode_node will create a torrent_info │ │ │ │ @@ -382,19 +382,19 @@ │ │ │ │ the current one.

    │ │ │ │ │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    trackers() add_tracker() clear_trackers()

    │ │ │ │
    │ │ │ │ -void add_tracker (std::string const& url, int tier = 0);
    │ │ │ │  void add_tracker (std::string const& url, int tier
    │ │ │ │        , announce_entry::tracker_source source);
    │ │ │ │ -void clear_trackers ();
    │ │ │ │ +void add_tracker (std::string const& url, int tier = 0);
    │ │ │ │  std::vector<announce_entry> const& trackers () const;
    │ │ │ │ +void clear_trackers ();
    │ │ │ │  
    │ │ │ │

    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 │ │ │ │ announce_entry. Each announce entry 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 @@ │ │ │ │

    trackers() returns all entries from announce-list.

    │ │ │ │

    clear_trackers() removes all trackers from announce-list.

    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    collections() similar_torrents()

    │ │ │ │
    │ │ │ │ -std::vector<std::string> collections () const;
    │ │ │ │  std::vector<sha1_hash> similar_torrents () const;
    │ │ │ │ +std::vector<std::string> collections () const;
    │ │ │ │  
    │ │ │ │

    These two functions are related to BEP 38 (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.

    │ │ │ │ - │ │ │ │ │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_http_seed() web_seeds() add_url_seed() set_web_seeds()

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    web_seeds() set_web_seeds() add_http_seed() add_url_seed()

    │ │ │ │
    │ │ │ │ +void set_web_seeds (std::vector<web_seed_entry> seeds);
    │ │ │ │  void add_http_seed (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 add_url_seed (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& web_seeds () const;
    │ │ │ │ -void set_web_seeds (std::vector<web_seed_entry> seeds);
    │ │ │ │  
    │ │ │ │

    web_seeds() returns all url seeds and http seeds in the torrent. │ │ │ │ Each entry 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 │ │ │ │ @@ -476,37 +476,37 @@ │ │ │ │

    │ │ │ │

    blocks_per_piece()

    │ │ │ │
    │ │ │ │  int blocks_per_piece () const;
    │ │ │ │  
    │ │ │ │

    returns the number of blocks there are in the typical piece. There │ │ │ │ may be fewer in the last piece)

    │ │ │ │ - │ │ │ │ │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    last_piece() end_piece() piece_range()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    end_piece() piece_range() last_piece()

    │ │ │ │
    │ │ │ │  index_range<piece_index_t> piece_range () const;
    │ │ │ │ -piece_index_t last_piece () const;
    │ │ │ │  piece_index_t end_piece () const;
    │ │ │ │ +piece_index_t last_piece () 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 file_storage.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    info_hash() info_hashes()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    info_hashes() info_hash()

    │ │ │ │
    │ │ │ │ -sha1_hash info_hash () const noexcept;
    │ │ │ │  info_hash_t const& info_hashes () const;
    │ │ │ │ +sha1_hash info_hash () 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

    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -12,20 +12,20 @@ │ │ │ │ │ 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 _t_r_a_c_k_e_r_s_(_)_ _a_d_d___t_r_a_c_k_e_r_(_)_ _c_l_e_a_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_(_)_ _w_e_b___s_e_e_d_s_(_)_ _a_d_d___u_r_l___s_e_e_d_(_)_ _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_(_)_ _e_n_d___p_i_e_c_e_(_)_ _p_i_e_c_e___r_a_n_g_e_(_) │ │ │ │ │ - o _i_n_f_o___h_a_s_h_(_)_ _i_n_f_o___h_a_s_h_e_s_(_) │ │ │ │ │ + o _e_n_d___p_i_e_c_e_(_)_ _p_i_e_c_e___r_a_n_g_e_(_)_ _l_a_s_t___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_2_(_)_ _v_1_(_) │ │ │ │ │ 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_(_) │ │ │ │ │ @@ -120,60 +120,60 @@ │ │ │ │ │ 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 (torrent_info const& t); │ │ │ │ │ explicit ttoorrrreenntt__iinnffoo (std::string const& filename); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, error_code& ec); │ │ │ │ │ + ttoorrrreenntt__iinnffoo (span buffer, load_torrent_limits const& cfg, │ │ │ │ │ +from_span_t); │ │ │ │ │ ttoorrrreenntt__iinnffoo (std::string const& filename, load_torrent_limits const& cfg); │ │ │ │ │ - explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file); │ │ │ │ │ - explicit ttoorrrreenntt__iinnffoo (span buffer, from_span_t); │ │ │ │ │ + ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec); │ │ │ │ │ + ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec); │ │ │ │ │ + ttoorrrreenntt__iinnffoo (span buffer, error_code& ec, from_span_t); │ │ │ │ │ ttoorrrreenntt__iinnffoo (char const* buffer, int size); │ │ │ │ │ ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, load_torrent_limits const& │ │ │ │ │ cfg); │ │ │ │ │ explicit ttoorrrreenntt__iinnffoo (info_hash_t const& info_hash); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (span buffer, load_torrent_limits const& cfg, │ │ │ │ │ -from_span_t); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (torrent_info const& t); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (span buffer, error_code& ec, from_span_t); │ │ │ │ │ + ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, error_code& ec); │ │ │ │ │ + explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file); │ │ │ │ │ + explicit ttoorrrreenntt__iinnffoo (span buffer, from_span_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); │ │ │ │ │ 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 const& ttrraacckkeerrss () const; │ │ │ │ │ - std::vector ccoolllleeccttiioonnss () const; │ │ │ │ │ + void cclleeaarr__ttrraacckkeerrss (); │ │ │ │ │ std::vector ssiimmiillaarr__ttoorrrreennttss () const; │ │ │ │ │ + std::vector ccoolllleeccttiioonnss () const; │ │ │ │ │ + void sseett__wweebb__sseeeeddss (std::vector 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 const& wweebb__sseeeeddss () const; │ │ │ │ │ - void sseett__wweebb__sseeeeddss (std::vector seeds); │ │ │ │ │ std::int64_t ttoottaall__ssiizzee () const; │ │ │ │ │ int nnuumm__ppiieecceess () const; │ │ │ │ │ int ppiieeccee__lleennggtthh () const; │ │ │ │ │ int bblloocckkss__ppeerr__ppiieeccee () const; │ │ │ │ │ index_range ppiieeccee__rraannggee () const; │ │ │ │ │ - piece_index_t llaasstt__ppiieeccee () const; │ │ │ │ │ piece_index_t eenndd__ppiieeccee () const; │ │ │ │ │ - sha1_hash iinnffoo__hhaasshh () const noexcept; │ │ │ │ │ + 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 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; │ │ │ │ │ @@ -196,29 +196,29 @@ │ │ │ │ │ bdecode_node iinnffoo (char const* key) const; │ │ │ │ │ span iinnffoo__sseeccttiioonn () const; │ │ │ │ │ span 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 (torrent_info const& t); │ │ │ │ │ explicit ttoorrrreenntt__iinnffoo (std::string const& filename); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, error_code& ec); │ │ │ │ │ +ttoorrrreenntt__iinnffoo (span buffer, load_torrent_limits const& cfg, │ │ │ │ │ +from_span_t); │ │ │ │ │ ttoorrrreenntt__iinnffoo (std::string const& filename, load_torrent_limits const& cfg); │ │ │ │ │ -explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file); │ │ │ │ │ -explicit ttoorrrreenntt__iinnffoo (span buffer, from_span_t); │ │ │ │ │ +ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec); │ │ │ │ │ +ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec); │ │ │ │ │ +ttoorrrreenntt__iinnffoo (span buffer, error_code& ec, from_span_t); │ │ │ │ │ ttoorrrreenntt__iinnffoo (char const* buffer, int size); │ │ │ │ │ ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, load_torrent_limits const& │ │ │ │ │ cfg); │ │ │ │ │ explicit ttoorrrreenntt__iinnffoo (info_hash_t const& info_hash); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (span buffer, load_torrent_limits const& cfg, │ │ │ │ │ -from_span_t); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (torrent_info const& t); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (span buffer, error_code& ec, from_span_t); │ │ │ │ │ +ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, error_code& ec); │ │ │ │ │ +explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file); │ │ │ │ │ +explicit ttoorrrreenntt__iinnffoo (span buffer, from_span_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 │ │ │ │ │ @@ -285,48 +285,48 @@ │ │ │ │ │ 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] │ │ │ │ │ ********** ttrraacckkeerrss(()) aadddd__ttrraacckkeerr(()) cclleeaarr__ttrraacckkeerrss(()) ********** │ │ │ │ │ -void aadddd__ttrraacckkeerr (std::string const& url, int tier = 0); │ │ │ │ │ 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 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 ccoolllleeccttiioonnss () const; │ │ │ │ │ std::vector ssiimmiillaarr__ttoorrrreennttss () const; │ │ │ │ │ +std::vector 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(()) wweebb__sseeeeddss(()) aadddd__uurrll__sseeeedd(()) sseett__wweebb__sseeeeddss(()) ********** │ │ │ │ │ +********** wweebb__sseeeeddss(()) sseett__wweebb__sseeeeddss(()) aadddd__hhttttpp__sseeeedd(()) aadddd__uurrll__sseeeedd(()) ********** │ │ │ │ │ +void sseett__wweebb__sseeeeddss (std::vector 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 const& wweebb__sseeeeddss () const; │ │ │ │ │ -void sseett__wweebb__sseeeeddss (std::vector 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 │ │ │ │ │ @@ -353,27 +353,27 @@ │ │ │ │ │ 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(()) ********** │ │ │ │ │ +********** eenndd__ppiieeccee(()) ppiieeccee__rraannggee(()) llaasstt__ppiieeccee(()) ********** │ │ │ │ │ index_range ppiieeccee__rraannggee () const; │ │ │ │ │ -piece_index_t llaasstt__ppiieeccee () const; │ │ │ │ │ piece_index_t eenndd__ppiieeccee () 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__hhaasshh(()) iinnffoo__hhaasshheess(()) ********** │ │ │ │ │ -sha1_hash iinnffoo__hhaasshh () const noexcept; │ │ │ │ │ +********** 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] │ │ │ │ │ ********** vv22(()) vv11(()) ********** │ │ │ │ │ bool vv11 () const; │ │ │ │ │ bool vv22 () const; │ │ │ │ │ returns whether this torrent has v1 and/or v2 metadata, respectively. Hybrid │ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Status.html │ │ │ │ @@ -426,15 +426,15 @@ │ │ │ │ currently connected to. │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    num_peers
    │ │ │ │
    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 get_peer_info().
    │ │ │ │ +are visible in the peer list when you call get_peer_info(). │ │ │ │
    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    num_complete num_incomplete
    │ │ │ │
    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 @@ │ │ │ │

    home

    │ │ │ │
    │ │ │ │

    Table of contents

    │ │ │ │ │ │ │ │
    │ │ │ │ [report issue]
    │ │ │ │

    announce_infohash

    │ │ │ │ @@ -132,18 +132,18 @@ │ │ │ │

    Declared in "libtorrent/announce_entry.hpp"

    │ │ │ │

    this class holds information about one bittorrent tracker, as it │ │ │ │ relates to a specific torrent.

    │ │ │ │
    │ │ │ │  struct announce_entry
    │ │ │ │  {
    │ │ │ │     announce_entry ();
    │ │ │ │ -   explicit announce_entry (string_view u);
    │ │ │ │ -   announce_entry& operator= (announce_entry const&) &;
    │ │ │ │     ~announce_entry ();
    │ │ │ │     announce_entry (announce_entry const&);
    │ │ │ │ +   explicit announce_entry (string_view u);
    │ │ │ │ +   announce_entry& operator= (announce_entry const&) &;
    │ │ │ │  
    │ │ │ │     enum tracker_source
    │ │ │ │     {
    │ │ │ │        source_torrent,
    │ │ │ │        source_client,
    │ │ │ │        source_magnet_link,
    │ │ │ │        source_tex,
    │ │ │ │ @@ -155,23 +155,23 @@
    │ │ │ │     std::uint8_t tier  = 0;
    │ │ │ │     std::uint8_t fail_limit  = 0;
    │ │ │ │     std::uint8_t source:4;
    │ │ │ │     bool verified:1;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    announce_entry() ~announce_entry() operator=()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    announce_entry() operator=() ~announce_entry()

    │ │ │ │
    │ │ │ │  announce_entry ();
    │ │ │ │ -explicit announce_entry (string_view u);
    │ │ │ │ -announce_entry& operator= (announce_entry const&) &;
    │ │ │ │  ~announce_entry ();
    │ │ │ │  announce_entry (announce_entry const&);
    │ │ │ │ +explicit announce_entry (string_view u);
    │ │ │ │ +announce_entry& operator= (announce_entry const&) &;
    │ │ │ │  
    │ │ │ │

    constructs a tracker announce entry with u as the URL.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    enum tracker_source

    │ │ │ │

    Declared in "libtorrent/announce_entry.hpp"

    │ │ │ │ │ │ │ │ @@ -189,15 +189,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── 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 _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_p_e_r_a_t_o_r_=_(_) │ │ │ │ │ + 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; │ │ │ │ │ @@ -79,18 +79,18 @@ │ │ │ │ │ ************ 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 (); │ │ │ │ │ - explicit aannnnoouunnccee__eennttrryy (string_view u); │ │ │ │ │ - announce_entry& ooppeerraattoorr== (announce_entry const&) &; │ │ │ │ │ ~~aannnnoouunnccee__eennttrryy (); │ │ │ │ │ aannnnoouunnccee__eennttrryy (announce_entry const&); │ │ │ │ │ + explicit aannnnoouunnccee__eennttrryy (string_view u); │ │ │ │ │ + announce_entry& ooppeerraattoorr== (announce_entry const&) &; │ │ │ │ │ │ │ │ │ │ enum tracker_source │ │ │ │ │ { │ │ │ │ │ source_torrent, │ │ │ │ │ source_client, │ │ │ │ │ source_magnet_link, │ │ │ │ │ source_tex, │ │ │ │ │ @@ -101,20 +101,20 @@ │ │ │ │ │ std::vector 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] │ │ │ │ │ -********** aannnnoouunnccee__eennttrryy(()) ~~aannnnoouunnccee__eennttrryy(()) ooppeerraattoorr==(()) ********** │ │ │ │ │ +********** aannnnoouunnccee__eennttrryy(()) ooppeerraattoorr==(()) ~~aannnnoouunnccee__eennttrryy(()) ********** │ │ │ │ │ aannnnoouunnccee__eennttrryy (); │ │ │ │ │ -explicit aannnnoouunnccee__eennttrryy (string_view u); │ │ │ │ │ -announce_entry& ooppeerraattoorr== (announce_entry const&) &; │ │ │ │ │ ~~aannnnoouunnccee__eennttrryy (); │ │ │ │ │ aannnnoouunnccee__eennttrryy (announce_entry const&); │ │ │ │ │ +explicit aannnnoouunnccee__eennttrryy (string_view u); │ │ │ │ │ +announce_entry& ooppeerraattoorr== (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 │ │ │ │ @@ -32,30 +32,30 @@ │ │ │ │
    │ │ │ │

    Table of contents

    │ │ │ │
      │ │ │ │
    • bitfield │ │ │ │
    • │ │ │ │
    • hasher │ │ │ │
    • │ │ │ │
    • hasher256
        │ │ │ │
      • hasher256() operator=()
      • │ │ │ │ @@ -70,20 +70,20 @@ │ │ │ │

        bitfield

        │ │ │ │

        Declared in "libtorrent/bitfield.hpp"

        │ │ │ │

        The bitfield type stores any number of bits as a bitfield │ │ │ │ in a heap allocated array.

        │ │ │ │
        │ │ │ │  struct bitfield
        │ │ │ │  {
        │ │ │ │ -   bitfield (int bits, bool val);
        │ │ │ │ -   bitfield (bitfield const& rhs);
        │ │ │ │ +   bitfield () noexcept = default;
        │ │ │ │     explicit bitfield (int bits);
        │ │ │ │ -   bitfield (char const* b, int bits);
        │ │ │ │     bitfield (bitfield&& rhs) noexcept = default;
        │ │ │ │ -   bitfield () noexcept = default;
        │ │ │ │ +   bitfield (char const* b, int bits);
        │ │ │ │ +   bitfield (int bits, bool val);
        │ │ │ │ +   bitfield (bitfield const& rhs);
        │ │ │ │     void assign (char const* b, int const bits);
        │ │ │ │     bool get_bit (int index) const noexcept;
        │ │ │ │     bool operator[] (int index) const noexcept;
        │ │ │ │     void set_bit (int index) noexcept;
        │ │ │ │     void clear_bit (int index) noexcept;
        │ │ │ │     bool all_set () const noexcept;
        │ │ │ │     bool none_set () const noexcept;
        │ │ │ │ @@ -99,20 +99,20 @@
        │ │ │ │     int find_last_clear () const noexcept;
        │ │ │ │     bool operator== (lt::bitfield const& rhs) const;
        │ │ │ │  };
        │ │ │ │  
        │ │ │ │ [report issue]
        │ │ │ │

        bitfield()

        │ │ │ │
        │ │ │ │ -bitfield (int bits, bool val);
        │ │ │ │ -bitfield (bitfield const& rhs);
        │ │ │ │ +bitfield () noexcept = default;
        │ │ │ │  explicit bitfield (int bits);
        │ │ │ │ -bitfield (char const* b, int bits);
        │ │ │ │  bitfield (bitfield&& rhs) noexcept = default;
        │ │ │ │ -bitfield () noexcept = default;
        │ │ │ │ +bitfield (char const* b, int bits);
        │ │ │ │ +bitfield (int bits, bool val);
        │ │ │ │ +bitfield (bitfield const& rhs);
        │ │ │ │  
        │ │ │ │

        constructs a new bitfield. The default constructor creates an empty │ │ │ │ bitfield. bits is the size of the bitfield (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 bitfield │ │ │ │ from the specified buffer, and bits number of bits (rounded up to │ │ │ │ @@ -130,18 +130,18 @@ │ │ │ │

        │ │ │ │

        operator[]() get_bit()

        │ │ │ │
        │ │ │ │  bool get_bit (int index) const noexcept;
        │ │ │ │  bool operator[] (int index) const noexcept;
        │ │ │ │  
        │ │ │ │

        query bit at index. Returns true if bit is 1, otherwise false.

        │ │ │ │ - │ │ │ │ -[report issue]
        │ │ │ │ -
        │ │ │ │ -

        set_bit() clear_bit()

        │ │ │ │ + │ │ │ │ +[report issue]
        │ │ │ │ +
        │ │ │ │ +

        clear_bit() set_bit()

        │ │ │ │
        │ │ │ │  void set_bit (int index) noexcept;
        │ │ │ │  void clear_bit (int index) noexcept;
        │ │ │ │  
        │ │ │ │

        set bit at index to 0 (clear_bit) or 1 (set_bit).

        │ │ │ │ [report issue]
        │ │ │ │
        │ │ │ │ @@ -242,41 +242,41 @@ │ │ │ │

        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
        │ │ │ │  {
        │ │ │ │     hasher ();
        │ │ │ │ +   hasher (hasher const&);
        │ │ │ │     explicit hasher (span<char const> data);
        │ │ │ │ -   hasher& operator= (hasher const&) &;
        │ │ │ │     hasher (char const* data, int len);
        │ │ │ │ -   hasher (hasher const&);
        │ │ │ │ -   hasher& update (span<char const> data);
        │ │ │ │ +   hasher& operator= (hasher const&) &;
        │ │ │ │     hasher& update (char const* data, int len);
        │ │ │ │ +   hasher& update (span<char const> data);
        │ │ │ │     sha1_hash final ();
        │ │ │ │     void reset ();
        │ │ │ │  };
        │ │ │ │  
        │ │ │ │ - │ │ │ │ -[report issue]
        │ │ │ │ -

        hasher() operator=()

        │ │ │ │ + │ │ │ │ +[report issue]
        │ │ │ │ +

        operator=() hasher()

        │ │ │ │
        │ │ │ │ +hasher (hasher const&);
        │ │ │ │  explicit hasher (span<char const> data);
        │ │ │ │ -hasher& operator= (hasher const&) &;
        │ │ │ │  hasher (char const* data, int len);
        │ │ │ │ -hasher (hasher const&);
        │ │ │ │ +hasher& operator= (hasher const&) &;
        │ │ │ │  
        │ │ │ │

        this is the same as default constructing followed by a call to │ │ │ │ update(data, len).

        │ │ │ │ [report issue]
        │ │ │ │
        │ │ │ │

        update()

        │ │ │ │
        │ │ │ │ -hasher& update (span<char const> data);
        │ │ │ │  hasher& update (char const* data, int len);
        │ │ │ │ +hasher& update (span<char const> data);
        │ │ │ │  
        │ │ │ │

        append the following bytes to what is being hashed

        │ │ │ │ [report issue]
        │ │ │ │
        │ │ │ │

        final()

        │ │ │ │
        │ │ │ │  sha1_hash final ();
        │ │ │ │ @@ -296,42 +296,42 @@
        │ │ │ │  
        │ │ │ │

        hasher256

        │ │ │ │

        Declared in "libtorrent/hasher.hpp"

        │ │ │ │
        │ │ │ │  class hasher256
        │ │ │ │  {
        │ │ │ │     hasher256 ();
        │ │ │ │ -   hasher256 (char const* data, int len);
        │ │ │ │     explicit hasher256 (span<char const> data);
        │ │ │ │ +   hasher256 (char const* data, int len);
        │ │ │ │     hasher256& operator= (hasher256 const&) &;
        │ │ │ │     hasher256 (hasher256 const&);
        │ │ │ │ -   hasher256& update (span<char const> data);
        │ │ │ │     hasher256& update (char const* data, int len);
        │ │ │ │ +   hasher256& update (span<char const> data);
        │ │ │ │     sha256_hash final ();
        │ │ │ │     void reset ();
        │ │ │ │     ~hasher256 ();
        │ │ │ │  };
        │ │ │ │  
        │ │ │ │ │ │ │ │ [report issue]
        │ │ │ │

        hasher256() operator=()

        │ │ │ │
        │ │ │ │ -hasher256 (char const* data, int len);
        │ │ │ │  explicit hasher256 (span<char const> data);
        │ │ │ │ +hasher256 (char const* data, int len);
        │ │ │ │  hasher256& operator= (hasher256 const&) &;
        │ │ │ │  hasher256 (hasher256 const&);
        │ │ │ │  
        │ │ │ │

        this is the same as default constructing followed by a call to │ │ │ │ update(data, len).

        │ │ │ │ [report issue]
        │ │ │ │
        │ │ │ │

        update()

        │ │ │ │
        │ │ │ │ -hasher256& update (span<char const> data);
        │ │ │ │  hasher256& update (char const* data, int len);
        │ │ │ │ +hasher256& update (span<char const> data);
        │ │ │ │  
        │ │ │ │

        append the following bytes to what is being hashed

        │ │ │ │ [report issue]
        │ │ │ │
        │ │ │ │

        final()

        │ │ │ │
        │ │ │ │  sha256_hash final ();
        │ │ │ │ ├── html2text {}
        │ │ │ │ │ @@ -3,28 +3,28 @@
        │ │ │ │ │  VVeerrssiioonn:: 2.0.11
        │ │ │ │ │  _h_o_m_e
        │ │ │ │ │  Table of contents
        │ │ │ │ │      * _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 _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_(_)
        │ │ │ │ │            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_(_)
        │ │ │ │ │      * _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 _u_p_d_a_t_e_(_)
        │ │ │ │ │            o _f_i_n_a_l_(_)
        │ │ │ │ │ @@ -32,20 +32,20 @@
        │ │ │ │ │  [_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 (bitfield const& rhs);
        │ │ │ │ │ +   bbiittffiieelldd () noexcept = default;
        │ │ │ │ │     explicit bbiittffiieelldd (int bits);
        │ │ │ │ │ -   bbiittffiieelldd (char const* b, int bits);
        │ │ │ │ │     bbiittffiieelldd (bitfield&& rhs) noexcept = default;
        │ │ │ │ │ -   bbiittffiieelldd () noexcept = default;
        │ │ │ │ │ +   bbiittffiieelldd (char const* b, int bits);
        │ │ │ │ │ +   bbiittffiieelldd (int bits, bool val);
        │ │ │ │ │ +   bbiittffiieelldd (bitfield const& rhs);
        │ │ │ │ │     void aassssiiggnn (char const* b, int const bits);
        │ │ │ │ │     bool ggeett__bbiitt (int index) const noexcept;
        │ │ │ │ │     bool ooppeerraattoorr[[]] (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;
        │ │ │ │ │ @@ -59,20 +59,20 @@
        │ │ │ │ │     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 (bitfield const& rhs);
        │ │ │ │ │ +bbiittffiieelldd () noexcept = default;
        │ │ │ │ │  explicit bbiittffiieelldd (int bits);
        │ │ │ │ │ -bbiittffiieelldd (char const* b, int bits);
        │ │ │ │ │  bbiittffiieelldd (bitfield&& rhs) noexcept = default;
        │ │ │ │ │ -bbiittffiieelldd () noexcept = default;
        │ │ │ │ │ +bbiittffiieelldd (char const* b, int bits);
        │ │ │ │ │ +bbiittffiieelldd (int bits, bool val);
        │ │ │ │ │ +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]
        │ │ │ │ │ @@ -82,15 +82,15 @@
        │ │ │ │ │  byte boundary.
        │ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
        │ │ │ │ │  ********** ooppeerraattoorr[[]](()) ggeett__bbiitt(()) **********
        │ │ │ │ │  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]
        │ │ │ │ │ -********** sseett__bbiitt(()) cclleeaarr__bbiitt(()) **********
        │ │ │ │ │ +********** cclleeaarr__bbiitt(()) sseett__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
        │ │ │ │ │ @@ -151,35 +151,35 @@
        │ │ │ │ │  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 (hasher const&);
        │ │ │ │ │     explicit hhaasshheerr (span data);
        │ │ │ │ │ -   hasher& ooppeerraattoorr== (hasher const&) &;
        │ │ │ │ │     hhaasshheerr (char const* data, int len);
        │ │ │ │ │ -   hhaasshheerr (hasher const&);
        │ │ │ │ │ -   hasher& uuppddaattee (span data);
        │ │ │ │ │ +   hasher& ooppeerraattoorr== (hasher const&) &;
        │ │ │ │ │     hasher& uuppddaattee (char const* data, int len);
        │ │ │ │ │ +   hasher& uuppddaattee (span data);
        │ │ │ │ │     sha1_hash ffiinnaall ();
        │ │ │ │ │     void rreesseett ();
        │ │ │ │ │  };
        │ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
        │ │ │ │ │ -********** hhaasshheerr(()) ooppeerraattoorr==(()) **********
        │ │ │ │ │ +********** ooppeerraattoorr==(()) hhaasshheerr(()) **********
        │ │ │ │ │ +hhaasshheerr (hasher const&);
        │ │ │ │ │  explicit hhaasshheerr (span data);
        │ │ │ │ │ -hasher& ooppeerraattoorr== (hasher const&) &;
        │ │ │ │ │  hhaasshheerr (char const* data, int len);
        │ │ │ │ │ -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 data);
        │ │ │ │ │  hasher& uuppddaattee (char const* data, int len);
        │ │ │ │ │ +hasher& uuppddaattee (span data);
        │ │ │ │ │  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]
        │ │ │ │ │ @@ -189,36 +189,36 @@
        │ │ │ │ │  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 (char const* data, int len);
        │ │ │ │ │     explicit hhaasshheerr225566 (span data);
        │ │ │ │ │ +   hhaasshheerr225566 (char const* data, int len);
        │ │ │ │ │     hasher256& ooppeerraattoorr== (hasher256 const&) &;
        │ │ │ │ │     hhaasshheerr225566 (hasher256 const&);
        │ │ │ │ │ -   hasher256& uuppddaattee (span data);
        │ │ │ │ │     hasher256& uuppddaattee (char const* data, int len);
        │ │ │ │ │ +   hasher256& uuppddaattee (span data);
        │ │ │ │ │     sha256_hash ffiinnaall ();
        │ │ │ │ │     void rreesseett ();
        │ │ │ │ │     ~~hhaasshheerr225566 ();
        │ │ │ │ │  };
        │ │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
        │ │ │ │ │  ********** hhaasshheerr225566(()) ooppeerraattoorr==(()) **********
        │ │ │ │ │ -hhaasshheerr225566 (char const* data, int len);
        │ │ │ │ │  explicit hhaasshheerr225566 (span data);
        │ │ │ │ │ +hhaasshheerr225566 (char const* data, int len);
        │ │ │ │ │  hasher256& ooppeerraattoorr== (hasher256 const&) &;
        │ │ │ │ │  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 data);
        │ │ │ │ │  hasher256& uuppddaattee (char const* data, int len);
        │ │ │ │ │ +hasher256& uuppddaattee (span data);
        │ │ │ │ │  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]
        │ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-ed25519.html
        │ │ │ │┄ Ordering differences only
        │ │ │ │ @@ -84,18 +84,18 @@
        │ │ │ │  
        │ │ │ │

        Verifies the signature on the given message using pk

        │ │ │ │ [report issue]
        │ │ │ │
        │ │ │ │

        ed25519_add_scalar()

        │ │ │ │

        Declared in "libtorrent/kademlia/ed25519.hpp"

        │ │ │ │
        │ │ │ │ -secret_key ed25519_add_scalar (secret_key const& sk
        │ │ │ │ -   , std::array<char, 32> const& scalar);
        │ │ │ │  public_key ed25519_add_scalar (public_key const& pk
        │ │ │ │     , std::array<char, 32> const& scalar);
        │ │ │ │ +secret_key ed25519_add_scalar (secret_key const& sk
        │ │ │ │ +   , std::array<char, 32> const& scalar);
        │ │ │ │  
        │ │ │ │

        Adds a scalar to the given key pair where scalar is a 32 byte buffer │ │ │ │ (possibly generated with ed25519_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 │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -39,18 +39,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 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" │ │ │ │ │ -secret_key eedd2255551199__aadddd__ssccaallaarr (secret_key const& sk │ │ │ │ │ - , std::array const& scalar); │ │ │ │ │ public_key eedd2255551199__aadddd__ssccaallaarr (public_key const& pk │ │ │ │ │ , std::array const& scalar); │ │ │ │ │ +secret_key eedd2255551199__aadddd__ssccaallaarr (secret_key const& sk │ │ │ │ │ + , std::array 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/reference.html │ │ │ │┄ Ordering differences only │ │ │ │ @@ -19,214 +19,214 @@ │ │ │ │ libtorrent logo │ │ │ │ │ │ │ │

        │ │ │ │

        reference documentation

        │ │ │ │ │ │ │ │

        single-page version

        │ │ │ │
        │ │ │ │ +

        Torrent Handle

        │ │ │ │ +
        │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
        │ │ │ │ +

        Torrent Info

        │ │ │ │ +
        │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
        │ │ │ │ +

        Trackers

        │ │ │ │ +
        │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
        │ │ │ │

        Session

        │ │ │ │
        │ │ │ │ - │ │ │ │ - │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │
        │ │ │ │ +

        Stats

        │ │ │ │ +
        │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
        │ │ │ │ +

        Add Torrent

        │ │ │ │ +
        │ │ │ │ + │ │ │ │ + │ │ │ │ +
        │ │ │ │

        Core

        │ │ │ │
        │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
        │ │ │ │ -

        Add Torrent

        │ │ │ │ -
        │ │ │ │ - │ │ │ │ - │ │ │ │ -
        │ │ │ │ -

        Torrent Info

        │ │ │ │ +

        Torrent Status

        │ │ │ │
        │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │
        │ │ │ │

        Settings

        │ │ │ │
        │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
        │ │ │ │ -

        Stats

        │ │ │ │ -
        │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
        │ │ │ │ -

        Torrent Status

        │ │ │ │ -
        │ │ │ │ - │ │ │ │ -
        │ │ │ │ -

        Trackers

        │ │ │ │ -
        │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
        │ │ │ │ -

        Torrent Handle

        │ │ │ │ -
        │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │
        │ │ │ │

        DHT

        │ │ │ │
        │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │
        │ │ │ │

        Resume Data

        │ │ │ │
        │ │ │ │ - │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
        │ │ │ │
        │ │ │ │
        │ │ │ │ +

        Bdecoding

        │ │ │ │ +
        │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
        │ │ │ │ +

        Bencoding

        │ │ │ │ +
        │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
        │ │ │ │

        Error Codes

        │ │ │ │
        │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │
        │ │ │ │ -

        Bencoding

        │ │ │ │ -
        │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
        │ │ │ │ -

        Filter

        │ │ │ │ -
        │ │ │ │ - │ │ │ │ - │ │ │ │ -
        │ │ │ │ -

        Bdecoding

        │ │ │ │ -
        │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
        │ │ │ │

        Create Torrents

        │ │ │ │
        │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
        │ │ │ │ -
        │ │ │ │ -
        │ │ │ │ -

        Custom Storage

        │ │ │ │ -
        │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
        │ │ │ │ -

        Utility

        │ │ │ │ +

        Filter

        │ │ │ │
        │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │
        │ │ │ │ -

        PeerClass

        │ │ │ │ -
        │ │ │ │ - │ │ │ │ - │ │ │ │
        │ │ │ │ +
        │ │ │ │

        Plugins

        │ │ │ │
        │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ +
        │ │ │ │ +

        PeerClass

        │ │ │ │ +
        │ │ │ │ + │ │ │ │ + │ │ │ │ +
        │ │ │ │ +

        Utility

        │ │ │ │ +
        │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │
        │ │ │ │

        Storage

        │ │ │ │
        │ │ │ │ - │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
        │ │ │ │ +

        Custom Storage

        │ │ │ │ +
        │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
        │ │ │ │

        ed25519

        │ │ │ │
        │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,165 +1,165 @@ │ │ │ │ │ > │ │ │ │ │ _[_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 │ │ │ │ │ +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 │ │ │ │ │ +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 │ │ │ │ │ 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 │ │ │ │ │ -_w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s_(_) │ │ │ │ │ +_s_e_s_s_i_o_n___p_r_o_x_y │ │ │ │ │ +_s_e_s_s_i_o_n │ │ │ │ │ _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_(_) │ │ │ │ │ _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s___b_u_f_(_) │ │ │ │ │ +Stats │ │ │ │ │ +_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 │ │ │ │ │ +_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 │ │ │ │ │ Core │ │ │ │ │ _i_n_f_o___h_a_s_h___t │ │ │ │ │ +_p_e_e_r___r_e_q_u_e_s_t │ │ │ │ │ _p_e_e_r___i_n_f_o │ │ │ │ │ _p_i_e_c_e___b_l_o_c_k │ │ │ │ │ -_p_e_e_r___r_e_q_u_e_s_t │ │ │ │ │ +_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_(_) │ │ │ │ │ _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_(_) │ │ │ │ │ _l_o_a_d___t_o_r_r_e_n_t___p_a_r_s_e_d_(_) │ │ │ │ │ _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_(_) │ │ │ │ │ _v_e_r_s_i_o_n_(_) │ │ │ │ │ -_t_o_r_r_e_n_t___p_e_e_r___e_q_u_a_l_(_) │ │ │ │ │ -_p_r_o_t_o_c_o_l___v_e_r_s_i_o_n │ │ │ │ │ -_e_v_e_n_t___t │ │ │ │ │ -_c_o_n_n_e_c_t_i_o_n___t_y_p_e │ │ │ │ │ _s_o_c_k_e_t___t_y_p_e___t │ │ │ │ │ +_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 │ │ │ │ │ +_c_o_n_n_e_c_t_i_o_n___t_y_p_e │ │ │ │ │ _d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y___t │ │ │ │ │ -_p_e_x___f_l_a_g_s___t │ │ │ │ │ _i_n_t │ │ │ │ │ _t_o_r_r_e_n_t___f_l_a_g_s___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 │ │ │ │ │ -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 │ │ │ │ │ -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 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 │ │ │ │ │ +_g_e_n_e_r_a_t_e___f_i_n_g_e_r_p_r_i_n_t_(_) │ │ │ │ │ _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_(_) │ │ │ │ │ -_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_(_) │ │ │ │ │ +_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_(_) │ │ │ │ │ -_g_e_n_e_r_a_t_e___f_i_n_g_e_r_p_r_i_n_t_(_) │ │ │ │ │ -Stats │ │ │ │ │ -_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 │ │ │ │ │ -Torrent Status │ │ │ │ │ -_t_o_r_r_e_n_t___s_t_a_t_u_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 │ │ │ │ │ -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_(_) │ │ │ │ │ DHT │ │ │ │ │ _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 │ │ │ │ │ -_s_i_g_n___m_u_t_a_b_l_e___i_t_e_m_(_) │ │ │ │ │ _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 │ │ │ │ │ -_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___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_(_) │ │ │ │ │ _r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_) │ │ │ │ │ _w_r_i_t_e___t_o_r_r_e_n_t___f_l_a_g_s___t │ │ │ │ │ +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 │ │ │ │ │ +_o_p_e_r_a_t_o_r_<_<_(_) │ │ │ │ │ +_b_e_n_c_o_d_e_(_) │ │ │ │ │ Error Codes │ │ │ │ │ _s_t_o_r_a_g_e___e_r_r_o_r │ │ │ │ │ +_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_(_) │ │ │ │ │ +_s_o_c_k_s___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_(_) │ │ │ │ │ -_p_c_p___c_a_t_e_g_o_r_y_(_) │ │ │ │ │ _u_p_n_p___c_a_t_e_g_o_r_y_(_) │ │ │ │ │ +_p_c_p___c_a_t_e_g_o_r_y_(_) │ │ │ │ │ _g_z_i_p___c_a_t_e_g_o_r_y_(_) │ │ │ │ │ -_s_o_c_k_s___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_(_) │ │ │ │ │ +_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 │ │ │ │ │ -_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 │ │ │ │ │ +_h_t_t_p___e_r_r_o_r_s │ │ │ │ │ _e_r_r_o_r___c_o_d_e___e_n_u_m │ │ │ │ │ -_s_o_c_k_s___e_r_r_o_r___c_o_d_e │ │ │ │ │ -_i_2_p___e_r_r_o_r___c_o_d_e │ │ │ │ │ +_p_c_p___e_r_r_o_r_s │ │ │ │ │ _e_r_r_o_r___c_o_d_e___e_n_u_m │ │ │ │ │ -Bencoding │ │ │ │ │ -_o_v_e_r_v_i_e_w │ │ │ │ │ -_e_n_t_r_y │ │ │ │ │ -_o_p_e_r_a_t_o_r_<_<_(_) │ │ │ │ │ -_b_e_n_c_o_d_e_(_) │ │ │ │ │ -Filter │ │ │ │ │ -_i_p___f_i_l_t_e_r │ │ │ │ │ -_p_o_r_t___f_i_l_t_e_r │ │ │ │ │ -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_(_) │ │ │ │ │ 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_(_) │ │ │ │ │ -Custom Storage │ │ │ │ │ -_o_v_e_r_v_i_e_w │ │ │ │ │ -_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 │ │ │ │ │ -_d_i_s_k___o_b_s_e_r_v_e_r │ │ │ │ │ -_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 │ │ │ │ │ -_f_i_l_e___o_p_e_n___m_o_d_e___t │ │ │ │ │ -Utility │ │ │ │ │ -_b_i_t_f_i_e_l_d │ │ │ │ │ -_h_a_s_h_e_r │ │ │ │ │ -_h_a_s_h_e_r_2_5_6 │ │ │ │ │ -PeerClass │ │ │ │ │ -_p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r │ │ │ │ │ -_p_e_e_r___c_l_a_s_s___i_n_f_o │ │ │ │ │ +Filter │ │ │ │ │ +_i_p___f_i_l_t_e_r │ │ │ │ │ +_p_o_r_t___f_i_l_t_e_r │ │ │ │ │ Plugins │ │ │ │ │ _o_v_e_r_v_i_e_w │ │ │ │ │ _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 │ │ │ │ │ _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 │ │ │ │ │ +_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_(_) │ │ │ │ │ _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_(_) │ │ │ │ │ +PeerClass │ │ │ │ │ +_p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r │ │ │ │ │ +_p_e_e_r___c_l_a_s_s___i_n_f_o │ │ │ │ │ +Utility │ │ │ │ │ +_b_i_t_f_i_e_l_d │ │ │ │ │ +_h_a_s_h_e_r │ │ │ │ │ +_h_a_s_h_e_r_2_5_6 │ │ │ │ │ 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_(_) │ │ │ │ │ +_s_t_o_r_a_g_e___p_a_r_a_m_s │ │ │ │ │ _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_(_) │ │ │ │ │ +_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_(_) │ │ │ │ │ _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 │ │ │ │ │ +Custom Storage │ │ │ │ │ +_o_v_e_r_v_i_e_w │ │ │ │ │ +_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 │ │ │ │ │ +_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 │ │ │ │ │ +_d_i_s_k___o_b_s_e_r_v_e_r │ │ │ │ │ +_s_e_t_t_i_n_g_s___i_n_t_e_r_f_a_c_e │ │ │ │ │ +_f_i_l_e___o_p_e_n___m_o_d_e___t │ │ │ │ │ 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_(_) │ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/single-page-ref.html │ │ │ │ @@ -28,728 +28,728 @@ │ │ │ │
    │ │ │ │ │ │ │ │
    source_torrent1the tracker was part of the .torrent file
    source_client2the tracker was added programmatically via the add_tracker() functionthe tracker was added programmatically via the add_tracker() function
    source_magnet_link4the tracker was part of a magnet link
    source_tex82.0.11
    │ │ │ │

    home

    │ │ │ │
    │ │ │ │

    Table of contents

    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -

    session_proxy

    │ │ │ │ -

    Declared in "libtorrent/session.hpp"

    │ │ │ │ -

    this is a holder for the internal session implementation object. Once the │ │ │ │ -session destruction is explicitly initiated, this holder is used to │ │ │ │ -synchronize the completion of the shutdown. The lifetime of this object │ │ │ │ -may outlive session, causing the session destructor to not block. The │ │ │ │ -session_proxy destructor will block however, until the underlying session │ │ │ │ -is done shutting down.

    │ │ │ │ +[report issue]
    │ │ │ │ +

    bdecode_node

    │ │ │ │ +

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ +

    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 │ │ │ │ +non_owning() member function.

    │ │ │ │ +

    There are 5 different types of nodes, see type_t.

    │ │ │ │
    │ │ │ │ -struct session_proxy
    │ │ │ │ +struct bdecode_node
    │ │ │ │  {
    │ │ │ │ -   session_proxy ();
    │ │ │ │ -   session_proxy (session_proxy&&) noexcept;
    │ │ │ │ -   session_proxy& operator= (session_proxy&&) & noexcept;
    │ │ │ │ -   ~session_proxy ();
    │ │ │ │ -   session_proxy& operator= (session_proxy const&) &;
    │ │ │ │ -   session_proxy (session_proxy const&);
    │ │ │ │ +   bdecode_node () = default;
    │ │ │ │ +   bdecode_node (bdecode_node const&);
    │ │ │ │ +   bdecode_node (bdecode_node&&) noexcept;
    │ │ │ │ +   bdecode_node& operator= (bdecode_node const&) &;
    │ │ │ │ +   bdecode_node& operator= (bdecode_node&&) & = default;
    │ │ │ │ +   type_t type () const noexcept;
    │ │ │ │ +   explicit operator bool () const noexcept;
    │ │ │ │ +   bdecode_node non_owning () const;
    │ │ │ │ +   std::ptrdiff_t data_offset () const noexcept;
    │ │ │ │ +   span<char const> data_section () const noexcept;
    │ │ │ │ +   std::int64_t list_int_value_at (int i
    │ │ │ │ +      , std::int64_t default_val = 0) const;
    │ │ │ │ +   int list_size () const;
    │ │ │ │ +   bdecode_node list_at (int i) const;
    │ │ │ │ +   string_view list_string_value_at (int i
    │ │ │ │ +      , string_view default_val = string_view()) const;
    │ │ │ │ +   int dict_size () const;
    │ │ │ │ +   bdecode_node dict_find (string_view key) const;
    │ │ │ │ +   bdecode_node dict_find_list (string_view key) const;
    │ │ │ │ +   bdecode_node dict_find_string (string_view key) const;
    │ │ │ │ +   std::int64_t dict_find_int_value (string_view key
    │ │ │ │ +      , std::int64_t default_val = 0) const;
    │ │ │ │ +   std::pair<string_view, bdecode_node> dict_at (int i) const;
    │ │ │ │ +   std::pair<bdecode_node, bdecode_node> dict_at_node (int i) const;
    │ │ │ │ +   bdecode_node dict_find_int (string_view key) const;
    │ │ │ │ +   bdecode_node dict_find_dict (string_view key) const;
    │ │ │ │ +   string_view dict_find_string_value (string_view key
    │ │ │ │ +      , string_view default_value = string_view()) const;
    │ │ │ │ +   std::int64_t int_value () const;
    │ │ │ │ +   char const* string_ptr () const;
    │ │ │ │ +   string_view string_value () const;
    │ │ │ │ +   std::ptrdiff_t string_offset () const;
    │ │ │ │ +   int string_length () const;
    │ │ │ │ +   void clear ();
    │ │ │ │ +   void swap (bdecode_node& n);
    │ │ │ │ +   void reserve (int tokens);
    │ │ │ │ +   void switch_underlying_buffer (char const* buf) noexcept;
    │ │ │ │ +   bool has_soft_error (span<char> error) const;
    │ │ │ │ +
    │ │ │ │ +   enum type_t
    │ │ │ │ +   {
    │ │ │ │ +      none_t,
    │ │ │ │ +      dict_t,
    │ │ │ │ +      list_t,
    │ │ │ │ +      string_t,
    │ │ │ │ +      int_t,
    │ │ │ │ +   };
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    ~session_proxy() session_proxy() operator=()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    bdecode_node()

    │ │ │ │
    │ │ │ │ -session_proxy ();
    │ │ │ │ -session_proxy (session_proxy&&) noexcept;
    │ │ │ │ -session_proxy& operator= (session_proxy&&) & noexcept;
    │ │ │ │ -~session_proxy ();
    │ │ │ │ -session_proxy& operator= (session_proxy const&) &;
    │ │ │ │ -session_proxy (session_proxy const&);
    │ │ │ │ +bdecode_node () = default;
    │ │ │ │  
    │ │ │ │ -

    default constructor, does not refer to any session │ │ │ │ -implementation object.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    session

    │ │ │ │ -

    Declared in "libtorrent/session.hpp"

    │ │ │ │ -

    The session holds all state that spans multiple torrents. Among other │ │ │ │ -things it runs the network loop and manages all torrents. Once it's │ │ │ │ -created, the session 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.

    │ │ │ │ -

    You have some control over session configuration through the │ │ │ │ -session_handle::apply_settings() member function. To change one or more │ │ │ │ -configuration options, create a settings_pack. object and fill it with │ │ │ │ -the settings to be set and pass it in to session::apply_settings().

    │ │ │ │ -

    see apply_settings().

    │ │ │ │ +

    creates a default constructed node, it will have the type none_t.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    bdecode_node() operator=()

    │ │ │ │
    │ │ │ │ -struct session : session_handle
    │ │ │ │ -{
    │ │ │ │ -   session ();
    │ │ │ │ -   session (session_params const& params, session_flags_t flags);
    │ │ │ │ -   explicit session (session_params const& params);
    │ │ │ │ -   explicit session (session_params&& params);
    │ │ │ │ -   session (session_params&& params, session_flags_t flags);
    │ │ │ │ -   session (session_params&& params, io_context& ios);
    │ │ │ │ -   session (session_params const& params, io_context& ios, session_flags_t);
    │ │ │ │ -   session (session_params const& params, io_context& ios);
    │ │ │ │ -   session (session_params&& params, io_context& ios, session_flags_t);
    │ │ │ │ -   ~session ();
    │ │ │ │ -   session_proxy abort ();
    │ │ │ │ -};
    │ │ │ │ +bdecode_node (bdecode_node const&);
    │ │ │ │ +bdecode_node (bdecode_node&&) noexcept;
    │ │ │ │ +bdecode_node& operator= (bdecode_node const&) &;
    │ │ │ │ +bdecode_node& operator= (bdecode_node&&) & = default;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    session()

    │ │ │ │ +

    For owning nodes, the copy will create a copy of the tree, but the │ │ │ │ +underlying buffer remains the same.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    type()

    │ │ │ │
    │ │ │ │ -session ();
    │ │ │ │ -session (session_params const& params, session_flags_t flags);
    │ │ │ │ -explicit session (session_params const& params);
    │ │ │ │ -explicit session (session_params&& params);
    │ │ │ │ -session (session_params&& params, session_flags_t flags);
    │ │ │ │ +type_t type () const noexcept;
    │ │ │ │  
    │ │ │ │ -

    Constructs the session objects which acts as the container of torrents. │ │ │ │ -In order to avoid a race condition between starting the session and │ │ │ │ -configuring it, you can pass in a session_params object. Its settings │ │ │ │ -will take effect before the session starts up.

    │ │ │ │ -

    The overloads taking flags can be used to start a session in │ │ │ │ -paused mode (by passing in session::paused). Note that │ │ │ │ -add_default_plugins do not have an affect on constructors that │ │ │ │ -take a session_params object. It already contains the plugins to use.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    session()

    │ │ │ │ +

    the type of this node. See type_t.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    bool()

    │ │ │ │
    │ │ │ │ -session (session_params&& params, io_context& ios);
    │ │ │ │ -session (session_params const& params, io_context& ios, session_flags_t);
    │ │ │ │ -session (session_params const& params, io_context& ios);
    │ │ │ │ -session (session_params&& params, io_context& ios, session_flags_t);
    │ │ │ │ +explicit operator bool () const noexcept;
    │ │ │ │  
    │ │ │ │ -

    Overload of the constructor that takes an external io_context to run │ │ │ │ -the session 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 session object does not cleanly terminate with an external │ │ │ │ -io_context. The io_context::run() call must have returned │ │ │ │ -before it's safe to destruct the session. Which means you MUST │ │ │ │ -call session::abort() and save the session_proxy first, then │ │ │ │ -destruct the session object, then sync with the io_context, then │ │ │ │ -destruct the session_proxy object.

    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    ~session()

    │ │ │ │ +

    returns true if type() != none_t.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    non_owning()

    │ │ │ │
    │ │ │ │ -~session ();
    │ │ │ │ +bdecode_node non_owning () const;
    │ │ │ │  
    │ │ │ │ -

    The destructor of session 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 session returns. So, it's advised │ │ │ │ -that any kind of interface (such as windows) are closed before │ │ │ │ -destructing the session object. Because it can take a few second for │ │ │ │ -it to finish. The timeout can be set with apply_settings().

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    abort()

    │ │ │ │ +

    return a non-owning reference to this node. This is useful to refer to │ │ │ │ +the root node without copying it in assignments.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    data_offset() data_section()

    │ │ │ │
    │ │ │ │ -session_proxy abort ();
    │ │ │ │ +std::ptrdiff_t data_offset () const noexcept;
    │ │ │ │ +span<char const> data_section () const noexcept;
    │ │ │ │  
    │ │ │ │ -

    In case you want to destruct the session asynchronously, you can │ │ │ │ -request a session destruction proxy. If you don't do this, the │ │ │ │ -destructor of the session object will block while the trackers are │ │ │ │ -contacted. If you keep one session_proxy to the session when │ │ │ │ -destructing it, the destructor will not block, but start to close down │ │ │ │ -the session, the destructor of the proxy will then synchronize the │ │ │ │ -threads. So, the destruction of the session is performed from the │ │ │ │ -session destructor call until the session_proxy destructor │ │ │ │ -call. The session_proxy does not have any operations on it (since │ │ │ │ -the session is being closed down, no operations are allowed on it). │ │ │ │ -The only valid operation is calling the destructor:

    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    list_int_value_at() list_string_value_at() list_size() list_at()

    │ │ │ │
    │ │ │ │ -struct session_proxy {};
    │ │ │ │ +std::int64_t list_int_value_at (int i
    │ │ │ │ +      , std::int64_t default_val = 0) const;
    │ │ │ │ +int list_size () const;
    │ │ │ │ +bdecode_node list_at (int i) const;
    │ │ │ │ +string_view list_string_value_at (int i
    │ │ │ │ +      , string_view default_val = string_view()) const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dict_at_node() dict_find_string() dict_find_int() dict_find_string_value() dict_find_list() dict_find_dict() dict_find_int_value() dict_at() dict_size() dict_find()

    │ │ │ │ +
    │ │ │ │ +int dict_size () const;
    │ │ │ │ +bdecode_node dict_find (string_view key) const;
    │ │ │ │ +bdecode_node dict_find_list (string_view key) const;
    │ │ │ │ +bdecode_node dict_find_string (string_view key) const;
    │ │ │ │ +std::int64_t dict_find_int_value (string_view key
    │ │ │ │ +      , std::int64_t default_val = 0) const;
    │ │ │ │ +std::pair<string_view, bdecode_node> dict_at (int i) const;
    │ │ │ │ +std::pair<bdecode_node, bdecode_node> dict_at_node (int i) const;
    │ │ │ │ +bdecode_node dict_find_int (string_view key) const;
    │ │ │ │ +bdecode_node dict_find_dict (string_view key) const;
    │ │ │ │ +string_view dict_find_string_value (string_view key
    │ │ │ │ +      , string_view default_value = string_view()) 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 bdecode_node.

    │ │ │ │ +

    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).

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    int_value()

    │ │ │ │ +
    │ │ │ │ +std::int64_t int_value () const;
    │ │ │ │ +
    │ │ │ │ +

    this function is only valid if type() == int_t. It returns the │ │ │ │ +value of the integer.

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    string_ptr() string_value() string_offset() string_length()

    │ │ │ │ +
    │ │ │ │ +char const* string_ptr () const;
    │ │ │ │ +string_view string_value () const;
    │ │ │ │ +std::ptrdiff_t string_offset () const;
    │ │ │ │ +int string_length () const;
    │ │ │ │ +
    │ │ │ │ +

    these functions are only valid if type() == string_t. They return │ │ │ │ +the string values. Note that string_ptr() is not 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    clear()

    │ │ │ │ +
    │ │ │ │ +void clear ();
    │ │ │ │ +
    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    swap()

    │ │ │ │ +
    │ │ │ │ +void swap (bdecode_node& n);
    │ │ │ │ +
    │ │ │ │ +

    Swap contents.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    reserve()

    │ │ │ │ +
    │ │ │ │ +void reserve (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 bdecode().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    switch_underlying_buffer()

    │ │ │ │ +
    │ │ │ │ +void switch_underlying_buffer (char const* buf) noexcept;
    │ │ │ │ +
    │ │ │ │ +

    this buffer MUST be identical to the one originally parsed. This │ │ │ │ +operation is only defined on owning root nodes, i.e. the one passed in to │ │ │ │ +decode().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    has_soft_error()

    │ │ │ │ +
    │ │ │ │ +bool has_soft_error (span<char> error) const;
    │ │ │ │ +
    │ │ │ │ +

    returns true if there is a non-fatal error in the bencoding of this node │ │ │ │ +or its children

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum type_t

    │ │ │ │ +

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    none_t0uninitialized or default constructed. This is also used │ │ │ │ +to indicate that a node was not found in some cases.
    dict_t1a dictionary node. The dict_find_ functions are valid.
    list_t2a list node. The list_ functions are valid.
    string_t3a string node, the string_ functions are valid.
    int_t4an integer node. The int_ functions are valid.
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    session_params

    │ │ │ │ -

    Declared in "libtorrent/session_params.hpp"

    │ │ │ │ -

    The session_params is a parameters pack for configuring the session │ │ │ │ -before it's started.

    │ │ │ │ +
    │ │ │ │ +

    print_entry()

    │ │ │ │ +

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │
    │ │ │ │ -struct session_params
    │ │ │ │ +std::string print_entry (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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    bdecode()

    │ │ │ │ +

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ +
    │ │ │ │ +bdecode_node bdecode (span<char const> buffer
    │ │ │ │ +   , error_code& ec, int* error_pos = nullptr, int depth_limit = 100
    │ │ │ │ +   , int token_limit = 2000000);
    │ │ │ │ +bdecode_node bdecode (span<char const> buffer
    │ │ │ │ +   , int depth_limit = 100, int token_limit = 2000000);
    │ │ │ │ +int bdecode (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.

    │ │ │ │ +

    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 owning 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    block_info

    │ │ │ │ +

    Declared in "libtorrent/torrent_handle.hpp"

    │ │ │ │ +

    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
    │ │ │ │  {
    │ │ │ │ -   session_params (settings_pack&& sp);
    │ │ │ │ -   session_params (settings_pack const& sp);
    │ │ │ │ -   session_params ();
    │ │ │ │ -   session_params (settings_pack&& sp
    │ │ │ │ -      , std::vector<std::shared_ptr<plugin>> exts);
    │ │ │ │ -   session_params (settings_pack const& sp
    │ │ │ │ -      , std::vector<std::shared_ptr<plugin>> exts);
    │ │ │ │ +   void set_peer (tcp::endpoint const& ep);
    │ │ │ │ +   tcp::endpoint peer () const;
    │ │ │ │  
    │ │ │ │ -   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;
    │ │ │ │ +   enum block_state_t
    │ │ │ │ +   {
    │ │ │ │ +      none,
    │ │ │ │ +      requested,
    │ │ │ │ +      writing,
    │ │ │ │ +      finished,
    │ │ │ │ +   };
    │ │ │ │ +
    │ │ │ │ +   unsigned bytes_progress:15;
    │ │ │ │ +   unsigned block_size:15;
    │ │ │ │ +   unsigned state:2;
    │ │ │ │ +   unsigned num_peers:14;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    session_params()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    peer() set_peer()

    │ │ │ │
    │ │ │ │ -session_params (settings_pack&& sp);
    │ │ │ │ -session_params (settings_pack const& sp);
    │ │ │ │ -session_params ();
    │ │ │ │ +void set_peer (tcp::endpoint const& ep);
    │ │ │ │ +tcp::endpoint peer () const;
    │ │ │ │  
    │ │ │ │ -

    This constructor can be used to start with the default plugins │ │ │ │ -(ut_metadata, ut_pex and smart_ban). Pass a settings_pack to set the │ │ │ │ -initial settings when the session starts.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    session_params()

    │ │ │ │ +

    The peer is the ip address of the peer this block was downloaded from.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum block_state_t

    │ │ │ │ +

    Declared in "libtorrent/torrent_handle.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    none0This block has not been downloaded or requested form any peer.
    requested1The block has been requested, but not completely downloaded yet.
    writing2The block has been downloaded and is currently queued for being │ │ │ │ +written to disk.
    finished3The block has been written to disk.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    bytes_progress
    │ │ │ │ +
    the number of bytes that have been received for this block
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    block_size
    │ │ │ │ +
    the total number of bytes in this block.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    state
    │ │ │ │ +
    the state this block is in (see block_state_t)
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    num_peers
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    partial_piece_info

    │ │ │ │ +

    Declared in "libtorrent/torrent_handle.hpp"

    │ │ │ │ +

    This class holds information about pieces that have outstanding requests │ │ │ │ +or outstanding writes

    │ │ │ │
    │ │ │ │ -session_params (settings_pack&& sp
    │ │ │ │ -      , std::vector<std::shared_ptr<plugin>> exts);
    │ │ │ │ -session_params (settings_pack const& sp
    │ │ │ │ -      , std::vector<std::shared_ptr<plugin>> exts);
    │ │ │ │ +struct partial_piece_info
    │ │ │ │ +{
    │ │ │ │ +   piece_index_t piece_index;
    │ │ │ │ +   int blocks_in_piece;
    │ │ │ │ +   int finished;
    │ │ │ │ +   int writing;
    │ │ │ │ +   int requested;
    │ │ │ │ +   block_info const* blocks;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    This constructor helps to configure the set of initial plugins │ │ │ │ -to be added to the session before it's started.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    settings
    │ │ │ │ -
    The settings to configure the session with
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    extensions
    │ │ │ │ -
    the plugins to add to the session as it is constructed
    │ │ │ │ +[report issue]
    │ │ │ │ +
    piece_index
    │ │ │ │ +
    the index of the piece in question. blocks_in_piece 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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    dht_state
    │ │ │ │ -
    DHT node ID and node addresses to bootstrap the DHT with.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    blocks_in_piece
    │ │ │ │ +
    the number of blocks in this piece
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    dht_storage_constructor
    │ │ │ │ -
    function object to construct the storage object for DHT items.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    finished
    │ │ │ │ +
    the number of blocks that are in the finished state
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    disk_io_constructor
    │ │ │ │ -
    function object to create the disk I/O subsystem. Defaults to │ │ │ │ -default_disk_io_constructor.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    writing
    │ │ │ │ +
    the number of blocks that are in the writing state
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    ext_state
    │ │ │ │ -
    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 read_session_params() and write_session_params().
    │ │ │ │ +[report issue]
    │ │ │ │ +
    requested
    │ │ │ │ +
    the number of blocks that are in the requested state
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    ip_filter
    │ │ │ │ -
    the IP filter to use for the session. This restricts which peers are allowed │ │ │ │ -to connect. As if passed to set_ip_filter().
    │ │ │ │ +[report issue]
    │ │ │ │ +
    blocks
    │ │ │ │ +

    this is an array of blocks_in_piece number of │ │ │ │ +items. One for each block in the piece.

    │ │ │ │ +
    │ │ │ │ +

    Warning

    │ │ │ │ +

    This is a pointer that points to an array │ │ │ │ +that's owned by the session object. The next time │ │ │ │ +get_download_queue() is called, it will be invalidated. │ │ │ │ +In the case of piece_info_alert, these pointers point into the alert │ │ │ │ +object itself, and will be invalidated when the alert destruct.

    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    torrent_handle

    │ │ │ │ +

    Declared in "libtorrent/torrent_handle.hpp"

    │ │ │ │ +

    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.

    │ │ │ │ +
    │ │ │ │ +

    Warning

    │ │ │ │ +

    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 │ │ │ │ +torrent_handle::status() call.

    │ │ │ │ +
    │ │ │ │ +

    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 invalid_handle.

    │ │ │ │ +
    │ │ │ │ +

    Warning

    │ │ │ │ +

    All operations on a torrent_handle may throw system_error │ │ │ │ +exception, in case the handle is no longer referring to a torrent. │ │ │ │ +There is one exception is_valid() 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.

    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    session_handle

    │ │ │ │ -

    Declared in "libtorrent/session_handle.hpp"

    │ │ │ │ -

    this class provides a non-owning handle to a session and a subset of the │ │ │ │ -interface of the session class. If the underlying session is destructed │ │ │ │ -any handle to it will no longer be valid. is_valid() will return false and │ │ │ │ -any operation on it will throw a system_error exception, with error code │ │ │ │ -invalid_session_handle.

    │ │ │ │
    │ │ │ │ -struct session_handle
    │ │ │ │ +struct torrent_handle
    │ │ │ │  {
    │ │ │ │ +   friend std::size_t hash_value (torrent_handle const& th);
    │ │ │ │ +   torrent_handle () noexcept = default;
    │ │ │ │ +   void add_piece (piece_index_t piece, std::vector<char> data, add_piece_flags_t flags = {}) const;
    │ │ │ │ +   void add_piece (piece_index_t piece, char const* data, add_piece_flags_t flags = {}) const;
    │ │ │ │ +   void read_piece (piece_index_t piece) const;
    │ │ │ │ +   bool have_piece (piece_index_t piece) const;
    │ │ │ │ +   void post_peer_info () const;
    │ │ │ │ +   void get_peer_info (std::vector<peer_info>& v) const;
    │ │ │ │ +   void post_status (status_flags_t flags = status_flags_t::all()) const;
    │ │ │ │ +   torrent_status status (status_flags_t flags = status_flags_t::all()) const;
    │ │ │ │ +   void get_download_queue (std::vector<partial_piece_info>& queue) const;
    │ │ │ │ +   std::vector<partial_piece_info> get_download_queue () const;
    │ │ │ │ +   void post_download_queue () const;
    │ │ │ │ +   void clear_piece_deadlines () const;
    │ │ │ │ +   void reset_piece_deadline (piece_index_t index) const;
    │ │ │ │ +   void set_piece_deadline (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;
    │ │ │ │ +   void file_progress (std::vector<std::int64_t>& progress, file_progress_flags_t flags = {}) const;
    │ │ │ │ +   void post_file_progress (file_progress_flags_t flags) const;
    │ │ │ │ +   std::vector<std::int64_t> file_progress (file_progress_flags_t flags = {}) const;
    │ │ │ │ +   std::vector<open_file_state> file_status () const;
    │ │ │ │ +   void clear_error () const;
    │ │ │ │ +   void add_tracker (announce_entry const&) const;
    │ │ │ │ +   void post_trackers () const;
    │ │ │ │ +   std::vector<announce_entry> trackers () const;
    │ │ │ │ +   void replace_trackers (std::vector<announce_entry> const&) const;
    │ │ │ │ +   void remove_url_seed (std::string const& url) const;
    │ │ │ │ +   std::set<std::string> url_seeds () const;
    │ │ │ │ +   void add_url_seed (std::string const& url) const;
    │ │ │ │ +   void add_http_seed (std::string const& url) const;
    │ │ │ │ +   std::set<std::string> http_seeds () const;
    │ │ │ │ +   void remove_http_seed (std::string const& url) const;
    │ │ │ │ +   void add_extension (
    │ │ │ │ +      std::function<std::shared_ptr<torrent_plugin>(torrent_handle const&, client_data_t)> const& ext
    │ │ │ │ +      , client_data_t userdata = client_data_t{});
    │ │ │ │ +   bool set_metadata (span<char const> metadata) const;
    │ │ │ │     bool is_valid () const;
    │ │ │ │ -   session_params session_state (save_state_flags_t flags = save_state_flags_t::all()) const;
    │ │ │ │ -   void refresh_torrent_status (std::vector<torrent_status>* ret
    │ │ │ │ -      , status_flags_t flags = {}) const;
    │ │ │ │ -   std::vector<torrent_status> get_torrent_status (
    │ │ │ │ -      std::function<bool(torrent_status const&)> const& pred
    │ │ │ │ -      , status_flags_t flags = {}) const;
    │ │ │ │ -   void post_torrent_updates (status_flags_t flags = status_flags_t::all());
    │ │ │ │ -   void post_session_stats ();
    │ │ │ │ -   void post_dht_stats ();
    │ │ │ │ -   void set_dht_state (dht::dht_state const& st);
    │ │ │ │ -   void set_dht_state (dht::dht_state&& st);
    │ │ │ │ -   std::vector<torrent_handle> get_torrents () const;
    │ │ │ │ -   torrent_handle find_torrent (sha1_hash const& info_hash) const;
    │ │ │ │ -   torrent_handle add_torrent (add_torrent_params&& params);
    │ │ │ │ -   torrent_handle add_torrent (add_torrent_params const& params, error_code& ec);
    │ │ │ │ -   void async_add_torrent (add_torrent_params&& params);
    │ │ │ │ -   torrent_handle add_torrent (add_torrent_params&& params, error_code& ec);
    │ │ │ │ -   torrent_handle add_torrent (add_torrent_params const& params);
    │ │ │ │ -   void async_add_torrent (add_torrent_params const& params);
    │ │ │ │ -   bool is_paused () const;
    │ │ │ │ -   void resume ();
    │ │ │ │ -   void pause ();
    │ │ │ │ -   bool is_dht_running () const;
    │ │ │ │ -   void set_dht_storage (dht::dht_storage_constructor_type sc);
    │ │ │ │ -   void add_dht_node (std::pair<std::string, int> const& node);
    │ │ │ │ -   void dht_get_item (sha1_hash const& target);
    │ │ │ │ -   void dht_get_item (std::array<char, 32> key
    │ │ │ │ -      , std::string salt = std::string());
    │ │ │ │ -   sha1_hash dht_put_item (entry data);
    │ │ │ │ -   void 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 = std::string());
    │ │ │ │ -   void dht_announce (sha1_hash const& info_hash, int port = 0, dht::announce_flags_t flags = {});
    │ │ │ │ -   void dht_get_peers (sha1_hash const& info_hash);
    │ │ │ │ -   void dht_live_nodes (sha1_hash const& nid);
    │ │ │ │ -   void dht_sample_infohashes (udp::endpoint const& ep, sha1_hash const& target);
    │ │ │ │ -   void dht_direct_request (udp::endpoint const& ep, entry const& e, client_data_t userdata = {});
    │ │ │ │ -   void add_extension (std::shared_ptr<plugin> ext);
    │ │ │ │ -   void add_extension (std::function<std::shared_ptr<torrent_plugin>(
    │ │ │ │ -      torrent_handle const&, client_data_t)> ext);
    │ │ │ │ -   void set_ip_filter (ip_filter f);
    │ │ │ │ -   ip_filter get_ip_filter () const;
    │ │ │ │ -   void set_port_filter (port_filter const& f);
    │ │ │ │ -   unsigned short listen_port () const;
    │ │ │ │ -   unsigned short ssl_listen_port () const;
    │ │ │ │ -   bool is_listening () const;
    │ │ │ │ -   void set_peer_class_filter (ip_filter const& f);
    │ │ │ │ -   ip_filter get_peer_class_filter () const;
    │ │ │ │ -   void set_peer_class_type_filter (peer_class_type_filter const& f);
    │ │ │ │ -   peer_class_type_filter get_peer_class_type_filter () const;
    │ │ │ │ -   peer_class_t create_peer_class (char const* name);
    │ │ │ │ -   void delete_peer_class (peer_class_t cid);
    │ │ │ │ -   peer_class_info get_peer_class (peer_class_t cid) const;
    │ │ │ │ -   void set_peer_class (peer_class_t cid, peer_class_info const& pci);
    │ │ │ │ -   void remove_torrent (const torrent_handle&, remove_flags_t = {});
    │ │ │ │ -   void apply_settings (settings_pack const&);
    │ │ │ │ -   settings_pack get_settings () const;
    │ │ │ │ -   void apply_settings (settings_pack&&);
    │ │ │ │ -   void pop_alerts (std::vector<alert*>* alerts);
    │ │ │ │ -   alert* wait_for_alert (time_duration max_wait);
    │ │ │ │ -   void set_alert_notify (std::function<void()> const& fun);
    │ │ │ │ -   std::vector<port_mapping_t> add_port_mapping (portmap_protocol t, int external_port, int local_port);
    │ │ │ │ -   void delete_port_mapping (port_mapping_t handle);
    │ │ │ │ -   void reopen_network_sockets (reopen_network_flags_t options = reopen_map_ports);
    │ │ │ │ -   std::shared_ptr<aux::session_impl> native_handle () const;
    │ │ │ │ +   void resume () const;
    │ │ │ │ +   void pause (pause_flags_t flags = {}) const;
    │ │ │ │ +   torrent_flags_t flags () const;
    │ │ │ │ +   void set_flags (torrent_flags_t flags, torrent_flags_t mask) const;
    │ │ │ │ +   void unset_flags (torrent_flags_t flags) const;
    │ │ │ │ +   void set_flags (torrent_flags_t flags) const;
    │ │ │ │ +   void flush_cache () const;
    │ │ │ │ +   void force_recheck () const;
    │ │ │ │ +   void save_resume_data (resume_data_flags_t flags = {}) const;
    │ │ │ │ +   bool need_save_resume_data (resume_data_flags_t flags) const;
    │ │ │ │ +   bool need_save_resume_data () const;
    │ │ │ │ +   void queue_position_bottom () const;
    │ │ │ │ +   void queue_position_up () const;
    │ │ │ │ +   void queue_position_down () const;
    │ │ │ │ +   queue_position_t queue_position () const;
    │ │ │ │ +   void queue_position_top () const;
    │ │ │ │ +   void queue_position_set (queue_position_t p) const;
    │ │ │ │ +   void set_ssl_certificate_buffer (std::string const& certificate
    │ │ │ │ +      , std::string const& private_key
    │ │ │ │ +      , std::string const& dh_params);
    │ │ │ │ +   void set_ssl_certificate (std::string const& certificate
    │ │ │ │ +      , std::string const& private_key
    │ │ │ │ +      , std::string const& dh_params
    │ │ │ │ +      , std::string const& passphrase = "");
    │ │ │ │ +   std::shared_ptr<const torrent_info> torrent_file () const;
    │ │ │ │ +   std::shared_ptr<torrent_info> torrent_file_with_hashes () const;
    │ │ │ │ +   std::vector<std::vector<sha256_hash>> piece_layers () const;
    │ │ │ │ +   void piece_availability (std::vector<int>& avail) const;
    │ │ │ │ +   void post_piece_availability () const;
    │ │ │ │ +   void prioritize_pieces (std::vector<std::pair<piece_index_t, download_priority_t>> const& pieces) const;
    │ │ │ │ +   std::vector<download_priority_t> get_piece_priorities () const;
    │ │ │ │ +   download_priority_t piece_priority (piece_index_t index) const;
    │ │ │ │ +   void piece_priority (piece_index_t index, download_priority_t priority) const;
    │ │ │ │ +   void prioritize_pieces (std::vector<download_priority_t> const& pieces) const;
    │ │ │ │ +   void file_priority (file_index_t index, download_priority_t priority) const;
    │ │ │ │ +   void prioritize_files (std::vector<download_priority_t> const& files) const;
    │ │ │ │ +   download_priority_t file_priority (file_index_t index) const;
    │ │ │ │ +   std::vector<download_priority_t> get_file_priorities () const;
    │ │ │ │ +   void force_reannounce (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
    │ │ │ │ +   void force_lsd_announce () const;
    │ │ │ │ +   void force_dht_announce () const;
    │ │ │ │ +   void scrape_tracker (int idx = -1) const;
    │ │ │ │ +   int download_limit () const;
    │ │ │ │ +   void set_download_limit (int limit) const;
    │ │ │ │ +   void set_upload_limit (int limit) const;
    │ │ │ │ +   int upload_limit () const;
    │ │ │ │ +   void connect_peer (tcp::endpoint const& adr, peer_source_flags_t source = {}
    │ │ │ │ +      , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const;
    │ │ │ │ +   void clear_peers ();
    │ │ │ │ +   void set_max_uploads (int max_uploads) const;
    │ │ │ │ +   int max_uploads () const;
    │ │ │ │ +   int max_connections () const;
    │ │ │ │ +   void set_max_connections (int max_connections) const;
    │ │ │ │ +   void move_storage (std::string const& save_path
    │ │ │ │ +      , move_flags_t flags = move_flags_t::always_replace_files
    │ │ │ │ +      ) const;
    │ │ │ │ +   void rename_file (file_index_t index, std::string const& new_name) const;
    │ │ │ │ +   sha1_hash info_hash () const;
    │ │ │ │ +   info_hash_t info_hashes () const;
    │ │ │ │ +   bool operator== (const torrent_handle& h) const;
    │ │ │ │ +   bool operator< (const torrent_handle& h) const;
    │ │ │ │ +   bool operator!= (const torrent_handle& h) const;
    │ │ │ │ +   std::uint32_t id () const;
    │ │ │ │ +   std::shared_ptr<torrent> native_handle () const;
    │ │ │ │ +   client_data_t userdata () const;
    │ │ │ │ +   bool in_session () const;
    │ │ │ │  
    │ │ │ │ -   static constexpr save_state_flags_t save_settings  = 0_bit;
    │ │ │ │ -   static constexpr save_state_flags_t save_dht_state  = 2_bit;
    │ │ │ │ -   static constexpr save_state_flags_t save_extension_state  = 11_bit;
    │ │ │ │ -   static constexpr save_state_flags_t save_ip_filter  = 12_bit;
    │ │ │ │ -   static constexpr peer_class_t global_peer_class_id {0};
    │ │ │ │ -   static constexpr peer_class_t tcp_peer_class_id {1};
    │ │ │ │ -   static constexpr peer_class_t local_peer_class_id {2};
    │ │ │ │ -   static constexpr remove_flags_t delete_files  = 0_bit;
    │ │ │ │ -   static constexpr remove_flags_t delete_partfile  = 1_bit;
    │ │ │ │ -   static constexpr session_flags_t paused  = 2_bit;
    │ │ │ │ -   static constexpr portmap_protocol udp  = portmap_protocol::udp;
    │ │ │ │ -   static constexpr portmap_protocol tcp  = portmap_protocol::tcp;
    │ │ │ │ -   static constexpr reopen_network_flags_t reopen_map_ports  = 0_bit;
    │ │ │ │ +   static constexpr add_piece_flags_t overwrite_existing  = 0_bit;
    │ │ │ │ +   static constexpr status_flags_t query_distributed_copies  = 0_bit;
    │ │ │ │ +   static constexpr status_flags_t query_accurate_download_counters  = 1_bit;
    │ │ │ │ +   static constexpr status_flags_t query_last_seen_complete  = 2_bit;
    │ │ │ │ +   static constexpr status_flags_t query_pieces  = 3_bit;
    │ │ │ │ +   static constexpr status_flags_t query_verified_pieces  = 4_bit;
    │ │ │ │ +   static constexpr status_flags_t query_torrent_file  = 5_bit;
    │ │ │ │ +   static constexpr status_flags_t query_name  = 6_bit;
    │ │ │ │ +   static constexpr status_flags_t query_save_path  = 7_bit;
    │ │ │ │ +   static constexpr deadline_flags_t alert_when_available  = 0_bit;
    │ │ │ │ +   static constexpr file_progress_flags_t piece_granularity  = 0_bit;
    │ │ │ │ +   static constexpr pause_flags_t graceful_pause  = 0_bit;
    │ │ │ │ +   static constexpr resume_data_flags_t flush_disk_cache  = 0_bit;
    │ │ │ │ +   static constexpr resume_data_flags_t save_info_dict  = 1_bit;
    │ │ │ │ +   static constexpr resume_data_flags_t only_if_modified  = 2_bit;
    │ │ │ │ +   static constexpr resume_data_flags_t if_counters_changed  = 3_bit;
    │ │ │ │ +   static constexpr resume_data_flags_t if_download_progress  = 4_bit;
    │ │ │ │ +   static constexpr resume_data_flags_t if_config_changed  = 5_bit;
    │ │ │ │ +   static constexpr resume_data_flags_t if_state_changed  = 6_bit;
    │ │ │ │ +   static constexpr resume_data_flags_t if_metadata_changed  = 7_bit;
    │ │ │ │ +   static constexpr reannounce_flags_t ignore_min_interval  = 0_bit;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    is_valid()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    torrent_handle()

    │ │ │ │
    │ │ │ │ -bool is_valid () const;
    │ │ │ │ +torrent_handle () noexcept = default;
    │ │ │ │  
    │ │ │ │ -

    returns true if this handle refers to a valid session object. If the │ │ │ │ -session has been destroyed, all session_handle objects will expire and │ │ │ │ -not be valid.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    session_state()

    │ │ │ │ +

    constructs a torrent handle that does not refer to a torrent. │ │ │ │ +i.e. is_valid() will return false.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_piece()

    │ │ │ │
    │ │ │ │ -session_params session_state (save_state_flags_t flags = save_state_flags_t::all()) const;
    │ │ │ │ +void add_piece (piece_index_t piece, std::vector<char> data, add_piece_flags_t flags = {}) const;
    │ │ │ │ +void add_piece (piece_index_t piece, char const* data, add_piece_flags_t flags = {}) const;
    │ │ │ │  
    │ │ │ │ -

    returns the current session state. This can be passed to │ │ │ │ -write_session_params() to save the state to disk and restored using │ │ │ │ -read_session_params() when constructing a new session. 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 │ │ │ │ -session state

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    refresh_torrent_status() get_torrent_status()

    │ │ │ │ +

    This function will write data to the storage as piece piece, │ │ │ │ +as if it had been downloaded from a peer.

    │ │ │ │ +

    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.

    │ │ │ │ +

    Since the data is written asynchronously, you may know that is passed │ │ │ │ +or failed the hash check by waiting for piece_finished_alert or │ │ │ │ +hash_failed_alert.

    │ │ │ │ +

    Adding pieces while the torrent is being checked (i.e. in │ │ │ │ +torrent_status::checking_files state) is not supported.

    │ │ │ │ +

    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. data is expected to point to a buffer of as │ │ │ │ +many bytes as the size of the specified piece. See │ │ │ │ +file_storage::piece_size().

    │ │ │ │ +

    The data in the buffer is copied and passed on to the disk IO thread │ │ │ │ +to be written at a later point.

    │ │ │ │ +

    The overload taking a std::vector<char> is not blocking, it will │ │ │ │ +send the buffer to the main thread and return immediately.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    read_piece()

    │ │ │ │
    │ │ │ │ -void refresh_torrent_status (std::vector<torrent_status>* ret
    │ │ │ │ -      , status_flags_t flags = {}) const;
    │ │ │ │ -std::vector<torrent_status> get_torrent_status (
    │ │ │ │ -      std::function<bool(torrent_status const&)> const& pred
    │ │ │ │ -      , status_flags_t flags = {}) const;
    │ │ │ │ +void read_piece (piece_index_t piece) 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 torrent_status 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 should be included and false means │ │ │ │ -excluded. The flags argument is the same as to │ │ │ │ -torrent_handle::status(). Since pred is guaranteed to be │ │ │ │ -called for every torrent, it may be used to count the number of │ │ │ │ -torrents of different categories as well.

    │ │ │ │ -

    refresh_torrent_status takes a vector of torrent_status structs │ │ │ │ -(for instance the same vector that was returned by │ │ │ │ -get_torrent_status() ) and refreshes the status based on the │ │ │ │ -handle member. It is possible to use this function by first │ │ │ │ -setting up a vector of default constructed torrent_status objects, │ │ │ │ -only initializing the handle 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.

    │ │ │ │ -

    Any torrent_status object whose handle member is not referring to │ │ │ │ -a valid torrent are ignored.

    │ │ │ │ -

    The intended use of these functions is to start off by calling │ │ │ │ -get_torrent_status() to get a list of all torrents that match your │ │ │ │ -criteria. Then call refresh_torrent_status() 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 get_torrent_status() 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    post_torrent_updates()

    │ │ │ │ +

    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.

    │ │ │ │ +

    When the read operation is completed, it is passed back through an │ │ │ │ +alert, read_piece_alert. Since this alert is a response to an explicit │ │ │ │ +call, it will always be posted, regardless of the alert mask.

    │ │ │ │ +

    Note that if you read multiple pieces, the read operations are not │ │ │ │ +guaranteed to finish in the same order as you initiated them.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    have_piece()

    │ │ │ │
    │ │ │ │ -void post_torrent_updates (status_flags_t flags = status_flags_t::all());
    │ │ │ │ +bool have_piece (piece_index_t piece) const;
    │ │ │ │  
    │ │ │ │ -

    This functions instructs the session to post the state_update_alert, │ │ │ │ -containing the status of all torrents whose state changed since the │ │ │ │ -last time this function was called.

    │ │ │ │ -

    Only torrents who has the state subscription flag set will be │ │ │ │ -included. This flag is on by default. See add_torrent_params. │ │ │ │ -the flags argument is the same as for torrent_handle::status(). │ │ │ │ -see status_flags_t in torrent_handle.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    post_session_stats()

    │ │ │ │ +

    Returns true if this piece has been completely downloaded and written │ │ │ │ +to disk, and false otherwise.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    post_peer_info() get_peer_info()

    │ │ │ │
    │ │ │ │ -void post_session_stats ();
    │ │ │ │ +void post_peer_info () const;
    │ │ │ │ +void get_peer_info (std::vector<peer_info>& v) const;
    │ │ │ │  
    │ │ │ │ -

    This function will post a session_stats_alert object, containing a │ │ │ │ -snapshot of the performance counters from the internals of libtorrent. │ │ │ │ -To interpret these counters, query the session via │ │ │ │ -session_stats_metrics().

    │ │ │ │ -

    For more information, see the session statistics section.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    post_dht_stats()

    │ │ │ │ +

    Query information about connected peers for this torrent. If the │ │ │ │ +torrent_handle is invalid, it will throw a system_error exception.

    │ │ │ │ +

    post_peer_info() is asynchronous and will trigger the posting of │ │ │ │ +a peer_info_alert. The alert contain a list of peer_info 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 entry for each peer │ │ │ │ +connected to this torrent, given the handle is valid. Each entry in │ │ │ │ +the vector contains information about that particular peer. See │ │ │ │ +peer_info.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    post_status() status()

    │ │ │ │
    │ │ │ │ -void post_dht_stats ();
    │ │ │ │ +void post_status (status_flags_t flags = status_flags_t::all()) const;
    │ │ │ │ +torrent_status status (status_flags_t flags = status_flags_t::all()) const;
    │ │ │ │  
    │ │ │ │ -

    This will cause a dht_stats_alert to be posted.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_dht_state()

    │ │ │ │ +

    status() will return a structure with information about the status │ │ │ │ +of this torrent. If the torrent_handle is invalid, it will throw │ │ │ │ +system_error exception. See torrent_status. The flags │ │ │ │ +argument filters what information is returned in the torrent_status. │ │ │ │ +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.

    │ │ │ │ +

    The status() function will block until the internal libtorrent │ │ │ │ +thread responds with the torrent_status object. To avoid blocking, │ │ │ │ +instead call post_status(). It will trigger posting of a │ │ │ │ +state_update_alert with a single torrent_status 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 include are defined in this class.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    post_download_queue() get_download_queue()

    │ │ │ │
    │ │ │ │ -void set_dht_state (dht::dht_state const& st);
    │ │ │ │ -void set_dht_state (dht::dht_state&& st);
    │ │ │ │ +void get_download_queue (std::vector<partial_piece_info>& queue) const;
    │ │ │ │ +std::vector<partial_piece_info> get_download_queue () const;
    │ │ │ │ +void post_download_queue () const;
    │ │ │ │  
    │ │ │ │ -

    set the DHT state for the session. This will be taken into account the │ │ │ │ -next time the DHT is started, as if it had been passed in via the │ │ │ │ -session_params on startup.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    get_torrents() find_torrent()

    │ │ │ │ +

    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 partial_piece_info for the │ │ │ │ +fields in the returned vector.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_piece_deadline() clear_piece_deadlines() reset_piece_deadline()

    │ │ │ │
    │ │ │ │ -std::vector<torrent_handle> get_torrents () const;
    │ │ │ │ -torrent_handle find_torrent (sha1_hash const& info_hash) const;
    │ │ │ │ +void clear_piece_deadlines () const;
    │ │ │ │ +void reset_piece_deadline (piece_index_t index) const;
    │ │ │ │ +void set_piece_deadline (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;
    │ │ │ │  
    │ │ │ │ -

    find_torrent() looks for a torrent with the given info-hash. In │ │ │ │ -case there is such a torrent in the session, a torrent_handle to that │ │ │ │ -torrent is returned. In case the torrent cannot be found, an invalid │ │ │ │ -torrent_handle 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 session.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    async_add_torrent() add_torrent()

    │ │ │ │ +

    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, unless the alert_when_available flag is set, in which case it │ │ │ │ +will have the same effect as calling read_piece() 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 reset_piece_deadline() was called on all pieces.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    post_file_progress() file_progress()

    │ │ │ │
    │ │ │ │ -torrent_handle add_torrent (add_torrent_params&& params);
    │ │ │ │ -torrent_handle add_torrent (add_torrent_params const& params, error_code& ec);
    │ │ │ │ -void async_add_torrent (add_torrent_params&& params);
    │ │ │ │ -torrent_handle add_torrent (add_torrent_params&& params, error_code& ec);
    │ │ │ │ -torrent_handle add_torrent (add_torrent_params const& params);
    │ │ │ │ -void async_add_torrent (add_torrent_params const& params);
    │ │ │ │ +void file_progress (std::vector<std::int64_t>& progress, file_progress_flags_t flags = {}) const;
    │ │ │ │ +void post_file_progress (file_progress_flags_t flags) const;
    │ │ │ │ +std::vector<std::int64_t> file_progress (file_progress_flags_t flags = {}) const;
    │ │ │ │  
    │ │ │ │ -

    You add torrents through the add_torrent() function where you give an │ │ │ │ -object with all the parameters. The add_torrent() overloads will block │ │ │ │ -until the torrent has been added (or failed to be added) and returns │ │ │ │ -an error code and a torrent_handle. In order to add torrents more │ │ │ │ -efficiently, consider using async_add_torrent() which returns │ │ │ │ -immediately, without waiting for the torrent to add. Notification of │ │ │ │ -the torrent being added is sent as add_torrent_alert.

    │ │ │ │ -

    The save_path field in add_torrent_params 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 add_torrent() will throw a system_error │ │ │ │ -exception.

    │ │ │ │ -

    The overload that does not take an error_code throws an exception on │ │ │ │ -error and is not available when building without exception support. │ │ │ │ -The torrent_handle returned by add_torrent() can be used to retrieve │ │ │ │ -information about the torrent's progress, its peers etc. It is also │ │ │ │ -used to abort a torrent.

    │ │ │ │ -

    If the torrent you are trying to add already exists in the session (is │ │ │ │ -either queued for checking, being checked or downloading) │ │ │ │ -add_torrent() will throw system_error which derives from │ │ │ │ -std::exception unless duplicate_is_error is set to false. In that │ │ │ │ -case, add_torrent() will return the handle to the existing torrent.

    │ │ │ │ -

    The add_torrent_params 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.

    │ │ │ │ -

    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 BitTorrent v2 torrents.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    resume() pause() is_paused()

    │ │ │ │ +

    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 │ │ │ │ +torrent_info.

    │ │ │ │ +

    This operation is not very cheap. Its complexity is O(n + mj). │ │ │ │ +Where n is the number of files, m is the number of currently │ │ │ │ +downloading pieces and j is the number of blocks in a piece.

    │ │ │ │ +

    The flags 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 │ │ │ │ +torrent_handle::piece_granularity 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_status()

    │ │ │ │
    │ │ │ │ -bool is_paused () const;
    │ │ │ │ -void resume ();
    │ │ │ │ -void pause ();
    │ │ │ │ +std::vector<open_file_state> file_status () const;
    │ │ │ │  
    │ │ │ │ -

    Pausing the session 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 session pause state is separate from the torrent pause │ │ │ │ -state. A torrent is inactive if it is paused or if the session is │ │ │ │ -paused.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    is_dht_running()

    │ │ │ │ +

    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.

    │ │ │ │ +

    See open_file_state

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    clear_error()

    │ │ │ │
    │ │ │ │ -bool is_dht_running () const;
    │ │ │ │ +void clear_error () const;
    │ │ │ │  
    │ │ │ │ -

    is_dht_running() returns true if the DHT support has been started │ │ │ │ -and false otherwise.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_dht_storage()

    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    trackers() replace_trackers() post_trackers() add_tracker()

    │ │ │ │
    │ │ │ │ -void set_dht_storage (dht::dht_storage_constructor_type sc);
    │ │ │ │ +void add_tracker (announce_entry const&) const;
    │ │ │ │ +void post_trackers () const;
    │ │ │ │ +std::vector<announce_entry> trackers () const;
    │ │ │ │ +void replace_trackers (std::vector<announce_entry> const&) const;
    │ │ │ │  
    │ │ │ │ -

    set_dht_storage set a dht custom storage constructor function │ │ │ │ -to be used internally when the dht is created.

    │ │ │ │ -

    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.

    │ │ │ │ -

    If you want to make sure the dht is initially created with your │ │ │ │ -custom storage, create a session with the setting │ │ │ │ -settings_pack::enable_dht to false, set your constructor function │ │ │ │ -and call apply_settings with settings_pack::enable_dht to true.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_dht_node()

    │ │ │ │ +

    trackers() returns the list of trackers for this torrent. The │ │ │ │ +announce entry contains both a string url which specify the │ │ │ │ +announce url for the tracker as well as an int 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, 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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_url_seed() remove_url_seed() url_seeds()

    │ │ │ │
    │ │ │ │ -void add_dht_node (std::pair<std::string, int> const& node);
    │ │ │ │ +void remove_url_seed (std::string const& url) const;
    │ │ │ │ +std::set<std::string> url_seeds () const;
    │ │ │ │ +void add_url_seed (std::string const& url) const;
    │ │ │ │  
    │ │ │ │ -

    add_dht_node 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_get_item()

    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_http_seed() remove_http_seed() http_seeds()

    │ │ │ │
    │ │ │ │ -void dht_get_item (sha1_hash const& target);
    │ │ │ │ +void add_http_seed (std::string const& url) const;
    │ │ │ │ +std::set<std::string> http_seeds () const;
    │ │ │ │ +void remove_http_seed (std::string const& url) const;
    │ │ │ │  
    │ │ │ │ -

    query the DHT for an immutable item at the target hash. │ │ │ │ -the result is posted as a dht_immutable_item_alert.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_get_item()

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_extension()

    │ │ │ │
    │ │ │ │ -void dht_get_item (std::array<char, 32> key
    │ │ │ │ -      , std::string salt = std::string());
    │ │ │ │ +void add_extension (
    │ │ │ │ +      std::function<std::shared_ptr<torrent_plugin>(torrent_handle const&, client_data_t)> const& ext
    │ │ │ │ +      , client_data_t userdata = client_data_t{});
    │ │ │ │  
    │ │ │ │ -

    query the DHT for a mutable item under the public key key. │ │ │ │ -this is an ed25519 key. salt 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 dht_mutable_item_alert is │ │ │ │ -posted.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_put_item()

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_metadata()

    │ │ │ │
    │ │ │ │ -sha1_hash dht_put_item (entry data);
    │ │ │ │ +bool set_metadata (span<char const> metadata) const;
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_put_item()

    │ │ │ │ +

    set_metadata expects the info section of metadata. i.e. The │ │ │ │ +buffer passed in will be hashed and verified against the info-hash. If │ │ │ │ +it fails, a metadata_failed_alert will be generated. If it passes, │ │ │ │ +a metadata_received_alert 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    is_valid()

    │ │ │ │
    │ │ │ │ -void 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 = std::string());
    │ │ │ │ +bool is_valid () const;
    │ │ │ │  
    │ │ │ │ -

    store a mutable item. The key is the public key the blob is │ │ │ │ -to be stored under. The optional salt 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:

    │ │ │ │ -
    │ │ │ │ -
    entry& value
    │ │ │ │ -
    the current value stored under the key (may be empty). Also expected │ │ │ │ -to be set to the value to be stored by the function.
    │ │ │ │ -
    std::array<char,64>& signature
    │ │ │ │ -
    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 │ │ │ │ -sign_mutable_item function.
    │ │ │ │ -
    std::int64_t& seq
    │ │ │ │ -
    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.
    │ │ │ │ -
    std::string const& salt
    │ │ │ │ -
    this is the salt that was used for this put call.
    │ │ │ │ -
    │ │ │ │ -

    Since the callback function cb 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 update 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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_announce() dht_get_peers()

    │ │ │ │ +

    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 session AND destructed.

    │ │ │ │ +

    To tell if the torrent_handle is in the session, use │ │ │ │ +torrent_handle::in_session(). This will return true before │ │ │ │ +session_handle::remove_torrent() is called, and false │ │ │ │ +afterward.

    │ │ │ │ +

    Clients should only use is_valid() to determine if the result of │ │ │ │ +session::find_torrent() was successful.

    │ │ │ │ +

    Unlike other member functions which return a value, is_valid() │ │ │ │ +completes immediately, without blocking on a result from the │ │ │ │ +network thread. Also unlike other functions, it never throws │ │ │ │ +the system_error exception.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    resume() pause()

    │ │ │ │
    │ │ │ │ -void dht_announce (sha1_hash const& info_hash, int port = 0, dht::announce_flags_t flags = {});
    │ │ │ │ -void dht_get_peers (sha1_hash const& info_hash);
    │ │ │ │ +void resume () const;
    │ │ │ │ +void pause (pause_flags_t flags = {}) const;
    │ │ │ │  
    │ │ │ │ -

    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 │ │ │ │ -dht_get_peers_reply_alert.

    │ │ │ │ -

    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 announce_port override setting.

    │ │ │ │ -

    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.

    │ │ │ │ -

    For possible flags, see announce_flags_t.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_live_nodes()

    │ │ │ │ +

    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 │ │ │ │ +file_error_alert.

    │ │ │ │ +

    For possible values of the flags parameter, see pause_flags_t.

    │ │ │ │ +

    To know if a torrent is paused or not, call │ │ │ │ +torrent_handle::flags() and check 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 session. For more information, see queuing.

    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    unset_flags() set_flags() flags()

    │ │ │ │
    │ │ │ │ -void dht_live_nodes (sha1_hash const& nid);
    │ │ │ │ +torrent_flags_t flags () const;
    │ │ │ │ +void set_flags (torrent_flags_t flags, torrent_flags_t mask) const;
    │ │ │ │ +void unset_flags (torrent_flags_t flags) const;
    │ │ │ │ +void set_flags (torrent_flags_t flags) const;
    │ │ │ │  
    │ │ │ │ -

    Retrieve all the live DHT (identified by nid) nodes. All the │ │ │ │ -nodes id and endpoint will be returned in the list of nodes in the │ │ │ │ -alert dht_live_nodes_alert. │ │ │ │ -Since this alert is a response to an explicit call, it will always be │ │ │ │ -posted, regardless of the alert mask.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_sample_infohashes()

    │ │ │ │ +

    sets and gets the torrent state flags. See torrent_flags_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.

    │ │ │ │ +

    The seed_mode flag is special, it can only be cleared once the │ │ │ │ +torrent has been added, and it can only be set as part of the │ │ │ │ +add_torrent_params flags, when adding the torrent.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    flush_cache()

    │ │ │ │
    │ │ │ │ -void dht_sample_infohashes (udp::endpoint const& ep, sha1_hash const& target);
    │ │ │ │ +void flush_cache () const;
    │ │ │ │  
    │ │ │ │ -

    Query the DHT node specified by ep to retrieve a sample of the │ │ │ │ -info-hashes that the node currently have in their storage. │ │ │ │ -The target 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 dht_sample_infohashes_alert.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_direct_request()

    │ │ │ │ +

    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 cache_flushed_alert.

    │ │ │ │ +

    Note that by the time you get the alert, libtorrent may have cached │ │ │ │ +more data for the torrent, but you are guaranteed that whatever cached │ │ │ │ +data libtorrent had by the time you called │ │ │ │ +torrent_handle::flush_cache() has been written to disk.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    force_recheck()

    │ │ │ │
    │ │ │ │ -void dht_direct_request (udp::endpoint const& ep, entry const& e, client_data_t userdata = {});
    │ │ │ │ +void force_recheck () const;
    │ │ │ │  
    │ │ │ │ -

    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 dht_direct_response_alert will be posted │ │ │ │ -with the response (if any) and the userdata pointer passed in here. │ │ │ │ -Since this alert is a response to an explicit call, it will always be │ │ │ │ -posted, regardless of the alert mask.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_extension()

    │ │ │ │ +

    force_recheck 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 session.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    save_resume_data()

    │ │ │ │
    │ │ │ │ -void add_extension (std::shared_ptr<plugin> ext);
    │ │ │ │ -void add_extension (std::function<std::shared_ptr<torrent_plugin>(
    │ │ │ │ -      torrent_handle const&, client_data_t)> ext);
    │ │ │ │ -
    │ │ │ │ -

    This function adds an extension to this session. 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 libtorrent plugins. 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 │ │ │ │ -directly. Makes it possible to join a swarm with just a tracker and │ │ │ │ -info-hash.
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -#include <libtorrent/extensions/ut_metadata.hpp>
    │ │ │ │ -ses.add_extension(&lt::create_ut_metadata_plugin);
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    uTorrent peer exchange
    │ │ │ │ -
    Exchanges peers between clients.
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -#include <libtorrent/extensions/ut_pex.hpp>
    │ │ │ │ -ses.add_extension(&lt::create_ut_pex_plugin);
    │ │ │ │ +void save_resume_data (resume_data_flags_t flags = {}) const;
    │ │ │ │  
    │ │ │ │ -
    │ │ │ │ -
    smart ban plugin
    │ │ │ │ -
    A plugin that, with a small overhead, can ban peers │ │ │ │ -that sends bad data with very high accuracy. Should │ │ │ │ -eliminate most problems on poisoned torrents.
    │ │ │ │ -
    │ │ │ │ +

    save_resume_data() asks libtorrent to generate fast-resume data for │ │ │ │ +this torrent. The fast resume data (stored in an add_torrent_params │ │ │ │ +object) can be used to resume a torrent in the next session without │ │ │ │ +having to check all files for which pieces have been downloaded. It │ │ │ │ +can also be used to save a .torrent file for a torrent_handle.

    │ │ │ │ +

    This operation is asynchronous, save_resume_data will return │ │ │ │ +immediately. The resume data is delivered when it's done through a │ │ │ │ +save_resume_data_alert.

    │ │ │ │ +

    The operation will fail, and post a save_resume_data_failed_alert │ │ │ │ +instead, in the following cases:

    │ │ │ │ +
    │ │ │ │ +
      │ │ │ │ +
    1. The torrent is in the process of being removed.
    2. │ │ │ │ +
    3. No torrent state has changed since the last saving of resume │ │ │ │ +data, and the only_if_modified flag is set. │ │ │ │ +metadata (see libtorrent's metadata from peers extension)
    4. │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    Note that some counters may be outdated by the time you receive the fast resume data

    │ │ │ │ +

    When saving resume data because of shutting down, make sure not to │ │ │ │ +remove_torrent() before you receive the save_resume_data_alert. │ │ │ │ +There's no need to pause the session or torrent when saving resume │ │ │ │ +data.

    │ │ │ │ +

    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.

    │ │ │ │ +
    │ │ │ │ +

    Note

    │ │ │ │ +

    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.

    │ │ │ │ +
    │ │ │ │ +

    Example code to pause and save resume data for all torrents and wait │ │ │ │ +for the alerts:

    │ │ │ │
    │ │ │ │ -#include <libtorrent/extensions/smart_ban.hpp>
    │ │ │ │ -ses.add_extension(&lt::create_smart_ban_plugin);
    │ │ │ │ +extern int outstanding_resume_data; // global counter of outstanding resume data
    │ │ │ │ +std::vector<torrent_handle> handles = ses.get_torrents();
    │ │ │ │ +for (torrent_handle const& h : handles) try
    │ │ │ │ +{
    │ │ │ │ +        h.save_resume_data(torrent_handle::only_if_modified);
    │ │ │ │ +        ++outstanding_resume_data;
    │ │ │ │ +}
    │ │ │ │ +catch (lt::system_error const& e)
    │ │ │ │ +{
    │ │ │ │ +        // the handle was invalid, ignore this one and move to the next
    │ │ │ │ +}
    │ │ │ │ +
    │ │ │ │ +while (outstanding_resume_data > 0)
    │ │ │ │ +{
    │ │ │ │ +        alert const* a = ses.wait_for_alert(seconds(30));
    │ │ │ │ +
    │ │ │ │ +        // if we don't get an alert within 30 seconds, abort
    │ │ │ │ +        if (a == nullptr) break;
    │ │ │ │ +
    │ │ │ │ +        std::vector<alert*> alerts;
    │ │ │ │ +        ses.pop_alerts(&alerts);
    │ │ │ │ +
    │ │ │ │ +        for (alert* i : alerts)
    │ │ │ │ +        {
    │ │ │ │ +                if (alert_cast<save_resume_data_failed_alert>(i))
    │ │ │ │ +                {
    │ │ │ │ +                        process_alert(i);
    │ │ │ │ +                        --outstanding_resume_data;
    │ │ │ │ +                        continue;
    │ │ │ │ +                }
    │ │ │ │ +
    │ │ │ │ +                save_resume_data_alert const* rd = alert_cast<save_resume_data_alert>(i);
    │ │ │ │ +                if (rd == nullptr)
    │ │ │ │ +                {
    │ │ │ │ +                        process_alert(i);
    │ │ │ │ +                        continue;
    │ │ │ │ +                }
    │ │ │ │ +
    │ │ │ │ +                std::ofstream out((rd->params.save_path
    │ │ │ │ +                        + "/" + rd->params.name + ".fastresume").c_str()
    │ │ │ │ +                        , std::ios_base::binary);
    │ │ │ │ +                std::vector<char> buf = write_resume_data_buf(rd->params);
    │ │ │ │ +                out.write(buf.data(), buf.size());
    │ │ │ │ +                --outstanding_resume_data;
    │ │ │ │ +        }
    │ │ │ │ +}
    │ │ │ │  
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_ip_filter() get_ip_filter()

    │ │ │ │ +
    │ │ │ │ +

    Note

    │ │ │ │ +

    Note how outstanding_resume_data 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 alert, 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.

    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    need_save_resume_data()

    │ │ │ │
    │ │ │ │ -void set_ip_filter (ip_filter f);
    │ │ │ │ -ip_filter get_ip_filter () const;
    │ │ │ │ +bool need_save_resume_data (resume_data_flags_t flags) const;
    │ │ │ │ +bool need_save_resume_data () 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 ip_filter.

    │ │ │ │ -

    Each time a peer is blocked because of the IP filter, a │ │ │ │ -peer_blocked_alert is generated. get_ip_filter() Returns the │ │ │ │ -ip_filter currently in the session. See ip_filter.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_port_filter()

    │ │ │ │ +

    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 flags let you ask if specific categories │ │ │ │ +of properties have changed. These flags have the same behavior as in │ │ │ │ +the save_resume_data() call.

    │ │ │ │ +

    This is a blocking call. It will wait for a response from │ │ │ │ +libtorrent's main thread. A way to avoid blocking is to instead │ │ │ │ +call save_resume_data() directly, specifying the conditions under │ │ │ │ +which resume data should be saved.

    │ │ │ │ +
    │ │ │ │ +

    Note

    │ │ │ │ +

    A torrent's resume data is considered saved as soon as the │ │ │ │ +save_resume_data_alert is posted. It is important to make sure this │ │ │ │ +alert is received and handled in order for this function to be │ │ │ │ +meaningful.

    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    queue_position_up() queue_position_top() queue_position() queue_position_bottom() queue_position_down()

    │ │ │ │
    │ │ │ │ -void set_port_filter (port_filter const& f);
    │ │ │ │ +void queue_position_bottom () const;
    │ │ │ │ +void queue_position_up () const;
    │ │ │ │ +void queue_position_down () const;
    │ │ │ │ +queue_position_t queue_position () const;
    │ │ │ │ +void queue_position_top () const;
    │ │ │ │  
    │ │ │ │ -

    apply port_filter 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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    listen_port() is_listening() ssl_listen_port()

    │ │ │ │ +

    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 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.

    │ │ │ │ +

    The queue position is also available in the torrent_status.

    │ │ │ │ +

    The queue_position_*() 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    queue_position_set()

    │ │ │ │
    │ │ │ │ -unsigned short listen_port () const;
    │ │ │ │ -unsigned short ssl_listen_port () const;
    │ │ │ │ -bool is_listening () const;
    │ │ │ │ +void queue_position_set (queue_position_t p) const;
    │ │ │ │  
    │ │ │ │ -

    is_listening() will tell you whether or not the session has │ │ │ │ -successfully opened a listening port. If it hasn't, this function will │ │ │ │ -return false, and then you can set a new │ │ │ │ -settings_pack::listen_interfaces to try another interface and port to │ │ │ │ -bind to.

    │ │ │ │ -

    listen_port() returns the port we ended up listening on.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_peer_class_filter() get_peer_class_filter()

    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_ssl_certificate_buffer() set_ssl_certificate()

    │ │ │ │
    │ │ │ │ -void set_peer_class_filter (ip_filter const& f);
    │ │ │ │ -ip_filter get_peer_class_filter () const;
    │ │ │ │ -
    │ │ │ │ -

    Sets the peer class filter for this session. 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 ip_filter.

    │ │ │ │ -

    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:

    │ │ │ │ -
    │ │ │ │ -ip_filter f = ses.get_peer_class_filter();
    │ │ │ │ -peer_class_t my_class = ses.create_peer_class("200.1.x.x IP range");
    │ │ │ │ -f.add_rule(make_address("200.1.1.0"), make_address("200.1.255.255")
    │ │ │ │ -        , 1 << static_cast<std::uint32_t>(my_class));
    │ │ │ │ -ses.set_peer_class_filter(f);
    │ │ │ │ +void set_ssl_certificate_buffer (std::string const& certificate
    │ │ │ │ +      , std::string const& private_key
    │ │ │ │ +      , std::string const& dh_params);
    │ │ │ │ +void set_ssl_certificate (std::string const& certificate
    │ │ │ │ +      , std::string const& private_key
    │ │ │ │ +      , std::string const& dh_params
    │ │ │ │ +      , std::string const& passphrase = "");
    │ │ │ │  
    │ │ │ │ -

    This setting only applies to new connections, it won't affect existing │ │ │ │ -peer connections.

    │ │ │ │ -

    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.

    │ │ │ │ -

    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 peer classes.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    get_peer_class_type_filter() set_peer_class_type_filter()

    │ │ │ │ +

    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 set_ssl_certificate_buffer() 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.

    │ │ │ │ +

    private_key is a path to the private key for the specified │ │ │ │ +certificate. This must be in .pem format.

    │ │ │ │ +

    dh_params 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: openssl dhparam -outform PEM -out │ │ │ │ +dhparams.pem 512.

    │ │ │ │ +

    passphrase may be specified if the private key is encrypted and │ │ │ │ +requires a passphrase to be decrypted.

    │ │ │ │ +

    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 torrent_need_cert_alert, 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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    torrent_file_with_hashes() torrent_file()

    │ │ │ │
    │ │ │ │ -void set_peer_class_type_filter (peer_class_type_filter const& f);
    │ │ │ │ -peer_class_type_filter get_peer_class_type_filter () const;
    │ │ │ │ +std::shared_ptr<const torrent_info> torrent_file () const;
    │ │ │ │ +std::shared_ptr<torrent_info> torrent_file_with_hashes () const;
    │ │ │ │  
    │ │ │ │ -

    Sets and gets the peer class type filter. 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. │ │ │ │ -
    3. peer-class type filter, removing classes
    4. │ │ │ │ -
    5. peer-class type filter, adding classes
    6. │ │ │ │ -
    │ │ │ │ -

    For more information, see peer classes.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    create_peer_class()

    │ │ │ │ +

    torrent_file() returns a pointer to the torrent_info object │ │ │ │ +associated with this torrent. The torrent_info 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 torrent_info object returned here may be a different │ │ │ │ +instance than the one added to the session, with different attributes │ │ │ │ +like piece layers, dht nodes and trackers. A torrent_info object does │ │ │ │ +not round-trip cleanly when added to a session.

    │ │ │ │ +

    If you want to save a .torrent file from the torrent_handle, instead │ │ │ │ +call save_resume_data() and write_torrent_file() the │ │ │ │ +add_torrent_params object passed back in the alert.

    │ │ │ │ +

    torrent_file_with_hashes() returns a copy of the internal │ │ │ │ +torrent_info 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 │ │ │ │ +torrent_file() since it needs to make copies of this information.

    │ │ │ │ +

    The torrent_file_with_hashes() is here for backwards compatibility │ │ │ │ +when constructing a create_torrent object from a torrent_info that's │ │ │ │ +in a session. Prefer save_resume_data() + write_torrent_file().

    │ │ │ │ +

    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 torrent_info returned from torrent_file_with_hashes(). Once the │ │ │ │ +torrent completes downloading all files, becoming a seed, you can │ │ │ │ +make a .torrent file from it.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    piece_layers()

    │ │ │ │
    │ │ │ │ -peer_class_t create_peer_class (char const* name);
    │ │ │ │ +std::vector<std::vector<sha256_hash>> piece_layers () const;
    │ │ │ │  
    │ │ │ │ -

    Creates a new peer class (see peer classes) 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.

    │ │ │ │ -

    Identifiers are assigned from low numbers to higher. So if you plan on │ │ │ │ -using certain peer classes in a call to set_peer_class_filter(), │ │ │ │ -make sure to create those early on, to get low identifiers.

    │ │ │ │ -

    For more information on peer classes, see peer classes.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    delete_peer_class()

    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    post_piece_availability() piece_availability()

    │ │ │ │
    │ │ │ │ -void delete_peer_class (peer_class_t cid);
    │ │ │ │ +void piece_availability (std::vector<int>& avail) const;
    │ │ │ │ +void post_piece_availability () const;
    │ │ │ │  
    │ │ │ │ -

    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 once per peer class you create. │ │ │ │ -Calling it more than once for the same class will lead to memory │ │ │ │ -corruption.

    │ │ │ │ -

    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.

    │ │ │ │ -

    There is no need to call this function for custom peer classes. All │ │ │ │ -peer classes will be properly destructed when the session object │ │ │ │ -destructs.

    │ │ │ │ -

    For more information on peer classes, see peer classes.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    get_peer_class() set_peer_class()

    │ │ │ │ +

    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 piece_availability_alert │ │ │ │ +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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    get_piece_priorities() prioritize_pieces() piece_priority()

    │ │ │ │
    │ │ │ │ -peer_class_info get_peer_class (peer_class_t cid) const;
    │ │ │ │ -void set_peer_class (peer_class_t cid, peer_class_info const& pci);
    │ │ │ │ +void prioritize_pieces (std::vector<std::pair<piece_index_t, download_priority_t>> const& pieces) const;
    │ │ │ │ +std::vector<download_priority_t> get_piece_priorities () const;
    │ │ │ │ +download_priority_t piece_priority (piece_index_t index) const;
    │ │ │ │ +void piece_priority (piece_index_t index, download_priority_t priority) const;
    │ │ │ │ +void prioritize_pieces (std::vector<download_priority_t> const& pieces) const;
    │ │ │ │  
    │ │ │ │ -

    These functions queries information from a peer class and updates the │ │ │ │ -configuration of a peer class, respectively.

    │ │ │ │ -

    cid must refer to an existing peer class. If it does not, the │ │ │ │ -return value of get_peer_class() is undefined.

    │ │ │ │ -

    set_peer_class() sets all the information in the │ │ │ │ -peer_class_info object in the specified peer class. There is no │ │ │ │ -option to only update a single property.

    │ │ │ │ -

    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.

    │ │ │ │ -

    For more information, see peer classes.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    remove_torrent()

    │ │ │ │ +

    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.

    │ │ │ │ +

    The default priority of pieces is 4.

    │ │ │ │ +

    Piece priorities can not be changed for torrents that have not │ │ │ │ +downloaded the metadata yet. Magnet links won't have metadata │ │ │ │ +immediately. see the metadata_received_alert.

    │ │ │ │ +

    piece_priority sets or gets the priority for an individual piece, │ │ │ │ +specified by index.

    │ │ │ │ +

    prioritize_pieces 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 prioritize_pieces 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.

    │ │ │ │ +

    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 file priorities by setting the │ │ │ │ +priorities for the affected pieces. Care has to be taken when mixing │ │ │ │ +usage of file- and piece priorities.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    prioritize_files() file_priority() get_file_priorities()

    │ │ │ │
    │ │ │ │ -void remove_torrent (const torrent_handle&, remove_flags_t = {});
    │ │ │ │ +void file_priority (file_index_t index, download_priority_t priority) const;
    │ │ │ │ +void prioritize_files (std::vector<download_priority_t> const& files) const;
    │ │ │ │ +download_priority_t file_priority (file_index_t index) const;
    │ │ │ │ +std::vector<download_priority_t> get_file_priorities () const;
    │ │ │ │  
    │ │ │ │ -

    remove_torrent() 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 torrent_removed_alert.

    │ │ │ │ -

    remove_torrent() is non-blocking, but will remove the torrent from the │ │ │ │ -session synchronously. Calling session_handle::add_torrent() immediately │ │ │ │ -afterward with the same torrent will succeed. Note that this creates a │ │ │ │ -new handle which is not equal to the removed one.

    │ │ │ │ -

    The optional second argument options can be used to delete all the │ │ │ │ -files downloaded by this torrent. To do so, pass in the value │ │ │ │ -session_handle::delete_files. Once the torrent is deleted, a │ │ │ │ -torrent_deleted_alert is posted.

    │ │ │ │ -

    The torrent_handle remains valid for some time after remove_torrent() 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, │ │ │ │ -torrent_handle::is_valid() will return true, and other calls such │ │ │ │ -as torrent_handle::status() will succeed. Because of this, and because │ │ │ │ -remove_torrent() is non-blocking, the following sequence usually │ │ │ │ -succeeds (does not throw system_error): │ │ │ │ -.. code:: c++

    │ │ │ │ -
    │ │ │ │ -session.remove_handle(handle); │ │ │ │ -handle.save_resume_data();
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    apply_settings() get_settings()

    │ │ │ │ +

    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 entry 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 piece_priority(). See │ │ │ │ +download_priority_t.

    │ │ │ │ +

    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, piece_priority() has to be called │ │ │ │ +again for those pieces.

    │ │ │ │ +

    You cannot set the file priorities on a torrent that does not yet have │ │ │ │ +metadata or a torrent that is a seed. file_priority(int, int) and │ │ │ │ +prioritize_files() are both no-ops for such torrents.

    │ │ │ │ +

    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 │ │ │ │ +file_prio_alert.

    │ │ │ │ +

    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 after it has already │ │ │ │ +been created, it will not be moved into the partfile.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    force_reannounce() force_dht_announce() force_lsd_announce()

    │ │ │ │
    │ │ │ │ -void apply_settings (settings_pack const&);
    │ │ │ │ -settings_pack get_settings () const;
    │ │ │ │ -void apply_settings (settings_pack&&);
    │ │ │ │ +void force_reannounce (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
    │ │ │ │ +void force_lsd_announce () const;
    │ │ │ │ +void force_dht_announce () const;
    │ │ │ │  
    │ │ │ │ -

    Applies the settings specified by the settings_pack s. This is an │ │ │ │ -asynchronous operation that will return immediately and actually apply │ │ │ │ -the settings to the main thread of libtorrent some time later.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    wait_for_alert() set_alert_notify() pop_alerts()

    │ │ │ │ +

    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 -1 (which is the default), all trackers are re-announce.

    │ │ │ │ +

    The flags argument can be used to affect the re-announce. See │ │ │ │ +ignore_min_interval.

    │ │ │ │ +

    force_dht_announce will announce the torrent to the DHT │ │ │ │ +immediately.

    │ │ │ │ +

    force_lsd_announce will announce the torrent on LSD │ │ │ │ +immediately.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    scrape_tracker()

    │ │ │ │
    │ │ │ │ -void pop_alerts (std::vector<alert*>* alerts);
    │ │ │ │ -alert* wait_for_alert (time_duration max_wait);
    │ │ │ │ -void set_alert_notify (std::function<void()> const& fun);
    │ │ │ │ +void scrape_tracker (int idx = -1) const;
    │ │ │ │  
    │ │ │ │ -

    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 session still owns these alerts and they will stay │ │ │ │ -valid until the next time pop_alerts is called. You may not delete │ │ │ │ -the alert 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.

    │ │ │ │ -

    wait_for_alert will block the current thread for max_wait time │ │ │ │ -duration, or until another alert is posted. If an alert is available │ │ │ │ -at the time of the call, it returns immediately. The returned alert │ │ │ │ -pointer is the head of the alert queue. wait_for_alert does not │ │ │ │ -pop alerts from the queue, it merely peeks at it. The returned alert │ │ │ │ -will stay valid until pop_alerts is called twice. The first time │ │ │ │ -will pop it and the second will free it.

    │ │ │ │ -

    If there is no alert in the queue and no alert arrives within the │ │ │ │ -specified timeout, wait_for_alert returns nullptr.

    │ │ │ │ -

    In the python binding, wait_for_alert takes the number of │ │ │ │ -milliseconds to wait as an integer.

    │ │ │ │ -

    The alert queue in the session 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 session, see │ │ │ │ -settings_pack::alert_queue_size.

    │ │ │ │ -

    Some alerts are considered so important that they are posted even when │ │ │ │ -the alert queue is full. Some alerts are considered mandatory and cannot │ │ │ │ -be disabled by the alert_mask. For instance, │ │ │ │ -save_resume_data_alert and save_resume_data_failed_alert are always │ │ │ │ -posted, regardless of the alert mask.

    │ │ │ │ -

    To control which alerts are posted, set the alert_mask │ │ │ │ -(settings_pack::alert_mask).

    │ │ │ │ -

    If the alert queue fills up to the point where alerts are dropped, this │ │ │ │ -will be indicated by a alerts_dropped_alert, which contains a bitmask │ │ │ │ -of which types of alerts were dropped. Generally it is a good idea to │ │ │ │ -make sure the alert queue is large enough, the alert_mask doesn't have │ │ │ │ -unnecessary categories enabled and to call pop_alert() frequently, to │ │ │ │ -avoid alerts being dropped.

    │ │ │ │ -

    the set_alert_notify function lets the client set a function object │ │ │ │ -to be invoked every time the alert queue goes from having 0 alerts to │ │ │ │ -1 alert. 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 pop_alerts(). If the notify function fails │ │ │ │ -to do so, it won't be called again, until pop_alerts 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.

    │ │ │ │ -

    The type of an alert 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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_port_mapping() delete_port_mapping()

    │ │ │ │ +

    scrape_tracker() will send a scrape request to a tracker. By │ │ │ │ +default (idx = -1) it will scrape the last working tracker. If │ │ │ │ +idx is >= 0, the tracker with the specified index will scraped.

    │ │ │ │ +

    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 torrent_status struct once it │ │ │ │ +completes. When it completes, it will generate a scrape_reply_alert. │ │ │ │ +If it fails, it will generate a scrape_failed_alert.

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_download_limit() set_upload_limit() upload_limit() download_limit()

    │ │ │ │
    │ │ │ │ -std::vector<port_mapping_t> add_port_mapping (portmap_protocol t, int external_port, int local_port);
    │ │ │ │ -void delete_port_mapping (port_mapping_t handle);
    │ │ │ │ +int download_limit () const;
    │ │ │ │ +void set_download_limit (int limit) const;
    │ │ │ │ +void set_upload_limit (int limit) const;
    │ │ │ │ +int upload_limit () const;
    │ │ │ │  
    │ │ │ │ -

    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 session. The return values are all handles referring to the │ │ │ │ -port mappings that were just created. Pass them to delete_port_mapping() │ │ │ │ -to remove them.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    reopen_network_sockets()

    │ │ │ │ +

    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.

    │ │ │ │ +

    upload_limit and download_limit will return the current limit │ │ │ │ +setting, for upload and download, respectively.

    │ │ │ │ +

    Local peers are not rate limited by default. see peer classes.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    connect_peer()

    │ │ │ │
    │ │ │ │ -void reopen_network_sockets (reopen_network_flags_t options = reopen_map_ports);
    │ │ │ │ +void connect_peer (tcp::endpoint const& adr, peer_source_flags_t source = {}
    │ │ │ │ +      , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const;
    │ │ │ │  
    │ │ │ │ -

    Instructs the session to reopen all listen and outgoing sockets.

    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    native_handle()

    │ │ │ │ +

    connect_peer() 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 peer_info. i.e. │ │ │ │ +tracker, pex, dht etc.

    │ │ │ │ +

    For possible values of flags, see pex_flags_t.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    clear_peers()

    │ │ │ │
    │ │ │ │ -std::shared_ptr<aux::session_impl> native_handle () const;
    │ │ │ │ +void clear_peers ();
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    save_settings
    │ │ │ │ -
    saves settings (i.e. the settings_pack)
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    save_dht_state
    │ │ │ │ -
    saves dht state such as nodes and node-id, possibly accelerating │ │ │ │ -joining the DHT if provided at next session startup.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    save_extension_state
    │ │ │ │ -
    load or save state from plugins
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    save_ip_filter
    │ │ │ │ -
    load or save the IP filter set on the session
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    global_peer_class_id tcp_peer_class_id local_peer_class_id
    │ │ │ │ -
    built-in peer classes
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    delete_files
    │ │ │ │ -
    delete the files belonging to the torrent from disk. │ │ │ │ -including the part-file, if there is one
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    delete_partfile
    │ │ │ │ -
    delete just the part-file associated with this torrent
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    paused
    │ │ │ │ -
    when set, the session will start paused. Call │ │ │ │ -session_handle::resume() to start
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    udp tcp
    │ │ │ │ -
    protocols used by add_port_mapping()
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    read_session_params() write_session_params() write_session_params_buf()

    │ │ │ │ -

    Declared in "libtorrent/session_params.hpp"

    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    max_uploads() set_max_uploads()

    │ │ │ │
    │ │ │ │ -session_params read_session_params (span<char const> buf
    │ │ │ │ -   , save_state_flags_t flags = save_state_flags_t::all());
    │ │ │ │ -entry write_session_params (session_params const& sp
    │ │ │ │ -   , save_state_flags_t flags = save_state_flags_t::all());
    │ │ │ │ -std::vector<char> write_session_params_buf (session_params const& sp
    │ │ │ │ -   , save_state_flags_t flags = save_state_flags_t::all());
    │ │ │ │ -session_params read_session_params (bdecode_node const& e
    │ │ │ │ -   , save_state_flags_t flags = save_state_flags_t::all());
    │ │ │ │ +void set_max_uploads (int max_uploads) const;
    │ │ │ │ +int max_uploads () const;
    │ │ │ │  
    │ │ │ │ -

    These functions serialize and de-serialize a session_params object to and │ │ │ │ -from bencoded form. The session_params object is used to initialize a new │ │ │ │ -session using the state from a previous one (or by programmatically configure │ │ │ │ -the session 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 session are not part of the session_params state, they have │ │ │ │ -to be restored separately.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    info_hash_t

    │ │ │ │ -

    Declared in "libtorrent/info_hash.hpp"

    │ │ │ │ -

    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

    │ │ │ │ -
    │ │ │ │ +

    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 │ │ │ │ +settings_pack.

    │ │ │ │ +

    max_uploads() returns the current settings.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    max_connections() set_max_connections()

    │ │ │ │
    │ │ │ │ -struct info_hash_t
    │ │ │ │ -{
    │ │ │ │ -   info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;
    │ │ │ │ -   info_hash_t () noexcept = default;
    │ │ │ │ -   explicit info_hash_t (sha256_hash h2) noexcept;
    │ │ │ │ -   explicit info_hash_t (sha1_hash h1) noexcept;
    │ │ │ │ -   bool has_v2 () const;
    │ │ │ │ -   bool has_v1 () const;
    │ │ │ │ -   bool has (protocol_version v) const;
    │ │ │ │ -   sha1_hash get (protocol_version v) const;
    │ │ │ │ -   sha1_hash get_best () const;
    │ │ │ │ -   friend bool operator!= (info_hash_t const& lhs, info_hash_t const& rhs);
    │ │ │ │ -   friend bool operator== (info_hash_t const& lhs, info_hash_t const& rhs) noexcept;
    │ │ │ │ -   template <typename F> void for_each (F f) const;
    │ │ │ │ -   bool operator< (info_hash_t const& o) const;
    │ │ │ │ -   friend std::ostream& operator<< (std::ostream& os, info_hash_t const& ih);
    │ │ │ │ -
    │ │ │ │ -   sha1_hash v1;
    │ │ │ │ -   sha256_hash v2;
    │ │ │ │ -};
    │ │ │ │ +int max_connections () const;
    │ │ │ │ +void set_max_connections (int max_connections) const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    info_hash_t()

    │ │ │ │ +

    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 settings_pack.

    │ │ │ │ +

    max_connections() returns the current settings.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    move_storage()

    │ │ │ │
    │ │ │ │ -info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;
    │ │ │ │ -info_hash_t () noexcept = default;
    │ │ │ │ -explicit info_hash_t (sha256_hash h2) noexcept;
    │ │ │ │ -explicit info_hash_t (sha1_hash h1) noexcept;
    │ │ │ │ +void move_storage (std::string const& save_path
    │ │ │ │ +      , move_flags_t flags = move_flags_t::always_replace_files
    │ │ │ │ +      ) const;
    │ │ │ │  
    │ │ │ │ -

    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 implicit conversion from a │ │ │ │ -v1 hash, but the implicitness is deprecated.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    has_v2() has_v1() has()

    │ │ │ │ +

    Moves the file(s) that this torrent are currently seeding from or │ │ │ │ +downloading to. If the given save_path 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.

    │ │ │ │ +

    Since disk IO is performed in a separate thread, this operation is │ │ │ │ +also asynchronous. Once the operation completes, the │ │ │ │ +storage_moved_alert is generated, with the new path as the │ │ │ │ +message. If the move fails for some reason, │ │ │ │ +storage_moved_failed_alert is generated instead, containing the │ │ │ │ +error message.

    │ │ │ │ +

    The flags argument determines the behavior of the copying/moving │ │ │ │ +of the files in the torrent. see move_flags_t.

    │ │ │ │ +

    always_replace_files is the default and replaces any file that │ │ │ │ +exist in both the source directory and the target directory.

    │ │ │ │ +

    fail_if_exist 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 always_replace_files 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 error of │ │ │ │ +move_storage_failed_alert is set to │ │ │ │ +boost::system::errc::file_exists.

    │ │ │ │ +

    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 move_storage call with one of the other modes.

    │ │ │ │ +

    dont_replace 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.

    │ │ │ │ +

    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.

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    rename_file()

    │ │ │ │
    │ │ │ │ -bool has_v2 () const;
    │ │ │ │ -bool has_v1 () const;
    │ │ │ │ -bool has (protocol_version v) const;
    │ │ │ │ +void rename_file (file_index_t index, std::string const& new_name) const;
    │ │ │ │  
    │ │ │ │ -

    returns true if the corresponding info hash is present in this │ │ │ │ -object.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    get()

    │ │ │ │ +

    Renames the file with the given index asynchronously. The rename │ │ │ │ +operation is complete when either a file_renamed_alert or │ │ │ │ +file_rename_failed_alert is posted.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    info_hashes() info_hash()

    │ │ │ │
    │ │ │ │ -sha1_hash get (protocol_version v) const;
    │ │ │ │ +sha1_hash info_hash () const;
    │ │ │ │ +info_hash_t info_hashes () const;
    │ │ │ │  
    │ │ │ │ -

    returns the has for the specified protocol version

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    get_best()

    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    operator==() operator<() operator!=()

    │ │ │ │
    │ │ │ │ -sha1_hash get_best () const;
    │ │ │ │ +bool operator== (const torrent_handle& h) const;
    │ │ │ │ +bool operator< (const torrent_handle& h) const;
    │ │ │ │ +bool operator!= (const torrent_handle& h) const;
    │ │ │ │  
    │ │ │ │ -

    returns the v2 (truncated) info-hash, if there is one, otherwise │ │ │ │ -returns the v1 info-hash

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    for_each()

    │ │ │ │ +

    comparison operators. The order of the torrents is unspecified │ │ │ │ +but stable.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    id()

    │ │ │ │
    │ │ │ │ -template <typename F> void for_each (F f) const;
    │ │ │ │ +std::uint32_t id () const;
    │ │ │ │  
    │ │ │ │ -

    calls the function object f for each hash that is available. │ │ │ │ -starting with v1. The signature of F is:

    │ │ │ │ +

    returns a unique identifier for this torrent. It's not a dense index. │ │ │ │ +It's not preserved across sessions.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    native_handle()

    │ │ │ │
    │ │ │ │ -void(sha1_hash const&, protocol_version);
    │ │ │ │ +std::shared_ptr<torrent> native_handle () const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    peer_info

    │ │ │ │ -

    Declared in "libtorrent/peer_info.hpp"

    │ │ │ │ -

    holds information and statistics about one peer │ │ │ │ -that libtorrent is connected to

    │ │ │ │ +

    This function is intended only for use by plugins and the alert │ │ │ │ +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 plugin callbacks). │ │ │ │ +The torrent 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 TORRENT_ macros must match between libtorrent and the │ │ │ │ +client builds.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    userdata()

    │ │ │ │
    │ │ │ │ -struct peer_info
    │ │ │ │ -{
    │ │ │ │ -   sha256_hash i2p_destination () 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 interesting  = 0_bit;
    │ │ │ │ -   static constexpr peer_flags_t choked  = 1_bit;
    │ │ │ │ -   static constexpr peer_flags_t remote_interested  = 2_bit;
    │ │ │ │ -   static constexpr peer_flags_t remote_choked  = 3_bit;
    │ │ │ │ -   static constexpr peer_flags_t supports_extensions  = 4_bit;
    │ │ │ │ -   static constexpr peer_flags_t outgoing_connection  = 5_bit;
    │ │ │ │ -   static constexpr peer_flags_t local_connection  = 5_bit;
    │ │ │ │ -   static constexpr peer_flags_t handshake  = 6_bit;
    │ │ │ │ -   static constexpr peer_flags_t connecting  = 7_bit;
    │ │ │ │ -   static constexpr peer_flags_t on_parole  = 9_bit;
    │ │ │ │ -   static constexpr peer_flags_t seed  = 10_bit;
    │ │ │ │ -   static constexpr peer_flags_t optimistic_unchoke  = 11_bit;
    │ │ │ │ -   static constexpr peer_flags_t snubbed  = 12_bit;
    │ │ │ │ -   static constexpr peer_flags_t upload_only  = 13_bit;
    │ │ │ │ -   static constexpr peer_flags_t endgame_mode  = 14_bit;
    │ │ │ │ -   static constexpr peer_flags_t holepunched  = 15_bit;
    │ │ │ │ -   static constexpr peer_flags_t i2p_socket  = 16_bit;
    │ │ │ │ -   static constexpr peer_flags_t utp_socket  = 17_bit;
    │ │ │ │ -   static constexpr peer_flags_t ssl_socket  = 18_bit;
    │ │ │ │ -   static constexpr peer_flags_t rc4_encrypted  = 19_bit;
    │ │ │ │ -   static constexpr peer_flags_t plaintext_encrypted  = 20_bit;
    │ │ │ │ -   peer_flags_t flags;
    │ │ │ │ -   static constexpr peer_source_flags_t tracker  = 0_bit;
    │ │ │ │ -   static constexpr peer_source_flags_t dht  = 1_bit;
    │ │ │ │ -   static constexpr peer_source_flags_t pex  = 2_bit;
    │ │ │ │ -   static constexpr peer_source_flags_t lsd  = 3_bit;
    │ │ │ │ -   static constexpr peer_source_flags_t resume_data  = 4_bit;
    │ │ │ │ -   static constexpr peer_source_flags_t incoming  = 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 standard_bittorrent  = 0_bit;
    │ │ │ │ -   static constexpr connection_type_t web_seed  = 1_bit;
    │ │ │ │ -   static constexpr connection_type_t http_seed  = 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;
    │ │ │ │ -   tcp::endpoint ip;
    │ │ │ │ -   tcp::endpoint local_endpoint;
    │ │ │ │ -   static constexpr bandwidth_state_flags_t bw_idle  = 0_bit;
    │ │ │ │ -   static constexpr bandwidth_state_flags_t bw_limit  = 1_bit;
    │ │ │ │ -   static constexpr bandwidth_state_flags_t bw_network  = 2_bit;
    │ │ │ │ -   static constexpr bandwidth_state_flags_t bw_disk  = 4_bit;
    │ │ │ │ -   bandwidth_state_flags_t read_state;
    │ │ │ │ -   bandwidth_state_flags_t write_state;
    │ │ │ │ -};
    │ │ │ │ +client_data_t userdata () const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    i2p_destination()

    │ │ │ │ +

    returns the userdata pointer as set in add_torrent_params

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    in_session()

    │ │ │ │
    │ │ │ │ -sha256_hash i2p_destination () const;
    │ │ │ │ +bool in_session () const;
    │ │ │ │  
    │ │ │ │ -

    If this peer is an i2p peer, this function returns the destination │ │ │ │ -address of the peer

    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    pieces
    │ │ │ │ -
    a bitfield, 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).
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    last_request last_active
    │ │ │ │ -
    the time since we last sent a request to this peer and since any │ │ │ │ -transfer occurred with this peer
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    download_queue_time
    │ │ │ │ -
    the time until all blocks in the request queue will be downloaded
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    interesting
    │ │ │ │ -
    we are interested in pieces from this peer.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    choked
    │ │ │ │ -
    we have choked this peer.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    remote_interested
    │ │ │ │ -
    the peer is interested in us
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    remote_choked
    │ │ │ │ -
    the peer has choked us.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    supports_extensions
    │ │ │ │ -
    means that this peer supports the │ │ │ │ -extension protocol.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    local_connection
    │ │ │ │ -
    deprecated synonym for outgoing_connection
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    handshake
    │ │ │ │ -
    The connection is opened, and waiting for the │ │ │ │ -handshake. Until the handshake is done, the peer │ │ │ │ -cannot be identified.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    connecting
    │ │ │ │ -
    The connection is in a half-open state (i.e. it is │ │ │ │ -being connected).
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    seed
    │ │ │ │ -
    This peer is a seed (it has all the pieces).
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    i2p_socket
    │ │ │ │ -
    indicates that this socket is running on top of the │ │ │ │ -I2P transport.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    utp_socket
    │ │ │ │ -
    indicates that this socket is a uTP socket
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    ssl_socket
    │ │ │ │ -
    indicates that this socket is running on top of an SSL │ │ │ │ -(TLS) channel
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    rc4_encrypted
    │ │ │ │ -
    this connection is obfuscated with RC4
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    plaintext_encrypted
    │ │ │ │ -
    the handshake of this connection was obfuscated │ │ │ │ -with a Diffie-Hellman exchange
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    flags
    │ │ │ │ -
    tells you in which state the peer is in. It is set to │ │ │ │ -any combination of the peer_flags_t flags above.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    tracker
    │ │ │ │ -
    The peer was received from the tracker.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    dht
    │ │ │ │ -
    The peer was received from the kademlia DHT.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    pex
    │ │ │ │ -
    The peer was received from the peer exchange │ │ │ │ -extension.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    lsd
    │ │ │ │ -
    The peer was received from the local service │ │ │ │ -discovery (The peer is on the local network).
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    resume_data
    │ │ │ │ -
    The peer was added from the fast resume data.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    incoming
    │ │ │ │ -
    we received an incoming connection from this peer
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    source
    │ │ │ │ -
    a combination of flags describing from which sources this peer │ │ │ │ -was received. A combination of the peer_source_flags_t above.
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    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
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    payload_up_speed payload_down_speed
    │ │ │ │ -
    The transfer rates of payload data only updated about once per second
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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()_
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    queue_bytes
    │ │ │ │ -
    the number of bytes we have requested from this peer, but not yet │ │ │ │ -received.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    send_buffer_size used_send_buffer
    │ │ │ │ -
    the number of bytes allocated │ │ │ │ -and used for the peer's send buffer, respectively.
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    receive_buffer_size used_receive_buffer receive_buffer_watermark
    │ │ │ │ -
    the number of bytes │ │ │ │ -allocated and used as receive buffer, respectively.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    num_hashfails
    │ │ │ │ -
    the number of pieces this peer has participated in sending us that │ │ │ │ -turned out to fail the hash check.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    download_queue_length
    │ │ │ │ -
    this is the number of requests we have sent to this peer that we │ │ │ │ -haven't got a response for yet
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    timed_out_requests
    │ │ │ │ -
    the number of block requests that have timed out, and are still in the │ │ │ │ -download queue
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    requests_in_buffer
    │ │ │ │ -
    the number of requests messages that are currently in the send buffer │ │ │ │ -waiting to be sent.
    │ │ │ │ +

    Returns true if the torrent is in the session. It returns true before │ │ │ │ +session::remove_torrent() is called, and false afterward.

    │ │ │ │ +

    Note that this is a blocking function, unlike torrent_handle::is_valid() │ │ │ │ +which returns immediately.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    overwrite_existing
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    target_dl_queue_length
    │ │ │ │ -
    the number of requests that is tried to be maintained (this is │ │ │ │ -typically a function of download speed)
    │ │ │ │ +[report issue]
    │ │ │ │ +
    query_distributed_copies
    │ │ │ │ +
    calculates distributed_copies, distributed_full_copies and │ │ │ │ +distributed_fraction.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    upload_queue_length
    │ │ │ │ -
    the number of piece-requests we have received from this peer │ │ │ │ -that we haven't answered with a piece yet.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    query_accurate_download_counters
    │ │ │ │ +
    includes partial downloaded blocks in total_done and │ │ │ │ +total_wanted_done.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    query_last_seen_complete
    │ │ │ │ +
    includes last_seen_complete.
    │ │ │ │
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    query_pieces
    │ │ │ │ +
    populate the pieces field in torrent_status.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    standard_bittorrent
    │ │ │ │ -
    Regular bittorrent connection
    │ │ │ │ +[report issue]
    │ │ │ │ +
    query_verified_pieces
    │ │ │ │ +
    includes verified_pieces (only applies to torrents in seed │ │ │ │ +mode).
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    web_seed
    │ │ │ │ -
    HTTP connection using the BEP 19 protocol
    │ │ │ │ +[report issue]
    │ │ │ │ +
    query_torrent_file
    │ │ │ │ +
    includes torrent_file, which is all the static information from │ │ │ │ +the .torrent file.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    http_seed
    │ │ │ │ -
    HTTP connection using the BEP 17 protocol
    │ │ │ │ +[report issue]
    │ │ │ │ +
    query_name
    │ │ │ │ +
    includes name, the name of the torrent. This is either derived │ │ │ │ +from the .torrent file, or from the &dn= magnet link argument │ │ │ │ +or possibly some other source. If the name of the torrent is not │ │ │ │ +known, this is an empty string.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    connection_type
    │ │ │ │ -
    the kind of connection this peer uses. See connection_type_t.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    query_save_path
    │ │ │ │ +
    includes save_path, the path to the directory the files of the │ │ │ │ +torrent are saved to.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    alert_when_available
    │ │ │ │ +
    used to ask libtorrent to send an alert once the piece has been │ │ │ │ +downloaded, by passing alert_when_available. When set, the │ │ │ │ +read_piece_alert alert will be delivered, with the piece data, when │ │ │ │ +it's downloaded.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    pending_disk_read_bytes
    │ │ │ │ -
    number of outstanding bytes to read │ │ │ │ -from disk
    │ │ │ │ +[report issue]
    │ │ │ │ +
    piece_granularity
    │ │ │ │ +
    only calculate file progress at piece granularity. This makes │ │ │ │ +the file_progress() call cheaper and also only takes bytes that │ │ │ │ +have passed the hash check into account, so progress cannot │ │ │ │ +regress in this mode.
    │ │ │ │
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    graceful_pause
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    flush_disk_cache
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    num_pieces
    │ │ │ │ -
    the number of pieces this peer has.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    save_info_dict
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    only_if_modified
    │ │ │ │ +
    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
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    if_counters_changed
    │ │ │ │ +
    save resume data if any counters has changed since the last time │ │ │ │ +resume data was saved. This includes upload/download counters, active │ │ │ │ +time counters and scrape data. A torrent that is not paused will have │ │ │ │ +its active time counters incremented continuously.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    progress_ppm
    │ │ │ │ -
    indicates the download progress of the peer in the range [0, 1000000] │ │ │ │ -(parts per million).
    │ │ │ │ +[report issue]
    │ │ │ │ +
    if_download_progress
    │ │ │ │ +
    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
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    ip
    │ │ │ │ -
    the IP-address to this peer. The type is an asio endpoint. For │ │ │ │ -more info, see the asio documentation. This field is not valid for │ │ │ │ -i2p peers. Instead use the i2p_destination() function.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    if_config_changed
    │ │ │ │ +
    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)
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    if_state_changed
    │ │ │ │ +
    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
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    bw_idle
    │ │ │ │ -
    The peer is not waiting for any external events to │ │ │ │ -send or receive data.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    if_metadata_changed
    │ │ │ │ +
    save the resume data if any metadata changed since the last time │ │ │ │ +resume data was saved. This includes: │ │ │ │ +* add/remove web seeds │ │ │ │ +* add/remove trackers │ │ │ │ +* receiving metadata for a magnet link
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    bw_limit
    │ │ │ │ -
    The peer is waiting for the rate limiter.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    ignore_min_interval
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    hash_value()

    │ │ │ │ +

    Declared in "libtorrent/torrent_handle.hpp"

    │ │ │ │ +
    │ │ │ │ +std::size_t hash_value (torrent_handle const& h);
    │ │ │ │ +
    │ │ │ │ +

    for std::hash (and to support using this type in unordered_map etc.)

    │ │ │ │ +

    The pop_alerts() function on session is the main interface for retrieving │ │ │ │ +alerts (warnings, messages and errors from libtorrent). If no alerts have │ │ │ │ +been posted by libtorrent pop_alerts() will return an empty list.

    │ │ │ │ +

    By default, only errors are reported. settings_pack::alert_mask can be │ │ │ │ +used to specify which kinds of events should be reported. The alert mask is │ │ │ │ +a combination of the alert_category_t flags in the alert class.

    │ │ │ │ +

    Every alert 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 alert bitmask to 0 will disable all alerts (except those │ │ │ │ +that are non-discardable). Alerts that are responses to API calls such as │ │ │ │ +save_resume_data() and post_session_stats() are non-discardable and will be │ │ │ │ +posted even if their category is disabled.

    │ │ │ │ +

    There are other alert base classes that some alerts derive from, all the │ │ │ │ +alerts that are generated for a specific torrent are derived from │ │ │ │ +torrent_alert, and tracker events derive from tracker_alert.

    │ │ │ │ +

    Alerts returned by pop_alerts() are only valid until the next call to │ │ │ │ +pop_alerts(). You may not copy an alert object to access it after the next │ │ │ │ +call to pop_alerts(). Internal members of alerts also become invalid once │ │ │ │ +pop_alerts() is called again.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_routing_bucket

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    struct to hold information about a single DHT routing table bucket

    │ │ │ │ +
    │ │ │ │ +struct dht_routing_bucket
    │ │ │ │ +{
    │ │ │ │ +   int num_nodes;
    │ │ │ │ +   int num_replacements;
    │ │ │ │ +   int last_active;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    num_nodes num_replacements
    │ │ │ │ +
    the total number of nodes and replacement nodes │ │ │ │ +in the routing table
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    bw_disk
    │ │ │ │ -
    The peer is waiting for the disk I/O thread to catch │ │ │ │ -up writing buffers to disk before downloading more.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    last_active
    │ │ │ │ +
    number of seconds since last activity
    │ │ │ │
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    torrent_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This is a base class for alerts that are associated with a │ │ │ │ +specific torrent. It contains a handle to the torrent.

    │ │ │ │ +

    Note that by the time the client receives a torrent_alert, its │ │ │ │ +handle member may be invalid.

    │ │ │ │ +
    │ │ │ │ +struct torrent_alert : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* torrent_name () const;
    │ │ │ │ +
    │ │ │ │ +   torrent_handle handle;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    message()

    │ │ │ │ +
    │ │ │ │ +std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +

    returns the message associated with this alert

    │ │ │ │ +[report issue]
    │ │ │ │ +
    handle
    │ │ │ │ +
    The torrent_handle pointing to the torrent this │ │ │ │ +alert is associated with.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    piece_block

    │ │ │ │ -

    Declared in "libtorrent/piece_block.hpp"

    │ │ │ │ +
    │ │ │ │ +

    peer_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    The peer alert is a base class for alerts that refer to a specific peer. It includes all │ │ │ │ +the information to identify the peer. i.e. ip and peer-id.

    │ │ │ │
    │ │ │ │ -struct piece_block
    │ │ │ │ +struct peer_alert : torrent_alert
    │ │ │ │  {
    │ │ │ │ -   piece_block (piece_index_t p_index, int b_index);
    │ │ │ │ -   piece_block () = default;
    │ │ │ │ -   bool operator< (piece_block const& b) const;
    │ │ │ │ -   bool operator== (piece_block const& b) const;
    │ │ │ │ -   bool operator!= (piece_block const& b) const;
    │ │ │ │ +   std::string message () const override;
    │ │ │ │  
    │ │ │ │ -   static const piece_block invalid;
    │ │ │ │ -   piece_index_t piece_index {0};
    │ │ │ │ -   int block_index  = 0;
    │ │ │ │ +   aux::noexcept_movable<tcp::endpoint> endpoint;
    │ │ │ │ +   peer_id pid;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    peer_request

    │ │ │ │ -

    Declared in "libtorrent/peer_request.hpp"

    │ │ │ │ -

    represents a byte range within a piece. Internally this is is used for │ │ │ │ -incoming piece requests.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    endpoint
    │ │ │ │ +
    The peer's IP address and port.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    pid
    │ │ │ │ +
    the peer ID, if known.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    tracker_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This is a base class used for alerts that are associated with a │ │ │ │ +specific tracker. It derives from torrent_alert since a tracker │ │ │ │ +is also associated with a specific torrent.

    │ │ │ │
    │ │ │ │ -struct peer_request
    │ │ │ │ +struct tracker_alert : torrent_alert
    │ │ │ │  {
    │ │ │ │ -   bool operator== (peer_request const& r) const;
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* tracker_url () const;
    │ │ │ │  
    │ │ │ │ -   piece_index_t piece;
    │ │ │ │ -   int start;
    │ │ │ │ -   int length;
    │ │ │ │ +   aux::noexcept_movable<tcp::endpoint> local_endpoint;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    operator==()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    tracker_url()

    │ │ │ │
    │ │ │ │ -bool operator== (peer_request const& r) const;
    │ │ │ │ +char const* tracker_url () const;
    │ │ │ │  
    │ │ │ │ -

    returns true if the right hand side peer_request refers to the same │ │ │ │ -range as this does.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    piece
    │ │ │ │ -
    The index of the piece in which the range starts.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    start
    │ │ │ │ -
    The byte offset within that piece where the range starts.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    length
    │ │ │ │ -
    The size of the range, in bytes.
    │ │ │ │ +

    returns a 0-terminated string of the tracker's URL

    │ │ │ │ +[report issue]
    │ │ │ │ +
    local_endpoint
    │ │ │ │ +
    endpoint of the listen interface being announced
    │ │ │ │
    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    load_torrent_parsed() load_torrent_file() load_torrent_buffer()

    │ │ │ │ -

    Declared in "libtorrent/load_torrent.hpp"

    │ │ │ │ +
    │ │ │ │ +

    torrent_removed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    The torrent_removed_alert 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 alert_category::status bit is set in the alert_mask.

    │ │ │ │ +

    Note that the handle remains valid for some time after │ │ │ │ +torrent_removed_alert is posted, as long as some internal libtorrent │ │ │ │ +task (such as an I/O task) refers to it. Additionally, other alerts like │ │ │ │ +save_resume_data_alert may be posted after torrent_removed_alert. │ │ │ │ +To synchronize on whether the torrent has been removed or not, call │ │ │ │ +torrent_handle::in_session(). This will return true before │ │ │ │ +torrent_removed_alert is posted, and false afterward.

    │ │ │ │ +

    Even though the handle 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.

    │ │ │ │ +

    The torrent_handle acts as a weak_ptr, even though its object no │ │ │ │ +longer exists, it can still compare equal to another weak pointer which │ │ │ │ +points to the same non-existent object.

    │ │ │ │
    │ │ │ │ -add_torrent_params load_torrent_file (
    │ │ │ │ -   std::string const& filename, load_torrent_limits const& cfg);
    │ │ │ │ -add_torrent_params load_torrent_parsed (
    │ │ │ │ -   bdecode_node const& torrent_file, load_torrent_limits const& cfg);
    │ │ │ │ -add_torrent_params load_torrent_buffer (
    │ │ │ │ -   span<char const> buffer);
    │ │ │ │ -add_torrent_params load_torrent_file (
    │ │ │ │ -   std::string const& filename);
    │ │ │ │ -add_torrent_params load_torrent_buffer (
    │ │ │ │ -   span<char const> buffer, load_torrent_limits const& cfg);
    │ │ │ │ -add_torrent_params load_torrent_parsed (
    │ │ │ │ -   bdecode_node const& torrent_file);
    │ │ │ │ +struct torrent_removed_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +   info_hash_t info_hashes;
    │ │ │ │ +   client_data_t userdata;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    These functions load the content of a .torrent file into an │ │ │ │ -add_torrent_params object. │ │ │ │ -The immutable part of a torrent file (the info-dictionary) is stored in │ │ │ │ -the ti field in the add_torrent_params object (as a torrent_info │ │ │ │ -object). │ │ │ │ -The returned object is suitable to be:

    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    truncate_files()

    │ │ │ │ -

    Declared in "libtorrent/truncate.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    userdata
    │ │ │ │ +
    'userdata` as set in add_torrent_params at torrent creation. │ │ │ │ +This can be used to associate this torrent with related data │ │ │ │ +in the client application more efficiently than info_hashes.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    read_piece_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is posted when the asynchronous read operation initiated by │ │ │ │ +a call to torrent_handle::read_piece() is completed. If the read failed, the torrent │ │ │ │ +is paused and an error state is set and the buffer member of the alert │ │ │ │ +is 0. If successful, buffer points to a buffer containing all the data │ │ │ │ +of the piece. piece is the piece index that was read. size is the │ │ │ │ +number of bytes that was read.

    │ │ │ │ +

    If the operation fails, error will indicate what went wrong.

    │ │ │ │
    │ │ │ │ -void truncate_files (file_storage const& fs, std::string const& save_path, storage_error& ec);
    │ │ │ │ +struct read_piece_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +   boost::shared_array<char> const buffer;
    │ │ │ │ +   piece_index_t const piece;
    │ │ │ │ +   int const size;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    Truncates files larger than specified in the file_storage, saved under │ │ │ │ -the specified save_path.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    make_magnet_uri()

    │ │ │ │ -

    Declared in "libtorrent/magnet_uri.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_completed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This is posted whenever an individual file completes its download. i.e. │ │ │ │ +All pieces overlapping this file have passed their hash check.

    │ │ │ │
    │ │ │ │ -std::string make_magnet_uri (torrent_info const& info);
    │ │ │ │ -std::string make_magnet_uri (torrent_handle const& handle);
    │ │ │ │ -std::string make_magnet_uri (add_torrent_params const& atp);
    │ │ │ │ +struct file_completed_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   file_index_t const index;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    Generates a magnet URI from the specified torrent.

    │ │ │ │ -

    Several fields from the add_torrent_params objects are recorded in the │ │ │ │ -magnet link. In order to not include them, they have to be cleared before │ │ │ │ -calling make_magnet_uri(). 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 add_torrent_params │ │ │ │ -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 │ │ │ │ -make_magnet_uri() returns an empty string.

    │ │ │ │ -

    The recommended way to generate a magnet link from a torrent_handle is to │ │ │ │ -call save_resume_data(), which will post a save_resume_data_alert │ │ │ │ -containing an add_torrent_params object. This can then be passed to │ │ │ │ -make_magnet_uri().

    │ │ │ │ -

    The overload that takes a torrent_handle 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 magnet links.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    parse_magnet_uri()

    │ │ │ │ -

    Declared in "libtorrent/magnet_uri.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    index
    │ │ │ │ +
    refers to the index of the file that completed.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_renamed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This is posted as a response to a torrent_handle::rename_file() call, if the rename │ │ │ │ +operation succeeds.

    │ │ │ │
    │ │ │ │ -add_torrent_params parse_magnet_uri (string_view uri);
    │ │ │ │ -add_torrent_params parse_magnet_uri (string_view uri, error_code& ec);
    │ │ │ │ -void parse_magnet_uri (string_view uri, add_torrent_params& p, error_code& ec);
    │ │ │ │ +struct file_renamed_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* new_name () const;
    │ │ │ │ +   char const* old_name () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ +   file_index_t const index;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    This function parses out information from the magnet link and populates the │ │ │ │ -add_torrent_params 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    version()

    │ │ │ │ -

    Declared in "libtorrent/version.hpp"

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    old_name() new_name()

    │ │ │ │
    │ │ │ │ -char const* version ();
    │ │ │ │ +char const* new_name () const;
    │ │ │ │ +char const* old_name () const;
    │ │ │ │  
    │ │ │ │ -

    returns the libtorrent version as string form in this format: │ │ │ │ -"<major>.<minor>.<tiny>.<tag>"

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    torrent_peer_equal()

    │ │ │ │ -

    Declared in "libtorrent/torrent_peer.hpp"

    │ │ │ │ +

    returns the new and previous file name, respectively.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    index
    │ │ │ │ +
    refers to the index of the file that was renamed,
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    file_rename_failed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This is posted as a response to a torrent_handle::rename_file() call, if the rename │ │ │ │ +operation failed.

    │ │ │ │
    │ │ │ │ -inline bool torrent_peer_equal (torrent_peer const* lhs, torrent_peer const* rhs);
    │ │ │ │ +struct file_rename_failed_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ +   file_index_t const index;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum protocol_version

    │ │ │ │ -

    Declared in "libtorrent/info_hash.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    V10The original BitTorrent version, using SHA-1 hashes
    V21Version 2 of the BitTorrent protocol, using SHA-256 hashes
    NUM2 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum event_t

    │ │ │ │ -

    Declared in "libtorrent/tracker_manager.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    none0 
    completed1 
    started2 
    stopped3 
    paused4 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum connection_type

    │ │ │ │ -

    Declared in "libtorrent/peer_connection.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    bittorrent0 
    url_seed1 
    http_seed2 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum socket_type_t

    │ │ │ │ -

    Declared in "libtorrent/socket_type.hpp"

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    index error
    │ │ │ │ +
    refers to the index of the file that was supposed to be renamed, │ │ │ │ +error is the error code returned from the filesystem.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    performance_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a limit is reached that might have a negative impact on │ │ │ │ +upload or download rate performance.

    │ │ │ │ +
    │ │ │ │ +struct performance_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () 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 static_category  = alert_category::performance_warning;
    │ │ │ │ +   performance_warning_t const warning_code;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    enum performance_warning_t

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ -
    namevaluedescription
    tcp
    outstanding_disk_buffer_limit_reached0 This warning means that the number of bytes queued to be written to disk │ │ │ │ +exceeds the max disk byte queue setting (settings_pack::max_queued_disk_bytes). │ │ │ │ +This might restrict the download rate, by not queuing up enough write jobs │ │ │ │ +to the disk I/O thread. When this alert is posted, peer connections are │ │ │ │ +temporarily stopped from downloading, until the queued disk bytes have fallen │ │ │ │ +below the limit again. Unless your max_queued_disk_bytes setting is already │ │ │ │ +high, you might want to increase it to get better performance.
    socks5
    outstanding_request_limit_reached1 This is posted when libtorrent would like to send more requests to a peer, │ │ │ │ +but it's limited by settings_pack::max_out_request_queue. The queue length │ │ │ │ +libtorrent is trying to achieve is determined by the download rate and the │ │ │ │ +assumed round-trip-time (settings_pack::request_queue_time). 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 alert │ │ │ │ +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 max_out_request_queue │ │ │ │ +setting.
    http
    upload_limit_too_low2 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.
    utp
    download_limit_too_low3 This is the same warning as upload_limit_too_low 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.
    i2p
    send_buffer_watermark_too_low4 

    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:

    │ │ │ │ +
    │ │ │ │ +min(512, max(upload_rate * send_buffer_watermark_factor / 100, send_buffer_watermark))
    │ │ │ │ +
    │ │ │ │ +

    If you receive this alert, you might want to either increase your send_buffer_watermark │ │ │ │ +or send_buffer_watermark_factor.

    │ │ │ │ +
    tcp_ssl
    too_many_optimistic_unchoke_slots5 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.
    socks5_ssl
    too_high_disk_queue_limit6 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 max_queued_disk_bytes or increase cache_size.
    http_ssl
    aio_limit_reached7 
    utp_ssl
    deprecated_bittyrant_with_no_uplimit8 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum portmap_transport

    │ │ │ │ -

    Declared in "libtorrent/portmap.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    namevaluedescription
    too_few_outgoing_ports9This is generated if outgoing peer connections are failing because of address in use │ │ │ │ +errors, indicating that settings_pack::outgoing_ports is set and is too small of │ │ │ │ +a range. Consider not using the outgoing_ports setting at all, or widen the range to │ │ │ │ +include more ports.
    natpmp0natpmp can be NAT-PMP or PCP
    too_few_file_descriptors10 
    upnp1
    num_warnings11 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum portmap_protocol

    │ │ │ │ -

    Declared in "libtorrent/portmap.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    state_changed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    Generated whenever a torrent changes its state.

    │ │ │ │ +
    │ │ │ │ +struct state_changed_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +   torrent_status::state_t const state;
    │ │ │ │ +   torrent_status::state_t const prev_state;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    state
    │ │ │ │ +
    the new state of the torrent.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    prev_state
    │ │ │ │ +
    the previous state.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    tracker_error_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated on tracker time outs, premature disconnects, │ │ │ │ +invalid response or a HTTP response other than "200 OK". From the alert │ │ │ │ +you can get the handle to the torrent the tracker belongs to.

    │ │ │ │ +
    │ │ │ │ +struct tracker_error_alert final : tracker_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* failure_reason () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::tracker | alert_category::error;
    │ │ │ │ +   int const times_in_row;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +   operation_t op;
    │ │ │ │ +   protocol_version version;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    failure_reason()

    │ │ │ │ +
    │ │ │ │ +char const* failure_reason () const;
    │ │ │ │ +
    │ │ │ │ +

    if the tracker sent a "failure reason" string, it will be returned │ │ │ │ +here.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    times_in_row
    │ │ │ │ +
    This member says how many times in a row this tracker has failed.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    the error code indicating why the tracker announce failed. If it is │ │ │ │ +is lt::errors::tracker_failure the failure_reason() might contain │ │ │ │ +a more detailed description of why the tracker rejected the request. │ │ │ │ +HTTP status codes indicating errors are also set in this field.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    version
    │ │ │ │ +
    the bittorrent protocol version that was announced
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    tracker_warning_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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.

    │ │ │ │ +
    │ │ │ │ +struct tracker_warning_alert final : tracker_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* warning_message () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::tracker | alert_category::error;
    │ │ │ │ +   protocol_version version;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    warning_message()

    │ │ │ │ +
    │ │ │ │ +char const* warning_message () const;
    │ │ │ │ +
    │ │ │ │ +

    the message associated with this warning

    │ │ │ │ +[report issue]
    │ │ │ │ +
    version
    │ │ │ │ +
    the bittorrent protocol version that was announced
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    scrape_reply_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a scrape request succeeds.

    │ │ │ │ +
    │ │ │ │ +struct scrape_reply_alert final : tracker_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::tracker;
    │ │ │ │ +   int const incomplete;
    │ │ │ │ +   int const complete;
    │ │ │ │ +   protocol_version version;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    incomplete complete
    │ │ │ │ +
    the data returned in the scrape response. These numbers │ │ │ │ +may be -1 if the response was malformed.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    version
    │ │ │ │ +
    the bittorrent protocol version that was scraped
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    scrape_failed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    If a scrape request fails, this alert is generated. This might be due │ │ │ │ +to the tracker timing out, refusing connection or returning an http response │ │ │ │ +code indicating an error.

    │ │ │ │ +
    │ │ │ │ +struct scrape_failed_alert final : tracker_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* error_message () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::tracker | alert_category::error;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +   protocol_version version;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    error_message()

    │ │ │ │ +
    │ │ │ │ +char const* error_message () const;
    │ │ │ │ +
    │ │ │ │ +

    if the error indicates there is an associated message, this returns │ │ │ │ +that message. Otherwise and empty string.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    the error itself. This may indicate that the tracker sent an error │ │ │ │ +message (error::tracker_failure), in which case it can be │ │ │ │ +retrieved by calling error_message().
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    version
    │ │ │ │ +
    the bittorrent protocol version that was scraped
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    tracker_reply_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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.

    │ │ │ │ +
    │ │ │ │ +struct tracker_reply_alert final : tracker_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::tracker;
    │ │ │ │ +   int const num_peers;
    │ │ │ │ +   protocol_version version;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    num_peers
    │ │ │ │ +
    tells how many peers the tracker returned in this response. This is │ │ │ │ +not expected to be greater than the num_want settings. These are not necessarily │ │ │ │ +all new peers, some of them may already be connected.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    version
    │ │ │ │ +
    the bittorrent protocol version that was announced
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_reply_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated each time the DHT receives peers from a node. num_peers │ │ │ │ +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.

    │ │ │ │ +
    │ │ │ │ +struct dht_reply_alert final : tracker_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::dht | alert_category::tracker;
    │ │ │ │ +   int const num_peers;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    tracker_announce_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated each time a tracker announce is sent (or attempted to be sent). │ │ │ │ +There are no extra data members in this alert. The url can be found in the base class │ │ │ │ +however.

    │ │ │ │ +
    │ │ │ │ +struct tracker_announce_alert final : tracker_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::tracker;
    │ │ │ │ +   event_t const event;
    │ │ │ │ +   protocol_version version;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    event
    │ │ │ │ +
    specifies what event was sent to the tracker. See event_t.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    version
    │ │ │ │ +
    the bittorrent protocol version that is announced
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    hash_failed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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 alert.

    │ │ │ │ +
    │ │ │ │ +struct hash_failed_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +   piece_index_t const piece_index;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    peer_ban_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a peer is banned because it has sent too many corrupt pieces │ │ │ │ +to us. ip is the endpoint to the peer that was banned.

    │ │ │ │ +
    │ │ │ │ +struct peer_ban_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    peer_unsnubbed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a peer is un-snubbed. Essentially when it was snubbed for stalling │ │ │ │ +sending data, and now it started sending data again.

    │ │ │ │ +
    │ │ │ │ +struct peer_unsnubbed_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    peer_snubbed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a peer is snubbed, when it stops sending data when we request │ │ │ │ +it.

    │ │ │ │ +
    │ │ │ │ +struct peer_snubbed_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    peer_error_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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 alert, to identify it.

    │ │ │ │ +
    │ │ │ │ +struct peer_error_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ +   operation_t op;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    op
    │ │ │ │ +
    a 0-terminated string of the low-level operation that failed, or nullptr if │ │ │ │ +there was no low level disk operation.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    tells you what error caused this alert.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    peer_connect_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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 incoming_connection_alert.

    │ │ │ │ +
    │ │ │ │ +struct peer_connect_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   enum direction_t
    │ │ │ │ +   {
    │ │ │ │ +      in,
    │ │ │ │ +      out,
    │ │ │ │ +   };
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::connect;
    │ │ │ │ +   direction_t direction;
    │ │ │ │ +   socket_type_t socket_type;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    enum direction_t

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ │ │ │ │
    namevaluedescription
    none
    in0 
    tcp
    out1 
    udp2 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    download_priority_t

    │ │ │ │ -

    Declared in "libtorrent/download_priority.hpp"

    │ │ │ │ -
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    pex_flags_t

    │ │ │ │ -

    Declared in "libtorrent/pex_flags.hpp"

    │ │ │ │ -
    │ │ │ │ -
    pex_encryption
    │ │ │ │ -
    the peer supports protocol encryption
    │ │ │ │ +[report issue]
    │ │ │ │ +
    direction
    │ │ │ │ +
    Tells you if the peer was incoming or outgoing
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    pex_seed
    │ │ │ │ -
    the peer is a seed
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    peer_disconnected_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a peer is disconnected for any reason (other than the ones │ │ │ │ +covered by peer_error_alert ).

    │ │ │ │ +
    │ │ │ │ +struct peer_disconnected_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::connect;
    │ │ │ │ +   socket_type_t const socket_type;
    │ │ │ │ +   operation_t const op;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +   close_reason_t const reason;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    socket_type
    │ │ │ │ +
    the kind of socket this peer was connected over
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    pex_utp
    │ │ │ │ -
    the peer supports the uTP, transport protocol over UDP.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    op
    │ │ │ │ +
    the operation or level where the error occurred. Specified as an │ │ │ │ +value from the operation_t enum. Defined in operations.hpp.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    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
    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    tells you what error caused peer to disconnect.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    pex_lt_v2
    │ │ │ │ -
    protocol v2 │ │ │ │ -this is not a standard flag, it is only used internally
    │ │ │ │ +[report issue]
    │ │ │ │ +
    reason
    │ │ │ │ +
    the reason the peer disconnected (if specified)
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    int

    │ │ │ │ -

    Declared in "libtorrent/version.hpp"

    │ │ │ │ -
    │ │ │ │ -
    version_major
    │ │ │ │ -
    the major, minor and tiny versions of libtorrent
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    invalid_request_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This is a debug alert that is generated by an incoming invalid piece request. │ │ │ │ +ip is the address of the peer and the request is the actual incoming │ │ │ │ +request from the peer. See peer_request for more info.

    │ │ │ │ +
    │ │ │ │ +struct invalid_request_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ +   peer_request const request;
    │ │ │ │ +   bool const we_have;
    │ │ │ │ +   bool const peer_interested;
    │ │ │ │ +   bool const withheld;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    request
    │ │ │ │ +
    the request we received from the peer
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    version_minor
    │ │ │ │ -
    the major, minor and tiny versions of libtorrent
    │ │ │ │ +[report issue]
    │ │ │ │ +
    we_have
    │ │ │ │ +
    true if we have this piece
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    version_tiny
    │ │ │ │ -
    the major, minor and tiny versions of libtorrent
    │ │ │ │ +[report issue]
    │ │ │ │ +
    peer_interested
    │ │ │ │ +
    true if the peer indicated that it was interested to download before │ │ │ │ +sending the request
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    torrent_flags_t

    │ │ │ │ -

    Declared in "libtorrent/torrent_flags.hpp"

    │ │ │ │ -
    │ │ │ │ -
    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 set the seed_mode flag on a torrent after it has │ │ │ │ -been added to a session. It is possible to clear it though.

    │ │ │ │ -
    │ │ │ │ +[report issue]
    │ │ │ │ +
    withheld
    │ │ │ │ +
    if this is true, the peer is not allowed to download this piece because │ │ │ │ +of super-seeding rules.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    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.

    │ │ │ │ -
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    torrent_finished_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a torrent switches from being a downloader to a seed. │ │ │ │ +It will only be generated once per torrent. It contains a torrent_handle to the │ │ │ │ +torrent in question.

    │ │ │ │ +
    │ │ │ │ +struct torrent_finished_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    piece_finished_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    this alert is posted every time a piece completes downloading │ │ │ │ +and passes the hash check. This alert derives from torrent_alert │ │ │ │ +which contains the torrent_handle 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 torrent_handle::have_piece() │ │ │ │ +may still return false

    │ │ │ │ +
    │ │ │ │ +struct piece_finished_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   piece_index_t const piece_index;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    piece_index
    │ │ │ │ +
    the index of the piece that finished
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    share_mode
    │ │ │ │ -

    determines if the torrent should be added in share mode 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 queuing.
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    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 queuing.

    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    duplicate_is_error
    │ │ │ │ -
    used in add_torrent_params to indicate that it's an error to attempt │ │ │ │ -to add a torrent that's already in the session. If it's not considered an │ │ │ │ -error, a handle to the existing torrent is returned. │ │ │ │ -This flag is not saved by write_resume_data(), 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 post_torrent_updates(). │ │ │ │ -This flag is not saved by write_resume_data().
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    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 set_piece_deadline() instead.
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    stop_when_ready
    │ │ │ │ -

    When this flag is set, the torrent will force stop 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.

    │ │ │ │ -

    Force stopped 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 add_torrent_params.

    │ │ │ │ -

    The stop-when-ready flag fixes the inherent race condition of waiting │ │ │ │ -for the state_changed_alert and then call pause(). The download/seeding │ │ │ │ -will most likely start in between posting the alert 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 add_torrent_params │ │ │ │ -object override any trackers from the torrent file. If the flag is │ │ │ │ -not set, the trackers from the add_torrent_params object will be │ │ │ │ -added to the list of trackers used by the torrent. │ │ │ │ -This flag is set by read_resume_data() 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 session. │ │ │ │ -This flag is not saved by write_resume_data()
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    override_web_seeds
    │ │ │ │ -
    If this flag is set, the web seeds from the add_torrent_params │ │ │ │ -object will override any web seeds in the torrent file. If it's not │ │ │ │ -set, web seeds in the add_torrent_params object will be added to the │ │ │ │ -list of web seeds used by the torrent. │ │ │ │ -This flag is set by read_resume_data() 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 session. │ │ │ │ -This flag is not saved by write_resume_data()
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    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 │ │ │ │ -save_resume_data() for details.

    │ │ │ │ -

    This flag is cleared by a successful call to save_resume_data() │ │ │ │ -This flag is not saved by write_resume_data(), 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 session 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 session 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 parse_magnet_uri() if the tracker list contains such │ │ │ │ -URL.
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    all
    │ │ │ │ -
    all torrent flags combined. Can conveniently be used when creating masks │ │ │ │ -for flags
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    char const*

    │ │ │ │ -

    Declared in "libtorrent/version.hpp"

    │ │ │ │ -
    │ │ │ │ -
    version_str
    │ │ │ │ -
    the libtorrent version in string form
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    std::uint64_t

    │ │ │ │ -

    Declared in "libtorrent/version.hpp"

    │ │ │ │ -
    │ │ │ │ -
    version_revision
    │ │ │ │ -
    the git commit of this libtorrent version
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    request_dropped_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a peer rejects or ignores a piece request.

    │ │ │ │ +
    │ │ │ │ +struct request_dropped_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   int const block_index;
    │ │ │ │ +   piece_index_t const piece_index;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    block_timeout_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a block request times out.

    │ │ │ │ +
    │ │ │ │ +struct block_timeout_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   int const block_index;
    │ │ │ │ +   piece_index_t const piece_index;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    block_finished_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a block request receives a response.

    │ │ │ │ +
    │ │ │ │ +struct block_finished_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   int const block_index;
    │ │ │ │ +   piece_index_t const piece_index;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    block_downloading_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a block request is sent to a peer.

    │ │ │ │ +
    │ │ │ │ +struct block_downloading_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   int const block_index;
    │ │ │ │ +   piece_index_t const piece_index;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    unwanted_block_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a block is received that was not requested or │ │ │ │ +whose request timed out.

    │ │ │ │ +
    │ │ │ │ +struct unwanted_block_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ +   int const block_index;
    │ │ │ │ +   piece_index_t const piece_index;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    storage_moved_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    The storage_moved_alert is generated when all the disk IO has │ │ │ │ +completed and the files have been moved, as an effect of a call to │ │ │ │ +torrent_handle::move_storage. This is useful to synchronize with the │ │ │ │ +actual disk. The storage_path() member return the new path of the │ │ │ │ +storage.

    │ │ │ │ +
    │ │ │ │ +struct storage_moved_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* storage_path () const;
    │ │ │ │ +   char const* old_path () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    old_path() storage_path()

    │ │ │ │ +
    │ │ │ │ +char const* storage_path () const;
    │ │ │ │ +char const* old_path () const;
    │ │ │ │ +
    │ │ │ │ +

    the path the torrent was moved to and from, respectively.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    storage_moved_failed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    The storage_moved_failed_alert is generated when an attempt to move the storage, │ │ │ │ +via torrent_handle::move_storage(), fails.

    │ │ │ │ +
    │ │ │ │ +struct storage_moved_failed_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* file_path () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +   operation_t op;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    file_path()

    │ │ │ │ +
    │ │ │ │ +char const* file_path () const;
    │ │ │ │ +
    │ │ │ │ +

    If the error happened for a specific file, this returns its path.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    op
    │ │ │ │ +
    this indicates what underlying operation caused the error
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_torrent_params

    │ │ │ │ -

    Declared in "libtorrent/add_torrent_params.hpp"

    │ │ │ │ -

    The add_torrent_params contains all the information in a .torrent file │ │ │ │ -along with all information necessary to add that torrent to a session. │ │ │ │ -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 session, one of those fields must be set │ │ │ │ -in addition to save_path. The add_torrent_params 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 session. For serialization and de-serialization of │ │ │ │ -add_torrent_params objects, see read_resume_data() and │ │ │ │ -write_resume_data().

    │ │ │ │ -

    The add_torrent_params is also used to represent a parsed .torrent │ │ │ │ -file. It can be loaded via load_torrent_file(), load_torrent_buffer() and │ │ │ │ -load_torrent_parsed(). It can be saved via write_torrent_file().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    torrent_deleted_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a request to delete the files of a torrent complete.

    │ │ │ │ +

    This alert is posted in the alert_category::storage category, and that bit │ │ │ │ +needs to be set in the alert_mask.

    │ │ │ │
    │ │ │ │ -struct add_torrent_params
    │ │ │ │ +struct torrent_deleted_alert final : torrent_alert
    │ │ │ │  {
    │ │ │ │ -   int version  = 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 storage_mode  = storage_mode_sparse;
    │ │ │ │ -   client_data_t userdata;
    │ │ │ │ -   aux::noexcept_movable<std::vector<download_priority_t>> file_priorities;
    │ │ │ │ -   std::string trackerid;
    │ │ │ │ -   torrent_flags_t flags  = torrent_flags::default_flags;
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │     info_hash_t info_hashes;
    │ │ │ │ -   int max_uploads  = -1;
    │ │ │ │ -   int max_connections  = -1;
    │ │ │ │ -   int upload_limit  = -1;
    │ │ │ │ -   int download_limit  = -1;
    │ │ │ │ -   std::int64_t total_uploaded  = 0;
    │ │ │ │ -   std::int64_t total_downloaded  = 0;
    │ │ │ │ -   int active_time  = 0;
    │ │ │ │ -   int finished_time  = 0;
    │ │ │ │ -   int seeding_time  = 0;
    │ │ │ │ -   std::time_t added_time  = 0;
    │ │ │ │ -   std::time_t completed_time  = 0;
    │ │ │ │ -   std::time_t last_seen_complete  = 0;
    │ │ │ │ -   int num_complete  = -1;
    │ │ │ │ -   int num_incomplete  = -1;
    │ │ │ │ -   int num_downloaded  = -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 last_download  = 0;
    │ │ │ │ -   std::time_t last_upload  = 0;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    version
    │ │ │ │ -
    filled in by the constructor and should be left untouched. It is used │ │ │ │ -for forward binary compatibility.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    ti
    │ │ │ │ -
    torrent_info object with the torrent to add. Unless the │ │ │ │ -info_hash is set, this is required to be initialized.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    info_hashes
    │ │ │ │ +
    The info-hash of the torrent that was just deleted. Most of │ │ │ │ +the time the torrent_handle in the torrent_alert will be invalid by the time │ │ │ │ +this alert arrives, since the torrent is being deleted. The info_hashes member │ │ │ │ +is hence the main way of identifying which torrent just completed the delete.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    dht_nodes
    │ │ │ │ -
    a list of hostname and port pairs, representing DHT nodes to be added │ │ │ │ -to the session (if DHT is enabled). The hostname may be an IP address.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    torrent_delete_failed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a request to delete the files of a torrent fails. │ │ │ │ +Just removing a torrent from the session cannot fail

    │ │ │ │ +
    │ │ │ │ +struct torrent_delete_failed_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::storage
    │ │ │ │ +   | alert_category::error;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +   info_hash_t info_hashes;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    tells you why it failed.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    name
    │ │ │ │ -
    in case there's no other name in this torrent, this name will be used. │ │ │ │ -The name out of the torrent_info object takes precedence if available.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    info_hashes
    │ │ │ │ +
    the info hash of the torrent whose files failed to be deleted
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    save_resume_data_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated as a response to a torrent_handle::save_resume_data request. │ │ │ │ +It is generated once the disk IO thread is done writing the state for this torrent.

    │ │ │ │ +
    │ │ │ │ +struct save_resume_data_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ +   add_torrent_params params;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    params
    │ │ │ │ +

    the params object is populated with the torrent file whose resume │ │ │ │ +data was saved. It is suitable to be:

    │ │ │ │ + │ │ │ │
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    storage_mode
    │ │ │ │ -
    One of the values from storage_mode_t. For more information, see │ │ │ │ -storage allocation.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    save_resume_data_failed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated instead of save_resume_data_alert if there was an error │ │ │ │ +generating the resume data. error describes what went wrong.

    │ │ │ │ +
    │ │ │ │ +struct save_resume_data_failed_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::storage
    │ │ │ │ +   | alert_category::error;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    the error code from the resume_data failure
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    userdata
    │ │ │ │ -
    The userdata parameter is optional and will be passed on to the │ │ │ │ -extension constructor functions, if any │ │ │ │ -(see torrent_handle::add_extension()). It will also be stored in the │ │ │ │ -torrent object and can be retrieved by calling userdata().
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    torrent_paused_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated as a response to a torrent_handle::pause request. It is │ │ │ │ +generated once all disk IO is complete and the files in the torrent have been closed. │ │ │ │ +This is useful for synchronizing with the disk.

    │ │ │ │ +
    │ │ │ │ +struct torrent_paused_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    torrent_resumed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated as a response to a torrent_handle::resume() request. It is │ │ │ │ +generated when a torrent goes from a paused state to an active state.

    │ │ │ │ +
    │ │ │ │ +struct torrent_resumed_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    torrent_checked_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is posted when a torrent completes checking. i.e. when it transitions │ │ │ │ +out of the checking files state into a state where it is ready to start downloading

    │ │ │ │ +
    │ │ │ │ +struct torrent_checked_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    url_seed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a HTTP seed name lookup fails.

    │ │ │ │ +
    │ │ │ │ +struct url_seed_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* server_url () const;
    │ │ │ │ +   char const* error_message () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::peer | alert_category::error;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    server_url()

    │ │ │ │ +
    │ │ │ │ +char const* server_url () const;
    │ │ │ │ +
    │ │ │ │ +

    the URL the error is associated with

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    error_message()

    │ │ │ │ +
    │ │ │ │ +char const* error_message () const;
    │ │ │ │ +
    │ │ │ │ +

    in case the web server sent an error message, this function returns │ │ │ │ +it.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    the error the web seed encountered. If this is not set, the server │ │ │ │ +sent an error message, call error_message().
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    file_error_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    If the storage fails to read or write files that it needs access to, this alert is │ │ │ │ +generated and the torrent is paused.

    │ │ │ │ +
    │ │ │ │ +struct file_error_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* filename () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status
    │ │ │ │ +   | alert_category::storage;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +   operation_t op;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    filename()

    │ │ │ │ +
    │ │ │ │ +char const* filename () const;
    │ │ │ │ +
    │ │ │ │ +

    the file that experienced the error

    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    the error code describing the error.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    op
    │ │ │ │ +
    indicates which underlying operation caused the error
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    flags
    │ │ │ │ -

    flags controlling aspects of this torrent and how it's added. See │ │ │ │ -torrent_flags_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.

    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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 parse_magnet_uri() to populate fields in the │ │ │ │ -add_torrent_params object.
    │ │ │ │ +
    │ │ │ │ +

    metadata_failed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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.

    │ │ │ │ +
    │ │ │ │ +struct metadata_failed_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    indicates what failed when parsing the metadata. This error is │ │ │ │ +what's returned from lazy_bdecode().
    │ │ │ │
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    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 torrent_handle. 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 torrent_handle

    │ │ │ │ -

    For fine grained control over rate limits, including making them apply │ │ │ │ -to local peers, see peer classes.

    │ │ │ │ -
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    metadata_received_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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).

    │ │ │ │ +

    There are no additional data members in this alert.

    │ │ │ │ +

    Typically, when receiving this alert, you would want to save the torrent file in order │ │ │ │ +to load it back up again when the session is restarted. Here's an example snippet of │ │ │ │ +code to do that:

    │ │ │ │ +
    │ │ │ │ +torrent_handle h = alert->handle;
    │ │ │ │ +std::shared_ptr<torrent_info const> ti = h.torrent_file();
    │ │ │ │ +create_torrent ct(*ti);
    │ │ │ │ +entry te = ct.generate();
    │ │ │ │ +std::vector<char> buffer;
    │ │ │ │ +bencode(std::back_inserter(buffer), te);
    │ │ │ │ +FILE* f = fopen((to_hex(ti->info_hashes().get_best().to_string()) + ".torrent").c_str(), "wb+");
    │ │ │ │ +if (f) {
    │ │ │ │ +        fwrite(&buffer[0], 1, buffer.size(), f);
    │ │ │ │ +        fclose(f);
    │ │ │ │ +}
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +struct metadata_received_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    udp_error_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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 session.

    │ │ │ │ +
    │ │ │ │ +struct udp_error_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ +   aux::noexcept_movable<udp::endpoint> endpoint;
    │ │ │ │ +   operation_t operation;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    endpoint
    │ │ │ │ +
    the source address associated with the error (if any)
    │ │ │ │
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    upload_limit download_limit
    │ │ │ │ -
    the upload and download rate limits for this torrent, specified in │ │ │ │ -bytes per second. -1 means unlimited.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    operation
    │ │ │ │ +
    the operation that failed
    │ │ │ │
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    total_uploaded total_downloaded
    │ │ │ │ -
    the total number of bytes uploaded and downloaded by this torrent so │ │ │ │ -far.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    the error code describing the error
    │ │ │ │
    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    active_time finished_time seeding_time
    │ │ │ │ -
    the number of seconds this torrent has spent in started, finished and │ │ │ │ -seeding state so far, respectively.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    external_ip_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    Whenever libtorrent learns about the machines external IP, this alert 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 external_address member.

    │ │ │ │ +
    │ │ │ │ +struct external_ip_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +   aux::noexcept_movable<address> external_address;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    external_address
    │ │ │ │ +
    the IP address that is believed to be our external IP
    │ │ │ │
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    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 add_torrent() is │ │ │ │ -called.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    listen_failed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when none of the ports, given in the port range, to │ │ │ │ +session can be opened for listening. The listen_interface member is the │ │ │ │ +interface that failed, error is the error code describing the failure.

    │ │ │ │ +

    In the case an endpoint was created before generating the alert, it is │ │ │ │ +represented by address and port. The combinations of socket type │ │ │ │ +and operation in which such address and port are not valid are: │ │ │ │ +accept - i2p │ │ │ │ +accept - socks5 │ │ │ │ +enum_if - tcp

    │ │ │ │ +

    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 listen_failed_alert with port 0 even if you didn't ask to │ │ │ │ +listen on it.

    │ │ │ │ +
    │ │ │ │ +struct listen_failed_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* listen_interface () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status | alert_category::error;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +   operation_t op;
    │ │ │ │ +   lt::socket_type_t const socket_type;
    │ │ │ │ +   aux::noexcept_movable<lt::address> address;
    │ │ │ │ +   int const port;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    listen_interface()

    │ │ │ │ +
    │ │ │ │ +char const* listen_interface () const;
    │ │ │ │ +
    │ │ │ │ +

    the network device libtorrent attempted to listen on, or the IP address

    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    the error the system returned
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    op
    │ │ │ │ +
    the underlying operation that failed
    │ │ │ │
    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    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.

    │ │ │ │ -
    │ │ │ │ +[report issue]
    │ │ │ │ +
    socket_type
    │ │ │ │ +
    the type of listen socket this alert refers to.
    │ │ │ │
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    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 BEP 17.

    │ │ │ │ -

    url_seeds expects URLs to regular web servers, aka "get right" style, │ │ │ │ -specified in BEP 19.

    │ │ │ │ -
    │ │ │ │ +[report issue]
    │ │ │ │ +
    address
    │ │ │ │ +
    the address libtorrent attempted to listen on │ │ │ │ +see alert documentation for validity of this value
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    peers
    │ │ │ │ -
    peers to add to the torrent, to be tried to be connected to as │ │ │ │ -bittorrent peers.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    port
    │ │ │ │ +
    the port libtorrent attempted to listen on │ │ │ │ +see alert documentation for validity of this value
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    banned_peers
    │ │ │ │ -
    peers banned from this torrent. The will not be connected to
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    listen_succeeded_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is posted when the listen port succeeds to be opened on a │ │ │ │ +particular interface. address and port is the endpoint that │ │ │ │ +successfully was opened for listening.

    │ │ │ │ +
    │ │ │ │ +struct listen_succeeded_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +   aux::noexcept_movable<lt::address> address;
    │ │ │ │ +   int const port;
    │ │ │ │ +   lt::socket_type_t const socket_type;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    address
    │ │ │ │ +
    the address libtorrent ended up listening on. This address │ │ │ │ +refers to the local interface.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    unfinished_pieces
    │ │ │ │ -
    this is a map of partially downloaded piece. The key is the piece index │ │ │ │ -and the value is a bitfield where each bit represents a 16 kiB block. │ │ │ │ -A set bit means we have that block.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    port
    │ │ │ │ +
    the port libtorrent ended up listening on.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    have_pieces
    │ │ │ │ -
    this is a bitfield indicating which pieces we already have of this │ │ │ │ -torrent.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    socket_type
    │ │ │ │ +
    the type of listen socket this alert refers to.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    verified_pieces
    │ │ │ │ -
    when in seed_mode, pieces with a set bit in this bitfield have been │ │ │ │ -verified to be valid. Other pieces will be verified the first time a │ │ │ │ -peer requests it.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    portmap_error_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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 alert 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.

    │ │ │ │ +
    │ │ │ │ +struct portmap_error_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::port_mapping
    │ │ │ │ +   | alert_category::error;
    │ │ │ │ +   port_mapping_t const mapping;
    │ │ │ │ +   portmap_transport map_transport;
    │ │ │ │ +   aux::noexcept_movable<address> local_address;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    mapping
    │ │ │ │ +
    refers to the mapping index of the port map that failed, i.e. │ │ │ │ +the index returned from add_mapping().
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    map_transport
    │ │ │ │ +
    UPnP or NAT-PMP
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    merkle_trees
    │ │ │ │ -
    v2 hashes, if known
    │ │ │ │ +[report issue]
    │ │ │ │ +
    local_address
    │ │ │ │ +
    the local network the port mapper is running on
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    tells you what failed.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    portmap_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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.

    │ │ │ │ +
    │ │ │ │ +struct portmap_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = 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<address> local_address;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    mapping
    │ │ │ │ +
    refers to the mapping index of the port map that failed, i.e. │ │ │ │ +the index returned from add_mapping().
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    renamed_files
    │ │ │ │ -
    this is a map of file indices in the torrent and new filenames to be │ │ │ │ -applied before the torrent is added.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    external_port
    │ │ │ │ +
    the external port allocated for the mapping.
    │ │ │ │
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    local_address
    │ │ │ │ +
    the local network the port mapper is running on
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    client_data_t

    │ │ │ │ -

    Declared in "libtorrent/client_data.hpp"

    │ │ │ │ -

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    portmap_log_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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 alert is only │ │ │ │ +posted if the alert_category::port_mapping_log flag is enabled in │ │ │ │ +the alert mask.

    │ │ │ │
    │ │ │ │ -struct client_data_t
    │ │ │ │ +struct portmap_log_alert final : alert
    │ │ │ │  {
    │ │ │ │ -   client_data_t () = default;
    │ │ │ │ -   explicit client_data_t (T* v);
    │ │ │ │ -   client_data_t& operator= (T* v);
    │ │ │ │ -   T* get () const;
    │ │ │ │ -   explicit operator T () const;
    │ │ │ │ -   client_data_t& operator= (void const*) = delete;
    │ │ │ │ -   client_data_t& operator= (void*) = delete;
    │ │ │ │ -   operator void* () const = delete;
    │ │ │ │ -   operator void const* () const = delete;
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* log_message () const;
    │ │ │ │  
    │ │ │ │ -   template <typename T, typename U  = typename std::enable_if<std::is_pointer<T>::value>::type>
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::port_mapping_log;
    │ │ │ │ +   portmap_transport const map_transport;
    │ │ │ │ +   aux::noexcept_movable<address> local_address;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    client_data_t()

    │ │ │ │ -
    │ │ │ │ -client_data_t () = default;
    │ │ │ │ -
    │ │ │ │ -

    construct a nullptr client data

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    const*() void*() operator=()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    log_message()

    │ │ │ │
    │ │ │ │ -client_data_t& operator= (void const*) = delete;
    │ │ │ │ -client_data_t& operator= (void*) = delete;
    │ │ │ │ -operator void* () const = delete;
    │ │ │ │ -operator void const* () const = delete;
    │ │ │ │ +char const* log_message () const;
    │ │ │ │  
    │ │ │ │ -

    we don't allow type-unsafe operations

    │ │ │ │ -

    You have some control over session configuration through the session::apply_settings() │ │ │ │ -member function. To change one or more configuration options, create a settings_pack │ │ │ │ -object and fill it with the settings to be set and pass it in to session::apply_settings().

    │ │ │ │ -

    The settings_pack object is a collection of settings updates that are applied │ │ │ │ -to the session 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 │ │ │ │ -settings_pack class. These are the available settings:

    │ │ │ │ -[report issue]
    │ │ │ │ +

    the message associated with this log line

    │ │ │ │ +[report issue]
    │ │ │ │ +
    local_address
    │ │ │ │ +
    the local network the port mapper is running on
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    open_file_state

    │ │ │ │ -

    Declared in "libtorrent/disk_interface.hpp"

    │ │ │ │ -

    this contains information about a file that's currently open by the │ │ │ │ -libtorrent disk I/O subsystem. It's associated with a single torrent.

    │ │ │ │ +
    │ │ │ │ +

    fastresume_rejected_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a fast resume file has been passed to │ │ │ │ +add_torrent() but the files on disk did not match the fast resume file. │ │ │ │ +The error_code explains the reason why the resume file was rejected.

    │ │ │ │
    │ │ │ │ -struct open_file_state
    │ │ │ │ +struct fastresume_rejected_alert final : torrent_alert
    │ │ │ │  {
    │ │ │ │ -   file_index_t file_index;
    │ │ │ │ -   file_open_mode_t open_mode;
    │ │ │ │ -   time_point last_use;
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* file_path () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status
    │ │ │ │ +   | alert_category::error;
    │ │ │ │ +   error_code error;
    │ │ │ │ +   operation_t op;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    file_index
    │ │ │ │ -
    the index of the file this entry refers to into the file_storage │ │ │ │ -file list of this torrent. This starts indexing at 0.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    open_mode
    │ │ │ │ -

    open_mode is a bitmask of the file flags this file is currently │ │ │ │ -opened with. For possible flags, see file_open_mode_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.

    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    last_use
    │ │ │ │ -
    a (high precision) timestamp of when the file was last used.
    │ │ │ │ +[report issue]
    │ │ │ │ +

    file_path()

    │ │ │ │ +
    │ │ │ │ +char const* file_path () const;
    │ │ │ │ +
    │ │ │ │ +

    If the error happened to a specific file, this returns the path to it.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    op
    │ │ │ │ +
    the underlying operation that failed
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    disk_interface

    │ │ │ │ -

    Declared in "libtorrent/disk_interface.hpp"

    │ │ │ │ -

    The disk_interface is the customization point for disk I/O in libtorrent. │ │ │ │ -implement this interface and provide a factory function to the session constructor │ │ │ │ -use custom disk I/O. All functions on the disk subsystem (implementing │ │ │ │ -disk_interface) 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 │ │ │ │ -have 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    peer_blocked_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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:

    │ │ │ │ +
      │ │ │ │ +
    • the IP filter
    • │ │ │ │ +
    • i2p mixed mode restrictions (a normal peer is not allowed on an i2p swarm)
    • │ │ │ │ +
    • the port filter
    • │ │ │ │ +
    • the peer has a low port and no_connect_privileged_ports is enabled
    • │ │ │ │ +
    • the protocol of the peer is blocked (uTP/TCP blocking)
    • │ │ │ │ +
    │ │ │ │
    │ │ │ │ -struct disk_interface
    │ │ │ │ +struct peer_blocked_alert final : peer_alert
    │ │ │ │  {
    │ │ │ │ -   virtual storage_holder new_torrent (storage_params const& p
    │ │ │ │ -      , std::shared_ptr<void> const& torrent) = 0;
    │ │ │ │ -   virtual void remove_torrent (storage_index_t) = 0;
    │ │ │ │ -   virtual bool async_write (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 async_read (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 async_hash (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 async_hash2 (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 async_move_storage (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 async_release_files (storage_index_t storage
    │ │ │ │ -      , std::function<void()> handler = std::function<void()>()) = 0;
    │ │ │ │ -   virtual void async_check_files (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 async_stop_torrent (storage_index_t storage
    │ │ │ │ -      , std::function<void()> handler = std::function<void()>()) = 0;
    │ │ │ │ -   virtual void async_rename_file (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 async_delete_files (storage_index_t storage, remove_flags_t options
    │ │ │ │ -      , std::function<void(storage_error const&)> handler) = 0;
    │ │ │ │ -   virtual void async_set_file_priority (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 async_clear_piece (storage_index_t storage, piece_index_t index
    │ │ │ │ -      , std::function<void(piece_index_t)> handler) = 0;
    │ │ │ │ -   virtual void update_stats_counters (counters& c) const = 0;
    │ │ │ │ -   virtual std::vector<open_file_state> get_status (storage_index_t) const = 0;
    │ │ │ │ -   virtual void abort (bool wait) = 0;
    │ │ │ │ -   virtual void submit_jobs () = 0;
    │ │ │ │ -   virtual void settings_updated () = 0;
    │ │ │ │ +   std::string message () const override;
    │ │ │ │  
    │ │ │ │ -   static constexpr disk_job_flags_t force_copy  = 0_bit;
    │ │ │ │ -   static constexpr disk_job_flags_t sequential_access  = 3_bit;
    │ │ │ │ -   static constexpr disk_job_flags_t volatile_read  = 4_bit;
    │ │ │ │ -   static constexpr disk_job_flags_t v1_hash  = 5_bit;
    │ │ │ │ -   static constexpr disk_job_flags_t flush_piece  = 7_bit;
    │ │ │ │ +   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 static_category  = alert_category::ip_block;
    │ │ │ │ +   int const reason;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    new_torrent()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    enum reason_t

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    ip_filter0 
    port_filter1 
    i2p_mixed2 
    privileged_ports3 
    utp_disabled4 
    tcp_disabled5 
    invalid_local_interface6 
    ssrf_mitigation7 
    │ │ │ │ +[report issue]
    │ │ │ │ +
    reason
    │ │ │ │ +
    the reason for the peer being blocked. Is one of the values from the │ │ │ │ +reason_t enum.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    dht_announce_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a DHT node announces to an info-hash on our │ │ │ │ +DHT node. It belongs to the alert_category::dht category.

    │ │ │ │
    │ │ │ │ -virtual storage_holder new_torrent (storage_params const& p
    │ │ │ │ -      , std::shared_ptr<void> const& torrent) = 0;
    │ │ │ │ +struct dht_announce_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ +   aux::noexcept_movable<address> ip;
    │ │ │ │ +   int port;
    │ │ │ │ +   sha1_hash info_hash;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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 storage_holder is an owning reference to the underlying │ │ │ │ -storage that was just created. It is fundamentally a storage_index_t

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    remove_torrent()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_get_peers_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when a DHT node sends a get_peers message to │ │ │ │ +our DHT node. It belongs to the alert_category::dht category.

    │ │ │ │
    │ │ │ │ -virtual void remove_torrent (storage_index_t) = 0;
    │ │ │ │ +struct dht_get_peers_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ +   sha1_hash info_hash;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    async_read() async_write()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    cache_flushed_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is posted when the disk cache has been flushed for a specific │ │ │ │ +torrent as a result of a call to torrent_handle::flush_cache(). This │ │ │ │ +alert belongs to the alert_category::storage category, which must be │ │ │ │ +enabled to let this alert through. The alert is also posted when removing │ │ │ │ +a torrent from the session, once the outstanding cache flush is complete │ │ │ │ +and the torrent does no longer have any files open.

    │ │ │ │
    │ │ │ │ -virtual bool async_write (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 async_read (storage_index_t storage, peer_request const& r
    │ │ │ │ -      , std::function<void(disk_buffer_holder, storage_error const&)> handler
    │ │ │ │ -      , disk_job_flags_t flags = {}) = 0;
    │ │ │ │ +struct cache_flushed_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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 disk_buffer_holder, holding the buffer with │ │ │ │ -the result. Flags may be set to affect the read operation. See │ │ │ │ -disk_job_flags_t.

    │ │ │ │ -

    The disk_observer 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 peer_request (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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    async_hash()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    lsd_peer_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when we receive a local service discovery message │ │ │ │ +from a peer for a torrent we're currently participating in.

    │ │ │ │
    │ │ │ │ -virtual void async_hash (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;
    │ │ │ │ +struct lsd_peer_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -

    The v2 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    async_hash2()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    trackerid_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is posted whenever a tracker responds with a trackerid. │ │ │ │ +The tracker ID is like a cookie. libtorrent will store the tracker ID │ │ │ │ +for this tracker and repeat it in subsequent announces.

    │ │ │ │
    │ │ │ │ -virtual void async_hash2 (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;
    │ │ │ │ +struct trackerid_alert final : tracker_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* tracker_id () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    computes the v2 hash (SHA-256) of a single block. The block at │ │ │ │ -offset in piece piece.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    async_move_storage()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    tracker_id()

    │ │ │ │
    │ │ │ │ -virtual void async_move_storage (storage_index_t storage, std::string p, move_flags_t flags
    │ │ │ │ -      , std::function<void(status_t, std::string const&, storage_error const&)> handler) = 0;
    │ │ │ │ +char const* tracker_id () const;
    │ │ │ │  
    │ │ │ │ -

    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 move_flags_t).

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    async_release_files()

    │ │ │ │ +

    The tracker ID returned by the tracker

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    dht_bootstrap_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is posted when the initial DHT bootstrap is done.

    │ │ │ │
    │ │ │ │ -virtual void async_release_files (storage_index_t storage
    │ │ │ │ -      , std::function<void()> handler = std::function<void()>()) = 0;
    │ │ │ │ +struct dht_bootstrap_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    async_check_files()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    torrent_error_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This is posted whenever a torrent is transitioned into the error state. │ │ │ │ +If the error code is duplicate_torrent (error_code_enum) error, it suggests two magnet │ │ │ │ +links ended up resolving to the same hybrid torrent. For more details, │ │ │ │ +see BitTorrent v2 torrents.

    │ │ │ │
    │ │ │ │ -virtual void async_check_files (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;
    │ │ │ │ +struct torrent_error_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* filename () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::error | alert_category::status;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    async_stop_torrent()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    filename()

    │ │ │ │
    │ │ │ │ -virtual void async_stop_torrent (storage_index_t storage
    │ │ │ │ -      , std::function<void()> handler = std::function<void()>()) = 0;
    │ │ │ │ +char const* filename () const;
    │ │ │ │  
    │ │ │ │ -

    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 │ │ │ │ -async_release_files().

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    async_rename_file()

    │ │ │ │ +

    the filename (or object) the error occurred on.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    specifies which error the torrent encountered.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    torrent_need_cert_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This is always posted for SSL torrents. This is a reminder to the client that │ │ │ │ +the torrent won't work unless torrent_handle::set_ssl_certificate() is called with │ │ │ │ +a valid certificate. Valid certificates MUST be signed by the SSL certificate │ │ │ │ +in the .torrent file.

    │ │ │ │
    │ │ │ │ -virtual void async_rename_file (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;
    │ │ │ │ +struct torrent_need_cert_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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.).

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    async_delete_files()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    incoming_connection_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    The incoming connection alert 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.

    │ │ │ │
    │ │ │ │ -virtual void async_delete_files (storage_index_t storage, remove_flags_t options
    │ │ │ │ -      , std::function<void(storage_error const&)> handler) = 0;
    │ │ │ │ +struct incoming_connection_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ +   socket_type_t socket_type;
    │ │ │ │ +   aux::noexcept_movable<tcp::endpoint> endpoint;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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 session_handle for remove_flags_t flags │ │ │ │ -indicating which files are to be removed. │ │ │ │ -e.g. session_handle::delete_files - delete all files │ │ │ │ -session_handle::delete_partfile - only delete part file.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    async_set_file_priority()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    socket_type
    │ │ │ │ +
    tells you what kind of socket the connection was accepted
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    endpoint
    │ │ │ │ +
    is the IP address and port the connection came from.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_torrent_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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 handle member in the base class. If adding │ │ │ │ +the torrent failed, error contains the error code.

    │ │ │ │
    │ │ │ │ -virtual void async_set_file_priority (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;
    │ │ │ │ +struct add_torrent_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +   add_torrent_params params;
    │ │ │ │ +   error_code error;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    async_clear_piece()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    params
    │ │ │ │ +

    This contains copies of the most important fields from the original │ │ │ │ +add_torrent_params object, passed to add_torrent() or │ │ │ │ +async_add_torrent(). Specifically, these fields are copied:

    │ │ │ │ +
      │ │ │ │ +
    • version
    • │ │ │ │ +
    • ti
    • │ │ │ │ +
    • name
    • │ │ │ │ +
    • save_path
    • │ │ │ │ +
    • userdata
    • │ │ │ │ +
    • tracker_id
    • │ │ │ │ +
    • flags
    • │ │ │ │ +
    • info_hash
    • │ │ │ │ +
    │ │ │ │ +

    the info_hash field will be updated with the info-hash of the torrent │ │ │ │ +specified by ti.

    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    set to the error, if one occurred while adding the torrent.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    state_update_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is only posted when requested by the user, by calling │ │ │ │ +session::post_torrent_updates() on the session. It contains the torrent │ │ │ │ +status of all torrents that changed since last time this message was │ │ │ │ +posted. Its category is alert_category::status, but it's not subject to │ │ │ │ +filtering, since it's only manually posted anyway.

    │ │ │ │
    │ │ │ │ -virtual void async_clear_piece (storage_index_t storage, piece_index_t index
    │ │ │ │ -      , std::function<void(piece_index_t)> handler) = 0;
    │ │ │ │ +struct state_update_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +   std::vector<torrent_status> status;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    update_stats_counters()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    status
    │ │ │ │ +
    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 handle member. The receiving end is │ │ │ │ +suggested to have all torrents sorted by the torrent_handle or hashed │ │ │ │ +by it, for efficient updates.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    session_stats_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    The session_stats_alert is posted when the user requests session statistics by │ │ │ │ +calling post_session_stats() on the session object. This alert 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.

    │ │ │ │ +

    the message() member function returns a string representation of the values that │ │ │ │ +properly match the line returned in session_stats_header_alert::message().

    │ │ │ │ +

    this specific output is parsed by tools/parse_session_stats.py │ │ │ │ +if this is changed, that parser should also be changed

    │ │ │ │
    │ │ │ │ -virtual void update_stats_counters (counters& c) const = 0;
    │ │ │ │ +struct session_stats_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   span<std::int64_t const> counters () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = {};
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    update_stats_counters() is called to give the disk storage an │ │ │ │ -opportunity to update gauges in the c stats counters, that aren't │ │ │ │ -updated continuously as operations are performed. This is called │ │ │ │ -before a snapshot of the counters are passed to the client.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    get_status()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    counters()

    │ │ │ │
    │ │ │ │ -virtual std::vector<open_file_state> get_status (storage_index_t) const = 0;
    │ │ │ │ +span<std::int64_t const> counters () const;
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    abort()

    │ │ │ │ +

    An array are a mix of counters and gauges, which meanings can be │ │ │ │ +queries via the session_stats_metrics() function on the session. 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 │ │ │ │ +session_stats_metrics(), once on startup, and then use that mapping to │ │ │ │ +interpret these values throughout the process' runtime.

    │ │ │ │ +

    For more information, see the session statistics section.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    dht_error_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    posted when something fails in the DHT. This is not necessarily a fatal │ │ │ │ +error, but it could prevent proper operation

    │ │ │ │
    │ │ │ │ -virtual void abort (bool wait) = 0;
    │ │ │ │ +struct dht_error_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::error | alert_category::dht;
    │ │ │ │ +   error_code error;
    │ │ │ │ +   operation_t op;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    this is called when the session 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    submit_jobs()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    the error code
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    op
    │ │ │ │ +
    the operation that failed
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_immutable_item_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    this alert is posted as a response to a call to session::get_item(), │ │ │ │ +specifically the overload for looking up immutable items in the DHT.

    │ │ │ │
    │ │ │ │ -virtual void submit_jobs () = 0;
    │ │ │ │ +struct dht_immutable_item_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ +   sha1_hash target;
    │ │ │ │ +   entry item;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    settings_updated()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    target
    │ │ │ │ +
    the target hash of the immutable item. This must │ │ │ │ +match the SHA-1 hash of the bencoded form of item.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    item
    │ │ │ │ +
    the data for this item
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_mutable_item_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    this alert is posted as a response to a call to session::get_item(), │ │ │ │ +specifically the overload for looking up mutable items in the DHT.

    │ │ │ │
    │ │ │ │ -virtual void settings_updated () = 0;
    │ │ │ │ +struct dht_mutable_item_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ +   std::array<char, 32> key;
    │ │ │ │ +   std::array<char, 64> signature;
    │ │ │ │ +   std::int64_t seq;
    │ │ │ │ +   std::string salt;
    │ │ │ │ +   entry item;
    │ │ │ │ +   bool authoritative;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    This is called to notify the disk I/O object that the settings have │ │ │ │ -been updated. In the disk io constructor, a settings_interface │ │ │ │ -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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    key
    │ │ │ │ +
    the public key that was looked up
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    sequential_access
    │ │ │ │ -
    hint that there may be more disk operations with sequential access to │ │ │ │ -the file
    │ │ │ │ +[report issue]
    │ │ │ │ +
    signature
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    seq
    │ │ │ │ +
    the sequence number of this item
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    v1_hash
    │ │ │ │ -
    compute a v1 piece hash. This is only used by the async_hash() call. │ │ │ │ -If this flag is not set in the async_hash() call, the SHA-1 piece │ │ │ │ -hash does not need to be computed.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    salt
    │ │ │ │ +
    the salt, if any, used to lookup and store this item. If no │ │ │ │ +salt was used, this is an empty string
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    flush_piece
    │ │ │ │ -
    this flag instructs a hash job that we just completed this piece, and │ │ │ │ -it should be flushed to disk
    │ │ │ │ +[report issue]
    │ │ │ │ +
    item
    │ │ │ │ +
    the data for this item
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    storage_holder

    │ │ │ │ -

    Declared in "libtorrent/disk_interface.hpp"

    │ │ │ │ -

    a unique, owning, reference to the storage of a torrent in a disk io │ │ │ │ -subsystem (class that implements disk_interface). 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 session, this holder is destructed and will │ │ │ │ -inform the disk object.

    │ │ │ │ -
    │ │ │ │ -struct storage_holder
    │ │ │ │ -{
    │ │ │ │ -   storage_holder (storage_index_t idx, disk_interface& disk_io);
    │ │ │ │ -   ~storage_holder ();
    │ │ │ │ -   storage_holder () = default;
    │ │ │ │ -   explicit operator bool () const;
    │ │ │ │ -   operator storage_index_t () const;
    │ │ │ │ -   void reset ();
    │ │ │ │ -   storage_holder& operator= (storage_holder const&) = delete;
    │ │ │ │ -   storage_holder (storage_holder const&) = delete;
    │ │ │ │ -   storage_holder (storage_holder&& rhs) noexcept;
    │ │ │ │ -   storage_holder& operator= (storage_holder&& rhs) noexcept;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    settings_interface

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ -

    the common interface to settings_pack and the internal representation of │ │ │ │ -settings.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    authoritative
    │ │ │ │ +
    the last response for mutable data is authoritative.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_put_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    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.

    │ │ │ │
    │ │ │ │ -struct settings_interface
    │ │ │ │ +struct dht_put_alert final : alert
    │ │ │ │  {
    │ │ │ │ -   virtual void set_int (int name, int val) = 0;
    │ │ │ │ -   virtual void set_bool (int name, bool val) = 0;
    │ │ │ │ -   virtual void set_str (int name, std::string val) = 0;
    │ │ │ │ -   virtual bool has_val (int name) const = 0;
    │ │ │ │ -   virtual std::string const& get_str (int name) const = 0;
    │ │ │ │ -   virtual bool get_bool (int name) const = 0;
    │ │ │ │ -   virtual int get_int (int name) const = 0;
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ +   sha1_hash target;
    │ │ │ │ +   std::array<char, 32> public_key;
    │ │ │ │ +   std::array<char, 64> signature;
    │ │ │ │ +   std::string salt;
    │ │ │ │ +   std::int64_t seq;
    │ │ │ │ +   int num_success;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    disk_observer

    │ │ │ │ -

    Declared in "libtorrent/disk_observer.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    target
    │ │ │ │ +
    the target hash the item was stored under if this was an immutable │ │ │ │ +item.
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    public_key signature salt seq
    │ │ │ │ +
    if a mutable item was stored, these are the public key, signature, │ │ │ │ +salt and sequence number the item was stored under.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    num_success
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    i2p_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    this alert is used to report errors in the i2p SAM connection

    │ │ │ │
    │ │ │ │ -struct disk_observer
    │ │ │ │ +struct i2p_alert final : alert
    │ │ │ │  {
    │ │ │ │ -   virtual void on_disk () = 0;
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ +   error_code error;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    on_disk()

    │ │ │ │ -
    │ │ │ │ -virtual void on_disk () = 0;
    │ │ │ │ -
    │ │ │ │ -

    called when the disk cache size has dropped │ │ │ │ -below the low watermark again and we can │ │ │ │ -resume downloading from peers

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    buffer_allocator_interface

    │ │ │ │ -

    Declared in "libtorrent/disk_buffer_holder.hpp"

    │ │ │ │ -

    the interface for freeing disk buffers, used by the disk_buffer_holder. │ │ │ │ -when implementing disk_interface, this must also be implemented in order │ │ │ │ -to return disk buffers back to libtorrent

    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    the error that occurred in the i2p SAM connection
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_outgoing_get_peers_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is generated when we send a get_peers request │ │ │ │ +It belongs to the alert_category::dht category.

    │ │ │ │
    │ │ │ │ -struct buffer_allocator_interface
    │ │ │ │ +struct dht_outgoing_get_peers_alert final : alert
    │ │ │ │  {
    │ │ │ │ -   virtual void free_disk_buffer (char* b) = 0;
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ +   sha1_hash info_hash;
    │ │ │ │ +   sha1_hash obfuscated_info_hash;
    │ │ │ │ +   aux::noexcept_movable<udp::endpoint> endpoint;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    disk_buffer_holder

    │ │ │ │ -

    Declared in "libtorrent/disk_buffer_holder.hpp"

    │ │ │ │ -

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    info_hash
    │ │ │ │ +
    the info_hash of the torrent we're looking for peers for.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    obfuscated_info_hash
    │ │ │ │ +
    if this was an obfuscated lookup, this is the info-hash target │ │ │ │ +actually sent to the node.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    endpoint
    │ │ │ │ +
    the endpoint we're sending this query to
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    log_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is posted by some session wide event. Its main purpose is │ │ │ │ +trouble shooting and debugging. It's not enabled by the default alert │ │ │ │ +mask and is enabled by the alert_category::session_log bit. │ │ │ │ +Furthermore, it's by default disabled as a build configuration.

    │ │ │ │
    │ │ │ │ -struct disk_buffer_holder
    │ │ │ │ +struct log_alert final : alert
    │ │ │ │  {
    │ │ │ │ -   disk_buffer_holder (disk_buffer_holder&&) noexcept;
    │ │ │ │ -   disk_buffer_holder& operator= (disk_buffer_holder&&) & noexcept;
    │ │ │ │ -   disk_buffer_holder& operator= (disk_buffer_holder const&) = delete;
    │ │ │ │ -   disk_buffer_holder (disk_buffer_holder const&) = delete;
    │ │ │ │ -   disk_buffer_holder (buffer_allocator_interface& alloc
    │ │ │ │ -      , char* buf, int sz) noexcept;
    │ │ │ │ -   disk_buffer_holder () noexcept = default;
    │ │ │ │ -   ~disk_buffer_holder ();
    │ │ │ │ -   char* data () const noexcept;
    │ │ │ │ -   void reset ();
    │ │ │ │ -   void swap (disk_buffer_holder& h) noexcept;
    │ │ │ │ -   bool is_mutable () const noexcept;
    │ │ │ │ -   explicit operator bool () const noexcept;
    │ │ │ │ -   std::ptrdiff_t size () const;
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* log_message () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::session_log;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    disk_buffer_holder()

    │ │ │ │ -
    │ │ │ │ -disk_buffer_holder (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 session)

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    disk_buffer_holder()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    log_message()

    │ │ │ │
    │ │ │ │ -disk_buffer_holder () noexcept = default;
    │ │ │ │ +char const* log_message () const;
    │ │ │ │  
    │ │ │ │ -

    default construct a holder that does not own any buffer

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    ~disk_buffer_holder()

    │ │ │ │ +

    returns the log message

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    torrent_log_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is posted by torrent wide events. It's meant to be used for │ │ │ │ +trouble shooting and debugging. It's not enabled by the default alert │ │ │ │ +mask and is enabled by the alert_category::torrent_log bit. By │ │ │ │ +default it is disabled as a build configuration.

    │ │ │ │
    │ │ │ │ -~disk_buffer_holder ();
    │ │ │ │ +struct torrent_log_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* log_message () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::torrent_log;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    frees disk buffer held by this object

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    data()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    log_message()

    │ │ │ │
    │ │ │ │ -char* data () const noexcept;
    │ │ │ │ +char const* log_message () const;
    │ │ │ │  
    │ │ │ │ -

    return a pointer to the held buffer, if any. Otherwise returns nullptr.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    reset()

    │ │ │ │ +

    returns the log message

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    peer_log_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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 alert │ │ │ │ +mask and is enabled by the alert_category::peer_log bit. By │ │ │ │ +default it is disabled as a build configuration.

    │ │ │ │
    │ │ │ │ -void reset ();
    │ │ │ │ +struct peer_log_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* log_message () const;
    │ │ │ │ +
    │ │ │ │ +   enum direction_t
    │ │ │ │ +   {
    │ │ │ │ +      incoming_message,
    │ │ │ │ +      outgoing_message,
    │ │ │ │ +      incoming,
    │ │ │ │ +      outgoing,
    │ │ │ │ +      info,
    │ │ │ │ +   };
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::peer_log;
    │ │ │ │ +   char const* event_type;
    │ │ │ │ +   direction_t direction;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    free the held disk buffer, if any, and clear the holder. This sets the │ │ │ │ -holder object to a default-constructed state

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    swap()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    log_message()

    │ │ │ │
    │ │ │ │ -void swap (disk_buffer_holder& h) noexcept;
    │ │ │ │ +char const* log_message () const;
    │ │ │ │  
    │ │ │ │ -

    swap pointers of two disk buffer holders.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    is_mutable()

    │ │ │ │ +

    returns the log message

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum direction_t

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    incoming_message0 
    outgoing_message1 
    incoming2 
    outgoing3 
    info4 
    │ │ │ │ +[report issue]
    │ │ │ │ +
    event_type
    │ │ │ │ +
    string literal indicating the kind of event. For messages, this is the │ │ │ │ +message name.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    lsd_error_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    posted if the local service discovery socket fails to start properly. │ │ │ │ +it's categorized as alert_category::error.

    │ │ │ │
    │ │ │ │ -bool is_mutable () const noexcept;
    │ │ │ │ +struct lsd_error_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ +   aux::noexcept_movable<address> local_address;
    │ │ │ │ +   error_code error;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    if this returns true, the buffer may not be modified in place

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    bool()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    local_address
    │ │ │ │ +
    the local network the corresponding local service discovery is running │ │ │ │ +on
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    The error code
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_lookup

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    holds statistics about a current dht_lookup 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

    │ │ │ │
    │ │ │ │ -explicit operator bool () const noexcept;
    │ │ │ │ +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;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    implicitly convertible to true if the object is currently holding a │ │ │ │ -buffer

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    file_open_mode_t

    │ │ │ │ -

    Declared in "libtorrent/disk_interface.hpp"

    │ │ │ │ -
    │ │ │ │ -
    read_only
    │ │ │ │ -
    open the file for reading only
    │ │ │ │ +[report issue]
    │ │ │ │ +
    type
    │ │ │ │ +
    string literal indicating which kind of lookup this is
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    write_only
    │ │ │ │ -
    open the file for writing only
    │ │ │ │ +[report issue]
    │ │ │ │ +
    outstanding_requests
    │ │ │ │ +
    the number of outstanding request to individual nodes │ │ │ │ +this lookup has right now
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    read_write
    │ │ │ │ -
    open the file for reading and writing
    │ │ │ │ +[report issue]
    │ │ │ │ +
    timeouts
    │ │ │ │ +
    the total number of requests that have timed out so far │ │ │ │ +for this lookup
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    rw_mask
    │ │ │ │ -
    the mask for the bits determining read or write mode
    │ │ │ │ +[report issue]
    │ │ │ │ +
    responses
    │ │ │ │ +
    the total number of responses we have received for this │ │ │ │ +lookup so far for this lookup
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    sparse
    │ │ │ │ -
    open the file in sparse mode (if supported by the │ │ │ │ -filesystem).
    │ │ │ │ +[report issue]
    │ │ │ │ +
    branch_factor
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    no_atime
    │ │ │ │ -
    don't update the access timestamps on the file (if │ │ │ │ -supported by the operating system and filesystem). │ │ │ │ -this generally improves disk performance.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    nodes_left
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    random_access
    │ │ │ │ -
    When this is not set, the kernel is hinted that access to this file will │ │ │ │ -be made sequentially.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    last_sent
    │ │ │ │ +
    the number of seconds ago the │ │ │ │ +last message was sent that's still │ │ │ │ +outstanding
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    mmapped
    │ │ │ │ -
    the file is memory mapped
    │ │ │ │ +[report issue]
    │ │ │ │ +
    first_timeout
    │ │ │ │ +
    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
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    web_seed_entry

    │ │ │ │ -

    Declared in "libtorrent/torrent_info.hpp"

    │ │ │ │ -

    the web_seed_entry 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 BEP 17 and BEP 19.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    target
    │ │ │ │ +
    the node-id or info-hash target for this lookup
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_stats_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    contains current DHT state. Posted in response to session::post_dht_stats().

    │ │ │ │
    │ │ │ │ -struct web_seed_entry
    │ │ │ │ +struct dht_stats_alert final : alert
    │ │ │ │  {
    │ │ │ │ -   bool operator== (web_seed_entry const& e) const;
    │ │ │ │ -   bool operator< (web_seed_entry const& e) const;
    │ │ │ │ +   std::string message () const override;
    │ │ │ │  
    │ │ │ │ -   enum type_t
    │ │ │ │ -   {
    │ │ │ │ -      url_seed,
    │ │ │ │ -      http_seed,
    │ │ │ │ -   };
    │ │ │ │ +   static constexpr alert_category_t static_category  = {};
    │ │ │ │ +   std::vector<dht_lookup> active_requests;
    │ │ │ │ +   std::vector<dht_routing_bucket> routing_table;
    │ │ │ │ +   sha1_hash nid;
    │ │ │ │ +   aux::noexcept_movable<udp::endpoint> local_endpoint;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    active_requests
    │ │ │ │ +
    a vector of the currently running DHT lookups.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    routing_table
    │ │ │ │ +
    contains information about every bucket in the DHT routing │ │ │ │ +table.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    nid
    │ │ │ │ +
    the node ID of the DHT node instance
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    local_endpoint
    │ │ │ │ +
    the local socket this DHT node is running on
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    incoming_request_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    posted every time an incoming request from a peer is accepted and queued │ │ │ │ +up for being serviced. This alert is only posted if │ │ │ │ +the alert_category::incoming_request flag is enabled in the alert │ │ │ │ +mask.

    │ │ │ │ +
    │ │ │ │ +struct incoming_request_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │  
    │ │ │ │ -   std::string url;
    │ │ │ │ -   std::string auth;
    │ │ │ │ -   headers_t extra_headers;
    │ │ │ │ -   std::uint8_t type;
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::incoming_request;
    │ │ │ │ +   peer_request req;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    operator==()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    req
    │ │ │ │ +
    the request this peer sent to us
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_log_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    debug logging of the DHT when alert_category::dht_log is set in the alert │ │ │ │ +mask.

    │ │ │ │
    │ │ │ │ -bool operator== (web_seed_entry const& e) const;
    │ │ │ │ +struct dht_log_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   char const* log_message () const;
    │ │ │ │ +
    │ │ │ │ +   enum dht_module_t
    │ │ │ │ +   {
    │ │ │ │ +      tracker,
    │ │ │ │ +      node,
    │ │ │ │ +      routing_table,
    │ │ │ │ +      rpc_manager,
    │ │ │ │ +      traversal,
    │ │ │ │ +   };
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::dht_log;
    │ │ │ │ +   dht_module_t module;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    URL and type comparison

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    operator<()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    log_message()

    │ │ │ │
    │ │ │ │ -bool operator< (web_seed_entry const& e) const;
    │ │ │ │ +char const* log_message () const;
    │ │ │ │  
    │ │ │ │ -

    URL and type less-than comparison

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum type_t

    │ │ │ │ -

    Declared in "libtorrent/torrent_info.hpp"

    │ │ │ │ +

    the log message

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum dht_module_t

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │
    namevaluedescription
    url_seed
    tracker0 
    http_seed
    node1 
    routing_table2 
    rpc_manager3 
    traversal4 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    url
    │ │ │ │ -
    The URL of the web seed
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    auth
    │ │ │ │ -
    Optional authentication. If this is set, it's passed │ │ │ │ -in as HTTP basic auth to the web seed. The format is: │ │ │ │ -username:password.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    extra_headers
    │ │ │ │ -
    Any extra HTTP headers that need to be passed to the web seed
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    type
    │ │ │ │ -
    The type of web seed (see type_t)
    │ │ │ │ +[report issue]
    │ │ │ │ +
    module
    │ │ │ │ +
    the module, or part, of the DHT that produced this log message.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    load_torrent_limits

    │ │ │ │ -

    Declared in "libtorrent/torrent_info.hpp"

    │ │ │ │ -

    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.

    │ │ │ │ +
    │ │ │ │ +

    dht_pkt_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert is posted every time a DHT message is sent or received. It is │ │ │ │ +only posted if the alert_category::dht_log alert category is │ │ │ │ +enabled. It contains a verbatim copy of the message.

    │ │ │ │
    │ │ │ │ -struct load_torrent_limits
    │ │ │ │ +struct dht_pkt_alert final : alert
    │ │ │ │  {
    │ │ │ │ -   int max_buffer_size  = 10000000;
    │ │ │ │ -   int max_pieces  = 0x200000;
    │ │ │ │ -   int max_decode_depth  = 100;
    │ │ │ │ -   int max_decode_tokens  = 3000000;
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   span<char const> pkt_buf () const;
    │ │ │ │ +
    │ │ │ │ +   enum direction_t
    │ │ │ │ +   {
    │ │ │ │ +      incoming,
    │ │ │ │ +      outgoing,
    │ │ │ │ +   };
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::dht_log;
    │ │ │ │ +   direction_t direction;
    │ │ │ │ +   aux::noexcept_movable<udp::endpoint> node;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    max_buffer_size
    │ │ │ │ -
    the max size of a .torrent file to load into RAM
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    max_pieces
    │ │ │ │ -
    the max number of pieces allowed in the torrent
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    max_decode_depth
    │ │ │ │ -
    the max recursion depth in the bdecoded structure
    │ │ │ │ +[report issue]
    │ │ │ │ +

    pkt_buf()

    │ │ │ │ +
    │ │ │ │ +span<char const> pkt_buf () const;
    │ │ │ │ +
    │ │ │ │ +

    returns a pointer to the packet buffer and size of the packet, │ │ │ │ +respectively. This buffer is only valid for as long as the alert itself │ │ │ │ +is valid, which is owned by libtorrent and reclaimed whenever │ │ │ │ +pop_alerts() is called on the session.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum direction_t

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    incoming0 
    outgoing1 
    │ │ │ │ +[report issue]
    │ │ │ │ +
    direction
    │ │ │ │ +
    whether this is an incoming or outgoing packet.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    max_decode_tokens
    │ │ │ │ -
    the max number of bdecode tokens
    │ │ │ │ +[report issue]
    │ │ │ │ +
    node
    │ │ │ │ +
    the DHT node we received this packet from, or sent this packet to │ │ │ │ +(depending on direction).
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    torrent_info

    │ │ │ │ -

    Declared in "libtorrent/torrent_info.hpp"

    │ │ │ │ -

    the torrent_info class holds the information found in a .torrent file.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    dht_get_peers_reply_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    Posted when we receive a response to a DHT get_peers request.

    │ │ │ │
    │ │ │ │ -class torrent_info
    │ │ │ │ +struct dht_get_peers_reply_alert final : alert
    │ │ │ │  {
    │ │ │ │ -   explicit torrent_info (span<char const> buffer, from_span_t);
    │ │ │ │ -   torrent_info (span<char const> buffer, load_torrent_limits const& cfg, from_span_t);
    │ │ │ │ -   torrent_info (bdecode_node const& torrent_file, error_code& ec);
    │ │ │ │ -   torrent_info (char const* buffer, int size);
    │ │ │ │ -   torrent_info (bdecode_node const& torrent_file, load_torrent_limits const& cfg);
    │ │ │ │ -   torrent_info (torrent_info const& t);
    │ │ │ │ -   explicit torrent_info (info_hash_t const& info_hash);
    │ │ │ │ -   torrent_info (std::string const& filename, error_code& ec);
    │ │ │ │ -   torrent_info (std::string const& filename, load_torrent_limits const& cfg);
    │ │ │ │ -   torrent_info (char const* buffer, int size, error_code& ec);
    │ │ │ │ -   explicit torrent_info (bdecode_node const& torrent_file);
    │ │ │ │ -   explicit torrent_info (std::string const& filename);
    │ │ │ │ -   torrent_info (span<char const> buffer, error_code& ec, from_span_t);
    │ │ │ │ -   ~torrent_info ();
    │ │ │ │ -   file_storage const& files () const;
    │ │ │ │ -   file_storage const& orig_files () const;
    │ │ │ │ -   void rename_file (file_index_t index, std::string const& new_filename);
    │ │ │ │ -   void remap_files (file_storage const& f);
    │ │ │ │ -   void add_tracker (std::string const& url, int tier
    │ │ │ │ -      , announce_entry::tracker_source source);
    │ │ │ │ -   std::vector<announce_entry> const& trackers () const;
    │ │ │ │ -   void add_tracker (std::string const& url, int tier = 0);
    │ │ │ │ -   void clear_trackers ();
    │ │ │ │ -   std::vector<sha1_hash> similar_torrents () const;
    │ │ │ │ -   std::vector<std::string> collections () const;
    │ │ │ │ -   void set_web_seeds (std::vector<web_seed_entry> seeds);
    │ │ │ │ -   void add_http_seed (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 add_url_seed (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& web_seeds () const;
    │ │ │ │ -   std::int64_t total_size () const;
    │ │ │ │ -   int num_pieces () const;
    │ │ │ │ -   int piece_length () const;
    │ │ │ │ -   int blocks_per_piece () const;
    │ │ │ │ -   piece_index_t last_piece () const;
    │ │ │ │ -   piece_index_t end_piece () const;
    │ │ │ │ -   index_range<piece_index_t> piece_range () const;
    │ │ │ │ -   sha1_hash info_hash () const noexcept;
    │ │ │ │ -   info_hash_t const& info_hashes () const;
    │ │ │ │ -   bool v1 () const;
    │ │ │ │ -   bool v2 () const;
    │ │ │ │ -   int num_files () const;
    │ │ │ │ -   std::vector<file_slice> map_block (piece_index_t const piece
    │ │ │ │ -      , std::int64_t offset, int size) const;
    │ │ │ │ -   peer_request map_file (file_index_t const file, std::int64_t offset, int size) const;
    │ │ │ │ -   string_view ssl_cert () const;
    │ │ │ │ -   bool is_valid () const;
    │ │ │ │ -   bool priv () const;
    │ │ │ │ -   bool is_i2p () const;
    │ │ │ │ -   int piece_size (piece_index_t index) const;
    │ │ │ │ -   sha1_hash hash_for_piece (piece_index_t index) const;
    │ │ │ │ -   char const* hash_for_piece_ptr (piece_index_t const index) const;
    │ │ │ │ -   bool is_loaded () const;
    │ │ │ │ -   const std::string& name () const;
    │ │ │ │ -   std::time_t creation_date () const;
    │ │ │ │ -   const std::string& creator () const;
    │ │ │ │ -   const std::string& comment () const;
    │ │ │ │ -   std::vector<std::pair<std::string, int>> const& nodes () const;
    │ │ │ │ -   void add_node (std::pair<std::string, int> const& node);
    │ │ │ │ -   bool parse_info_section (bdecode_node const& info, error_code& ec, int max_pieces);
    │ │ │ │ -   bdecode_node info (char const* key) const;
    │ │ │ │ -   span<char const> info_section () const;
    │ │ │ │ -   span<char const> piece_layer (file_index_t) const;
    │ │ │ │ -   void free_piece_layers ();
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   int num_peers () const;
    │ │ │ │ +   std::vector<tcp::endpoint> peers () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::dht_operation;
    │ │ │ │ +   sha1_hash info_hash;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    torrent_info()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_direct_response_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This is posted exactly once for every call to session_handle::dht_direct_request. │ │ │ │ +If the request failed, response() will return a default constructed bdecode_node.

    │ │ │ │
    │ │ │ │ -explicit torrent_info (span<char const> buffer, from_span_t);
    │ │ │ │ -torrent_info (span<char const> buffer, load_torrent_limits const& cfg, from_span_t);
    │ │ │ │ -torrent_info (bdecode_node const& torrent_file, error_code& ec);
    │ │ │ │ -torrent_info (char const* buffer, int size);
    │ │ │ │ -torrent_info (bdecode_node const& torrent_file, load_torrent_limits const& cfg);
    │ │ │ │ -torrent_info (torrent_info const& t);
    │ │ │ │ -explicit torrent_info (info_hash_t const& info_hash);
    │ │ │ │ -torrent_info (std::string const& filename, error_code& ec);
    │ │ │ │ -torrent_info (std::string const& filename, load_torrent_limits const& cfg);
    │ │ │ │ -torrent_info (char const* buffer, int size, error_code& ec);
    │ │ │ │ -explicit torrent_info (bdecode_node const& torrent_file);
    │ │ │ │ -explicit torrent_info (std::string const& filename);
    │ │ │ │ -torrent_info (span<char const> buffer, error_code& ec, from_span_t);
    │ │ │ │ +struct dht_direct_response_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   bdecode_node response () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ +   client_data_t userdata;
    │ │ │ │ +   aux::noexcept_movable<udp::endpoint> endpoint;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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 bdecode_node will create a torrent_info │ │ │ │ -object from the information found in the given torrent_file. The │ │ │ │ -bdecode_node represents a tree node in an bencoded file. To load an │ │ │ │ -ordinary .torrent file into a bdecode_node, use bdecode().

    │ │ │ │ -

    The version that takes a buffer pointer and a size will decode it as a │ │ │ │ -.torrent file and initialize the torrent_info 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 torrent_info 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    ~torrent_info()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    picker_log_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    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).

    │ │ │ │
    │ │ │ │ -~torrent_info ();
    │ │ │ │ +struct picker_log_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   std::vector<piece_block> blocks () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::picker_log;
    │ │ │ │ +   static constexpr picker_flags_t partial_ratio  = 0_bit;
    │ │ │ │ +   static constexpr picker_flags_t prioritize_partials  = 1_bit;
    │ │ │ │ +   static constexpr picker_flags_t rarest_first_partials  = 2_bit;
    │ │ │ │ +   static constexpr picker_flags_t rarest_first  = 3_bit;
    │ │ │ │ +   static constexpr picker_flags_t reverse_rarest_first  = 4_bit;
    │ │ │ │ +   static constexpr picker_flags_t suggested_pieces  = 5_bit;
    │ │ │ │ +   static constexpr picker_flags_t prio_sequential_pieces  = 6_bit;
    │ │ │ │ +   static constexpr picker_flags_t sequential_pieces  = 7_bit;
    │ │ │ │ +   static constexpr picker_flags_t reverse_pieces  = 8_bit;
    │ │ │ │ +   static constexpr picker_flags_t time_critical  = 9_bit;
    │ │ │ │ +   static constexpr picker_flags_t random_pieces  = 10_bit;
    │ │ │ │ +   static constexpr picker_flags_t prefer_contiguous  = 11_bit;
    │ │ │ │ +   static constexpr picker_flags_t reverse_sequential  = 12_bit;
    │ │ │ │ +   static constexpr picker_flags_t backup1  = 13_bit;
    │ │ │ │ +   static constexpr picker_flags_t backup2  = 14_bit;
    │ │ │ │ +   static constexpr picker_flags_t end_game  = 15_bit;
    │ │ │ │ +   static constexpr picker_flags_t extent_affinity  = 16_bit;
    │ │ │ │ +   picker_flags_t const picker_flags;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    frees all storage associated with this torrent_info object

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    orig_files() files()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    picker_flags
    │ │ │ │ +
    this is a bitmask of which features were enabled for this particular │ │ │ │ +pick. The bits are defined in the picker_flags_t enum.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    session_error_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    this alert is posted when the session encounters a serious error, │ │ │ │ +potentially fatal

    │ │ │ │
    │ │ │ │ -file_storage const& files () const;
    │ │ │ │ -file_storage const& orig_files () const;
    │ │ │ │ +struct session_error_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ +   error_code const error;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    The file_storage object contains the information on how to map the │ │ │ │ -pieces to files. It is separated from the torrent_info 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 file_storage 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 file_storage object, see the separate │ │ │ │ -document on how to create torrents.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    rename_file()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    The error code, if one is associated with this error
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_live_nodes_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    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.

    │ │ │ │
    │ │ │ │ -void rename_file (file_index_t index, std::string const& new_filename);
    │ │ │ │ +struct dht_live_nodes_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   std::vector<std::pair<sha1_hash, udp::endpoint>> nodes () const;
    │ │ │ │ +   int num_nodes () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ +   sha1_hash node_id;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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 files() and │ │ │ │ -orig_files() ), change the name, and then use remap_files().

    │ │ │ │ -

    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 move_storage() is │ │ │ │ -invoked.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    remap_files()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    nodes() num_nodes()

    │ │ │ │
    │ │ │ │ -void remap_files (file_storage const& f);
    │ │ │ │ +std::vector<std::pair<sha1_hash, udp::endpoint>> nodes () const;
    │ │ │ │ +int num_nodes () const;
    │ │ │ │  
    │ │ │ │ -
    │ │ │ │ -

    Warning

    │ │ │ │ -

    Using remap_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 disk_interface │ │ │ │ -to customize how to store files.

    │ │ │ │ +

    the number of nodes in the routing table and the actual nodes.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    node_id
    │ │ │ │ +
    the local DHT node's node-ID this routing table belongs to
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    clear_trackers() trackers() add_tracker()

    │ │ │ │ -
    │ │ │ │ -void add_tracker (std::string const& url, int tier
    │ │ │ │ -      , announce_entry::tracker_source source);
    │ │ │ │ -std::vector<announce_entry> const& trackers () const;
    │ │ │ │ -void add_tracker (std::string const& url, int tier = 0);
    │ │ │ │ -void clear_trackers ();
    │ │ │ │ -
    │ │ │ │ -

    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 │ │ │ │ -announce_entry. Each announce entry 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 announce_entry.

    │ │ │ │ -

    trackers() returns all entries from announce-list.

    │ │ │ │ -

    clear_trackers() removes all trackers from announce-list.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    similar_torrents() collections()

    │ │ │ │ -
    │ │ │ │ -std::vector<sha1_hash> similar_torrents () const;
    │ │ │ │ -std::vector<std::string> collections () const;
    │ │ │ │ -
    │ │ │ │ -

    These two functions are related to BEP 38 (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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    web_seeds() add_url_seed() set_web_seeds() add_http_seed()

    │ │ │ │ -
    │ │ │ │ -void set_web_seeds (std::vector<web_seed_entry> seeds);
    │ │ │ │ -void add_http_seed (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 add_url_seed (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& web_seeds () const;
    │ │ │ │ -
    │ │ │ │ -

    web_seeds() returns all url seeds and http seeds in the torrent. │ │ │ │ -Each entry 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 http seeding for more information.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    total_size()

    │ │ │ │ -
    │ │ │ │ -std::int64_t total_size () 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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    num_pieces() piece_length()

    │ │ │ │ +
    │ │ │ │ +

    session_stats_header_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    The session_stats_header alert is posted the first time │ │ │ │ +post_session_stats() is called

    │ │ │ │ +

    the message() member function returns a string representation of the │ │ │ │ +header that properly match the stats values string returned in │ │ │ │ +session_stats_alert::message().

    │ │ │ │ +

    this specific output is parsed by tools/parse_session_stats.py │ │ │ │ +if this is changed, that parser should also be changed

    │ │ │ │
    │ │ │ │ -int num_pieces () const;
    │ │ │ │ -int piece_length () const;
    │ │ │ │ +struct session_stats_header_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = {};
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    blocks_per_piece()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_sample_infohashes_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    posted as a response to a call to session::dht_sample_infohashes() with │ │ │ │ +the information from the DHT response message.

    │ │ │ │
    │ │ │ │ -int blocks_per_piece () const;
    │ │ │ │ +struct dht_sample_infohashes_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   int num_samples () const;
    │ │ │ │ +   std::vector<sha1_hash> samples () const;
    │ │ │ │ +   int num_nodes () const;
    │ │ │ │ +   std::vector<std::pair<sha1_hash, udp::endpoint>> nodes () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::dht_operation;
    │ │ │ │ +   sha1_hash node_id;
    │ │ │ │ +   aux::noexcept_movable<udp::endpoint> endpoint;
    │ │ │ │ +   time_duration const interval;
    │ │ │ │ +   int const num_infohashes;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    returns the number of blocks there are in the typical piece. There │ │ │ │ -may be fewer in the last piece)

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    last_piece() end_piece() piece_range()

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    num_samples() samples()

    │ │ │ │
    │ │ │ │ -piece_index_t last_piece () const;
    │ │ │ │ -piece_index_t end_piece () const;
    │ │ │ │ -index_range<piece_index_t> piece_range () const;
    │ │ │ │ +int num_samples () const;
    │ │ │ │ +std::vector<sha1_hash> samples () 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 file_storage.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    info_hash() info_hashes()

    │ │ │ │ +

    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().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    num_nodes()

    │ │ │ │
    │ │ │ │ -sha1_hash info_hash () const noexcept;
    │ │ │ │ -info_hash_t const& info_hashes () const;
    │ │ │ │ +int num_nodes () 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

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    v2() v1()

    │ │ │ │ +

    The total number of nodes returned by nodes().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    nodes()

    │ │ │ │
    │ │ │ │ -bool v1 () const;
    │ │ │ │ -bool v2 () const;
    │ │ │ │ +std::vector<std::pair<sha1_hash, udp::endpoint>> nodes () 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    num_files()

    │ │ │ │ +

    This is the set of more DHT nodes returned by the request.

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    node_id
    │ │ │ │ +
    id of the node the request was sent to (and this response was received from)
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    endpoint
    │ │ │ │ +
    the node the request was sent to (and this response was received from)
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    interval
    │ │ │ │ +
    the interval to wait before making another request to this node
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    num_infohashes
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    block_uploaded_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    This alert 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 alert may be posted without the bytes having been sent to the peer. │ │ │ │ +It belongs to the alert_category::upload category.

    │ │ │ │
    │ │ │ │ -int num_files () const;
    │ │ │ │ +struct block_uploaded_alert final : peer_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   int const block_index;
    │ │ │ │ +   piece_index_t const piece_index;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    map_block()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    alerts_dropped_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    this alert is posted to indicate to the client that some alerts were │ │ │ │ +dropped. Dropped meaning that the alert failed to be delivered to the │ │ │ │ +client. The most common cause of such failure is that the internal alert │ │ │ │ +queue grew too big (controlled by alert_queue_size).

    │ │ │ │
    │ │ │ │ -std::vector<file_slice> map_block (piece_index_t const piece
    │ │ │ │ -      , std::int64_t offset, int size) const;
    │ │ │ │ +struct alerts_dropped_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +   static_assert (num_alert_types <= abi_alert_count, "need to increase bitset. This is an ABI break");
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ +   std::bitset<abi_alert_count> dropped_alerts;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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 file_slice.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    map_file()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    dropped_alerts
    │ │ │ │ +
    a bitmask indicating which alerts were dropped. Each bit represents the │ │ │ │ +alert type ID, where bit 0 represents whether any alert of type 0 has │ │ │ │ +been dropped, and so on.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    socks5_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    this alert is posted with SOCKS5 related errors, when a SOCKS5 proxy is │ │ │ │ +configured. It's enabled with the alert_category::error alert category.

    │ │ │ │
    │ │ │ │ -peer_request map_file (file_index_t const file, std::int64_t offset, int size) const;
    │ │ │ │ +struct socks5_alert final : alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ +   error_code error;
    │ │ │ │ +   operation_t op;
    │ │ │ │ +   aux::noexcept_movable<tcp::endpoint> ip;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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 peer_request.

    │ │ │ │ -

    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().

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    ssl_cert()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    the error
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    op
    │ │ │ │ +
    the operation that failed
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    ip
    │ │ │ │ +
    the endpoint configured as the proxy
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_prio_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    posted when a prioritize_files() or file_priority() update of the file │ │ │ │ +priorities complete, which requires a round-trip to the disk thread.

    │ │ │ │ +

    If the disk operation fails this alert won't be posted, but a │ │ │ │ +file_error_alert is posted instead, and the torrent is stopped.

    │ │ │ │
    │ │ │ │ -string_view ssl_cert () const;
    │ │ │ │ +struct file_prio_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ +   error_code error;
    │ │ │ │ +   operation_t op;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    is_valid()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    error
    │ │ │ │ +
    the error
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    op
    │ │ │ │ +
    the operation that failed
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    oversized_file_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    this alert 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 alert is posted. │ │ │ │ +the client may want to call truncate_files() in that case, or perhaps │ │ │ │ +interpret it as a sign that some other file is in the way, that shouldn't │ │ │ │ +be overwritten.

    │ │ │ │
    │ │ │ │ -bool is_valid () const;
    │ │ │ │ +struct oversized_file_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    returns true if this torrent_info object has a torrent loaded. │ │ │ │ -This is primarily used to determine if a magnet link has had its │ │ │ │ -metadata resolved yet or not.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    priv()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    torrent_conflict_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    this alert 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 duplicate_torrent │ │ │ │ +as the error code. This alert is posted containing the metadata. For more │ │ │ │ +information, see BitTorrent v2 torrents. │ │ │ │ +The torrent this alert originated from was the one that downloaded the

    │ │ │ │ +

    metadata (i.e. the handle member from the torrent_alert base class).

    │ │ │ │
    │ │ │ │ -bool priv () const;
    │ │ │ │ +struct torrent_conflict_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ +   torrent_handle conflicting_torrent;
    │ │ │ │ +   std::shared_ptr<torrent_info> metadata;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    is_i2p()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    conflicting_torrent
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    metadata
    │ │ │ │ +
    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
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    peer_info_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    posted when torrent_handle::post_peer_info() is called

    │ │ │ │
    │ │ │ │ -bool is_i2p () const;
    │ │ │ │ +struct peer_info_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +   std::vector<lt::peer_info> peer_info;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    piece_size()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    peer_info
    │ │ │ │ +
    the list of the currently connected peers
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_progress_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    posted when torrent_handle::post_file_progress() is called

    │ │ │ │
    │ │ │ │ -int piece_size (piece_index_t index) const;
    │ │ │ │ +struct file_progress_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::file_progress;
    │ │ │ │ +   aux::vector<std::int64_t, file_index_t> files;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    returns the piece size of file with index. This will be the same as piece_length(), │ │ │ │ -except for the last piece, which may be shorter.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    hash_for_piece() hash_for_piece_ptr()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    files
    │ │ │ │ +
    the list of the files in the torrent
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    piece_info_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    posted when torrent_handle::post_download_queue() is called

    │ │ │ │
    │ │ │ │ -sha1_hash hash_for_piece (piece_index_t index) const;
    │ │ │ │ -char const* hash_for_piece_ptr (piece_index_t const index) const;
    │ │ │ │ +struct piece_info_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::piece_progress;
    │ │ │ │ +   std::vector<partial_piece_info> piece_info;
    │ │ │ │ +   std::vector<block_info> block_data;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    name()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    piece_info
    │ │ │ │ +
    info about pieces being downloaded for the torrent
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    block_data
    │ │ │ │ +
    storage for block_info pointers in partial_piece_info objects
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    piece_availability_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    posted when torrent_handle::post_piece_availability() is called

    │ │ │ │
    │ │ │ │ -const std::string& name () const;
    │ │ │ │ +struct piece_availability_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +   std::vector<int> piece_availability;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    name() returns the name of the torrent. │ │ │ │ -name contains UTF-8 encoded string.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    creation_date()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    piece_availability
    │ │ │ │ +
    info about pieces being downloaded for the torrent
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    tracker_list_alert

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    posted when torrent_handle::post_trackers() is called

    │ │ │ │
    │ │ │ │ -std::time_t creation_date () const;
    │ │ │ │ +struct tracker_list_alert final : torrent_alert
    │ │ │ │ +{
    │ │ │ │ +   std::string message () const override;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ +   std::vector<announce_entry> trackers;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    creation_date() returns the creation date of the torrent as time_t │ │ │ │ -(posix time). If there's no time stamp in the torrent file, 0 is │ │ │ │ -returned. │ │ │ │ -.. posix time: http://www.opengroup.org/onlinepubs/009695399/functions/time.html

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    creator()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    trackers
    │ │ │ │ +
    list of trackers and their status for the torrent
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    alert

    │ │ │ │ +

    Declared in "libtorrent/alert.hpp"

    │ │ │ │ +

    The alert class is the base class that specific messages are derived from. │ │ │ │ +alert types are not copyable, and cannot be constructed by the client. The │ │ │ │ +pointers returned by libtorrent are short lived (the details are described │ │ │ │ +under session_handle::pop_alerts())

    │ │ │ │
    │ │ │ │ -const std::string& creator () const;
    │ │ │ │ +struct alert
    │ │ │ │ +{
    │ │ │ │ +   time_point timestamp () const;
    │ │ │ │ +   virtual int type () const noexcept = 0;
    │ │ │ │ +   virtual char const* what () const noexcept = 0;
    │ │ │ │ +   virtual std::string message () const = 0;
    │ │ │ │ +   virtual alert_category_t category () const noexcept = 0;
    │ │ │ │ +
    │ │ │ │ +   static constexpr alert_category_t error_notification  = 0_bit;
    │ │ │ │ +   static constexpr alert_category_t peer_notification  = 1_bit;
    │ │ │ │ +   static constexpr alert_category_t port_mapping_notification  = 2_bit;
    │ │ │ │ +   static constexpr alert_category_t storage_notification  = 3_bit;
    │ │ │ │ +   static constexpr alert_category_t tracker_notification  = 4_bit;
    │ │ │ │ +   static constexpr alert_category_t connect_notification  = 5_bit;
    │ │ │ │ +   static constexpr alert_category_t status_notification  = 6_bit;
    │ │ │ │ +   static constexpr alert_category_t ip_block_notification  = 8_bit;
    │ │ │ │ +   static constexpr alert_category_t performance_warning  = 9_bit;
    │ │ │ │ +   static constexpr alert_category_t dht_notification  = 10_bit;
    │ │ │ │ +   static constexpr alert_category_t session_log_notification  = 13_bit;
    │ │ │ │ +   static constexpr alert_category_t torrent_log_notification  = 14_bit;
    │ │ │ │ +   static constexpr alert_category_t peer_log_notification  = 15_bit;
    │ │ │ │ +   static constexpr alert_category_t incoming_request_notification  = 16_bit;
    │ │ │ │ +   static constexpr alert_category_t dht_log_notification  = 17_bit;
    │ │ │ │ +   static constexpr alert_category_t dht_operation_notification  = 18_bit;
    │ │ │ │ +   static constexpr alert_category_t port_mapping_log_notification  = 19_bit;
    │ │ │ │ +   static constexpr alert_category_t picker_log_notification  = 20_bit;
    │ │ │ │ +   static constexpr alert_category_t file_progress_notification  = 21_bit;
    │ │ │ │ +   static constexpr alert_category_t piece_progress_notification  = 22_bit;
    │ │ │ │ +   static constexpr alert_category_t upload_notification  = 23_bit;
    │ │ │ │ +   static constexpr alert_category_t block_progress_notification  = 24_bit;
    │ │ │ │ +   static constexpr alert_category_t all_categories  = alert_category_t::all();
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    creator() returns the creator string in the torrent. If there is │ │ │ │ -no creator string it will return an empty string.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    comment()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    timestamp()

    │ │ │ │
    │ │ │ │ -const std::string& comment () const;
    │ │ │ │ +time_point timestamp () 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    nodes()

    │ │ │ │ +

    a timestamp is automatically created in the constructor

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    type()

    │ │ │ │
    │ │ │ │ -std::vector<std::pair<std::string, int>> const& nodes () const;
    │ │ │ │ +virtual int type () const noexcept = 0;
    │ │ │ │  
    │ │ │ │ -

    If this torrent contains any DHT nodes, they are put in this vector in │ │ │ │ -their original form (host name and port number).

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_node()

    │ │ │ │ -
    │ │ │ │ -void add_node (std::pair<std::string, int> const& node);
    │ │ │ │ +

    returns an integer that is unique to this alert type. It can be │ │ │ │ +compared against a specific alert by querying a static constant called alert_type │ │ │ │ +in the alert. It can be used to determine the run-time type of an alert* in │ │ │ │ +order to cast to that alert 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...
    │ │ │ │ +                }
    │ │ │ │ +        }
    │ │ │ │ +}
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    parse_info_section()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    what()

    │ │ │ │
    │ │ │ │ -bool parse_info_section (bdecode_node const& info, error_code& ec, int max_pieces);
    │ │ │ │ +virtual char const* what () const noexcept = 0;
    │ │ │ │  
    │ │ │ │ -

    populates the torrent_info 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 bdecode_node e points to a │ │ │ │ -parsed info-dictionary. ec returns an error code if something │ │ │ │ -fails (typically if the info dictionary is malformed). │ │ │ │ -The max_pieces 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 settings_pack::max_piece_count and in calls to │ │ │ │ -read_resume_data().

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    info()

    │ │ │ │ +

    returns a string literal describing the type of the alert. It does │ │ │ │ +not include any information that might be bundled with the alert.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    message()

    │ │ │ │
    │ │ │ │ -bdecode_node info (char const* key) const;
    │ │ │ │ +virtual std::string message () const = 0;
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    info_section()

    │ │ │ │ +

    generate a string describing the alert 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 alert │ │ │ │ +type individually and extract and render the information from the alert depending │ │ │ │ +on the locale.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    category()

    │ │ │ │
    │ │ │ │ -span<char const> info_section () const;
    │ │ │ │ +virtual alert_category_t category () const noexcept = 0;
    │ │ │ │  
    │ │ │ │ -

    returns a the raw info section of the torrent file. │ │ │ │ -The underlying buffer is still owned by the torrent_info object

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    piece_layer()

    │ │ │ │ +

    returns a bitmask specifying which categories this alert belong to.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    operation_name()

    │ │ │ │ +

    Declared in "libtorrent/operations.hpp"

    │ │ │ │
    │ │ │ │ -span<char const> piece_layer (file_index_t) const;
    │ │ │ │ +char const* operation_name (operation_t op);
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    free_piece_layers()

    │ │ │ │ +

    maps an operation id (from peer_error_alert and peer_disconnected_alert) │ │ │ │ +to its name. See operation_t for the constants

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    alert_cast()

    │ │ │ │ +

    Declared in "libtorrent/alert.hpp"

    │ │ │ │
    │ │ │ │ -void free_piece_layers ();
    │ │ │ │ +template <typename T> T* alert_cast (alert* a);
    │ │ │ │ +template <typename T> T const* alert_cast (alert const* a);
    │ │ │ │  
    │ │ │ │ -

    clears the piece layers from the torrent_info. This is done by the │ │ │ │ -session 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.

    │ │ │ │ -

    You have some control over session configuration through the session::apply_settings() │ │ │ │ -member function. To change one or more configuration options, create a settings_pack │ │ │ │ -object and fill it with the settings to be set and pass it in to session::apply_settings().

    │ │ │ │ -

    The settings_pack object is a collection of settings updates that are applied │ │ │ │ -to the session 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 │ │ │ │ -settings_pack class. These are the available settings:

    │ │ │ │ -[report issue]
    │ │ │ │ +

    When you get an alert, you can use alert_cast<> to attempt to cast the │ │ │ │ +pointer to a specific alert type, in order to query it for more │ │ │ │ +information.

    │ │ │ │ +
    │ │ │ │ +

    Note

    │ │ │ │ +

    alert_cast<> can only cast to an exact alert type, not a base class

    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    settings_pack

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ +[report issue] │ │ │ │ +
    │ │ │ │ +

    enum operation_t

    │ │ │ │ +

    Declared in "libtorrent/operations.hpp"

    │ │ │ │ +
    │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefaultvaluedescription
    user_agentstringlibtorrent/
    unknown0the error was unexpected and it is unknown which operation caused it
    │ │ │ │ -

    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

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    bittorrent1this is used when the bittorrent logic │ │ │ │ +determines to disconnect
    announce_ipstringnullptr
    iocontrol2a call to iocontrol failed
    │ │ │ │ -

    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.

    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    getpeername3a call to getpeername() failed (querying the remote IP of a │ │ │ │ +connection)
    handshake_client_versionstringnullptr
    getname4a call to getname failed (querying the local IP of a │ │ │ │ +connection)
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    alloc_recvbuf5an attempt to allocate a receive buffer failed
    outgoing_interfacesstring 
    alloc_sndbuf6an attempt to allocate a send buffer failed
    │ │ │ │ -

    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 (bind-to-device).

    │ │ │ │ -

    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 to bind() │ │ │ │ -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 to bind() 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 not in this list │ │ │ │ -will be rejected with a peer_blocked_alert 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 [, ].

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    file_write7writing to a file failed
    listen_interfacesstring0.0.0.0:6881,[::]:6881
    file_read8reading from a file failed
    │ │ │ │ -

    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 outgoing 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 listen_failed_alert is posted. Once a │ │ │ │ -socket binding succeeds (if it does), the listen_succeeded_alert │ │ │ │ -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 │ │ │ │ -settings_pack::outgoing_interfaces).

    │ │ │ │ -

    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 Multi-homed hosts section.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    file9a non-read and non-write file operation failed
    proxy_hostnamestring 
    sock_write10a socket write operation failed
    │ │ │ │ -

    when using a proxy, this is the hostname where the proxy is running │ │ │ │ -see proxy_type. Note that when using a proxy, the │ │ │ │ -settings_pack::listen_interfaces 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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    sock_read11a socket read operation failed
    proxy_usernamestring 
    sock_open12a call to open(), to create a socket socket failed
    proxy_passwordstring 
    sock_bind13a call to bind() on a socket failed
    │ │ │ │ -

    when using a proxy, these are the credentials (if any) to use when │ │ │ │ -connecting to it. see proxy_type

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    available14an attempt to query the number of bytes available to read from a socket │ │ │ │ +failed
    i2p_hostnamestring 
    encryption15a call related to bittorrent protocol encryption failed
    │ │ │ │ -

    sets the i2p 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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    connect16an attempt to connect a socket failed
    peer_fingerprintstring-LT20B0-
    ssl_handshake17establishing an SSL connection failed
    │ │ │ │ -

    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, generate_fingerprint() that can be used │ │ │ │ -to generate a standard client peer ID fingerprint prefix.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    get_interface18a connection failed to satisfy the bind interface setting
    dht_bootstrap_nodesstringdht.libtorrent.org:25401
    sock_listen19a call to listen() on a socket
    │ │ │ │ -

    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,

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    sock_bind_to_device20a call to the ioctl to bind a socket to a specific network device or │ │ │ │ +adapter
    allow_multiple_connections_per_ipboolfalse
    sock_accept21a call to accept() on a socket
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    parse_address22convert a string into a valid network address
    send_redundant_havebooltrue
    enum_if23enumeration network devices or adapters
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    file_stat24invoking stat() on a file
    use_dht_as_fallbackboolfalse
    file_copy25copying a file
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    file_fallocate26allocating storage for a file
    upnp_ignore_nonroutersboolfalse
    file_hard_link27creating a hard link
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    file_remove28removing a file
    use_parole_modebooltrue
    file_rename29renaming a file
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    file_open30opening a file
    auto_manage_prefer_seedsboolfalse
    mkdir31creating a directory
    │ │ │ │ -

    if true, prefer seeding torrents when determining which torrents to give │ │ │ │ -active slots to. If false, give preference to downloading torrents

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    check_resume32check fast resume data against files on disk
    dont_count_slow_torrentsbooltrue
    exception33an unknown exception
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    alloc_cache_piece34allocate space for a piece in the cache
    close_redundant_connectionsbooltrue
    partfile_move35move a part-file
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    partfile_read36read from a part file
    prioritize_partial_piecesboolfalse
    partfile_write37write to a part-file
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    hostname_lookup38a hostname lookup
    rate_limit_ip_overheadbooltrue
    symlink39create or read a symlink
    │ │ │ │ -

    if set to true, the estimated TCP/IP overhead is drained from the │ │ │ │ -rate limiters, to avoid exceeding the limits with the total traffic

    │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    handshake40handshake with a peer or server
    announce_to_all_tiersboolfalse
    sock_option41set socket option
    announce_to_all_trackersboolfalse
    enum_route42enumeration of network routes
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    file_seek43moving read/write position in a file, operation_t::hostname_lookup
    prefer_udp_trackersbooltrue
    timer44an async wait operation on a timer
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    nametypedefault
    file_mmap45call to mmap() (or windows counterpart)
    disable_hash_checksboolfalse
    file_truncate46call to ftruncate() (or SetEndOfFile() on windows)
    │ │ │ │ -

    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)

    │ │ │ │ - │ │ │ │ +[report issue] │ │ │ │ +
    │ │ │ │ +

    int

    │ │ │ │ +

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +
    │ │ │ │ +
    user_alert_id
    │ │ │ │ +
    user defined alerts should use IDs greater than this
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    num_alert_types
    │ │ │ │ +
    this constant represents "max_alert_index" + 1
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    alert_category_t

    │ │ │ │ +

    Declared in "libtorrent/alert.hpp"

    │ │ │ │ +
    │ │ │ │ +
    error
    │ │ │ │ +

    Enables alerts that report an error. This includes:

    │ │ │ │ +
      │ │ │ │ +
    • tracker errors
    • │ │ │ │ +
    • tracker warnings
    • │ │ │ │ +
    • file errors
    • │ │ │ │ +
    • resume data failures
    • │ │ │ │ +
    • web seed errors
    • │ │ │ │ +
    • .torrent files errors
    • │ │ │ │ +
    • listen socket errors
    • │ │ │ │ +
    • port mapping errors
    • │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    peer
    │ │ │ │ +
    Enables alerts when peers send invalid requests, get banned or │ │ │ │ +snubbed.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    port_mapping
    │ │ │ │ +
    Enables alerts for port mapping events. For NAT-PMP and UPnP.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    storage
    │ │ │ │ +
    Enables alerts for events related to the storage. File errors and │ │ │ │ +synchronization events for moving the storage, renaming files etc.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    tracker
    │ │ │ │ +
    Enables all tracker events. Includes announcing to trackers, │ │ │ │ +receiving responses, warnings and errors.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    connect
    │ │ │ │ +
    Low level alerts for when peers are connected and disconnected.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    status
    │ │ │ │ +
    Enables alerts for when a torrent or the session changes state.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    ip_block
    │ │ │ │ +
    Alerts when a peer is blocked by the ip blocker or port blocker.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    performance_warning
    │ │ │ │ +
    Alerts when some limit is reached that might limit the download │ │ │ │ +or upload rate.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    dht
    │ │ │ │ +
    Alerts on events in the DHT node. For incoming searches or │ │ │ │ +bootstrapping being done etc.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    stats
    │ │ │ │ +
    If you enable these alerts, you will receive a stats_alert │ │ │ │ +approximately once every second, for every active torrent. │ │ │ │ +These alerts contain all statistics counters for the interval since │ │ │ │ +the lasts stats alert.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    session_log
    │ │ │ │ +
    Enables debug logging alerts. These are available unless libtorrent │ │ │ │ +was built with logging disabled (TORRENT_DISABLE_LOGGING). The │ │ │ │ +alerts being posted are log_alert and are session wide.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    torrent_log
    │ │ │ │ +
    Enables debug logging alerts for torrents. These are available │ │ │ │ +unless libtorrent was built with logging disabled │ │ │ │ +(TORRENT_DISABLE_LOGGING). The alerts being posted are │ │ │ │ +torrent_log_alert and are torrent wide debug events.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    peer_log
    │ │ │ │ +
    Enables debug logging alerts for peers. These are available unless │ │ │ │ +libtorrent was built with logging disabled │ │ │ │ +(TORRENT_DISABLE_LOGGING). The alerts being posted are │ │ │ │ +peer_log_alert and low-level peer events and messages.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    incoming_request
    │ │ │ │ +
    enables the incoming_request_alert.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    dht_log
    │ │ │ │ +
    enables dht_log_alert, debug logging for the DHT
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    dht_operation
    │ │ │ │ +
    enable events from pure dht operations not related to torrents
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    port_mapping_log
    │ │ │ │ +
    enables port mapping log events. This log is useful │ │ │ │ +for debugging the UPnP or NAT-PMP implementation
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    picker_log
    │ │ │ │ +
    enables verbose logging from the piece picker.
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    file_progress
    │ │ │ │ +
    alerts when files complete downloading
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    piece_progress
    │ │ │ │ +
    alerts when pieces complete downloading or fail hash check
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    upload
    │ │ │ │ +
    alerts when we upload blocks to other peers
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    block_progress
    │ │ │ │ +
    alerts on individual blocks being requested, downloading, finished, │ │ │ │ +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.

    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    libtorrent has a plugin 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 plugin interface makes it possible to:

    │ │ │ │ +
      │ │ │ │ +
    • register extension messages (sent in the extension handshake), see │ │ │ │ +extensions.
    • │ │ │ │ +
    • 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 session state
    • │ │ │ │ +
    • see all alerts that are posted
    • │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    a word of caution

    │ │ │ │ +

    Writing your own plugin is a very easy way to introduce serious bugs such as │ │ │ │ +dead locks and race conditions. Since a plugin 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 plugin 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 plugin, 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 plugin 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.

    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    plugin-interface

    │ │ │ │ +

    The plugin interface consists of three base classes that the plugin may │ │ │ │ +implement. These are called plugin, torrent_plugin and peer_plugin. │ │ │ │ +They are found in the <libtorrent/extensions.hpp> header.

    │ │ │ │ +

    These plugins are instantiated for each session, 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 session wide state, you would │ │ │ │ +implement plugin, construct an object (in a std::shared_ptr) and pass │ │ │ │ +it in to session::add_extension().

    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    custom alerts

    │ │ │ │ +

    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 alert, apart from deriving from the alert │ │ │ │ +base class, looks like this:

    │ │ │ │ +
    │ │ │ │ +static const int alert_type = <unique alert ID>;
    │ │ │ │ +virtual int type() const { return alert_type; }
    │ │ │ │ +
    │ │ │ │ +virtual std::string message() const;
    │ │ │ │ +
    │ │ │ │ +static const alert_category_t static_category = <bitmask of alert::category_t flags>;
    │ │ │ │ +virtual alert_category_t category() const { return static_category; }
    │ │ │ │ +
    │ │ │ │ +virtual char const* what() const { return <string literal of the name of this alert>; }
    │ │ │ │ +
    │ │ │ │ +

    The alert_type is used for the type-checking in alert_cast. It must │ │ │ │ +not collide with any other alert. The built-in alerts in libtorrent will │ │ │ │ +not use alert type IDs greater than user_alert_id. When defining your │ │ │ │ +own alert, 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 alert 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 alert is enabled or not, without instantiating the alert. │ │ │ │ +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 alert.

    │ │ │ │ +

    For more information, see the alert section.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    plugin

    │ │ │ │ +

    Declared in "libtorrent/extensions.hpp"

    │ │ │ │ +

    this is the base class for a session plugin. One primary feature │ │ │ │ +is that it is notified of all torrents that are added to the session, │ │ │ │ +and can add its own torrent_plugins.

    │ │ │ │ +
    │ │ │ │ +struct plugin
    │ │ │ │ +{
    │ │ │ │ +   virtual feature_flags_t implemented_features ();
    │ │ │ │ +   virtual std::shared_ptr<torrent_plugin> new_torrent (torrent_handle const&, client_data_t);
    │ │ │ │ +   virtual void added (session_handle const&);
    │ │ │ │ +   virtual void abort ();
    │ │ │ │ +   virtual bool on_dht_request (string_view /* query */
    │ │ │ │ +      , udp::endpoint const& /* source */, bdecode_node const& /* message */
    │ │ │ │ +      , entry& /* response */);
    │ │ │ │ +   virtual void on_alert (alert const*);
    │ │ │ │ +   virtual bool on_unknown_torrent (info_hash_t const& /* info_hash */
    │ │ │ │ +      , peer_connection_handle const& /* pc */, add_torrent_params& /* p */);
    │ │ │ │ +   virtual void on_tick ();
    │ │ │ │ +   virtual uint64_t get_unchoke_priority (peer_connection_handle const& /* peer */);
    │ │ │ │ +   virtual std::map<std::string, std::string> save_state () const;
    │ │ │ │ +   virtual void load_state (std::map<std::string, std::string> const&);
    │ │ │ │ +
    │ │ │ │ +   static constexpr feature_flags_t optimistic_unchoke_feature  = 1_bit;
    │ │ │ │ +   static constexpr feature_flags_t tick_feature  = 2_bit;
    │ │ │ │ +   static constexpr feature_flags_t dht_request_feature  = 3_bit;
    │ │ │ │ +   static constexpr feature_flags_t alert_feature  = 4_bit;
    │ │ │ │ +   static constexpr feature_flags_t unknown_torrent_feature  = 5_bit;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    implemented_features()

    │ │ │ │ +
    │ │ │ │ +virtual feature_flags_t implemented_features ();
    │ │ │ │ +
    │ │ │ │ +

    This function is expected to return a bitmask indicating which features │ │ │ │ +this plugin 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    new_torrent()

    │ │ │ │ +
    │ │ │ │ +virtual std::shared_ptr<torrent_plugin> new_torrent (torrent_handle const&, client_data_t);
    │ │ │ │ +
    │ │ │ │ +

    this is called by the session every time a new torrent is added. │ │ │ │ +The torrent* points to the internal torrent object created │ │ │ │ +for the new torrent. The client_data_t is the userdata pointer as │ │ │ │ +passed in via add_torrent_params.

    │ │ │ │ +

    If the plugin returns a torrent_plugin instance, it will be added │ │ │ │ +to the new torrent. Otherwise, return an empty shared_ptr to a │ │ │ │ +torrent_plugin (the default).

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    added()

    │ │ │ │ +
    │ │ │ │ +virtual void added (session_handle const&);
    │ │ │ │ +
    │ │ │ │ +

    called when plugin is added to a session

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    abort()

    │ │ │ │ +
    │ │ │ │ +virtual void abort ();
    │ │ │ │ +
    │ │ │ │ +

    called when the session is aborted │ │ │ │ +the plugin should perform any cleanup necessary to allow the session's │ │ │ │ +destruction (e.g. cancel outstanding async operations)

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_dht_request()

    │ │ │ │ +
    │ │ │ │ +virtual bool on_dht_request (string_view /* query */
    │ │ │ │ +      , udp::endpoint const& /* source */, bdecode_node const& /* message */
    │ │ │ │ +      , entry& /* response */);
    │ │ │ │ +
    │ │ │ │ +

    called when a dht request is received. │ │ │ │ +If your plugin expects this to be called, make sure to include the flag │ │ │ │ +dht_request_feature in the return value from implemented_features().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_alert()

    │ │ │ │ +
    │ │ │ │ +virtual void on_alert (alert const*);
    │ │ │ │ +
    │ │ │ │ +

    called when an alert is posted alerts that are filtered are not posted. │ │ │ │ +If your plugin expects this to be called, make sure to include the flag │ │ │ │ +alert_feature in the return value from implemented_features().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_unknown_torrent()

    │ │ │ │ +
    │ │ │ │ +virtual bool on_unknown_torrent (info_hash_t const& /* info_hash */
    │ │ │ │ +      , peer_connection_handle const& /* pc */, add_torrent_params& /* p */);
    │ │ │ │ +
    │ │ │ │ +

    return true if the add_torrent_params should be added

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_tick()

    │ │ │ │ +
    │ │ │ │ +virtual void on_tick ();
    │ │ │ │ +
    │ │ │ │ +

    called once per second. │ │ │ │ +If your plugin expects this to be called, make sure to include the flag │ │ │ │ +tick_feature in the return value from implemented_features().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    get_unchoke_priority()

    │ │ │ │ +
    │ │ │ │ +virtual uint64_t get_unchoke_priority (peer_connection_handle const& /* peer */);
    │ │ │ │ +
    │ │ │ │ +

    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 plugin has no priority to assign a peer it should return 2^64-1. │ │ │ │ +If your plugin expects this to be called, make sure to include the flag │ │ │ │ +optimistic_unchoke_feature in the return value from implemented_features(). │ │ │ │ +If multiple plugins implement this function the lowest return value │ │ │ │ +(i.e. the highest priority) is used.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    load_state()

    │ │ │ │ +
    │ │ │ │ +virtual void load_state (std::map<std::string, std::string> const&);
    │ │ │ │ +
    │ │ │ │ +

    called on startup while loading settings state from the session_params

    │ │ │ │ +[report issue]
    │ │ │ │ +
    optimistic_unchoke_feature
    │ │ │ │ +
    include this bit if your plugin needs to alter the order of the │ │ │ │ +optimistic unchoke of peers. i.e. have the on_optimistic_unchoke() │ │ │ │ +callback be called.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    tick_feature
    │ │ │ │ +
    include this bit if your plugin needs to have on_tick() called
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    dht_request_feature
    │ │ │ │ +
    include this bit if your plugin needs to have on_dht_request() │ │ │ │ +called
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    alert_feature
    │ │ │ │ +
    include this bit if your plugin needs to have on_alert() │ │ │ │ +called
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    unknown_torrent_feature
    │ │ │ │ +
    include this bit if your plugin needs to have on_unknown_torrent() │ │ │ │ +called even if there is no active torrent in the session
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    torrent_plugin

    │ │ │ │ +

    Declared in "libtorrent/extensions.hpp"

    │ │ │ │ +

    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> new_connection (peer_connection_handle const&);
    │ │ │ │ +   virtual void on_piece_pass (piece_index_t);
    │ │ │ │ +   virtual void on_piece_failed (piece_index_t);
    │ │ │ │ +   virtual void tick ();
    │ │ │ │ +   virtual bool on_resume ();
    │ │ │ │ +   virtual bool on_pause ();
    │ │ │ │ +   virtual void on_files_checked ();
    │ │ │ │ +   virtual void on_state (torrent_status::state_t);
    │ │ │ │ +   virtual void on_add_peer (tcp::endpoint const&,
    │ │ │ │ +      peer_source_flags_t, add_peer_flags_t);
    │ │ │ │ +
    │ │ │ │ +   static constexpr add_peer_flags_t first_time  = 1_bit;
    │ │ │ │ +   static constexpr add_peer_flags_t filtered  = 2_bit;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    new_connection()

    │ │ │ │ +
    │ │ │ │ +virtual std::shared_ptr<peer_plugin> new_connection (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 peer_plugin 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 peer_plugin. If you want to keep references │ │ │ │ +to it, use weak_ptr.

    │ │ │ │ +

    If this function throws an exception, the connection will be closed.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_piece_failed() on_piece_pass()

    │ │ │ │ +
    │ │ │ │ +virtual void on_piece_pass (piece_index_t);
    │ │ │ │ +virtual void on_piece_failed (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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    tick()

    │ │ │ │ +
    │ │ │ │ +virtual void tick ();
    │ │ │ │ +
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_pause() on_resume()

    │ │ │ │ +
    │ │ │ │ +virtual bool on_resume ();
    │ │ │ │ +virtual bool on_pause ();
    │ │ │ │ +
    │ │ │ │ +

    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 plugin 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_files_checked()

    │ │ │ │ +
    │ │ │ │ +virtual void on_files_checked ();
    │ │ │ │ +
    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_state()

    │ │ │ │ +
    │ │ │ │ +virtual void on_state (torrent_status::state_t);
    │ │ │ │ +
    │ │ │ │ +

    called when the torrent changes state │ │ │ │ +the state is one of torrent_status::state_t │ │ │ │ +enum members

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_add_peer()

    │ │ │ │ +
    │ │ │ │ +virtual void on_add_peer (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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    first_time
    │ │ │ │ +
    this is the first time we see this peer
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    filtered
    │ │ │ │ +
    this peer was not added because it was │ │ │ │ +filtered by the IP filter
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    peer_plugin

    │ │ │ │ +

    Declared in "libtorrent/extensions.hpp"

    │ │ │ │ +

    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 plugin for certain peer │ │ │ │ +connection types

    │ │ │ │ +
    │ │ │ │ +struct peer_plugin
    │ │ │ │ +{
    │ │ │ │ +   virtual string_view type () const;
    │ │ │ │ +   virtual void add_handshake (entry&);
    │ │ │ │ +   virtual void on_disconnect (error_code const&);
    │ │ │ │ +   virtual void on_connected ();
    │ │ │ │ +   virtual bool on_handshake (span<char const>);
    │ │ │ │ +   virtual bool on_extension_handshake (bdecode_node const&);
    │ │ │ │ +   virtual bool on_have_all ();
    │ │ │ │ +   virtual bool on_dont_have (piece_index_t);
    │ │ │ │ +   virtual bool on_interested ();
    │ │ │ │ +   virtual bool on_choke ();
    │ │ │ │ +   virtual bool on_not_interested ();
    │ │ │ │ +   virtual bool on_bitfield (bitfield const& /*bitfield*/);
    │ │ │ │ +   virtual bool on_unchoke ();
    │ │ │ │ +   virtual bool on_request (peer_request const&);
    │ │ │ │ +   virtual bool on_have (piece_index_t);
    │ │ │ │ +   virtual bool on_have_none ();
    │ │ │ │ +   virtual bool on_allowed_fast (piece_index_t);
    │ │ │ │ +   virtual bool on_piece (peer_request const& /*piece*/
    │ │ │ │ +      , span<char const> /*buf*/);
    │ │ │ │ +   virtual bool on_cancel (peer_request const&);
    │ │ │ │ +   virtual bool on_reject (peer_request const&);
    │ │ │ │ +   virtual bool on_suggest (piece_index_t);
    │ │ │ │ +   virtual void sent_allow_fast (piece_index_t);
    │ │ │ │ +   virtual void sent_have_none ();
    │ │ │ │ +   virtual void sent_suggest (piece_index_t);
    │ │ │ │ +   virtual void sent_cancel (peer_request const&);
    │ │ │ │ +   virtual void sent_reject_request (peer_request const&);
    │ │ │ │ +   virtual void sent_request (peer_request const&);
    │ │ │ │ +   virtual void sent_choke ();
    │ │ │ │ +   virtual void sent_have_all ();
    │ │ │ │ +   virtual void sent_not_interested ();
    │ │ │ │ +   virtual void sent_unchoke ();
    │ │ │ │ +   virtual void sent_piece (peer_request const&);
    │ │ │ │ +   virtual void sent_have (piece_index_t);
    │ │ │ │ +   virtual void sent_interested ();
    │ │ │ │ +   virtual void sent_payload (int /* bytes */);
    │ │ │ │ +   virtual bool can_disconnect (error_code const& /*ec*/);
    │ │ │ │ +   virtual bool on_extended (int /*length*/, int /*msg*/,
    │ │ │ │ +      span<char const> /*body*/);
    │ │ │ │ +   virtual bool on_unknown_message (int /*length*/, int /*msg*/,
    │ │ │ │ +      span<char const> /*body*/);
    │ │ │ │ +   virtual void on_piece_pass (piece_index_t);
    │ │ │ │ +   virtual void on_piece_failed (piece_index_t);
    │ │ │ │ +   virtual void tick ();
    │ │ │ │ +   virtual bool write_request (peer_request const&);
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    type()

    │ │ │ │ +
    │ │ │ │ +virtual string_view type () const;
    │ │ │ │ +
    │ │ │ │ +

    This function is expected to return the name of │ │ │ │ +the plugin.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_handshake()

    │ │ │ │ +
    │ │ │ │ +virtual void add_handshake (entry&);
    │ │ │ │ +
    │ │ │ │ +

    can add entries to the extension handshake │ │ │ │ +this is not called for web seeds

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_disconnect()

    │ │ │ │ +
    │ │ │ │ +virtual void on_disconnect (error_code const&);
    │ │ │ │ +
    │ │ │ │ +

    called when the peer is being disconnected.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_connected()

    │ │ │ │ +
    │ │ │ │ +virtual void on_connected ();
    │ │ │ │ +
    │ │ │ │ +

    called when the peer is successfully connected. Note that │ │ │ │ +incoming connections will have been connected by the time │ │ │ │ +the peer plugin is attached to it, and won't have this hook │ │ │ │ +called.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_handshake()

    │ │ │ │ +
    │ │ │ │ +virtual bool on_handshake (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

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_extension_handshake()

    │ │ │ │ +
    │ │ │ │ +virtual bool on_extension_handshake (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 peer_plugin │ │ │ │ +being removed from the peer_connection and destructed. │ │ │ │ +this is not called for web seeds

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_request() on_have_none() on_have_all() on_bitfield() on_not_interested() on_dont_have() on_unchoke() on_have() on_allowed_fast() on_choke() on_interested()

    │ │ │ │ +
    │ │ │ │ +virtual bool on_have_all ();
    │ │ │ │ +virtual bool on_dont_have (piece_index_t);
    │ │ │ │ +virtual bool on_interested ();
    │ │ │ │ +virtual bool on_choke ();
    │ │ │ │ +virtual bool on_not_interested ();
    │ │ │ │ +virtual bool on_bitfield (bitfield const& /*bitfield*/);
    │ │ │ │ +virtual bool on_unchoke ();
    │ │ │ │ +virtual bool on_request (peer_request const&);
    │ │ │ │ +virtual bool on_have (piece_index_t);
    │ │ │ │ +virtual bool on_have_none ();
    │ │ │ │ +virtual bool on_allowed_fast (piece_index_t);
    │ │ │ │ +
    │ │ │ │ +

    returning true from any of the message handlers │ │ │ │ +indicates that the plugin has handled the message. │ │ │ │ +it will break the plugin chain traversing and not let │ │ │ │ +anyone else handle the message, including the default │ │ │ │ +handler.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_piece()

    │ │ │ │ +
    │ │ │ │ +virtual bool on_piece (peer_request const& /*piece*/
    │ │ │ │ +      , span<char const> /*buf*/);
    │ │ │ │ +
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    sent_interested() sent_not_interested() sent_have() sent_unchoke() sent_piece()

    │ │ │ │ +
    │ │ │ │ +virtual void sent_not_interested ();
    │ │ │ │ +virtual void sent_unchoke ();
    │ │ │ │ +virtual void sent_piece (peer_request const&);
    │ │ │ │ +virtual void sent_have (piece_index_t);
    │ │ │ │ +virtual void sent_interested ();
    │ │ │ │ +
    │ │ │ │ +

    called after a choke message has been sent to the peer

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    sent_payload()

    │ │ │ │ +
    │ │ │ │ +virtual void sent_payload (int /* bytes */);
    │ │ │ │ +
    │ │ │ │ +

    called after piece data has been sent to the peer │ │ │ │ +this can be used for stats book keeping

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    can_disconnect()

    │ │ │ │ +
    │ │ │ │ +virtual bool can_disconnect (error_code const& /*ec*/);
    │ │ │ │ +
    │ │ │ │ +

    called when libtorrent think this peer should be disconnected. │ │ │ │ +if the plugin returns false, the peer will not be disconnected.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_extended()

    │ │ │ │ +
    │ │ │ │ +virtual bool on_extended (int /*length*/, int /*msg*/,
    │ │ │ │ +      span<char const> /*body*/);
    │ │ │ │ +
    │ │ │ │ +

    called when an extended message is received. If returning true, │ │ │ │ +the message is not processed by any other plugin and if false │ │ │ │ +is returned the next plugin 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_unknown_message()

    │ │ │ │ +
    │ │ │ │ +virtual bool on_unknown_message (int /*length*/, int /*msg*/,
    │ │ │ │ +      span<char const> /*body*/);
    │ │ │ │ +
    │ │ │ │ +

    this is not called for web seeds

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    on_piece_failed() on_piece_pass()

    │ │ │ │ +
    │ │ │ │ +virtual void on_piece_pass (piece_index_t);
    │ │ │ │ +virtual void on_piece_failed (piece_index_t);
    │ │ │ │ +
    │ │ │ │ +

    called when a piece that this peer participated in either │ │ │ │ +fails or passes the hash_check

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    tick()

    │ │ │ │ +
    │ │ │ │ +virtual void tick ();
    │ │ │ │ +
    │ │ │ │ +

    called approximately once every second

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    write_request()

    │ │ │ │ +
    │ │ │ │ +virtual bool write_request (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 plugin will have this function called.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    crypto_plugin

    │ │ │ │ +

    Declared in "libtorrent/extensions.hpp"

    │ │ │ │ +
    │ │ │ │ +struct crypto_plugin
    │ │ │ │ +{
    │ │ │ │ +   virtual void set_outgoing_key (span<char const> key) = 0;
    │ │ │ │ +   virtual void set_incoming_key (span<char const> key) = 0;
    │ │ │ │ +   encrypt (span<span<char>> /*send_vec*/) = 0;
    │ │ │ │ +   virtual std::tuple<int, int, int> decrypt (span<span<char>> /*receive_vec*/) = 0;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    decrypt()

    │ │ │ │ +
    │ │ │ │ +virtual std::tuple<int, int, int> decrypt (span<span<char>> /*receive_vec*/) = 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

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    peer_connection_handle

    │ │ │ │ +

    Declared in "libtorrent/peer_connection_handle.hpp"

    │ │ │ │ +

    the peer_connection_handle 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 peer_connection_handle (std::weak_ptr<peer_connection> impl);
    │ │ │ │ +   connection_type type () const;
    │ │ │ │ +   void add_extension (std::shared_ptr<peer_plugin>);
    │ │ │ │ +   peer_plugin const* find_plugin (string_view type) const;
    │ │ │ │ +   bool is_seed () const;
    │ │ │ │ +   bool upload_only () const;
    │ │ │ │ +   bool has_piece (piece_index_t i) const;
    │ │ │ │ +   peer_id const& pid () const;
    │ │ │ │ +   bool is_choked () const;
    │ │ │ │ +   bool is_interesting () const;
    │ │ │ │ +   bool is_peer_interested () const;
    │ │ │ │ +   bool has_peer_choked () const;
    │ │ │ │ +   void maybe_unchoke_this_peer ();
    │ │ │ │ +   void choke_this_peer ();
    │ │ │ │ +   void get_peer_info (peer_info& p) const;
    │ │ │ │ +   torrent_handle associated_torrent () const;
    │ │ │ │ +   tcp::endpoint const& remote () const;
    │ │ │ │ +   tcp::endpoint local_endpoint () const;
    │ │ │ │ +   void disconnect (error_code const& ec, operation_t op
    │ │ │ │ +      , disconnect_severity_t = peer_connection_interface::normal);
    │ │ │ │ +   bool is_connecting () const;
    │ │ │ │ +   bool is_disconnecting () const;
    │ │ │ │ +   bool is_outgoing () const;
    │ │ │ │ +   bool on_local_network () const;
    │ │ │ │ +   bool ignore_unchoke_slots () const;
    │ │ │ │ +   bool failed () const;
    │ │ │ │ +   void peer_log (peer_log_alert::direction_t direction
    │ │ │ │ +      , char const* event, char const* fmt = "", ...) const TORRENT_FORMAT(4,5);
    │ │ │ │ +   bool should_log (peer_log_alert::direction_t direction) const;
    │ │ │ │ +   bool can_disconnect (error_code const& ec) const;
    │ │ │ │ +   bool has_metadata () const;
    │ │ │ │ +   bool in_handshake () const;
    │ │ │ │ +   void send_buffer (char const* begin, int size);
    │ │ │ │ +   std::time_t last_seen_complete () const;
    │ │ │ │ +   time_point time_of_last_unchoke () const;
    │ │ │ │ +   bool operator!= (peer_connection_handle const& o) const;
    │ │ │ │ +   bool operator== (peer_connection_handle const& o) const;
    │ │ │ │ +   bool operator< (peer_connection_handle const& o) const;
    │ │ │ │ +   std::shared_ptr<peer_connection> native_handle () const;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    bt_peer_connection_handle

    │ │ │ │ +

    Declared in "libtorrent/peer_connection_handle.hpp"

    │ │ │ │ +

    The bt_peer_connection_handle 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 bt_peer_connection_handle (peer_connection_handle pc);
    │ │ │ │ +   bool support_extensions () const;
    │ │ │ │ +   bool packet_finished () const;
    │ │ │ │ +   bool supports_encryption () const;
    │ │ │ │ +   void switch_recv_crypto (std::shared_ptr<crypto_plugin> crypto);
    │ │ │ │ +   void switch_send_crypto (std::shared_ptr<crypto_plugin> crypto);
    │ │ │ │ +   std::shared_ptr<bt_peer_connection> native_handle () const;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    create_ut_pex_plugin()

    │ │ │ │ +

    Declared in "libtorrent/extensions/ut_pex.hpp"

    │ │ │ │ +
    │ │ │ │ +std::shared_ptr<torrent_plugin> create_ut_pex_plugin (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 session constructor.

    │ │ │ │ +

    This can either be passed in the add_torrent_params::extensions field, or │ │ │ │ +via torrent_handle::add_extension().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    create_ut_metadata_plugin()

    │ │ │ │ +

    Declared in "libtorrent/extensions/ut_metadata.hpp"

    │ │ │ │ +
    │ │ │ │ +std::shared_ptr<torrent_plugin> create_ut_metadata_plugin (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 session constructor.

    │ │ │ │ +

    This can either be passed in the add_torrent_params::extensions field, or │ │ │ │ +via torrent_handle::add_extension().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    create_smart_ban_plugin()

    │ │ │ │ +

    Declared in "libtorrent/extensions/smart_ban.hpp"

    │ │ │ │ +
    │ │ │ │ +std::shared_ptr<torrent_plugin> create_smart_ban_plugin (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 torrent_handle::add_extension().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    peer_class_type_filter

    │ │ │ │ +

    Declared in "libtorrent/peer_class_type_filter.hpp"

    │ │ │ │ +

    peer_class_type_filter is a simple container for rules for adding and subtracting │ │ │ │ +peer-classes from peers. It is applied after the peer class filter is applied (which │ │ │ │ +is based on the peer's IP address).

    │ │ │ │ +
    │ │ │ │ +struct peer_class_type_filter
    │ │ │ │ +{
    │ │ │ │ +   void remove (socket_type_t const st, peer_class_t const peer_class);
    │ │ │ │ +   void add (socket_type_t const st, peer_class_t const peer_class);
    │ │ │ │ +   void disallow (socket_type_t const st, peer_class_t const peer_class);
    │ │ │ │ +   void allow (socket_type_t const st, peer_class_t const peer_class);
    │ │ │ │ +   std::uint32_t apply (socket_type_t const st, std::uint32_t peer_class_mask);
    │ │ │ │ +   friend bool operator== (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,
    │ │ │ │ +   };
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    remove() add()

    │ │ │ │ +
    │ │ │ │ +void remove (socket_type_t const st, peer_class_t const peer_class);
    │ │ │ │ +void add (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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    disallow() allow()

    │ │ │ │ +
    │ │ │ │ +void disallow (socket_type_t const st, peer_class_t const peer_class);
    │ │ │ │ +void allow (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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    apply()

    │ │ │ │ +
    │ │ │ │ +std::uint32_t apply (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).

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum socket_type_t

    │ │ │ │ +

    Declared in "libtorrent/peer_class_type_filter.hpp"

    │ │ │ │ +
    │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefaultvaluedescription
    allow_i2p_mixedboolfalse
    tcp_socket0these match the socket types from socket_type.hpp │ │ │ │ +shifted one down
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    utp_socket1 
    no_atime_storagebooltrue
    ssl_tcp_socket2 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    nametypedefault
    ssl_utp_socket3 
    incoming_starts_queued_torrentsboolfalse
    i2p_socket4 
    num_socket_types5 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ +[report issue] │ │ │ │ + │ │ │ │ +
    │ │ │ │ +

    peer_class_info

    │ │ │ │ +

    Declared in "libtorrent/peer_class.hpp"

    │ │ │ │ +

    holds settings for a peer class. Used in set_peer_class() and │ │ │ │ +get_peer_class() 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;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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 any of the peer classes a peer belongs to has this set to true, │ │ │ │ +that peer will be unchoked at all times.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    label
    │ │ │ │ +
    not used by libtorrent. It's intended as a potentially user-facing │ │ │ │ +identifier of this peer class.
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    bitfield

    │ │ │ │ +

    Declared in "libtorrent/bitfield.hpp"

    │ │ │ │ +

    The bitfield type stores any number of bits as a bitfield │ │ │ │ +in a heap allocated array.

    │ │ │ │ +
    │ │ │ │ +struct bitfield
    │ │ │ │ +{
    │ │ │ │ +   bitfield (char const* b, int bits);
    │ │ │ │ +   bitfield (bitfield&& rhs) noexcept = default;
    │ │ │ │ +   bitfield (bitfield const& rhs);
    │ │ │ │ +   bitfield () noexcept = default;
    │ │ │ │ +   bitfield (int bits, bool val);
    │ │ │ │ +   explicit bitfield (int bits);
    │ │ │ │ +   void assign (char const* b, int const bits);
    │ │ │ │ +   bool operator[] (int index) const noexcept;
    │ │ │ │ +   bool get_bit (int index) const noexcept;
    │ │ │ │ +   void set_bit (int index) noexcept;
    │ │ │ │ +   void clear_bit (int index) noexcept;
    │ │ │ │ +   bool all_set () const noexcept;
    │ │ │ │ +   bool none_set () const noexcept;
    │ │ │ │ +   int size () const noexcept;
    │ │ │ │ +   int num_words () const noexcept;
    │ │ │ │ +   int num_bytes () const noexcept;
    │ │ │ │ +   bool empty () const noexcept;
    │ │ │ │ +   char const* data () const noexcept;
    │ │ │ │ +   char* data () noexcept;
    │ │ │ │ +   void swap (bitfield& rhs) noexcept;
    │ │ │ │ +   int count () const noexcept;
    │ │ │ │ +   int find_first_set () const noexcept;
    │ │ │ │ +   int find_last_clear () const noexcept;
    │ │ │ │ +   bool operator== (lt::bitfield const& rhs) const;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    bitfield()

    │ │ │ │ +
    │ │ │ │ +bitfield (char const* b, int bits);
    │ │ │ │ +bitfield (bitfield&& rhs) noexcept = default;
    │ │ │ │ +bitfield (bitfield const& rhs);
    │ │ │ │ +bitfield () noexcept = default;
    │ │ │ │ +bitfield (int bits, bool val);
    │ │ │ │ +explicit bitfield (int bits);
    │ │ │ │ +
    │ │ │ │ +

    constructs a new bitfield. The default constructor creates an empty │ │ │ │ +bitfield. bits is the size of the bitfield (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 bitfield │ │ │ │ +from the specified buffer, and bits number of bits (rounded up to │ │ │ │ +the nearest byte boundary).

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    assign()

    │ │ │ │ +
    │ │ │ │ +void assign (char const* b, int const bits);
    │ │ │ │ +
    │ │ │ │ +

    copy bitfield from buffer b of bits number of bits, rounded up to │ │ │ │ +the nearest byte boundary.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    get_bit() operator[]()

    │ │ │ │ +
    │ │ │ │ +bool operator[] (int index) const noexcept;
    │ │ │ │ +bool get_bit (int index) const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    query bit at index. Returns true if bit is 1, otherwise false.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_bit() clear_bit()

    │ │ │ │ +
    │ │ │ │ +void set_bit (int index) noexcept;
    │ │ │ │ +void clear_bit (int index) noexcept;
    │ │ │ │ +
    │ │ │ │ +

    set bit at index to 0 (clear_bit) or 1 (set_bit).

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    all_set()

    │ │ │ │ +
    │ │ │ │ +bool all_set () const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    returns true if all bits in the bitfield are set

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    none_set()

    │ │ │ │ +
    │ │ │ │ +bool none_set () const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    returns true if no bit in the bitfield is set

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    size()

    │ │ │ │ +
    │ │ │ │ +int size () const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    returns the size of the bitfield in bits.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    num_words()

    │ │ │ │ +
    │ │ │ │ +int num_words () const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    returns the number of 32 bit words are needed to represent all bits in │ │ │ │ +this bitfield.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    num_bytes()

    │ │ │ │ +
    │ │ │ │ +int num_bytes () const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    returns the number of bytes needed to represent all bits in this │ │ │ │ +bitfield

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    empty()

    │ │ │ │ +
    │ │ │ │ +bool empty () const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    returns true if the bitfield has zero size.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    data()

    │ │ │ │ +
    │ │ │ │ +char const* data () const noexcept;
    │ │ │ │ +char* data () noexcept;
    │ │ │ │ +
    │ │ │ │ +

    returns a pointer to the internal buffer of the bitfield, or │ │ │ │ +nullptr if it's empty.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    swap()

    │ │ │ │ +
    │ │ │ │ +void swap (bitfield& rhs) noexcept;
    │ │ │ │ +
    │ │ │ │ +

    swaps the bit-fields two variables refer to

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    count()

    │ │ │ │ +
    │ │ │ │ +int count () const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    count the number of bits in the bitfield that are set to 1.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    find_first_set()

    │ │ │ │ +
    │ │ │ │ +int find_first_set () const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    returns the index of the first set bit in the bitfield, i.e. 1 bit.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    find_last_clear()

    │ │ │ │ +
    │ │ │ │ +int find_last_clear () const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    returns the index to the last cleared bit in the bitfield, i.e. 0 bit.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    hasher

    │ │ │ │ +

    Declared in "libtorrent/hasher.hpp"

    │ │ │ │ +

    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 hasher parts of it at a time. When │ │ │ │ +You have fed the hasher 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 hasher 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
    │ │ │ │ +{
    │ │ │ │ +   hasher ();
    │ │ │ │ +   hasher (hasher const&);
    │ │ │ │ +   hasher (char const* data, int len);
    │ │ │ │ +   explicit hasher (span<char const> data);
    │ │ │ │ +   hasher& operator= (hasher const&) &;
    │ │ │ │ +   hasher& update (span<char const> data);
    │ │ │ │ +   hasher& update (char const* data, int len);
    │ │ │ │ +   sha1_hash final ();
    │ │ │ │ +   void reset ();
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    hasher() operator=()

    │ │ │ │ +
    │ │ │ │ +hasher (hasher const&);
    │ │ │ │ +hasher (char const* data, int len);
    │ │ │ │ +explicit hasher (span<char const> data);
    │ │ │ │ +hasher& operator= (hasher const&) &;
    │ │ │ │ +
    │ │ │ │ +

    this is the same as default constructing followed by a call to │ │ │ │ +update(data, len).

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    update()

    │ │ │ │ +
    │ │ │ │ +hasher& update (span<char const> data);
    │ │ │ │ +hasher& update (char const* data, int len);
    │ │ │ │ +
    │ │ │ │ +

    append the following bytes to what is being hashed

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    final()

    │ │ │ │ +
    │ │ │ │ +sha1_hash final ();
    │ │ │ │ +
    │ │ │ │ +

    returns the SHA-1 digest of the buffers previously passed to │ │ │ │ +update() and the hasher constructor.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    reset()

    │ │ │ │ +
    │ │ │ │ +void reset ();
    │ │ │ │ +
    │ │ │ │ +

    restore the hasher state to be as if the hasher has just been │ │ │ │ +default constructed.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    hasher256

    │ │ │ │ +

    Declared in "libtorrent/hasher.hpp"

    │ │ │ │ +
    │ │ │ │ +class hasher256
    │ │ │ │ +{
    │ │ │ │ +   hasher256 ();
    │ │ │ │ +   hasher256 (hasher256 const&);
    │ │ │ │ +   hasher256& operator= (hasher256 const&) &;
    │ │ │ │ +   explicit hasher256 (span<char const> data);
    │ │ │ │ +   hasher256 (char const* data, int len);
    │ │ │ │ +   hasher256& update (char const* data, int len);
    │ │ │ │ +   hasher256& update (span<char const> data);
    │ │ │ │ +   sha256_hash final ();
    │ │ │ │ +   void reset ();
    │ │ │ │ +   ~hasher256 ();
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    operator=() hasher256()

    │ │ │ │ +
    │ │ │ │ +hasher256 (hasher256 const&);
    │ │ │ │ +hasher256& operator= (hasher256 const&) &;
    │ │ │ │ +explicit hasher256 (span<char const> data);
    │ │ │ │ +hasher256 (char const* data, int len);
    │ │ │ │ +
    │ │ │ │ +

    this is the same as default constructing followed by a call to │ │ │ │ +update(data, len).

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    update()

    │ │ │ │ +
    │ │ │ │ +hasher256& update (char const* data, int len);
    │ │ │ │ +hasher256& update (span<char const> data);
    │ │ │ │ +
    │ │ │ │ +

    append the following bytes to what is being hashed

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    final()

    │ │ │ │ +
    │ │ │ │ +sha256_hash final ();
    │ │ │ │ +
    │ │ │ │ +

    returns the SHA-1 digest of the buffers previously passed to │ │ │ │ +update() and the hasher constructor.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    reset()

    │ │ │ │ +
    │ │ │ │ +void reset ();
    │ │ │ │ +
    │ │ │ │ +

    restore the hasher state to be as if the hasher has just been │ │ │ │ +default constructed.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    web_seed_entry

    │ │ │ │ +

    Declared in "libtorrent/torrent_info.hpp"

    │ │ │ │ +

    the web_seed_entry 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 BEP 17 and BEP 19.

    │ │ │ │ +
    │ │ │ │ +struct web_seed_entry
    │ │ │ │ +{
    │ │ │ │ +   bool operator== (web_seed_entry const& e) const;
    │ │ │ │ +   bool operator< (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;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    operator==()

    │ │ │ │ +
    │ │ │ │ +bool operator== (web_seed_entry const& e) const;
    │ │ │ │ +
    │ │ │ │ +

    URL and type comparison

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    operator<()

    │ │ │ │ +
    │ │ │ │ +bool operator< (web_seed_entry const& e) const;
    │ │ │ │ +
    │ │ │ │ +

    URL and type less-than comparison

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum type_t

    │ │ │ │ +

    Declared in "libtorrent/torrent_info.hpp"

    │ │ │ │ +
    │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ │ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefaultvaluedescription
    report_true_downloadedboolfalse
    │ │ │ │ -

    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

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    nametypedefault
    url_seed0 
    strict_end_game_modebooltrue
    http_seed1 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ +[report issue]
    │ │ │ │ +
    url
    │ │ │ │ +
    The URL of the web seed
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    auth
    │ │ │ │ +
    Optional authentication. If this is set, it's passed │ │ │ │ +in as HTTP basic auth to the web seed. The format is: │ │ │ │ +username:password.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    extra_headers
    │ │ │ │ +
    Any extra HTTP headers that need to be passed to the web seed
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    type
    │ │ │ │ +
    The type of web seed (see type_t)
    │ │ │ │ +
    │ │ │ │ +[report issue] │ │ │ │ + │ │ │ │ +
    │ │ │ │ +

    load_torrent_limits

    │ │ │ │ +

    Declared in "libtorrent/torrent_info.hpp"

    │ │ │ │ +

    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 max_buffer_size  = 10000000;
    │ │ │ │ +   int max_pieces  = 0x200000;
    │ │ │ │ +   int max_decode_depth  = 100;
    │ │ │ │ +   int max_decode_tokens  = 3000000;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    max_buffer_size
    │ │ │ │ +
    the max size of a .torrent file to load into RAM
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    max_pieces
    │ │ │ │ +
    the max number of pieces allowed in the torrent
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    max_decode_depth
    │ │ │ │ +
    the max recursion depth in the bdecoded structure
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    max_decode_tokens
    │ │ │ │ +
    the max number of bdecode tokens
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    torrent_info

    │ │ │ │ +

    Declared in "libtorrent/torrent_info.hpp"

    │ │ │ │ +

    the torrent_info class holds the information found in a .torrent file.

    │ │ │ │ +
    │ │ │ │ +class torrent_info
    │ │ │ │ +{
    │ │ │ │ +   torrent_info (std::string const& filename, error_code& ec);
    │ │ │ │ +   torrent_info (span<char const> buffer, error_code& ec, from_span_t);
    │ │ │ │ +   torrent_info (bdecode_node const& torrent_file, error_code& ec);
    │ │ │ │ +   explicit torrent_info (std::string const& filename);
    │ │ │ │ +   explicit torrent_info (span<char const> buffer, from_span_t);
    │ │ │ │ +   torrent_info (char const* buffer, int size);
    │ │ │ │ +   torrent_info (torrent_info const& t);
    │ │ │ │ +   explicit torrent_info (info_hash_t const& info_hash);
    │ │ │ │ +   torrent_info (char const* buffer, int size, error_code& ec);
    │ │ │ │ +   torrent_info (span<char const> buffer, load_torrent_limits const& cfg, from_span_t);
    │ │ │ │ +   torrent_info (bdecode_node const& torrent_file, load_torrent_limits const& cfg);
    │ │ │ │ +   torrent_info (std::string const& filename, load_torrent_limits const& cfg);
    │ │ │ │ +   explicit torrent_info (bdecode_node const& torrent_file);
    │ │ │ │ +   ~torrent_info ();
    │ │ │ │ +   file_storage const& files () const;
    │ │ │ │ +   file_storage const& orig_files () const;
    │ │ │ │ +   void rename_file (file_index_t index, std::string const& new_filename);
    │ │ │ │ +   void remap_files (file_storage const& f);
    │ │ │ │ +   void add_tracker (std::string const& url, int tier
    │ │ │ │ +      , announce_entry::tracker_source source);
    │ │ │ │ +   std::vector<announce_entry> const& trackers () const;
    │ │ │ │ +   void add_tracker (std::string const& url, int tier = 0);
    │ │ │ │ +   void clear_trackers ();
    │ │ │ │ +   std::vector<sha1_hash> similar_torrents () const;
    │ │ │ │ +   std::vector<std::string> collections () const;
    │ │ │ │ +   std::vector<web_seed_entry> const& web_seeds () const;
    │ │ │ │ +   void add_url_seed (std::string const& url
    │ │ │ │ +      , std::string const& ext_auth = std::string()
    │ │ │ │ +      , web_seed_entry::headers_t const& ext_headers = web_seed_entry::headers_t());
    │ │ │ │ +   void set_web_seeds (std::vector<web_seed_entry> seeds);
    │ │ │ │ +   void add_http_seed (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::int64_t total_size () const;
    │ │ │ │ +   int piece_length () const;
    │ │ │ │ +   int num_pieces () const;
    │ │ │ │ +   int blocks_per_piece () const;
    │ │ │ │ +   piece_index_t last_piece () const;
    │ │ │ │ +   index_range<piece_index_t> piece_range () const;
    │ │ │ │ +   piece_index_t end_piece () const;
    │ │ │ │ +   info_hash_t const& info_hashes () const;
    │ │ │ │ +   sha1_hash info_hash () const noexcept;
    │ │ │ │ +   bool v2 () const;
    │ │ │ │ +   bool v1 () const;
    │ │ │ │ +   int num_files () const;
    │ │ │ │ +   std::vector<file_slice> map_block (piece_index_t const piece
    │ │ │ │ +      , std::int64_t offset, int size) const;
    │ │ │ │ +   peer_request map_file (file_index_t const file, std::int64_t offset, int size) const;
    │ │ │ │ +   string_view ssl_cert () const;
    │ │ │ │ +   bool is_valid () const;
    │ │ │ │ +   bool priv () const;
    │ │ │ │ +   bool is_i2p () const;
    │ │ │ │ +   int piece_size (piece_index_t index) const;
    │ │ │ │ +   sha1_hash hash_for_piece (piece_index_t index) const;
    │ │ │ │ +   char const* hash_for_piece_ptr (piece_index_t const index) const;
    │ │ │ │ +   bool is_loaded () const;
    │ │ │ │ +   const std::string& name () const;
    │ │ │ │ +   std::time_t creation_date () const;
    │ │ │ │ +   const std::string& creator () const;
    │ │ │ │ +   const std::string& comment () const;
    │ │ │ │ +   std::vector<std::pair<std::string, int>> const& nodes () const;
    │ │ │ │ +   void add_node (std::pair<std::string, int> const& node);
    │ │ │ │ +   bool parse_info_section (bdecode_node const& info, error_code& ec, int max_pieces);
    │ │ │ │ +   bdecode_node info (char const* key) const;
    │ │ │ │ +   span<char const> info_section () const;
    │ │ │ │ +   span<char const> piece_layer (file_index_t) const;
    │ │ │ │ +   void free_piece_layers ();
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    torrent_info()

    │ │ │ │ +
    │ │ │ │ +torrent_info (std::string const& filename, error_code& ec);
    │ │ │ │ +torrent_info (span<char const> buffer, error_code& ec, from_span_t);
    │ │ │ │ +torrent_info (bdecode_node const& torrent_file, error_code& ec);
    │ │ │ │ +explicit torrent_info (std::string const& filename);
    │ │ │ │ +explicit torrent_info (span<char const> buffer, from_span_t);
    │ │ │ │ +torrent_info (char const* buffer, int size);
    │ │ │ │ +torrent_info (torrent_info const& t);
    │ │ │ │ +explicit torrent_info (info_hash_t const& info_hash);
    │ │ │ │ +torrent_info (char const* buffer, int size, error_code& ec);
    │ │ │ │ +torrent_info (span<char const> buffer, load_torrent_limits const& cfg, from_span_t);
    │ │ │ │ +torrent_info (bdecode_node const& torrent_file, load_torrent_limits const& cfg);
    │ │ │ │ +torrent_info (std::string const& filename, load_torrent_limits const& cfg);
    │ │ │ │ +explicit torrent_info (bdecode_node const& torrent_file);
    │ │ │ │ +
    │ │ │ │ +

    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 bdecode_node will create a torrent_info │ │ │ │ +object from the information found in the given torrent_file. The │ │ │ │ +bdecode_node represents a tree node in an bencoded file. To load an │ │ │ │ +ordinary .torrent file into a bdecode_node, use bdecode().

    │ │ │ │ +

    The version that takes a buffer pointer and a size will decode it as a │ │ │ │ +.torrent file and initialize the torrent_info 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 torrent_info 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    ~torrent_info()

    │ │ │ │ +
    │ │ │ │ +~torrent_info ();
    │ │ │ │ +
    │ │ │ │ +

    frees all storage associated with this torrent_info object

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    files() orig_files()

    │ │ │ │ +
    │ │ │ │ +file_storage const& files () const;
    │ │ │ │ +file_storage const& orig_files () const;
    │ │ │ │ +
    │ │ │ │ +

    The file_storage object contains the information on how to map the │ │ │ │ +pieces to files. It is separated from the torrent_info 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 file_storage 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 file_storage object, see the separate │ │ │ │ +document on how to create torrents.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    rename_file()

    │ │ │ │ +
    │ │ │ │ +void rename_file (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 files() and │ │ │ │ +orig_files() ), change the name, and then use remap_files().

    │ │ │ │ +

    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 move_storage() is │ │ │ │ +invoked.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    remap_files()

    │ │ │ │ +
    │ │ │ │ +void remap_files (file_storage const& f);
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    Warning

    │ │ │ │ +

    Using remap_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 disk_interface │ │ │ │ +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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    trackers() clear_trackers() add_tracker()

    │ │ │ │ +
    │ │ │ │ +void add_tracker (std::string const& url, int tier
    │ │ │ │ +      , announce_entry::tracker_source source);
    │ │ │ │ +std::vector<announce_entry> const& trackers () const;
    │ │ │ │ +void add_tracker (std::string const& url, int tier = 0);
    │ │ │ │ +void clear_trackers ();
    │ │ │ │ +
    │ │ │ │ +

    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 │ │ │ │ +announce_entry. Each announce entry 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 announce_entry.

    │ │ │ │ +

    trackers() returns all entries from announce-list.

    │ │ │ │ +

    clear_trackers() removes all trackers from announce-list.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    similar_torrents() collections()

    │ │ │ │ +
    │ │ │ │ +std::vector<sha1_hash> similar_torrents () const;
    │ │ │ │ +std::vector<std::string> collections () const;
    │ │ │ │ +
    │ │ │ │ +

    These two functions are related to BEP 38 (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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_http_seed() add_url_seed() web_seeds() set_web_seeds()

    │ │ │ │ +
    │ │ │ │ +std::vector<web_seed_entry> const& web_seeds () const;
    │ │ │ │ +void add_url_seed (std::string const& url
    │ │ │ │ +      , std::string const& ext_auth = std::string()
    │ │ │ │ +      , web_seed_entry::headers_t const& ext_headers = web_seed_entry::headers_t());
    │ │ │ │ +void set_web_seeds (std::vector<web_seed_entry> seeds);
    │ │ │ │ +void add_http_seed (std::string const& url
    │ │ │ │ +      , std::string const& extern_auth = std::string()
    │ │ │ │ +      , web_seed_entry::headers_t const& extra_headers = web_seed_entry::headers_t());
    │ │ │ │ +
    │ │ │ │ +

    web_seeds() returns all url seeds and http seeds in the torrent. │ │ │ │ +Each entry 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 http seeding for more information.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    total_size()

    │ │ │ │ +
    │ │ │ │ +std::int64_t total_size () 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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    piece_length() num_pieces()

    │ │ │ │ +
    │ │ │ │ +int piece_length () const;
    │ │ │ │ +int num_pieces () 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    blocks_per_piece()

    │ │ │ │ +
    │ │ │ │ +int blocks_per_piece () const;
    │ │ │ │ +
    │ │ │ │ +

    returns the number of blocks there are in the typical piece. There │ │ │ │ +may be fewer in the last piece)

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    last_piece() end_piece() piece_range()

    │ │ │ │ +
    │ │ │ │ +piece_index_t last_piece () const;
    │ │ │ │ +index_range<piece_index_t> piece_range () const;
    │ │ │ │ +piece_index_t end_piece () 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 file_storage.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    info_hashes() info_hash()

    │ │ │ │ +
    │ │ │ │ +info_hash_t const& info_hashes () const;
    │ │ │ │ +sha1_hash info_hash () 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

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    v1() v2()

    │ │ │ │ +
    │ │ │ │ +bool v2 () const;
    │ │ │ │ +bool v1 () 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    num_files()

    │ │ │ │ +
    │ │ │ │ +int num_files () 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    map_block()

    │ │ │ │ +
    │ │ │ │ +std::vector<file_slice> map_block (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 file_slice.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    map_file()

    │ │ │ │ +
    │ │ │ │ +peer_request map_file (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 peer_request.

    │ │ │ │ +

    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().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    ssl_cert()

    │ │ │ │ +
    │ │ │ │ +string_view ssl_cert () 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    is_valid()

    │ │ │ │ +
    │ │ │ │ +bool is_valid () const;
    │ │ │ │ +
    │ │ │ │ +

    returns true if this torrent_info object has a torrent loaded. │ │ │ │ +This is primarily used to determine if a magnet link has had its │ │ │ │ +metadata resolved yet or not.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    priv()

    │ │ │ │ +
    │ │ │ │ +bool priv () 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    is_i2p()

    │ │ │ │ +
    │ │ │ │ +bool is_i2p () 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    piece_size()

    │ │ │ │ +
    │ │ │ │ +int piece_size (piece_index_t index) const;
    │ │ │ │ +
    │ │ │ │ +

    returns the piece size of file with index. This will be the same as piece_length(), │ │ │ │ +except for the last piece, which may be shorter.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    hash_for_piece_ptr() hash_for_piece()

    │ │ │ │ +
    │ │ │ │ +sha1_hash hash_for_piece (piece_index_t index) const;
    │ │ │ │ +char const* hash_for_piece_ptr (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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    name()

    │ │ │ │ +
    │ │ │ │ +const std::string& name () const;
    │ │ │ │ +
    │ │ │ │ +

    name() returns the name of the torrent. │ │ │ │ +name contains UTF-8 encoded string.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    creation_date()

    │ │ │ │ +
    │ │ │ │ +std::time_t creation_date () const;
    │ │ │ │ +
    │ │ │ │ +

    creation_date() returns the creation date of the torrent as time_t │ │ │ │ +(posix time). If there's no time stamp in the torrent file, 0 is │ │ │ │ +returned. │ │ │ │ +.. posix time: http://www.opengroup.org/onlinepubs/009695399/functions/time.html

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    creator()

    │ │ │ │ +
    │ │ │ │ +const std::string& creator () const;
    │ │ │ │ +
    │ │ │ │ +

    creator() returns the creator string in the torrent. If there is │ │ │ │ +no creator string it will return an empty string.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    comment()

    │ │ │ │ +
    │ │ │ │ +const std::string& comment () 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    nodes()

    │ │ │ │ +
    │ │ │ │ +std::vector<std::pair<std::string, int>> const& nodes () const;
    │ │ │ │ +
    │ │ │ │ +

    If this torrent contains any DHT nodes, they are put in this vector in │ │ │ │ +their original form (host name and port number).

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_node()

    │ │ │ │ +
    │ │ │ │ +void add_node (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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    parse_info_section()

    │ │ │ │ +
    │ │ │ │ +bool parse_info_section (bdecode_node const& info, error_code& ec, int max_pieces);
    │ │ │ │ +
    │ │ │ │ +

    populates the torrent_info 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 bdecode_node e points to a │ │ │ │ +parsed info-dictionary. ec returns an error code if something │ │ │ │ +fails (typically if the info dictionary is malformed). │ │ │ │ +The max_pieces 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 settings_pack::max_piece_count and in calls to │ │ │ │ +read_resume_data().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    info()

    │ │ │ │ +
    │ │ │ │ +bdecode_node info (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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    info_section()

    │ │ │ │ +
    │ │ │ │ +span<char const> info_section () const;
    │ │ │ │ +
    │ │ │ │ +

    returns a the raw info section of the torrent file. │ │ │ │ +The underlying buffer is still owned by the torrent_info object

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    piece_layer()

    │ │ │ │ +
    │ │ │ │ +span<char const> piece_layer (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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    free_piece_layers()

    │ │ │ │ +
    │ │ │ │ +void free_piece_layers ();
    │ │ │ │ +
    │ │ │ │ +

    clears the piece layers from the torrent_info. This is done by the │ │ │ │ +session 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    announce_infohash

    │ │ │ │ +

    Declared in "libtorrent/announce_entry.hpp"

    │ │ │ │ +
    │ │ │ │ +struct announce_infohash
    │ │ │ │ +{
    │ │ │ │ +   std::string message;
    │ │ │ │ +   error_code last_error;
    │ │ │ │ +   int scrape_incomplete  = -1;
    │ │ │ │ +   int scrape_complete  = -1;
    │ │ │ │ +   int scrape_downloaded  = -1;
    │ │ │ │ +   std::uint8_t fails : 7;
    │ │ │ │ +   bool updating : 1;
    │ │ │ │ +   bool start_sent : 1;
    │ │ │ │ +   bool complete_sent : 1;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    message
    │ │ │ │ +
    if this tracker has returned an error or warning message │ │ │ │ +that message is stored here
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    last_error
    │ │ │ │ +
    if this tracker failed the last time it was contacted │ │ │ │ +this error code specifies what error occurred
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    scrape_incomplete scrape_complete scrape_downloaded
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    fails
    │ │ │ │ +
    the number of times in a row we have failed to announce to this │ │ │ │ +tracker.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    updating
    │ │ │ │ +
    true while we're waiting for a response from the tracker.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    start_sent
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    complete_sent
    │ │ │ │ +
    set to true when we send a event=completed.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    announce_endpoint

    │ │ │ │ +

    Declared in "libtorrent/announce_entry.hpp"

    │ │ │ │ +

    announces are sent to each tracker using every listen socket │ │ │ │ +this class holds information about one listen socket for one tracker

    │ │ │ │ +
    │ │ │ │ +struct announce_endpoint
    │ │ │ │ +{
    │ │ │ │ +   announce_endpoint ();
    │ │ │ │ +
    │ │ │ │ +   tcp::endpoint local_endpoint;
    │ │ │ │ +   aux::array<announce_infohash, num_protocols, protocol_version> info_hashes;
    │ │ │ │ +   bool enabled  = true;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    local_endpoint
    │ │ │ │ +
    the local endpoint of the listen interface associated with this endpoint
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    info_hashes
    │ │ │ │ +
    info_hashes[0] is the v1 info hash (SHA1) │ │ │ │ +info_hashes[1] is the v2 info hash (truncated SHA-256)
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    enabled
    │ │ │ │ +
    set to false to not announce from this endpoint
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    announce_entry

    │ │ │ │ +

    Declared in "libtorrent/announce_entry.hpp"

    │ │ │ │ +

    this class holds information about one bittorrent tracker, as it │ │ │ │ +relates to a specific torrent.

    │ │ │ │ +
    │ │ │ │ +struct announce_entry
    │ │ │ │ +{
    │ │ │ │ +   explicit announce_entry (string_view u);
    │ │ │ │ +   announce_entry ();
    │ │ │ │ +   announce_entry (announce_entry const&);
    │ │ │ │ +   ~announce_entry ();
    │ │ │ │ +   announce_entry& operator= (announce_entry const&) &;
    │ │ │ │ +
    │ │ │ │ +   enum tracker_source
    │ │ │ │ +   {
    │ │ │ │ +      source_torrent,
    │ │ │ │ +      source_client,
    │ │ │ │ +      source_magnet_link,
    │ │ │ │ +      source_tex,
    │ │ │ │ +   };
    │ │ │ │ +
    │ │ │ │ +   std::string url;
    │ │ │ │ +   std::string trackerid;
    │ │ │ │ +   std::vector<announce_endpoint> endpoints;
    │ │ │ │ +   std::uint8_t tier  = 0;
    │ │ │ │ +   std::uint8_t fail_limit  = 0;
    │ │ │ │ +   std::uint8_t source:4;
    │ │ │ │ +   bool verified:1;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    operator=() announce_entry() ~announce_entry()

    │ │ │ │ +
    │ │ │ │ +explicit announce_entry (string_view u);
    │ │ │ │ +announce_entry ();
    │ │ │ │ +announce_entry (announce_entry const&);
    │ │ │ │ +~announce_entry ();
    │ │ │ │ +announce_entry& operator= (announce_entry const&) &;
    │ │ │ │ +
    │ │ │ │ +

    constructs a tracker announce entry with u as the URL.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum tracker_source

    │ │ │ │ +

    Declared in "libtorrent/announce_entry.hpp"

    │ │ │ │ +
    │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefaultvaluedescription
    enable_outgoing_utpbooltrue
    enable_incoming_utpbooltrue
    enable_outgoing_tcpbooltrue
    source_torrent1the tracker was part of the .torrent file
    enable_incoming_tcpbooltrue
    source_client2the tracker was added programmatically via the add_tracker() function
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    nametypedefault
    source_magnet_link4the tracker was part of a magnet link
    no_recheck_incomplete_resumeboolfalse
    source_tex8the tracker was received from the swarm via tracker exchange
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ +[report issue]
    │ │ │ │ +
    url
    │ │ │ │ +
    tracker URL as it appeared in the torrent file
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    trackerid
    │ │ │ │ +
    the current &trackerid= argument passed to the tracker. │ │ │ │ +this is optional and is normally empty (in which case no │ │ │ │ +trackerid is sent).
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    endpoints
    │ │ │ │ +
    each local listen socket (endpoint) will announce to the tracker. This │ │ │ │ +list contains state per endpoint.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    tier
    │ │ │ │ +
    the tier this tracker belongs to
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    fail_limit
    │ │ │ │ +
    the max number of failures to announce to this tracker in │ │ │ │ +a row, before this tracker is not used anymore. 0 means unlimited
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    source
    │ │ │ │ +
    a bitmask specifying which sources we got this tracker from.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    verified
    │ │ │ │ +
    set to true the first time we receive a valid response │ │ │ │ +from this tracker.
    │ │ │ │ +
    │ │ │ │ +

    Bencoding is a common representation in bittorrent used for dictionary, │ │ │ │ +list, int 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 session 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 BEP 3.

    │ │ │ │ +

    The function for decoding bencoded data bdecode(), returning a bdecode_node. │ │ │ │ +This function builds a tree that points back into the original buffer. The │ │ │ │ +returned bdecode_node will not be valid once the buffer it was parsed out of │ │ │ │ +is discarded.

    │ │ │ │ +

    It's possible to construct an entry from a bdecode_node, if a structure needs │ │ │ │ +to be altered and re-encoded.

    │ │ │ │ +[report issue] │ │ │ │ + │ │ │ │ +
    │ │ │ │ +

    entry

    │ │ │ │ +

    Declared in "libtorrent/entry.hpp"

    │ │ │ │ +

    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 type () const;
    │ │ │ │ +   entry (preformatted_type);
    │ │ │ │ +   entry (list_type);
    │ │ │ │ +   entry (span<char const>);
    │ │ │ │ +   entry (dictionary_type);
    │ │ │ │ +   entry (integer_type);
    │ │ │ │ +   entry (U v);
    │ │ │ │ +   entry (data_type t);
    │ │ │ │ +   entry (bdecode_node const& n);
    │ │ │ │ +   entry& operator= (bdecode_node const&) &;
    │ │ │ │ +   entry& operator= (span<char const>) &;
    │ │ │ │ +   entry& operator= (integer_type) &;
    │ │ │ │ +   entry& operator= (preformatted_type) &;
    │ │ │ │ +   entry& operator= (entry&&) & noexcept;
    │ │ │ │ +   entry& operator= (dictionary_type) &;
    │ │ │ │ +   entry& operator= (entry const&) &;
    │ │ │ │ +   entry& operator= (list_type) &;
    │ │ │ │ +   entry& operator= (U v) &;
    │ │ │ │ +   preformatted_type& preformatted ();
    │ │ │ │ +   preformatted_type const& preformatted () const;
    │ │ │ │ +   string_type& string ();
    │ │ │ │ +   dictionary_type& dict ();
    │ │ │ │ +   string_type const& string () const;
    │ │ │ │ +   integer_type& integer ();
    │ │ │ │ +   dictionary_type const& dict () const;
    │ │ │ │ +   integer_type const& integer () const;
    │ │ │ │ +   list_type const& list () const;
    │ │ │ │ +   list_type& list ();
    │ │ │ │ +   void swap (entry& e);
    │ │ │ │ +   entry const& operator[] (string_view key) const;
    │ │ │ │ +   entry& operator[] (string_view key);
    │ │ │ │ +   entry const* find_key (string_view key) const;
    │ │ │ │ +   entry* find_key (string_view key);
    │ │ │ │ +   std::string to_string (bool single_line = false) const;
    │ │ │ │ +
    │ │ │ │ +   enum data_type
    │ │ │ │ +   {
    │ │ │ │ +      int_t,
    │ │ │ │ +      string_t,
    │ │ │ │ +      list_t,
    │ │ │ │ +      dictionary_t,
    │ │ │ │ +      undefined_t,
    │ │ │ │ +      preformatted_t,
    │ │ │ │ +   };
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    type()

    │ │ │ │ +
    │ │ │ │ +data_type type () const;
    │ │ │ │ +
    │ │ │ │ +

    returns the concrete type of the entry

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    entry()

    │ │ │ │ +
    │ │ │ │ +entry (preformatted_type);
    │ │ │ │ +entry (list_type);
    │ │ │ │ +entry (span<char const>);
    │ │ │ │ +entry (dictionary_type);
    │ │ │ │ +entry (integer_type);
    │ │ │ │ +
    │ │ │ │ +

    constructors directly from a specific type. │ │ │ │ +The content of the argument is copied into the │ │ │ │ +newly constructed entry

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    entry()

    │ │ │ │ +
    │ │ │ │ +entry (data_type t);
    │ │ │ │ +
    │ │ │ │ +

    construct an empty entry of the specified type. │ │ │ │ +see data_type enum.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    entry()

    │ │ │ │ +
    │ │ │ │ +entry (bdecode_node const& n);
    │ │ │ │ +
    │ │ │ │ +

    construct from bdecode_node parsed form (see bdecode())

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    operator=()

    │ │ │ │ +
    │ │ │ │ +entry& operator= (bdecode_node const&) &;
    │ │ │ │ +entry& operator= (span<char const>) &;
    │ │ │ │ +entry& operator= (integer_type) &;
    │ │ │ │ +entry& operator= (preformatted_type) &;
    │ │ │ │ +entry& operator= (entry&&) & noexcept;
    │ │ │ │ +entry& operator= (dictionary_type) &;
    │ │ │ │ +entry& operator= (entry const&) &;
    │ │ │ │ +entry& operator= (list_type) &;
    │ │ │ │ +
    │ │ │ │ +

    copies the structure of the right hand side into this │ │ │ │ +entry.

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    integer() preformatted() string() list() dict()

    │ │ │ │ +
    │ │ │ │ +preformatted_type& preformatted ();
    │ │ │ │ +preformatted_type const& preformatted () const;
    │ │ │ │ +string_type& string ();
    │ │ │ │ +dictionary_type& dict ();
    │ │ │ │ +string_type const& string () const;
    │ │ │ │ +integer_type& integer ();
    │ │ │ │ +dictionary_type const& dict () const;
    │ │ │ │ +integer_type const& integer () const;
    │ │ │ │ +list_type const& list () const;
    │ │ │ │ +list_type& list ();
    │ │ │ │ +
    │ │ │ │ +

    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 torrent_info exists.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    swap()

    │ │ │ │ +
    │ │ │ │ +void swap (entry& e);
    │ │ │ │ +
    │ │ │ │ +

    swaps the content of this with e.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    operator[]()

    │ │ │ │ +
    │ │ │ │ +entry const& operator[] (string_view key) const;
    │ │ │ │ +entry& operator[] (string_view key);
    │ │ │ │ +
    │ │ │ │ +

    All of these functions requires the entry 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    find_key()

    │ │ │ │ +
    │ │ │ │ +entry const* find_key (string_view key) const;
    │ │ │ │ +entry* find_key (string_view key);
    │ │ │ │ +
    │ │ │ │ +

    These functions requires the entry 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    to_string()

    │ │ │ │ +
    │ │ │ │ +std::string to_string (bool single_line = false) const;
    │ │ │ │ +
    │ │ │ │ +

    returns a pretty-printed string representation │ │ │ │ +of the bencoded structure, with JSON-style syntax

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum data_type

    │ │ │ │ +

    Declared in "libtorrent/entry.hpp"

    │ │ │ │ +
    │ │ │ │ │ │ │ │ -│ │ │ │ +│ │ │ │ │ │ │ │ -│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefaultvaluedescription
    anonymous_modeboolfalse
    int_t0 
    │ │ │ │ -

    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.
    • │ │ │ │ -
    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    string_t1 
    report_web_seed_downloadsbooltrue
    list_t2 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    nametypedefault
    dictionary_t3 
    seeding_outgoing_connectionsbooltrue
    undefined_t4 
    preformatted_t5 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ +[report issue] │ │ │ │ + │ │ │ │ +
    │ │ │ │ +

    operator<<()

    │ │ │ │ +

    Declared in "libtorrent/entry.hpp"

    │ │ │ │ +
    │ │ │ │ +inline std::ostream& operator<< (std::ostream& os, const entry& e);
    │ │ │ │ +
    │ │ │ │ +

    prints the bencoded structure to the ostream as a JSON-style structure.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    bencode()

    │ │ │ │ +

    Declared in "libtorrent/bencode.hpp"

    │ │ │ │ +
    │ │ │ │ +template<class OutIt> int bencode (OutIt out, const entry& e);
    │ │ │ │ +
    │ │ │ │ +

    This function will encode data to bencoded form.

    │ │ │ │ +

    The entry class is the internal representation of the bencoded data │ │ │ │ +and it can be used to retrieve information, an entry can also be build by │ │ │ │ +the program and given to bencode() to encode it into the OutIt │ │ │ │ +iterator.

    │ │ │ │ +

    OutIt is an OutputIterator. It's a template and usually │ │ │ │ +instantiated as ostream_iterator or back_insert_iterator. This │ │ │ │ +function assumes the value_type of the iterator is a char. │ │ │ │ +In order to encode entry e into a buffer, do:

    │ │ │ │ +
    │ │ │ │ +std::vector<char> buf;
    │ │ │ │ +bencode(std::back_inserter(buf), e);
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_slice

    │ │ │ │ +

    Declared in "libtorrent/file_storage.hpp"

    │ │ │ │ +

    represents a window of a file in a torrent.

    │ │ │ │ +

    The file_index refers to the index of the file (in the torrent_info). │ │ │ │ +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;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    file_index
    │ │ │ │ +
    the index of the file
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    offset
    │ │ │ │ +
    the offset from the start of the file, in bytes
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    size
    │ │ │ │ +
    the size of the window, in bytes
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_storage

    │ │ │ │ +

    Declared in "libtorrent/file_storage.hpp"

    │ │ │ │ +

    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 is_valid () const;
    │ │ │ │ +   void reserve (int num_files);
    │ │ │ │ +   void add_file_borrow (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 add_file (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 add_file (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 add_file_borrow (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 rename_file (file_index_t index, std::string const& new_filename);
    │ │ │ │ +   std::vector<file_slice> map_block (piece_index_t piece, std::int64_t offset
    │ │ │ │ +      , std::int64_t size) const;
    │ │ │ │ +   peer_request map_file (file_index_t file, std::int64_t offset, int size) const;
    │ │ │ │ +   int num_files () const noexcept;
    │ │ │ │ +   file_index_t end_file () const noexcept;
    │ │ │ │ +   index_range<file_index_t> file_range () const noexcept;
    │ │ │ │ +   std::int64_t total_size () const;
    │ │ │ │ +   void set_num_pieces (int n);
    │ │ │ │ +   int num_pieces () const;
    │ │ │ │ +   piece_index_t end_piece () const;
    │ │ │ │ +   piece_index_t last_piece () const;
    │ │ │ │ +   index_range<piece_index_t> piece_range () const noexcept;
    │ │ │ │ +   void set_piece_length (int l);
    │ │ │ │ +   int piece_length () const;
    │ │ │ │ +   int piece_size (piece_index_t index) const;
    │ │ │ │ +   int piece_size2 (piece_index_t index) const;
    │ │ │ │ +   int blocks_in_piece2 (piece_index_t index) const;
    │ │ │ │ +   int blocks_per_piece () const;
    │ │ │ │ +   std::string const& name () const;
    │ │ │ │ +   void set_name (std::string const& n);
    │ │ │ │ +   void swap (file_storage& ti) noexcept;
    │ │ │ │ +   void canonicalize ();
    │ │ │ │ +   sha1_hash hash (file_index_t index) const;
    │ │ │ │ +   bool pad_file_at (file_index_t index) const;
    │ │ │ │ +   string_view file_name (file_index_t index) const;
    │ │ │ │ +   std::int64_t file_offset (file_index_t index) const;
    │ │ │ │ +   std::time_t mtime (file_index_t index) const;
    │ │ │ │ +   std::string symlink (file_index_t index) const;
    │ │ │ │ +   std::string file_path (file_index_t index, std::string const& save_path = "") const;
    │ │ │ │ +   std::int64_t file_size (file_index_t index) const;
    │ │ │ │ +   char const* root_ptr (file_index_t const index) const;
    │ │ │ │ +   sha256_hash root (file_index_t index) const;
    │ │ │ │ +   index_range<piece_index_t::diff_type> file_piece_range (file_index_t) const;
    │ │ │ │ +   int file_num_pieces (file_index_t index) const;
    │ │ │ │ +   int file_num_blocks (file_index_t index) const;
    │ │ │ │ +   int file_first_piece_node (file_index_t index) const;
    │ │ │ │ +   int file_first_block_node (file_index_t index) const;
    │ │ │ │ +   std::uint32_t file_path_hash (file_index_t index, std::string const& save_path) const;
    │ │ │ │ +   void all_path_hashes (std::unordered_set<std::uint32_t>& table) const;
    │ │ │ │ +   file_flags_t file_flags (file_index_t index) const;
    │ │ │ │ +   bool file_absolute_path (file_index_t index) const;
    │ │ │ │ +   file_index_t file_index_at_piece (piece_index_t piece) const;
    │ │ │ │ +   file_index_t file_index_at_offset (std::int64_t offset) const;
    │ │ │ │ +   file_index_t file_index_for_root (sha256_hash const& root_hash) const;
    │ │ │ │ +   piece_index_t piece_index_at_file (file_index_t f) const;
    │ │ │ │ +   void sanitize_symlinks ();
    │ │ │ │ +   bool v2 () const;
    │ │ │ │ +
    │ │ │ │ +   static constexpr file_flags_t flag_pad_file  = 0_bit;
    │ │ │ │ +   static constexpr file_flags_t flag_hidden  = 1_bit;
    │ │ │ │ +   static constexpr file_flags_t flag_executable  = 2_bit;
    │ │ │ │ +   static constexpr file_flags_t flag_symlink  = 3_bit;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    is_valid()

    │ │ │ │ +
    │ │ │ │ +bool is_valid () const;
    │ │ │ │ +
    │ │ │ │ +

    returns true if the piece length has been initialized │ │ │ │ +on the file_storage. This is typically taken as a proxy │ │ │ │ +of whether the file_storage as a whole is initialized or │ │ │ │ +not.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    reserve()

    │ │ │ │ +
    │ │ │ │ +void reserve (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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_file_borrow() add_file()

    │ │ │ │ +
    │ │ │ │ +void add_file_borrow (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 add_file (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 add_file (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 add_file_borrow (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 borrowed, i.e. it is the caller's │ │ │ │ +responsibility to make sure it stays valid throughout the lifetime │ │ │ │ +of this file_storage 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 file_storage::flag_symlink 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 │ │ │ │ +file_storage object, it will not be copied. This parameter is only │ │ │ │ +used when loading 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 an error_code reference will report failures │ │ │ │ +via that variable, otherwise system_error is thrown.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    rename_file()

    │ │ │ │ +
    │ │ │ │ +void rename_file (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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    map_block()

    │ │ │ │ +
    │ │ │ │ +std::vector<file_slice> map_block (piece_index_t piece, std::int64_t offset
    │ │ │ │ +      , std::int64_t size) const;
    │ │ │ │ +
    │ │ │ │ +

    returns a list of file_slice objects representing the portions of │ │ │ │ +files the specified piece index, byte offset and size range overlaps. │ │ │ │ +this is the inverse mapping of map_file().

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    map_file()

    │ │ │ │ +
    │ │ │ │ +peer_request map_file (file_index_t file, std::int64_t offset, int size) const;
    │ │ │ │ +
    │ │ │ │ +

    returns a peer_request representing the piece index, byte offset │ │ │ │ +and size the specified file range overlaps. This is the inverse │ │ │ │ +mapping over map_block(). 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    num_files()

    │ │ │ │ +
    │ │ │ │ +int num_files () const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    returns the number of files in the file_storage

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    end_file()

    │ │ │ │ +
    │ │ │ │ +file_index_t end_file () const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    returns the index of the one-past-end file in the file storage

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_range()

    │ │ │ │ +
    │ │ │ │ +index_range<file_index_t> file_range () 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 file_storage.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    total_size()

    │ │ │ │ +
    │ │ │ │ +std::int64_t total_size () const;
    │ │ │ │ +
    │ │ │ │ +

    returns the total number of bytes all the files in this torrent spans

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_num_pieces() num_pieces()

    │ │ │ │ +
    │ │ │ │ +void set_num_pieces (int n);
    │ │ │ │ +int num_pieces () const;
    │ │ │ │ +
    │ │ │ │ +

    set and get the number of pieces in the torrent

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    end_piece()

    │ │ │ │ +
    │ │ │ │ +piece_index_t end_piece () const;
    │ │ │ │ +
    │ │ │ │ +

    returns the index of the one-past-end piece in the file storage

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    last_piece()

    │ │ │ │ +
    │ │ │ │ +piece_index_t last_piece () 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).

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    piece_range()

    │ │ │ │ +
    │ │ │ │ +index_range<piece_index_t> piece_range () 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 file_storage.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_piece_length() piece_length()

    │ │ │ │ +
    │ │ │ │ +void set_piece_length (int l);
    │ │ │ │ +int piece_length () const;
    │ │ │ │ +
    │ │ │ │ +

    set and get the size of each piece in this torrent. It must be a power of two │ │ │ │ +and at least 16 kiB.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    piece_size()

    │ │ │ │ +
    │ │ │ │ +int piece_size (piece_index_t index) const;
    │ │ │ │ +
    │ │ │ │ +

    returns the piece size of index. This will be the same as piece_length(), except │ │ │ │ +for the last piece, which may be shorter.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    piece_size2()

    │ │ │ │ +
    │ │ │ │ +int piece_size2 (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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    blocks_in_piece2()

    │ │ │ │ +
    │ │ │ │ +int blocks_in_piece2 (piece_index_t index) const;
    │ │ │ │ +
    │ │ │ │ +

    returns the number of blocks in the specified piece, for v2 torrents.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    blocks_per_piece()

    │ │ │ │ +
    │ │ │ │ +int blocks_per_piece () const;
    │ │ │ │ +
    │ │ │ │ +

    returns the number of blocks there are in the typical piece. There │ │ │ │ +may be fewer in the last piece)

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    name() set_name()

    │ │ │ │ +
    │ │ │ │ +std::string const& name () const;
    │ │ │ │ +void set_name (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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    swap()

    │ │ │ │ +
    │ │ │ │ +void swap (file_storage& ti) noexcept;
    │ │ │ │ +
    │ │ │ │ +

    swap all content of this with ti.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    canonicalize()

    │ │ │ │ +
    │ │ │ │ +void canonicalize ();
    │ │ │ │ +
    │ │ │ │ +

    arrange files and padding to match the canonical form required │ │ │ │ +by BEP 52

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +

    file_num_pieces() file_num_blocks() file_piece_range()

    │ │ │ │ +
    │ │ │ │ +index_range<piece_index_t::diff_type> file_piece_range (file_index_t) const;
    │ │ │ │ +int file_num_pieces (file_index_t index) const;
    │ │ │ │ +int file_num_blocks (file_index_t index) const;
    │ │ │ │ +
    │ │ │ │ +

    Returns the number of pieces or blocks the file at index 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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_first_piece_node() file_first_block_node()

    │ │ │ │ +
    │ │ │ │ +int file_first_piece_node (file_index_t index) const;
    │ │ │ │ +int file_first_block_node (file_index_t index) const;
    │ │ │ │ +
    │ │ │ │ +

    index of first piece node in the merkle tree

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_path_hash()

    │ │ │ │ +
    │ │ │ │ +std::uint32_t file_path_hash (file_index_t index, std::string const& save_path) const;
    │ │ │ │ +
    │ │ │ │ +

    returns the crc32 hash of file_path(index)

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    all_path_hashes()

    │ │ │ │ +
    │ │ │ │ +void all_path_hashes (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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_flags()

    │ │ │ │ +
    │ │ │ │ +file_flags_t file_flags (file_index_t index) const;
    │ │ │ │ +
    │ │ │ │ +

    returns a bitmask of flags from file_flags_t that apply │ │ │ │ +to file at index.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_absolute_path()

    │ │ │ │ +
    │ │ │ │ +bool file_absolute_path (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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_index_at_piece() file_index_at_offset()

    │ │ │ │ +
    │ │ │ │ +file_index_t file_index_at_piece (piece_index_t piece) const;
    │ │ │ │ +file_index_t file_index_at_offset (std::int64_t offset) const;
    │ │ │ │ +
    │ │ │ │ +

    returns the index of the file at the given offset in the torrent

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_index_for_root()

    │ │ │ │ +
    │ │ │ │ +file_index_t file_index_for_root (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

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    piece_index_at_file()

    │ │ │ │ +
    │ │ │ │ +piece_index_t piece_index_at_file (file_index_t f) const;
    │ │ │ │ +
    │ │ │ │ +

    returns the piece index the given file starts at

    │ │ │ │ +[report issue]
    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +

    v2()

    │ │ │ │ +
    │ │ │ │ +bool v2 () const;
    │ │ │ │ +
    │ │ │ │ +

    returns true if this torrent contains v2 metadata.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    flag_hidden
    │ │ │ │ +
    this file has the hidden attribute set. This is primarily │ │ │ │ +a windows attribute
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    flag_executable
    │ │ │ │ +
    this file has the executable attribute set.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    flag_symlink
    │ │ │ │ +
    this file is a symbolic link. It should have a link │ │ │ │ +target string associated with it.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    storage_params

    │ │ │ │ +

    Declared in "libtorrent/storage_defs.hpp"

    │ │ │ │ +

    a parameter pack used to construct the storage for a torrent, used in │ │ │ │ +disk_interface

    │ │ │ │ +
    │ │ │ │ +struct storage_params
    │ │ │ │ +{
    │ │ │ │ +   storage_params (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* mapped_files  = nullptr;
    │ │ │ │ +   std::string const& path;
    │ │ │ │ +   storage_mode_t mode {storage_mode_sparse};
    │ │ │ │ +   aux::vector<download_priority_t, file_index_t> const& priorities;
    │ │ │ │ +   sha1_hash info_hash;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    mmap_disk_io_constructor()

    │ │ │ │ +

    Declared in "libtorrent/mmap_disk_io.hpp"

    │ │ │ │ +
    │ │ │ │ +std::unique_ptr<disk_interface> mmap_disk_io_constructor (
    │ │ │ │ +   io_context& ios, settings_interface const&, counters& cnt);
    │ │ │ │ +
    │ │ │ │ +

    constructs a memory mapped file disk I/O object.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    posix_disk_io_constructor()

    │ │ │ │ +

    Declared in "libtorrent/posix_disk_io.hpp"

    │ │ │ │ +
    │ │ │ │ +std::unique_ptr<disk_interface> posix_disk_io_constructor (
    │ │ │ │ +   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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    default_disk_io_constructor()

    │ │ │ │ +

    Declared in "libtorrent/session.hpp"

    │ │ │ │ +
    │ │ │ │ +std::unique_ptr<disk_interface> default_disk_io_constructor (
    │ │ │ │ +   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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    disabled_disk_io_constructor()

    │ │ │ │ +

    Declared in "libtorrent/disabled_disk_io.hpp"

    │ │ │ │ +
    │ │ │ │ +std::unique_ptr<disk_interface> disabled_disk_io_constructor (
    │ │ │ │ +   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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum storage_mode_t

    │ │ │ │ +

    Declared in "libtorrent/storage_defs.hpp"

    │ │ │ │ +
    │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    nametypedefaultvaluedescription
    no_connect_privileged_portsboolfalse
    storage_mode_allocate0All 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.
    storage_mode_sparse1All pieces will be written to the place where they belong and sparse files │ │ │ │ +will be used. This is the recommended, and default mode.
    │ │ │ │ -

    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

    │ │ │ │ - │ │ │ │ +[report issue] │ │ │ │ +
    │ │ │ │ +

    enum status_t

    │ │ │ │ +

    Declared in "libtorrent/storage_defs.hpp"

    │ │ │ │ +
    │ │ │ │ │ │ │ │ -│ │ │ │ │ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefaultvaluedescription
    smooth_connectsbooltrue
    no_error0 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    fatal_disk_error1 
    always_send_user_agentboolfalse
    need_full_check2 
    │ │ │ │ -

    always send user-agent in every web seed request. If false, only │ │ │ │ -the first request per http connection will include the user agent

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    nametypedefault
    file_exist3 
    apply_ip_filter_to_trackersbooltrue
    oversized_file16this 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 status_t field is used for this to preserve ABI.
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ +[report issue] │ │ │ │ +
    │ │ │ │ +

    enum move_flags_t

    │ │ │ │ +

    Declared in "libtorrent/storage_defs.hpp"

    │ │ │ │ +
    │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefaultvaluedescription
    ban_web_seedsbooltrue
    always_replace_files0replace any files in the destination when copying │ │ │ │ +or moving the storage
    │ │ │ │ -

    when true, web seeds sending bad data will be banned

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    fail_if_exist1if 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.
    support_share_modebooltrue
    dont_replace2if any file exist in the target, take those files instead │ │ │ │ +of the ones we may have in the source.
    │ │ │ │ -

    if false, prevents libtorrent to advertise share-mode support

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    nametypedefault
    reset_save_path3don't move any source files, just forget about them │ │ │ │ +and begin checking files at new save path
    report_redundant_bytesbooltrue
    reset_save_path_unchecked4don't move any source files, just change save path │ │ │ │ +and continue working without any checks
    │ │ │ │ -

    if this is true, the number of redundant bytes is sent to the │ │ │ │ -tracker

    │ │ │ │ - │ │ │ │ +[report issue] │ │ │ │ +
    │ │ │ │ +

    storage_error

    │ │ │ │ +

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │ +

    used by storage to return errors │ │ │ │ +also includes which underlying file the │ │ │ │ +error happened on

    │ │ │ │ +
    │ │ │ │ +struct storage_error
    │ │ │ │ +{
    │ │ │ │ +   explicit operator bool () const;
    │ │ │ │ +   void file (file_index_t f);
    │ │ │ │ +   file_index_t file () const;
    │ │ │ │ +
    │ │ │ │ +   error_code ec;
    │ │ │ │ +   operation_t operation;
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +

    bool()

    │ │ │ │ +
    │ │ │ │ +explicit operator bool () const;
    │ │ │ │ +
    │ │ │ │ +

    explicitly converts to true if this object represents an error, and │ │ │ │ +false if it does not.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file()

    │ │ │ │ +
    │ │ │ │ +void file (file_index_t f);
    │ │ │ │ +file_index_t file () const;
    │ │ │ │ +
    │ │ │ │ +

    set and query the index (in the torrent) of the file this error │ │ │ │ +occurred on. This may also have special values defined in │ │ │ │ +torrent_status.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    ec
    │ │ │ │ +
    the error that occurred
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    operation
    │ │ │ │ +
    A code from operation_t enum, indicating what │ │ │ │ +kind of operation failed.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    i2p_category()

    │ │ │ │ +

    Declared in "libtorrent/i2p_stream.hpp"

    │ │ │ │ +
    │ │ │ │ +boost::system::error_category& i2p_category ();
    │ │ │ │ +
    │ │ │ │ +

    returns the error category for I2P errors

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    bdecode_category()

    │ │ │ │ +

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ +
    │ │ │ │ +boost::system::error_category& bdecode_category ();
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    socks_category()

    │ │ │ │ +

    Declared in "libtorrent/socks5_stream.hpp"

    │ │ │ │ +
    │ │ │ │ +boost::system::error_category& socks_category ();
    │ │ │ │ +
    │ │ │ │ +

    returns the error_category for SOCKS5 errors

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    libtorrent_category()

    │ │ │ │ +

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │ +
    │ │ │ │ +boost::system::error_category& libtorrent_category ();
    │ │ │ │ +
    │ │ │ │ +

    return the instance of the libtorrent_error_category which │ │ │ │ +maps libtorrent error codes to human readable error messages.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    http_category()

    │ │ │ │ +

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │ +
    │ │ │ │ +boost::system::error_category& http_category ();
    │ │ │ │ +
    │ │ │ │ +

    returns the error_category for HTTP errors

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    upnp_category()

    │ │ │ │ +

    Declared in "libtorrent/upnp.hpp"

    │ │ │ │ +
    │ │ │ │ +boost::system::error_category& upnp_category ();
    │ │ │ │ +
    │ │ │ │ +

    the boost.system error category for UPnP errors

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    pcp_category()

    │ │ │ │ +

    Declared in "libtorrent/natpmp.hpp"

    │ │ │ │ +
    │ │ │ │ +boost::system::error_category& pcp_category ();
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    gzip_category()

    │ │ │ │ +

    Declared in "libtorrent/gzip.hpp"

    │ │ │ │ +
    │ │ │ │ +boost::system::error_category& gzip_category ();
    │ │ │ │ +
    │ │ │ │ +

    get the error_category for zip errors

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum i2p_error_code

    │ │ │ │ +

    Declared in "libtorrent/i2p_stream.hpp"

    │ │ │ │ +
    │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefaultvaluedescription
    listen_system_port_fallbackbooltrue
    no_error0 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    parse_failed1 
    announce_crypto_supportbooltrue
    cant_reach_peer2 
    │ │ │ │ -

    when this is true, and incoming encrypted connections are enabled, │ │ │ │ -&supportcrypt=1 is included in http tracker announces

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    i2p_error3 
    enable_upnpbooltrue
    invalid_key4 
    │ │ │ │ -

    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 portmap_alert and the portmap_error_alert. The object will be │ │ │ │ -valid until stop_upnp() is called. See upnp and nat pmp.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_id5 
    enable_natpmpbooltrue
    timeout6 
    │ │ │ │ -

    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 portmap_alert and the portmap_error_alert. The object │ │ │ │ -will be valid until stop_natpmp() is called. See │ │ │ │ -upnp and nat pmp.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    nametypedefault
    key_not_found7 
    enable_lsdbooltrue
    duplicated_id8 
    num_errors9 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ +[report issue] │ │ │ │ +
    │ │ │ │ +

    enum error_code_enum

    │ │ │ │ +

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ +
    │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefaultvaluedescription
    enable_dhtbooltrue
    no_error0Not an error
    │ │ │ │ -

    starts the dht node and makes the trackerless service available to │ │ │ │ -torrents.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    expected_digit1expected digit in bencoded string
    prefer_rc4boolfalse
    expected_colon2expected colon in bencoded string
    │ │ │ │ -

    if the allowed encryption level is both, setting this to true will │ │ │ │ -prefer RC4 if both methods are offered, plain text otherwise

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    unexpected_eof3unexpected end of file in bencoded string
    proxy_hostnamesbooltrue
    expected_value4expected value (list, dict, int or string) in bencoded string
    │ │ │ │ -

    if true, hostname lookups are done via the configured proxy (if │ │ │ │ -any). This is only supported by SOCKS5 and HTTP.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    depth_exceeded5bencoded recursion depth limit exceeded
    proxy_peer_connectionsbooltrue
    limit_exceeded6bencoded item count limit exceeded
    │ │ │ │ -

    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).

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    nametypedefault
    overflow7integer overflow
    auto_sequentialbooltrue
    error_code_max8the number of error codes
    │ │ │ │ -

    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

    │ │ │ │ - │ │ │ │ +[report issue] │ │ │ │ +
    │ │ │ │ +

    enum socks_error_code

    │ │ │ │ +

    Declared in "libtorrent/socks5_stream.hpp"

    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefaultvaluedescription
    proxy_tracker_connectionsbooltrue
    no_error0 
    │ │ │ │ -

    if true, tracker connections are made over the configured proxy, if │ │ │ │ -any.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    unsupported_version1 
    enable_ip_notifierbooltrue
    unsupported_authentication_method2 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    unsupported_authentication_version3 
    dht_prefer_verified_node_idsbooltrue
    authentication_error4 
    │ │ │ │ -

    when this is true, nodes whose IDs are derived from their source │ │ │ │ -IP according to BEP 42 are preferred in the routing table.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    nametypedefault
    username_required5 
    dht_restrict_routing_ipsbooltrue
    general_failure6 
    command_not_supported7 
    no_identd8 
    identd_error9 
    num_errors10 
    │ │ │ │ -

    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 entry in the whole routing table

    │ │ │ │ - │ │ │ │ +[report issue] │ │ │ │ +
    │ │ │ │ +

    enum error_code_enum

    │ │ │ │ +

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │ +
    │ │ │ │ │ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefaultvaluedescription
    dht_restrict_search_ipsbooltrue
    no_error0Not an error
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    file_collision1Two torrents has files which end up overwriting each other
    dht_extended_routing_tablebooltrue
    failed_hash_check2A piece did not match its piece hash
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    torrent_is_no_dict3The .torrent file does not contain a bencoded dictionary at │ │ │ │ +its top level
    dht_aggressive_lookupsbooltrue
    torrent_missing_info4The .torrent file does not have an info dictionary
    │ │ │ │ -

    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 branch factor 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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    dht_privacy_lookupsboolfalse
    │ │ │ │ -

    when set, perform lookups in a way that is slightly more expensive, │ │ │ │ -but which minimizes the amount of information leaked about you.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    dht_enforce_node_idboolfalse
    │ │ │ │ -

    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".

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    dht_ignore_dark_internetbooltrue
    │ │ │ │ -

    ignore DHT messages from parts of the internet we wouldn't expect to │ │ │ │ -see any traffic from

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    dht_read_onlyboolfalse
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    piece_extent_affinityboolfalse
    │ │ │ │ -

    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

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    validate_https_trackersbooltrue
    │ │ │ │ -

    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).

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    ssrf_mitigationbooltrue
    │ │ │ │ -

    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

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    allow_idnaboolfalse
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    enable_set_file_valid_databoolfalse
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    socks5_udp_send_local_epboolfalse
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    tracker_completion_timeoutint30
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    tracker_receive_timeoutint10
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    stop_tracker_timeoutint
    torrent_info_no_dict5The .torrent file's info entry is not a dictionary
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    tracker_maximum_response_lengthint1024*1024
    │ │ │ │ -

    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).

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    piece_timeoutint20
    torrent_missing_piece_length6The .torrent file does not have a piece length entry
    │ │ │ │ -

    the number of seconds from a request is sent until it times out if │ │ │ │ -no piece response is returned.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    torrent_missing_name7The .torrent file does not have a name entry
    request_timeoutint60
    torrent_invalid_name8The .torrent file's name entry is invalid
    │ │ │ │ -

    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

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    torrent_invalid_length9The length of a file, or of the whole .torrent file is invalid. │ │ │ │ +Either negative or not an integer
    request_queue_timeint3
    torrent_file_parse_failed10Failed to parse a file entry in the .torrent
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    torrent_missing_pieces11The pieces field is missing or invalid in the .torrent file
    max_allowed_in_request_queueint2000
    torrent_invalid_hashes12The pieces string has incorrect length
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    too_many_pieces_in_torrent13The .torrent file has more pieces than is supported by libtorrent
    max_out_request_queueint500
    invalid_swarm_metadata14The metadata (.torrent file) that was received from the swarm │ │ │ │ +matched the info-hash, but failed to be parsed
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_bencoding15The file or buffer is not correctly bencoded
    whole_pieces_thresholdint20
    no_files_in_torrent16The .torrent file does not contain any files
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_escaped_string17The string was not properly url-encoded as expected
    peer_timeoutint120
    session_is_closing18Operation is not permitted since the session is shutting down
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    duplicate_torrent19There's already a torrent with that info-hash added to the │ │ │ │ +session
    urlseed_timeoutint
    invalid_torrent_handle20The supplied torrent_handle is not referring to a valid torrent
    │ │ │ │ -

    same as peer_timeout, but only applies to url-seeds. this is │ │ │ │ -usually set lower, because web servers are expected to be more │ │ │ │ -reliable.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    urlseed_pipeline_sizeint5
    │ │ │ │ -

    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

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    urlseed_wait_retryint30
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_entry_type21The type requested from the entry did not match its type
    file_pool_sizeint40
    missing_info_hash_in_uri22The specified URI does not contain a valid info-hash
    │ │ │ │ -

    sets the upper limit on the total number of files this session 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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    file_too_short23One of the files in the torrent was unexpectedly small. This │ │ │ │ +might be caused by files being changed by an external process
    max_failcountint3
    unsupported_url_protocol24The URL used an unknown protocol. Currently http and │ │ │ │ +https (if built with openssl support) are recognized. For │ │ │ │ +trackers udp is recognized as well.
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    url_parse_error25The URL did not conform to URL syntax and failed to be parsed
    min_reconnect_timeint60
    peer_sent_empty_piece26The peer sent a piece message of length 0
    │ │ │ │ -

    the number of seconds to wait to reconnect to a peer. this time is │ │ │ │ -multiplied with the failcount.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    parse_failed27A bencoded structure was corrupt and failed to be parsed
    peer_connect_timeoutint15
    invalid_file_tag28The fast resume file was missing or had an invalid file version │ │ │ │ +tag
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    missing_info_hash29The fast resume file was missing or had an invalid info-hash
    connection_speedint
    mismatching_info_hash30The info-hash did not match the torrent
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    inactivity_timeoutint600
    │ │ │ │ -

    if a peer is uninteresting and uninterested for longer than this │ │ │ │ -number of seconds, it will be disconnected.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_hostname31The URL contained an invalid hostname
    unchoke_intervalint15
    invalid_port32The URL had an invalid port
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    port_blocked33The port is blocked by the port-filter, and prevented the │ │ │ │ +connection
    optimistic_unchoke_intervalint30
    expected_close_bracket_in_address34The IPv6 address was expected to end with "]"
    │ │ │ │ -

    optimistic_unchoke_interval is the number of seconds between │ │ │ │ -each optimistic unchoke. On this timer, the currently │ │ │ │ -optimistically unchoked peer will change.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    destructing_torrent35The torrent is being destructed, preventing the operation to │ │ │ │ +succeed
    num_wantint200
    timed_out36The connection timed out
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    upload_upload_connection37The peer is upload only, and we are upload only. There's no point │ │ │ │ +in keeping the connection
    initial_picker_thresholdint4
    uninteresting_upload_peer38The peer is upload only, and we're not interested in it. There's │ │ │ │ +no point in keeping the connection
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_info_hash39The peer sent an unknown info-hash
    allowed_fast_set_sizeint5
    torrent_paused40The torrent is paused, preventing the operation from succeeding
    │ │ │ │ -

    the number of allowed pieces to send to peers that supports the │ │ │ │ -fast extensions

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_have41The peer sent an invalid have message, either wrong size or │ │ │ │ +referring to a piece that doesn't exist in the torrent
    suggest_modeintsettings_pack::no_piece_suggestions
    invalid_bitfield_size42The bitfield message had the incorrect size
    │ │ │ │ -

    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.
    • │ │ │ │ -
    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    too_many_requests_when_choked43The peer kept requesting pieces after it was choked, possible │ │ │ │ +abuse attempt.
    max_queued_disk_bytesint1024 * 1024
    invalid_piece44The peer sent a piece message that does not correspond to a │ │ │ │ +piece request sent by the client
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    no_memory45memory allocation failed
    handshake_timeoutint10
    torrent_aborted46The torrent is aborted, preventing the operation to succeed
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    self_connection47The peer is a connection to ourself, no point in keeping it
    send_buffer_low_watermarkint10 * 1024
    invalid_piece_size48The peer sent a piece message with invalid size, either negative │ │ │ │ +or greater than one block
    send_buffer_watermarkint500 * 1024
    timed_out_no_interest49The peer has not been interesting or interested in us for too │ │ │ │ +long, no point in keeping it around
    send_buffer_watermark_factorint
    timed_out_inactivity50The peer has not said anything in a long time, possibly dead
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    choking_algorithmintsettings_pack::fixed_slots_choker
    seed_choking_algorithmintsettings_pack::round_robin
    │ │ │ │ -

    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 │ │ │ │ -choking_algorithm_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 seed_choking_algorithm_t enum.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    disk_io_write_modeintDISK_WRITE_MODE
    disk_io_read_modeintsettings_pack::enable_os_cache
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    outgoing_portint0
    num_outgoing_portsint0
    timed_out_no_handshake51The peer did not send a handshake within a reasonable amount of │ │ │ │ +time, it might not be a bittorrent peer
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    timed_out_no_request52The peer has been unchoked for too long without requesting any │ │ │ │ +data. It might be lying about its interest in us
    peer_dscpint0x04
    invalid_choke53The peer sent an invalid choke message
    │ │ │ │ -

    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 RFC 8622.

    │ │ │ │ -

    peer_tos is the backwards compatible name for this setting.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_unchoke54The peer send an invalid unchoke message
    active_downloadsint3
    invalid_interested55The peer sent an invalid interested message
    active_seedsint5
    invalid_not_interested56The peer sent an invalid not-interested message
    active_checkingint1
    invalid_request57The peer sent an invalid piece request message
    active_dht_limitint88
    invalid_hash_list58The peer sent an invalid hash-list message (this is part of the │ │ │ │ +merkle-torrent extension)
    active_tracker_limitint1600
    invalid_hash_piece59The peer sent an invalid hash-piece message (this is part of the │ │ │ │ +merkle-torrent extension)
    active_lsd_limitint
    invalid_cancel60The peer sent an invalid cancel message
    active_limitint500
    │ │ │ │ -

    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 active, 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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    auto_manage_intervalint30
    │ │ │ │ -

    auto_manage_interval is the number of seconds between the │ │ │ │ -torrent queue is updated, and rotated.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_dht_port61The peer sent an invalid DHT port-message
    seed_time_limitint24 * 60 * 60
    invalid_suggest62The peer sent an invalid suggest piece-message
    │ │ │ │ -

    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 queuing.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_have_all63The peer sent an invalid have all-message
    auto_scrape_intervalint1800
    invalid_have_none64The peer sent an invalid have none-message
    auto_scrape_min_intervalint300
    invalid_reject65The peer sent an invalid reject message
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_allow_fast66The peer sent an invalid allow fast-message
    max_peerlist_sizeint3000
    invalid_extended67The peer sent an invalid extension message ID
    max_paused_peerlist_sizeint1000
    invalid_message68The peer sent an invalid message ID
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    sync_hash_not_found69The synchronization hash was not found in the encrypted handshake
    min_announce_intervalint5 * 60
    invalid_encryption_constant70The encryption constant in the handshake is invalid
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    no_plaintext_mode71The peer does not support plain text, which is the selected mode
    auto_manage_startupint60
    no_rc4_mode72The peer does not support RC4, which is the selected mode
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    unsupported_encryption_mode73The peer does not support any of the encryption modes that the │ │ │ │ +client supports
    seeding_piece_quotaint20
    unsupported_encryption_mode_selected74The peer selected an encryption mode that the client did not │ │ │ │ +advertise and does not support
    │ │ │ │ -

    seeding_piece_quota is the number of pieces to send to a peer, │ │ │ │ -when seeding, before rotating in another peer to the unchoke set.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_pad_size75The pad size used in the encryption handshake is of invalid size
    max_rejectsint50
    invalid_encrypt_handshake76The encryption handshake is invalid
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    no_incoming_encrypted77The client is set to not support incoming encrypted connections │ │ │ │ +and this is an encrypted connection
    recv_socket_buffer_sizeint0
    no_incoming_regular78The client is set to not support incoming regular bittorrent │ │ │ │ +connections, and this is a regular connection
    send_socket_buffer_sizeint0
    duplicate_peer_id79The client is already connected to this peer-ID
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    torrent_removed80Torrent was removed
    max_peer_recv_buffer_sizeint2 * 1024 * 1024
    packet_too_large81The packet size exceeded the upper sanity check-limit
    │ │ │ │ -

    the max number of bytes a single peer connection's receive buffer is │ │ │ │ -allowed to grow to.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    reserved82 
    optimistic_disk_retryint10 * 60
    http_error83The web server responded with an error
    │ │ │ │ -

    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().

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    missing_location84The web server response is missing a location header
    max_suggest_piecesint16
    invalid_redirection85The web seed redirected to a path that no longer matches the │ │ │ │ +.torrent directory structure
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    redirecting86The connection was closed because it redirected to a different │ │ │ │ +URL
    local_service_announce_intervalint5 * 60
    invalid_range87The HTTP range header is invalid
    │ │ │ │ -

    local_service_announce_interval is the time between local │ │ │ │ -network announces for a torrent. │ │ │ │ -This interval is specified in seconds.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    no_content_length88The HTTP response did not have a content length
    dht_announce_intervalint15 * 60
    banned_by_ip_filter89The IP is blocked by the IP filter
    │ │ │ │ -

    dht_announce_interval is the number of seconds between │ │ │ │ -announcing torrents to the distributed hash table (DHT).

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    too_many_connections90At the connection limit
    udp_tracker_token_expiryint60
    peer_banned91The peer is marked as banned
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    stopping_torrent92The torrent is stopping, causing the operation to fail
    num_optimistic_unchoke_slotsint0
    too_many_corrupt_pieces93The peer has sent too many corrupt pieces and is banned
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    torrent_not_ready94The torrent is not ready to receive peers
    max_pex_peersint50
    peer_not_constructed95The peer is not completely constructed yet
    │ │ │ │ -

    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

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    session_closing96The session is closing, causing the operation to fail
    tick_intervalint500
    optimistic_disconnect97The peer was disconnected in order to leave room for a │ │ │ │ +potentially better peer
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    torrent_finished98The torrent is finished
    share_mode_targetint3
    no_router99No UPnP router found
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    metadata_too_large100The metadata message says the metadata exceeds the limit
    upload_rate_limitint0
    invalid_metadata_request101The peer sent an invalid metadata request message
    download_rate_limitint0
    invalid_metadata_size102The peer advertised an invalid metadata size
    │ │ │ │ -

    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 peer classes.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_metadata_offset103The peer sent a message with an invalid metadata offset
    dht_upload_rate_limitint8000
    invalid_metadata_message104The peer sent an invalid metadata message
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    pex_message_too_large105The peer sent a peer exchange message that was too large
    unchoke_slots_limitint8
    invalid_pex_message106The peer sent an invalid peer exchange message
    │ │ │ │ -

    unchoke_slots_limit is the max number of unchoked peers in the │ │ │ │ -session. 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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_lt_tracker_message107The peer sent an invalid tracker exchange message
    connections_limitint200
    too_frequent_pex108The peer sent an pex messages too often. This is a possible │ │ │ │ +attempt of and attack
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    no_metadata109The operation failed because it requires the torrent to have │ │ │ │ +the metadata (.torrent file) and it doesn't have it yet. │ │ │ │ +This happens for magnet links before they have downloaded the │ │ │ │ +metadata, and also torrents added by URL.
    connections_slackint10
    invalid_dont_have110The peer sent an invalid dont_have message. The don't have │ │ │ │ +message is an extension to allow peers to advertise that the │ │ │ │ +no longer has a piece they previously had.
    │ │ │ │ -

    connections_slack is the number of incoming connections │ │ │ │ -exceeding the connection limit to accept in order to potentially │ │ │ │ -replace existing ones.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    requires_ssl_connection111The peer tried to connect to an SSL torrent without connecting │ │ │ │ +over SSL.
    utp_target_delayint100
    invalid_ssl_cert112The peer tried to connect to a torrent with a certificate │ │ │ │ +for a different torrent.
    utp_gain_factorint3000
    not_an_ssl_torrent113the torrent is not an SSL torrent, and the operation requires │ │ │ │ +an SSL torrent
    utp_min_timeoutint500
    banned_by_port_filter114peer was banned because its listen port is within a banned port │ │ │ │ +range, as specified by the port_filter.
    utp_syn_resendsint2
    invalid_session_handle115The session_handle is not referring to a valid session_impl
    utp_fin_resendsint2
    invalid_listen_socket116the listen socket associated with this request was closed
    utp_num_resendsint3
    invalid_hash_request117 
    utp_connect_timeoutint3000
    invalid_hashes118 
    utp_loss_multiplierint50
    invalid_hash_reject119 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    deprecated_120120 
    mixed_mode_algorithmintsettings_pack::peer_proportional
    deprecated_121121 
    │ │ │ │ -

    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).

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    deprecated_122122 
    listen_queue_sizeint5
    deprecated_123123 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    deprecated_124124 
    torrent_connect_boostint30
    missing_file_sizes130The resume data file is missing the file sizes entry
    │ │ │ │ -

    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 session tick to trigger connections. │ │ │ │ -This may not be set higher than 255.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    no_files_in_resume_data131The resume data file file sizes entry is empty
    alert_queue_sizeint2000
    missing_pieces132The resume data file is missing the pieces and slots entry
    │ │ │ │ -

    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 alert 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().

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    mismatching_number_of_files133The number of files in the resume data does not match the number │ │ │ │ +of files in the torrent
    max_metadata_sizeint3 * 1024 * 10240
    mismatching_file_size134One of the files on disk has a different size than in the fast │ │ │ │ +resume file
    │ │ │ │ -

    max_metadata_size is the maximum allowed size (in bytes) to be │ │ │ │ -received by the metadata extension, i.e. magnet links.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    mismatching_file_timestamp135One of the files on disk has a different timestamp than in the │ │ │ │ +fast resume file
    hashing_threadsint1
    not_a_dictionary136The resume data file is not a dictionary
    │ │ │ │ -

    hashing_threads is the number of disk I/O threads to use for │ │ │ │ -piece hash verification. These threads are in addition to the │ │ │ │ -regular disk I/O threads specified by settings_pack::aio_threads. │ │ │ │ -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 hasher 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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_blocks_per_piece137The blocks per piece entry is invalid in the resume data file
    checking_mem_usageint256
    missing_slots138The resume file is missing the slots entry, which is required │ │ │ │ +for torrents with compact allocation. DEPRECATED
    │ │ │ │ -

    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

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    too_many_slots139The resume file contains more slots than the torrent
    predictive_piece_announceint0
    invalid_slot_list140The slot entry is invalid in the resume data
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_piece_index141One index in the slot list is invalid
    aio_threadsint10
    pieces_need_reorder142The pieces on disk needs to be re-ordered for the specified │ │ │ │ +allocation mode. This happens if you specify sparse allocation │ │ │ │ +and the files on disk are using compact storage. The pieces needs │ │ │ │ +to be moved to their right position. DEPRECATED
    │ │ │ │ -

    for some aio back-ends, aio_threads specifies the number of │ │ │ │ -io-threads to use.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    resume_data_not_modified143this error is returned when asking to save resume data and │ │ │ │ +specifying the flag to only save when there's anything new to save │ │ │ │ +(torrent_handle::only_if_modified) and there wasn't anything changed.
    tracker_backoffint250
    invalid_save_path144the save_path in add_torrent_params is not valid
    │ │ │ │ -

    tracker_backoff determines how aggressively to back off from │ │ │ │ -retrying failing trackers. This value determines x 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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    http_parse_error150The HTTP header was not correctly formatted
    share_ratio_limitint200
    http_missing_location151The HTTP response was in the 300-399 range but lacked a location │ │ │ │ +header
    seed_time_ratio_limitint700
    http_failed_decompress152The HTTP response was encoded with gzip or deflate but │ │ │ │ +decompressing it failed
    │ │ │ │ -

    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 queuing.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    no_i2p_router160The URL specified an i2p address, but no i2p router is configured
    peer_turnoverint4
    no_i2p_endpoint161i2p acceptor is not available yet, can't announce without endpoint
    peer_turnover_cutoffint90
    scrape_not_available170The tracker URL doesn't support transforming it into a scrape │ │ │ │ +URL. i.e. it doesn't contain "announce.
    peer_turnover_intervalint300
    invalid_tracker_response171invalid tracker response
    │ │ │ │ -

    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

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_peer_dict172invalid peer dictionary entry. Not a dictionary
    connect_seed_every_n_downloadint10
    tracker_failure173tracker sent a failure message
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_files_entry174missing or invalid files entry
    max_http_recv_buffer_sizeint4*1024*204
    invalid_hash_entry175missing or invalid hash entry
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_peers_entry176missing or invalid peers and peers6 entry
    max_retry_port_bindint10
    invalid_tracker_response_length177UDP tracker response packet has invalid size
    │ │ │ │ -

    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

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    invalid_tracker_transaction_id178invalid transaction id in UDP tracker response
    alert_maskintint
    invalid_tracker_action179invalid action field in UDP tracker response
    │ │ │ │ -

    a bitmask combining flags from alert_category_t defining which │ │ │ │ -kinds of alerts to receive

    │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    announce_skipped180skipped announce (because it's assumed to be unreachable over the │ │ │ │ +given source network interface)
    out_enc_policyintsettings_pack::pe_enabled
    no_entropy200random number generation failed
    in_enc_policyintsettings_pack::pe_enabled
    ssrf_mitigation201blocked by SSRF mitigation
    │ │ │ │ -

    control the settings for incoming and outgoing connections │ │ │ │ -respectively. see enc_policy 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. │ │ │ │ -
    3. The encryption itself requires more CPU than plain bittorrent │ │ │ │ -protocol. The highest cost is the Diffie Hellman exchange on │ │ │ │ -connection setup.
    4. │ │ │ │ -
    5. The encryption handshake adds several round-trips to the │ │ │ │ -connection setup, and delays transferring data.
    6. │ │ │ │ -
    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    blocked_by_idna202blocked because IDNA host names are banned
    allowed_enc_levelintsettings_pack::pe_both
    torrent_unknown_version210the torrent file has an unknown meta version
    │ │ │ │ -

    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 │ │ │ │ -enc_level enum for options.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    torrent_missing_file_tree211the v2 torrent file has no file tree
    inactive_down_rateint2048
    torrent_missing_meta_version212the torrent contains v2 keys but does not specify meta version 2
    inactive_up_rateint2048
    torrent_inconsistent_files213the v1 and v2 file metadata does not match
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    torrent_missing_piece_layer214one or more files are missing piece layer hashes
    proxy_typeintsettings_pack::none
    torrent_invalid_piece_layer215a piece layer has the wrong size or failed hash check
    │ │ │ │ -

    proxy to use. see proxy_type_t.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    torrent_missing_pieces_root216a v2 file entry has no root hash
    proxy_portint0
    torrent_inconsistent_hashes217the v1 and v2 hashes do not describe the same data
    │ │ │ │ -

    the port of the proxy server

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    nametypedefault
    torrent_invalid_pad_file218a file in the v2 metadata has the pad attribute set
    i2p_portint0
    error_code_max219the number of error codes
    │ │ │ │ -

    sets the i2p SAM bridge port to connect to. set the hostname with │ │ │ │ -the i2p_hostname setting.

    │ │ │ │ - │ │ │ │ +[report issue] │ │ │ │ +
    │ │ │ │ +

    enum http_errors

    │ │ │ │ +

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │ +
    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    urlseed_max_request_bytesint16 * 1024 * 1024
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    web_seed_name_lookup_retryint1800
    │ │ │ │ -

    time to wait until a new retry of a web seed name lookup

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    close_file_intervalintCLOSE_FILE_INTERVAL
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ │ │ │ │ -│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefaultvaluedescription
    utp_cwnd_reduce_timerint
    cont100 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    max_web_seed_connectionsint3
    │ │ │ │ -

    the max number of web seeds to have connected per torrent at any │ │ │ │ -given time.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    resolver_cache_timeoutint1200
    │ │ │ │ -

    the number of seconds before the internal host name resolver │ │ │ │ -considers a cache value timed out, negative values are interpreted │ │ │ │ -as zero.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    send_not_sent_low_watermarkint16384
    │ │ │ │ -

    specify the not-sent low watermark for socket send buffers. This │ │ │ │ -corresponds to the, Linux-specific, TCP_NOTSENT_LOWAT TCP socket │ │ │ │ -option.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    rate_choker_initial_thresholdint1024
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    upnp_lease_durationint3600
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    max_concurrent_http_announcesint50
    ok200 
    │ │ │ │ -

    limits the number of concurrent HTTP tracker announces. Once the │ │ │ │ -limit is hit, tracker requests are queued and issued when an │ │ │ │ -outstanding announce completes.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    created201 
    dht_max_peers_replyint100
    accepted202 
    │ │ │ │ -

    the maximum number of peers to send in a reply to get_peers

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    no_content204 
    dht_search_branchingint5
    multiple_choices300 
    │ │ │ │ -

    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

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    moved_permanently301 
    dht_max_fail_countint20
    moved_temporarily302 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    not_modified304 
    dht_max_torrentsint2000
    bad_request400 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    unauthorized401 
    dht_max_dht_itemsint700
    forbidden403 
    │ │ │ │ -

    max number of items the DHT will store

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    not_found404 
    dht_max_peersint
    internal_server_error500 
    │ │ │ │ -

    the max number of peers to store per torrent (for the DHT)

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    dht_max_torrent_search_replyint20
    │ │ │ │ -

    the max number of torrents to return in a torrent search query to the │ │ │ │ -DHT

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    dht_block_timeoutint5 * 60
    not_implemented501 
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    nametypedefault
    bad_gateway502 
    dht_block_ratelimitint5
    service_unavailable503 
    │ │ │ │ -

    the max number of packets per second a DHT node is allowed to send │ │ │ │ -without getting banned.

    │ │ │ │ - │ │ │ │ +[report issue] │ │ │ │ +
    │ │ │ │ +

    enum error_code_enum

    │ │ │ │ +

    Declared in "libtorrent/upnp.hpp"

    │ │ │ │ +
    │ │ │ │ │ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefaultvaluedescription
    dht_item_lifetimeint
    no_error0No error
    │ │ │ │ -

    the number of seconds a immutable/mutable item will be expired. │ │ │ │ -default is 0, means never expires.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    dht_sample_infohashes_intervalint21600
    │ │ │ │ -

    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).

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    dht_max_infohashes_sample_countint20
    │ │ │ │ -

    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

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    max_piece_countint0x200000
    │ │ │ │ -

    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 read_resume_data() and │ │ │ │ -torrent_info::parse_info_section(), if those are used.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    nametypedefault
    metadata_token_limitint2500000
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    disk_write_modeintsettings_pack::mmap_write_mode_t::auto_mmap_write
    invalid_argument402One of the arguments in the request is invalid
    │ │ │ │ -

    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 mmap_write_mode_t.

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    action_failed501The request failed
    mmap_file_size_cutoffint40
    value_not_in_array714The specified value does not exist in the array
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    nametypedefault
    source_ip_cannot_be_wildcarded715The source IP address cannot be wild-carded, but │ │ │ │ +must be fully specified
    i2p_inbound_quantityint3
    external_port_cannot_be_wildcarded716The external port cannot be a wildcard, but must │ │ │ │ +be specified
    i2p_outbound_quantityint3
    port_mapping_conflict718The port mapping entry specified conflicts with a │ │ │ │ +mapping assigned previously to another client
    i2p_inbound_lengthint3
    internal_port_must_match_external724Internal and external port value must be the same
    i2p_outbound_lengthint3
    only_permanent_leases_supported725The NAT implementation only supports permanent │ │ │ │ +lease times on port mappings
    │ │ │ │ -

    Configures the SAM session │ │ │ │ -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).

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    nametypedefault
    remote_host_must_be_wildcard726RemoteHost must be a wildcard and cannot be a │ │ │ │ +specific IP address or DNS name
    announce_portint0
    external_port_must_be_wildcard727ExternalPort must be a wildcard and cannot be a │ │ │ │ +specific port
    │ │ │ │ -

    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 apply_pack_impl (settings_pack const*
    │ │ │ │ -      , aux::session_settings_single_thread&
    │ │ │ │ -      , std::vector<void(aux::session_impl::*)()>*);
    │ │ │ │ -   void set_int (int name, int val) override;
    │ │ │ │ -   void set_bool (int name, bool val) override;
    │ │ │ │ -   void set_int (int name, flags::bitfield_flag<Type, Tag> const val);
    │ │ │ │ -   void set_str (int name, std::string val) override;
    │ │ │ │ -   bool has_val (int name) const override;
    │ │ │ │ -   void clear ();
    │ │ │ │ -   void clear (int name);
    │ │ │ │ -   int get_int (int name) const override;
    │ │ │ │ -   std::string const& get_str (int name) const override;
    │ │ │ │ -   bool get_bool (int name) const override;
    │ │ │ │ -   void for_each (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,
    │ │ │ │ -   };
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    set_str() set_int() set_bool()

    │ │ │ │ -
    │ │ │ │ -void set_int (int name, int val) override;
    │ │ │ │ -void set_bool (int name, bool val) override;
    │ │ │ │ -void set_int (int name, flags::bitfield_flag<Type, Tag> const val);
    │ │ │ │ -void set_str (int name, std::string val) override;
    │ │ │ │ -
    │ │ │ │ -

    set a configuration option in the settings_pack. 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    has_val()

    │ │ │ │ -
    │ │ │ │ -bool has_val (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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    clear()

    │ │ │ │ -
    │ │ │ │ -void clear ();
    │ │ │ │ -
    │ │ │ │ -

    clear the settings pack from all settings

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    clear()

    │ │ │ │ -
    │ │ │ │ -void clear (int name);
    │ │ │ │ -
    │ │ │ │ -

    clear a specific setting from the pack

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    get_str() get_int() get_bool()

    │ │ │ │ -
    │ │ │ │ -int get_int (int name) const override;
    │ │ │ │ -std::string const& get_str (int name) const override;
    │ │ │ │ -bool get_bool (int name) const override;
    │ │ │ │ -
    │ │ │ │ -

    queries the current configuration option from the settings_pack. │ │ │ │ -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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum type_bases

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum pcp_errors

    │ │ │ │ +

    Declared in "libtorrent/natpmp.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ -
    namevaluedescription
    string_type_base
    pcp_success0 
    int_type_base16384
    pcp_unsupp_version1 
    bool_type_base32768
    pcp_not_authorized2 
    type_mask49152
    pcp_malformed_request3 
    index_mask16383
    pcp_unsupp_opcode4 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum mmap_write_mode_t

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    always_pwrite0disable writing to disk via mmap, always use normal write calls
    always_mmap_write1prefer using memory mapped files for disk writes (at least for │ │ │ │ -large files where it might make sense)
    auto_mmap_write2determine whether to use pwrite or memory mapped files for disk │ │ │ │ -writes depending on the kind of storage behind the save path
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum suggest_mode_t

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ -
    namevaluedescription
    no_piece_suggestions0
    pcp_unsupp_option5 
    suggest_read_cache1
    pcp_malformed_option6 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum choking_algorithm_t

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ -
    namevaluedescription
    fixed_slots_choker0This is the traditional choker with a fixed number of unchoke │ │ │ │ -slots (as specified by settings_pack::unchoke_slots_limit).
    rate_based_choker2

    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 settings_pack::rate_choker_initial_threshold.

    │ │ │ │ -

    For more information, see rate based choking.

    │ │ │ │ -
    deprecated_bittyrant_choker3
    pcp_network_failure7 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum seed_choking_algorithm_t

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    namevaluedescription
    round_robin0which 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.
    fastest_upload1unchokes the peers we can send to the fastest. This might be a │ │ │ │ -bit more reliable in utilizing all available capacity.
    anti_leech2prioritizes 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.
    pcp_no_resources8 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum io_buffer_mode_t

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    namevaluedescription
    pcp_unsupp_protocol9 
    enable_os_cache0
    pcp_user_ex_quota10 
    deprecated_disable_os_cache_for_aligned_files1
    pcp_cannot_provide_external11 
    disable_os_cache2
    pcp_address_mismatch12 
    write_through3
    pcp_excessive_remote_peers13 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum bandwidth_mixed_algo_t

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum error_code_enum

    │ │ │ │ +

    Declared in "libtorrent/gzip.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    namevaluedescription
    prefer_tcp
    no_error0disables the mixed mode bandwidth balancingNot an error
    peer_proportional
    invalid_gzip_header1does not throttle uTP, throttles TCP to the same proportion │ │ │ │ -of throughput as there are TCP connectionsthe supplied gzip buffer has invalid header
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum enc_policy

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    namevaluedescription
    inflated_data_too_large2the gzip buffer would inflate to more bytes than the specified │ │ │ │ +maximum size, and was rejected.
    pe_forced0Only 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.
    data_did_not_terminate3available inflate data did not terminate
    pe_enabled1encrypted 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.
    space_exhausted4output space exhausted before completing inflate
    pe_disabled2only non-encrypted connections are allowed.
    invalid_block_type5invalid block type (type == 3)
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum enc_level

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ -
    namevaluedescription
    invalid_stored_block_length6stored block length did not match one's complement
    pe_plaintext1use only plain text encryption
    too_many_length_or_distance_codes7dynamic block code description: too many length or distance codes
    pe_rc42use only RC4 encryption
    code_lengths_codes_incomplete8dynamic block code description: code lengths codes incomplete
    pe_both3allow both
    repeat_lengths_with_no_first_length9dynamic block code description: repeat lengths with no first length
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum proxy_type_t

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    namevaluedescription
    repeat_more_than_specified_lengths10dynamic block code description: repeat more than specified lengths
    none0No proxy server is used and all other fields are ignored.
    invalid_literal_length_code_lengths11dynamic block code description: invalid literal/length code lengths
    socks41The server is assumed to be a SOCKS4 server that requires a │ │ │ │ -username.
    invalid_distance_code_lengths12dynamic block code description: invalid distance code lengths
    socks52The server is assumed to be a SOCKS5 server (RFC 1928) that does │ │ │ │ -not require any authentication. The username and password are │ │ │ │ -ignored.
    invalid_literal_code_in_block13invalid literal/length or distance code in fixed or dynamic block
    socks5_pw3The server is assumed to be a SOCKS5 server that supports plain │ │ │ │ -text username and password authentication (RFC 1929). The │ │ │ │ -username and password specified may be sent to the proxy if it │ │ │ │ -requires.
    distance_too_far_back_in_block14distance is too far back in fixed or dynamic block
    http4The 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 CONNECT 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.
    unknown_gzip_error15an unknown error occurred during gzip inflation
    http_pw5The server is assumed to be an HTTP proxy that requires user │ │ │ │ -authorization. The username and password will be sent to the proxy.
    error_code_max16the number of error codes
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    min_memory_usage() high_performance_seed()

    │ │ │ │ -

    Declared in "libtorrent/session.hpp"

    │ │ │ │ -
    │ │ │ │ -settings_pack min_memory_usage ();
    │ │ │ │ -settings_pack high_performance_seed ();
    │ │ │ │ -
    │ │ │ │ -

    The default values of the session settings are set for a regular │ │ │ │ -bittorrent client running on a desktop system. There are functions that │ │ │ │ -can set the session 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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    setting_by_name() name_for_setting()

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ -
    │ │ │ │ -char const* name_for_setting (int s);
    │ │ │ │ -int setting_by_name (string_view name);
    │ │ │ │ -
    │ │ │ │ -

    converts a setting integer (from the enums string_types, int_types or │ │ │ │ -bool_types) to a string, and vice versa.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    default_settings()

    │ │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ -
    │ │ │ │ -settings_pack default_settings ();
    │ │ │ │ -
    │ │ │ │ -

    returns a settings_pack with every setting set to its default value

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    generate_fingerprint()

    │ │ │ │ -

    Declared in "libtorrent/fingerprint.hpp"

    │ │ │ │ +

    You have some control over session configuration through the session::apply_settings() │ │ │ │ +member function. To change one or more configuration options, create a settings_pack │ │ │ │ +object and fill it with the settings to be set and pass it in to session::apply_settings().

    │ │ │ │ +

    The settings_pack object is a collection of settings updates that are applied │ │ │ │ +to the session 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 │ │ │ │ +settings_pack class. These are the available settings:

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    open_file_state

    │ │ │ │ +

    Declared in "libtorrent/disk_interface.hpp"

    │ │ │ │ +

    this contains information about a file that's currently open by the │ │ │ │ +libtorrent disk I/O subsystem. It's associated with a single torrent.

    │ │ │ │
    │ │ │ │ -std::string generate_fingerprint (std::string name
    │ │ │ │ -   , int major, int minor = 0, int revision = 0, int tag = 0);
    │ │ │ │ +struct open_file_state
    │ │ │ │ +{
    │ │ │ │ +   file_index_t file_index;
    │ │ │ │ +   file_open_mode_t open_mode;
    │ │ │ │ +   time_point last_use;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    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 settings_pack.

    │ │ │ │ -

    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:

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    id charsclient
    LTlibtorrent (default)
    UTuTorrent
    UMuTorrent Mac
    qBqBittorrent
    BPBitTorrent Pro
    BTBitTorrent
    DEDeluge
    AZAzureus
    TLTribler
    │ │ │ │ -

    There's an informal directory of client id's here.

    │ │ │ │ -

    The major, minor, revision and tag parameters are used to │ │ │ │ -identify the version of your client.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    bitfield

    │ │ │ │ -

    Declared in "libtorrent/bitfield.hpp"

    │ │ │ │ -

    The bitfield type stores any number of bits as a bitfield │ │ │ │ -in a heap allocated array.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    file_index
    │ │ │ │ +
    the index of the file this entry refers to into the file_storage │ │ │ │ +file list of this torrent. This starts indexing at 0.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    open_mode
    │ │ │ │ +

    open_mode is a bitmask of the file flags this file is currently │ │ │ │ +opened with. For possible flags, see file_open_mode_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.

    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    last_use
    │ │ │ │ +
    a (high precision) timestamp of when the file was last used.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    disk_interface

    │ │ │ │ +

    Declared in "libtorrent/disk_interface.hpp"

    │ │ │ │ +

    The disk_interface is the customization point for disk I/O in libtorrent. │ │ │ │ +implement this interface and provide a factory function to the session constructor │ │ │ │ +use custom disk I/O. All functions on the disk subsystem (implementing │ │ │ │ +disk_interface) 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 │ │ │ │ +have 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 bitfield
    │ │ │ │ +struct disk_interface
    │ │ │ │  {
    │ │ │ │ -   bitfield (bitfield&& rhs) noexcept = default;
    │ │ │ │ -   explicit bitfield (int bits);
    │ │ │ │ -   bitfield (char const* b, int bits);
    │ │ │ │ -   bitfield (bitfield const& rhs);
    │ │ │ │ -   bitfield () noexcept = default;
    │ │ │ │ -   bitfield (int bits, bool val);
    │ │ │ │ -   void assign (char const* b, int const bits);
    │ │ │ │ -   bool get_bit (int index) const noexcept;
    │ │ │ │ -   bool operator[] (int index) const noexcept;
    │ │ │ │ -   void clear_bit (int index) noexcept;
    │ │ │ │ -   void set_bit (int index) noexcept;
    │ │ │ │ -   bool all_set () const noexcept;
    │ │ │ │ -   bool none_set () const noexcept;
    │ │ │ │ -   int size () const noexcept;
    │ │ │ │ -   int num_words () const noexcept;
    │ │ │ │ -   int num_bytes () const noexcept;
    │ │ │ │ -   bool empty () const noexcept;
    │ │ │ │ -   char const* data () const noexcept;
    │ │ │ │ -   char* data () noexcept;
    │ │ │ │ -   void swap (bitfield& rhs) noexcept;
    │ │ │ │ -   int count () const noexcept;
    │ │ │ │ -   int find_first_set () const noexcept;
    │ │ │ │ -   int find_last_clear () const noexcept;
    │ │ │ │ -   bool operator== (lt::bitfield const& rhs) const;
    │ │ │ │ +   virtual storage_holder new_torrent (storage_params const& p
    │ │ │ │ +      , std::shared_ptr<void> const& torrent) = 0;
    │ │ │ │ +   virtual void remove_torrent (storage_index_t) = 0;
    │ │ │ │ +   virtual void async_read (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 async_write (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 async_hash (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 async_hash2 (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 async_move_storage (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 async_release_files (storage_index_t storage
    │ │ │ │ +      , std::function<void()> handler = std::function<void()>()) = 0;
    │ │ │ │ +   virtual void async_check_files (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 async_stop_torrent (storage_index_t storage
    │ │ │ │ +      , std::function<void()> handler = std::function<void()>()) = 0;
    │ │ │ │ +   virtual void async_rename_file (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 async_delete_files (storage_index_t storage, remove_flags_t options
    │ │ │ │ +      , std::function<void(storage_error const&)> handler) = 0;
    │ │ │ │ +   virtual void async_set_file_priority (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 async_clear_piece (storage_index_t storage, piece_index_t index
    │ │ │ │ +      , std::function<void(piece_index_t)> handler) = 0;
    │ │ │ │ +   virtual void update_stats_counters (counters& c) const = 0;
    │ │ │ │ +   virtual std::vector<open_file_state> get_status (storage_index_t) const = 0;
    │ │ │ │ +   virtual void abort (bool wait) = 0;
    │ │ │ │ +   virtual void submit_jobs () = 0;
    │ │ │ │ +   virtual void settings_updated () = 0;
    │ │ │ │ +
    │ │ │ │ +   static constexpr disk_job_flags_t force_copy  = 0_bit;
    │ │ │ │ +   static constexpr disk_job_flags_t sequential_access  = 3_bit;
    │ │ │ │ +   static constexpr disk_job_flags_t volatile_read  = 4_bit;
    │ │ │ │ +   static constexpr disk_job_flags_t v1_hash  = 5_bit;
    │ │ │ │ +   static constexpr disk_job_flags_t flush_piece  = 7_bit;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    bitfield()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    new_torrent()

    │ │ │ │
    │ │ │ │ -bitfield (bitfield&& rhs) noexcept = default;
    │ │ │ │ -explicit bitfield (int bits);
    │ │ │ │ -bitfield (char const* b, int bits);
    │ │ │ │ -bitfield (bitfield const& rhs);
    │ │ │ │ -bitfield () noexcept = default;
    │ │ │ │ -bitfield (int bits, bool val);
    │ │ │ │ +virtual storage_holder new_torrent (storage_params const& p
    │ │ │ │ +      , std::shared_ptr<void> const& torrent) = 0;
    │ │ │ │  
    │ │ │ │ -

    constructs a new bitfield. The default constructor creates an empty │ │ │ │ -bitfield. bits is the size of the bitfield (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 bitfield │ │ │ │ -from the specified buffer, and bits number of bits (rounded up to │ │ │ │ -the nearest byte boundary).

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    assign()

    │ │ │ │ +

    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 storage_holder is an owning reference to the underlying │ │ │ │ +storage that was just created. It is fundamentally a storage_index_t

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    remove_torrent()

    │ │ │ │
    │ │ │ │ -void assign (char const* b, int const bits);
    │ │ │ │ +virtual void remove_torrent (storage_index_t) = 0;
    │ │ │ │  
    │ │ │ │ -

    copy bitfield from buffer b of bits number of bits, rounded up to │ │ │ │ -the nearest byte boundary.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    operator[]() get_bit()

    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    async_write() async_read()

    │ │ │ │
    │ │ │ │ -bool get_bit (int index) const noexcept;
    │ │ │ │ -bool operator[] (int index) const noexcept;
    │ │ │ │ +virtual void async_read (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 async_write (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;
    │ │ │ │  
    │ │ │ │ -

    query bit at index. Returns true if bit is 1, otherwise false.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    clear_bit() set_bit()

    │ │ │ │ +

    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 disk_buffer_holder, holding the buffer with │ │ │ │ +the result. Flags may be set to affect the read operation. See │ │ │ │ +disk_job_flags_t.

    │ │ │ │ +

    The disk_observer 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 peer_request (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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    async_hash()

    │ │ │ │
    │ │ │ │ -void clear_bit (int index) noexcept;
    │ │ │ │ -void set_bit (int index) noexcept;
    │ │ │ │ +virtual void async_hash (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;
    │ │ │ │  
    │ │ │ │ -

    set bit at index to 0 (clear_bit) or 1 (set_bit).

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    all_set()

    │ │ │ │ +

    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.

    │ │ │ │ +

    The v2 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    async_hash2()

    │ │ │ │
    │ │ │ │ -bool all_set () const noexcept;
    │ │ │ │ +virtual void async_hash2 (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;
    │ │ │ │  
    │ │ │ │ -

    returns true if all bits in the bitfield are set

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    none_set()

    │ │ │ │ +

    computes the v2 hash (SHA-256) of a single block. The block at │ │ │ │ +offset in piece piece.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    async_move_storage()

    │ │ │ │
    │ │ │ │ -bool none_set () const noexcept;
    │ │ │ │ +virtual void async_move_storage (storage_index_t storage, std::string p, move_flags_t flags
    │ │ │ │ +      , std::function<void(status_t, std::string const&, storage_error const&)> handler) = 0;
    │ │ │ │  
    │ │ │ │ -

    returns true if no bit in the bitfield is set

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    size()

    │ │ │ │ +

    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 move_flags_t).

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    async_release_files()

    │ │ │ │
    │ │ │ │ -int size () const noexcept;
    │ │ │ │ +virtual void async_release_files (storage_index_t storage
    │ │ │ │ +      , std::function<void()> handler = std::function<void()>()) = 0;
    │ │ │ │  
    │ │ │ │ -

    returns the size of the bitfield in bits.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    num_words()

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    async_check_files()

    │ │ │ │
    │ │ │ │ -int num_words () const noexcept;
    │ │ │ │ +virtual void async_check_files (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;
    │ │ │ │  
    │ │ │ │ -

    returns the number of 32 bit words are needed to represent all bits in │ │ │ │ -this bitfield.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    num_bytes()

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    async_stop_torrent()

    │ │ │ │
    │ │ │ │ -int num_bytes () const noexcept;
    │ │ │ │ +virtual void async_stop_torrent (storage_index_t storage
    │ │ │ │ +      , std::function<void()> handler = std::function<void()>()) = 0;
    │ │ │ │  
    │ │ │ │ -

    returns the number of bytes needed to represent all bits in this │ │ │ │ -bitfield

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    empty()

    │ │ │ │ +

    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 │ │ │ │ +async_release_files().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    async_rename_file()

    │ │ │ │
    │ │ │ │ -bool empty () const noexcept;
    │ │ │ │ +virtual void async_rename_file (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;
    │ │ │ │  
    │ │ │ │ -

    returns true if the bitfield has zero size.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    data()

    │ │ │ │ +

    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.).

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    async_delete_files()

    │ │ │ │
    │ │ │ │ -char const* data () const noexcept;
    │ │ │ │ -char* data () noexcept;
    │ │ │ │ +virtual void async_delete_files (storage_index_t storage, remove_flags_t options
    │ │ │ │ +      , std::function<void(storage_error const&)> handler) = 0;
    │ │ │ │  
    │ │ │ │ -

    returns a pointer to the internal buffer of the bitfield, or │ │ │ │ -nullptr if it's empty.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    swap()

    │ │ │ │ +

    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 session_handle for remove_flags_t flags │ │ │ │ +indicating which files are to be removed. │ │ │ │ +e.g. session_handle::delete_files - delete all files │ │ │ │ +session_handle::delete_partfile - only delete part file.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    async_set_file_priority()

    │ │ │ │
    │ │ │ │ -void swap (bitfield& rhs) noexcept;
    │ │ │ │ +virtual void async_set_file_priority (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;
    │ │ │ │  
    │ │ │ │ -

    swaps the bit-fields two variables refer to

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    count()

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    async_clear_piece()

    │ │ │ │
    │ │ │ │ -int count () const noexcept;
    │ │ │ │ +virtual void async_clear_piece (storage_index_t storage, piece_index_t index
    │ │ │ │ +      , std::function<void(piece_index_t)> handler) = 0;
    │ │ │ │  
    │ │ │ │ -

    count the number of bits in the bitfield that are set to 1.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    find_first_set()

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    update_stats_counters()

    │ │ │ │
    │ │ │ │ -int find_first_set () const noexcept;
    │ │ │ │ +virtual void update_stats_counters (counters& c) const = 0;
    │ │ │ │  
    │ │ │ │ -

    returns the index of the first set bit in the bitfield, i.e. 1 bit.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    find_last_clear()

    │ │ │ │ +

    update_stats_counters() is called to give the disk storage an │ │ │ │ +opportunity to update gauges in the c stats counters, that aren't │ │ │ │ +updated continuously as operations are performed. This is called │ │ │ │ +before a snapshot of the counters are passed to the client.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    get_status()

    │ │ │ │
    │ │ │ │ -int find_last_clear () const noexcept;
    │ │ │ │ +virtual std::vector<open_file_state> get_status (storage_index_t) const = 0;
    │ │ │ │  
    │ │ │ │ -

    returns the index to the last cleared bit in the bitfield, i.e. 0 bit.

    │ │ │ │ -[report issue]
    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    abort()

    │ │ │ │ +
    │ │ │ │ +virtual void abort (bool wait) = 0;
    │ │ │ │ +
    │ │ │ │ +

    this is called when the session 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    submit_jobs()

    │ │ │ │ +
    │ │ │ │ +virtual void submit_jobs () = 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    settings_updated()

    │ │ │ │ +
    │ │ │ │ +virtual void settings_updated () = 0;
    │ │ │ │ +
    │ │ │ │ +

    This is called to notify the disk I/O object that the settings have │ │ │ │ +been updated. In the disk io constructor, a settings_interface │ │ │ │ +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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    sequential_access
    │ │ │ │ +
    hint that there may be more disk operations with sequential access to │ │ │ │ +the file
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    v1_hash
    │ │ │ │ +
    compute a v1 piece hash. This is only used by the async_hash() call. │ │ │ │ +If this flag is not set in the async_hash() call, the SHA-1 piece │ │ │ │ +hash does not need to be computed.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    flush_piece
    │ │ │ │ +
    this flag instructs a hash job that we just completed this piece, and │ │ │ │ +it should be flushed to disk
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    hasher

    │ │ │ │ -

    Declared in "libtorrent/hasher.hpp"

    │ │ │ │ -

    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 hasher parts of it at a time. When │ │ │ │ -You have fed the hasher 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 hasher 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.

    │ │ │ │ +
    │ │ │ │ +

    storage_holder

    │ │ │ │ +

    Declared in "libtorrent/disk_interface.hpp"

    │ │ │ │ +

    a unique, owning, reference to the storage of a torrent in a disk io │ │ │ │ +subsystem (class that implements disk_interface). 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 session, this holder is destructed and will │ │ │ │ +inform the disk object.

    │ │ │ │
    │ │ │ │ -class hasher
    │ │ │ │ +struct storage_holder
    │ │ │ │  {
    │ │ │ │ -   hasher ();
    │ │ │ │ -   hasher (char const* data, int len);
    │ │ │ │ -   explicit hasher (span<char const> data);
    │ │ │ │ -   hasher& operator= (hasher const&) &;
    │ │ │ │ -   hasher (hasher const&);
    │ │ │ │ -   hasher& update (char const* data, int len);
    │ │ │ │ -   hasher& update (span<char const> data);
    │ │ │ │ -   sha1_hash final ();
    │ │ │ │ +   storage_holder (storage_index_t idx, disk_interface& disk_io);
    │ │ │ │ +   ~storage_holder ();
    │ │ │ │ +   storage_holder () = default;
    │ │ │ │ +   explicit operator bool () const;
    │ │ │ │ +   operator storage_index_t () const;
    │ │ │ │     void reset ();
    │ │ │ │ +   storage_holder (storage_holder const&) = delete;
    │ │ │ │ +   storage_holder& operator= (storage_holder const&) = delete;
    │ │ │ │ +   storage_holder (storage_holder&& rhs) noexcept;
    │ │ │ │ +   storage_holder& operator= (storage_holder&& rhs) noexcept;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    hasher() operator=()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    buffer_allocator_interface

    │ │ │ │ +

    Declared in "libtorrent/disk_buffer_holder.hpp"

    │ │ │ │ +

    the interface for freeing disk buffers, used by the disk_buffer_holder. │ │ │ │ +when implementing disk_interface, this must also be implemented in order │ │ │ │ +to return disk buffers back to libtorrent

    │ │ │ │
    │ │ │ │ -hasher (char const* data, int len);
    │ │ │ │ -explicit hasher (span<char const> data);
    │ │ │ │ -hasher& operator= (hasher const&) &;
    │ │ │ │ -hasher (hasher const&);
    │ │ │ │ +struct buffer_allocator_interface
    │ │ │ │ +{
    │ │ │ │ +   virtual void free_disk_buffer (char* b) = 0;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    this is the same as default constructing followed by a call to │ │ │ │ -update(data, len).

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    update()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    disk_buffer_holder

    │ │ │ │ +

    Declared in "libtorrent/disk_buffer_holder.hpp"

    │ │ │ │ +

    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.

    │ │ │ │
    │ │ │ │ -hasher& update (char const* data, int len);
    │ │ │ │ -hasher& update (span<char const> data);
    │ │ │ │ +struct disk_buffer_holder
    │ │ │ │ +{
    │ │ │ │ +   disk_buffer_holder (disk_buffer_holder&&) noexcept;
    │ │ │ │ +   disk_buffer_holder& operator= (disk_buffer_holder&&) & noexcept;
    │ │ │ │ +   disk_buffer_holder& operator= (disk_buffer_holder const&) = delete;
    │ │ │ │ +   disk_buffer_holder (disk_buffer_holder const&) = delete;
    │ │ │ │ +   disk_buffer_holder (buffer_allocator_interface& alloc
    │ │ │ │ +      , char* buf, int sz) noexcept;
    │ │ │ │ +   disk_buffer_holder () noexcept = default;
    │ │ │ │ +   ~disk_buffer_holder ();
    │ │ │ │ +   char* data () const noexcept;
    │ │ │ │ +   void reset ();
    │ │ │ │ +   void swap (disk_buffer_holder& h) noexcept;
    │ │ │ │ +   bool is_mutable () const noexcept;
    │ │ │ │ +   explicit operator bool () const noexcept;
    │ │ │ │ +   std::ptrdiff_t size () const;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    append the following bytes to what is being hashed

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    final()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    disk_buffer_holder()

    │ │ │ │
    │ │ │ │ -sha1_hash final ();
    │ │ │ │ +disk_buffer_holder (buffer_allocator_interface& alloc
    │ │ │ │ +      , char* buf, int sz) noexcept;
    │ │ │ │  
    │ │ │ │ -

    returns the SHA-1 digest of the buffers previously passed to │ │ │ │ -update() and the hasher constructor.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ +

    construct a buffer holder that will free the held buffer │ │ │ │ +using a disk buffer pool directly (there's only one │ │ │ │ +disk_buffer_pool per session)

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    disk_buffer_holder()

    │ │ │ │ +
    │ │ │ │ +disk_buffer_holder () noexcept = default;
    │ │ │ │ +
    │ │ │ │ +

    default construct a holder that does not own any buffer

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    ~disk_buffer_holder()

    │ │ │ │ +
    │ │ │ │ +~disk_buffer_holder ();
    │ │ │ │ +
    │ │ │ │ +

    frees disk buffer held by this object

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    data()

    │ │ │ │ +
    │ │ │ │ +char* data () const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    return a pointer to the held buffer, if any. Otherwise returns nullptr.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │

    reset()

    │ │ │ │
    │ │ │ │  void reset ();
    │ │ │ │  
    │ │ │ │ -

    restore the hasher state to be as if the hasher has just been │ │ │ │ -default constructed.

    │ │ │ │ -[report issue]
    │ │ │ │ +

    free the held disk buffer, if any, and clear the holder. This sets the │ │ │ │ +holder object to a default-constructed state

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    swap()

    │ │ │ │ +
    │ │ │ │ +void swap (disk_buffer_holder& h) noexcept;
    │ │ │ │ +
    │ │ │ │ +

    swap pointers of two disk buffer holders.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    is_mutable()

    │ │ │ │ +
    │ │ │ │ +bool is_mutable () const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    if this returns true, the buffer may not be modified in place

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    bool()

    │ │ │ │ +
    │ │ │ │ +explicit operator bool () const noexcept;
    │ │ │ │ +
    │ │ │ │ +

    implicitly convertible to true if the object is currently holding a │ │ │ │ +buffer

    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    hasher256

    │ │ │ │ -

    Declared in "libtorrent/hasher.hpp"

    │ │ │ │ +
    │ │ │ │ +

    disk_observer

    │ │ │ │ +

    Declared in "libtorrent/disk_observer.hpp"

    │ │ │ │
    │ │ │ │ -class hasher256
    │ │ │ │ +struct disk_observer
    │ │ │ │  {
    │ │ │ │ -   hasher256 ();
    │ │ │ │ -   hasher256 (char const* data, int len);
    │ │ │ │ -   explicit hasher256 (span<char const> data);
    │ │ │ │ -   hasher256 (hasher256 const&);
    │ │ │ │ -   hasher256& operator= (hasher256 const&) &;
    │ │ │ │ -   hasher256& update (span<char const> data);
    │ │ │ │ -   hasher256& update (char const* data, int len);
    │ │ │ │ -   sha256_hash final ();
    │ │ │ │ -   void reset ();
    │ │ │ │ -   ~hasher256 ();
    │ │ │ │ +   virtual void on_disk () = 0;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    hasher256() operator=()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    on_disk()

    │ │ │ │
    │ │ │ │ -hasher256 (char const* data, int len);
    │ │ │ │ -explicit hasher256 (span<char const> data);
    │ │ │ │ -hasher256 (hasher256 const&);
    │ │ │ │ -hasher256& operator= (hasher256 const&) &;
    │ │ │ │ +virtual void on_disk () = 0;
    │ │ │ │  
    │ │ │ │ -

    this is the same as default constructing followed by a call to │ │ │ │ -update(data, len).

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    update()

    │ │ │ │ +

    called when the disk cache size has dropped │ │ │ │ +below the low watermark again and we can │ │ │ │ +resume downloading from peers

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    settings_interface

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ +

    the common interface to settings_pack and the internal representation of │ │ │ │ +settings.

    │ │ │ │
    │ │ │ │ -hasher256& update (span<char const> data);
    │ │ │ │ -hasher256& update (char const* data, int len);
    │ │ │ │ +struct settings_interface
    │ │ │ │ +{
    │ │ │ │ +   virtual void set_int (int name, int val) = 0;
    │ │ │ │ +   virtual bool has_val (int name) const = 0;
    │ │ │ │ +   virtual void set_bool (int name, bool val) = 0;
    │ │ │ │ +   virtual void set_str (int name, std::string val) = 0;
    │ │ │ │ +   virtual bool get_bool (int name) const = 0;
    │ │ │ │ +   virtual int get_int (int name) const = 0;
    │ │ │ │ +   virtual std::string const& get_str (int name) const = 0;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    append the following bytes to what is being hashed

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    final()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_open_mode_t

    │ │ │ │ +

    Declared in "libtorrent/disk_interface.hpp"

    │ │ │ │ +
    │ │ │ │ +
    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
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    session_params

    │ │ │ │ +

    Declared in "libtorrent/session_params.hpp"

    │ │ │ │ +

    The session_params is a parameters pack for configuring the session │ │ │ │ +before it's started.

    │ │ │ │
    │ │ │ │ -sha256_hash final ();
    │ │ │ │ +struct session_params
    │ │ │ │ +{
    │ │ │ │ +   session_params ();
    │ │ │ │ +   session_params (settings_pack const& sp);
    │ │ │ │ +   session_params (settings_pack&& sp);
    │ │ │ │ +   session_params (settings_pack&& sp
    │ │ │ │ +      , std::vector<std::shared_ptr<plugin>> exts);
    │ │ │ │ +   session_params (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;
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    returns the SHA-1 digest of the buffers previously passed to │ │ │ │ -update() and the hasher constructor.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    reset()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    session_params()

    │ │ │ │
    │ │ │ │ -void reset ();
    │ │ │ │ +session_params ();
    │ │ │ │ +session_params (settings_pack const& sp);
    │ │ │ │ +session_params (settings_pack&& sp);
    │ │ │ │  
    │ │ │ │ -

    restore the hasher state to be as if the hasher has just been │ │ │ │ -default constructed.

    │ │ │ │ -[report issue]
    │ │ │ │ +

    This constructor can be used to start with the default plugins │ │ │ │ +(ut_metadata, ut_pex and smart_ban). Pass a settings_pack to set the │ │ │ │ +initial settings when the session starts.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    session_params()

    │ │ │ │ +
    │ │ │ │ +session_params (settings_pack&& sp
    │ │ │ │ +      , std::vector<std::shared_ptr<plugin>> exts);
    │ │ │ │ +session_params (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 session before it's started.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    settings
    │ │ │ │ +
    The settings to configure the session with
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    extensions
    │ │ │ │ +
    the plugins to add to the session as it is constructed
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    dht_state
    │ │ │ │ +
    DHT node ID and node addresses to bootstrap the DHT with.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    dht_storage_constructor
    │ │ │ │ +
    function object to construct the storage object for DHT items.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    disk_io_constructor
    │ │ │ │ +
    function object to create the disk I/O subsystem. Defaults to │ │ │ │ +default_disk_io_constructor.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    ext_state
    │ │ │ │ +
    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 read_session_params() and write_session_params().
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    ip_filter
    │ │ │ │ +
    the IP filter to use for the session. This restricts which peers are allowed │ │ │ │ +to connect. As if passed to set_ip_filter().
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    peer_class_type_filter

    │ │ │ │ -

    Declared in "libtorrent/peer_class_type_filter.hpp"

    │ │ │ │ -

    peer_class_type_filter is a simple container for rules for adding and subtracting │ │ │ │ -peer-classes from peers. It is applied after the peer class filter is applied (which │ │ │ │ -is based on the peer's IP address).

    │ │ │ │ +
    │ │ │ │ +

    session_handle

    │ │ │ │ +

    Declared in "libtorrent/session_handle.hpp"

    │ │ │ │ +

    this class provides a non-owning handle to a session and a subset of the │ │ │ │ +interface of the session class. If the underlying session is destructed │ │ │ │ +any handle to it will no longer be valid. is_valid() will return false and │ │ │ │ +any operation on it will throw a system_error exception, with error code │ │ │ │ +invalid_session_handle.

    │ │ │ │
    │ │ │ │ -struct peer_class_type_filter
    │ │ │ │ +struct session_handle
    │ │ │ │  {
    │ │ │ │ -   void add (socket_type_t const st, peer_class_t const peer_class);
    │ │ │ │ -   void remove (socket_type_t const st, peer_class_t const peer_class);
    │ │ │ │ -   void disallow (socket_type_t const st, peer_class_t const peer_class);
    │ │ │ │ -   void allow (socket_type_t const st, peer_class_t const peer_class);
    │ │ │ │ -   std::uint32_t apply (socket_type_t const st, std::uint32_t peer_class_mask);
    │ │ │ │ -   friend bool operator== (peer_class_type_filter const& lhs
    │ │ │ │ -      , peer_class_type_filter const& rhs);
    │ │ │ │ +   bool is_valid () const;
    │ │ │ │ +   session_params session_state (save_state_flags_t flags = save_state_flags_t::all()) const;
    │ │ │ │ +   void refresh_torrent_status (std::vector<torrent_status>* ret
    │ │ │ │ +      , status_flags_t flags = {}) const;
    │ │ │ │ +   std::vector<torrent_status> get_torrent_status (
    │ │ │ │ +      std::function<bool(torrent_status const&)> const& pred
    │ │ │ │ +      , status_flags_t flags = {}) const;
    │ │ │ │ +   void post_torrent_updates (status_flags_t flags = status_flags_t::all());
    │ │ │ │ +   void post_session_stats ();
    │ │ │ │ +   void post_dht_stats ();
    │ │ │ │ +   void set_dht_state (dht::dht_state const& st);
    │ │ │ │ +   void set_dht_state (dht::dht_state&& st);
    │ │ │ │ +   std::vector<torrent_handle> get_torrents () const;
    │ │ │ │ +   torrent_handle find_torrent (sha1_hash const& info_hash) const;
    │ │ │ │ +   torrent_handle add_torrent (add_torrent_params const& params);
    │ │ │ │ +   torrent_handle add_torrent (add_torrent_params&& params);
    │ │ │ │ +   torrent_handle add_torrent (add_torrent_params&& params, error_code& ec);
    │ │ │ │ +   torrent_handle add_torrent (add_torrent_params const& params, error_code& ec);
    │ │ │ │ +   void async_add_torrent (add_torrent_params&& params);
    │ │ │ │ +   void async_add_torrent (add_torrent_params const& params);
    │ │ │ │ +   void pause ();
    │ │ │ │ +   bool is_paused () const;
    │ │ │ │ +   void resume ();
    │ │ │ │ +   bool is_dht_running () const;
    │ │ │ │ +   void set_dht_storage (dht::dht_storage_constructor_type sc);
    │ │ │ │ +   void add_dht_node (std::pair<std::string, int> const& node);
    │ │ │ │ +   void dht_get_item (sha1_hash const& target);
    │ │ │ │ +   void dht_get_item (std::array<char, 32> key
    │ │ │ │ +      , std::string salt = std::string());
    │ │ │ │ +   sha1_hash dht_put_item (entry data);
    │ │ │ │ +   void 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 = std::string());
    │ │ │ │ +   void dht_get_peers (sha1_hash const& info_hash);
    │ │ │ │ +   void dht_announce (sha1_hash const& info_hash, int port = 0, dht::announce_flags_t flags = {});
    │ │ │ │ +   void dht_live_nodes (sha1_hash const& nid);
    │ │ │ │ +   void dht_sample_infohashes (udp::endpoint const& ep, sha1_hash const& target);
    │ │ │ │ +   void dht_direct_request (udp::endpoint const& ep, entry const& e, client_data_t userdata = {});
    │ │ │ │ +   void add_extension (std::shared_ptr<plugin> ext);
    │ │ │ │ +   void add_extension (std::function<std::shared_ptr<torrent_plugin>(
    │ │ │ │ +      torrent_handle const&, client_data_t)> ext);
    │ │ │ │ +   void set_ip_filter (ip_filter f);
    │ │ │ │ +   ip_filter get_ip_filter () const;
    │ │ │ │ +   void set_port_filter (port_filter const& f);
    │ │ │ │ +   unsigned short listen_port () const;
    │ │ │ │ +   bool is_listening () const;
    │ │ │ │ +   unsigned short ssl_listen_port () const;
    │ │ │ │ +   void set_peer_class_filter (ip_filter const& f);
    │ │ │ │ +   ip_filter get_peer_class_filter () const;
    │ │ │ │ +   peer_class_type_filter get_peer_class_type_filter () const;
    │ │ │ │ +   void set_peer_class_type_filter (peer_class_type_filter const& f);
    │ │ │ │ +   peer_class_t create_peer_class (char const* name);
    │ │ │ │ +   void delete_peer_class (peer_class_t cid);
    │ │ │ │ +   peer_class_info get_peer_class (peer_class_t cid) const;
    │ │ │ │ +   void set_peer_class (peer_class_t cid, peer_class_info const& pci);
    │ │ │ │ +   void remove_torrent (const torrent_handle&, remove_flags_t = {});
    │ │ │ │ +   void apply_settings (settings_pack&&);
    │ │ │ │ +   settings_pack get_settings () const;
    │ │ │ │ +   void apply_settings (settings_pack const&);
    │ │ │ │ +   void set_alert_notify (std::function<void()> const& fun);
    │ │ │ │ +   alert* wait_for_alert (time_duration max_wait);
    │ │ │ │ +   void pop_alerts (std::vector<alert*>* alerts);
    │ │ │ │ +   void delete_port_mapping (port_mapping_t handle);
    │ │ │ │ +   std::vector<port_mapping_t> add_port_mapping (portmap_protocol t, int external_port, int local_port);
    │ │ │ │ +   void reopen_network_sockets (reopen_network_flags_t options = reopen_map_ports);
    │ │ │ │ +   std::shared_ptr<aux::session_impl> native_handle () const;
    │ │ │ │  
    │ │ │ │ -   enum socket_type_t
    │ │ │ │ -   {
    │ │ │ │ -      tcp_socket,
    │ │ │ │ -      utp_socket,
    │ │ │ │ -      ssl_tcp_socket,
    │ │ │ │ -      ssl_utp_socket,
    │ │ │ │ -      i2p_socket,
    │ │ │ │ -      num_socket_types,
    │ │ │ │ -   };
    │ │ │ │ +   static constexpr save_state_flags_t save_settings  = 0_bit;
    │ │ │ │ +   static constexpr save_state_flags_t save_dht_state  = 2_bit;
    │ │ │ │ +   static constexpr save_state_flags_t save_extension_state  = 11_bit;
    │ │ │ │ +   static constexpr save_state_flags_t save_ip_filter  = 12_bit;
    │ │ │ │ +   static constexpr peer_class_t global_peer_class_id {0};
    │ │ │ │ +   static constexpr peer_class_t tcp_peer_class_id {1};
    │ │ │ │ +   static constexpr peer_class_t local_peer_class_id {2};
    │ │ │ │ +   static constexpr remove_flags_t delete_files  = 0_bit;
    │ │ │ │ +   static constexpr remove_flags_t delete_partfile  = 1_bit;
    │ │ │ │ +   static constexpr session_flags_t paused  = 2_bit;
    │ │ │ │ +   static constexpr portmap_protocol udp  = portmap_protocol::udp;
    │ │ │ │ +   static constexpr portmap_protocol tcp  = portmap_protocol::tcp;
    │ │ │ │ +   static constexpr reopen_network_flags_t reopen_map_ports  = 0_bit;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    remove() add()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    is_valid()

    │ │ │ │
    │ │ │ │ -void add (socket_type_t const st, peer_class_t const peer_class);
    │ │ │ │ -void remove (socket_type_t const st, peer_class_t const peer_class);
    │ │ │ │ +bool is_valid () const;
    │ │ │ │  
    │ │ │ │ -

    add() and remove() adds and removes a peer class to be added │ │ │ │ -to new peers based on socket type.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    allow() disallow()

    │ │ │ │ +

    returns true if this handle refers to a valid session object. If the │ │ │ │ +session has been destroyed, all session_handle objects will expire and │ │ │ │ +not be valid.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    session_state()

    │ │ │ │
    │ │ │ │ -void disallow (socket_type_t const st, peer_class_t const peer_class);
    │ │ │ │ -void allow (socket_type_t const st, peer_class_t const peer_class);
    │ │ │ │ +session_params session_state (save_state_flags_t flags = save_state_flags_t::all()) const;
    │ │ │ │  
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    apply()

    │ │ │ │ +

    returns the current session state. This can be passed to │ │ │ │ +write_session_params() to save the state to disk and restored using │ │ │ │ +read_session_params() when constructing a new session. 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 │ │ │ │ +session state

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    refresh_torrent_status() get_torrent_status()

    │ │ │ │
    │ │ │ │ -std::uint32_t apply (socket_type_t const st, std::uint32_t peer_class_mask);
    │ │ │ │ +void refresh_torrent_status (std::vector<torrent_status>* ret
    │ │ │ │ +      , status_flags_t flags = {}) const;
    │ │ │ │ +std::vector<torrent_status> get_torrent_status (
    │ │ │ │ +      std::function<bool(torrent_status const&)> const& pred
    │ │ │ │ +      , status_flags_t flags = {}) const;
    │ │ │ │  
    │ │ │ │ -

    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).

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum socket_type_t

    │ │ │ │ -

    Declared in "libtorrent/peer_class_type_filter.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    tcp_socket0these match the socket types from socket_type.hpp │ │ │ │ -shifted one down
    utp_socket1 
    ssl_tcp_socket2 
    ssl_utp_socket3 
    i2p_socket4 
    num_socket_types5 
    │ │ │ │ -[report issue]
    │ │ │ │ +
    │ │ │ │ +

    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.

    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    peer_class_info

    │ │ │ │ -

    Declared in "libtorrent/peer_class.hpp"

    │ │ │ │ -

    holds settings for a peer class. Used in set_peer_class() and │ │ │ │ -get_peer_class() calls.

    │ │ │ │ +

    get_torrent_status returns a vector of the torrent_status 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 should be included and false means │ │ │ │ +excluded. The flags argument is the same as to │ │ │ │ +torrent_handle::status(). Since pred is guaranteed to be │ │ │ │ +called for every torrent, it may be used to count the number of │ │ │ │ +torrents of different categories as well.

    │ │ │ │ +

    refresh_torrent_status takes a vector of torrent_status structs │ │ │ │ +(for instance the same vector that was returned by │ │ │ │ +get_torrent_status() ) and refreshes the status based on the │ │ │ │ +handle member. It is possible to use this function by first │ │ │ │ +setting up a vector of default constructed torrent_status objects, │ │ │ │ +only initializing the handle 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.

    │ │ │ │ +

    Any torrent_status object whose handle member is not referring to │ │ │ │ +a valid torrent are ignored.

    │ │ │ │ +

    The intended use of these functions is to start off by calling │ │ │ │ +get_torrent_status() to get a list of all torrents that match your │ │ │ │ +criteria. Then call refresh_torrent_status() 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 get_torrent_status() 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    post_torrent_updates()

    │ │ │ │
    │ │ │ │ -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;
    │ │ │ │ -};
    │ │ │ │ +void post_torrent_updates (status_flags_t flags = status_flags_t::all());
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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 any of the peer classes a peer belongs to has this set to true, │ │ │ │ -that peer will be unchoked at all times.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +

    This functions instructs the session to post the state_update_alert, │ │ │ │ +containing the status of all torrents whose state changed since the │ │ │ │ +last time this function was called.

    │ │ │ │ +

    Only torrents who has the state subscription flag set will be │ │ │ │ +included. This flag is on by default. See add_torrent_params. │ │ │ │ +the flags argument is the same as for torrent_handle::status(). │ │ │ │ +see status_flags_t in torrent_handle.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    post_session_stats()

    │ │ │ │ +
    │ │ │ │ +void post_session_stats ();
    │ │ │ │ +
    │ │ │ │ +

    This function will post a session_stats_alert object, containing a │ │ │ │ +snapshot of the performance counters from the internals of libtorrent. │ │ │ │ +To interpret these counters, query the session via │ │ │ │ +session_stats_metrics().

    │ │ │ │ +

    For more information, see the session statistics section.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    post_dht_stats()

    │ │ │ │ +
    │ │ │ │ +void post_dht_stats ();
    │ │ │ │ +
    │ │ │ │ +

    This will cause a dht_stats_alert to be posted.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_dht_state()

    │ │ │ │ +
    │ │ │ │ +void set_dht_state (dht::dht_state const& st);
    │ │ │ │ +void set_dht_state (dht::dht_state&& st);
    │ │ │ │ +
    │ │ │ │ +

    set the DHT state for the session. This will be taken into account the │ │ │ │ +next time the DHT is started, as if it had been passed in via the │ │ │ │ +session_params on startup.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    find_torrent() get_torrents()

    │ │ │ │ +
    │ │ │ │ +std::vector<torrent_handle> get_torrents () const;
    │ │ │ │ +torrent_handle find_torrent (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 session, a torrent_handle to that │ │ │ │ +torrent is returned. In case the torrent cannot be found, an invalid │ │ │ │ +torrent_handle 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 session.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    async_add_torrent() add_torrent()

    │ │ │ │ +
    │ │ │ │ +torrent_handle add_torrent (add_torrent_params const& params);
    │ │ │ │ +torrent_handle add_torrent (add_torrent_params&& params);
    │ │ │ │ +torrent_handle add_torrent (add_torrent_params&& params, error_code& ec);
    │ │ │ │ +torrent_handle add_torrent (add_torrent_params const& params, error_code& ec);
    │ │ │ │ +void async_add_torrent (add_torrent_params&& params);
    │ │ │ │ +void async_add_torrent (add_torrent_params const& params);
    │ │ │ │ +
    │ │ │ │ +

    You add torrents through the add_torrent() function where you give an │ │ │ │ +object with all the parameters. The add_torrent() overloads will block │ │ │ │ +until the torrent has been added (or failed to be added) and returns │ │ │ │ +an error code and a torrent_handle. In order to add torrents more │ │ │ │ +efficiently, consider using async_add_torrent() which returns │ │ │ │ +immediately, without waiting for the torrent to add. Notification of │ │ │ │ +the torrent being added is sent as add_torrent_alert.

    │ │ │ │ +

    The save_path field in add_torrent_params 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 add_torrent() will throw a system_error │ │ │ │ +exception.

    │ │ │ │ +

    The overload that does not take an error_code throws an exception on │ │ │ │ +error and is not available when building without exception support. │ │ │ │ +The torrent_handle returned by add_torrent() can be used to retrieve │ │ │ │ +information about the torrent's progress, its peers etc. It is also │ │ │ │ +used to abort a torrent.

    │ │ │ │ +

    If the torrent you are trying to add already exists in the session (is │ │ │ │ +either queued for checking, being checked or downloading) │ │ │ │ +add_torrent() will throw system_error which derives from │ │ │ │ +std::exception unless duplicate_is_error is set to false. In that │ │ │ │ +case, add_torrent() will return the handle to the existing torrent.

    │ │ │ │ +

    The add_torrent_params 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.

    │ │ │ │ +

    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 BitTorrent v2 torrents.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    resume() pause() is_paused()

    │ │ │ │ +
    │ │ │ │ +void pause ();
    │ │ │ │ +bool is_paused () const;
    │ │ │ │ +void resume ();
    │ │ │ │ +
    │ │ │ │ +

    Pausing the session 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 session pause state is separate from the torrent pause │ │ │ │ +state. A torrent is inactive if it is paused or if the session is │ │ │ │ +paused.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    is_dht_running()

    │ │ │ │ +
    │ │ │ │ +bool is_dht_running () const;
    │ │ │ │ +
    │ │ │ │ +

    is_dht_running() returns true if the DHT support has been started │ │ │ │ +and false otherwise.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_dht_storage()

    │ │ │ │ +
    │ │ │ │ +void set_dht_storage (dht::dht_storage_constructor_type sc);
    │ │ │ │ +
    │ │ │ │ +

    set_dht_storage set a dht custom storage constructor function │ │ │ │ +to be used internally when the dht is created.

    │ │ │ │ +

    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.

    │ │ │ │ +

    If you want to make sure the dht is initially created with your │ │ │ │ +custom storage, create a session with the setting │ │ │ │ +settings_pack::enable_dht to false, set your constructor function │ │ │ │ +and call apply_settings with settings_pack::enable_dht to true.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_dht_node()

    │ │ │ │ +
    │ │ │ │ +void add_dht_node (std::pair<std::string, int> const& node);
    │ │ │ │ +
    │ │ │ │ +

    add_dht_node 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_get_item()

    │ │ │ │ +
    │ │ │ │ +void dht_get_item (sha1_hash const& target);
    │ │ │ │ +
    │ │ │ │ +

    query the DHT for an immutable item at the target hash. │ │ │ │ +the result is posted as a dht_immutable_item_alert.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_get_item()

    │ │ │ │ +
    │ │ │ │ +void dht_get_item (std::array<char, 32> key
    │ │ │ │ +      , std::string salt = std::string());
    │ │ │ │ +
    │ │ │ │ +

    query the DHT for a mutable item under the public key key. │ │ │ │ +this is an ed25519 key. salt 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 dht_mutable_item_alert is │ │ │ │ +posted.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_put_item()

    │ │ │ │ +
    │ │ │ │ +sha1_hash dht_put_item (entry data);
    │ │ │ │ +
    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_put_item()

    │ │ │ │ +
    │ │ │ │ +void 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 = std::string());
    │ │ │ │ +
    │ │ │ │ +

    store a mutable item. The key is the public key the blob is │ │ │ │ +to be stored under. The optional salt 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:

    │ │ │ │ +
    │ │ │ │ +
    entry& value
    │ │ │ │ +
    the current value stored under the key (may be empty). Also expected │ │ │ │ +to be set to the value to be stored by the function.
    │ │ │ │ +
    std::array<char,64>& signature
    │ │ │ │ +
    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 │ │ │ │ +sign_mutable_item function.
    │ │ │ │ +
    std::int64_t& seq
    │ │ │ │ +
    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.
    │ │ │ │ +
    std::string const& salt
    │ │ │ │ +
    this is the salt that was used for this put call.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    label
    │ │ │ │ -
    not used by libtorrent. It's intended as a potentially user-facing │ │ │ │ -identifier of this peer class.
    │ │ │ │ +

    Since the callback function cb 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 update 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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_announce() dht_get_peers()

    │ │ │ │ +
    │ │ │ │ +void dht_get_peers (sha1_hash const& info_hash);
    │ │ │ │ +void dht_announce (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 │ │ │ │ +dht_get_peers_reply_alert.

    │ │ │ │ +

    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 announce_port override setting.

    │ │ │ │ +

    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.

    │ │ │ │ +

    For possible flags, see announce_flags_t.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_live_nodes()

    │ │ │ │ +
    │ │ │ │ +void dht_live_nodes (sha1_hash const& nid);
    │ │ │ │ +
    │ │ │ │ +

    Retrieve all the live DHT (identified by nid) nodes. All the │ │ │ │ +nodes id and endpoint will be returned in the list of nodes in the │ │ │ │ +alert dht_live_nodes_alert. │ │ │ │ +Since this alert is a response to an explicit call, it will always be │ │ │ │ +posted, regardless of the alert mask.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_sample_infohashes()

    │ │ │ │ +
    │ │ │ │ +void dht_sample_infohashes (udp::endpoint const& ep, sha1_hash const& target);
    │ │ │ │ +
    │ │ │ │ +

    Query the DHT node specified by ep to retrieve a sample of the │ │ │ │ +info-hashes that the node currently have in their storage. │ │ │ │ +The target 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 dht_sample_infohashes_alert.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_direct_request()

    │ │ │ │ +
    │ │ │ │ +void dht_direct_request (udp::endpoint const& ep, entry const& e, client_data_t userdata = {});
    │ │ │ │ +
    │ │ │ │ +

    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 dht_direct_response_alert will be posted │ │ │ │ +with the response (if any) and the userdata pointer passed in here. │ │ │ │ +Since this alert is a response to an explicit call, it will always be │ │ │ │ +posted, regardless of the alert mask.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_extension()

    │ │ │ │ +
    │ │ │ │ +void add_extension (std::shared_ptr<plugin> ext);
    │ │ │ │ +void add_extension (std::function<std::shared_ptr<torrent_plugin>(
    │ │ │ │ +      torrent_handle const&, client_data_t)> ext);
    │ │ │ │ +
    │ │ │ │ +

    This function adds an extension to this session. 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 libtorrent plugins. 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 │ │ │ │ +directly. Makes it possible to join a swarm with just a tracker and │ │ │ │ +info-hash.
    │ │ │ │
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +
    │ │ │ │ +#include <libtorrent/extensions/ut_metadata.hpp>
    │ │ │ │ +ses.add_extension(&lt::create_ut_metadata_plugin);
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    uTorrent peer exchange
    │ │ │ │ +
    Exchanges peers between clients.
    │ │ │ │
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ +
    │ │ │ │ +#include <libtorrent/extensions/ut_pex.hpp>
    │ │ │ │ +ses.add_extension(&lt::create_ut_pex_plugin);
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    smart ban plugin
    │ │ │ │ +
    A plugin that, with a small overhead, can ban peers │ │ │ │ +that sends bad data with very high accuracy. Should │ │ │ │ +eliminate most problems on poisoned torrents.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    storage_error

    │ │ │ │ -

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │ -

    used by storage to return errors │ │ │ │ -also includes which underlying file the │ │ │ │ -error happened on

    │ │ │ │ +
    │ │ │ │ +#include <libtorrent/extensions/smart_ban.hpp>
    │ │ │ │ +ses.add_extension(&lt::create_smart_ban_plugin);
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    get_ip_filter() set_ip_filter()

    │ │ │ │
    │ │ │ │ -struct storage_error
    │ │ │ │ -{
    │ │ │ │ -   explicit operator bool () const;
    │ │ │ │ -   void file (file_index_t f);
    │ │ │ │ -   file_index_t file () const;
    │ │ │ │ -
    │ │ │ │ -   error_code ec;
    │ │ │ │ -   operation_t operation;
    │ │ │ │ -};
    │ │ │ │ +void set_ip_filter (ip_filter f);
    │ │ │ │ +ip_filter get_ip_filter () const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    bool()

    │ │ │ │ +

    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 ip_filter.

    │ │ │ │ +

    Each time a peer is blocked because of the IP filter, a │ │ │ │ +peer_blocked_alert is generated. get_ip_filter() Returns the │ │ │ │ +ip_filter currently in the session. See ip_filter.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_port_filter()

    │ │ │ │
    │ │ │ │ -explicit operator bool () const;
    │ │ │ │ +void set_port_filter (port_filter const& f);
    │ │ │ │  
    │ │ │ │ -

    explicitly converts to true if this object represents an error, and │ │ │ │ -false if it does not.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file()

    │ │ │ │ +

    apply port_filter 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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    is_listening() ssl_listen_port() listen_port()

    │ │ │ │
    │ │ │ │ -void file (file_index_t f);
    │ │ │ │ -file_index_t file () const;
    │ │ │ │ +unsigned short listen_port () const;
    │ │ │ │ +bool is_listening () const;
    │ │ │ │ +unsigned short ssl_listen_port () const;
    │ │ │ │  
    │ │ │ │ -

    set and query the index (in the torrent) of the file this error │ │ │ │ -occurred on. This may also have special values defined in │ │ │ │ -torrent_status.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    ec
    │ │ │ │ -
    the error that occurred
    │ │ │ │ +

    is_listening() will tell you whether or not the session has │ │ │ │ +successfully opened a listening port. If it hasn't, this function will │ │ │ │ +return false, and then you can set a new │ │ │ │ +settings_pack::listen_interfaces to try another interface and port to │ │ │ │ +bind to.

    │ │ │ │ +

    listen_port() returns the port we ended up listening on.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_peer_class_filter() get_peer_class_filter()

    │ │ │ │ +
    │ │ │ │ +void set_peer_class_filter (ip_filter const& f);
    │ │ │ │ +ip_filter get_peer_class_filter () const;
    │ │ │ │ +
    │ │ │ │ +

    Sets the peer class filter for this session. 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 ip_filter.

    │ │ │ │ +

    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:

    │ │ │ │ +
    │ │ │ │ +ip_filter f = ses.get_peer_class_filter();
    │ │ │ │ +peer_class_t my_class = ses.create_peer_class("200.1.x.x IP range");
    │ │ │ │ +f.add_rule(make_address("200.1.1.0"), make_address("200.1.255.255")
    │ │ │ │ +        , 1 << static_cast<std::uint32_t>(my_class));
    │ │ │ │ +ses.set_peer_class_filter(f);
    │ │ │ │ +
    │ │ │ │ +

    This setting only applies to new connections, it won't affect existing │ │ │ │ +peer connections.

    │ │ │ │ +

    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.

    │ │ │ │ +

    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 peer classes.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_peer_class_type_filter() get_peer_class_type_filter()

    │ │ │ │ +
    │ │ │ │ +peer_class_type_filter get_peer_class_type_filter () const;
    │ │ │ │ +void set_peer_class_type_filter (peer_class_type_filter const& f);
    │ │ │ │ +
    │ │ │ │ +

    Sets and gets the peer class type filter. 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. │ │ │ │ +
    3. peer-class type filter, removing classes
    4. │ │ │ │ +
    5. peer-class type filter, adding classes
    6. │ │ │ │ +
    │ │ │ │ +

    For more information, see peer classes.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    create_peer_class()

    │ │ │ │ +
    │ │ │ │ +peer_class_t create_peer_class (char const* name);
    │ │ │ │ +
    │ │ │ │ +

    Creates a new peer class (see peer classes) 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.

    │ │ │ │ +

    Identifiers are assigned from low numbers to higher. So if you plan on │ │ │ │ +using certain peer classes in a call to set_peer_class_filter(), │ │ │ │ +make sure to create those early on, to get low identifiers.

    │ │ │ │ +

    For more information on peer classes, see peer classes.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    delete_peer_class()

    │ │ │ │ +
    │ │ │ │ +void delete_peer_class (peer_class_t cid);
    │ │ │ │ +
    │ │ │ │ +

    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 once per peer class you create. │ │ │ │ +Calling it more than once for the same class will lead to memory │ │ │ │ +corruption.

    │ │ │ │ +

    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.

    │ │ │ │ +

    There is no need to call this function for custom peer classes. All │ │ │ │ +peer classes will be properly destructed when the session object │ │ │ │ +destructs.

    │ │ │ │ +

    For more information on peer classes, see peer classes.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    get_peer_class() set_peer_class()

    │ │ │ │ +
    │ │ │ │ +peer_class_info get_peer_class (peer_class_t cid) const;
    │ │ │ │ +void set_peer_class (peer_class_t cid, peer_class_info const& pci);
    │ │ │ │ +
    │ │ │ │ +

    These functions queries information from a peer class and updates the │ │ │ │ +configuration of a peer class, respectively.

    │ │ │ │ +

    cid must refer to an existing peer class. If it does not, the │ │ │ │ +return value of get_peer_class() is undefined.

    │ │ │ │ +

    set_peer_class() sets all the information in the │ │ │ │ +peer_class_info object in the specified peer class. There is no │ │ │ │ +option to only update a single property.

    │ │ │ │ +

    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.

    │ │ │ │ +

    For more information, see peer classes.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    remove_torrent()

    │ │ │ │ +
    │ │ │ │ +void remove_torrent (const torrent_handle&, remove_flags_t = {});
    │ │ │ │ +
    │ │ │ │ +

    remove_torrent() 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 torrent_removed_alert.

    │ │ │ │ +

    remove_torrent() is non-blocking, but will remove the torrent from the │ │ │ │ +session synchronously. Calling session_handle::add_torrent() immediately │ │ │ │ +afterward with the same torrent will succeed. Note that this creates a │ │ │ │ +new handle which is not equal to the removed one.

    │ │ │ │ +

    The optional second argument options can be used to delete all the │ │ │ │ +files downloaded by this torrent. To do so, pass in the value │ │ │ │ +session_handle::delete_files. Once the torrent is deleted, a │ │ │ │ +torrent_deleted_alert is posted.

    │ │ │ │ +

    The torrent_handle remains valid for some time after remove_torrent() 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, │ │ │ │ +torrent_handle::is_valid() will return true, and other calls such │ │ │ │ +as torrent_handle::status() will succeed. Because of this, and because │ │ │ │ +remove_torrent() is non-blocking, the following sequence usually │ │ │ │ +succeeds (does not throw system_error): │ │ │ │ +.. code:: c++

    │ │ │ │ +
    │ │ │ │ +session.remove_handle(handle); │ │ │ │ +handle.save_resume_data();
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    apply_settings() get_settings()

    │ │ │ │ +
    │ │ │ │ +void apply_settings (settings_pack&&);
    │ │ │ │ +settings_pack get_settings () const;
    │ │ │ │ +void apply_settings (settings_pack const&);
    │ │ │ │ +
    │ │ │ │ +

    Applies the settings specified by the settings_pack s. This is an │ │ │ │ +asynchronous operation that will return immediately and actually apply │ │ │ │ +the settings to the main thread of libtorrent some time later.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    pop_alerts() wait_for_alert() set_alert_notify()

    │ │ │ │ +
    │ │ │ │ +void set_alert_notify (std::function<void()> const& fun);
    │ │ │ │ +alert* wait_for_alert (time_duration max_wait);
    │ │ │ │ +void pop_alerts (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 session still owns these alerts and they will stay │ │ │ │ +valid until the next time pop_alerts is called. You may not delete │ │ │ │ +the alert 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.

    │ │ │ │ +

    wait_for_alert will block the current thread for max_wait time │ │ │ │ +duration, or until another alert is posted. If an alert is available │ │ │ │ +at the time of the call, it returns immediately. The returned alert │ │ │ │ +pointer is the head of the alert queue. wait_for_alert does not │ │ │ │ +pop alerts from the queue, it merely peeks at it. The returned alert │ │ │ │ +will stay valid until pop_alerts is called twice. The first time │ │ │ │ +will pop it and the second will free it.

    │ │ │ │ +

    If there is no alert in the queue and no alert arrives within the │ │ │ │ +specified timeout, wait_for_alert returns nullptr.

    │ │ │ │ +

    In the python binding, wait_for_alert takes the number of │ │ │ │ +milliseconds to wait as an integer.

    │ │ │ │ +

    The alert queue in the session 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 session, see │ │ │ │ +settings_pack::alert_queue_size.

    │ │ │ │ +

    Some alerts are considered so important that they are posted even when │ │ │ │ +the alert queue is full. Some alerts are considered mandatory and cannot │ │ │ │ +be disabled by the alert_mask. For instance, │ │ │ │ +save_resume_data_alert and save_resume_data_failed_alert are always │ │ │ │ +posted, regardless of the alert mask.

    │ │ │ │ +

    To control which alerts are posted, set the alert_mask │ │ │ │ +(settings_pack::alert_mask).

    │ │ │ │ +

    If the alert queue fills up to the point where alerts are dropped, this │ │ │ │ +will be indicated by a alerts_dropped_alert, which contains a bitmask │ │ │ │ +of which types of alerts were dropped. Generally it is a good idea to │ │ │ │ +make sure the alert queue is large enough, the alert_mask doesn't have │ │ │ │ +unnecessary categories enabled and to call pop_alert() frequently, to │ │ │ │ +avoid alerts being dropped.

    │ │ │ │ +

    the set_alert_notify function lets the client set a function object │ │ │ │ +to be invoked every time the alert queue goes from having 0 alerts to │ │ │ │ +1 alert. 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 pop_alerts(). If the notify function fails │ │ │ │ +to do so, it won't be called again, until pop_alerts 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.

    │ │ │ │ +

    The type of an alert 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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_port_mapping() delete_port_mapping()

    │ │ │ │ +
    │ │ │ │ +void delete_port_mapping (port_mapping_t handle);
    │ │ │ │ +std::vector<port_mapping_t> add_port_mapping (portmap_protocol t, int external_port, int local_port);
    │ │ │ │ +
    │ │ │ │ +

    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 session. The return values are all handles referring to the │ │ │ │ +port mappings that were just created. Pass them to delete_port_mapping() │ │ │ │ +to remove them.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    reopen_network_sockets()

    │ │ │ │ +
    │ │ │ │ +void reopen_network_sockets (reopen_network_flags_t options = reopen_map_ports);
    │ │ │ │ +
    │ │ │ │ +

    Instructs the session to reopen all listen and outgoing sockets.

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    native_handle()

    │ │ │ │ +
    │ │ │ │ +std::shared_ptr<aux::session_impl> native_handle () const;
    │ │ │ │ +
    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    save_settings
    │ │ │ │ +
    saves settings (i.e. the settings_pack)
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    operation
    │ │ │ │ -
    A code from operation_t enum, indicating what │ │ │ │ -kind of operation failed.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    save_dht_state
    │ │ │ │ +
    saves dht state such as nodes and node-id, possibly accelerating │ │ │ │ +joining the DHT if provided at next session startup.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ +[report issue]
    │ │ │ │ +
    save_extension_state
    │ │ │ │ +
    load or save state from plugins
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    save_ip_filter
    │ │ │ │ +
    load or save the IP filter set on the session
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    global_peer_class_id tcp_peer_class_id local_peer_class_id
    │ │ │ │ +
    built-in peer classes
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    delete_files
    │ │ │ │ +
    delete the files belonging to the torrent from disk. │ │ │ │ +including the part-file, if there is one
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    delete_partfile
    │ │ │ │ +
    delete just the part-file associated with this torrent
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    paused
    │ │ │ │ +
    when set, the session will start paused. Call │ │ │ │ +session_handle::resume() to start
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    udp tcp
    │ │ │ │ +
    protocols used by add_port_mapping()
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    libtorrent_category()

    │ │ │ │ -

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │ +
    │ │ │ │ +

    session_proxy

    │ │ │ │ +

    Declared in "libtorrent/session.hpp"

    │ │ │ │ +

    this is a holder for the internal session implementation object. Once the │ │ │ │ +session destruction is explicitly initiated, this holder is used to │ │ │ │ +synchronize the completion of the shutdown. The lifetime of this object │ │ │ │ +may outlive session, causing the session destructor to not block. The │ │ │ │ +session_proxy destructor will block however, until the underlying session │ │ │ │ +is done shutting down.

    │ │ │ │
    │ │ │ │ -boost::system::error_category& libtorrent_category ();
    │ │ │ │ +struct session_proxy
    │ │ │ │ +{
    │ │ │ │ +   session_proxy (session_proxy&&) noexcept;
    │ │ │ │ +   session_proxy& operator= (session_proxy&&) & noexcept;
    │ │ │ │ +   session_proxy& operator= (session_proxy const&) &;
    │ │ │ │ +   session_proxy (session_proxy const&);
    │ │ │ │ +   session_proxy ();
    │ │ │ │ +   ~session_proxy ();
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    return the instance of the libtorrent_error_category which │ │ │ │ -maps libtorrent error codes to human readable error messages.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    http_category()

    │ │ │ │ -

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    session_proxy() ~session_proxy() operator=()

    │ │ │ │
    │ │ │ │ -boost::system::error_category& http_category ();
    │ │ │ │ +session_proxy (session_proxy&&) noexcept;
    │ │ │ │ +session_proxy& operator= (session_proxy&&) & noexcept;
    │ │ │ │ +session_proxy& operator= (session_proxy const&) &;
    │ │ │ │ +session_proxy (session_proxy const&);
    │ │ │ │ +session_proxy ();
    │ │ │ │ +~session_proxy ();
    │ │ │ │  
    │ │ │ │ -

    returns the error_category for HTTP errors

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    pcp_category()

    │ │ │ │ -

    Declared in "libtorrent/natpmp.hpp"

    │ │ │ │ +

    default constructor, does not refer to any session │ │ │ │ +implementation object.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    session

    │ │ │ │ +

    Declared in "libtorrent/session.hpp"

    │ │ │ │ +

    The session holds all state that spans multiple torrents. Among other │ │ │ │ +things it runs the network loop and manages all torrents. Once it's │ │ │ │ +created, the session 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.

    │ │ │ │ +

    You have some control over session configuration through the │ │ │ │ +session_handle::apply_settings() member function. To change one or more │ │ │ │ +configuration options, create a settings_pack. object and fill it with │ │ │ │ +the settings to be set and pass it in to session::apply_settings().

    │ │ │ │ +

    see apply_settings().

    │ │ │ │
    │ │ │ │ -boost::system::error_category& pcp_category ();
    │ │ │ │ +struct session : session_handle
    │ │ │ │ +{
    │ │ │ │ +   session (session_params const& params, session_flags_t flags);
    │ │ │ │ +   session ();
    │ │ │ │ +   explicit session (session_params&& params);
    │ │ │ │ +   session (session_params&& params, session_flags_t flags);
    │ │ │ │ +   explicit session (session_params const& params);
    │ │ │ │ +   session (session_params const& params, io_context& ios);
    │ │ │ │ +   session (session_params&& params, io_context& ios);
    │ │ │ │ +   session (session_params&& params, io_context& ios, session_flags_t);
    │ │ │ │ +   session (session_params const& params, io_context& ios, session_flags_t);
    │ │ │ │ +   ~session ();
    │ │ │ │ +   session_proxy abort ();
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    upnp_category()

    │ │ │ │ -

    Declared in "libtorrent/upnp.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +

    session()

    │ │ │ │
    │ │ │ │ -boost::system::error_category& upnp_category ();
    │ │ │ │ +session (session_params const& params, session_flags_t flags);
    │ │ │ │ +session ();
    │ │ │ │ +explicit session (session_params&& params);
    │ │ │ │ +session (session_params&& params, session_flags_t flags);
    │ │ │ │ +explicit session (session_params const& params);
    │ │ │ │  
    │ │ │ │ -

    the boost.system error category for UPnP errors

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    gzip_category()

    │ │ │ │ -

    Declared in "libtorrent/gzip.hpp"

    │ │ │ │ +

    Constructs the session objects which acts as the container of torrents. │ │ │ │ +In order to avoid a race condition between starting the session and │ │ │ │ +configuring it, you can pass in a session_params object. Its settings │ │ │ │ +will take effect before the session starts up.

    │ │ │ │ +

    The overloads taking flags can be used to start a session in │ │ │ │ +paused mode (by passing in session::paused). Note that │ │ │ │ +add_default_plugins do not have an affect on constructors that │ │ │ │ +take a session_params object. It already contains the plugins to use.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    session()

    │ │ │ │
    │ │ │ │ -boost::system::error_category& gzip_category ();
    │ │ │ │ +session (session_params const& params, io_context& ios);
    │ │ │ │ +session (session_params&& params, io_context& ios);
    │ │ │ │ +session (session_params&& params, io_context& ios, session_flags_t);
    │ │ │ │ +session (session_params const& params, io_context& ios, session_flags_t);
    │ │ │ │  
    │ │ │ │ -

    get the error_category for zip errors

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    socks_category()

    │ │ │ │ -

    Declared in "libtorrent/socks5_stream.hpp"

    │ │ │ │ +

    Overload of the constructor that takes an external io_context to run │ │ │ │ +the session 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 session object does not cleanly terminate with an external │ │ │ │ +io_context. The io_context::run() call must have returned │ │ │ │ +before it's safe to destruct the session. Which means you MUST │ │ │ │ +call session::abort() and save the session_proxy first, then │ │ │ │ +destruct the session object, then sync with the io_context, then │ │ │ │ +destruct the session_proxy object.

    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    ~session()

    │ │ │ │
    │ │ │ │ -boost::system::error_category& socks_category ();
    │ │ │ │ +~session ();
    │ │ │ │  
    │ │ │ │ -

    returns the error_category for SOCKS5 errors

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    i2p_category()

    │ │ │ │ -

    Declared in "libtorrent/i2p_stream.hpp"

    │ │ │ │ +

    The destructor of session 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 session returns. So, it's advised │ │ │ │ +that any kind of interface (such as windows) are closed before │ │ │ │ +destructing the session object. Because it can take a few second for │ │ │ │ +it to finish. The timeout can be set with apply_settings().

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    abort()

    │ │ │ │
    │ │ │ │ -boost::system::error_category& i2p_category ();
    │ │ │ │ +session_proxy abort ();
    │ │ │ │  
    │ │ │ │ -

    returns the error category for I2P errors

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    bdecode_category()

    │ │ │ │ -

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ +

    In case you want to destruct the session asynchronously, you can │ │ │ │ +request a session destruction proxy. If you don't do this, the │ │ │ │ +destructor of the session object will block while the trackers are │ │ │ │ +contacted. If you keep one session_proxy to the session when │ │ │ │ +destructing it, the destructor will not block, but start to close down │ │ │ │ +the session, the destructor of the proxy will then synchronize the │ │ │ │ +threads. So, the destruction of the session is performed from the │ │ │ │ +session destructor call until the session_proxy destructor │ │ │ │ +call. The session_proxy does not have any operations on it (since │ │ │ │ +the session is being closed down, no operations are allowed on it). │ │ │ │ +The only valid operation is calling the destructor:

    │ │ │ │
    │ │ │ │ -boost::system::error_category& bdecode_category ();
    │ │ │ │ +struct session_proxy {};
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum error_code_enum

    │ │ │ │ -

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    no_error0Not an error
    file_collision1Two torrents has files which end up overwriting each other
    failed_hash_check2A piece did not match its piece hash
    torrent_is_no_dict3The .torrent file does not contain a bencoded dictionary at │ │ │ │ -its top level
    torrent_missing_info4The .torrent file does not have an info dictionary
    torrent_info_no_dict5The .torrent file's info entry is not a dictionary
    torrent_missing_piece_length6The .torrent file does not have a piece length entry
    torrent_missing_name7The .torrent file does not have a name entry
    torrent_invalid_name8The .torrent file's name entry is invalid
    torrent_invalid_length9The length of a file, or of the whole .torrent file is invalid. │ │ │ │ -Either negative or not an integer
    torrent_file_parse_failed10Failed to parse a file entry in the .torrent
    torrent_missing_pieces11The pieces field is missing or invalid in the .torrent file
    torrent_invalid_hashes12The pieces string has incorrect length
    too_many_pieces_in_torrent13The .torrent file has more pieces than is supported by libtorrent
    invalid_swarm_metadata14The metadata (.torrent file) that was received from the swarm │ │ │ │ -matched the info-hash, but failed to be parsed
    invalid_bencoding15The file or buffer is not correctly bencoded
    no_files_in_torrent16The .torrent file does not contain any files
    invalid_escaped_string17The string was not properly url-encoded as expected
    session_is_closing18Operation is not permitted since the session is shutting down
    duplicate_torrent19There's already a torrent with that info-hash added to the │ │ │ │ -session
    invalid_torrent_handle20The supplied torrent_handle is not referring to a valid torrent
    invalid_entry_type21The type requested from the entry did not match its type
    missing_info_hash_in_uri22The specified URI does not contain a valid info-hash
    file_too_short23One of the files in the torrent was unexpectedly small. This │ │ │ │ -might be caused by files being changed by an external process
    unsupported_url_protocol24The URL used an unknown protocol. Currently http and │ │ │ │ -https (if built with openssl support) are recognized. For │ │ │ │ -trackers udp is recognized as well.
    url_parse_error25The URL did not conform to URL syntax and failed to be parsed
    peer_sent_empty_piece26The peer sent a piece message of length 0
    parse_failed27A bencoded structure was corrupt and failed to be parsed
    invalid_file_tag28The fast resume file was missing or had an invalid file version │ │ │ │ -tag
    missing_info_hash29The fast resume file was missing or had an invalid info-hash
    mismatching_info_hash30The info-hash did not match the torrent
    invalid_hostname31The URL contained an invalid hostname
    invalid_port32The URL had an invalid port
    port_blocked33The port is blocked by the port-filter, and prevented the │ │ │ │ -connection
    expected_close_bracket_in_address34The IPv6 address was expected to end with "]"
    destructing_torrent35The torrent is being destructed, preventing the operation to │ │ │ │ -succeed
    timed_out36The connection timed out
    upload_upload_connection37The peer is upload only, and we are upload only. There's no point │ │ │ │ -in keeping the connection
    uninteresting_upload_peer38The peer is upload only, and we're not interested in it. There's │ │ │ │ -no point in keeping the connection
    invalid_info_hash39The peer sent an unknown info-hash
    torrent_paused40The torrent is paused, preventing the operation from succeeding
    invalid_have41The peer sent an invalid have message, either wrong size or │ │ │ │ -referring to a piece that doesn't exist in the torrent
    invalid_bitfield_size42The bitfield message had the incorrect size
    too_many_requests_when_choked43The peer kept requesting pieces after it was choked, possible │ │ │ │ -abuse attempt.
    invalid_piece44The peer sent a piece message that does not correspond to a │ │ │ │ -piece request sent by the client
    no_memory45memory allocation failed
    torrent_aborted46The torrent is aborted, preventing the operation to succeed
    self_connection47The peer is a connection to ourself, no point in keeping it
    invalid_piece_size48The peer sent a piece message with invalid size, either negative │ │ │ │ -or greater than one block
    timed_out_no_interest49The peer has not been interesting or interested in us for too │ │ │ │ -long, no point in keeping it around
    timed_out_inactivity50The peer has not said anything in a long time, possibly dead
    timed_out_no_handshake51The peer did not send a handshake within a reasonable amount of │ │ │ │ -time, it might not be a bittorrent peer
    timed_out_no_request52The peer has been unchoked for too long without requesting any │ │ │ │ -data. It might be lying about its interest in us
    invalid_choke53The peer sent an invalid choke message
    invalid_unchoke54The peer send an invalid unchoke message
    invalid_interested55The peer sent an invalid interested message
    invalid_not_interested56The peer sent an invalid not-interested message
    invalid_request57The peer sent an invalid piece request message
    invalid_hash_list58The peer sent an invalid hash-list message (this is part of the │ │ │ │ -merkle-torrent extension)
    invalid_hash_piece59The peer sent an invalid hash-piece message (this is part of the │ │ │ │ -merkle-torrent extension)
    invalid_cancel60The peer sent an invalid cancel message
    invalid_dht_port61The peer sent an invalid DHT port-message
    invalid_suggest62The peer sent an invalid suggest piece-message
    invalid_have_all63The peer sent an invalid have all-message
    invalid_have_none64The peer sent an invalid have none-message
    invalid_reject65The peer sent an invalid reject message
    invalid_allow_fast66The peer sent an invalid allow fast-message
    invalid_extended67The peer sent an invalid extension message ID
    invalid_message68The peer sent an invalid message ID
    sync_hash_not_found69The synchronization hash was not found in the encrypted handshake
    invalid_encryption_constant70The encryption constant in the handshake is invalid
    no_plaintext_mode71The peer does not support plain text, which is the selected mode
    no_rc4_mode72The peer does not support RC4, which is the selected mode
    unsupported_encryption_mode73The peer does not support any of the encryption modes that the │ │ │ │ -client supports
    unsupported_encryption_mode_selected74The peer selected an encryption mode that the client did not │ │ │ │ -advertise and does not support
    invalid_pad_size75The pad size used in the encryption handshake is of invalid size
    invalid_encrypt_handshake76The encryption handshake is invalid
    no_incoming_encrypted77The client is set to not support incoming encrypted connections │ │ │ │ -and this is an encrypted connection
    no_incoming_regular78The client is set to not support incoming regular bittorrent │ │ │ │ -connections, and this is a regular connection
    duplicate_peer_id79The client is already connected to this peer-ID
    torrent_removed80Torrent was removed
    packet_too_large81The packet size exceeded the upper sanity check-limit
    reserved82 
    http_error83The web server responded with an error
    missing_location84The web server response is missing a location header
    invalid_redirection85The web seed redirected to a path that no longer matches the │ │ │ │ -.torrent directory structure
    redirecting86The connection was closed because it redirected to a different │ │ │ │ -URL
    invalid_range87The HTTP range header is invalid
    no_content_length88The HTTP response did not have a content length
    banned_by_ip_filter89The IP is blocked by the IP filter
    too_many_connections90At the connection limit
    peer_banned91The peer is marked as banned
    stopping_torrent92The torrent is stopping, causing the operation to fail
    too_many_corrupt_pieces93The peer has sent too many corrupt pieces and is banned
    torrent_not_ready94The torrent is not ready to receive peers
    peer_not_constructed95The peer is not completely constructed yet
    session_closing96The session is closing, causing the operation to fail
    optimistic_disconnect97The peer was disconnected in order to leave room for a │ │ │ │ -potentially better peer
    torrent_finished98The torrent is finished
    no_router99No UPnP router found
    metadata_too_large100The metadata message says the metadata exceeds the limit
    invalid_metadata_request101The peer sent an invalid metadata request message
    invalid_metadata_size102The peer advertised an invalid metadata size
    invalid_metadata_offset103The peer sent a message with an invalid metadata offset
    invalid_metadata_message104The peer sent an invalid metadata message
    pex_message_too_large105The peer sent a peer exchange message that was too large
    invalid_pex_message106The peer sent an invalid peer exchange message
    invalid_lt_tracker_message107The peer sent an invalid tracker exchange message
    too_frequent_pex108The peer sent an pex messages too often. This is a possible │ │ │ │ -attempt of and attack
    no_metadata109The operation failed because it requires the torrent to have │ │ │ │ -the metadata (.torrent file) and it doesn't have it yet. │ │ │ │ -This happens for magnet links before they have downloaded the │ │ │ │ -metadata, and also torrents added by URL.
    invalid_dont_have110The peer sent an invalid dont_have message. The don't have │ │ │ │ -message is an extension to allow peers to advertise that the │ │ │ │ -no longer has a piece they previously had.
    requires_ssl_connection111The peer tried to connect to an SSL torrent without connecting │ │ │ │ -over SSL.
    invalid_ssl_cert112The peer tried to connect to a torrent with a certificate │ │ │ │ -for a different torrent.
    not_an_ssl_torrent113the torrent is not an SSL torrent, and the operation requires │ │ │ │ -an SSL torrent
    banned_by_port_filter114peer was banned because its listen port is within a banned port │ │ │ │ -range, as specified by the port_filter.
    invalid_session_handle115The session_handle is not referring to a valid session_impl
    invalid_listen_socket116the listen socket associated with this request was closed
    invalid_hash_request117 
    invalid_hashes118 
    invalid_hash_reject119 
    deprecated_120120 
    deprecated_121121 
    deprecated_122122 
    deprecated_123123 
    deprecated_124124 
    missing_file_sizes130The resume data file is missing the file sizes entry
    no_files_in_resume_data131The resume data file file sizes entry is empty
    missing_pieces132The resume data file is missing the pieces and slots entry
    mismatching_number_of_files133The number of files in the resume data does not match the number │ │ │ │ -of files in the torrent
    mismatching_file_size134One of the files on disk has a different size than in the fast │ │ │ │ -resume file
    mismatching_file_timestamp135One of the files on disk has a different timestamp than in the │ │ │ │ -fast resume file
    not_a_dictionary136The resume data file is not a dictionary
    invalid_blocks_per_piece137The blocks per piece entry is invalid in the resume data file
    missing_slots138The resume file is missing the slots entry, which is required │ │ │ │ -for torrents with compact allocation. DEPRECATED
    too_many_slots139The resume file contains more slots than the torrent
    invalid_slot_list140The slot entry is invalid in the resume data
    invalid_piece_index141One index in the slot list is invalid
    pieces_need_reorder142The pieces on disk needs to be re-ordered for the specified │ │ │ │ -allocation mode. This happens if you specify sparse allocation │ │ │ │ -and the files on disk are using compact storage. The pieces needs │ │ │ │ -to be moved to their right position. DEPRECATED
    resume_data_not_modified143this error is returned when asking to save resume data and │ │ │ │ -specifying the flag to only save when there's anything new to save │ │ │ │ -(torrent_handle::only_if_modified) and there wasn't anything changed.
    invalid_save_path144the save_path in add_torrent_params is not valid
    http_parse_error150The HTTP header was not correctly formatted
    http_missing_location151The HTTP response was in the 300-399 range but lacked a location │ │ │ │ -header
    http_failed_decompress152The HTTP response was encoded with gzip or deflate but │ │ │ │ -decompressing it failed
    no_i2p_router160The URL specified an i2p address, but no i2p router is configured
    no_i2p_endpoint161i2p acceptor is not available yet, can't announce without endpoint
    scrape_not_available170The tracker URL doesn't support transforming it into a scrape │ │ │ │ -URL. i.e. it doesn't contain "announce.
    invalid_tracker_response171invalid tracker response
    invalid_peer_dict172invalid peer dictionary entry. Not a dictionary
    tracker_failure173tracker sent a failure message
    invalid_files_entry174missing or invalid files entry
    invalid_hash_entry175missing or invalid hash entry
    invalid_peers_entry176missing or invalid peers and peers6 entry
    invalid_tracker_response_length177UDP tracker response packet has invalid size
    invalid_tracker_transaction_id178invalid transaction id in UDP tracker response
    invalid_tracker_action179invalid action field in UDP tracker response
    announce_skipped180skipped announce (because it's assumed to be unreachable over the │ │ │ │ -given source network interface)
    no_entropy200random number generation failed
    ssrf_mitigation201blocked by SSRF mitigation
    blocked_by_idna202blocked because IDNA host names are banned
    torrent_unknown_version210the torrent file has an unknown meta version
    torrent_missing_file_tree211the v2 torrent file has no file tree
    torrent_missing_meta_version212the torrent contains v2 keys but does not specify meta version 2
    torrent_inconsistent_files213the v1 and v2 file metadata does not match
    torrent_missing_piece_layer214one or more files are missing piece layer hashes
    torrent_invalid_piece_layer215a piece layer has the wrong size or failed hash check
    torrent_missing_pieces_root216a v2 file entry has no root hash
    torrent_inconsistent_hashes217the v1 and v2 hashes do not describe the same data
    torrent_invalid_pad_file218a file in the v2 metadata has the pad attribute set
    error_code_max219the number of error codes
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum http_errors

    │ │ │ │ -

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    cont100 
    ok200 
    created201 
    accepted202 
    no_content204 
    multiple_choices300 
    moved_permanently301 
    moved_temporarily302 
    not_modified304 
    bad_request400 
    unauthorized401 
    forbidden403 
    not_found404 
    internal_server_error500 
    not_implemented501 
    bad_gateway502 
    service_unavailable503 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum pcp_errors

    │ │ │ │ -

    Declared in "libtorrent/natpmp.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    pcp_success0 
    pcp_unsupp_version1 
    pcp_not_authorized2 
    pcp_malformed_request3 
    pcp_unsupp_opcode4 
    pcp_unsupp_option5 
    pcp_malformed_option6 
    pcp_network_failure7 
    pcp_no_resources8 
    pcp_unsupp_protocol9 
    pcp_user_ex_quota10 
    pcp_cannot_provide_external11 
    pcp_address_mismatch12 
    pcp_excessive_remote_peers13 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum error_code_enum

    │ │ │ │ -

    Declared in "libtorrent/upnp.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    no_error0No error
    invalid_argument402One of the arguments in the request is invalid
    action_failed501The request failed
    value_not_in_array714The specified value does not exist in the array
    source_ip_cannot_be_wildcarded715The source IP address cannot be wild-carded, but │ │ │ │ -must be fully specified
    external_port_cannot_be_wildcarded716The external port cannot be a wildcard, but must │ │ │ │ -be specified
    port_mapping_conflict718The port mapping entry specified conflicts with a │ │ │ │ -mapping assigned previously to another client
    internal_port_must_match_external724Internal and external port value must be the same
    only_permanent_leases_supported725The NAT implementation only supports permanent │ │ │ │ -lease times on port mappings
    remote_host_must_be_wildcard726RemoteHost must be a wildcard and cannot be a │ │ │ │ -specific IP address or DNS name
    external_port_must_be_wildcard727ExternalPort must be a wildcard and cannot be a │ │ │ │ -specific port
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum error_code_enum

    │ │ │ │ -

    Declared in "libtorrent/gzip.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    no_error0Not an error
    invalid_gzip_header1the supplied gzip buffer has invalid header
    inflated_data_too_large2the gzip buffer would inflate to more bytes than the specified │ │ │ │ -maximum size, and was rejected.
    data_did_not_terminate3available inflate data did not terminate
    space_exhausted4output space exhausted before completing inflate
    invalid_block_type5invalid block type (type == 3)
    invalid_stored_block_length6stored block length did not match one's complement
    too_many_length_or_distance_codes7dynamic block code description: too many length or distance codes
    code_lengths_codes_incomplete8dynamic block code description: code lengths codes incomplete
    repeat_lengths_with_no_first_length9dynamic block code description: repeat lengths with no first length
    repeat_more_than_specified_lengths10dynamic block code description: repeat more than specified lengths
    invalid_literal_length_code_lengths11dynamic block code description: invalid literal/length code lengths
    invalid_distance_code_lengths12dynamic block code description: invalid distance code lengths
    invalid_literal_code_in_block13invalid literal/length or distance code in fixed or dynamic block
    distance_too_far_back_in_block14distance is too far back in fixed or dynamic block
    unknown_gzip_error15an unknown error occurred during gzip inflation
    error_code_max16the number of error codes
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum socks_error_code

    │ │ │ │ -

    Declared in "libtorrent/socks5_stream.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    no_error0 
    unsupported_version1 
    unsupported_authentication_method2 
    unsupported_authentication_version3 
    authentication_error4 
    username_required5 
    general_failure6 
    command_not_supported7 
    no_identd8 
    identd_error9 
    num_errors10 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum i2p_error_code

    │ │ │ │ -

    Declared in "libtorrent/i2p_stream.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    no_error0 
    parse_failed1 
    cant_reach_peer2 
    i2p_error3 
    invalid_key4 
    invalid_id5 
    timeout6 
    key_not_found7 
    duplicated_id8 
    num_errors9 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum error_code_enum

    │ │ │ │ -

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    no_error0Not an error
    expected_digit1expected digit in bencoded string
    expected_colon2expected colon in bencoded string
    unexpected_eof3unexpected end of file in bencoded string
    expected_value4expected value (list, dict, int or string) in bencoded string
    depth_exceeded5bencoded recursion depth limit exceeded
    limit_exceeded6bencoded item count limit exceeded
    overflow7integer overflow
    error_code_max8the number of error codes
    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    write_session_params_buf() read_session_params() write_session_params()

    │ │ │ │ +

    Declared in "libtorrent/session_params.hpp"

    │ │ │ │ +
    │ │ │ │ +session_params read_session_params (bdecode_node const& e
    │ │ │ │ +   , save_state_flags_t flags = save_state_flags_t::all());
    │ │ │ │ +std::vector<char> write_session_params_buf (session_params const& sp
    │ │ │ │ +   , save_state_flags_t flags = save_state_flags_t::all());
    │ │ │ │ +session_params read_session_params (span<char const> buf
    │ │ │ │ +   , save_state_flags_t flags = save_state_flags_t::all());
    │ │ │ │ +entry write_session_params (session_params const& sp
    │ │ │ │ +   , 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 session_params object is used to initialize a new │ │ │ │ +session using the state from a previous one (or by programmatically configure │ │ │ │ +the session 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 session are not part of the session_params state, they have │ │ │ │ +to be restored separately.

    │ │ │ │ [report issue]
    │ │ │ │ -
    │ │ │ │ +
    │ │ │ │

    counters

    │ │ │ │

    Declared in "libtorrent/performance_counters.hpp"

    │ │ │ │
    │ │ │ │  struct counters
    │ │ │ │  {
    │ │ │ │     counters () ;
    │ │ │ │ -   counters (counters const&) ;
    │ │ │ │     counters& operator= (counters const&) & ;
    │ │ │ │ +   counters (counters const&) ;
    │ │ │ │     std::int64_t inc_stats_counter (int c, std::int64_t value = 1) ;
    │ │ │ │     std::int64_t operator[] (int i) const ;
    │ │ │ │     void set_value (int c, std::int64_t value) ;
    │ │ │ │     void blend_stats_counter (int c, std::int64_t value, int ratio) ;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ │ │ │ │ @@ -11730,3464 +12105,2088 @@ │ │ │ │ │ │ │ │ gauge │ │ │ │ 1 │ │ │ │   │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

    The pop_alerts() function on session is the main interface for retrieving │ │ │ │ -alerts (warnings, messages and errors from libtorrent). If no alerts have │ │ │ │ -been posted by libtorrent pop_alerts() will return an empty list.

    │ │ │ │ -

    By default, only errors are reported. settings_pack::alert_mask can be │ │ │ │ -used to specify which kinds of events should be reported. The alert mask is │ │ │ │ -a combination of the alert_category_t flags in the alert class.

    │ │ │ │ -

    Every alert 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 alert bitmask to 0 will disable all alerts (except those │ │ │ │ -that are non-discardable). Alerts that are responses to API calls such as │ │ │ │ -save_resume_data() and post_session_stats() are non-discardable and will be │ │ │ │ -posted even if their category is disabled.

    │ │ │ │ -

    There are other alert base classes that some alerts derive from, all the │ │ │ │ -alerts that are generated for a specific torrent are derived from │ │ │ │ -torrent_alert, and tracker events derive from tracker_alert.

    │ │ │ │ -

    Alerts returned by pop_alerts() are only valid until the next call to │ │ │ │ -pop_alerts(). You may not copy an alert object to access it after the next │ │ │ │ -call to pop_alerts(). Internal members of alerts also become invalid once │ │ │ │ -pop_alerts() is called again.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_routing_bucket

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    struct to hold information about a single DHT routing table bucket

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_torrent_params

    │ │ │ │ +

    Declared in "libtorrent/add_torrent_params.hpp"

    │ │ │ │ +

    The add_torrent_params contains all the information in a .torrent file │ │ │ │ +along with all information necessary to add that torrent to a session. │ │ │ │ +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 session, one of those fields must be set │ │ │ │ +in addition to save_path. The add_torrent_params 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 session. For serialization and de-serialization of │ │ │ │ +add_torrent_params objects, see read_resume_data() and │ │ │ │ +write_resume_data().

    │ │ │ │ +

    The add_torrent_params is also used to represent a parsed .torrent │ │ │ │ +file. It can be loaded via load_torrent_file(), load_torrent_buffer() and │ │ │ │ +load_torrent_parsed(). It can be saved via write_torrent_file().

    │ │ │ │
    │ │ │ │ -struct dht_routing_bucket
    │ │ │ │ +struct add_torrent_params
    │ │ │ │  {
    │ │ │ │ -   int num_nodes;
    │ │ │ │ -   int num_replacements;
    │ │ │ │ -   int last_active;
    │ │ │ │ +   int version  = 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 storage_mode  = storage_mode_sparse;
    │ │ │ │ +   client_data_t userdata;
    │ │ │ │ +   aux::noexcept_movable<std::vector<download_priority_t>> file_priorities;
    │ │ │ │ +   std::string trackerid;
    │ │ │ │ +   torrent_flags_t flags  = torrent_flags::default_flags;
    │ │ │ │ +   info_hash_t info_hashes;
    │ │ │ │ +   int max_uploads  = -1;
    │ │ │ │ +   int max_connections  = -1;
    │ │ │ │ +   int upload_limit  = -1;
    │ │ │ │ +   int download_limit  = -1;
    │ │ │ │ +   std::int64_t total_uploaded  = 0;
    │ │ │ │ +   std::int64_t total_downloaded  = 0;
    │ │ │ │ +   int active_time  = 0;
    │ │ │ │ +   int finished_time  = 0;
    │ │ │ │ +   int seeding_time  = 0;
    │ │ │ │ +   std::time_t added_time  = 0;
    │ │ │ │ +   std::time_t completed_time  = 0;
    │ │ │ │ +   std::time_t last_seen_complete  = 0;
    │ │ │ │ +   int num_complete  = -1;
    │ │ │ │ +   int num_incomplete  = -1;
    │ │ │ │ +   int num_downloaded  = -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 last_download  = 0;
    │ │ │ │ +   std::time_t last_upload  = 0;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    num_nodes num_replacements
    │ │ │ │ -
    the total number of nodes and replacement nodes │ │ │ │ -in the routing table
    │ │ │ │ +[report issue]
    │ │ │ │ +
    version
    │ │ │ │ +
    filled in by the constructor and should be left untouched. It is used │ │ │ │ +for forward binary compatibility.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    last_active
    │ │ │ │ -
    number of seconds since last activity
    │ │ │ │ +[report issue]
    │ │ │ │ +
    ti
    │ │ │ │ +
    torrent_info object with the torrent to add. Unless the │ │ │ │ +info_hash is set, this is required to be initialized.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    torrent_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This is a base class for alerts that are associated with a │ │ │ │ -specific torrent. It contains a handle to the torrent.

    │ │ │ │ -

    Note that by the time the client receives a torrent_alert, its │ │ │ │ -handle member may be invalid.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    dht_nodes
    │ │ │ │ +
    a list of hostname and port pairs, representing DHT nodes to be added │ │ │ │ +to the session (if DHT is enabled). The hostname may be an IP address.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    name
    │ │ │ │ +
    in case there's no other name in this torrent, this name will be used. │ │ │ │ +The name out of the torrent_info object takes precedence if available.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.

    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    storage_mode
    │ │ │ │ +
    One of the values from storage_mode_t. For more information, see │ │ │ │ +storage allocation.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    userdata
    │ │ │ │ +
    The userdata parameter is optional and will be passed on to the │ │ │ │ +extension constructor functions, if any │ │ │ │ +(see torrent_handle::add_extension()). It will also be stored in the │ │ │ │ +torrent object and can be retrieved by calling userdata().
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    flags
    │ │ │ │ +

    flags controlling aspects of this torrent and how it's added. See │ │ │ │ +torrent_flags_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.

    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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 parse_magnet_uri() to populate fields in the │ │ │ │ +add_torrent_params object.
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    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 torrent_handle. 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 torrent_handle

    │ │ │ │ +

    For fine grained control over rate limits, including making them apply │ │ │ │ +to local peers, see peer classes.

    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    upload_limit download_limit
    │ │ │ │ +
    the upload and download rate limits for this torrent, specified in │ │ │ │ +bytes per second. -1 means unlimited.
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    total_uploaded total_downloaded
    │ │ │ │ +
    the total number of bytes uploaded and downloaded by this torrent so │ │ │ │ +far.
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    active_time finished_time seeding_time
    │ │ │ │ +
    the number of seconds this torrent has spent in started, finished and │ │ │ │ +seeding state so far, respectively.
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    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 add_torrent() is │ │ │ │ +called.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    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.

    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    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 BEP 17.

    │ │ │ │ +

    url_seeds expects URLs to regular web servers, aka "get right" style, │ │ │ │ +specified in BEP 19.

    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    peers
    │ │ │ │ +
    peers to add to the torrent, to be tried to be connected to as │ │ │ │ +bittorrent peers.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    banned_peers
    │ │ │ │ +
    peers banned from this torrent. The will not be connected to
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    unfinished_pieces
    │ │ │ │ +
    this is a map of partially downloaded piece. The key is the piece index │ │ │ │ +and the value is a bitfield where each bit represents a 16 kiB block. │ │ │ │ +A set bit means we have that block.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    have_pieces
    │ │ │ │ +
    this is a bitfield indicating which pieces we already have of this │ │ │ │ +torrent.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    verified_pieces
    │ │ │ │ +
    when in seed_mode, pieces with a set bit in this bitfield have been │ │ │ │ +verified to be valid. Other pieces will be verified the first time a │ │ │ │ +peer requests it.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    merkle_trees
    │ │ │ │ +
    v2 hashes, if known
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    renamed_files
    │ │ │ │ +
    this is a map of file indices in the torrent and new filenames to be │ │ │ │ +applied before the torrent is added.
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    client_data_t

    │ │ │ │ +

    Declared in "libtorrent/client_data.hpp"

    │ │ │ │ +

    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 torrent_alert : alert
    │ │ │ │ +struct client_data_t
    │ │ │ │  {
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* torrent_name () const;
    │ │ │ │ +   client_data_t () = default;
    │ │ │ │ +   explicit client_data_t (T* v);
    │ │ │ │ +   client_data_t& operator= (T* v);
    │ │ │ │ +   explicit operator T () const;
    │ │ │ │ +   T* get () const;
    │ │ │ │ +   operator void* () const = delete;
    │ │ │ │ +   operator void const* () const = delete;
    │ │ │ │ +   client_data_t& operator= (void*) = delete;
    │ │ │ │ +   client_data_t& operator= (void const*) = delete;
    │ │ │ │  
    │ │ │ │ -   torrent_handle handle;
    │ │ │ │ +   template <typename T, typename U  = typename std::enable_if<std::is_pointer<T>::value>::type>
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    message()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    client_data_t()

    │ │ │ │
    │ │ │ │ -std::string message () const override;
    │ │ │ │ +client_data_t () = default;
    │ │ │ │  
    │ │ │ │ -

    returns the message associated with this alert

    │ │ │ │ -[report issue]
    │ │ │ │ -
    handle
    │ │ │ │ -
    The torrent_handle pointing to the torrent this │ │ │ │ -alert is associated with.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    peer_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    The peer alert is a base class for alerts that refer to a specific peer. It includes all │ │ │ │ -the information to identify the peer. i.e. ip and peer-id.

    │ │ │ │ +

    construct a nullptr client data

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    const*() void*() operator=()

    │ │ │ │
    │ │ │ │ -struct peer_alert : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ +operator void* () const = delete;
    │ │ │ │ +operator void const* () const = delete;
    │ │ │ │ +client_data_t& operator= (void*) = delete;
    │ │ │ │ +client_data_t& operator= (void const*) = delete;
    │ │ │ │ +
    │ │ │ │ +

    we don't allow type-unsafe operations

    │ │ │ │ +

    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. │ │ │ │ +
    3. the torrent properties are set, such as tracker url, web seeds, │ │ │ │ +DHT nodes etc.
    4. │ │ │ │ +
    5. Read through all the files in the torrent, SHA-1 all the data │ │ │ │ +and set the piece hashes.
    6. │ │ │ │ +
    7. The torrent is bencoded into a file or buffer.
    8. │ │ │ │ +
    │ │ │ │ +

    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;
    │ │ │ │  
    │ │ │ │ -   aux::noexcept_movable<tcp::endpoint> endpoint;
    │ │ │ │ -   peer_id pid;
    │ │ │ │ -};
    │ │ │ │ +// 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());
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    endpoint
    │ │ │ │ -
    The peer's IP address and port.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    pid
    │ │ │ │ -
    the peer ID, if known.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    tracker_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This is a base class used for alerts that are associated with a │ │ │ │ -specific tracker. It derives from torrent_alert since a tracker │ │ │ │ -is also associated with a specific torrent.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    create_torrent

    │ │ │ │ +

    Declared in "libtorrent/create_torrent.hpp"

    │ │ │ │ +

    This class holds state for creating a torrent. After having added │ │ │ │ +all information to it, call create_torrent::generate() to generate │ │ │ │ +the torrent. The entry that's returned can then be bencoded into a │ │ │ │ +.torrent file using bencode().

    │ │ │ │
    │ │ │ │ -struct tracker_alert : torrent_alert
    │ │ │ │ +struct create_torrent
    │ │ │ │  {
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* tracker_url () const;
    │ │ │ │ +   explicit create_torrent (file_storage& fs, int piece_size = 0
    │ │ │ │ +      , create_flags_t flags = {});
    │ │ │ │ +   explicit create_torrent (torrent_info const& ti);
    │ │ │ │ +   entry generate () const;
    │ │ │ │ +   std::vector<char> generate_buf () const;
    │ │ │ │ +   file_storage const& files () const;
    │ │ │ │ +   void set_comment (char const* str);
    │ │ │ │ +   void set_creator (char const* str);
    │ │ │ │ +   void set_creation_date (std::time_t timestamp);
    │ │ │ │ +   void set_hash (piece_index_t index, sha1_hash const& h);
    │ │ │ │ +   void set_hash2 (file_index_t file, piece_index_t::diff_type piece, sha256_hash const& h);
    │ │ │ │ +   void add_url_seed (string_view url);
    │ │ │ │ +   void add_http_seed (string_view url);
    │ │ │ │ +   void add_node (std::pair<std::string, int> node);
    │ │ │ │ +   void add_tracker (string_view url, int tier = 0);
    │ │ │ │ +   void set_root_cert (string_view cert);
    │ │ │ │ +   void set_priv (bool p);
    │ │ │ │ +   bool priv () const;
    │ │ │ │ +   bool is_v2_only () const;
    │ │ │ │ +   bool is_v1_only () const;
    │ │ │ │ +   int num_pieces () const;
    │ │ │ │ +   piece_index_t end_piece () const;
    │ │ │ │ +   index_range<piece_index_t> piece_range () const noexcept;
    │ │ │ │ +   file_index_t end_file () const;
    │ │ │ │ +   index_range<file_index_t> file_range () const noexcept;
    │ │ │ │ +   index_range<piece_index_t::diff_type> file_piece_range (file_index_t f);
    │ │ │ │ +   std::int64_t total_size () const;
    │ │ │ │ +   int piece_size (piece_index_t i) const;
    │ │ │ │ +   int piece_length () const;
    │ │ │ │ +   void add_collection (string_view c);
    │ │ │ │ +   void add_similar_torrent (sha1_hash ih);
    │ │ │ │  
    │ │ │ │ -   aux::noexcept_movable<tcp::endpoint> local_endpoint;
    │ │ │ │ +   static constexpr create_flags_t modification_time  = 2_bit;
    │ │ │ │ +   static constexpr create_flags_t symlinks  = 3_bit;
    │ │ │ │ +   static constexpr create_flags_t v2_only  = 5_bit;
    │ │ │ │ +   static constexpr create_flags_t v1_only  = 6_bit;
    │ │ │ │ +   static constexpr create_flags_t canonical_files  = 7_bit;
    │ │ │ │ +   static constexpr create_flags_t no_attributes  = 8_bit;
    │ │ │ │ +   static constexpr create_flags_t canonical_files_no_tail_padding  = 9_bit;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    tracker_url()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    create_torrent()

    │ │ │ │
    │ │ │ │ -char const* tracker_url () const;
    │ │ │ │ +explicit create_torrent (file_storage& fs, int piece_size = 0
    │ │ │ │ +      , create_flags_t flags = {});
    │ │ │ │ +explicit create_torrent (torrent_info const& ti);
    │ │ │ │  
    │ │ │ │ -

    returns a 0-terminated string of the tracker's URL

    │ │ │ │ -[report issue]
    │ │ │ │ -
    local_endpoint
    │ │ │ │ -
    endpoint of the listen interface being announced
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ +

    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 file_storage (fs) parameter defines the files, sizes and │ │ │ │ +their properties for the torrent to be created. Set this up first, │ │ │ │ +before passing it to the create_torrent 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 create_torrent::generate(). This means │ │ │ │ +that none of the member functions of create_torrent that affects │ │ │ │ +the content of the info dictionary (such as set_hash()), will │ │ │ │ +have any affect. Instead of using this overload, consider using │ │ │ │ +write_torrent_file() instead.

    │ │ │ │ +
    │ │ │ │ +

    Warning

    │ │ │ │ +

    The file_storage and torrent_info objects must stay alive for the │ │ │ │ +entire duration of the create_torrent object.

    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    torrent_removed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    The torrent_removed_alert 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 alert_category::status bit is set in the alert_mask.

    │ │ │ │ -

    Note that the handle remains valid for some time after │ │ │ │ -torrent_removed_alert is posted, as long as some internal libtorrent │ │ │ │ -task (such as an I/O task) refers to it. Additionally, other alerts like │ │ │ │ -save_resume_data_alert may be posted after torrent_removed_alert. │ │ │ │ -To synchronize on whether the torrent has been removed or not, call │ │ │ │ -torrent_handle::in_session(). This will return true before │ │ │ │ -torrent_removed_alert is posted, and false afterward.

    │ │ │ │ -

    Even though the handle 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.

    │ │ │ │ -

    The torrent_handle acts as a weak_ptr, even though its object no │ │ │ │ -longer exists, it can still compare equal to another weak pointer which │ │ │ │ -points to the same non-existent object.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    generate() generate_buf()

    │ │ │ │
    │ │ │ │ -struct torrent_removed_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -   info_hash_t info_hashes;
    │ │ │ │ -   client_data_t userdata;
    │ │ │ │ -};
    │ │ │ │ +entry generate () const;
    │ │ │ │ +std::vector<char> generate_buf () const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    userdata
    │ │ │ │ -
    'userdata` as set in add_torrent_params at torrent creation. │ │ │ │ -This can be used to associate this torrent with related data │ │ │ │ -in the client application more efficiently than info_hashes.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    read_piece_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is posted when the asynchronous read operation initiated by │ │ │ │ -a call to torrent_handle::read_piece() is completed. If the read failed, the torrent │ │ │ │ -is paused and an error state is set and the buffer member of the alert │ │ │ │ -is 0. If successful, buffer points to a buffer containing all the data │ │ │ │ -of the piece. piece is the piece index that was read. size is the │ │ │ │ -number of bytes that was read.

    │ │ │ │ -

    If the operation fails, error will indicate what went wrong.

    │ │ │ │ +

    This function will generate the .torrent file as a bencode tree, or a │ │ │ │ +bencoded into a buffer. │ │ │ │ +In order to encode the entry into a flat file, use the bencode() function.

    │ │ │ │ +

    The function returning an entry 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 (set_hash()) and not all v2 hashes (set_hash2()) │ │ │ │ +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, generate() │ │ │ │ +fails.
    • │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    files()

    │ │ │ │
    │ │ │ │ -struct read_piece_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -   boost::shared_array<char> const buffer;
    │ │ │ │ -   piece_index_t const piece;
    │ │ │ │ -   int const size;
    │ │ │ │ -};
    │ │ │ │ +file_storage const& files () const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_completed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This is posted whenever an individual file completes its download. i.e. │ │ │ │ -All pieces overlapping this file have passed their hash check.

    │ │ │ │ +

    returns an immutable reference to the file_storage used to create │ │ │ │ +the torrent from.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_comment()

    │ │ │ │
    │ │ │ │ -struct file_completed_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   file_index_t const index;
    │ │ │ │ -};
    │ │ │ │ +void set_comment (char const* str);
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    index
    │ │ │ │ -
    refers to the index of the file that completed.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_renamed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This is posted as a response to a torrent_handle::rename_file() call, if the rename │ │ │ │ -operation succeeds.

    │ │ │ │ +

    Sets the comment for the torrent. The string str should be utf-8 encoded. │ │ │ │ +The comment in a torrent file is optional.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_creator()

    │ │ │ │
    │ │ │ │ -struct file_renamed_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* new_name () const;
    │ │ │ │ -   char const* old_name () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ -   file_index_t const index;
    │ │ │ │ -};
    │ │ │ │ +void set_creator (char const* str);
    │ │ │ │  
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    old_name() new_name()

    │ │ │ │ +

    Sets the creator of the torrent. The string str should be utf-8 encoded. │ │ │ │ +This is optional.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_creation_date()

    │ │ │ │
    │ │ │ │ -char const* new_name () const;
    │ │ │ │ -char const* old_name () const;
    │ │ │ │ +void set_creation_date (std::time_t timestamp);
    │ │ │ │  
    │ │ │ │ -

    returns the new and previous file name, respectively.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    index
    │ │ │ │ -
    refers to the index of the file that was renamed,
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    file_rename_failed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This is posted as a response to a torrent_handle::rename_file() call, if the rename │ │ │ │ -operation failed.

    │ │ │ │ +

    sets the "creation time" field. Defaults to the system clock at the │ │ │ │ +time of construction of the create_torrent 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_hash()

    │ │ │ │
    │ │ │ │ -struct file_rename_failed_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ -   file_index_t const index;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -};
    │ │ │ │ +void set_hash (piece_index_t index, sha1_hash const& h);
    │ │ │ │  
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    index error
    │ │ │ │ -
    refers to the index of the file that was supposed to be renamed, │ │ │ │ -error is the error code returned from the filesystem.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    performance_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a limit is reached that might have a negative impact on │ │ │ │ -upload or download rate performance.

    │ │ │ │ +

    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 set_piece_hashes(). │ │ │ │ +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 generate(). │ │ │ │ +This function will throw std::system_error if it is called on an │ │ │ │ +object constructed with the v2_only flag.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_hash2()

    │ │ │ │
    │ │ │ │ -struct performance_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () 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 static_category  = alert_category::performance_warning;
    │ │ │ │ -   performance_warning_t const warning_code;
    │ │ │ │ -};
    │ │ │ │ +void set_hash2 (file_index_t file, piece_index_t::diff_type piece, sha256_hash const& h);
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    enum performance_warning_t

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    outstanding_disk_buffer_limit_reached0This warning means that the number of bytes queued to be written to disk │ │ │ │ -exceeds the max disk byte queue setting (settings_pack::max_queued_disk_bytes). │ │ │ │ -This might restrict the download rate, by not queuing up enough write jobs │ │ │ │ -to the disk I/O thread. When this alert is posted, peer connections are │ │ │ │ -temporarily stopped from downloading, until the queued disk bytes have fallen │ │ │ │ -below the limit again. Unless your max_queued_disk_bytes setting is already │ │ │ │ -high, you might want to increase it to get better performance.
    outstanding_request_limit_reached1This is posted when libtorrent would like to send more requests to a peer, │ │ │ │ -but it's limited by settings_pack::max_out_request_queue. The queue length │ │ │ │ -libtorrent is trying to achieve is determined by the download rate and the │ │ │ │ -assumed round-trip-time (settings_pack::request_queue_time). 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 alert │ │ │ │ -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 max_out_request_queue │ │ │ │ -setting.
    upload_limit_too_low2This 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.
    download_limit_too_low3This is the same warning as upload_limit_too_low 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.
    send_buffer_watermark_too_low4

    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:

    │ │ │ │ -
    │ │ │ │ -min(512, max(upload_rate * send_buffer_watermark_factor / 100, send_buffer_watermark))
    │ │ │ │ +

    sets the bittorrent v2 hash for file file of the piece piece. │ │ │ │ +piece is relative to the first piece of the file, starting at 0. The │ │ │ │ +first piece in the file can be computed with │ │ │ │ +file_storage::file_index_at_piece(). │ │ │ │ +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 generate(). │ │ │ │ +This function will throw std::system_error if it is called on an │ │ │ │ +object constructed with the v1_only flag.

    │ │ │ │ + │ │ │ │ +[report issue] │ │ │ │ +
    │ │ │ │ +

    add_http_seed() add_url_seed()

    │ │ │ │ +
    │ │ │ │ +void add_url_seed (string_view url);
    │ │ │ │ +void add_http_seed (string_view url);
    │ │ │ │  
    │ │ │ │ -

    If you receive this alert, you might want to either increase your send_buffer_watermark │ │ │ │ -or send_buffer_watermark_factor.

    │ │ │ │ -
    too_many_optimistic_unchoke_slots5If 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.
    too_high_disk_queue_limit6If 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 max_queued_disk_bytes or increase cache_size.
    aio_limit_reached7 
    deprecated_bittyrant_with_no_uplimit8 
    too_few_outgoing_ports9This is generated if outgoing peer connections are failing because of address in use │ │ │ │ -errors, indicating that settings_pack::outgoing_ports is set and is too small of │ │ │ │ -a range. Consider not using the outgoing_ports setting at all, or widen the range to │ │ │ │ -include more ports.
    too_few_file_descriptors10 
    num_warnings11 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    state_changed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    Generated whenever a torrent changes its state.

    │ │ │ │ -
    │ │ │ │ -struct state_changed_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -   torrent_status::state_t const state;
    │ │ │ │ -   torrent_status::state_t const prev_state;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    state
    │ │ │ │ -
    the new state of the torrent.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    prev_state
    │ │ │ │ -
    the previous state.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    tracker_error_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated on tracker time outs, premature disconnects, │ │ │ │ -invalid response or a HTTP response other than "200 OK". From the alert │ │ │ │ -you can get the handle to the torrent the tracker belongs to.

    │ │ │ │ -
    │ │ │ │ -struct tracker_error_alert final : tracker_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* failure_reason () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::tracker | alert_category::error;
    │ │ │ │ -   int const times_in_row;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -   operation_t op;
    │ │ │ │ -   protocol_version version;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    failure_reason()

    │ │ │ │ -
    │ │ │ │ -char const* failure_reason () const;
    │ │ │ │ -
    │ │ │ │ -

    if the tracker sent a "failure reason" string, it will be returned │ │ │ │ -here.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    times_in_row
    │ │ │ │ -
    This member says how many times in a row this tracker has failed.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    the error code indicating why the tracker announce failed. If it is │ │ │ │ -is lt::errors::tracker_failure the failure_reason() might contain │ │ │ │ -a more detailed description of why the tracker rejected the request. │ │ │ │ -HTTP status codes indicating errors are also set in this field.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    version
    │ │ │ │ -
    the bittorrent protocol version that was announced
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    tracker_warning_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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.

    │ │ │ │ -
    │ │ │ │ -struct tracker_warning_alert final : tracker_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* warning_message () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::tracker | alert_category::error;
    │ │ │ │ -   protocol_version version;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    warning_message()

    │ │ │ │ -
    │ │ │ │ -char const* warning_message () const;
    │ │ │ │ -
    │ │ │ │ -

    the message associated with this warning

    │ │ │ │ -[report issue]
    │ │ │ │ -
    version
    │ │ │ │ -
    the bittorrent protocol version that was announced
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    scrape_reply_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a scrape request succeeds.

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_node()

    │ │ │ │
    │ │ │ │ -struct scrape_reply_alert final : tracker_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::tracker;
    │ │ │ │ -   int const incomplete;
    │ │ │ │ -   int const complete;
    │ │ │ │ -   protocol_version version;
    │ │ │ │ -};
    │ │ │ │ +void add_node (std::pair<std::string, int> node);
    │ │ │ │  
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    incomplete complete
    │ │ │ │ -
    the data returned in the scrape response. These numbers │ │ │ │ -may be -1 if the response was malformed.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    version
    │ │ │ │ -
    the bittorrent protocol version that was scraped
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    scrape_failed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    If a scrape request fails, this alert is generated. This might be due │ │ │ │ -to the tracker timing out, refusing connection or returning an http response │ │ │ │ -code indicating an error.

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_tracker()

    │ │ │ │
    │ │ │ │ -struct scrape_failed_alert final : tracker_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* error_message () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::tracker | alert_category::error;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -   protocol_version version;
    │ │ │ │ -};
    │ │ │ │ +void add_tracker (string_view url, int tier = 0);
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    error_message()

    │ │ │ │ +

    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 http:// 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_root_cert()

    │ │ │ │
    │ │ │ │ -char const* error_message () const;
    │ │ │ │ +void set_root_cert (string_view cert);
    │ │ │ │  
    │ │ │ │ -

    if the error indicates there is an associated message, this returns │ │ │ │ -that message. Otherwise and empty string.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    the error itself. This may indicate that the tracker sent an error │ │ │ │ -message (error::tracker_failure), in which case it can be │ │ │ │ -retrieved by calling error_message().
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    version
    │ │ │ │ -
    the bittorrent protocol version that was scraped
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    tracker_reply_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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.

    │ │ │ │ +

    This function sets an X.509 certificate in PEM format to the torrent. This makes the │ │ │ │ +torrent an SSL torrent. 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 ssl torrents.

    │ │ │ │ +

    The string is not the path to the cert, it's the actual content of the │ │ │ │ +certificate.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    priv() set_priv()

    │ │ │ │
    │ │ │ │ -struct tracker_reply_alert final : tracker_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::tracker;
    │ │ │ │ -   int const num_peers;
    │ │ │ │ -   protocol_version version;
    │ │ │ │ -};
    │ │ │ │ +void set_priv (bool p);
    │ │ │ │ +bool priv () const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    num_peers
    │ │ │ │ -
    tells how many peers the tracker returned in this response. This is │ │ │ │ -not expected to be greater than the num_want settings. These are not necessarily │ │ │ │ -all new peers, some of them may already be connected.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    version
    │ │ │ │ -
    the bittorrent protocol version that was announced
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_reply_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated each time the DHT receives peers from a node. num_peers │ │ │ │ -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.

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    num_pieces()

    │ │ │ │
    │ │ │ │ -struct dht_reply_alert final : tracker_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::dht | alert_category::tracker;
    │ │ │ │ -   int const num_peers;
    │ │ │ │ -};
    │ │ │ │ +int num_pieces () const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    tracker_announce_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated each time a tracker announce is sent (or attempted to be sent). │ │ │ │ -There are no extra data members in this alert. The url can be found in the base class │ │ │ │ -however.

    │ │ │ │ +

    returns the number of pieces in the associated file_storage object.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    piece_range()

    │ │ │ │
    │ │ │ │ -struct tracker_announce_alert final : tracker_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::tracker;
    │ │ │ │ -   event_t const event;
    │ │ │ │ -   protocol_version version;
    │ │ │ │ -};
    │ │ │ │ +index_range<piece_index_t> piece_range () const noexcept;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    event
    │ │ │ │ -
    specifies what event was sent to the tracker. See event_t.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    version
    │ │ │ │ -
    the bittorrent protocol version that is announced
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    hash_failed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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 alert.

    │ │ │ │ +

    all piece indices in the torrent to be created

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_range()

    │ │ │ │
    │ │ │ │ -struct hash_failed_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -   piece_index_t const piece_index;
    │ │ │ │ -};
    │ │ │ │ +index_range<file_index_t> file_range () const noexcept;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    peer_ban_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a peer is banned because it has sent too many corrupt pieces │ │ │ │ -to us. ip is the endpoint to the peer that was banned.

    │ │ │ │ +

    all file indices in the torrent to be created

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    file_piece_range()

    │ │ │ │
    │ │ │ │ -struct peer_ban_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ -};
    │ │ │ │ +index_range<piece_index_t::diff_type> file_piece_range (file_index_t f);
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    peer_unsnubbed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a peer is un-snubbed. Essentially when it was snubbed for stalling │ │ │ │ -sending data, and now it started sending data again.

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    total_size()

    │ │ │ │
    │ │ │ │ -struct peer_unsnubbed_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ -};
    │ │ │ │ +std::int64_t total_size () const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    peer_snubbed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a peer is snubbed, when it stops sending data when we request │ │ │ │ -it.

    │ │ │ │ +

    the total number of bytes of all files and pad files

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    piece_size() piece_length()

    │ │ │ │
    │ │ │ │ -struct peer_snubbed_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ -};
    │ │ │ │ +int piece_size (piece_index_t i) const;
    │ │ │ │ +int piece_length () const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    peer_error_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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 alert, to identify it.

    │ │ │ │ +

    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 file_storage.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    add_collection() add_similar_torrent()

    │ │ │ │
    │ │ │ │ -struct peer_error_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ -   operation_t op;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -};
    │ │ │ │ +void add_collection (string_view c);
    │ │ │ │ +void add_similar_torrent (sha1_hash ih);
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    op
    │ │ │ │ -
    a 0-terminated string of the low-level operation that failed, or nullptr if │ │ │ │ -there was no low level disk operation.
    │ │ │ │ +

    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 BEP 38.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    tells you what error caused this alert.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    peer_connect_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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 incoming_connection_alert.

    │ │ │ │ -
    │ │ │ │ -struct peer_connect_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   enum direction_t
    │ │ │ │ -   {
    │ │ │ │ -      in,
    │ │ │ │ -      out,
    │ │ │ │ -   };
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::connect;
    │ │ │ │ -   direction_t direction;
    │ │ │ │ -   socket_type_t socket_type;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    enum direction_t

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    in0 
    out1 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    direction
    │ │ │ │ -
    Tells you if the peer was incoming or outgoing
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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 │ │ │ │ +set_hash2() before calling generate(). Setting v1 hashes (with │ │ │ │ +set_hash()) is an error with this flag set.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    peer_disconnected_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a peer is disconnected for any reason (other than the ones │ │ │ │ -covered by peer_error_alert ).

    │ │ │ │ -
    │ │ │ │ -struct peer_disconnected_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::connect;
    │ │ │ │ -   socket_type_t const socket_type;
    │ │ │ │ -   operation_t const op;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -   close_reason_t const reason;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    socket_type
    │ │ │ │ -
    the kind of socket this peer was connected over
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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 set_hash(), before calling │ │ │ │ +generate(). Setting v2 hashes (with set_hash2()) is an error with │ │ │ │ +this flag set.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    op
    │ │ │ │ -
    the operation or level where the error occurred. Specified as an │ │ │ │ -value from the operation_t enum. Defined in operations.hpp.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    tells you what error caused peer to disconnect.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    no_attributes
    │ │ │ │ +
    passing this flag to add_files() 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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    reason
    │ │ │ │ -
    the reason the peer disconnected (if specified)
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    invalid_request_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This is a debug alert that is generated by an incoming invalid piece request. │ │ │ │ -ip is the address of the peer and the request is the actual incoming │ │ │ │ -request from the peer. See peer_request for more info.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    add_files()

    │ │ │ │ +

    Declared in "libtorrent/create_torrent.hpp"

    │ │ │ │
    │ │ │ │ -struct invalid_request_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ -   peer_request const request;
    │ │ │ │ -   bool const we_have;
    │ │ │ │ -   bool const peer_interested;
    │ │ │ │ -   bool const withheld;
    │ │ │ │ -};
    │ │ │ │ +void add_files (file_storage& fs, std::string const& file
    │ │ │ │ +   , create_flags_t flags = {});
    │ │ │ │ +void add_files (file_storage& fs, std::string const& file
    │ │ │ │ +   , std::function<bool(std::string)> p, create_flags_t flags = {});
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    request
    │ │ │ │ -
    the request we received from the peer
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    we_have
    │ │ │ │ -
    true if we have this piece
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    peer_interested
    │ │ │ │ -
    true if the peer indicated that it was interested to download before │ │ │ │ -sending the request
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    withheld
    │ │ │ │ -
    if this is true, the peer is not allowed to download this piece because │ │ │ │ -of super-seeding rules.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    torrent_finished_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a torrent switches from being a downloader to a seed. │ │ │ │ -It will only be generated once per torrent. It contains a torrent_handle to the │ │ │ │ -torrent in question.

    │ │ │ │ -
    │ │ │ │ -struct torrent_finished_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -};
    │ │ │ │ +

    Adds the file specified by path to the file_storage 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);
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    piece_finished_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    this alert is posted every time a piece completes downloading │ │ │ │ -and passes the hash check. This alert derives from torrent_alert │ │ │ │ -which contains the torrent_handle 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 torrent_handle::have_piece() │ │ │ │ -may still return false

    │ │ │ │ +

    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 create_torrent │ │ │ │ +constructor.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    set_piece_hashes()

    │ │ │ │ +

    Declared in "libtorrent/create_torrent.hpp"

    │ │ │ │
    │ │ │ │ -struct piece_finished_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   piece_index_t const piece_index;
    │ │ │ │ -};
    │ │ │ │ +inline void set_piece_hashes (create_torrent& t, std::string const& p
    │ │ │ │ +   , settings_interface const& settings
    │ │ │ │ +   , std::function<void(piece_index_t)> const& f);
    │ │ │ │ +void set_piece_hashes (create_torrent& t, std::string const& p
    │ │ │ │ +   , std::function<void(piece_index_t)> const& f, error_code& ec);
    │ │ │ │ +inline void set_piece_hashes (create_torrent& t, std::string const& p
    │ │ │ │ +   , std::function<void(piece_index_t)> const& f);
    │ │ │ │ +inline void set_piece_hashes (create_torrent& t, std::string const& p);
    │ │ │ │ +void set_piece_hashes (create_torrent& t, std::string const& p
    │ │ │ │ +   , settings_interface const& settings
    │ │ │ │ +   , std::function<void(piece_index_t)> const& f, error_code& ec);
    │ │ │ │ +inline void set_piece_hashes (create_torrent& t, std::string const& p, error_code& ec);
    │ │ │ │ +void set_piece_hashes (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);
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    piece_index
    │ │ │ │ -
    the index of the piece that finished
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    request_dropped_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a peer rejects or ignores a piece request.

    │ │ │ │ +

    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 settings_pack 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    info_hash_t

    │ │ │ │ +

    Declared in "libtorrent/info_hash.hpp"

    │ │ │ │ +

    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 request_dropped_alert final : peer_alert
    │ │ │ │ +struct info_hash_t
    │ │ │ │  {
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ +   explicit info_hash_t (sha256_hash h2) noexcept;
    │ │ │ │ +   info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;
    │ │ │ │ +   explicit info_hash_t (sha1_hash h1) noexcept;
    │ │ │ │ +   info_hash_t () noexcept = default;
    │ │ │ │ +   bool has (protocol_version v) const;
    │ │ │ │ +   bool has_v1 () const;
    │ │ │ │ +   bool has_v2 () const;
    │ │ │ │ +   sha1_hash get (protocol_version v) const;
    │ │ │ │ +   sha1_hash get_best () const;
    │ │ │ │ +   friend bool operator!= (info_hash_t const& lhs, info_hash_t const& rhs);
    │ │ │ │ +   friend bool operator== (info_hash_t const& lhs, info_hash_t const& rhs) noexcept;
    │ │ │ │ +   template <typename F> void for_each (F f) const;
    │ │ │ │ +   bool operator< (info_hash_t const& o) const;
    │ │ │ │ +   friend std::ostream& operator<< (std::ostream& os, info_hash_t const& ih);
    │ │ │ │  
    │ │ │ │ -   int const block_index;
    │ │ │ │ -   piece_index_t const piece_index;
    │ │ │ │ +   sha1_hash v1;
    │ │ │ │ +   sha256_hash v2;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    block_timeout_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a block request times out.

    │ │ │ │ +[report issue]
    │ │ │ │ +

    info_hash_t()

    │ │ │ │
    │ │ │ │ -struct block_timeout_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   int const block_index;
    │ │ │ │ -   piece_index_t const piece_index;
    │ │ │ │ -};
    │ │ │ │ +explicit info_hash_t (sha256_hash h2) noexcept;
    │ │ │ │ +info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;
    │ │ │ │ +explicit info_hash_t (sha1_hash h1) noexcept;
    │ │ │ │ +info_hash_t () noexcept = default;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    block_finished_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a block request receives a response.

    │ │ │ │ +

    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 implicit conversion from a │ │ │ │ +v1 hash, but the implicitness is deprecated.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    has_v1() has() has_v2()

    │ │ │ │
    │ │ │ │ -struct block_finished_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   int const block_index;
    │ │ │ │ -   piece_index_t const piece_index;
    │ │ │ │ -};
    │ │ │ │ +bool has (protocol_version v) const;
    │ │ │ │ +bool has_v1 () const;
    │ │ │ │ +bool has_v2 () const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    block_downloading_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a block request is sent to a peer.

    │ │ │ │ +

    returns true if the corresponding info hash is present in this │ │ │ │ +object.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    get()

    │ │ │ │
    │ │ │ │ -struct block_downloading_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   int const block_index;
    │ │ │ │ -   piece_index_t const piece_index;
    │ │ │ │ -};
    │ │ │ │ +sha1_hash get (protocol_version v) const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    unwanted_block_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a block is received that was not requested or │ │ │ │ -whose request timed out.

    │ │ │ │ +

    returns the has for the specified protocol version

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    get_best()

    │ │ │ │
    │ │ │ │ -struct unwanted_block_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ -   int const block_index;
    │ │ │ │ -   piece_index_t const piece_index;
    │ │ │ │ -};
    │ │ │ │ +sha1_hash get_best () const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    storage_moved_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    The storage_moved_alert is generated when all the disk IO has │ │ │ │ -completed and the files have been moved, as an effect of a call to │ │ │ │ -torrent_handle::move_storage. This is useful to synchronize with the │ │ │ │ -actual disk. The storage_path() member return the new path of the │ │ │ │ -storage.

    │ │ │ │ +

    returns the v2 (truncated) info-hash, if there is one, otherwise │ │ │ │ +returns the v1 info-hash

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    for_each()

    │ │ │ │
    │ │ │ │ -struct storage_moved_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* old_path () const;
    │ │ │ │ -   char const* storage_path () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ -};
    │ │ │ │ +template <typename F> void for_each (F f) const;
    │ │ │ │  
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    storage_path() old_path()

    │ │ │ │ +

    calls the function object f for each hash that is available. │ │ │ │ +starting with v1. The signature of F is:

    │ │ │ │
    │ │ │ │ -char const* old_path () const;
    │ │ │ │ -char const* storage_path () const;
    │ │ │ │ +void(sha1_hash const&, protocol_version);
    │ │ │ │  
    │ │ │ │ -

    the path the torrent was moved to and from, respectively.

    │ │ │ │ -[report issue]
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    storage_moved_failed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    The storage_moved_failed_alert is generated when an attempt to move the storage, │ │ │ │ -via torrent_handle::move_storage(), fails.

    │ │ │ │ +
    │ │ │ │ +

    peer_request

    │ │ │ │ +

    Declared in "libtorrent/peer_request.hpp"

    │ │ │ │ +

    represents a byte range within a piece. Internally this is is used for │ │ │ │ +incoming piece requests.

    │ │ │ │
    │ │ │ │ -struct storage_moved_failed_alert final : torrent_alert
    │ │ │ │ +struct peer_request
    │ │ │ │  {
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* file_path () const;
    │ │ │ │ +   bool operator== (peer_request const& r) const;
    │ │ │ │  
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -   operation_t op;
    │ │ │ │ +   piece_index_t piece;
    │ │ │ │ +   int start;
    │ │ │ │ +   int length;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    file_path()

    │ │ │ │ +[report issue]
    │ │ │ │ +

    operator==()

    │ │ │ │
    │ │ │ │ -char const* file_path () const;
    │ │ │ │ +bool operator== (peer_request const& r) const;
    │ │ │ │  
    │ │ │ │ -

    If the error happened for a specific file, this returns its path.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    op
    │ │ │ │ -
    this indicates what underlying operation caused the error
    │ │ │ │ +

    returns true if the right hand side peer_request refers to the same │ │ │ │ +range as this does.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    piece
    │ │ │ │ +
    The index of the piece in which the range starts.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ +[report issue]
    │ │ │ │ +
    start
    │ │ │ │ +
    The byte offset within that piece where the range starts.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    length
    │ │ │ │ +
    The size of the range, in bytes.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    torrent_deleted_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a request to delete the files of a torrent complete.

    │ │ │ │ -

    This alert is posted in the alert_category::storage category, and that bit │ │ │ │ -needs to be set in the alert_mask.

    │ │ │ │ +
    │ │ │ │ +

    peer_info

    │ │ │ │ +

    Declared in "libtorrent/peer_info.hpp"

    │ │ │ │ +

    holds information and statistics about one peer │ │ │ │ +that libtorrent is connected to

    │ │ │ │
    │ │ │ │ -struct torrent_deleted_alert final : torrent_alert
    │ │ │ │ +struct peer_info
    │ │ │ │  {
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ +   sha256_hash i2p_destination () const;
    │ │ │ │  
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ -   info_hash_t info_hashes;
    │ │ │ │ +   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 interesting  = 0_bit;
    │ │ │ │ +   static constexpr peer_flags_t choked  = 1_bit;
    │ │ │ │ +   static constexpr peer_flags_t remote_interested  = 2_bit;
    │ │ │ │ +   static constexpr peer_flags_t remote_choked  = 3_bit;
    │ │ │ │ +   static constexpr peer_flags_t supports_extensions  = 4_bit;
    │ │ │ │ +   static constexpr peer_flags_t outgoing_connection  = 5_bit;
    │ │ │ │ +   static constexpr peer_flags_t local_connection  = 5_bit;
    │ │ │ │ +   static constexpr peer_flags_t handshake  = 6_bit;
    │ │ │ │ +   static constexpr peer_flags_t connecting  = 7_bit;
    │ │ │ │ +   static constexpr peer_flags_t on_parole  = 9_bit;
    │ │ │ │ +   static constexpr peer_flags_t seed  = 10_bit;
    │ │ │ │ +   static constexpr peer_flags_t optimistic_unchoke  = 11_bit;
    │ │ │ │ +   static constexpr peer_flags_t snubbed  = 12_bit;
    │ │ │ │ +   static constexpr peer_flags_t upload_only  = 13_bit;
    │ │ │ │ +   static constexpr peer_flags_t endgame_mode  = 14_bit;
    │ │ │ │ +   static constexpr peer_flags_t holepunched  = 15_bit;
    │ │ │ │ +   static constexpr peer_flags_t i2p_socket  = 16_bit;
    │ │ │ │ +   static constexpr peer_flags_t utp_socket  = 17_bit;
    │ │ │ │ +   static constexpr peer_flags_t ssl_socket  = 18_bit;
    │ │ │ │ +   static constexpr peer_flags_t rc4_encrypted  = 19_bit;
    │ │ │ │ +   static constexpr peer_flags_t plaintext_encrypted  = 20_bit;
    │ │ │ │ +   peer_flags_t flags;
    │ │ │ │ +   static constexpr peer_source_flags_t tracker  = 0_bit;
    │ │ │ │ +   static constexpr peer_source_flags_t dht  = 1_bit;
    │ │ │ │ +   static constexpr peer_source_flags_t pex  = 2_bit;
    │ │ │ │ +   static constexpr peer_source_flags_t lsd  = 3_bit;
    │ │ │ │ +   static constexpr peer_source_flags_t resume_data  = 4_bit;
    │ │ │ │ +   static constexpr peer_source_flags_t incoming  = 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 standard_bittorrent  = 0_bit;
    │ │ │ │ +   static constexpr connection_type_t web_seed  = 1_bit;
    │ │ │ │ +   static constexpr connection_type_t http_seed  = 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;
    │ │ │ │ +   tcp::endpoint ip;
    │ │ │ │ +   tcp::endpoint local_endpoint;
    │ │ │ │ +   static constexpr bandwidth_state_flags_t bw_idle  = 0_bit;
    │ │ │ │ +   static constexpr bandwidth_state_flags_t bw_limit  = 1_bit;
    │ │ │ │ +   static constexpr bandwidth_state_flags_t bw_network  = 2_bit;
    │ │ │ │ +   static constexpr bandwidth_state_flags_t bw_disk  = 4_bit;
    │ │ │ │ +   bandwidth_state_flags_t read_state;
    │ │ │ │ +   bandwidth_state_flags_t write_state;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    info_hashes
    │ │ │ │ -
    The info-hash of the torrent that was just deleted. Most of │ │ │ │ -the time the torrent_handle in the torrent_alert will be invalid by the time │ │ │ │ -this alert arrives, since the torrent is being deleted. The info_hashes member │ │ │ │ -is hence the main way of identifying which torrent just completed the delete.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    torrent_delete_failed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a request to delete the files of a torrent fails. │ │ │ │ -Just removing a torrent from the session cannot fail

    │ │ │ │ +[report issue]
    │ │ │ │ +

    i2p_destination()

    │ │ │ │
    │ │ │ │ -struct torrent_delete_failed_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::storage
    │ │ │ │ -   | alert_category::error;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -   info_hash_t info_hashes;
    │ │ │ │ -};
    │ │ │ │ +sha256_hash i2p_destination () const;
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    tells you why it failed.
    │ │ │ │ +

    If this peer is an i2p peer, this function returns the destination │ │ │ │ +address of the peer

    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    info_hashes
    │ │ │ │ -
    the info hash of the torrent whose files failed to be deleted
    │ │ │ │ +[report issue]
    │ │ │ │ +
    pieces
    │ │ │ │ +
    a bitfield, 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).
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    save_resume_data_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated as a response to a torrent_handle::save_resume_data request. │ │ │ │ -It is generated once the disk IO thread is done writing the state for this torrent.

    │ │ │ │ -
    │ │ │ │ -struct save_resume_data_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ -   add_torrent_params params;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    params
    │ │ │ │ -

    the params object is populated with the torrent file whose resume │ │ │ │ -data was saved. It is suitable to be:

    │ │ │ │ - │ │ │ │ -
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    save_resume_data_failed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated instead of save_resume_data_alert if there was an error │ │ │ │ -generating the resume data. error describes what went wrong.

    │ │ │ │ -
    │ │ │ │ -struct save_resume_data_failed_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::storage
    │ │ │ │ -   | alert_category::error;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    the error code from the resume_data failure
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    last_request last_active
    │ │ │ │ +
    the time since we last sent a request to this peer and since any │ │ │ │ +transfer occurred with this peer
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    torrent_paused_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated as a response to a torrent_handle::pause request. It is │ │ │ │ -generated once all disk IO is complete and the files in the torrent have been closed. │ │ │ │ -This is useful for synchronizing with the disk.

    │ │ │ │ -
    │ │ │ │ -struct torrent_paused_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    torrent_resumed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated as a response to a torrent_handle::resume() request. It is │ │ │ │ -generated when a torrent goes from a paused state to an active state.

    │ │ │ │ -
    │ │ │ │ -struct torrent_resumed_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    torrent_checked_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is posted when a torrent completes checking. i.e. when it transitions │ │ │ │ -out of the checking files state into a state where it is ready to start downloading

    │ │ │ │ -
    │ │ │ │ -struct torrent_checked_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    url_seed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a HTTP seed name lookup fails.

    │ │ │ │ -
    │ │ │ │ -struct url_seed_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* server_url () const;
    │ │ │ │ -   char const* error_message () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::peer | alert_category::error;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    server_url()

    │ │ │ │ -
    │ │ │ │ -char const* server_url () const;
    │ │ │ │ -
    │ │ │ │ -

    the URL the error is associated with

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    error_message()

    │ │ │ │ -
    │ │ │ │ -char const* error_message () const;
    │ │ │ │ -
    │ │ │ │ -

    in case the web server sent an error message, this function returns │ │ │ │ -it.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    the error the web seed encountered. If this is not set, the server │ │ │ │ -sent an error message, call error_message().
    │ │ │ │ +[report issue]
    │ │ │ │ +
    download_queue_time
    │ │ │ │ +
    the time until all blocks in the request queue will be downloaded
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    file_error_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    If the storage fails to read or write files that it needs access to, this alert is │ │ │ │ -generated and the torrent is paused.

    │ │ │ │ -
    │ │ │ │ -struct file_error_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* filename () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status
    │ │ │ │ -   | alert_category::storage;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -   operation_t op;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    filename()

    │ │ │ │ -
    │ │ │ │ -char const* filename () const;
    │ │ │ │ -
    │ │ │ │ -

    the file that experienced the error

    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    the error code describing the error.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    interesting
    │ │ │ │ +
    we are interested in pieces from this peer.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    op
    │ │ │ │ -
    indicates which underlying operation caused the error
    │ │ │ │ +[report issue]
    │ │ │ │ +
    choked
    │ │ │ │ +
    we have choked this peer.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    metadata_failed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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.

    │ │ │ │ -
    │ │ │ │ -struct metadata_failed_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    indicates what failed when parsing the metadata. This error is │ │ │ │ -what's returned from lazy_bdecode().
    │ │ │ │ +[report issue]
    │ │ │ │ +
    remote_interested
    │ │ │ │ +
    the peer is interested in us
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    metadata_received_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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).

    │ │ │ │ -

    There are no additional data members in this alert.

    │ │ │ │ -

    Typically, when receiving this alert, you would want to save the torrent file in order │ │ │ │ -to load it back up again when the session is restarted. Here's an example snippet of │ │ │ │ -code to do that:

    │ │ │ │ -
    │ │ │ │ -torrent_handle h = alert->handle;
    │ │ │ │ -std::shared_ptr<torrent_info const> ti = h.torrent_file();
    │ │ │ │ -create_torrent ct(*ti);
    │ │ │ │ -entry te = ct.generate();
    │ │ │ │ -std::vector<char> buffer;
    │ │ │ │ -bencode(std::back_inserter(buffer), te);
    │ │ │ │ -FILE* f = fopen((to_hex(ti->info_hashes().get_best().to_string()) + ".torrent").c_str(), "wb+");
    │ │ │ │ -if (f) {
    │ │ │ │ -        fwrite(&buffer[0], 1, buffer.size(), f);
    │ │ │ │ -        fclose(f);
    │ │ │ │ -}
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -struct metadata_received_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    udp_error_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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 session.

    │ │ │ │ -
    │ │ │ │ -struct udp_error_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ -   aux::noexcept_movable<udp::endpoint> endpoint;
    │ │ │ │ -   operation_t operation;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    endpoint
    │ │ │ │ -
    the source address associated with the error (if any)
    │ │ │ │ +[report issue]
    │ │ │ │ +
    remote_choked
    │ │ │ │ +
    the peer has choked us.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    operation
    │ │ │ │ -
    the operation that failed
    │ │ │ │ +[report issue]
    │ │ │ │ +
    supports_extensions
    │ │ │ │ +
    means that this peer supports the │ │ │ │ +extension protocol.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    the error code describing the error
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    external_ip_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    Whenever libtorrent learns about the machines external IP, this alert 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 external_address member.

    │ │ │ │ -
    │ │ │ │ -struct external_ip_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -   aux::noexcept_movable<address> external_address;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    external_address
    │ │ │ │ -
    the IP address that is believed to be our external IP
    │ │ │ │ +[report issue]
    │ │ │ │ +
    local_connection
    │ │ │ │ +
    deprecated synonym for outgoing_connection
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    listen_failed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when none of the ports, given in the port range, to │ │ │ │ -session can be opened for listening. The listen_interface member is the │ │ │ │ -interface that failed, error is the error code describing the failure.

    │ │ │ │ -

    In the case an endpoint was created before generating the alert, it is │ │ │ │ -represented by address and port. The combinations of socket type │ │ │ │ -and operation in which such address and port are not valid are: │ │ │ │ -accept - i2p │ │ │ │ -accept - socks5 │ │ │ │ -enum_if - tcp

    │ │ │ │ -

    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 listen_failed_alert with port 0 even if you didn't ask to │ │ │ │ -listen on it.

    │ │ │ │ -
    │ │ │ │ -struct listen_failed_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* listen_interface () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status | alert_category::error;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -   operation_t op;
    │ │ │ │ -   lt::socket_type_t const socket_type;
    │ │ │ │ -   aux::noexcept_movable<lt::address> address;
    │ │ │ │ -   int const port;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    listen_interface()

    │ │ │ │ -
    │ │ │ │ -char const* listen_interface () const;
    │ │ │ │ -
    │ │ │ │ -

    the network device libtorrent attempted to listen on, or the IP address

    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    the error the system returned
    │ │ │ │ +[report issue]
    │ │ │ │ +
    handshake
    │ │ │ │ +
    The connection is opened, and waiting for the │ │ │ │ +handshake. Until the handshake is done, the peer │ │ │ │ +cannot be identified.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    op
    │ │ │ │ -
    the underlying operation that failed
    │ │ │ │ +[report issue]
    │ │ │ │ +
    connecting
    │ │ │ │ +
    The connection is in a half-open state (i.e. it is │ │ │ │ +being connected).
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    socket_type
    │ │ │ │ -
    the type of listen socket this alert refers to.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    address
    │ │ │ │ -
    the address libtorrent attempted to listen on │ │ │ │ -see alert documentation for validity of this value
    │ │ │ │ +[report issue]
    │ │ │ │ +
    seed
    │ │ │ │ +
    This peer is a seed (it has all the pieces).
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    port
    │ │ │ │ -
    the port libtorrent attempted to listen on │ │ │ │ -see alert documentation for validity of this value
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    listen_succeeded_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is posted when the listen port succeeds to be opened on a │ │ │ │ -particular interface. address and port is the endpoint that │ │ │ │ -successfully was opened for listening.

    │ │ │ │ -
    │ │ │ │ -struct listen_succeeded_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -   aux::noexcept_movable<lt::address> address;
    │ │ │ │ -   int const port;
    │ │ │ │ -   lt::socket_type_t const socket_type;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    address
    │ │ │ │ -
    the address libtorrent ended up listening on. This address │ │ │ │ -refers to the local interface.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    port
    │ │ │ │ -
    the port libtorrent ended up listening on.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    socket_type
    │ │ │ │ -
    the type of listen socket this alert refers to.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    portmap_error_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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 alert 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.

    │ │ │ │ -
    │ │ │ │ -struct portmap_error_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::port_mapping
    │ │ │ │ -   | alert_category::error;
    │ │ │ │ -   port_mapping_t const mapping;
    │ │ │ │ -   portmap_transport map_transport;
    │ │ │ │ -   aux::noexcept_movable<address> local_address;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    mapping
    │ │ │ │ -
    refers to the mapping index of the port map that failed, i.e. │ │ │ │ -the index returned from add_mapping().
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    map_transport
    │ │ │ │ -
    UPnP or NAT-PMP
    │ │ │ │ +[report issue]
    │ │ │ │ +
    i2p_socket
    │ │ │ │ +
    indicates that this socket is running on top of the │ │ │ │ +I2P transport.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    local_address
    │ │ │ │ -
    the local network the port mapper is running on
    │ │ │ │ +[report issue]
    │ │ │ │ +
    utp_socket
    │ │ │ │ +
    indicates that this socket is a uTP socket
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    tells you what failed.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    ssl_socket
    │ │ │ │ +
    indicates that this socket is running on top of an SSL │ │ │ │ +(TLS) channel
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    portmap_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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.

    │ │ │ │ -
    │ │ │ │ -struct portmap_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = 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<address> local_address;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    mapping
    │ │ │ │ -
    refers to the mapping index of the port map that failed, i.e. │ │ │ │ -the index returned from add_mapping().
    │ │ │ │ +[report issue]
    │ │ │ │ +
    rc4_encrypted
    │ │ │ │ +
    this connection is obfuscated with RC4
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    external_port
    │ │ │ │ -
    the external port allocated for the mapping.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    plaintext_encrypted
    │ │ │ │ +
    the handshake of this connection was obfuscated │ │ │ │ +with a Diffie-Hellman exchange
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    local_address
    │ │ │ │ -
    the local network the port mapper is running on
    │ │ │ │ +[report issue]
    │ │ │ │ +
    flags
    │ │ │ │ +
    tells you in which state the peer is in. It is set to │ │ │ │ +any combination of the peer_flags_t flags above.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    portmap_log_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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 alert is only │ │ │ │ -posted if the alert_category::port_mapping_log flag is enabled in │ │ │ │ -the alert mask.

    │ │ │ │ -
    │ │ │ │ -struct portmap_log_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* log_message () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::port_mapping_log;
    │ │ │ │ -   portmap_transport const map_transport;
    │ │ │ │ -   aux::noexcept_movable<address> local_address;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    log_message()

    │ │ │ │ -
    │ │ │ │ -char const* log_message () const;
    │ │ │ │ -
    │ │ │ │ -

    the message associated with this log line

    │ │ │ │ -[report issue]
    │ │ │ │ -
    local_address
    │ │ │ │ -
    the local network the port mapper is running on
    │ │ │ │ +[report issue]
    │ │ │ │ +
    tracker
    │ │ │ │ +
    The peer was received from the tracker.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    fastresume_rejected_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a fast resume file has been passed to │ │ │ │ -add_torrent() but the files on disk did not match the fast resume file. │ │ │ │ -The error_code explains the reason why the resume file was rejected.

    │ │ │ │ -
    │ │ │ │ -struct fastresume_rejected_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* file_path () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status
    │ │ │ │ -   | alert_category::error;
    │ │ │ │ -   error_code error;
    │ │ │ │ -   operation_t op;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    file_path()

    │ │ │ │ -
    │ │ │ │ -char const* file_path () const;
    │ │ │ │ -
    │ │ │ │ -

    If the error happened to a specific file, this returns the path to it.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    op
    │ │ │ │ -
    the underlying operation that failed
    │ │ │ │ +[report issue]
    │ │ │ │ +
    dht
    │ │ │ │ +
    The peer was received from the kademlia DHT.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    peer_blocked_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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:

    │ │ │ │ -
      │ │ │ │ -
    • the IP filter
    • │ │ │ │ -
    • i2p mixed mode restrictions (a normal peer is not allowed on an i2p swarm)
    • │ │ │ │ -
    • the port filter
    • │ │ │ │ -
    • the peer has a low port and no_connect_privileged_ports is enabled
    • │ │ │ │ -
    • the protocol of the peer is blocked (uTP/TCP blocking)
    • │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -struct peer_blocked_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () 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 static_category  = alert_category::ip_block;
    │ │ │ │ -   int const reason;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    enum reason_t

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    ip_filter0 
    port_filter1 
    i2p_mixed2 
    privileged_ports3 
    utp_disabled4 
    tcp_disabled5 
    invalid_local_interface6 
    ssrf_mitigation7 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    reason
    │ │ │ │ -
    the reason for the peer being blocked. Is one of the values from the │ │ │ │ -reason_t enum.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    pex
    │ │ │ │ +
    The peer was received from the peer exchange │ │ │ │ +extension.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    dht_announce_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a DHT node announces to an info-hash on our │ │ │ │ -DHT node. It belongs to the alert_category::dht category.

    │ │ │ │ -
    │ │ │ │ -struct dht_announce_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ -   aux::noexcept_movable<address> ip;
    │ │ │ │ -   int port;
    │ │ │ │ -   sha1_hash info_hash;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_get_peers_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when a DHT node sends a get_peers message to │ │ │ │ -our DHT node. It belongs to the alert_category::dht category.

    │ │ │ │ -
    │ │ │ │ -struct dht_get_peers_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ -   sha1_hash info_hash;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    cache_flushed_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is posted when the disk cache has been flushed for a specific │ │ │ │ -torrent as a result of a call to torrent_handle::flush_cache(). This │ │ │ │ -alert belongs to the alert_category::storage category, which must be │ │ │ │ -enabled to let this alert through. The alert is also posted when removing │ │ │ │ -a torrent from the session, once the outstanding cache flush is complete │ │ │ │ -and the torrent does no longer have any files open.

    │ │ │ │ -
    │ │ │ │ -struct cache_flushed_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    lsd_peer_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when we receive a local service discovery message │ │ │ │ -from a peer for a torrent we're currently participating in.

    │ │ │ │ -
    │ │ │ │ -struct lsd_peer_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    trackerid_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is posted whenever a tracker responds with a trackerid. │ │ │ │ -The tracker ID is like a cookie. libtorrent will store the tracker ID │ │ │ │ -for this tracker and repeat it in subsequent announces.

    │ │ │ │ -
    │ │ │ │ -struct trackerid_alert final : tracker_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* tracker_id () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    tracker_id()

    │ │ │ │ -
    │ │ │ │ -char const* tracker_id () const;
    │ │ │ │ -
    │ │ │ │ -

    The tracker ID returned by the tracker

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    dht_bootstrap_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is posted when the initial DHT bootstrap is done.

    │ │ │ │ -
    │ │ │ │ -struct dht_bootstrap_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    torrent_error_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This is posted whenever a torrent is transitioned into the error state. │ │ │ │ -If the error code is duplicate_torrent (error_code_enum) error, it suggests two magnet │ │ │ │ -links ended up resolving to the same hybrid torrent. For more details, │ │ │ │ -see BitTorrent v2 torrents.

    │ │ │ │ -
    │ │ │ │ -struct torrent_error_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* filename () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::error | alert_category::status;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    filename()

    │ │ │ │ -
    │ │ │ │ -char const* filename () const;
    │ │ │ │ -
    │ │ │ │ -

    the filename (or object) the error occurred on.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    specifies which error the torrent encountered.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    lsd
    │ │ │ │ +
    The peer was received from the local service │ │ │ │ +discovery (The peer is on the local network).
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    torrent_need_cert_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This is always posted for SSL torrents. This is a reminder to the client that │ │ │ │ -the torrent won't work unless torrent_handle::set_ssl_certificate() is called with │ │ │ │ -a valid certificate. Valid certificates MUST be signed by the SSL certificate │ │ │ │ -in the .torrent file.

    │ │ │ │ -
    │ │ │ │ -struct torrent_need_cert_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    incoming_connection_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    The incoming connection alert 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.

    │ │ │ │ -
    │ │ │ │ -struct incoming_connection_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::peer;
    │ │ │ │ -   socket_type_t socket_type;
    │ │ │ │ -   aux::noexcept_movable<tcp::endpoint> endpoint;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    socket_type
    │ │ │ │ -
    tells you what kind of socket the connection was accepted
    │ │ │ │ +[report issue]
    │ │ │ │ +
    resume_data
    │ │ │ │ +
    The peer was added from the fast resume data.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    endpoint
    │ │ │ │ -
    is the IP address and port the connection came from.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    incoming
    │ │ │ │ +
    we received an incoming connection from this peer
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_torrent_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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 handle member in the base class. If adding │ │ │ │ -the torrent failed, error contains the error code.

    │ │ │ │ -
    │ │ │ │ -struct add_torrent_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -   add_torrent_params params;
    │ │ │ │ -   error_code error;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    params
    │ │ │ │ -

    This contains copies of the most important fields from the original │ │ │ │ -add_torrent_params object, passed to add_torrent() or │ │ │ │ -async_add_torrent(). Specifically, these fields are copied:

    │ │ │ │ -
      │ │ │ │ -
    • version
    • │ │ │ │ -
    • ti
    • │ │ │ │ -
    • name
    • │ │ │ │ -
    • save_path
    • │ │ │ │ -
    • userdata
    • │ │ │ │ -
    • tracker_id
    • │ │ │ │ -
    • flags
    • │ │ │ │ -
    • info_hash
    • │ │ │ │ -
    │ │ │ │ -

    the info_hash field will be updated with the info-hash of the torrent │ │ │ │ -specified by ti.

    │ │ │ │ -
    │ │ │ │ +[report issue]
    │ │ │ │ +
    source
    │ │ │ │ +
    a combination of flags describing from which sources this peer │ │ │ │ +was received. A combination of the peer_source_flags_t above.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    set to the error, if one occurred while adding the torrent.
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    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
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    state_update_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is only posted when requested by the user, by calling │ │ │ │ -session::post_torrent_updates() on the session. It contains the torrent │ │ │ │ -status of all torrents that changed since last time this message was │ │ │ │ -posted. Its category is alert_category::status, but it's not subject to │ │ │ │ -filtering, since it's only manually posted anyway.

    │ │ │ │ -
    │ │ │ │ -struct state_update_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -   std::vector<torrent_status> status;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    status
    │ │ │ │ -
    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 handle member. The receiving end is │ │ │ │ -suggested to have all torrents sorted by the torrent_handle or hashed │ │ │ │ -by it, for efficient updates.
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    payload_up_speed payload_down_speed
    │ │ │ │ +
    The transfer rates of payload data only updated about once per second
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    session_stats_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    The session_stats_alert is posted when the user requests session statistics by │ │ │ │ -calling post_session_stats() on the session object. This alert 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.

    │ │ │ │ -

    the message() member function returns a string representation of the values that │ │ │ │ -properly match the line returned in session_stats_header_alert::message().

    │ │ │ │ -

    this specific output is parsed by tools/parse_session_stats.py │ │ │ │ -if this is changed, that parser should also be changed

    │ │ │ │ -
    │ │ │ │ -struct session_stats_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   span<std::int64_t const> counters () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = {};
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    counters()

    │ │ │ │ -
    │ │ │ │ -span<std::int64_t const> counters () const;
    │ │ │ │ -
    │ │ │ │ -

    An array are a mix of counters and gauges, which meanings can be │ │ │ │ -queries via the session_stats_metrics() function on the session. 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 │ │ │ │ -session_stats_metrics(), once on startup, and then use that mapping to │ │ │ │ -interpret these values throughout the process' runtime.

    │ │ │ │ -

    For more information, see the session statistics section.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    dht_error_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    posted when something fails in the DHT. This is not necessarily a fatal │ │ │ │ -error, but it could prevent proper operation

    │ │ │ │ -
    │ │ │ │ -struct dht_error_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::error | alert_category::dht;
    │ │ │ │ -   error_code error;
    │ │ │ │ -   operation_t op;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    the error code
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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()_
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    op
    │ │ │ │ -
    the operation that failed
    │ │ │ │ +[report issue]
    │ │ │ │ +
    queue_bytes
    │ │ │ │ +
    the number of bytes we have requested from this peer, but not yet │ │ │ │ +received.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_immutable_item_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    this alert is posted as a response to a call to session::get_item(), │ │ │ │ -specifically the overload for looking up immutable items in the DHT.

    │ │ │ │ -
    │ │ │ │ -struct dht_immutable_item_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ -   sha1_hash target;
    │ │ │ │ -   entry item;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    target
    │ │ │ │ -
    the target hash of the immutable item. This must │ │ │ │ -match the SHA-1 hash of the bencoded form of item.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    item
    │ │ │ │ -
    the data for this item
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    send_buffer_size used_send_buffer
    │ │ │ │ +
    the number of bytes allocated │ │ │ │ +and used for the peer's send buffer, respectively.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_mutable_item_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    this alert is posted as a response to a call to session::get_item(), │ │ │ │ -specifically the overload for looking up mutable items in the DHT.

    │ │ │ │ -
    │ │ │ │ -struct dht_mutable_item_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ -   std::array<char, 32> key;
    │ │ │ │ -   std::array<char, 64> signature;
    │ │ │ │ -   std::int64_t seq;
    │ │ │ │ -   std::string salt;
    │ │ │ │ -   entry item;
    │ │ │ │ -   bool authoritative;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    key
    │ │ │ │ -
    the public key that was looked up
    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    receive_buffer_size used_receive_buffer receive_buffer_watermark
    │ │ │ │ +
    the number of bytes │ │ │ │ +allocated and used as receive buffer, respectively.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    signature
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    num_hashfails
    │ │ │ │ +
    the number of pieces this peer has participated in sending us that │ │ │ │ +turned out to fail the hash check.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    seq
    │ │ │ │ -
    the sequence number of this item
    │ │ │ │ +[report issue]
    │ │ │ │ +
    download_queue_length
    │ │ │ │ +
    this is the number of requests we have sent to this peer that we │ │ │ │ +haven't got a response for yet
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    salt
    │ │ │ │ -
    the salt, if any, used to lookup and store this item. If no │ │ │ │ -salt was used, this is an empty string
    │ │ │ │ +[report issue]
    │ │ │ │ +
    timed_out_requests
    │ │ │ │ +
    the number of block requests that have timed out, and are still in the │ │ │ │ +download queue
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    item
    │ │ │ │ -
    the data for this item
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    authoritative
    │ │ │ │ -
    the last response for mutable data is authoritative.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    requests_in_buffer
    │ │ │ │ +
    the number of requests messages that are currently in the send buffer │ │ │ │ +waiting to be sent.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_put_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    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.

    │ │ │ │ -
    │ │ │ │ -struct dht_put_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ -   sha1_hash target;
    │ │ │ │ -   std::array<char, 32> public_key;
    │ │ │ │ -   std::array<char, 64> signature;
    │ │ │ │ -   std::string salt;
    │ │ │ │ -   std::int64_t seq;
    │ │ │ │ -   int num_success;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    target
    │ │ │ │ -
    the target hash the item was stored under if this was an immutable │ │ │ │ -item.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    target_dl_queue_length
    │ │ │ │ +
    the number of requests that is tried to be maintained (this is │ │ │ │ +typically a function of download speed)
    │ │ │ │
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    public_key signature salt seq
    │ │ │ │ -
    if a mutable item was stored, these are the public key, signature, │ │ │ │ -salt and sequence number the item was stored under.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    upload_queue_length
    │ │ │ │ +
    the number of piece-requests we have received from this peer │ │ │ │ +that we haven't answered with a piece yet.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    num_success
    │ │ │ │ -
    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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    i2p_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    this alert is used to report errors in the i2p SAM connection

    │ │ │ │ -
    │ │ │ │ -struct i2p_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ -   error_code error;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    the error that occurred in the i2p SAM connection
    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_outgoing_get_peers_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is generated when we send a get_peers request │ │ │ │ -It belongs to the alert_category::dht category.

    │ │ │ │ -
    │ │ │ │ -struct dht_outgoing_get_peers_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ -   sha1_hash info_hash;
    │ │ │ │ -   sha1_hash obfuscated_info_hash;
    │ │ │ │ -   aux::noexcept_movable<udp::endpoint> endpoint;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    info_hash
    │ │ │ │ -
    the info_hash of the torrent we're looking for peers for.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    standard_bittorrent
    │ │ │ │ +
    Regular bittorrent connection
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    obfuscated_info_hash
    │ │ │ │ -
    if this was an obfuscated lookup, this is the info-hash target │ │ │ │ -actually sent to the node.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    web_seed
    │ │ │ │ +
    HTTP connection using the BEP 19 protocol
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    endpoint
    │ │ │ │ -
    the endpoint we're sending this query to
    │ │ │ │ +[report issue]
    │ │ │ │ +
    http_seed
    │ │ │ │ +
    HTTP connection using the BEP 17 protocol
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    log_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is posted by some session wide event. Its main purpose is │ │ │ │ -trouble shooting and debugging. It's not enabled by the default alert │ │ │ │ -mask and is enabled by the alert_category::session_log bit. │ │ │ │ -Furthermore, it's by default disabled as a build configuration.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    connection_type
    │ │ │ │ +
    the kind of connection this peer uses. See connection_type_t.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    pending_disk_read_bytes
    │ │ │ │ +
    number of outstanding bytes to read │ │ │ │ +from disk
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    num_pieces
    │ │ │ │ +
    the number of pieces this peer has.
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    progress_ppm
    │ │ │ │ +
    indicates the download progress of the peer in the range [0, 1000000] │ │ │ │ +(parts per million).
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    ip
    │ │ │ │ +
    the IP-address to this peer. The type is an asio endpoint. For │ │ │ │ +more info, see the asio documentation. This field is not valid for │ │ │ │ +i2p peers. Instead use the i2p_destination() function.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    bw_idle
    │ │ │ │ +
    The peer is not waiting for any external events to │ │ │ │ +send or receive data.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    bw_limit
    │ │ │ │ +
    The peer is waiting for the rate limiter.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    bw_disk
    │ │ │ │ +
    The peer is waiting for the disk I/O thread to catch │ │ │ │ +up writing buffers to disk before downloading more.
    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    piece_block

    │ │ │ │ +

    Declared in "libtorrent/piece_block.hpp"

    │ │ │ │
    │ │ │ │ -struct log_alert final : alert
    │ │ │ │ +struct piece_block
    │ │ │ │  {
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* log_message () const;
    │ │ │ │ +   piece_block (piece_index_t p_index, int b_index);
    │ │ │ │ +   piece_block () = default;
    │ │ │ │ +   bool operator< (piece_block const& b) const;
    │ │ │ │ +   bool operator== (piece_block const& b) const;
    │ │ │ │ +   bool operator!= (piece_block const& b) const;
    │ │ │ │  
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::session_log;
    │ │ │ │ +   static const piece_block invalid;
    │ │ │ │ +   piece_index_t piece_index {0};
    │ │ │ │ +   int block_index  = 0;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    log_message()

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    make_magnet_uri()

    │ │ │ │ +

    Declared in "libtorrent/magnet_uri.hpp"

    │ │ │ │
    │ │ │ │ -char const* log_message () const;
    │ │ │ │ +std::string make_magnet_uri (add_torrent_params const& atp);
    │ │ │ │ +std::string make_magnet_uri (torrent_handle const& handle);
    │ │ │ │ +std::string make_magnet_uri (torrent_info const& info);
    │ │ │ │  
    │ │ │ │ -

    returns the log message

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    torrent_log_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is posted by torrent wide events. It's meant to be used for │ │ │ │ -trouble shooting and debugging. It's not enabled by the default alert │ │ │ │ -mask and is enabled by the alert_category::torrent_log bit. By │ │ │ │ -default it is disabled as a build configuration.

    │ │ │ │ +

    Generates a magnet URI from the specified torrent.

    │ │ │ │ +

    Several fields from the add_torrent_params objects are recorded in the │ │ │ │ +magnet link. In order to not include them, they have to be cleared before │ │ │ │ +calling make_magnet_uri(). 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 add_torrent_params │ │ │ │ +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 │ │ │ │ +make_magnet_uri() returns an empty string.

    │ │ │ │ +

    The recommended way to generate a magnet link from a torrent_handle is to │ │ │ │ +call save_resume_data(), which will post a save_resume_data_alert │ │ │ │ +containing an add_torrent_params object. This can then be passed to │ │ │ │ +make_magnet_uri().

    │ │ │ │ +

    The overload that takes a torrent_handle 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 magnet links.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    parse_magnet_uri()

    │ │ │ │ +

    Declared in "libtorrent/magnet_uri.hpp"

    │ │ │ │
    │ │ │ │ -struct torrent_log_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* log_message () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::torrent_log;
    │ │ │ │ -};
    │ │ │ │ +add_torrent_params parse_magnet_uri (string_view uri, error_code& ec);
    │ │ │ │ +add_torrent_params parse_magnet_uri (string_view uri);
    │ │ │ │ +void parse_magnet_uri (string_view uri, add_torrent_params& p, error_code& ec);
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    log_message()

    │ │ │ │ +

    This function parses out information from the magnet link and populates the │ │ │ │ +add_torrent_params 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    torrent_peer_equal()

    │ │ │ │ +

    Declared in "libtorrent/torrent_peer.hpp"

    │ │ │ │
    │ │ │ │ -char const* log_message () const;
    │ │ │ │ +inline bool torrent_peer_equal (torrent_peer const* lhs, torrent_peer const* rhs);
    │ │ │ │  
    │ │ │ │ -

    returns the log message

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    peer_log_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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 alert │ │ │ │ -mask and is enabled by the alert_category::peer_log bit. By │ │ │ │ -default it is disabled as a build configuration.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    load_torrent_buffer() load_torrent_file() load_torrent_parsed()

    │ │ │ │ +

    Declared in "libtorrent/load_torrent.hpp"

    │ │ │ │
    │ │ │ │ -struct peer_log_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* log_message () const;
    │ │ │ │ -
    │ │ │ │ -   enum direction_t
    │ │ │ │ -   {
    │ │ │ │ -      incoming_message,
    │ │ │ │ -      outgoing_message,
    │ │ │ │ -      incoming,
    │ │ │ │ -      outgoing,
    │ │ │ │ -      info,
    │ │ │ │ -   };
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::peer_log;
    │ │ │ │ -   char const* event_type;
    │ │ │ │ -   direction_t direction;
    │ │ │ │ -};
    │ │ │ │ +add_torrent_params load_torrent_parsed (
    │ │ │ │ +   bdecode_node const& torrent_file);
    │ │ │ │ +add_torrent_params load_torrent_buffer (
    │ │ │ │ +   span<char const> buffer);
    │ │ │ │ +add_torrent_params load_torrent_buffer (
    │ │ │ │ +   span<char const> buffer, load_torrent_limits const& cfg);
    │ │ │ │ +add_torrent_params load_torrent_parsed (
    │ │ │ │ +   bdecode_node const& torrent_file, load_torrent_limits const& cfg);
    │ │ │ │ +add_torrent_params load_torrent_file (
    │ │ │ │ +   std::string const& filename);
    │ │ │ │ +add_torrent_params load_torrent_file (
    │ │ │ │ +   std::string const& filename, load_torrent_limits const& cfg);
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -

    log_message()

    │ │ │ │ +

    These functions load the content of a .torrent file into an │ │ │ │ +add_torrent_params object. │ │ │ │ +The immutable part of a torrent file (the info-dictionary) is stored in │ │ │ │ +the ti field in the add_torrent_params object (as a torrent_info │ │ │ │ +object). │ │ │ │ +The returned object is suitable to be:

    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    truncate_files()

    │ │ │ │ +

    Declared in "libtorrent/truncate.hpp"

    │ │ │ │
    │ │ │ │ -char const* log_message () const;
    │ │ │ │ +void truncate_files (file_storage const& fs, std::string const& save_path, storage_error& ec);
    │ │ │ │  
    │ │ │ │ -

    returns the log message

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum direction_t

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +

    Truncates files larger than specified in the file_storage, saved under │ │ │ │ +the specified save_path.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    version()

    │ │ │ │ +

    Declared in "libtorrent/version.hpp"

    │ │ │ │ +
    │ │ │ │ +char const* version ();
    │ │ │ │ +
    │ │ │ │ +

    returns the libtorrent version as string form in this format: │ │ │ │ +"<major>.<minor>.<tiny>.<tag>"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum socket_type_t

    │ │ │ │ +

    Declared in "libtorrent/socket_type.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │
    namevaluedescription
    incoming_message
    tcp0 
    outgoing_message
    socks51 
    incoming
    http2 
    outgoing
    utp3 
    info
    i2p4 
    tcp_ssl5 
    socks5_ssl6 
    http_ssl7 
    utp_ssl8 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    event_type
    │ │ │ │ -
    string literal indicating the kind of event. For messages, this is the │ │ │ │ -message name.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    lsd_error_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    posted if the local service discovery socket fails to start properly. │ │ │ │ -it's categorized as alert_category::error.

    │ │ │ │ -
    │ │ │ │ -struct lsd_error_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ -   aux::noexcept_movable<address> local_address;
    │ │ │ │ -   error_code error;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    local_address
    │ │ │ │ -
    the local network the corresponding local service discovery is running │ │ │ │ -on
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    The error code
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_lookup

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    holds statistics about a current dht_lookup 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

    │ │ │ │ -
    │ │ │ │ -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;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    type
    │ │ │ │ -
    string literal indicating which kind of lookup this is
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    outstanding_requests
    │ │ │ │ -
    the number of outstanding request to individual nodes │ │ │ │ -this lookup has right now
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    timeouts
    │ │ │ │ -
    the total number of requests that have timed out so far │ │ │ │ -for this lookup
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    responses
    │ │ │ │ -
    the total number of responses we have received for this │ │ │ │ -lookup so far for this lookup
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    branch_factor
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    nodes_left
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    last_sent
    │ │ │ │ -
    the number of seconds ago the │ │ │ │ -last message was sent that's still │ │ │ │ -outstanding
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    first_timeout
    │ │ │ │ -
    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
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    target
    │ │ │ │ -
    the node-id or info-hash target for this lookup
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_stats_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    contains current DHT state. Posted in response to session::post_dht_stats().

    │ │ │ │ -
    │ │ │ │ -struct dht_stats_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = {};
    │ │ │ │ -   std::vector<dht_lookup> active_requests;
    │ │ │ │ -   std::vector<dht_routing_bucket> routing_table;
    │ │ │ │ -   sha1_hash nid;
    │ │ │ │ -   aux::noexcept_movable<udp::endpoint> local_endpoint;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    active_requests
    │ │ │ │ -
    a vector of the currently running DHT lookups.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    routing_table
    │ │ │ │ -
    contains information about every bucket in the DHT routing │ │ │ │ -table.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    nid
    │ │ │ │ -
    the node ID of the DHT node instance
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    local_endpoint
    │ │ │ │ -
    the local socket this DHT node is running on
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    incoming_request_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    posted every time an incoming request from a peer is accepted and queued │ │ │ │ -up for being serviced. This alert is only posted if │ │ │ │ -the alert_category::incoming_request flag is enabled in the alert │ │ │ │ -mask.

    │ │ │ │ -
    │ │ │ │ -struct incoming_request_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::incoming_request;
    │ │ │ │ -   peer_request req;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    req
    │ │ │ │ -
    the request this peer sent to us
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_log_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    debug logging of the DHT when alert_category::dht_log is set in the alert │ │ │ │ -mask.

    │ │ │ │ -
    │ │ │ │ -struct dht_log_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   char const* log_message () const;
    │ │ │ │ -
    │ │ │ │ -   enum dht_module_t
    │ │ │ │ -   {
    │ │ │ │ -      tracker,
    │ │ │ │ -      node,
    │ │ │ │ -      routing_table,
    │ │ │ │ -      rpc_manager,
    │ │ │ │ -      traversal,
    │ │ │ │ -   };
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::dht_log;
    │ │ │ │ -   dht_module_t module;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    log_message()

    │ │ │ │ -
    │ │ │ │ -char const* log_message () const;
    │ │ │ │ -
    │ │ │ │ -

    the log message

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum dht_module_t

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum event_t

    │ │ │ │ +

    Declared in "libtorrent/tracker_manager.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    namevaluedescription
    tracker
    none0 
    node
    completed1 
    routing_table
    started2 
    rpc_manager
    stopped3 
    traversal
    paused4 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    module
    │ │ │ │ -
    the module, or part, of the DHT that produced this log message.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    dht_pkt_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert is posted every time a DHT message is sent or received. It is │ │ │ │ -only posted if the alert_category::dht_log alert category is │ │ │ │ -enabled. It contains a verbatim copy of the message.

    │ │ │ │ -
    │ │ │ │ -struct dht_pkt_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   span<char const> pkt_buf () const;
    │ │ │ │ -
    │ │ │ │ -   enum direction_t
    │ │ │ │ -   {
    │ │ │ │ -      incoming,
    │ │ │ │ -      outgoing,
    │ │ │ │ -   };
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::dht_log;
    │ │ │ │ -   direction_t direction;
    │ │ │ │ -   aux::noexcept_movable<udp::endpoint> node;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    pkt_buf()

    │ │ │ │ -
    │ │ │ │ -span<char const> pkt_buf () const;
    │ │ │ │ -
    │ │ │ │ -

    returns a pointer to the packet buffer and size of the packet, │ │ │ │ -respectively. This buffer is only valid for as long as the alert itself │ │ │ │ -is valid, which is owned by libtorrent and reclaimed whenever │ │ │ │ -pop_alerts() is called on the session.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum direction_t

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum portmap_transport

    │ │ │ │ +

    Declared in "libtorrent/portmap.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    namevaluedescription
    incoming
    natpmp0 natpmp can be NAT-PMP or PCP
    outgoing
    upnp1 
    │ │ │ │ -[report issue]
    │ │ │ │ -
    direction
    │ │ │ │ -
    whether this is an incoming or outgoing packet.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    node
    │ │ │ │ -
    the DHT node we received this packet from, or sent this packet to │ │ │ │ -(depending on direction).
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    dht_get_peers_reply_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    Posted when we receive a response to a DHT get_peers request.

    │ │ │ │ -
    │ │ │ │ -struct dht_get_peers_reply_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   int num_peers () const;
    │ │ │ │ -   std::vector<tcp::endpoint> peers () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::dht_operation;
    │ │ │ │ -   sha1_hash info_hash;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_direct_response_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This is posted exactly once for every call to session_handle::dht_direct_request. │ │ │ │ -If the request failed, response() will return a default constructed bdecode_node.

    │ │ │ │ -
    │ │ │ │ -struct dht_direct_response_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   bdecode_node response () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ -   client_data_t userdata;
    │ │ │ │ -   aux::noexcept_movable<udp::endpoint> endpoint;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    picker_log_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    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).

    │ │ │ │ -
    │ │ │ │ -struct picker_log_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   std::vector<piece_block> blocks () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::picker_log;
    │ │ │ │ -   static constexpr picker_flags_t partial_ratio  = 0_bit;
    │ │ │ │ -   static constexpr picker_flags_t prioritize_partials  = 1_bit;
    │ │ │ │ -   static constexpr picker_flags_t rarest_first_partials  = 2_bit;
    │ │ │ │ -   static constexpr picker_flags_t rarest_first  = 3_bit;
    │ │ │ │ -   static constexpr picker_flags_t reverse_rarest_first  = 4_bit;
    │ │ │ │ -   static constexpr picker_flags_t suggested_pieces  = 5_bit;
    │ │ │ │ -   static constexpr picker_flags_t prio_sequential_pieces  = 6_bit;
    │ │ │ │ -   static constexpr picker_flags_t sequential_pieces  = 7_bit;
    │ │ │ │ -   static constexpr picker_flags_t reverse_pieces  = 8_bit;
    │ │ │ │ -   static constexpr picker_flags_t time_critical  = 9_bit;
    │ │ │ │ -   static constexpr picker_flags_t random_pieces  = 10_bit;
    │ │ │ │ -   static constexpr picker_flags_t prefer_contiguous  = 11_bit;
    │ │ │ │ -   static constexpr picker_flags_t reverse_sequential  = 12_bit;
    │ │ │ │ -   static constexpr picker_flags_t backup1  = 13_bit;
    │ │ │ │ -   static constexpr picker_flags_t backup2  = 14_bit;
    │ │ │ │ -   static constexpr picker_flags_t end_game  = 15_bit;
    │ │ │ │ -   static constexpr picker_flags_t extent_affinity  = 16_bit;
    │ │ │ │ -   picker_flags_t const picker_flags;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    picker_flags
    │ │ │ │ -
    this is a bitmask of which features were enabled for this particular │ │ │ │ -pick. The bits are defined in the picker_flags_t enum.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    session_error_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    this alert is posted when the session encounters a serious error, │ │ │ │ -potentially fatal

    │ │ │ │ -
    │ │ │ │ -struct session_error_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ -   error_code const error;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    The error code, if one is associated with this error
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_live_nodes_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    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.

    │ │ │ │ -
    │ │ │ │ -struct dht_live_nodes_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   std::vector<std::pair<sha1_hash, udp::endpoint>> nodes () const;
    │ │ │ │ -   int num_nodes () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::dht;
    │ │ │ │ -   sha1_hash node_id;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    nodes() num_nodes()

    │ │ │ │ -
    │ │ │ │ -std::vector<std::pair<sha1_hash, udp::endpoint>> nodes () const;
    │ │ │ │ -int num_nodes () const;
    │ │ │ │ -
    │ │ │ │ -

    the number of nodes in the routing table and the actual nodes.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    node_id
    │ │ │ │ -
    the local DHT node's node-ID this routing table belongs to
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    session_stats_header_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    The session_stats_header alert is posted the first time │ │ │ │ -post_session_stats() is called

    │ │ │ │ -

    the message() member function returns a string representation of the │ │ │ │ -header that properly match the stats values string returned in │ │ │ │ -session_stats_alert::message().

    │ │ │ │ -

    this specific output is parsed by tools/parse_session_stats.py │ │ │ │ -if this is changed, that parser should also be changed

    │ │ │ │ -
    │ │ │ │ -struct session_stats_header_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = {};
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_sample_infohashes_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    posted as a response to a call to session::dht_sample_infohashes() with │ │ │ │ -the information from the DHT response message.

    │ │ │ │ -
    │ │ │ │ -struct dht_sample_infohashes_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -   std::vector<sha1_hash> samples () const;
    │ │ │ │ -   int num_samples () const;
    │ │ │ │ -   int num_nodes () const;
    │ │ │ │ -   std::vector<std::pair<sha1_hash, udp::endpoint>> nodes () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::dht_operation;
    │ │ │ │ -   sha1_hash node_id;
    │ │ │ │ -   aux::noexcept_movable<udp::endpoint> endpoint;
    │ │ │ │ -   time_duration const interval;
    │ │ │ │ -   int const num_infohashes;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    num_samples() samples()

    │ │ │ │ -
    │ │ │ │ -std::vector<sha1_hash> samples () const;
    │ │ │ │ -int num_samples () 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().

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    num_nodes()

    │ │ │ │ -
    │ │ │ │ -int num_nodes () const;
    │ │ │ │ -
    │ │ │ │ -

    The total number of nodes returned by nodes().

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    nodes()

    │ │ │ │ -
    │ │ │ │ -std::vector<std::pair<sha1_hash, udp::endpoint>> nodes () const;
    │ │ │ │ -
    │ │ │ │ -

    This is the set of more DHT nodes returned by the request.

    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    node_id
    │ │ │ │ -
    id of the node the request was sent to (and this response was received from)
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    endpoint
    │ │ │ │ -
    the node the request was sent to (and this response was received from)
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    interval
    │ │ │ │ -
    the interval to wait before making another request to this node
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    num_infohashes
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    block_uploaded_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    This alert 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 alert may be posted without the bytes having been sent to the peer. │ │ │ │ -It belongs to the alert_category::upload category.

    │ │ │ │ -
    │ │ │ │ -struct block_uploaded_alert final : peer_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   int const block_index;
    │ │ │ │ -   piece_index_t const piece_index;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    alerts_dropped_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    this alert is posted to indicate to the client that some alerts were │ │ │ │ -dropped. Dropped meaning that the alert failed to be delivered to the │ │ │ │ -client. The most common cause of such failure is that the internal alert │ │ │ │ -queue grew too big (controlled by alert_queue_size).

    │ │ │ │ -
    │ │ │ │ -struct alerts_dropped_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   static_assert (num_alert_types <= abi_alert_count, "need to increase bitset. This is an ABI break");
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ -   std::bitset<abi_alert_count> dropped_alerts;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    dropped_alerts
    │ │ │ │ -
    a bitmask indicating which alerts were dropped. Each bit represents the │ │ │ │ -alert type ID, where bit 0 represents whether any alert of type 0 has │ │ │ │ -been dropped, and so on.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    socks5_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    this alert is posted with SOCKS5 related errors, when a SOCKS5 proxy is │ │ │ │ -configured. It's enabled with the alert_category::error alert category.

    │ │ │ │ -
    │ │ │ │ -struct socks5_alert final : alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ -   error_code error;
    │ │ │ │ -   operation_t op;
    │ │ │ │ -   aux::noexcept_movable<tcp::endpoint> ip;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    the error
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    op
    │ │ │ │ -
    the operation that failed
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    ip
    │ │ │ │ -
    the endpoint configured as the proxy
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_prio_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    posted when a prioritize_files() or file_priority() update of the file │ │ │ │ -priorities complete, which requires a round-trip to the disk thread.

    │ │ │ │ -

    If the disk operation fails this alert won't be posted, but a │ │ │ │ -file_error_alert is posted instead, and the torrent is stopped.

    │ │ │ │ -
    │ │ │ │ -struct file_prio_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ -   error_code error;
    │ │ │ │ -   operation_t op;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    error
    │ │ │ │ -
    the error
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    op
    │ │ │ │ -
    the operation that failed
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    oversized_file_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    this alert 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 alert is posted. │ │ │ │ -the client may want to call truncate_files() in that case, or perhaps │ │ │ │ -interpret it as a sign that some other file is in the way, that shouldn't │ │ │ │ -be overwritten.

    │ │ │ │ -
    │ │ │ │ -struct oversized_file_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::storage;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    torrent_conflict_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    this alert 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 duplicate_torrent │ │ │ │ -as the error code. This alert is posted containing the metadata. For more │ │ │ │ -information, see BitTorrent v2 torrents. │ │ │ │ -The torrent this alert originated from was the one that downloaded the

    │ │ │ │ -

    metadata (i.e. the handle member from the torrent_alert base class).

    │ │ │ │ -
    │ │ │ │ -struct torrent_conflict_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::error;
    │ │ │ │ -   torrent_handle conflicting_torrent;
    │ │ │ │ -   std::shared_ptr<torrent_info> metadata;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    conflicting_torrent
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    metadata
    │ │ │ │ -
    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
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    peer_info_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    posted when torrent_handle::post_peer_info() is called

    │ │ │ │ -
    │ │ │ │ -struct peer_info_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -   std::vector<lt::peer_info> peer_info;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    peer_info
    │ │ │ │ -
    the list of the currently connected peers
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_progress_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    posted when torrent_handle::post_file_progress() is called

    │ │ │ │ -
    │ │ │ │ -struct file_progress_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::file_progress;
    │ │ │ │ -   aux::vector<std::int64_t, file_index_t> files;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    files
    │ │ │ │ -
    the list of the files in the torrent
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    piece_info_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    posted when torrent_handle::post_download_queue() is called

    │ │ │ │ -
    │ │ │ │ -struct piece_info_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::piece_progress;
    │ │ │ │ -   std::vector<partial_piece_info> piece_info;
    │ │ │ │ -   std::vector<block_info> block_data;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    piece_info
    │ │ │ │ -
    info about pieces being downloaded for the torrent
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    block_data
    │ │ │ │ -
    storage for block_info pointers in partial_piece_info objects
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    piece_availability_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    posted when torrent_handle::post_piece_availability() is called

    │ │ │ │ -
    │ │ │ │ -struct piece_availability_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -   std::vector<int> piece_availability;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    piece_availability
    │ │ │ │ -
    info about pieces being downloaded for the torrent
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    tracker_list_alert

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -

    posted when torrent_handle::post_trackers() is called

    │ │ │ │ -
    │ │ │ │ -struct tracker_list_alert final : torrent_alert
    │ │ │ │ -{
    │ │ │ │ -   std::string message () const override;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t static_category  = alert_category::status;
    │ │ │ │ -   std::vector<announce_entry> trackers;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    trackers
    │ │ │ │ -
    list of trackers and their status for the torrent
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    alert

    │ │ │ │ -

    Declared in "libtorrent/alert.hpp"

    │ │ │ │ -

    The alert class is the base class that specific messages are derived from. │ │ │ │ -alert types are not copyable, and cannot be constructed by the client. The │ │ │ │ -pointers returned by libtorrent are short lived (the details are described │ │ │ │ -under session_handle::pop_alerts())

    │ │ │ │ -
    │ │ │ │ -struct alert
    │ │ │ │ -{
    │ │ │ │ -   time_point timestamp () const;
    │ │ │ │ -   virtual int type () const noexcept = 0;
    │ │ │ │ -   virtual char const* what () const noexcept = 0;
    │ │ │ │ -   virtual std::string message () const = 0;
    │ │ │ │ -   virtual alert_category_t category () const noexcept = 0;
    │ │ │ │ -
    │ │ │ │ -   static constexpr alert_category_t error_notification  = 0_bit;
    │ │ │ │ -   static constexpr alert_category_t peer_notification  = 1_bit;
    │ │ │ │ -   static constexpr alert_category_t port_mapping_notification  = 2_bit;
    │ │ │ │ -   static constexpr alert_category_t storage_notification  = 3_bit;
    │ │ │ │ -   static constexpr alert_category_t tracker_notification  = 4_bit;
    │ │ │ │ -   static constexpr alert_category_t connect_notification  = 5_bit;
    │ │ │ │ -   static constexpr alert_category_t status_notification  = 6_bit;
    │ │ │ │ -   static constexpr alert_category_t ip_block_notification  = 8_bit;
    │ │ │ │ -   static constexpr alert_category_t performance_warning  = 9_bit;
    │ │ │ │ -   static constexpr alert_category_t dht_notification  = 10_bit;
    │ │ │ │ -   static constexpr alert_category_t session_log_notification  = 13_bit;
    │ │ │ │ -   static constexpr alert_category_t torrent_log_notification  = 14_bit;
    │ │ │ │ -   static constexpr alert_category_t peer_log_notification  = 15_bit;
    │ │ │ │ -   static constexpr alert_category_t incoming_request_notification  = 16_bit;
    │ │ │ │ -   static constexpr alert_category_t dht_log_notification  = 17_bit;
    │ │ │ │ -   static constexpr alert_category_t dht_operation_notification  = 18_bit;
    │ │ │ │ -   static constexpr alert_category_t port_mapping_log_notification  = 19_bit;
    │ │ │ │ -   static constexpr alert_category_t picker_log_notification  = 20_bit;
    │ │ │ │ -   static constexpr alert_category_t file_progress_notification  = 21_bit;
    │ │ │ │ -   static constexpr alert_category_t piece_progress_notification  = 22_bit;
    │ │ │ │ -   static constexpr alert_category_t upload_notification  = 23_bit;
    │ │ │ │ -   static constexpr alert_category_t block_progress_notification  = 24_bit;
    │ │ │ │ -   static constexpr alert_category_t all_categories  = alert_category_t::all();
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    timestamp()

    │ │ │ │ -
    │ │ │ │ -time_point timestamp () const;
    │ │ │ │ -
    │ │ │ │ -

    a timestamp is automatically created in the constructor

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    type()

    │ │ │ │ -
    │ │ │ │ -virtual int type () const noexcept = 0;
    │ │ │ │ -
    │ │ │ │ -

    returns an integer that is unique to this alert type. It can be │ │ │ │ -compared against a specific alert by querying a static constant called alert_type │ │ │ │ -in the alert. It can be used to determine the run-time type of an alert* in │ │ │ │ -order to cast to that alert 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...
    │ │ │ │ -                }
    │ │ │ │ -        }
    │ │ │ │ -}
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    what()

    │ │ │ │ -
    │ │ │ │ -virtual char const* what () const noexcept = 0;
    │ │ │ │ -
    │ │ │ │ -

    returns a string literal describing the type of the alert. It does │ │ │ │ -not include any information that might be bundled with the alert.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    message()

    │ │ │ │ -
    │ │ │ │ -virtual std::string message () const = 0;
    │ │ │ │ -
    │ │ │ │ -

    generate a string describing the alert 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 alert │ │ │ │ -type individually and extract and render the information from the alert depending │ │ │ │ -on the locale.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    category()

    │ │ │ │ -
    │ │ │ │ -virtual alert_category_t category () const noexcept = 0;
    │ │ │ │ -
    │ │ │ │ -

    returns a bitmask specifying which categories this alert belong to.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    operation_name()

    │ │ │ │ -

    Declared in "libtorrent/operations.hpp"

    │ │ │ │ -
    │ │ │ │ -char const* operation_name (operation_t op);
    │ │ │ │ -
    │ │ │ │ -

    maps an operation id (from peer_error_alert and peer_disconnected_alert) │ │ │ │ -to its name. See operation_t for the constants

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    alert_cast()

    │ │ │ │ -

    Declared in "libtorrent/alert.hpp"

    │ │ │ │ -
    │ │ │ │ -template <typename T> T const* alert_cast (alert const* a);
    │ │ │ │ -template <typename T> T* alert_cast (alert* a);
    │ │ │ │ -
    │ │ │ │ -

    When you get an alert, you can use alert_cast<> to attempt to cast the │ │ │ │ -pointer to a specific alert type, in order to query it for more │ │ │ │ -information.

    │ │ │ │ -
    │ │ │ │ -

    Note

    │ │ │ │ -

    alert_cast<> can only cast to an exact alert type, not a base class

    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum operation_t

    │ │ │ │ -

    Declared in "libtorrent/operations.hpp"

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum portmap_protocol

    │ │ │ │ +

    Declared in "libtorrent/portmap.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ +
    namevaluedescription
    unknown
    none0the error was unexpected and it is unknown which operation caused it 
    bittorrent
    tcp1this is used when the bittorrent logic │ │ │ │ -determines to disconnect 
    iocontrol
    udp2a call to iocontrol failed
    getpeername3a call to getpeername() failed (querying the remote IP of a │ │ │ │ -connection)
    getname4a call to getname failed (querying the local IP of a │ │ │ │ -connection)
    alloc_recvbuf5an attempt to allocate a receive buffer failed
    alloc_sndbuf6an attempt to allocate a send buffer failed
    file_write7writing to a file failed
    file_read8reading from a file failed
    file9a non-read and non-write file operation failed
    sock_write10a socket write operation failed
    sock_read11a socket read operation failed
    sock_open12a call to open(), to create a socket socket failed
    sock_bind13a call to bind() on a socket failed
    available14an attempt to query the number of bytes available to read from a socket │ │ │ │ -failed
    encryption15a call related to bittorrent protocol encryption failed
    connect16an attempt to connect a socket failed
    ssl_handshake17establishing an SSL connection failed
    get_interface18a connection failed to satisfy the bind interface setting
    sock_listen19a call to listen() on a socket
    sock_bind_to_device20a call to the ioctl to bind a socket to a specific network device or │ │ │ │ -adapter
    sock_accept21a call to accept() on a socket
    parse_address22convert a string into a valid network address
    enum_if23enumeration network devices or adapters
    file_stat24invoking stat() on a file
    file_copy25copying a file
    file_fallocate26allocating storage for a file
    file_hard_link27creating a hard link
    file_remove28removing a file
    file_rename29renaming a file
    file_open30opening a file
    mkdir31creating a directory
    check_resume32check fast resume data against files on disk
    exception33an unknown exception
    alloc_cache_piece34allocate space for a piece in the cache
    partfile_move35move a part-file
    partfile_read36read from a part file
    partfile_write37write to a part-file
    hostname_lookup38a hostname lookup 
    symlink39create or read a symlink
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum protocol_version

    │ │ │ │ +

    Declared in "libtorrent/info_hash.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ +
    namevaluedescription
    handshake40handshake with a peer or server
    V10The original BitTorrent version, using SHA-1 hashes
    sock_option41set socket option
    V21Version 2 of the BitTorrent protocol, using SHA-256 hashes
    enum_route42enumeration of network routes
    NUM2 
    file_seek43moving read/write position in a file, operation_t::hostname_lookup
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum connection_type

    │ │ │ │ +

    Declared in "libtorrent/peer_connection.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    namevaluedescription
    timer44an async wait operation on a timer
    bittorrent0 
    file_mmap45call to mmap() (or windows counterpart)
    url_seed1 
    file_truncate46call to ftruncate() (or SetEndOfFile() on windows)
    http_seed2 
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    download_priority_t

    │ │ │ │ +

    Declared in "libtorrent/download_priority.hpp"

    │ │ │ │ +
    │ │ │ │ +
    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.
    │ │ │ │ +
    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    int

    │ │ │ │ -

    Declared in "libtorrent/alert_types.hpp"

    │ │ │ │ -
    │ │ │ │ -
    user_alert_id
    │ │ │ │ -
    user defined alerts should use IDs greater than this
    │ │ │ │ +

    Declared in "libtorrent/version.hpp"

    │ │ │ │ +
    │ │ │ │ +
    version_major
    │ │ │ │ +
    the major, minor and tiny versions of libtorrent
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    num_alert_types
    │ │ │ │ -
    this constant represents "max_alert_index" + 1
    │ │ │ │ +
    │ │ │ │ +
    version_minor
    │ │ │ │ +
    the major, minor and tiny versions of libtorrent
    │ │ │ │
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    alert_category_t

    │ │ │ │ -

    Declared in "libtorrent/alert.hpp"

    │ │ │ │ -
    │ │ │ │ -
    error
    │ │ │ │ -

    Enables alerts that report an error. This includes:

    │ │ │ │ -
      │ │ │ │ -
    • tracker errors
    • │ │ │ │ -
    • tracker warnings
    • │ │ │ │ -
    • file errors
    • │ │ │ │ -
    • resume data failures
    • │ │ │ │ -
    • web seed errors
    • │ │ │ │ -
    • .torrent files errors
    • │ │ │ │ -
    • listen socket errors
    • │ │ │ │ -
    • port mapping errors
    • │ │ │ │ -
    │ │ │ │ +
    │ │ │ │ +
    version_tiny
    │ │ │ │ +
    the major, minor and tiny versions of libtorrent
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    torrent_flags_t

    │ │ │ │ +

    Declared in "libtorrent/torrent_flags.hpp"

    │ │ │ │ +
    │ │ │ │ +
    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 set the seed_mode flag on a torrent after it has │ │ │ │ +been added to a session. It is possible to clear it though.

    │ │ │ │
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    peer
    │ │ │ │ -
    Enables alerts when peers send invalid requests, get banned or │ │ │ │ -snubbed.
    │ │ │ │ +
    │ │ │ │ +
    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.

    │ │ │ │ +
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    port_mapping
    │ │ │ │ -
    Enables alerts for port mapping events. For NAT-PMP and UPnP.
    │ │ │ │ +
    │ │ │ │ +
    share_mode
    │ │ │ │ +

    determines if the torrent should be added in share mode 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.

    │ │ │ │ +
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    storage
    │ │ │ │ -
    Enables alerts for events related to the storage. File errors and │ │ │ │ -synchronization events for moving the storage, renaming files etc.
    │ │ │ │ +
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    tracker
    │ │ │ │ -
    Enables all tracker events. Includes announcing to trackers, │ │ │ │ -receiving responses, warnings and errors.
    │ │ │ │ +
    │ │ │ │ +
    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 queuing.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    connect
    │ │ │ │ -
    Low level alerts for when peers are connected and disconnected.
    │ │ │ │ +
    │ │ │ │ +
    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 queuing.

    │ │ │ │ +
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    status
    │ │ │ │ -
    Enables alerts for when a torrent or the session changes state.
    │ │ │ │ +
    │ │ │ │ +
    duplicate_is_error
    │ │ │ │ +
    used in add_torrent_params to indicate that it's an error to attempt │ │ │ │ +to add a torrent that's already in the session. If it's not considered an │ │ │ │ +error, a handle to the existing torrent is returned. │ │ │ │ +This flag is not saved by write_resume_data(), since it is only meant for │ │ │ │ +adding torrents.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    ip_block
    │ │ │ │ -
    Alerts when a peer is blocked by the ip blocker or port blocker.
    │ │ │ │ +
    │ │ │ │ +
    update_subscribe
    │ │ │ │ +
    on by default and means that this torrent will be part of state │ │ │ │ +updates when calling post_torrent_updates(). │ │ │ │ +This flag is not saved by write_resume_data().
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    performance_warning
    │ │ │ │ -
    Alerts when some limit is reached that might limit the download │ │ │ │ -or upload rate.
    │ │ │ │ +
    │ │ │ │ +
    super_seeding
    │ │ │ │ +
    sets the torrent into super seeding/initial seeding mode. If the torrent │ │ │ │ +is not a seed, this flag has no effect.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    dht
    │ │ │ │ -
    Alerts on events in the DHT node. For incoming searches or │ │ │ │ -bootstrapping being done etc.
    │ │ │ │ +
    │ │ │ │ +
    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 set_piece_deadline() instead.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    stats
    │ │ │ │ -
    If you enable these alerts, you will receive a stats_alert │ │ │ │ -approximately once every second, for every active torrent. │ │ │ │ -These alerts contain all statistics counters for the interval since │ │ │ │ -the lasts stats alert.
    │ │ │ │ +
    │ │ │ │ +
    stop_when_ready
    │ │ │ │ +

    When this flag is set, the torrent will force stop 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.

    │ │ │ │ +

    Force stopped 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 add_torrent_params.

    │ │ │ │ +

    The stop-when-ready flag fixes the inherent race condition of waiting │ │ │ │ +for the state_changed_alert and then call pause(). The download/seeding │ │ │ │ +will most likely start in between posting the alert 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

    │ │ │ │ +
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    session_log
    │ │ │ │ -
    Enables debug logging alerts. These are available unless libtorrent │ │ │ │ -was built with logging disabled (TORRENT_DISABLE_LOGGING). The │ │ │ │ -alerts being posted are log_alert and are session wide.
    │ │ │ │ +
    │ │ │ │ +
    override_trackers
    │ │ │ │ +
    when this flag is set, the tracker list in the add_torrent_params │ │ │ │ +object override any trackers from the torrent file. If the flag is │ │ │ │ +not set, the trackers from the add_torrent_params object will be │ │ │ │ +added to the list of trackers used by the torrent. │ │ │ │ +This flag is set by read_resume_data() 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 session. │ │ │ │ +This flag is not saved by write_resume_data()
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    torrent_log
    │ │ │ │ -
    Enables debug logging alerts for torrents. These are available │ │ │ │ -unless libtorrent was built with logging disabled │ │ │ │ -(TORRENT_DISABLE_LOGGING). The alerts being posted are │ │ │ │ -torrent_log_alert and are torrent wide debug events.
    │ │ │ │ +
    │ │ │ │ +
    override_web_seeds
    │ │ │ │ +
    If this flag is set, the web seeds from the add_torrent_params │ │ │ │ +object will override any web seeds in the torrent file. If it's not │ │ │ │ +set, web seeds in the add_torrent_params object will be added to the │ │ │ │ +list of web seeds used by the torrent. │ │ │ │ +This flag is set by read_resume_data() 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 session. │ │ │ │ +This flag is not saved by write_resume_data()
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    peer_log
    │ │ │ │ -
    Enables debug logging alerts for peers. These are available unless │ │ │ │ -libtorrent was built with logging disabled │ │ │ │ -(TORRENT_DISABLE_LOGGING). The alerts being posted are │ │ │ │ -peer_log_alert and low-level peer events and messages.
    │ │ │ │ +
    │ │ │ │ +
    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 │ │ │ │ +save_resume_data() for details.

    │ │ │ │ +

    This flag is cleared by a successful call to save_resume_data() │ │ │ │ +This flag is not saved by write_resume_data(), since it represents an │ │ │ │ +ephemeral state of a running torrent.

    │ │ │ │ +
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    incoming_request
    │ │ │ │ -
    enables the incoming_request_alert.
    │ │ │ │ +
    │ │ │ │ +
    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.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    dht_log
    │ │ │ │ -
    enables dht_log_alert, debug logging for the DHT
    │ │ │ │ +
    │ │ │ │ +
    disable_lsd
    │ │ │ │ +
    set this flag to disable local service discovery for this torrent.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    dht_operation
    │ │ │ │ -
    enable events from pure dht operations not related to torrents
    │ │ │ │ +
    │ │ │ │ +
    disable_pex
    │ │ │ │ +
    set this flag to disable peer exchange for this torrent.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    port_mapping_log
    │ │ │ │ -
    enables port mapping log events. This log is useful │ │ │ │ -for debugging the UPnP or NAT-PMP implementation
    │ │ │ │ +
    │ │ │ │ +
    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 session 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.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    picker_log
    │ │ │ │ -
    enables verbose logging from the piece picker.
    │ │ │ │ +
    │ │ │ │ +
    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).
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    file_progress
    │ │ │ │ -
    alerts when files complete downloading
    │ │ │ │ +
    │ │ │ │ +
    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 session 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 parse_magnet_uri() if the tracker list contains such │ │ │ │ +URL.
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    piece_progress
    │ │ │ │ -
    alerts when pieces complete downloading or fail hash check
    │ │ │ │ +
    │ │ │ │ +
    all
    │ │ │ │ +
    all torrent flags combined. Can conveniently be used when creating masks │ │ │ │ +for flags
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    upload
    │ │ │ │ -
    alerts when we upload blocks to other peers
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    pex_flags_t

    │ │ │ │ +

    Declared in "libtorrent/pex_flags.hpp"

    │ │ │ │ +
    │ │ │ │ +
    pex_encryption
    │ │ │ │ +
    the peer supports protocol encryption
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    block_progress
    │ │ │ │ -
    alerts on individual blocks being requested, downloading, finished, │ │ │ │ -rejected, time-out and cancelled. This is likely to post alerts at a │ │ │ │ -high rate.
    │ │ │ │ +
    │ │ │ │ +
    pex_seed
    │ │ │ │ +
    the peer is a seed
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -
    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.

    │ │ │ │ -
    │ │ │ │ +
    │ │ │ │ +
    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
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    char const*

    │ │ │ │ +

    Declared in "libtorrent/version.hpp"

    │ │ │ │ +
    │ │ │ │ +
    version_str
    │ │ │ │ +
    the libtorrent version in string form
    │ │ │ │ +
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    std::uint64_t

    │ │ │ │ +

    Declared in "libtorrent/version.hpp"

    │ │ │ │ +
    │ │ │ │ +
    version_revision
    │ │ │ │ +
    the git commit of this libtorrent version
    │ │ │ │
    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    torrent_status

    │ │ │ │

    Declared in "libtorrent/torrent_status.hpp"

    │ │ │ │

    holds a snapshot of the status of a torrent, as queried by │ │ │ │ torrent_handle::status().

    │ │ │ │ @@ -15279,15 +14278,15 @@ │ │ │ │ time_point last_download; │ │ │ │ seconds active_duration; │ │ │ │ seconds finished_duration; │ │ │ │ seconds seeding_duration; │ │ │ │ torrent_flags_t flags {}; │ │ │ │ }; │ │ │ │ │ │ │ │ -[report issue]
    │ │ │ │ +[report issue]
    │ │ │ │

    operator==()

    │ │ │ │
    │ │ │ │  bool operator== (torrent_status const& st) const;
    │ │ │ │  
    │ │ │ │

    compares if the torrent status objects come from the same torrent. i.e. │ │ │ │ only the torrent_handle field is compared.

    │ │ │ │ [report issue]
    │ │ │ │ @@ -15573,15 +14572,15 @@ │ │ │ │ currently connected to. │ │ │ │
    │ │ │ │ [report issue]
    │ │ │ │
    num_peers
    │ │ │ │
    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 get_peer_info().
    │ │ │ │ +are visible in the peer list when you call get_peer_info(). │ │ │ │
    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    num_complete num_incomplete
    │ │ │ │
    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 │ │ │ │ @@ -15759,1059 +14758,5166 @@ │ │ │ │ asking for the payload.
    │ │ │ │
    │ │ │ │ [report issue]
    │ │ │ │
    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, int 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 session 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 BEP 3.

    │ │ │ │ -

    The function for decoding bencoded data bdecode(), returning a bdecode_node. │ │ │ │ -This function builds a tree that points back into the original buffer. The │ │ │ │ -returned bdecode_node will not be valid once the buffer it was parsed out of │ │ │ │ -is discarded.

    │ │ │ │ -

    It's possible to construct an entry from a bdecode_node, if a structure needs │ │ │ │ -to be altered and re-encoded.

    │ │ │ │ -[report issue]
    │ │ │ │ +

    You have some control over session configuration through the session::apply_settings() │ │ │ │ +member function. To change one or more configuration options, create a settings_pack │ │ │ │ +object and fill it with the settings to be set and pass it in to session::apply_settings().

    │ │ │ │ +

    The settings_pack object is a collection of settings updates that are applied │ │ │ │ +to the session 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 │ │ │ │ +settings_pack class. These are the available settings:

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +

    settings_pack

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    user_agentstringlibtorrent/
    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    announce_ipstringnullptr
    │ │ │ │ +

    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.

    │ │ │ │ +
    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    handshake_client_versionstringnullptr
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    outgoing_interfacesstring 
    │ │ │ │ +

    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 (bind-to-device).

    │ │ │ │ +

    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 to bind() │ │ │ │ +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 to bind() 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 not in this list │ │ │ │ +will be rejected with a peer_blocked_alert 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 [, ].

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    listen_interfacesstring0.0.0.0:6881,[::]:6881
    │ │ │ │ +

    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 outgoing 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 listen_failed_alert is posted. Once a │ │ │ │ +socket binding succeeds (if it does), the listen_succeeded_alert │ │ │ │ +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 │ │ │ │ +settings_pack::outgoing_interfaces).

    │ │ │ │ +

    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 Multi-homed hosts section.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    proxy_hostnamestring 
    │ │ │ │ +

    when using a proxy, this is the hostname where the proxy is running │ │ │ │ +see proxy_type. Note that when using a proxy, the │ │ │ │ +settings_pack::listen_interfaces 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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    proxy_usernamestring 
    proxy_passwordstring 
    │ │ │ │ +

    when using a proxy, these are the credentials (if any) to use when │ │ │ │ +connecting to it. see proxy_type

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    i2p_hostnamestring 
    │ │ │ │ +

    sets the i2p 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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    peer_fingerprintstring-LT20B0-
    │ │ │ │ +

    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, generate_fingerprint() that can be used │ │ │ │ +to generate a standard client peer ID fingerprint prefix.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_bootstrap_nodesstringdht.libtorrent.org:25401
    │ │ │ │ +

    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,

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    allow_multiple_connections_per_ipboolfalse
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    send_redundant_havebooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    use_dht_as_fallbackboolfalse
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    upnp_ignore_nonroutersboolfalse
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    use_parole_modebooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    auto_manage_prefer_seedsboolfalse
    │ │ │ │ +

    if true, prefer seeding torrents when determining which torrents to give │ │ │ │ +active slots to. If false, give preference to downloading torrents

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dont_count_slow_torrentsbooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    close_redundant_connectionsbooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    prioritize_partial_piecesboolfalse
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    rate_limit_ip_overheadbooltrue
    │ │ │ │ +

    if set to true, the estimated TCP/IP overhead is drained from the │ │ │ │ +rate limiters, to avoid exceeding the limits with the total traffic

    │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    announce_to_all_tiersboolfalse
    announce_to_all_trackersboolfalse
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    prefer_udp_trackersbooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    disable_hash_checksboolfalse
    │ │ │ │ +

    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)

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    allow_i2p_mixedboolfalse
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    no_atime_storagebooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    incoming_starts_queued_torrentsboolfalse
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    report_true_downloadedboolfalse
    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    strict_end_game_modebooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    enable_outgoing_utpbooltrue
    enable_incoming_utpbooltrue
    enable_outgoing_tcpbooltrue
    enable_incoming_tcpbooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    no_recheck_incomplete_resumeboolfalse
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    anonymous_modeboolfalse
    │ │ │ │ +

    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.
    • │ │ │ │ +
    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    report_web_seed_downloadsbooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    seeding_outgoing_connectionsbooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    no_connect_privileged_portsboolfalse
    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    smooth_connectsbooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    always_send_user_agentboolfalse
    │ │ │ │ +

    always send user-agent in every web seed request. If false, only │ │ │ │ +the first request per http connection will include the user agent

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    apply_ip_filter_to_trackersbooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    ban_web_seedsbooltrue
    │ │ │ │ +

    when true, web seeds sending bad data will be banned

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    support_share_modebooltrue
    │ │ │ │ +

    if false, prevents libtorrent to advertise share-mode support

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    report_redundant_bytesbooltrue
    │ │ │ │ +

    if this is true, the number of redundant bytes is sent to the │ │ │ │ +tracker

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    listen_system_port_fallbackbooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    announce_crypto_supportbooltrue
    │ │ │ │ +

    when this is true, and incoming encrypted connections are enabled, │ │ │ │ +&supportcrypt=1 is included in http tracker announces

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    enable_upnpbooltrue
    │ │ │ │ +

    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 portmap_alert and the portmap_error_alert. The object will be │ │ │ │ +valid until stop_upnp() is called. See upnp and nat pmp.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    enable_natpmpbooltrue
    │ │ │ │ +

    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 portmap_alert and the portmap_error_alert. The object │ │ │ │ +will be valid until stop_natpmp() is called. See │ │ │ │ +upnp and nat pmp.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    enable_lsdbooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    enable_dhtbooltrue
    │ │ │ │ +

    starts the dht node and makes the trackerless service available to │ │ │ │ +torrents.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    prefer_rc4boolfalse
    │ │ │ │ +

    if the allowed encryption level is both, setting this to true will │ │ │ │ +prefer RC4 if both methods are offered, plain text otherwise

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    proxy_hostnamesbooltrue
    │ │ │ │ +

    if true, hostname lookups are done via the configured proxy (if │ │ │ │ +any). This is only supported by SOCKS5 and HTTP.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    proxy_peer_connectionsbooltrue
    │ │ │ │ +

    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).

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    auto_sequentialbooltrue
    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    proxy_tracker_connectionsbooltrue
    │ │ │ │ +

    if true, tracker connections are made over the configured proxy, if │ │ │ │ +any.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    enable_ip_notifierbooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_prefer_verified_node_idsbooltrue
    │ │ │ │ +

    when this is true, nodes whose IDs are derived from their source │ │ │ │ +IP according to BEP 42 are preferred in the routing table.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_restrict_routing_ipsbooltrue
    │ │ │ │ +

    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 entry in the whole routing table

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_restrict_search_ipsbooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_extended_routing_tablebooltrue
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_aggressive_lookupsbooltrue
    │ │ │ │ +

    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 branch factor 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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_privacy_lookupsboolfalse
    │ │ │ │ +

    when set, perform lookups in a way that is slightly more expensive, │ │ │ │ +but which minimizes the amount of information leaked about you.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_enforce_node_idboolfalse
    │ │ │ │ +

    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".

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_ignore_dark_internetbooltrue
    │ │ │ │ +

    ignore DHT messages from parts of the internet we wouldn't expect to │ │ │ │ +see any traffic from

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_read_onlyboolfalse
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    piece_extent_affinityboolfalse
    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    validate_https_trackersbooltrue
    │ │ │ │ +

    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).

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    ssrf_mitigationbooltrue
    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    allow_idnaboolfalse
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    enable_set_file_valid_databoolfalse
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    socks5_udp_send_local_epboolfalse
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    tracker_completion_timeoutint30
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    tracker_receive_timeoutint10
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    stop_tracker_timeoutint5
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    tracker_maximum_response_lengthint1024*1024
    │ │ │ │ +

    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).

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    piece_timeoutint20
    │ │ │ │ +

    the number of seconds from a request is sent until it times out if │ │ │ │ +no piece response is returned.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    request_timeoutint60
    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    request_queue_timeint3
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_allowed_in_request_queueint2000
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_out_request_queueint500
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    whole_pieces_thresholdint20
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    peer_timeoutint120
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    urlseed_timeoutint20
    │ │ │ │ +

    same as peer_timeout, but only applies to url-seeds. this is │ │ │ │ +usually set lower, because web servers are expected to be more │ │ │ │ +reliable.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    urlseed_pipeline_sizeint5
    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    urlseed_wait_retryint30
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    file_pool_sizeint40
    │ │ │ │ +

    sets the upper limit on the total number of files this session 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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_failcountint3
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    min_reconnect_timeint60
    │ │ │ │ +

    the number of seconds to wait to reconnect to a peer. this time is │ │ │ │ +multiplied with the failcount.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    peer_connect_timeoutint15
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    connection_speedint30
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    inactivity_timeoutint600
    │ │ │ │ +

    if a peer is uninteresting and uninterested for longer than this │ │ │ │ +number of seconds, it will be disconnected.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    unchoke_intervalint15
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    optimistic_unchoke_intervalint30
    │ │ │ │ +

    optimistic_unchoke_interval is the number of seconds between │ │ │ │ +each optimistic unchoke. On this timer, the currently │ │ │ │ +optimistically unchoked peer will change.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    num_wantint200
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    initial_picker_thresholdint4
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    allowed_fast_set_sizeint5
    │ │ │ │ +

    the number of allowed pieces to send to peers that supports the │ │ │ │ +fast extensions

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    suggest_modeintsettings_pack::no_piece_suggestions
    │ │ │ │ +

    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.
    • │ │ │ │ +
    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_queued_disk_bytesint1024 * 1024
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    handshake_timeoutint10
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    send_buffer_low_watermarkint10 * 1024
    send_buffer_watermarkint500 * 1024
    send_buffer_watermark_factorint50
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    choking_algorithmintsettings_pack::fixed_slots_choker
    seed_choking_algorithmintsettings_pack::round_robin
    │ │ │ │ +

    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 │ │ │ │ +choking_algorithm_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 seed_choking_algorithm_t enum.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    disk_io_write_modeintDISK_WRITE_MODE
    disk_io_read_modeintsettings_pack::enable_os_cache
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    outgoing_portint0
    num_outgoing_portsint0
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    peer_dscpint0x04
    │ │ │ │ +

    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 RFC 8622.

    │ │ │ │ +

    peer_tos is the backwards compatible name for this setting.

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    active_downloadsint3
    active_seedsint5
    active_checkingint1
    active_dht_limitint88
    active_tracker_limitint1600
    active_lsd_limitint60
    active_limitint500
    │ │ │ │ +

    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 active, 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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    auto_manage_intervalint30
    │ │ │ │ +

    auto_manage_interval is the number of seconds between the │ │ │ │ +torrent queue is updated, and rotated.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    seed_time_limitint24 * 60 * 60
    │ │ │ │ +

    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 queuing.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    auto_scrape_intervalint1800
    auto_scrape_min_intervalint300
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_peerlist_sizeint3000
    max_paused_peerlist_sizeint1000
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    min_announce_intervalint5 * 60
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    auto_manage_startupint60
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    seeding_piece_quotaint20
    │ │ │ │ +

    seeding_piece_quota is the number of pieces to send to a peer, │ │ │ │ +when seeding, before rotating in another peer to the unchoke set.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_rejectsint50
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    recv_socket_buffer_sizeint0
    send_socket_buffer_sizeint0
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_peer_recv_buffer_sizeint2 * 1024 * 1024
    │ │ │ │ +

    the max number of bytes a single peer connection's receive buffer is │ │ │ │ +allowed to grow to.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    optimistic_disk_retryint10 * 60
    │ │ │ │ +

    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().

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_suggest_piecesint16
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    local_service_announce_intervalint5 * 60
    │ │ │ │ +

    local_service_announce_interval is the time between local │ │ │ │ +network announces for a torrent. │ │ │ │ +This interval is specified in seconds.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_announce_intervalint15 * 60
    │ │ │ │ +

    dht_announce_interval is the number of seconds between │ │ │ │ +announcing torrents to the distributed hash table (DHT).

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    udp_tracker_token_expiryint60
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    num_optimistic_unchoke_slotsint0
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_pex_peersint50
    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    tick_intervalint500
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    share_mode_targetint3
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    upload_rate_limitint0
    download_rate_limitint0
    │ │ │ │ +

    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 peer classes.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_upload_rate_limitint8000
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    unchoke_slots_limitint8
    │ │ │ │ +

    unchoke_slots_limit is the max number of unchoked peers in the │ │ │ │ +session. 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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    connections_limitint200
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    connections_slackint10
    │ │ │ │ +

    connections_slack is the number of incoming connections │ │ │ │ +exceeding the connection limit to accept in order to potentially │ │ │ │ +replace existing ones.

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    utp_target_delayint100
    utp_gain_factorint3000
    utp_min_timeoutint500
    utp_syn_resendsint2
    utp_fin_resendsint2
    utp_num_resendsint3
    utp_connect_timeoutint3000
    utp_loss_multiplierint50
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    mixed_mode_algorithmintsettings_pack::peer_proportional
    │ │ │ │ +

    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).

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    listen_queue_sizeint5
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    torrent_connect_boostint30
    │ │ │ │ +

    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 session tick to trigger connections. │ │ │ │ +This may not be set higher than 255.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    alert_queue_sizeint2000
    │ │ │ │ +

    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 alert 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().

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_metadata_sizeint3 * 1024 * 10240
    │ │ │ │ +

    max_metadata_size is the maximum allowed size (in bytes) to be │ │ │ │ +received by the metadata extension, i.e. magnet links.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    hashing_threadsint1
    │ │ │ │ +

    hashing_threads is the number of disk I/O threads to use for │ │ │ │ +piece hash verification. These threads are in addition to the │ │ │ │ +regular disk I/O threads specified by settings_pack::aio_threads. │ │ │ │ +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 hasher 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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    checking_mem_usageint256
    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    predictive_piece_announceint0
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    aio_threadsint10
    │ │ │ │ +

    for some aio back-ends, aio_threads specifies the number of │ │ │ │ +io-threads to use.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    tracker_backoffint250
    │ │ │ │ +

    tracker_backoff determines how aggressively to back off from │ │ │ │ +retrying failing trackers. This value determines x 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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    share_ratio_limitint200
    seed_time_ratio_limitint700
    │ │ │ │ +

    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 queuing.

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    peer_turnoverint4
    peer_turnover_cutoffint90
    peer_turnover_intervalint300
    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    connect_seed_every_n_downloadint10
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_http_recv_buffer_sizeint4*1024*204
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_retry_port_bindint10
    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    alert_maskintint
    │ │ │ │ +

    a bitmask combining flags from alert_category_t defining which │ │ │ │ +kinds of alerts to receive

    │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    out_enc_policyintsettings_pack::pe_enabled
    in_enc_policyintsettings_pack::pe_enabled
    │ │ │ │ +

    control the settings for incoming and outgoing connections │ │ │ │ +respectively. see enc_policy 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. │ │ │ │ +
    3. The encryption itself requires more CPU than plain bittorrent │ │ │ │ +protocol. The highest cost is the Diffie Hellman exchange on │ │ │ │ +connection setup.
    4. │ │ │ │ +
    5. The encryption handshake adds several round-trips to the │ │ │ │ +connection setup, and delays transferring data.
    6. │ │ │ │ +
    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    allowed_enc_levelintsettings_pack::pe_both
    │ │ │ │ +

    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 │ │ │ │ +enc_level enum for options.

    │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    inactive_down_rateint2048
    inactive_up_rateint2048
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    proxy_typeintsettings_pack::none
    │ │ │ │ +

    proxy to use. see proxy_type_t.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    proxy_portint0
    │ │ │ │ +

    the port of the proxy server

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    i2p_portint0
    │ │ │ │ +

    sets the i2p SAM bridge port to connect to. set the hostname with │ │ │ │ +the i2p_hostname setting.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    urlseed_max_request_bytesint16 * 1024 * 1024
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    web_seed_name_lookup_retryint1800
    │ │ │ │ +

    time to wait until a new retry of a web seed name lookup

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    close_file_intervalintCLOSE_FILE_INTERVAL
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    utp_cwnd_reduce_timerint100
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_web_seed_connectionsint3
    │ │ │ │ +

    the max number of web seeds to have connected per torrent at any │ │ │ │ +given time.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    resolver_cache_timeoutint1200
    │ │ │ │ +

    the number of seconds before the internal host name resolver │ │ │ │ +considers a cache value timed out, negative values are interpreted │ │ │ │ +as zero.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    send_not_sent_low_watermarkint16384
    │ │ │ │ +

    specify the not-sent low watermark for socket send buffers. This │ │ │ │ +corresponds to the, Linux-specific, TCP_NOTSENT_LOWAT TCP socket │ │ │ │ +option.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    rate_choker_initial_thresholdint1024
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    upnp_lease_durationint3600
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_concurrent_http_announcesint50
    │ │ │ │ +

    limits the number of concurrent HTTP tracker announces. Once the │ │ │ │ +limit is hit, tracker requests are queued and issued when an │ │ │ │ +outstanding announce completes.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_max_peers_replyint100
    │ │ │ │ +

    the maximum number of peers to send in a reply to get_peers

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_search_branchingint5
    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_max_fail_countint20
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_max_torrentsint2000
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_max_dht_itemsint700
    │ │ │ │ +

    max number of items the DHT will store

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_max_peersint500
    │ │ │ │ +

    the max number of peers to store per torrent (for the DHT)

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_max_torrent_search_replyint20
    │ │ │ │ +

    the max number of torrents to return in a torrent search query to the │ │ │ │ +DHT

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_block_timeoutint5 * 60
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_block_ratelimitint5
    │ │ │ │ +

    the max number of packets per second a DHT node is allowed to send │ │ │ │ +without getting banned.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_item_lifetimeint0
    │ │ │ │ +

    the number of seconds a immutable/mutable item will be expired. │ │ │ │ +default is 0, means never expires.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_sample_infohashes_intervalint21600
    │ │ │ │ +

    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).

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    dht_max_infohashes_sample_countint20
    │ │ │ │ +

    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

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    max_piece_countint0x200000
    │ │ │ │ +

    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 read_resume_data() and │ │ │ │ +torrent_info::parse_info_section(), if those are used.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    metadata_token_limitint2500000
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    disk_write_modeintsettings_pack::mmap_write_mode_t::auto_mmap_write
    │ │ │ │ +

    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 mmap_write_mode_t.

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    mmap_file_size_cutoffint40
    │ │ │ │ +

    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.

    │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    i2p_inbound_quantityint3
    i2p_outbound_quantityint3
    i2p_inbound_lengthint3
    i2p_outbound_lengthint3
    │ │ │ │ +

    Configures the SAM session │ │ │ │ +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).

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    nametypedefault
    announce_portint0
    │ │ │ │ +

    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.

    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    entry

    │ │ │ │ -

    Declared in "libtorrent/entry.hpp"

    │ │ │ │ -

    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 type () const;
    │ │ │ │ -   entry (preformatted_type);
    │ │ │ │ -   entry (integer_type);
    │ │ │ │ -   entry (dictionary_type);
    │ │ │ │ -   entry (span<char const>);
    │ │ │ │ -   entry (list_type);
    │ │ │ │ -   entry (U v);
    │ │ │ │ -   entry (data_type t);
    │ │ │ │ -   entry (bdecode_node const& n);
    │ │ │ │ -   entry& operator= (preformatted_type) &;
    │ │ │ │ -   entry& operator= (bdecode_node const&) &;
    │ │ │ │ -   entry& operator= (entry const&) &;
    │ │ │ │ -   entry& operator= (integer_type) &;
    │ │ │ │ -   entry& operator= (span<char const>) &;
    │ │ │ │ -   entry& operator= (entry&&) & noexcept;
    │ │ │ │ -   entry& operator= (dictionary_type) &;
    │ │ │ │ -   entry& operator= (list_type) &;
    │ │ │ │ -   entry& operator= (U v) &;
    │ │ │ │ -   integer_type& integer ();
    │ │ │ │ -   string_type const& string () const;
    │ │ │ │ -   preformatted_type const& preformatted () const;
    │ │ │ │ -   list_type& list ();
    │ │ │ │ -   string_type& string ();
    │ │ │ │ -   preformatted_type& preformatted ();
    │ │ │ │ -   integer_type const& integer () const;
    │ │ │ │ -   dictionary_type& dict ();
    │ │ │ │ -   dictionary_type const& dict () const;
    │ │ │ │ -   list_type const& list () const;
    │ │ │ │ -   void swap (entry& e);
    │ │ │ │ -   entry& operator[] (string_view key);
    │ │ │ │ -   entry const& operator[] (string_view key) const;
    │ │ │ │ -   entry* find_key (string_view key);
    │ │ │ │ -   entry const* find_key (string_view key) const;
    │ │ │ │ -   std::string to_string (bool single_line = false) const;
    │ │ │ │ -
    │ │ │ │ -   enum data_type
    │ │ │ │ -   {
    │ │ │ │ -      int_t,
    │ │ │ │ -      string_t,
    │ │ │ │ -      list_t,
    │ │ │ │ -      dictionary_t,
    │ │ │ │ -      undefined_t,
    │ │ │ │ -      preformatted_t,
    │ │ │ │ -   };
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    type()

    │ │ │ │ -
    │ │ │ │ -data_type type () const;
    │ │ │ │ -
    │ │ │ │ -

    returns the concrete type of the entry

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    entry()

    │ │ │ │ -
    │ │ │ │ -entry (preformatted_type);
    │ │ │ │ -entry (integer_type);
    │ │ │ │ -entry (dictionary_type);
    │ │ │ │ -entry (span<char const>);
    │ │ │ │ -entry (list_type);
    │ │ │ │ -
    │ │ │ │ -

    constructors directly from a specific type. │ │ │ │ -The content of the argument is copied into the │ │ │ │ -newly constructed entry

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    entry()

    │ │ │ │ -
    │ │ │ │ -entry (data_type t);
    │ │ │ │ -
    │ │ │ │ -

    construct an empty entry of the specified type. │ │ │ │ -see data_type enum.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    entry()

    │ │ │ │ -
    │ │ │ │ -entry (bdecode_node const& n);
    │ │ │ │ -
    │ │ │ │ -

    construct from bdecode_node parsed form (see bdecode())

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    operator=()

    │ │ │ │
    │ │ │ │ -entry& operator= (preformatted_type) &;
    │ │ │ │ -entry& operator= (bdecode_node const&) &;
    │ │ │ │ -entry& operator= (entry const&) &;
    │ │ │ │ -entry& operator= (integer_type) &;
    │ │ │ │ -entry& operator= (span<char const>) &;
    │ │ │ │ -entry& operator= (entry&&) & noexcept;
    │ │ │ │ -entry& operator= (dictionary_type) &;
    │ │ │ │ -entry& operator= (list_type) &;
    │ │ │ │ +struct settings_pack final : settings_interface
    │ │ │ │ +{
    │ │ │ │ +   friend  void apply_pack_impl (settings_pack const*
    │ │ │ │ +      , aux::session_settings_single_thread&
    │ │ │ │ +      , std::vector<void(aux::session_impl::*)()>*);
    │ │ │ │ +   void set_str (int name, std::string val) override;
    │ │ │ │ +   void set_int (int name, int val) override;
    │ │ │ │ +   void set_int (int name, flags::bitfield_flag<Type, Tag> const val);
    │ │ │ │ +   void set_bool (int name, bool val) override;
    │ │ │ │ +   bool has_val (int name) const override;
    │ │ │ │ +   void clear ();
    │ │ │ │ +   void clear (int name);
    │ │ │ │ +   int get_int (int name) const override;
    │ │ │ │ +   std::string const& get_str (int name) const override;
    │ │ │ │ +   bool get_bool (int name) const override;
    │ │ │ │ +   void for_each (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,
    │ │ │ │ +   };
    │ │ │ │ +};
    │ │ │ │  
    │ │ │ │ -

    copies the structure of the right hand side into this │ │ │ │ -entry.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    list() preformatted() dict() integer() string()

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +

    set_int() set_str() set_bool()

    │ │ │ │
    │ │ │ │ -integer_type& integer ();
    │ │ │ │ -string_type const& string () const;
    │ │ │ │ -preformatted_type const& preformatted () const;
    │ │ │ │ -list_type& list ();
    │ │ │ │ -string_type& string ();
    │ │ │ │ -preformatted_type& preformatted ();
    │ │ │ │ -integer_type const& integer () const;
    │ │ │ │ -dictionary_type& dict ();
    │ │ │ │ -dictionary_type const& dict () const;
    │ │ │ │ -list_type const& list () 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";
    │ │ │ │ -}
    │ │ │ │ +void set_str (int name, std::string val) override;
    │ │ │ │ +void set_int (int name, int val) override;
    │ │ │ │ +void set_int (int name, flags::bitfield_flag<Type, Tag> const val);
    │ │ │ │ +void set_bool (int name, bool val) override;
    │ │ │ │  
    │ │ │ │ -

    To make it easier to extract information from a torrent file, the │ │ │ │ -class torrent_info exists.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    swap()

    │ │ │ │ +

    set a configuration option in the settings_pack. 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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    has_val()

    │ │ │ │
    │ │ │ │ -void swap (entry& e);
    │ │ │ │ +bool has_val (int name) const override;
    │ │ │ │  
    │ │ │ │ -

    swaps the content of this with e.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    operator[]()

    │ │ │ │ +

    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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    clear()

    │ │ │ │
    │ │ │ │ -entry& operator[] (string_view key);
    │ │ │ │ -entry const& operator[] (string_view key) const;
    │ │ │ │ +void clear ();
    │ │ │ │  
    │ │ │ │ -

    All of these functions requires the entry 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    find_key()

    │ │ │ │ +

    clear the settings pack from all settings

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    clear()

    │ │ │ │
    │ │ │ │ -entry* find_key (string_view key);
    │ │ │ │ -entry const* find_key (string_view key) const;
    │ │ │ │ +void clear (int name);
    │ │ │ │  
    │ │ │ │ -

    These functions requires the entry 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    to_string()

    │ │ │ │ +

    clear a specific setting from the pack

    │ │ │ │ + │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    get_bool() get_str() get_int()

    │ │ │ │
    │ │ │ │ -std::string to_string (bool single_line = false) const;
    │ │ │ │ +int get_int (int name) const override;
    │ │ │ │ +std::string const& get_str (int name) const override;
    │ │ │ │ +bool get_bool (int name) const override;
    │ │ │ │  
    │ │ │ │ -

    returns a pretty-printed string representation │ │ │ │ -of the bencoded structure, with JSON-style syntax

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum data_type

    │ │ │ │ -

    Declared in "libtorrent/entry.hpp"

    │ │ │ │ +

    queries the current configuration option from the settings_pack. │ │ │ │ +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.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum type_bases

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    string_type_base0 
    int_type_base16384 
    bool_type_base32768 
    type_mask49152 
    index_mask16383 
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum mmap_write_mode_t

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    always_pwrite0disable writing to disk via mmap, always use normal write calls
    always_mmap_write1prefer using memory mapped files for disk writes (at least for │ │ │ │ +large files where it might make sense)
    auto_mmap_write2determine whether to use pwrite or memory mapped files for disk │ │ │ │ +writes depending on the kind of storage behind the save path
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum suggest_mode_t

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    no_piece_suggestions0 
    suggest_read_cache1 
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum choking_algorithm_t

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    fixed_slots_choker0This is the traditional choker with a fixed number of unchoke │ │ │ │ +slots (as specified by settings_pack::unchoke_slots_limit).
    rate_based_choker2

    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 settings_pack::rate_choker_initial_threshold.

    │ │ │ │ +

    For more information, see rate based choking.

    │ │ │ │ +
    deprecated_bittyrant_choker3 
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum seed_choking_algorithm_t

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    round_robin0which 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.
    fastest_upload1unchokes the peers we can send to the fastest. This might be a │ │ │ │ +bit more reliable in utilizing all available capacity.
    anti_leech2prioritizes 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.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum io_buffer_mode_t

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ -│ │ │ │ +│ │ │ │ +│ │ │ │ │ │ │ │ -│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ +
    namevaluedescription
    int_t
    enable_os_cache0 
    string_t
    deprecated_disable_os_cache_for_aligned_files1 
    list_t
    disable_os_cache2 
    dictionary_t
    write_through3 
    undefined_t
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum bandwidth_mixed_algo_t

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    prefer_tcp0disables the mixed mode bandwidth balancing
    peer_proportional1does not throttle uTP, throttles TCP to the same proportion │ │ │ │ +of throughput as there are TCP connections
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum enc_policy

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    pe_forced0Only 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.
    pe_enabled1encrypted 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.
    pe_disabled2only non-encrypted connections are allowed.
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum enc_level

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    namevaluedescription
    pe_plaintext1use only plain text encryption
    pe_rc42use only RC4 encryption
    pe_both3allow both
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    enum proxy_type_t

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │
    namevaluedescription
    none0No proxy server is used and all other fields are ignored.
    socks41The server is assumed to be a SOCKS4 server that requires a │ │ │ │ +username.
    socks52The server is assumed to be a SOCKS5 server (RFC 1928) that does │ │ │ │ +not require any authentication. The username and password are │ │ │ │ +ignored.
    socks5_pw3The server is assumed to be a SOCKS5 server that supports plain │ │ │ │ +text username and password authentication (RFC 1929). The │ │ │ │ +username and password specified may be sent to the proxy if it │ │ │ │ +requires.
    http4 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 CONNECT 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.
    preformatted_t
    http_pw5 The server is assumed to be an HTTP proxy that requires user │ │ │ │ +authorization. The username and password will be sent to the proxy.
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    operator<<()

    │ │ │ │ -

    Declared in "libtorrent/entry.hpp"

    │ │ │ │ -
    │ │ │ │ -inline std::ostream& operator<< (std::ostream& os, const entry& e);
    │ │ │ │ -
    │ │ │ │ -

    prints the bencoded structure to the ostream as a JSON-style structure.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    bencode()

    │ │ │ │ -

    Declared in "libtorrent/bencode.hpp"

    │ │ │ │ -
    │ │ │ │ -template<class OutIt> int bencode (OutIt out, const entry& e);
    │ │ │ │ -
    │ │ │ │ -

    This function will encode data to bencoded form.

    │ │ │ │ -

    The entry class is the internal representation of the bencoded data │ │ │ │ -and it can be used to retrieve information, an entry can also be build by │ │ │ │ -the program and given to bencode() to encode it into the OutIt │ │ │ │ -iterator.

    │ │ │ │ -

    OutIt is an OutputIterator. It's a template and usually │ │ │ │ -instantiated as ostream_iterator or back_insert_iterator. This │ │ │ │ -function assumes the value_type of the iterator is a char. │ │ │ │ -In order to encode entry e into a buffer, do:

    │ │ │ │ -
    │ │ │ │ -std::vector<char> buf;
    │ │ │ │ -bencode(std::back_inserter(buf), e);
    │ │ │ │ -
    │ │ │ │ -

    libtorrent has a plugin 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 plugin interface makes it possible to:

    │ │ │ │ -
      │ │ │ │ -
    • register extension messages (sent in the extension handshake), see │ │ │ │ -extensions.
    • │ │ │ │ -
    • 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 session state
    • │ │ │ │ -
    • see all alerts that are posted
    • │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    a word of caution

    │ │ │ │ -

    Writing your own plugin is a very easy way to introduce serious bugs such as │ │ │ │ -dead locks and race conditions. Since a plugin 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 plugin 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 plugin, 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 plugin 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.

    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    plugin-interface

    │ │ │ │ -

    The plugin interface consists of three base classes that the plugin may │ │ │ │ -implement. These are called plugin, torrent_plugin and peer_plugin. │ │ │ │ -They are found in the <libtorrent/extensions.hpp> header.

    │ │ │ │ -

    These plugins are instantiated for each session, 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 session wide state, you would │ │ │ │ -implement plugin, construct an object (in a std::shared_ptr) and pass │ │ │ │ -it in to session::add_extension().

    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    custom alerts

    │ │ │ │ -

    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 alert, apart from deriving from the alert │ │ │ │ -base class, looks like this:

    │ │ │ │ -
    │ │ │ │ -static const int alert_type = <unique alert ID>;
    │ │ │ │ -virtual int type() const { return alert_type; }
    │ │ │ │ -
    │ │ │ │ -virtual std::string message() const;
    │ │ │ │ -
    │ │ │ │ -static const alert_category_t static_category = <bitmask of alert::category_t flags>;
    │ │ │ │ -virtual alert_category_t category() const { return static_category; }
    │ │ │ │ -
    │ │ │ │ -virtual char const* what() const { return <string literal of the name of this alert>; }
    │ │ │ │ -
    │ │ │ │ -

    The alert_type is used for the type-checking in alert_cast. It must │ │ │ │ -not collide with any other alert. The built-in alerts in libtorrent will │ │ │ │ -not use alert type IDs greater than user_alert_id. When defining your │ │ │ │ -own alert, 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 alert 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 alert is enabled or not, without instantiating the alert. │ │ │ │ -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 alert.

    │ │ │ │ -

    For more information, see the alert section.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    plugin

    │ │ │ │ -

    Declared in "libtorrent/extensions.hpp"

    │ │ │ │ -

    this is the base class for a session plugin. One primary feature │ │ │ │ -is that it is notified of all torrents that are added to the session, │ │ │ │ -and can add its own torrent_plugins.

    │ │ │ │ -
    │ │ │ │ -struct plugin
    │ │ │ │ -{
    │ │ │ │ -   virtual feature_flags_t implemented_features ();
    │ │ │ │ -   virtual std::shared_ptr<torrent_plugin> new_torrent (torrent_handle const&, client_data_t);
    │ │ │ │ -   virtual void added (session_handle const&);
    │ │ │ │ -   virtual void abort ();
    │ │ │ │ -   virtual bool on_dht_request (string_view /* query */
    │ │ │ │ -      , udp::endpoint const& /* source */, bdecode_node const& /* message */
    │ │ │ │ -      , entry& /* response */);
    │ │ │ │ -   virtual void on_alert (alert const*);
    │ │ │ │ -   virtual bool on_unknown_torrent (info_hash_t const& /* info_hash */
    │ │ │ │ -      , peer_connection_handle const& /* pc */, add_torrent_params& /* p */);
    │ │ │ │ -   virtual void on_tick ();
    │ │ │ │ -   virtual uint64_t get_unchoke_priority (peer_connection_handle const& /* peer */);
    │ │ │ │ -   virtual std::map<std::string, std::string> save_state () const;
    │ │ │ │ -   virtual void load_state (std::map<std::string, std::string> const&);
    │ │ │ │ -
    │ │ │ │ -   static constexpr feature_flags_t optimistic_unchoke_feature  = 1_bit;
    │ │ │ │ -   static constexpr feature_flags_t tick_feature  = 2_bit;
    │ │ │ │ -   static constexpr feature_flags_t dht_request_feature  = 3_bit;
    │ │ │ │ -   static constexpr feature_flags_t alert_feature  = 4_bit;
    │ │ │ │ -   static constexpr feature_flags_t unknown_torrent_feature  = 5_bit;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    implemented_features()

    │ │ │ │ -
    │ │ │ │ -virtual feature_flags_t implemented_features ();
    │ │ │ │ -
    │ │ │ │ -

    This function is expected to return a bitmask indicating which features │ │ │ │ -this plugin 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    new_torrent()

    │ │ │ │ -
    │ │ │ │ -virtual std::shared_ptr<torrent_plugin> new_torrent (torrent_handle const&, client_data_t);
    │ │ │ │ -
    │ │ │ │ -

    this is called by the session every time a new torrent is added. │ │ │ │ -The torrent* points to the internal torrent object created │ │ │ │ -for the new torrent. The client_data_t is the userdata pointer as │ │ │ │ -passed in via add_torrent_params.

    │ │ │ │ -

    If the plugin returns a torrent_plugin instance, it will be added │ │ │ │ -to the new torrent. Otherwise, return an empty shared_ptr to a │ │ │ │ -torrent_plugin (the default).

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    added()

    │ │ │ │ -
    │ │ │ │ -virtual void added (session_handle const&);
    │ │ │ │ -
    │ │ │ │ -

    called when plugin is added to a session

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    abort()

    │ │ │ │ -
    │ │ │ │ -virtual void abort ();
    │ │ │ │ -
    │ │ │ │ -

    called when the session is aborted │ │ │ │ -the plugin should perform any cleanup necessary to allow the session's │ │ │ │ -destruction (e.g. cancel outstanding async operations)

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_dht_request()

    │ │ │ │ -
    │ │ │ │ -virtual bool on_dht_request (string_view /* query */
    │ │ │ │ -      , udp::endpoint const& /* source */, bdecode_node const& /* message */
    │ │ │ │ -      , entry& /* response */);
    │ │ │ │ -
    │ │ │ │ -

    called when a dht request is received. │ │ │ │ -If your plugin expects this to be called, make sure to include the flag │ │ │ │ -dht_request_feature in the return value from implemented_features().

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_alert()

    │ │ │ │ -
    │ │ │ │ -virtual void on_alert (alert const*);
    │ │ │ │ -
    │ │ │ │ -

    called when an alert is posted alerts that are filtered are not posted. │ │ │ │ -If your plugin expects this to be called, make sure to include the flag │ │ │ │ -alert_feature in the return value from implemented_features().

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_unknown_torrent()

    │ │ │ │ -
    │ │ │ │ -virtual bool on_unknown_torrent (info_hash_t const& /* info_hash */
    │ │ │ │ -      , peer_connection_handle const& /* pc */, add_torrent_params& /* p */);
    │ │ │ │ -
    │ │ │ │ -

    return true if the add_torrent_params should be added

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_tick()

    │ │ │ │ -
    │ │ │ │ -virtual void on_tick ();
    │ │ │ │ -
    │ │ │ │ -

    called once per second. │ │ │ │ -If your plugin expects this to be called, make sure to include the flag │ │ │ │ -tick_feature in the return value from implemented_features().

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    get_unchoke_priority()

    │ │ │ │ -
    │ │ │ │ -virtual uint64_t get_unchoke_priority (peer_connection_handle const& /* peer */);
    │ │ │ │ -
    │ │ │ │ -

    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 plugin has no priority to assign a peer it should return 2^64-1. │ │ │ │ -If your plugin expects this to be called, make sure to include the flag │ │ │ │ -optimistic_unchoke_feature in the return value from implemented_features(). │ │ │ │ -If multiple plugins implement this function the lowest return value │ │ │ │ -(i.e. the highest priority) is used.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    load_state()

    │ │ │ │ -
    │ │ │ │ -virtual void load_state (std::map<std::string, std::string> const&);
    │ │ │ │ -
    │ │ │ │ -

    called on startup while loading settings state from the session_params

    │ │ │ │ -[report issue]
    │ │ │ │ -
    optimistic_unchoke_feature
    │ │ │ │ -
    include this bit if your plugin needs to alter the order of the │ │ │ │ -optimistic unchoke of peers. i.e. have the on_optimistic_unchoke() │ │ │ │ -callback be called.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    tick_feature
    │ │ │ │ -
    include this bit if your plugin needs to have on_tick() called
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    dht_request_feature
    │ │ │ │ -
    include this bit if your plugin needs to have on_dht_request() │ │ │ │ -called
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    alert_feature
    │ │ │ │ -
    include this bit if your plugin needs to have on_alert() │ │ │ │ -called
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    unknown_torrent_feature
    │ │ │ │ -
    include this bit if your plugin needs to have on_unknown_torrent() │ │ │ │ -called even if there is no active torrent in the session
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    torrent_plugin

    │ │ │ │ -

    Declared in "libtorrent/extensions.hpp"

    │ │ │ │ -

    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> new_connection (peer_connection_handle const&);
    │ │ │ │ -   virtual void on_piece_pass (piece_index_t);
    │ │ │ │ -   virtual void on_piece_failed (piece_index_t);
    │ │ │ │ -   virtual void tick ();
    │ │ │ │ -   virtual bool on_pause ();
    │ │ │ │ -   virtual bool on_resume ();
    │ │ │ │ -   virtual void on_files_checked ();
    │ │ │ │ -   virtual void on_state (torrent_status::state_t);
    │ │ │ │ -   virtual void on_add_peer (tcp::endpoint const&,
    │ │ │ │ -      peer_source_flags_t, add_peer_flags_t);
    │ │ │ │ -
    │ │ │ │ -   static constexpr add_peer_flags_t first_time  = 1_bit;
    │ │ │ │ -   static constexpr add_peer_flags_t filtered  = 2_bit;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    new_connection()

    │ │ │ │ -
    │ │ │ │ -virtual std::shared_ptr<peer_plugin> new_connection (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 peer_plugin 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 peer_plugin. If you want to keep references │ │ │ │ -to it, use weak_ptr.

    │ │ │ │ -

    If this function throws an exception, the connection will be closed.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_piece_pass() on_piece_failed()

    │ │ │ │ -
    │ │ │ │ -virtual void on_piece_pass (piece_index_t);
    │ │ │ │ -virtual void on_piece_failed (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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    tick()

    │ │ │ │ -
    │ │ │ │ -virtual void tick ();
    │ │ │ │ -
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_resume() on_pause()

    │ │ │ │ -
    │ │ │ │ -virtual bool on_pause ();
    │ │ │ │ -virtual bool on_resume ();
    │ │ │ │ -
    │ │ │ │ -

    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 plugin 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_files_checked()

    │ │ │ │ -
    │ │ │ │ -virtual void on_files_checked ();
    │ │ │ │ -
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_state()

    │ │ │ │ -
    │ │ │ │ -virtual void on_state (torrent_status::state_t);
    │ │ │ │ -
    │ │ │ │ -

    called when the torrent changes state │ │ │ │ -the state is one of torrent_status::state_t │ │ │ │ -enum members

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_add_peer()

    │ │ │ │ -
    │ │ │ │ -virtual void on_add_peer (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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    first_time
    │ │ │ │ -
    this is the first time we see this peer
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    filtered
    │ │ │ │ -
    this peer was not added because it was │ │ │ │ -filtered by the IP filter
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    peer_plugin

    │ │ │ │ -

    Declared in "libtorrent/extensions.hpp"

    │ │ │ │ -

    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 plugin for certain peer │ │ │ │ -connection types

    │ │ │ │ -
    │ │ │ │ -struct peer_plugin
    │ │ │ │ -{
    │ │ │ │ -   virtual string_view type () const;
    │ │ │ │ -   virtual void add_handshake (entry&);
    │ │ │ │ -   virtual void on_disconnect (error_code const&);
    │ │ │ │ -   virtual void on_connected ();
    │ │ │ │ -   virtual bool on_handshake (span<char const>);
    │ │ │ │ -   virtual bool on_extension_handshake (bdecode_node const&);
    │ │ │ │ -   virtual bool on_bitfield (bitfield const& /*bitfield*/);
    │ │ │ │ -   virtual bool on_have_none ();
    │ │ │ │ -   virtual bool on_allowed_fast (piece_index_t);
    │ │ │ │ -   virtual bool on_request (peer_request const&);
    │ │ │ │ -   virtual bool on_unchoke ();
    │ │ │ │ -   virtual bool on_have (piece_index_t);
    │ │ │ │ -   virtual bool on_not_interested ();
    │ │ │ │ -   virtual bool on_have_all ();
    │ │ │ │ -   virtual bool on_choke ();
    │ │ │ │ -   virtual bool on_dont_have (piece_index_t);
    │ │ │ │ -   virtual bool on_interested ();
    │ │ │ │ -   virtual bool on_piece (peer_request const& /*piece*/
    │ │ │ │ -      , span<char const> /*buf*/);
    │ │ │ │ -   virtual bool on_suggest (piece_index_t);
    │ │ │ │ -   virtual bool on_cancel (peer_request const&);
    │ │ │ │ -   virtual bool on_reject (peer_request const&);
    │ │ │ │ -   virtual void sent_request (peer_request const&);
    │ │ │ │ -   virtual void sent_suggest (piece_index_t);
    │ │ │ │ -   virtual void sent_cancel (peer_request const&);
    │ │ │ │ -   virtual void sent_have_all ();
    │ │ │ │ -   virtual void sent_choke ();
    │ │ │ │ -   virtual void sent_have_none ();
    │ │ │ │ -   virtual void sent_allow_fast (piece_index_t);
    │ │ │ │ -   virtual void sent_reject_request (peer_request const&);
    │ │ │ │ -   virtual void sent_unchoke ();
    │ │ │ │ -   virtual void sent_have (piece_index_t);
    │ │ │ │ -   virtual void sent_not_interested ();
    │ │ │ │ -   virtual void sent_interested ();
    │ │ │ │ -   virtual void sent_piece (peer_request const&);
    │ │ │ │ -   virtual void sent_payload (int /* bytes */);
    │ │ │ │ -   virtual bool can_disconnect (error_code const& /*ec*/);
    │ │ │ │ -   virtual bool on_extended (int /*length*/, int /*msg*/,
    │ │ │ │ -      span<char const> /*body*/);
    │ │ │ │ -   virtual bool on_unknown_message (int /*length*/, int /*msg*/,
    │ │ │ │ -      span<char const> /*body*/);
    │ │ │ │ -   virtual void on_piece_pass (piece_index_t);
    │ │ │ │ -   virtual void on_piece_failed (piece_index_t);
    │ │ │ │ -   virtual void tick ();
    │ │ │ │ -   virtual bool write_request (peer_request const&);
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    type()

    │ │ │ │ -
    │ │ │ │ -virtual string_view type () const;
    │ │ │ │ -
    │ │ │ │ -

    This function is expected to return the name of │ │ │ │ -the plugin.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_handshake()

    │ │ │ │ -
    │ │ │ │ -virtual void add_handshake (entry&);
    │ │ │ │ -
    │ │ │ │ -

    can add entries to the extension handshake │ │ │ │ -this is not called for web seeds

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_disconnect()

    │ │ │ │ -
    │ │ │ │ -virtual void on_disconnect (error_code const&);
    │ │ │ │ -
    │ │ │ │ -

    called when the peer is being disconnected.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_connected()

    │ │ │ │ -
    │ │ │ │ -virtual void on_connected ();
    │ │ │ │ -
    │ │ │ │ -

    called when the peer is successfully connected. Note that │ │ │ │ -incoming connections will have been connected by the time │ │ │ │ -the peer plugin is attached to it, and won't have this hook │ │ │ │ -called.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_handshake()

    │ │ │ │ -
    │ │ │ │ -virtual bool on_handshake (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

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_extension_handshake()

    │ │ │ │ -
    │ │ │ │ -virtual bool on_extension_handshake (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 peer_plugin │ │ │ │ -being removed from the peer_connection and destructed. │ │ │ │ -this is not called for web seeds

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_dont_have() on_have_all() on_have_none() on_bitfield() on_allowed_fast() on_unchoke() on_request() on_have() on_choke() on_not_interested() on_interested()

    │ │ │ │ -
    │ │ │ │ -virtual bool on_bitfield (bitfield const& /*bitfield*/);
    │ │ │ │ -virtual bool on_have_none ();
    │ │ │ │ -virtual bool on_allowed_fast (piece_index_t);
    │ │ │ │ -virtual bool on_request (peer_request const&);
    │ │ │ │ -virtual bool on_unchoke ();
    │ │ │ │ -virtual bool on_have (piece_index_t);
    │ │ │ │ -virtual bool on_not_interested ();
    │ │ │ │ -virtual bool on_have_all ();
    │ │ │ │ -virtual bool on_choke ();
    │ │ │ │ -virtual bool on_dont_have (piece_index_t);
    │ │ │ │ -virtual bool on_interested ();
    │ │ │ │ -
    │ │ │ │ -

    returning true from any of the message handlers │ │ │ │ -indicates that the plugin has handled the message. │ │ │ │ -it will break the plugin chain traversing and not let │ │ │ │ -anyone else handle the message, including the default │ │ │ │ -handler.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_piece()

    │ │ │ │ -
    │ │ │ │ -virtual bool on_piece (peer_request const& /*piece*/
    │ │ │ │ -      , span<char const> /*buf*/);
    │ │ │ │ -
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    sent_have() sent_not_interested() sent_interested() sent_unchoke() sent_piece()

    │ │ │ │ -
    │ │ │ │ -virtual void sent_unchoke ();
    │ │ │ │ -virtual void sent_have (piece_index_t);
    │ │ │ │ -virtual void sent_not_interested ();
    │ │ │ │ -virtual void sent_interested ();
    │ │ │ │ -virtual void sent_piece (peer_request const&);
    │ │ │ │ -
    │ │ │ │ -

    called after a choke message has been sent to the peer

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    sent_payload()

    │ │ │ │ -
    │ │ │ │ -virtual void sent_payload (int /* bytes */);
    │ │ │ │ -
    │ │ │ │ -

    called after piece data has been sent to the peer │ │ │ │ -this can be used for stats book keeping

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    can_disconnect()

    │ │ │ │ -
    │ │ │ │ -virtual bool can_disconnect (error_code const& /*ec*/);
    │ │ │ │ -
    │ │ │ │ -

    called when libtorrent think this peer should be disconnected. │ │ │ │ -if the plugin returns false, the peer will not be disconnected.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_extended()

    │ │ │ │ -
    │ │ │ │ -virtual bool on_extended (int /*length*/, int /*msg*/,
    │ │ │ │ -      span<char const> /*body*/);
    │ │ │ │ -
    │ │ │ │ -

    called when an extended message is received. If returning true, │ │ │ │ -the message is not processed by any other plugin and if false │ │ │ │ -is returned the next plugin 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_unknown_message()

    │ │ │ │ -
    │ │ │ │ -virtual bool on_unknown_message (int /*length*/, int /*msg*/,
    │ │ │ │ -      span<char const> /*body*/);
    │ │ │ │ -
    │ │ │ │ -

    this is not called for web seeds

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    on_piece_pass() on_piece_failed()

    │ │ │ │ -
    │ │ │ │ -virtual void on_piece_pass (piece_index_t);
    │ │ │ │ -virtual void on_piece_failed (piece_index_t);
    │ │ │ │ -
    │ │ │ │ -

    called when a piece that this peer participated in either │ │ │ │ -fails or passes the hash_check

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    tick()

    │ │ │ │ -
    │ │ │ │ -virtual void tick ();
    │ │ │ │ -
    │ │ │ │ -

    called approximately once every second

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    write_request()

    │ │ │ │ -
    │ │ │ │ -virtual bool write_request (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 plugin will have this function called.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    crypto_plugin

    │ │ │ │ -

    Declared in "libtorrent/extensions.hpp"

    │ │ │ │ -
    │ │ │ │ -struct crypto_plugin
    │ │ │ │ -{
    │ │ │ │ -   virtual void set_incoming_key (span<char const> key) = 0;
    │ │ │ │ -   virtual void set_outgoing_key (span<char const> key) = 0;
    │ │ │ │ -   encrypt (span<span<char>> /*send_vec*/) = 0;
    │ │ │ │ -   virtual std::tuple<int, int, int> decrypt (span<span<char>> /*receive_vec*/) = 0;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    decrypt()

    │ │ │ │ -
    │ │ │ │ -virtual std::tuple<int, int, int> decrypt (span<span<char>> /*receive_vec*/) = 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

    │ │ │ │ -[report issue]
    │ │ │ │ +[report issue]
    │ │ │ │
    │ │ │ │ -
    │ │ │ │ -

    peer_connection_handle

    │ │ │ │ -

    Declared in "libtorrent/peer_connection_handle.hpp"

    │ │ │ │ -

    the peer_connection_handle 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 peer_connection_handle (std::weak_ptr<peer_connection> impl);
    │ │ │ │ -   connection_type type () const;
    │ │ │ │ -   void add_extension (std::shared_ptr<peer_plugin>);
    │ │ │ │ -   peer_plugin const* find_plugin (string_view type) const;
    │ │ │ │ -   bool is_seed () const;
    │ │ │ │ -   bool upload_only () const;
    │ │ │ │ -   bool has_piece (piece_index_t i) const;
    │ │ │ │ -   peer_id const& pid () const;
    │ │ │ │ -   bool is_choked () const;
    │ │ │ │ -   bool is_interesting () const;
    │ │ │ │ -   bool has_peer_choked () const;
    │ │ │ │ -   bool is_peer_interested () const;
    │ │ │ │ -   void maybe_unchoke_this_peer ();
    │ │ │ │ -   void choke_this_peer ();
    │ │ │ │ -   void get_peer_info (peer_info& p) const;
    │ │ │ │ -   torrent_handle associated_torrent () const;
    │ │ │ │ -   tcp::endpoint local_endpoint () const;
    │ │ │ │ -   tcp::endpoint const& remote () const;
    │ │ │ │ -   bool is_outgoing () const;
    │ │ │ │ -   bool is_disconnecting () const;
    │ │ │ │ -   bool is_connecting () const;
    │ │ │ │ -   void disconnect (error_code const& ec, operation_t op
    │ │ │ │ -      , disconnect_severity_t = peer_connection_interface::normal);
    │ │ │ │ -   bool ignore_unchoke_slots () const;
    │ │ │ │ -   bool on_local_network () const;
    │ │ │ │ -   bool failed () const;
    │ │ │ │ -   bool should_log (peer_log_alert::direction_t direction) const;
    │ │ │ │ -   void peer_log (peer_log_alert::direction_t direction
    │ │ │ │ -      , char const* event, char const* fmt = "", ...) const TORRENT_FORMAT(4,5);
    │ │ │ │ -   bool can_disconnect (error_code const& ec) const;
    │ │ │ │ -   bool has_metadata () const;
    │ │ │ │ -   bool in_handshake () const;
    │ │ │ │ -   void send_buffer (char const* begin, int size);
    │ │ │ │ -   time_point time_of_last_unchoke () const;
    │ │ │ │ -   std::time_t last_seen_complete () const;
    │ │ │ │ -   bool operator== (peer_connection_handle const& o) const;
    │ │ │ │ -   bool operator< (peer_connection_handle const& o) const;
    │ │ │ │ -   bool operator!= (peer_connection_handle const& o) const;
    │ │ │ │ -   std::shared_ptr<peer_connection> native_handle () const;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    bt_peer_connection_handle

    │ │ │ │ -

    Declared in "libtorrent/peer_connection_handle.hpp"

    │ │ │ │ -

    The bt_peer_connection_handle 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.

    │ │ │ │ +
    │ │ │ │ +

    generate_fingerprint()

    │ │ │ │ +

    Declared in "libtorrent/fingerprint.hpp"

    │ │ │ │
    │ │ │ │ -struct bt_peer_connection_handle : peer_connection_handle
    │ │ │ │ -{
    │ │ │ │ -   explicit bt_peer_connection_handle (peer_connection_handle pc);
    │ │ │ │ -   bool packet_finished () const;
    │ │ │ │ -   bool support_extensions () const;
    │ │ │ │ -   bool supports_encryption () const;
    │ │ │ │ -   void switch_recv_crypto (std::shared_ptr<crypto_plugin> crypto);
    │ │ │ │ -   void switch_send_crypto (std::shared_ptr<crypto_plugin> crypto);
    │ │ │ │ -   std::shared_ptr<bt_peer_connection> native_handle () const;
    │ │ │ │ -};
    │ │ │ │ +std::string generate_fingerprint (std::string name
    │ │ │ │ +   , int major, int minor = 0, int revision = 0, int tag = 0);
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    create_ut_metadata_plugin()

    │ │ │ │ -

    Declared in "libtorrent/extensions/ut_metadata.hpp"

    │ │ │ │ +

    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 settings_pack.

    │ │ │ │ +

    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:

    │ │ │ │ + │ │ │ │ +│ │ │ │ +│ │ │ │ +│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
    id charsclient
    LTlibtorrent (default)
    UTuTorrent
    UMuTorrent Mac
    qBqBittorrent
    BPBitTorrent Pro
    BTBitTorrent
    DEDeluge
    AZAzureus
    TLTribler
    │ │ │ │ +

    There's an informal directory of client id's here.

    │ │ │ │ +

    The major, minor, revision and tag parameters are used to │ │ │ │ +identify the version of your client.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    min_memory_usage() high_performance_seed()

    │ │ │ │ +

    Declared in "libtorrent/session.hpp"

    │ │ │ │
    │ │ │ │ -std::shared_ptr<torrent_plugin> create_ut_metadata_plugin (torrent_handle const&, client_data_t);
    │ │ │ │ +settings_pack high_performance_seed ();
    │ │ │ │ +settings_pack min_memory_usage ();
    │ │ │ │  
    │ │ │ │ -

    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 session constructor.

    │ │ │ │ -

    This can either be passed in the add_torrent_params::extensions field, or │ │ │ │ -via torrent_handle::add_extension().

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    create_smart_ban_plugin()

    │ │ │ │ -

    Declared in "libtorrent/extensions/smart_ban.hpp"

    │ │ │ │ +

    The default values of the session settings are set for a regular │ │ │ │ +bittorrent client running on a desktop system. There are functions that │ │ │ │ +can set the session 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.

    │ │ │ │ + │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    setting_by_name() name_for_setting()

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │
    │ │ │ │ -std::shared_ptr<torrent_plugin> create_smart_ban_plugin (torrent_handle const&, client_data_t);
    │ │ │ │ +int setting_by_name (string_view name);
    │ │ │ │ +char const* name_for_setting (int s);
    │ │ │ │  
    │ │ │ │ -

    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 torrent_handle::add_extension().

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    create_ut_pex_plugin()

    │ │ │ │ -

    Declared in "libtorrent/extensions/ut_pex.hpp"

    │ │ │ │ +

    converts a setting integer (from the enums string_types, int_types or │ │ │ │ +bool_types) to a string, and vice versa.

    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    default_settings()

    │ │ │ │ +

    Declared in "libtorrent/settings_pack.hpp"

    │ │ │ │
    │ │ │ │ -std::shared_ptr<torrent_plugin> create_ut_pex_plugin (torrent_handle const&, client_data_t);
    │ │ │ │ +settings_pack default_settings ();
    │ │ │ │  
    │ │ │ │ -

    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 session constructor.

    │ │ │ │ -

    This can either be passed in the add_torrent_params::extensions field, or │ │ │ │ -via torrent_handle::add_extension().

    │ │ │ │ +

    returns a settings_pack with every setting set to its default value

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    ip_filter

    │ │ │ │

    Declared in "libtorrent/ip_filter.hpp"

    │ │ │ │

    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 │ │ │ │ @@ -16819,18 +19925,18 @@ │ │ │ │ IPv6 range).

    │ │ │ │

    A default constructed ip_filter does not filter any address.

    │ │ │ │
    │ │ │ │  struct ip_filter
    │ │ │ │  {
    │ │ │ │     ip_filter (ip_filter&&);
    │ │ │ │     ip_filter ();
    │ │ │ │ -   ip_filter (ip_filter const&);
    │ │ │ │     ip_filter& operator= (ip_filter const&);
    │ │ │ │ -   ip_filter& operator= (ip_filter&&);
    │ │ │ │     ~ip_filter ();
    │ │ │ │ +   ip_filter (ip_filter const&);
    │ │ │ │ +   ip_filter& operator= (ip_filter&&);
    │ │ │ │     bool empty () const;
    │ │ │ │     void add_rule (address const& first, address const& last, std::uint32_t flags);
    │ │ │ │     std::uint32_t access (address const& addr) const;
    │ │ │ │     filter_tuple_t export_filter () const;
    │ │ │ │  
    │ │ │ │     enum access_flags
    │ │ │ │     {
    │ │ │ │ @@ -16914,20 +20020,20 @@
    │ │ │ │  

    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& operator= (port_filter const&);
    │ │ │ │ -   port_filter ();
    │ │ │ │     port_filter (port_filter const&);
    │ │ │ │ +   port_filter (port_filter&&);
    │ │ │ │ +   port_filter ();
    │ │ │ │     ~port_filter ();
    │ │ │ │     port_filter& operator= (port_filter&&);
    │ │ │ │ -   port_filter (port_filter&&);
    │ │ │ │ +   port_filter& operator= (port_filter const&);
    │ │ │ │     void add_rule (std::uint16_t first, std::uint16_t last, std::uint32_t flags);
    │ │ │ │     std::uint32_t access (std::uint16_t port) const;
    │ │ │ │  
    │ │ │ │     enum access_flags
    │ │ │ │     {
    │ │ │ │        blocked,
    │ │ │ │     };
    │ │ │ │ @@ -16970,3122 +20076,16 @@
    │ │ │ │  blocked
    │ │ │ │  1
    │ │ │ │  this flag indicates that destination ports in the
    │ │ │ │  range should not be connected to
    │ │ │ │  
    │ │ │ │  
    │ │ │ │  
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    bdecode_node

    │ │ │ │ -

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ -

    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 │ │ │ │ -non_owning() member function.

    │ │ │ │ -

    There are 5 different types of nodes, see type_t.

    │ │ │ │ -
    │ │ │ │ -struct bdecode_node
    │ │ │ │ -{
    │ │ │ │ -   bdecode_node () = default;
    │ │ │ │ -   bdecode_node& operator= (bdecode_node const&) &;
    │ │ │ │ -   bdecode_node (bdecode_node&&) noexcept;
    │ │ │ │ -   bdecode_node& operator= (bdecode_node&&) & = default;
    │ │ │ │ -   bdecode_node (bdecode_node const&);
    │ │ │ │ -   type_t type () const noexcept;
    │ │ │ │ -   explicit operator bool () const noexcept;
    │ │ │ │ -   bdecode_node non_owning () const;
    │ │ │ │ -   std::ptrdiff_t data_offset () const noexcept;
    │ │ │ │ -   span<char const> data_section () const noexcept;
    │ │ │ │ -   string_view list_string_value_at (int i
    │ │ │ │ -      , string_view default_val = string_view()) const;
    │ │ │ │ -   std::int64_t list_int_value_at (int i
    │ │ │ │ -      , std::int64_t default_val = 0) const;
    │ │ │ │ -   int list_size () const;
    │ │ │ │ -   bdecode_node list_at (int i) const;
    │ │ │ │ -   std::int64_t dict_find_int_value (string_view key
    │ │ │ │ -      , std::int64_t default_val = 0) const;
    │ │ │ │ -   std::pair<bdecode_node, bdecode_node> dict_at_node (int i) const;
    │ │ │ │ -   bdecode_node dict_find_list (string_view key) const;
    │ │ │ │ -   bdecode_node dict_find_string (string_view key) const;
    │ │ │ │ -   bdecode_node dict_find (string_view key) const;
    │ │ │ │ -   int dict_size () const;
    │ │ │ │ -   std::pair<string_view, bdecode_node> dict_at (int i) const;
    │ │ │ │ -   bdecode_node dict_find_dict (string_view key) const;
    │ │ │ │ -   bdecode_node dict_find_int (string_view key) const;
    │ │ │ │ -   string_view dict_find_string_value (string_view key
    │ │ │ │ -      , string_view default_value = string_view()) const;
    │ │ │ │ -   std::int64_t int_value () const;
    │ │ │ │ -   string_view string_value () const;
    │ │ │ │ -   std::ptrdiff_t string_offset () const;
    │ │ │ │ -   char const* string_ptr () const;
    │ │ │ │ -   int string_length () const;
    │ │ │ │ -   void clear ();
    │ │ │ │ -   void swap (bdecode_node& n);
    │ │ │ │ -   void reserve (int tokens);
    │ │ │ │ -   void switch_underlying_buffer (char const* buf) noexcept;
    │ │ │ │ -   bool has_soft_error (span<char> error) const;
    │ │ │ │ -
    │ │ │ │ -   enum type_t
    │ │ │ │ -   {
    │ │ │ │ -      none_t,
    │ │ │ │ -      dict_t,
    │ │ │ │ -      list_t,
    │ │ │ │ -      string_t,
    │ │ │ │ -      int_t,
    │ │ │ │ -   };
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    bdecode_node()

    │ │ │ │ -
    │ │ │ │ -bdecode_node () = default;
    │ │ │ │ -
    │ │ │ │ -

    creates a default constructed node, it will have the type none_t.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    bdecode_node() operator=()

    │ │ │ │ -
    │ │ │ │ -bdecode_node& operator= (bdecode_node const&) &;
    │ │ │ │ -bdecode_node (bdecode_node&&) noexcept;
    │ │ │ │ -bdecode_node& operator= (bdecode_node&&) & = default;
    │ │ │ │ -bdecode_node (bdecode_node const&);
    │ │ │ │ -
    │ │ │ │ -

    For owning nodes, the copy will create a copy of the tree, but the │ │ │ │ -underlying buffer remains the same.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    type()

    │ │ │ │ -
    │ │ │ │ -type_t type () const noexcept;
    │ │ │ │ -
    │ │ │ │ -

    the type of this node. See type_t.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    bool()

    │ │ │ │ -
    │ │ │ │ -explicit operator bool () const noexcept;
    │ │ │ │ -
    │ │ │ │ -

    returns true if type() != none_t.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    non_owning()

    │ │ │ │ -
    │ │ │ │ -bdecode_node non_owning () const;
    │ │ │ │ -
    │ │ │ │ -

    return a non-owning reference to this node. This is useful to refer to │ │ │ │ -the root node without copying it in assignments.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    data_section() data_offset()

    │ │ │ │ -
    │ │ │ │ -std::ptrdiff_t data_offset () const noexcept;
    │ │ │ │ -span<char const> data_section () 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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    list_size() list_string_value_at() list_at() list_int_value_at()

    │ │ │ │ -
    │ │ │ │ -string_view list_string_value_at (int i
    │ │ │ │ -      , string_view default_val = string_view()) const;
    │ │ │ │ -std::int64_t list_int_value_at (int i
    │ │ │ │ -      , std::int64_t default_val = 0) const;
    │ │ │ │ -int list_size () const;
    │ │ │ │ -bdecode_node list_at (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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dict_at() dict_find_string_value() dict_size() dict_find() dict_at_node() dict_find_string() dict_find_dict() dict_find_int() dict_find_int_value() dict_find_list()

    │ │ │ │ -
    │ │ │ │ -std::int64_t dict_find_int_value (string_view key
    │ │ │ │ -      , std::int64_t default_val = 0) const;
    │ │ │ │ -std::pair<bdecode_node, bdecode_node> dict_at_node (int i) const;
    │ │ │ │ -bdecode_node dict_find_list (string_view key) const;
    │ │ │ │ -bdecode_node dict_find_string (string_view key) const;
    │ │ │ │ -bdecode_node dict_find (string_view key) const;
    │ │ │ │ -int dict_size () const;
    │ │ │ │ -std::pair<string_view, bdecode_node> dict_at (int i) const;
    │ │ │ │ -bdecode_node dict_find_dict (string_view key) const;
    │ │ │ │ -bdecode_node dict_find_int (string_view key) const;
    │ │ │ │ -string_view dict_find_string_value (string_view key
    │ │ │ │ -      , string_view default_value = string_view()) 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 bdecode_node.

    │ │ │ │ -

    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).

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    int_value()

    │ │ │ │ -
    │ │ │ │ -std::int64_t int_value () const;
    │ │ │ │ -
    │ │ │ │ -

    this function is only valid if type() == int_t. It returns the │ │ │ │ -value of the integer.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    string_value() string_length() string_offset() string_ptr()

    │ │ │ │ -
    │ │ │ │ -string_view string_value () const;
    │ │ │ │ -std::ptrdiff_t string_offset () const;
    │ │ │ │ -char const* string_ptr () const;
    │ │ │ │ -int string_length () const;
    │ │ │ │ -
    │ │ │ │ -

    these functions are only valid if type() == string_t. They return │ │ │ │ -the string values. Note that string_ptr() is not 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    clear()

    │ │ │ │ -
    │ │ │ │ -void clear ();
    │ │ │ │ -
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    swap()

    │ │ │ │ -
    │ │ │ │ -void swap (bdecode_node& n);
    │ │ │ │ -
    │ │ │ │ -

    Swap contents.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    reserve()

    │ │ │ │ -
    │ │ │ │ -void reserve (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 bdecode().

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    switch_underlying_buffer()

    │ │ │ │ -
    │ │ │ │ -void switch_underlying_buffer (char const* buf) noexcept;
    │ │ │ │ -
    │ │ │ │ -

    this buffer MUST be identical to the one originally parsed. This │ │ │ │ -operation is only defined on owning root nodes, i.e. the one passed in to │ │ │ │ -decode().

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    has_soft_error()

    │ │ │ │ -
    │ │ │ │ -bool has_soft_error (span<char> error) const;
    │ │ │ │ -
    │ │ │ │ -

    returns true if there is a non-fatal error in the bencoding of this node │ │ │ │ -or its children

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum type_t

    │ │ │ │ -

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    none_t0uninitialized or default constructed. This is also used │ │ │ │ -to indicate that a node was not found in some cases.
    dict_t1a dictionary node. The dict_find_ functions are valid.
    list_t2a list node. The list_ functions are valid.
    string_t3a string node, the string_ functions are valid.
    int_t4an integer node. The int_ functions are valid.
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    print_entry()

    │ │ │ │ -

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ -
    │ │ │ │ -std::string print_entry (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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    bdecode()

    │ │ │ │ -

    Declared in "libtorrent/bdecode.hpp"

    │ │ │ │ -
    │ │ │ │ -int bdecode (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 bdecode (span<char const> buffer
    │ │ │ │ -   , int depth_limit = 100, int token_limit = 2000000);
    │ │ │ │ -bdecode_node bdecode (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 owning 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    storage_params

    │ │ │ │ -

    Declared in "libtorrent/storage_defs.hpp"

    │ │ │ │ -

    a parameter pack used to construct the storage for a torrent, used in │ │ │ │ -disk_interface

    │ │ │ │ -
    │ │ │ │ -struct storage_params
    │ │ │ │ -{
    │ │ │ │ -   storage_params (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* mapped_files  = nullptr;
    │ │ │ │ -   std::string const& path;
    │ │ │ │ -   storage_mode_t mode {storage_mode_sparse};
    │ │ │ │ -   aux::vector<download_priority_t, file_index_t> const& priorities;
    │ │ │ │ -   sha1_hash info_hash;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_slice

    │ │ │ │ -

    Declared in "libtorrent/file_storage.hpp"

    │ │ │ │ -

    represents a window of a file in a torrent.

    │ │ │ │ -

    The file_index refers to the index of the file (in the torrent_info). │ │ │ │ -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;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    file_index
    │ │ │ │ -
    the index of the file
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    offset
    │ │ │ │ -
    the offset from the start of the file, in bytes
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    size
    │ │ │ │ -
    the size of the window, in bytes
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_storage

    │ │ │ │ -

    Declared in "libtorrent/file_storage.hpp"

    │ │ │ │ -

    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 is_valid () const;
    │ │ │ │ -   void reserve (int num_files);
    │ │ │ │ -   void add_file (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 add_file_borrow (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 add_file (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 add_file_borrow (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 rename_file (file_index_t index, std::string const& new_filename);
    │ │ │ │ -   std::vector<file_slice> map_block (piece_index_t piece, std::int64_t offset
    │ │ │ │ -      , std::int64_t size) const;
    │ │ │ │ -   peer_request map_file (file_index_t file, std::int64_t offset, int size) const;
    │ │ │ │ -   int num_files () const noexcept;
    │ │ │ │ -   file_index_t end_file () const noexcept;
    │ │ │ │ -   index_range<file_index_t> file_range () const noexcept;
    │ │ │ │ -   std::int64_t total_size () const;
    │ │ │ │ -   int num_pieces () const;
    │ │ │ │ -   void set_num_pieces (int n);
    │ │ │ │ -   piece_index_t end_piece () const;
    │ │ │ │ -   piece_index_t last_piece () const;
    │ │ │ │ -   index_range<piece_index_t> piece_range () const noexcept;
    │ │ │ │ -   int piece_length () const;
    │ │ │ │ -   void set_piece_length (int l);
    │ │ │ │ -   int piece_size (piece_index_t index) const;
    │ │ │ │ -   int piece_size2 (piece_index_t index) const;
    │ │ │ │ -   int blocks_in_piece2 (piece_index_t index) const;
    │ │ │ │ -   int blocks_per_piece () const;
    │ │ │ │ -   void set_name (std::string const& n);
    │ │ │ │ -   std::string const& name () const;
    │ │ │ │ -   void swap (file_storage& ti) noexcept;
    │ │ │ │ -   void canonicalize ();
    │ │ │ │ -   sha1_hash hash (file_index_t index) const;
    │ │ │ │ -   std::int64_t file_size (file_index_t index) const;
    │ │ │ │ -   std::string file_path (file_index_t index, std::string const& save_path = "") const;
    │ │ │ │ -   bool pad_file_at (file_index_t index) const;
    │ │ │ │ -   std::int64_t file_offset (file_index_t index) const;
    │ │ │ │ -   std::time_t mtime (file_index_t index) const;
    │ │ │ │ -   std::string symlink (file_index_t index) const;
    │ │ │ │ -   char const* root_ptr (file_index_t const index) const;
    │ │ │ │ -   sha256_hash root (file_index_t index) const;
    │ │ │ │ -   string_view file_name (file_index_t index) const;
    │ │ │ │ -   int file_num_pieces (file_index_t index) const;
    │ │ │ │ -   index_range<piece_index_t::diff_type> file_piece_range (file_index_t) const;
    │ │ │ │ -   int file_num_blocks (file_index_t index) const;
    │ │ │ │ -   int file_first_block_node (file_index_t index) const;
    │ │ │ │ -   int file_first_piece_node (file_index_t index) const;
    │ │ │ │ -   std::uint32_t file_path_hash (file_index_t index, std::string const& save_path) const;
    │ │ │ │ -   void all_path_hashes (std::unordered_set<std::uint32_t>& table) const;
    │ │ │ │ -   file_flags_t file_flags (file_index_t index) const;
    │ │ │ │ -   bool file_absolute_path (file_index_t index) const;
    │ │ │ │ -   file_index_t file_index_at_piece (piece_index_t piece) const;
    │ │ │ │ -   file_index_t file_index_at_offset (std::int64_t offset) const;
    │ │ │ │ -   file_index_t file_index_for_root (sha256_hash const& root_hash) const;
    │ │ │ │ -   piece_index_t piece_index_at_file (file_index_t f) const;
    │ │ │ │ -   void sanitize_symlinks ();
    │ │ │ │ -   bool v2 () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr file_flags_t flag_pad_file  = 0_bit;
    │ │ │ │ -   static constexpr file_flags_t flag_hidden  = 1_bit;
    │ │ │ │ -   static constexpr file_flags_t flag_executable  = 2_bit;
    │ │ │ │ -   static constexpr file_flags_t flag_symlink  = 3_bit;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    is_valid()

    │ │ │ │ -
    │ │ │ │ -bool is_valid () const;
    │ │ │ │ -
    │ │ │ │ -

    returns true if the piece length has been initialized │ │ │ │ -on the file_storage. This is typically taken as a proxy │ │ │ │ -of whether the file_storage as a whole is initialized or │ │ │ │ -not.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    reserve()

    │ │ │ │ -
    │ │ │ │ -void reserve (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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_file_borrow() add_file()

    │ │ │ │ -
    │ │ │ │ -void add_file (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 add_file_borrow (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 add_file (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 add_file_borrow (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 borrowed, i.e. it is the caller's │ │ │ │ -responsibility to make sure it stays valid throughout the lifetime │ │ │ │ -of this file_storage 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 file_storage::flag_symlink 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 │ │ │ │ -file_storage object, it will not be copied. This parameter is only │ │ │ │ -used when loading 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 an error_code reference will report failures │ │ │ │ -via that variable, otherwise system_error is thrown.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    rename_file()

    │ │ │ │ -
    │ │ │ │ -void rename_file (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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    map_block()

    │ │ │ │ -
    │ │ │ │ -std::vector<file_slice> map_block (piece_index_t piece, std::int64_t offset
    │ │ │ │ -      , std::int64_t size) const;
    │ │ │ │ -
    │ │ │ │ -

    returns a list of file_slice objects representing the portions of │ │ │ │ -files the specified piece index, byte offset and size range overlaps. │ │ │ │ -this is the inverse mapping of map_file().

    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    map_file()

    │ │ │ │ -
    │ │ │ │ -peer_request map_file (file_index_t file, std::int64_t offset, int size) const;
    │ │ │ │ -
    │ │ │ │ -

    returns a peer_request representing the piece index, byte offset │ │ │ │ -and size the specified file range overlaps. This is the inverse │ │ │ │ -mapping over map_block(). 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    num_files()

    │ │ │ │ -
    │ │ │ │ -int num_files () const noexcept;
    │ │ │ │ -
    │ │ │ │ -

    returns the number of files in the file_storage

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    end_file()

    │ │ │ │ -
    │ │ │ │ -file_index_t end_file () const noexcept;
    │ │ │ │ -
    │ │ │ │ -

    returns the index of the one-past-end file in the file storage

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_range()

    │ │ │ │ -
    │ │ │ │ -index_range<file_index_t> file_range () 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 file_storage.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    total_size()

    │ │ │ │ -
    │ │ │ │ -std::int64_t total_size () const;
    │ │ │ │ -
    │ │ │ │ -

    returns the total number of bytes all the files in this torrent spans

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    num_pieces() set_num_pieces()

    │ │ │ │ -
    │ │ │ │ -int num_pieces () const;
    │ │ │ │ -void set_num_pieces (int n);
    │ │ │ │ -
    │ │ │ │ -

    set and get the number of pieces in the torrent

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    end_piece()

    │ │ │ │ -
    │ │ │ │ -piece_index_t end_piece () const;
    │ │ │ │ -
    │ │ │ │ -

    returns the index of the one-past-end piece in the file storage

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    last_piece()

    │ │ │ │ -
    │ │ │ │ -piece_index_t last_piece () 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).

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    piece_range()

    │ │ │ │ -
    │ │ │ │ -index_range<piece_index_t> piece_range () 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 file_storage.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_piece_length() piece_length()

    │ │ │ │ -
    │ │ │ │ -int piece_length () const;
    │ │ │ │ -void set_piece_length (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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    piece_size()

    │ │ │ │ -
    │ │ │ │ -int piece_size (piece_index_t index) const;
    │ │ │ │ -
    │ │ │ │ -

    returns the piece size of index. This will be the same as piece_length(), except │ │ │ │ -for the last piece, which may be shorter.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    piece_size2()

    │ │ │ │ -
    │ │ │ │ -int piece_size2 (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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    blocks_in_piece2()

    │ │ │ │ -
    │ │ │ │ -int blocks_in_piece2 (piece_index_t index) const;
    │ │ │ │ -
    │ │ │ │ -

    returns the number of blocks in the specified piece, for v2 torrents.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    blocks_per_piece()

    │ │ │ │ -
    │ │ │ │ -int blocks_per_piece () const;
    │ │ │ │ -
    │ │ │ │ -

    returns the number of blocks there are in the typical piece. There │ │ │ │ -may be fewer in the last piece)

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    name() set_name()

    │ │ │ │ -
    │ │ │ │ -void set_name (std::string const& n);
    │ │ │ │ -std::string const& name () const;
    │ │ │ │ -
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    swap()

    │ │ │ │ -
    │ │ │ │ -void swap (file_storage& ti) noexcept;
    │ │ │ │ -
    │ │ │ │ -

    swap all content of this with ti.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    canonicalize()

    │ │ │ │ -
    │ │ │ │ -void canonicalize ();
    │ │ │ │ -
    │ │ │ │ -

    arrange files and padding to match the canonical form required │ │ │ │ -by BEP 52

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -

    file_num_pieces() file_num_blocks() file_piece_range()

    │ │ │ │ -
    │ │ │ │ -int file_num_pieces (file_index_t index) const;
    │ │ │ │ -index_range<piece_index_t::diff_type> file_piece_range (file_index_t) const;
    │ │ │ │ -int file_num_blocks (file_index_t index) const;
    │ │ │ │ -
    │ │ │ │ -

    Returns the number of pieces or blocks the file at index 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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_first_piece_node() file_first_block_node()

    │ │ │ │ -
    │ │ │ │ -int file_first_block_node (file_index_t index) const;
    │ │ │ │ -int file_first_piece_node (file_index_t index) const;
    │ │ │ │ -
    │ │ │ │ -

    index of first piece node in the merkle tree

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_path_hash()

    │ │ │ │ -
    │ │ │ │ -std::uint32_t file_path_hash (file_index_t index, std::string const& save_path) const;
    │ │ │ │ -
    │ │ │ │ -

    returns the crc32 hash of file_path(index)

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    all_path_hashes()

    │ │ │ │ -
    │ │ │ │ -void all_path_hashes (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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_flags()

    │ │ │ │ -
    │ │ │ │ -file_flags_t file_flags (file_index_t index) const;
    │ │ │ │ -
    │ │ │ │ -

    returns a bitmask of flags from file_flags_t that apply │ │ │ │ -to file at index.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_absolute_path()

    │ │ │ │ -
    │ │ │ │ -bool file_absolute_path (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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_index_at_offset() file_index_at_piece()

    │ │ │ │ -
    │ │ │ │ -file_index_t file_index_at_piece (piece_index_t piece) const;
    │ │ │ │ -file_index_t file_index_at_offset (std::int64_t offset) const;
    │ │ │ │ -
    │ │ │ │ -

    returns the index of the file at the given offset in the torrent

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_index_for_root()

    │ │ │ │ -
    │ │ │ │ -file_index_t file_index_for_root (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

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    piece_index_at_file()

    │ │ │ │ -
    │ │ │ │ -piece_index_t piece_index_at_file (file_index_t f) const;
    │ │ │ │ -
    │ │ │ │ -

    returns the piece index the given file starts at

    │ │ │ │ -[report issue]
    │ │ │ │ - │ │ │ │ -
    │ │ │ │ -

    v2()

    │ │ │ │ -
    │ │ │ │ -bool v2 () const;
    │ │ │ │ -
    │ │ │ │ -

    returns true if this torrent contains v2 metadata.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    flag_hidden
    │ │ │ │ -
    this file has the hidden attribute set. This is primarily │ │ │ │ -a windows attribute
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    flag_executable
    │ │ │ │ -
    this file has the executable attribute set.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    flag_symlink
    │ │ │ │ -
    this file is a symbolic link. It should have a link │ │ │ │ -target string associated with it.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    default_disk_io_constructor()

    │ │ │ │ -

    Declared in "libtorrent/session.hpp"

    │ │ │ │ -
    │ │ │ │ -std::unique_ptr<disk_interface> default_disk_io_constructor (
    │ │ │ │ -   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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    posix_disk_io_constructor()

    │ │ │ │ -

    Declared in "libtorrent/posix_disk_io.hpp"

    │ │ │ │ -
    │ │ │ │ -std::unique_ptr<disk_interface> posix_disk_io_constructor (
    │ │ │ │ -   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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    mmap_disk_io_constructor()

    │ │ │ │ -

    Declared in "libtorrent/mmap_disk_io.hpp"

    │ │ │ │ -
    │ │ │ │ -std::unique_ptr<disk_interface> mmap_disk_io_constructor (
    │ │ │ │ -   io_context& ios, settings_interface const&, counters& cnt);
    │ │ │ │ -
    │ │ │ │ -

    constructs a memory mapped file disk I/O object.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    disabled_disk_io_constructor()

    │ │ │ │ -

    Declared in "libtorrent/disabled_disk_io.hpp"

    │ │ │ │ -
    │ │ │ │ -std::unique_ptr<disk_interface> disabled_disk_io_constructor (
    │ │ │ │ -   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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum storage_mode_t

    │ │ │ │ -

    Declared in "libtorrent/storage_defs.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    storage_mode_allocate0All 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.
    storage_mode_sparse1All pieces will be written to the place where they belong and sparse files │ │ │ │ -will be used. This is the recommended, and default mode.
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum status_t

    │ │ │ │ -

    Declared in "libtorrent/storage_defs.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    no_error0 
    fatal_disk_error1 
    need_full_check2 
    file_exist3 
    oversized_file16this 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 status_t field is used for this to preserve ABI.
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum move_flags_t

    │ │ │ │ -

    Declared in "libtorrent/storage_defs.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    always_replace_files0replace any files in the destination when copying │ │ │ │ -or moving the storage
    fail_if_exist1if 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.
    dont_replace2if any file exist in the target, take those files instead │ │ │ │ -of the ones we may have in the source.
    reset_save_path3don't move any source files, just forget about them │ │ │ │ -and begin checking files at new save path
    reset_save_path_unchecked4don't move any source files, just change save path │ │ │ │ -and continue working without any checks
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    announce_infohash

    │ │ │ │ -

    Declared in "libtorrent/announce_entry.hpp"

    │ │ │ │ -
    │ │ │ │ -struct announce_infohash
    │ │ │ │ -{
    │ │ │ │ -   std::string message;
    │ │ │ │ -   error_code last_error;
    │ │ │ │ -   int scrape_incomplete  = -1;
    │ │ │ │ -   int scrape_complete  = -1;
    │ │ │ │ -   int scrape_downloaded  = -1;
    │ │ │ │ -   std::uint8_t fails : 7;
    │ │ │ │ -   bool updating : 1;
    │ │ │ │ -   bool start_sent : 1;
    │ │ │ │ -   bool complete_sent : 1;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    message
    │ │ │ │ -
    if this tracker has returned an error or warning message │ │ │ │ -that message is stored here
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    last_error
    │ │ │ │ -
    if this tracker failed the last time it was contacted │ │ │ │ -this error code specifies what error occurred
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    scrape_incomplete scrape_complete scrape_downloaded
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    fails
    │ │ │ │ -
    the number of times in a row we have failed to announce to this │ │ │ │ -tracker.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    updating
    │ │ │ │ -
    true while we're waiting for a response from the tracker.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    start_sent
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    complete_sent
    │ │ │ │ -
    set to true when we send a event=completed.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    announce_endpoint

    │ │ │ │ -

    Declared in "libtorrent/announce_entry.hpp"

    │ │ │ │ -

    announces are sent to each tracker using every listen socket │ │ │ │ -this class holds information about one listen socket for one tracker

    │ │ │ │ -
    │ │ │ │ -struct announce_endpoint
    │ │ │ │ -{
    │ │ │ │ -   announce_endpoint ();
    │ │ │ │ -
    │ │ │ │ -   tcp::endpoint local_endpoint;
    │ │ │ │ -   aux::array<announce_infohash, num_protocols, protocol_version> info_hashes;
    │ │ │ │ -   bool enabled  = true;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    local_endpoint
    │ │ │ │ -
    the local endpoint of the listen interface associated with this endpoint
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    info_hashes
    │ │ │ │ -
    info_hashes[0] is the v1 info hash (SHA1) │ │ │ │ -info_hashes[1] is the v2 info hash (truncated SHA-256)
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    enabled
    │ │ │ │ -
    set to false to not announce from this endpoint
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    announce_entry

    │ │ │ │ -

    Declared in "libtorrent/announce_entry.hpp"

    │ │ │ │ -

    this class holds information about one bittorrent tracker, as it │ │ │ │ -relates to a specific torrent.

    │ │ │ │ -
    │ │ │ │ -struct announce_entry
    │ │ │ │ -{
    │ │ │ │ -   ~announce_entry ();
    │ │ │ │ -   announce_entry (announce_entry const&);
    │ │ │ │ -   explicit announce_entry (string_view u);
    │ │ │ │ -   announce_entry& operator= (announce_entry const&) &;
    │ │ │ │ -   announce_entry ();
    │ │ │ │ -
    │ │ │ │ -   enum tracker_source
    │ │ │ │ -   {
    │ │ │ │ -      source_torrent,
    │ │ │ │ -      source_client,
    │ │ │ │ -      source_magnet_link,
    │ │ │ │ -      source_tex,
    │ │ │ │ -   };
    │ │ │ │ -
    │ │ │ │ -   std::string url;
    │ │ │ │ -   std::string trackerid;
    │ │ │ │ -   std::vector<announce_endpoint> endpoints;
    │ │ │ │ -   std::uint8_t tier  = 0;
    │ │ │ │ -   std::uint8_t fail_limit  = 0;
    │ │ │ │ -   std::uint8_t source:4;
    │ │ │ │ -   bool verified:1;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    announce_entry() operator=() ~announce_entry()

    │ │ │ │ -
    │ │ │ │ -~announce_entry ();
    │ │ │ │ -announce_entry (announce_entry const&);
    │ │ │ │ -explicit announce_entry (string_view u);
    │ │ │ │ -announce_entry& operator= (announce_entry const&) &;
    │ │ │ │ -announce_entry ();
    │ │ │ │ -
    │ │ │ │ -

    constructs a tracker announce entry with u as the URL.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum tracker_source

    │ │ │ │ -

    Declared in "libtorrent/announce_entry.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    source_torrent1the tracker was part of the .torrent file
    source_client2the tracker was added programmatically via the add_tracker() function
    source_magnet_link4the tracker was part of a magnet link
    source_tex8the tracker was received from the swarm via tracker exchange
    │ │ │ │ -[report issue]
    │ │ │ │ -
    url
    │ │ │ │ -
    tracker URL as it appeared in the torrent file
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    trackerid
    │ │ │ │ -
    the current &trackerid= argument passed to the tracker. │ │ │ │ -this is optional and is normally empty (in which case no │ │ │ │ -trackerid is sent).
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    endpoints
    │ │ │ │ -
    each local listen socket (endpoint) will announce to the tracker. This │ │ │ │ -list contains state per endpoint.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    tier
    │ │ │ │ -
    the tier this tracker belongs to
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    fail_limit
    │ │ │ │ -
    the max number of failures to announce to this tracker in │ │ │ │ -a row, before this tracker is not used anymore. 0 means unlimited
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    source
    │ │ │ │ -
    a bitmask specifying which sources we got this tracker from.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    verified
    │ │ │ │ -
    set to true the first time we receive a valid response │ │ │ │ -from this tracker.
    │ │ │ │ -
    │ │ │ │ -

    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. │ │ │ │ -
    3. the torrent properties are set, such as tracker url, web seeds, │ │ │ │ -DHT nodes etc.
    4. │ │ │ │ -
    5. Read through all the files in the torrent, SHA-1 all the data │ │ │ │ -and set the piece hashes.
    6. │ │ │ │ -
    7. The torrent is bencoded into a file or buffer.
    8. │ │ │ │ -
    │ │ │ │ -

    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());
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    create_torrent

    │ │ │ │ -

    Declared in "libtorrent/create_torrent.hpp"

    │ │ │ │ -

    This class holds state for creating a torrent. After having added │ │ │ │ -all information to it, call create_torrent::generate() to generate │ │ │ │ -the torrent. The entry that's returned can then be bencoded into a │ │ │ │ -.torrent file using bencode().

    │ │ │ │ -
    │ │ │ │ -struct create_torrent
    │ │ │ │ -{
    │ │ │ │ -   explicit create_torrent (file_storage& fs, int piece_size = 0
    │ │ │ │ -      , create_flags_t flags = {});
    │ │ │ │ -   explicit create_torrent (torrent_info const& ti);
    │ │ │ │ -   entry generate () const;
    │ │ │ │ -   std::vector<char> generate_buf () const;
    │ │ │ │ -   file_storage const& files () const;
    │ │ │ │ -   void set_comment (char const* str);
    │ │ │ │ -   void set_creator (char const* str);
    │ │ │ │ -   void set_creation_date (std::time_t timestamp);
    │ │ │ │ -   void set_hash (piece_index_t index, sha1_hash const& h);
    │ │ │ │ -   void set_hash2 (file_index_t file, piece_index_t::diff_type piece, sha256_hash const& h);
    │ │ │ │ -   void add_http_seed (string_view url);
    │ │ │ │ -   void add_url_seed (string_view url);
    │ │ │ │ -   void add_node (std::pair<std::string, int> node);
    │ │ │ │ -   void add_tracker (string_view url, int tier = 0);
    │ │ │ │ -   void set_root_cert (string_view cert);
    │ │ │ │ -   void set_priv (bool p);
    │ │ │ │ -   bool priv () const;
    │ │ │ │ -   bool is_v1_only () const;
    │ │ │ │ -   bool is_v2_only () const;
    │ │ │ │ -   int num_pieces () const;
    │ │ │ │ -   piece_index_t end_piece () const;
    │ │ │ │ -   index_range<piece_index_t> piece_range () const noexcept;
    │ │ │ │ -   file_index_t end_file () const;
    │ │ │ │ -   index_range<file_index_t> file_range () const noexcept;
    │ │ │ │ -   index_range<piece_index_t::diff_type> file_piece_range (file_index_t f);
    │ │ │ │ -   std::int64_t total_size () const;
    │ │ │ │ -   int piece_length () const;
    │ │ │ │ -   int piece_size (piece_index_t i) const;
    │ │ │ │ -   void add_similar_torrent (sha1_hash ih);
    │ │ │ │ -   void add_collection (string_view c);
    │ │ │ │ -
    │ │ │ │ -   static constexpr create_flags_t modification_time  = 2_bit;
    │ │ │ │ -   static constexpr create_flags_t symlinks  = 3_bit;
    │ │ │ │ -   static constexpr create_flags_t v2_only  = 5_bit;
    │ │ │ │ -   static constexpr create_flags_t v1_only  = 6_bit;
    │ │ │ │ -   static constexpr create_flags_t canonical_files  = 7_bit;
    │ │ │ │ -   static constexpr create_flags_t no_attributes  = 8_bit;
    │ │ │ │ -   static constexpr create_flags_t canonical_files_no_tail_padding  = 9_bit;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    create_torrent()

    │ │ │ │ -
    │ │ │ │ -explicit create_torrent (file_storage& fs, int piece_size = 0
    │ │ │ │ -      , create_flags_t flags = {});
    │ │ │ │ -explicit create_torrent (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 file_storage (fs) parameter defines the files, sizes and │ │ │ │ -their properties for the torrent to be created. Set this up first, │ │ │ │ -before passing it to the create_torrent 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 create_torrent::generate(). This means │ │ │ │ -that none of the member functions of create_torrent that affects │ │ │ │ -the content of the info dictionary (such as set_hash()), will │ │ │ │ -have any affect. Instead of using this overload, consider using │ │ │ │ -write_torrent_file() instead.

    │ │ │ │ -
    │ │ │ │ -

    Warning

    │ │ │ │ -

    The file_storage and torrent_info objects must stay alive for the │ │ │ │ -entire duration of the create_torrent object.

    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    generate() generate_buf()

    │ │ │ │ -
    │ │ │ │ -entry generate () const;
    │ │ │ │ -std::vector<char> generate_buf () const;
    │ │ │ │ -
    │ │ │ │ -

    This function will generate the .torrent file as a bencode tree, or a │ │ │ │ -bencoded into a buffer. │ │ │ │ -In order to encode the entry into a flat file, use the bencode() function.

    │ │ │ │ -

    The function returning an entry 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 (set_hash()) and not all v2 hashes (set_hash2()) │ │ │ │ -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, generate() │ │ │ │ -fails.
    • │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    files()

    │ │ │ │ -
    │ │ │ │ -file_storage const& files () const;
    │ │ │ │ -
    │ │ │ │ -

    returns an immutable reference to the file_storage used to create │ │ │ │ -the torrent from.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_comment()

    │ │ │ │ -
    │ │ │ │ -void set_comment (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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_creator()

    │ │ │ │ -
    │ │ │ │ -void set_creator (char const* str);
    │ │ │ │ -
    │ │ │ │ -

    Sets the creator of the torrent. The string str should be utf-8 encoded. │ │ │ │ -This is optional.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_creation_date()

    │ │ │ │ -
    │ │ │ │ -void set_creation_date (std::time_t timestamp);
    │ │ │ │ -
    │ │ │ │ -

    sets the "creation time" field. Defaults to the system clock at the │ │ │ │ -time of construction of the create_torrent 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_hash()

    │ │ │ │ -
    │ │ │ │ -void set_hash (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 set_piece_hashes(). │ │ │ │ -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 generate(). │ │ │ │ -This function will throw std::system_error if it is called on an │ │ │ │ -object constructed with the v2_only flag.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_hash2()

    │ │ │ │ -
    │ │ │ │ -void set_hash2 (file_index_t file, piece_index_t::diff_type piece, sha256_hash const& h);
    │ │ │ │ -
    │ │ │ │ -

    sets the bittorrent v2 hash for file file of the piece piece. │ │ │ │ -piece is relative to the first piece of the file, starting at 0. The │ │ │ │ -first piece in the file can be computed with │ │ │ │ -file_storage::file_index_at_piece(). │ │ │ │ -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 generate(). │ │ │ │ -This function will throw std::system_error if it is called on an │ │ │ │ -object constructed with the v1_only flag.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_url_seed() add_http_seed()

    │ │ │ │ -
    │ │ │ │ -void add_http_seed (string_view url);
    │ │ │ │ -void add_url_seed (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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_node()

    │ │ │ │ -
    │ │ │ │ -void add_node (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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_tracker()

    │ │ │ │ -
    │ │ │ │ -void add_tracker (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 http:// 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_root_cert()

    │ │ │ │ -
    │ │ │ │ -void set_root_cert (string_view cert);
    │ │ │ │ -
    │ │ │ │ -

    This function sets an X.509 certificate in PEM format to the torrent. This makes the │ │ │ │ -torrent an SSL torrent. 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 ssl torrents.

    │ │ │ │ -

    The string is not the path to the cert, it's the actual content of the │ │ │ │ -certificate.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    priv() set_priv()

    │ │ │ │ -
    │ │ │ │ -void set_priv (bool p);
    │ │ │ │ -bool priv () 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    num_pieces()

    │ │ │ │ -
    │ │ │ │ -int num_pieces () const;
    │ │ │ │ -
    │ │ │ │ -

    returns the number of pieces in the associated file_storage object.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    piece_range()

    │ │ │ │ -
    │ │ │ │ -index_range<piece_index_t> piece_range () const noexcept;
    │ │ │ │ -
    │ │ │ │ -

    all piece indices in the torrent to be created

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_range()

    │ │ │ │ -
    │ │ │ │ -index_range<file_index_t> file_range () const noexcept;
    │ │ │ │ -
    │ │ │ │ -

    all file indices in the torrent to be created

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_piece_range()

    │ │ │ │ -
    │ │ │ │ -index_range<piece_index_t::diff_type> file_piece_range (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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    total_size()

    │ │ │ │ -
    │ │ │ │ -std::int64_t total_size () const;
    │ │ │ │ -
    │ │ │ │ -

    the total number of bytes of all files and pad files

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    piece_length() piece_size()

    │ │ │ │ -
    │ │ │ │ -int piece_length () const;
    │ │ │ │ -int piece_size (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 file_storage.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_similar_torrent() add_collection()

    │ │ │ │ -
    │ │ │ │ -void add_similar_torrent (sha1_hash ih);
    │ │ │ │ -void add_collection (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 BEP 38.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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 │ │ │ │ -set_hash2() before calling generate(). Setting v1 hashes (with │ │ │ │ -set_hash()) is an error with this flag set.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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 set_hash(), before calling │ │ │ │ -generate(). Setting v2 hashes (with set_hash2()) is an error with │ │ │ │ -this flag set.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    no_attributes
    │ │ │ │ -
    passing this flag to add_files() 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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    add_files()

    │ │ │ │ -

    Declared in "libtorrent/create_torrent.hpp"

    │ │ │ │ -
    │ │ │ │ -void add_files (file_storage& fs, std::string const& file
    │ │ │ │ -   , create_flags_t flags = {});
    │ │ │ │ -void add_files (file_storage& fs, std::string const& file
    │ │ │ │ -   , std::function<bool(std::string)> p, create_flags_t flags = {});
    │ │ │ │ -
    │ │ │ │ -

    Adds the file specified by path to the file_storage 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 create_torrent │ │ │ │ -constructor.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_piece_hashes()

    │ │ │ │ -

    Declared in "libtorrent/create_torrent.hpp"

    │ │ │ │ -
    │ │ │ │ -void set_piece_hashes (create_torrent& t, std::string const& p
    │ │ │ │ -   , settings_interface const& settings
    │ │ │ │ -   , std::function<void(piece_index_t)> const& f, error_code& ec);
    │ │ │ │ -inline void set_piece_hashes (create_torrent& t, std::string const& p, error_code& ec);
    │ │ │ │ -void set_piece_hashes (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 set_piece_hashes (create_torrent& t, std::string const& p);
    │ │ │ │ -inline void set_piece_hashes (create_torrent& t, std::string const& p
    │ │ │ │ -   , settings_interface const& settings
    │ │ │ │ -   , std::function<void(piece_index_t)> const& f);
    │ │ │ │ -inline void set_piece_hashes (create_torrent& t, std::string const& p
    │ │ │ │ -   , std::function<void(piece_index_t)> const& f);
    │ │ │ │ -void set_piece_hashes (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 settings_pack 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    block_info

    │ │ │ │ -

    Declared in "libtorrent/torrent_handle.hpp"

    │ │ │ │ -

    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
    │ │ │ │ -{
    │ │ │ │ -   tcp::endpoint peer () const;
    │ │ │ │ -   void set_peer (tcp::endpoint const& ep);
    │ │ │ │ -
    │ │ │ │ -   enum block_state_t
    │ │ │ │ -   {
    │ │ │ │ -      none,
    │ │ │ │ -      requested,
    │ │ │ │ -      writing,
    │ │ │ │ -      finished,
    │ │ │ │ -   };
    │ │ │ │ -
    │ │ │ │ -   unsigned bytes_progress:15;
    │ │ │ │ -   unsigned block_size:15;
    │ │ │ │ -   unsigned state:2;
    │ │ │ │ -   unsigned num_peers:14;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -

    peer() set_peer()

    │ │ │ │ -
    │ │ │ │ -tcp::endpoint peer () const;
    │ │ │ │ -void set_peer (tcp::endpoint const& ep);
    │ │ │ │ -
    │ │ │ │ -

    The peer is the ip address of the peer this block was downloaded from.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    enum block_state_t

    │ │ │ │ -

    Declared in "libtorrent/torrent_handle.hpp"

    │ │ │ │ - │ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ -│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
    namevaluedescription
    none0This block has not been downloaded or requested form any peer.
    requested1The block has been requested, but not completely downloaded yet.
    writing2The block has been downloaded and is currently queued for being │ │ │ │ -written to disk.
    finished3The block has been written to disk.
    │ │ │ │ -[report issue]
    │ │ │ │ -
    bytes_progress
    │ │ │ │ -
    the number of bytes that have been received for this block
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    block_size
    │ │ │ │ -
    the total number of bytes in this block.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    state
    │ │ │ │ -
    the state this block is in (see block_state_t)
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    num_peers
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    partial_piece_info

    │ │ │ │ -

    Declared in "libtorrent/torrent_handle.hpp"

    │ │ │ │ -

    This class holds information about pieces that have outstanding requests │ │ │ │ -or outstanding writes

    │ │ │ │ -
    │ │ │ │ -struct partial_piece_info
    │ │ │ │ -{
    │ │ │ │ -   piece_index_t piece_index;
    │ │ │ │ -   int blocks_in_piece;
    │ │ │ │ -   int finished;
    │ │ │ │ -   int writing;
    │ │ │ │ -   int requested;
    │ │ │ │ -   block_info const* blocks;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    piece_index
    │ │ │ │ -
    the index of the piece in question. blocks_in_piece 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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    blocks_in_piece
    │ │ │ │ -
    the number of blocks in this piece
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    finished
    │ │ │ │ -
    the number of blocks that are in the finished state
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    writing
    │ │ │ │ -
    the number of blocks that are in the writing state
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    requested
    │ │ │ │ -
    the number of blocks that are in the requested state
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    blocks
    │ │ │ │ -

    this is an array of blocks_in_piece number of │ │ │ │ -items. One for each block in the piece.

    │ │ │ │ -
    │ │ │ │ -

    Warning

    │ │ │ │ -

    This is a pointer that points to an array │ │ │ │ -that's owned by the session object. The next time │ │ │ │ -get_download_queue() is called, it will be invalidated. │ │ │ │ -In the case of piece_info_alert, these pointers point into the alert │ │ │ │ -object itself, and will be invalidated when the alert destruct.

    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    torrent_handle

    │ │ │ │ -

    Declared in "libtorrent/torrent_handle.hpp"

    │ │ │ │ -

    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.

    │ │ │ │ -
    │ │ │ │ -

    Warning

    │ │ │ │ -

    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 │ │ │ │ -torrent_handle::status() call.

    │ │ │ │ -
    │ │ │ │ -

    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 invalid_handle.

    │ │ │ │ -
    │ │ │ │ -

    Warning

    │ │ │ │ -

    All operations on a torrent_handle may throw system_error │ │ │ │ -exception, in case the handle is no longer referring to a torrent. │ │ │ │ -There is one exception is_valid() 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.

    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -struct torrent_handle
    │ │ │ │ -{
    │ │ │ │ -   friend std::size_t hash_value (torrent_handle const& th);
    │ │ │ │ -   torrent_handle () noexcept = default;
    │ │ │ │ -   void add_piece (piece_index_t piece, std::vector<char> data, add_piece_flags_t flags = {}) const;
    │ │ │ │ -   void add_piece (piece_index_t piece, char const* data, add_piece_flags_t flags = {}) const;
    │ │ │ │ -   void read_piece (piece_index_t piece) const;
    │ │ │ │ -   bool have_piece (piece_index_t piece) const;
    │ │ │ │ -   void post_peer_info () const;
    │ │ │ │ -   void get_peer_info (std::vector<peer_info>& v) const;
    │ │ │ │ -   void post_status (status_flags_t flags = status_flags_t::all()) const;
    │ │ │ │ -   torrent_status status (status_flags_t flags = status_flags_t::all()) const;
    │ │ │ │ -   void post_download_queue () const;
    │ │ │ │ -   std::vector<partial_piece_info> get_download_queue () const;
    │ │ │ │ -   void get_download_queue (std::vector<partial_piece_info>& queue) const;
    │ │ │ │ -   void clear_piece_deadlines () const;
    │ │ │ │ -   void set_piece_deadline (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;
    │ │ │ │ -   void reset_piece_deadline (piece_index_t index) const;
    │ │ │ │ -   std::vector<std::int64_t> file_progress (file_progress_flags_t flags = {}) const;
    │ │ │ │ -   void post_file_progress (file_progress_flags_t flags) const;
    │ │ │ │ -   void file_progress (std::vector<std::int64_t>& progress, file_progress_flags_t flags = {}) const;
    │ │ │ │ -   std::vector<open_file_state> file_status () const;
    │ │ │ │ -   void clear_error () const;
    │ │ │ │ -   void add_tracker (announce_entry const&) const;
    │ │ │ │ -   std::vector<announce_entry> trackers () const;
    │ │ │ │ -   void replace_trackers (std::vector<announce_entry> const&) const;
    │ │ │ │ -   void post_trackers () const;
    │ │ │ │ -   void remove_url_seed (std::string const& url) const;
    │ │ │ │ -   std::set<std::string> url_seeds () const;
    │ │ │ │ -   void add_url_seed (std::string const& url) const;
    │ │ │ │ -   void remove_http_seed (std::string const& url) const;
    │ │ │ │ -   void add_http_seed (std::string const& url) const;
    │ │ │ │ -   std::set<std::string> http_seeds () const;
    │ │ │ │ -   void add_extension (
    │ │ │ │ -      std::function<std::shared_ptr<torrent_plugin>(torrent_handle const&, client_data_t)> const& ext
    │ │ │ │ -      , client_data_t userdata = client_data_t{});
    │ │ │ │ -   bool set_metadata (span<char const> metadata) const;
    │ │ │ │ -   bool is_valid () const;
    │ │ │ │ -   void pause (pause_flags_t flags = {}) const;
    │ │ │ │ -   void resume () const;
    │ │ │ │ -   void set_flags (torrent_flags_t flags, torrent_flags_t mask) const;
    │ │ │ │ -   void set_flags (torrent_flags_t flags) const;
    │ │ │ │ -   torrent_flags_t flags () const;
    │ │ │ │ -   void unset_flags (torrent_flags_t flags) const;
    │ │ │ │ -   void flush_cache () const;
    │ │ │ │ -   void force_recheck () const;
    │ │ │ │ -   void save_resume_data (resume_data_flags_t flags = {}) const;
    │ │ │ │ -   bool need_save_resume_data (resume_data_flags_t flags) const;
    │ │ │ │ -   bool need_save_resume_data () const;
    │ │ │ │ -   queue_position_t queue_position () const;
    │ │ │ │ -   void queue_position_bottom () const;
    │ │ │ │ -   void queue_position_top () const;
    │ │ │ │ -   void queue_position_down () const;
    │ │ │ │ -   void queue_position_up () const;
    │ │ │ │ -   void queue_position_set (queue_position_t p) const;
    │ │ │ │ -   void set_ssl_certificate (std::string const& certificate
    │ │ │ │ -      , std::string const& private_key
    │ │ │ │ -      , std::string const& dh_params
    │ │ │ │ -      , std::string const& passphrase = "");
    │ │ │ │ -   void set_ssl_certificate_buffer (std::string const& certificate
    │ │ │ │ -      , std::string const& private_key
    │ │ │ │ -      , std::string const& dh_params);
    │ │ │ │ -   std::shared_ptr<const torrent_info> torrent_file () const;
    │ │ │ │ -   std::shared_ptr<torrent_info> torrent_file_with_hashes () const;
    │ │ │ │ -   std::vector<std::vector<sha256_hash>> piece_layers () const;
    │ │ │ │ -   void post_piece_availability () const;
    │ │ │ │ -   void piece_availability (std::vector<int>& avail) const;
    │ │ │ │ -   void prioritize_pieces (std::vector<download_priority_t> const& pieces) const;
    │ │ │ │ -   void piece_priority (piece_index_t index, download_priority_t priority) const;
    │ │ │ │ -   download_priority_t piece_priority (piece_index_t index) const;
    │ │ │ │ -   void prioritize_pieces (std::vector<std::pair<piece_index_t, download_priority_t>> const& pieces) const;
    │ │ │ │ -   std::vector<download_priority_t> get_piece_priorities () const;
    │ │ │ │ -   std::vector<download_priority_t> get_file_priorities () const;
    │ │ │ │ -   void file_priority (file_index_t index, download_priority_t priority) const;
    │ │ │ │ -   void prioritize_files (std::vector<download_priority_t> const& files) const;
    │ │ │ │ -   download_priority_t file_priority (file_index_t index) const;
    │ │ │ │ -   void force_dht_announce () const;
    │ │ │ │ -   void force_lsd_announce () const;
    │ │ │ │ -   void force_reannounce (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
    │ │ │ │ -   void scrape_tracker (int idx = -1) const;
    │ │ │ │ -   int download_limit () const;
    │ │ │ │ -   void set_upload_limit (int limit) const;
    │ │ │ │ -   void set_download_limit (int limit) const;
    │ │ │ │ -   int upload_limit () const;
    │ │ │ │ -   void connect_peer (tcp::endpoint const& adr, peer_source_flags_t source = {}
    │ │ │ │ -      , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const;
    │ │ │ │ -   void clear_peers ();
    │ │ │ │ -   void set_max_uploads (int max_uploads) const;
    │ │ │ │ -   int max_uploads () const;
    │ │ │ │ -   int max_connections () const;
    │ │ │ │ -   void set_max_connections (int max_connections) const;
    │ │ │ │ -   void move_storage (std::string const& save_path
    │ │ │ │ -      , move_flags_t flags = move_flags_t::always_replace_files
    │ │ │ │ -      ) const;
    │ │ │ │ -   void rename_file (file_index_t index, std::string const& new_name) const;
    │ │ │ │ -   sha1_hash info_hash () const;
    │ │ │ │ -   info_hash_t info_hashes () const;
    │ │ │ │ -   bool operator== (const torrent_handle& h) const;
    │ │ │ │ -   bool operator< (const torrent_handle& h) const;
    │ │ │ │ -   bool operator!= (const torrent_handle& h) const;
    │ │ │ │ -   std::uint32_t id () const;
    │ │ │ │ -   std::shared_ptr<torrent> native_handle () const;
    │ │ │ │ -   client_data_t userdata () const;
    │ │ │ │ -   bool in_session () const;
    │ │ │ │ -
    │ │ │ │ -   static constexpr add_piece_flags_t overwrite_existing  = 0_bit;
    │ │ │ │ -   static constexpr status_flags_t query_distributed_copies  = 0_bit;
    │ │ │ │ -   static constexpr status_flags_t query_accurate_download_counters  = 1_bit;
    │ │ │ │ -   static constexpr status_flags_t query_last_seen_complete  = 2_bit;
    │ │ │ │ -   static constexpr status_flags_t query_pieces  = 3_bit;
    │ │ │ │ -   static constexpr status_flags_t query_verified_pieces  = 4_bit;
    │ │ │ │ -   static constexpr status_flags_t query_torrent_file  = 5_bit;
    │ │ │ │ -   static constexpr status_flags_t query_name  = 6_bit;
    │ │ │ │ -   static constexpr status_flags_t query_save_path  = 7_bit;
    │ │ │ │ -   static constexpr deadline_flags_t alert_when_available  = 0_bit;
    │ │ │ │ -   static constexpr file_progress_flags_t piece_granularity  = 0_bit;
    │ │ │ │ -   static constexpr pause_flags_t graceful_pause  = 0_bit;
    │ │ │ │ -   static constexpr resume_data_flags_t flush_disk_cache  = 0_bit;
    │ │ │ │ -   static constexpr resume_data_flags_t save_info_dict  = 1_bit;
    │ │ │ │ -   static constexpr resume_data_flags_t only_if_modified  = 2_bit;
    │ │ │ │ -   static constexpr resume_data_flags_t if_counters_changed  = 3_bit;
    │ │ │ │ -   static constexpr resume_data_flags_t if_download_progress  = 4_bit;
    │ │ │ │ -   static constexpr resume_data_flags_t if_config_changed  = 5_bit;
    │ │ │ │ -   static constexpr resume_data_flags_t if_state_changed  = 6_bit;
    │ │ │ │ -   static constexpr resume_data_flags_t if_metadata_changed  = 7_bit;
    │ │ │ │ -   static constexpr reannounce_flags_t ignore_min_interval  = 0_bit;
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -

    torrent_handle()

    │ │ │ │ -
    │ │ │ │ -torrent_handle () noexcept = default;
    │ │ │ │ -
    │ │ │ │ -

    constructs a torrent handle that does not refer to a torrent. │ │ │ │ -i.e. is_valid() will return false.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_piece()

    │ │ │ │ -
    │ │ │ │ -void add_piece (piece_index_t piece, std::vector<char> data, add_piece_flags_t flags = {}) const;
    │ │ │ │ -void add_piece (piece_index_t piece, char const* data, add_piece_flags_t flags = {}) const;
    │ │ │ │ -
    │ │ │ │ -

    This function will write data to the storage as piece piece, │ │ │ │ -as if it had been downloaded from a peer.

    │ │ │ │ -

    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.

    │ │ │ │ -

    Since the data is written asynchronously, you may know that is passed │ │ │ │ -or failed the hash check by waiting for piece_finished_alert or │ │ │ │ -hash_failed_alert.

    │ │ │ │ -

    Adding pieces while the torrent is being checked (i.e. in │ │ │ │ -torrent_status::checking_files state) is not supported.

    │ │ │ │ -

    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. data is expected to point to a buffer of as │ │ │ │ -many bytes as the size of the specified piece. See │ │ │ │ -file_storage::piece_size().

    │ │ │ │ -

    The data in the buffer is copied and passed on to the disk IO thread │ │ │ │ -to be written at a later point.

    │ │ │ │ -

    The overload taking a std::vector<char> is not blocking, it will │ │ │ │ -send the buffer to the main thread and return immediately.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    read_piece()

    │ │ │ │ -
    │ │ │ │ -void read_piece (piece_index_t piece) const;
    │ │ │ │ -
    │ │ │ │ -

    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.

    │ │ │ │ -

    When the read operation is completed, it is passed back through an │ │ │ │ -alert, read_piece_alert. Since this alert is a response to an explicit │ │ │ │ -call, it will always be posted, regardless of the alert mask.

    │ │ │ │ -

    Note that if you read multiple pieces, the read operations are not │ │ │ │ -guaranteed to finish in the same order as you initiated them.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    have_piece()

    │ │ │ │ -
    │ │ │ │ -bool have_piece (piece_index_t piece) const;
    │ │ │ │ -
    │ │ │ │ -

    Returns true if this piece has been completely downloaded and written │ │ │ │ -to disk, and false otherwise.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    get_peer_info() post_peer_info()

    │ │ │ │ -
    │ │ │ │ -void post_peer_info () const;
    │ │ │ │ -void get_peer_info (std::vector<peer_info>& v) const;
    │ │ │ │ -
    │ │ │ │ -

    Query information about connected peers for this torrent. If the │ │ │ │ -torrent_handle is invalid, it will throw a system_error exception.

    │ │ │ │ -

    post_peer_info() is asynchronous and will trigger the posting of │ │ │ │ -a peer_info_alert. The alert contain a list of peer_info 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 entry for each peer │ │ │ │ -connected to this torrent, given the handle is valid. Each entry in │ │ │ │ -the vector contains information about that particular peer. See │ │ │ │ -peer_info.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    post_status() status()

    │ │ │ │ -
    │ │ │ │ -void post_status (status_flags_t flags = status_flags_t::all()) const;
    │ │ │ │ -torrent_status status (status_flags_t flags = status_flags_t::all()) const;
    │ │ │ │ -
    │ │ │ │ -

    status() will return a structure with information about the status │ │ │ │ -of this torrent. If the torrent_handle is invalid, it will throw │ │ │ │ -system_error exception. See torrent_status. The flags │ │ │ │ -argument filters what information is returned in the torrent_status. │ │ │ │ -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.

    │ │ │ │ -

    The status() function will block until the internal libtorrent │ │ │ │ -thread responds with the torrent_status object. To avoid blocking, │ │ │ │ -instead call post_status(). It will trigger posting of a │ │ │ │ -state_update_alert with a single torrent_status 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 include are defined in this class.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    post_download_queue() get_download_queue()

    │ │ │ │ -
    │ │ │ │ -void post_download_queue () const;
    │ │ │ │ -std::vector<partial_piece_info> get_download_queue () const;
    │ │ │ │ -void get_download_queue (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 partial_piece_info for the │ │ │ │ -fields in the returned vector.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    reset_piece_deadline() set_piece_deadline() clear_piece_deadlines()

    │ │ │ │ -
    │ │ │ │ -void clear_piece_deadlines () const;
    │ │ │ │ -void set_piece_deadline (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;
    │ │ │ │ -void reset_piece_deadline (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, unless the alert_when_available flag is set, in which case it │ │ │ │ -will have the same effect as calling read_piece() 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 reset_piece_deadline() was called on all pieces.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    post_file_progress() file_progress()

    │ │ │ │ -
    │ │ │ │ -std::vector<std::int64_t> file_progress (file_progress_flags_t flags = {}) const;
    │ │ │ │ -void post_file_progress (file_progress_flags_t flags) const;
    │ │ │ │ -void file_progress (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 │ │ │ │ -torrent_info.

    │ │ │ │ -

    This operation is not very cheap. Its complexity is O(n + mj). │ │ │ │ -Where n is the number of files, m is the number of currently │ │ │ │ -downloading pieces and j is the number of blocks in a piece.

    │ │ │ │ -

    The flags 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 │ │ │ │ -torrent_handle::piece_granularity 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    file_status()

    │ │ │ │ -
    │ │ │ │ -std::vector<open_file_state> file_status () const;
    │ │ │ │ -
    │ │ │ │ -

    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.

    │ │ │ │ -

    See open_file_state

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    clear_error()

    │ │ │ │ -
    │ │ │ │ -void clear_error () 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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    trackers() post_trackers() replace_trackers() add_tracker()

    │ │ │ │ -
    │ │ │ │ -void add_tracker (announce_entry const&) const;
    │ │ │ │ -std::vector<announce_entry> trackers () const;
    │ │ │ │ -void replace_trackers (std::vector<announce_entry> const&) const;
    │ │ │ │ -void post_trackers () const;
    │ │ │ │ -
    │ │ │ │ -

    trackers() returns the list of trackers for this torrent. The │ │ │ │ -announce entry contains both a string url which specify the │ │ │ │ -announce url for the tracker as well as an int 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, 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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    url_seeds() add_url_seed() remove_url_seed()

    │ │ │ │ -
    │ │ │ │ -void remove_url_seed (std::string const& url) const;
    │ │ │ │ -std::set<std::string> url_seeds () const;
    │ │ │ │ -void add_url_seed (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 http seeding for more information.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    http_seeds() add_http_seed() remove_http_seed()

    │ │ │ │ -
    │ │ │ │ -void remove_http_seed (std::string const& url) const;
    │ │ │ │ -void add_http_seed (std::string const& url) const;
    │ │ │ │ -std::set<std::string> http_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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    add_extension()

    │ │ │ │ -
    │ │ │ │ -void add_extension (
    │ │ │ │ -      std::function<std::shared_ptr<torrent_plugin>(torrent_handle const&, client_data_t)> const& ext
    │ │ │ │ -      , client_data_t userdata = client_data_t{});
    │ │ │ │ -
    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_metadata()

    │ │ │ │ -
    │ │ │ │ -bool set_metadata (span<char const> metadata) const;
    │ │ │ │ -
    │ │ │ │ -

    set_metadata expects the info section of metadata. i.e. The │ │ │ │ -buffer passed in will be hashed and verified against the info-hash. If │ │ │ │ -it fails, a metadata_failed_alert will be generated. If it passes, │ │ │ │ -a metadata_received_alert 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    is_valid()

    │ │ │ │ -
    │ │ │ │ -bool is_valid () const;
    │ │ │ │ -
    │ │ │ │ -

    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 session AND destructed.

    │ │ │ │ -

    To tell if the torrent_handle is in the session, use │ │ │ │ -torrent_handle::in_session(). This will return true before │ │ │ │ -session_handle::remove_torrent() is called, and false │ │ │ │ -afterward.

    │ │ │ │ -

    Clients should only use is_valid() to determine if the result of │ │ │ │ -session::find_torrent() was successful.

    │ │ │ │ -

    Unlike other member functions which return a value, is_valid() │ │ │ │ -completes immediately, without blocking on a result from the │ │ │ │ -network thread. Also unlike other functions, it never throws │ │ │ │ -the system_error exception.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    resume() pause()

    │ │ │ │ -
    │ │ │ │ -void pause (pause_flags_t flags = {}) const;
    │ │ │ │ -void resume () 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 │ │ │ │ -file_error_alert.

    │ │ │ │ -

    For possible values of the flags parameter, see pause_flags_t.

    │ │ │ │ -

    To know if a torrent is paused or not, call │ │ │ │ -torrent_handle::flags() and check 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 session. For more information, see queuing.

    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    flags() set_flags() unset_flags()

    │ │ │ │ -
    │ │ │ │ -void set_flags (torrent_flags_t flags, torrent_flags_t mask) const;
    │ │ │ │ -void set_flags (torrent_flags_t flags) const;
    │ │ │ │ -torrent_flags_t flags () const;
    │ │ │ │ -void unset_flags (torrent_flags_t flags) const;
    │ │ │ │ -
    │ │ │ │ -

    sets and gets the torrent state flags. See torrent_flags_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.

    │ │ │ │ -

    The seed_mode flag is special, it can only be cleared once the │ │ │ │ -torrent has been added, and it can only be set as part of the │ │ │ │ -add_torrent_params flags, when adding the torrent.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    flush_cache()

    │ │ │ │ -
    │ │ │ │ -void flush_cache () const;
    │ │ │ │ -
    │ │ │ │ -

    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 cache_flushed_alert.

    │ │ │ │ -

    Note that by the time you get the alert, libtorrent may have cached │ │ │ │ -more data for the torrent, but you are guaranteed that whatever cached │ │ │ │ -data libtorrent had by the time you called │ │ │ │ -torrent_handle::flush_cache() has been written to disk.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    force_recheck()

    │ │ │ │ -
    │ │ │ │ -void force_recheck () const;
    │ │ │ │ -
    │ │ │ │ -

    force_recheck 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 session.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    save_resume_data()

    │ │ │ │ -
    │ │ │ │ -void save_resume_data (resume_data_flags_t flags = {}) const;
    │ │ │ │ -
    │ │ │ │ -

    save_resume_data() asks libtorrent to generate fast-resume data for │ │ │ │ -this torrent. The fast resume data (stored in an add_torrent_params │ │ │ │ -object) can be used to resume a torrent in the next session without │ │ │ │ -having to check all files for which pieces have been downloaded. It │ │ │ │ -can also be used to save a .torrent file for a torrent_handle.

    │ │ │ │ -

    This operation is asynchronous, save_resume_data will return │ │ │ │ -immediately. The resume data is delivered when it's done through a │ │ │ │ -save_resume_data_alert.

    │ │ │ │ -

    The operation will fail, and post a save_resume_data_failed_alert │ │ │ │ -instead, in the following cases:

    │ │ │ │ -
    │ │ │ │ -
      │ │ │ │ -
    1. The torrent is in the process of being removed.
    2. │ │ │ │ -
    3. No torrent state has changed since the last saving of resume │ │ │ │ -data, and the only_if_modified flag is set. │ │ │ │ -metadata (see libtorrent's metadata from peers extension)
    4. │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    Note that some counters may be outdated by the time you receive the fast resume data

    │ │ │ │ -

    When saving resume data because of shutting down, make sure not to │ │ │ │ -remove_torrent() before you receive the save_resume_data_alert. │ │ │ │ -There's no need to pause the session or torrent when saving resume │ │ │ │ -data.

    │ │ │ │ -

    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.

    │ │ │ │ -
    │ │ │ │ -

    Note

    │ │ │ │ -

    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.

    │ │ │ │ -
    │ │ │ │ -

    Example code to pause and save resume data for all torrents and wait │ │ │ │ -for the alerts:

    │ │ │ │ -
    │ │ │ │ -extern int outstanding_resume_data; // global counter of outstanding resume data
    │ │ │ │ -std::vector<torrent_handle> handles = ses.get_torrents();
    │ │ │ │ -for (torrent_handle const& h : handles) try
    │ │ │ │ -{
    │ │ │ │ -        h.save_resume_data(torrent_handle::only_if_modified);
    │ │ │ │ -        ++outstanding_resume_data;
    │ │ │ │ -}
    │ │ │ │ -catch (lt::system_error const& e)
    │ │ │ │ -{
    │ │ │ │ -        // the handle was invalid, ignore this one and move to the next
    │ │ │ │ -}
    │ │ │ │ -
    │ │ │ │ -while (outstanding_resume_data > 0)
    │ │ │ │ -{
    │ │ │ │ -        alert const* a = ses.wait_for_alert(seconds(30));
    │ │ │ │ -
    │ │ │ │ -        // if we don't get an alert within 30 seconds, abort
    │ │ │ │ -        if (a == nullptr) break;
    │ │ │ │ -
    │ │ │ │ -        std::vector<alert*> alerts;
    │ │ │ │ -        ses.pop_alerts(&alerts);
    │ │ │ │ -
    │ │ │ │ -        for (alert* i : alerts)
    │ │ │ │ -        {
    │ │ │ │ -                if (alert_cast<save_resume_data_failed_alert>(i))
    │ │ │ │ -                {
    │ │ │ │ -                        process_alert(i);
    │ │ │ │ -                        --outstanding_resume_data;
    │ │ │ │ -                        continue;
    │ │ │ │ -                }
    │ │ │ │ -
    │ │ │ │ -                save_resume_data_alert const* rd = alert_cast<save_resume_data_alert>(i);
    │ │ │ │ -                if (rd == nullptr)
    │ │ │ │ -                {
    │ │ │ │ -                        process_alert(i);
    │ │ │ │ -                        continue;
    │ │ │ │ -                }
    │ │ │ │ -
    │ │ │ │ -                std::ofstream out((rd->params.save_path
    │ │ │ │ -                        + "/" + rd->params.name + ".fastresume").c_str()
    │ │ │ │ -                        , std::ios_base::binary);
    │ │ │ │ -                std::vector<char> buf = write_resume_data_buf(rd->params);
    │ │ │ │ -                out.write(buf.data(), buf.size());
    │ │ │ │ -                --outstanding_resume_data;
    │ │ │ │ -        }
    │ │ │ │ -}
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    Note

    │ │ │ │ -

    Note how outstanding_resume_data 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 alert, 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.

    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    need_save_resume_data()

    │ │ │ │ -
    │ │ │ │ -bool need_save_resume_data (resume_data_flags_t flags) const;
    │ │ │ │ -bool need_save_resume_data () const;
    │ │ │ │ -
    │ │ │ │ -

    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 flags let you ask if specific categories │ │ │ │ -of properties have changed. These flags have the same behavior as in │ │ │ │ -the save_resume_data() call.

    │ │ │ │ -

    This is a blocking call. It will wait for a response from │ │ │ │ -libtorrent's main thread. A way to avoid blocking is to instead │ │ │ │ -call save_resume_data() directly, specifying the conditions under │ │ │ │ -which resume data should be saved.

    │ │ │ │ -
    │ │ │ │ -

    Note

    │ │ │ │ -

    A torrent's resume data is considered saved as soon as the │ │ │ │ -save_resume_data_alert is posted. It is important to make sure this │ │ │ │ -alert is received and handled in order for this function to be │ │ │ │ -meaningful.

    │ │ │ │ -
    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    queue_position() queue_position_up() queue_position_bottom() queue_position_top() queue_position_down()

    │ │ │ │ -
    │ │ │ │ -queue_position_t queue_position () const;
    │ │ │ │ -void queue_position_bottom () const;
    │ │ │ │ -void queue_position_top () const;
    │ │ │ │ -void queue_position_down () const;
    │ │ │ │ -void queue_position_up () 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 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.

    │ │ │ │ -

    The queue position is also available in the torrent_status.

    │ │ │ │ -

    The queue_position_*() 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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    queue_position_set()

    │ │ │ │ -
    │ │ │ │ -void queue_position_set (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

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    set_ssl_certificate_buffer() set_ssl_certificate()

    │ │ │ │ -
    │ │ │ │ -void set_ssl_certificate (std::string const& certificate
    │ │ │ │ -      , std::string const& private_key
    │ │ │ │ -      , std::string const& dh_params
    │ │ │ │ -      , std::string const& passphrase = "");
    │ │ │ │ -void set_ssl_certificate_buffer (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 set_ssl_certificate_buffer() 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.

    │ │ │ │ -

    private_key is a path to the private key for the specified │ │ │ │ -certificate. This must be in .pem format.

    │ │ │ │ -

    dh_params 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: openssl dhparam -outform PEM -out │ │ │ │ -dhparams.pem 512.

    │ │ │ │ -

    passphrase may be specified if the private key is encrypted and │ │ │ │ -requires a passphrase to be decrypted.

    │ │ │ │ -

    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 torrent_need_cert_alert, 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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    torrent_file() torrent_file_with_hashes()

    │ │ │ │ -
    │ │ │ │ -std::shared_ptr<const torrent_info> torrent_file () const;
    │ │ │ │ -std::shared_ptr<torrent_info> torrent_file_with_hashes () const;
    │ │ │ │ -
    │ │ │ │ -

    torrent_file() returns a pointer to the torrent_info object │ │ │ │ -associated with this torrent. The torrent_info 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 torrent_info object returned here may be a different │ │ │ │ -instance than the one added to the session, with different attributes │ │ │ │ -like piece layers, dht nodes and trackers. A torrent_info object does │ │ │ │ -not round-trip cleanly when added to a session.

    │ │ │ │ -

    If you want to save a .torrent file from the torrent_handle, instead │ │ │ │ -call save_resume_data() and write_torrent_file() the │ │ │ │ -add_torrent_params object passed back in the alert.

    │ │ │ │ -

    torrent_file_with_hashes() returns a copy of the internal │ │ │ │ -torrent_info 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 │ │ │ │ -torrent_file() since it needs to make copies of this information.

    │ │ │ │ -

    The torrent_file_with_hashes() is here for backwards compatibility │ │ │ │ -when constructing a create_torrent object from a torrent_info that's │ │ │ │ -in a session. Prefer save_resume_data() + write_torrent_file().

    │ │ │ │ -

    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 torrent_info returned from torrent_file_with_hashes(). Once the │ │ │ │ -torrent completes downloading all files, becoming a seed, you can │ │ │ │ -make a .torrent file from it.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    piece_layers()

    │ │ │ │ -
    │ │ │ │ -std::vector<std::vector<sha256_hash>> piece_layers () 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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    post_piece_availability() piece_availability()

    │ │ │ │ -
    │ │ │ │ -void post_piece_availability () const;
    │ │ │ │ -void piece_availability (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 piece_availability_alert │ │ │ │ -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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    piece_priority() get_piece_priorities() prioritize_pieces()

    │ │ │ │ -
    │ │ │ │ -void prioritize_pieces (std::vector<download_priority_t> const& pieces) const;
    │ │ │ │ -void piece_priority (piece_index_t index, download_priority_t priority) const;
    │ │ │ │ -download_priority_t piece_priority (piece_index_t index) const;
    │ │ │ │ -void prioritize_pieces (std::vector<std::pair<piece_index_t, download_priority_t>> const& pieces) const;
    │ │ │ │ -std::vector<download_priority_t> get_piece_priorities () 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 and so on.

    │ │ │ │ -

    The default priority of pieces is 4.

    │ │ │ │ -

    Piece priorities can not be changed for torrents that have not │ │ │ │ -downloaded the metadata yet. Magnet links won't have metadata │ │ │ │ -immediately. see the metadata_received_alert.

    │ │ │ │ -

    piece_priority sets or gets the priority for an individual piece, │ │ │ │ -specified by index.

    │ │ │ │ -

    prioritize_pieces 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 prioritize_pieces 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.

    │ │ │ │ -

    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 file priorities by setting the │ │ │ │ -priorities for the affected pieces. Care has to be taken when mixing │ │ │ │ -usage of file- and piece priorities.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    prioritize_files() file_priority() get_file_priorities()

    │ │ │ │ -
    │ │ │ │ -std::vector<download_priority_t> get_file_priorities () const;
    │ │ │ │ -void file_priority (file_index_t index, download_priority_t priority) const;
    │ │ │ │ -void prioritize_files (std::vector<download_priority_t> const& files) const;
    │ │ │ │ -download_priority_t file_priority (file_index_t index) 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 entry 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 piece_priority(). See │ │ │ │ -download_priority_t.

    │ │ │ │ -

    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, piece_priority() has to be called │ │ │ │ -again for those pieces.

    │ │ │ │ -

    You cannot set the file priorities on a torrent that does not yet have │ │ │ │ -metadata or a torrent that is a seed. file_priority(int, int) and │ │ │ │ -prioritize_files() are both no-ops for such torrents.

    │ │ │ │ -

    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 │ │ │ │ -file_prio_alert.

    │ │ │ │ -

    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 after it has already │ │ │ │ -been created, it will not be moved into the partfile.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    force_lsd_announce() force_reannounce() force_dht_announce()

    │ │ │ │ -
    │ │ │ │ -void force_dht_announce () const;
    │ │ │ │ -void force_lsd_announce () const;
    │ │ │ │ -void force_reannounce (int seconds = 0, int idx = -1, reannounce_flags_t = {}) 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 -1 (which is the default), all trackers are re-announce.

    │ │ │ │ -

    The flags argument can be used to affect the re-announce. See │ │ │ │ -ignore_min_interval.

    │ │ │ │ -

    force_dht_announce will announce the torrent to the DHT │ │ │ │ -immediately.

    │ │ │ │ -

    force_lsd_announce will announce the torrent on LSD │ │ │ │ -immediately.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    scrape_tracker()

    │ │ │ │ -
    │ │ │ │ -void scrape_tracker (int idx = -1) const;
    │ │ │ │ -
    │ │ │ │ -

    scrape_tracker() will send a scrape request to a tracker. By │ │ │ │ -default (idx = -1) it will scrape the last working tracker. If │ │ │ │ -idx is >= 0, the tracker with the specified index will scraped.

    │ │ │ │ -

    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 torrent_status struct once it │ │ │ │ -completes. When it completes, it will generate a scrape_reply_alert. │ │ │ │ -If it fails, it will generate a scrape_failed_alert.

    │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    upload_limit() download_limit() set_download_limit() set_upload_limit()

    │ │ │ │ -
    │ │ │ │ -int download_limit () const;
    │ │ │ │ -void set_upload_limit (int limit) const;
    │ │ │ │ -void set_download_limit (int limit) const;
    │ │ │ │ -int upload_limit () 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.

    │ │ │ │ -

    upload_limit and download_limit will return the current limit │ │ │ │ -setting, for upload and download, respectively.

    │ │ │ │ -

    Local peers are not rate limited by default. see peer classes.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    connect_peer()

    │ │ │ │ -
    │ │ │ │ -void connect_peer (tcp::endpoint const& adr, peer_source_flags_t source = {}
    │ │ │ │ -      , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const;
    │ │ │ │ -
    │ │ │ │ -

    connect_peer() 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 peer_info. i.e. │ │ │ │ -tracker, pex, dht etc.

    │ │ │ │ -

    For possible values of flags, see pex_flags_t.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    clear_peers()

    │ │ │ │ -
    │ │ │ │ -void clear_peers ();
    │ │ │ │ -
    │ │ │ │ -

    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.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    max_uploads() set_max_uploads()

    │ │ │ │ -
    │ │ │ │ -void set_max_uploads (int max_uploads) const;
    │ │ │ │ -int max_uploads () const;
    │ │ │ │ -
    │ │ │ │ -

    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 │ │ │ │ -settings_pack.

    │ │ │ │ -

    max_uploads() returns the current settings.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    max_connections() set_max_connections()

    │ │ │ │ -
    │ │ │ │ -int max_connections () const;
    │ │ │ │ -void set_max_connections (int max_connections) 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 settings_pack.

    │ │ │ │ -

    max_connections() returns the current settings.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    move_storage()

    │ │ │ │ -
    │ │ │ │ -void move_storage (std::string const& save_path
    │ │ │ │ -      , move_flags_t flags = move_flags_t::always_replace_files
    │ │ │ │ -      ) const;
    │ │ │ │ -
    │ │ │ │ -

    Moves the file(s) that this torrent are currently seeding from or │ │ │ │ -downloading to. If the given save_path 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.

    │ │ │ │ -

    Since disk IO is performed in a separate thread, this operation is │ │ │ │ -also asynchronous. Once the operation completes, the │ │ │ │ -storage_moved_alert is generated, with the new path as the │ │ │ │ -message. If the move fails for some reason, │ │ │ │ -storage_moved_failed_alert is generated instead, containing the │ │ │ │ -error message.

    │ │ │ │ -

    The flags argument determines the behavior of the copying/moving │ │ │ │ -of the files in the torrent. see move_flags_t.

    │ │ │ │ -

    always_replace_files is the default and replaces any file that │ │ │ │ -exist in both the source directory and the target directory.

    │ │ │ │ -

    fail_if_exist 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 always_replace_files 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 error of │ │ │ │ -move_storage_failed_alert is set to │ │ │ │ -boost::system::errc::file_exists.

    │ │ │ │ -

    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 move_storage call with one of the other modes.

    │ │ │ │ -

    dont_replace 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.

    │ │ │ │ -

    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.

    │ │ │ │ -

    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.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    rename_file()

    │ │ │ │ -
    │ │ │ │ -void rename_file (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 file_renamed_alert or │ │ │ │ -file_rename_failed_alert is posted.

    │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    info_hash() info_hashes()

    │ │ │ │ -
    │ │ │ │ -sha1_hash info_hash () const;
    │ │ │ │ -info_hash_t info_hashes () 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.

    │ │ │ │ - │ │ │ │ - │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    operator==() operator!=() operator<()

    │ │ │ │ -
    │ │ │ │ -bool operator== (const torrent_handle& h) const;
    │ │ │ │ -bool operator< (const torrent_handle& h) const;
    │ │ │ │ -bool operator!= (const torrent_handle& h) const;
    │ │ │ │ -
    │ │ │ │ -

    comparison operators. The order of the torrents is unspecified │ │ │ │ -but stable.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    id()

    │ │ │ │ -
    │ │ │ │ -std::uint32_t id () const;
    │ │ │ │ -
    │ │ │ │ -

    returns a unique identifier for this torrent. It's not a dense index. │ │ │ │ -It's not preserved across sessions.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    native_handle()

    │ │ │ │ -
    │ │ │ │ -std::shared_ptr<torrent> native_handle () const;
    │ │ │ │ -
    │ │ │ │ -

    This function is intended only for use by plugins and the alert │ │ │ │ -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 plugin callbacks). │ │ │ │ -The torrent 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 TORRENT_ macros must match between libtorrent and the │ │ │ │ -client builds.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    userdata()

    │ │ │ │ -
    │ │ │ │ -client_data_t userdata () const;
    │ │ │ │ -
    │ │ │ │ -

    returns the userdata pointer as set in add_torrent_params

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    in_session()

    │ │ │ │ -
    │ │ │ │ -bool in_session () const;
    │ │ │ │ -
    │ │ │ │ -

    Returns true if the torrent is in the session. It returns true before │ │ │ │ -session::remove_torrent() is called, and false afterward.

    │ │ │ │ -

    Note that this is a blocking function, unlike torrent_handle::is_valid() │ │ │ │ -which returns immediately.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    overwrite_existing
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    query_distributed_copies
    │ │ │ │ -
    calculates distributed_copies, distributed_full_copies and │ │ │ │ -distributed_fraction.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    query_accurate_download_counters
    │ │ │ │ -
    includes partial downloaded blocks in total_done and │ │ │ │ -total_wanted_done.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    query_last_seen_complete
    │ │ │ │ -
    includes last_seen_complete.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    query_pieces
    │ │ │ │ -
    populate the pieces field in torrent_status.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    query_verified_pieces
    │ │ │ │ -
    includes verified_pieces (only applies to torrents in seed │ │ │ │ -mode).
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    query_torrent_file
    │ │ │ │ -
    includes torrent_file, which is all the static information from │ │ │ │ -the .torrent file.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    query_name
    │ │ │ │ -
    includes name, the name of the torrent. This is either derived │ │ │ │ -from the .torrent file, or from the &dn= magnet link argument │ │ │ │ -or possibly some other source. If the name of the torrent is not │ │ │ │ -known, this is an empty string.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    query_save_path
    │ │ │ │ -
    includes save_path, the path to the directory the files of the │ │ │ │ -torrent are saved to.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    alert_when_available
    │ │ │ │ -
    used to ask libtorrent to send an alert once the piece has been │ │ │ │ -downloaded, by passing alert_when_available. When set, the │ │ │ │ -read_piece_alert alert will be delivered, with the piece data, when │ │ │ │ -it's downloaded.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    piece_granularity
    │ │ │ │ -
    only calculate file progress at piece granularity. This makes │ │ │ │ -the file_progress() call cheaper and also only takes bytes that │ │ │ │ -have passed the hash check into account, so progress cannot │ │ │ │ -regress in this mode.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    graceful_pause
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    flush_disk_cache
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    save_info_dict
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    only_if_modified
    │ │ │ │ -
    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
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    if_counters_changed
    │ │ │ │ -
    save resume data if any counters has changed since the last time │ │ │ │ -resume data was saved. This includes upload/download counters, active │ │ │ │ -time counters and scrape data. A torrent that is not paused will have │ │ │ │ -its active time counters incremented continuously.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    if_download_progress
    │ │ │ │ -
    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
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    if_config_changed
    │ │ │ │ -
    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)
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    if_state_changed
    │ │ │ │ -
    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
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    if_metadata_changed
    │ │ │ │ -
    save the resume data if any metadata changed since the last time │ │ │ │ -resume data was saved. This includes: │ │ │ │ -* add/remove web seeds │ │ │ │ -* add/remove trackers │ │ │ │ -* receiving metadata for a magnet link
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    ignore_min_interval
    │ │ │ │ -
    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.
    │ │ │ │ -
    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -

    hash_value()

    │ │ │ │ -

    Declared in "libtorrent/torrent_handle.hpp"

    │ │ │ │ -
    │ │ │ │ -std::size_t hash_value (torrent_handle const& h);
    │ │ │ │ -
    │ │ │ │ -

    for std::hash (and to support using this type in unordered_map etc.)

    │ │ │ │ [report issue]
    │ │ │ │ +
    │ │ │ │
    │ │ │ │

    dht_storage_counters

    │ │ │ │

    Declared in "libtorrent/kademlia/dht_storage.hpp"

    │ │ │ │

    This structure hold the relevant counters for the storage

    │ │ │ │
    │ │ │ │  struct dht_storage_counters
    │ │ │ │  {
    │ │ │ │ @@ -20335,14 +20335,25 @@
    │ │ │ │  
    nodes
    │ │ │ │
    the bootstrap nodes saved from the buckets node
    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    nodes6
    │ │ │ │
    the bootstrap nodes saved from the IPv6 buckets node
    │ │ │ │
    │ │ │ │ +[report issue]
    │ │ │ │ +
    │ │ │ │ +

    dht_default_storage_constructor()

    │ │ │ │ +

    Declared in "libtorrent/kademlia/dht_storage.hpp"

    │ │ │ │ +
    │ │ │ │ +std::unique_ptr<dht_storage_interface> dht_default_storage_constructor (
    │ │ │ │ +   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.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    sign_mutable_item()

    │ │ │ │

    Declared in "libtorrent/kademlia/item.hpp"

    │ │ │ │
    │ │ │ │  signature sign_mutable_item (
    │ │ │ │     span<char const> v
    │ │ │ │ @@ -20353,25 +20364,14 @@
    │ │ │ │  
    │ │ │ │

    given a byte range v and an optional byte range salt, a │ │ │ │ sequence number, public key pk (must be 32 bytes) and a secret key │ │ │ │ sk (must be 64 bytes), this function produces a signature which │ │ │ │ is written into a 64 byte buffer pointed to by sig. The caller │ │ │ │ is responsible for allocating the destination buffer that's passed in │ │ │ │ as the sig argument. Typically it would be allocated on the stack.

    │ │ │ │ -[report issue]
    │ │ │ │ -
    │ │ │ │ -

    dht_default_storage_constructor()

    │ │ │ │ -

    Declared in "libtorrent/kademlia/dht_storage.hpp"

    │ │ │ │ -
    │ │ │ │ -std::unique_ptr<dht_storage_interface> dht_default_storage_constructor (
    │ │ │ │ -   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.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    announce_flags_t

    │ │ │ │

    Declared in "libtorrent/kademlia/announce_flags.hpp"

    │ │ │ │
    │ │ │ │
    seed
    │ │ │ │
    announce to DHT as a seed
    │ │ │ │ @@ -20388,16 +20388,16 @@ │ │ │ │
    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    write_resume_data() write_resume_data_buf()

    │ │ │ │

    Declared in "libtorrent/write_resume_data.hpp"

    │ │ │ │
    │ │ │ │ -std::vector<char> write_resume_data_buf (add_torrent_params const& atp);
    │ │ │ │  entry write_resume_data (add_torrent_params const& atp);
    │ │ │ │ +std::vector<char> write_resume_data_buf (add_torrent_params const& atp);
    │ │ │ │  
    │ │ │ │

    this function turns the resume data in an add_torrent_params object │ │ │ │ into a bencoded structure

    │ │ │ │ │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    write_torrent_file() write_torrent_file_buf()

    │ │ │ │ @@ -20420,21 +20420,21 @@ │ │ │ │ flexibility to add custom fields.

    │ │ │ │ [report issue]
    │ │ │ │
    │ │ │ │

    read_resume_data()

    │ │ │ │

    Declared in "libtorrent/read_resume_data.hpp"

    │ │ │ │
    │ │ │ │  add_torrent_params read_resume_data (span<char const> buffer
    │ │ │ │ +   , error_code& ec, load_torrent_limits const& cfg = {});
    │ │ │ │ +add_torrent_params read_resume_data (span<char const> buffer
    │ │ │ │     , load_torrent_limits const& cfg = {});
    │ │ │ │  add_torrent_params read_resume_data (bdecode_node const& rd
    │ │ │ │ -   , int piece_limit = 0x200000);
    │ │ │ │ -add_torrent_params read_resume_data (bdecode_node const& rd
    │ │ │ │     , error_code& ec, int piece_limit = 0x200000);
    │ │ │ │ -add_torrent_params read_resume_data (span<char const> buffer
    │ │ │ │ -   , error_code& ec, load_torrent_limits const& cfg = {});
    │ │ │ │ +add_torrent_params read_resume_data (bdecode_node const& rd
    │ │ │ │ +   , int piece_limit = 0x200000);
    │ │ │ │  
    │ │ │ │

    these functions are used to parse resume data and populate the appropriate │ │ │ │ fields in an add_torrent_params object. This object can then be used to add │ │ │ │ the actual torrent_info 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 │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,245 +1,87 @@ │ │ │ │ │ > │ │ │ │ │ _[_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_(_)_ _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 │ │ │ │ │ - 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 _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_(_)_ _p_a_u_s_e_(_)_ _i_s___p_a_u_s_e_d_(_) │ │ │ │ │ - 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___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_e_t___p_e_e_r___c_l_a_s_s___f_i_l_t_e_r_(_)_ _g_e_t___p_e_e_r___c_l_a_s_s___f_i_l_t_e_r_(_) │ │ │ │ │ - o _g_e_t___p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r_(_)_ _s_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 _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_(_)_ _p_o_p___a_l_e_r_t_s_(_) │ │ │ │ │ - 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_(_) │ │ │ │ │ - * _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_(_)_ _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s___b_u_f_(_) │ │ │ │ │ - * _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_(_) │ │ │ │ │ - * _p_e_e_r___i_n_f_o │ │ │ │ │ - o _i_2_p___d_e_s_t_i_n_a_t_i_o_n_(_) │ │ │ │ │ - * _p_i_e_c_e___b_l_o_c_k │ │ │ │ │ - * _p_e_e_r___r_e_q_u_e_s_t │ │ │ │ │ - o _o_p_e_r_a_t_o_r_=_=_(_) │ │ │ │ │ - * _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_(_) │ │ │ │ │ - * _v_e_r_s_i_o_n_(_) │ │ │ │ │ - * _t_o_r_r_e_n_t___p_e_e_r___e_q_u_a_l_(_) │ │ │ │ │ - * _e_n_u_m_ _p_r_o_t_o_c_o_l___v_e_r_s_i_o_n │ │ │ │ │ - * _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 │ │ │ │ │ - * _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 │ │ │ │ │ - * _d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y___t │ │ │ │ │ - * _p_e_x___f_l_a_g_s___t │ │ │ │ │ - * _i_n_t │ │ │ │ │ - * _t_o_r_r_e_n_t___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 │ │ │ │ │ - * _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 _c_o_n_s_t_*_(_)_ _v_o_i_d_*_(_)_ _o_p_e_r_a_t_o_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 │ │ │ │ │ - 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 │ │ │ │ │ - * _d_i_s_k___o_b_s_e_r_v_e_r │ │ │ │ │ - o _o_n___d_i_s_k_(_) │ │ │ │ │ - * _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_(_) │ │ │ │ │ + * _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_(_) │ │ │ │ │ - * _f_i_l_e___o_p_e_n___m_o_d_e___t │ │ │ │ │ - * _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 _o_r_i_g___f_i_l_e_s_(_)_ _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 _c_l_e_a_r___t_r_a_c_k_e_r_s_(_)_ _t_r_a_c_k_e_r_s_(_)_ _a_d_d___t_r_a_c_k_e_r_(_) │ │ │ │ │ - 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 _w_e_b___s_e_e_d_s_(_)_ _a_d_d___u_r_l___s_e_e_d_(_)_ _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 _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_(_)_ _e_n_d___p_i_e_c_e_(_)_ _p_i_e_c_e___r_a_n_g_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 _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_(_) │ │ │ │ │ - o _p_i_e_c_e___s_i_z_e_(_) │ │ │ │ │ - o _h_a_s_h___f_o_r___p_i_e_c_e_(_)_ _h_a_s_h___f_o_r___p_i_e_c_e___p_t_r_(_) │ │ │ │ │ - o _n_a_m_e_(_) │ │ │ │ │ - o _c_r_e_a_t_i_o_n___d_a_t_e_(_) │ │ │ │ │ - o _c_r_e_a_t_o_r_(_) │ │ │ │ │ - o _c_o_m_m_e_n_t_(_) │ │ │ │ │ - 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_(_) │ │ │ │ │ - * _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 _n_o_n___o_w_n_i_n_g_(_) │ │ │ │ │ + o _d_a_t_a___o_f_f_s_e_t_(_)_ _d_a_t_a___s_e_c_t_i_o_n_(_) │ │ │ │ │ + o _l_i_s_t___i_n_t___v_a_l_u_e___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___a_t_(_) │ │ │ │ │ + o _d_i_c_t___a_t___n_o_d_e_(_)_ _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_(_) │ │ │ │ │ + _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___d_i_c_t_(_) │ │ │ │ │ + _d_i_c_t___f_i_n_d___i_n_t___v_a_l_u_e_(_)_ _d_i_c_t___a_t_(_)_ _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___p_t_r_(_)_ _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_(_) │ │ │ │ │ o _c_l_e_a_r_(_) │ │ │ │ │ - o _g_e_t___s_t_r_(_)_ _g_e_t___i_n_t_(_)_ _g_e_t___b_o_o_l_(_) │ │ │ │ │ - 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_(_) │ │ │ │ │ - * _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_(_) │ │ │ │ │ - * _g_e_n_e_r_a_t_e___f_i_n_g_e_r_p_r_i_n_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_(_) │ │ │ │ │ - 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_(_) │ │ │ │ │ - * _h_a_s_h_e_r │ │ │ │ │ - o _h_a_s_h_e_r_(_)_ _o_p_e_r_a_t_o_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 _u_p_d_a_t_e_(_) │ │ │ │ │ - o _f_i_n_a_l_(_) │ │ │ │ │ - o _r_e_s_e_t_(_) │ │ │ │ │ - * _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 │ │ │ │ │ - * _p_e_e_r___c_l_a_s_s___i_n_f_o │ │ │ │ │ - * _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_(_) │ │ │ │ │ - * _p_c_p___c_a_t_e_g_o_r_y_(_) │ │ │ │ │ - * _u_p_n_p___c_a_t_e_g_o_r_y_(_) │ │ │ │ │ - * _g_z_i_p___c_a_t_e_g_o_r_y_(_) │ │ │ │ │ - * _s_o_c_k_s___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_(_) │ │ │ │ │ - * _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_ _p_c_p___e_r_r_o_r_s │ │ │ │ │ - * _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_ _s_o_c_k_s___e_r_r_o_r___c_o_d_e │ │ │ │ │ - * _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 │ │ │ │ │ - * _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_[_]_(_) │ │ │ │ │ - * _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 │ │ │ │ │ + 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_(_) │ │ │ │ │ + * _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 _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 _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_(_)_ _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_(_) │ │ │ │ │ + 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 _t_r_a_c_k_e_r_s_(_)_ _r_e_p_l_a_c_e___t_r_a_c_k_e_r_s_(_)_ _p_o_s_t___t_r_a_c_k_e_r_s_(_)_ _a_d_d___t_r_a_c_k_e_r_(_) │ │ │ │ │ + o _a_d_d___u_r_l___s_e_e_d_(_)_ _r_e_m_o_v_e___u_r_l___s_e_e_d_(_)_ _u_r_l___s_e_e_d_s_(_) │ │ │ │ │ + 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 _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___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_(_) │ │ │ │ │ + _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___d_o_w_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___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 _g_e_t___p_i_e_c_e___p_r_i_o_r_i_t_i_e_s_(_)_ _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_(_) │ │ │ │ │ + o _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_(_)_ _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 _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 _m_a_x___u_p_l_o_a_d_s_(_)_ _s_e_t___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_(_) │ │ │ │ │ * _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 │ │ │ │ │ @@ -274,15 +116,15 @@ │ │ │ │ │ * _p_i_e_c_e___f_i_n_i_s_h_e_d___a_l_e_r_t │ │ │ │ │ * _r_e_q_u_e_s_t___d_r_o_p_p_e_d___a_l_e_r_t │ │ │ │ │ * _b_l_o_c_k___t_i_m_e_o_u_t___a_l_e_r_t │ │ │ │ │ * _b_l_o_c_k___f_i_n_i_s_h_e_d___a_l_e_r_t │ │ │ │ │ * _b_l_o_c_k___d_o_w_n_l_o_a_d_i_n_g___a_l_e_r_t │ │ │ │ │ * _u_n_w_a_n_t_e_d___b_l_o_c_k___a_l_e_r_t │ │ │ │ │ * _s_t_o_r_a_g_e___m_o_v_e_d___a_l_e_r_t │ │ │ │ │ - o _s_t_o_r_a_g_e___p_a_t_h_(_)_ _o_l_d___p_a_t_h_(_) │ │ │ │ │ + o _o_l_d___p_a_t_h_(_)_ _s_t_o_r_a_g_e___p_a_t_h_(_) │ │ │ │ │ * _s_t_o_r_a_g_e___m_o_v_e_d___f_a_i_l_e_d___a_l_e_r_t │ │ │ │ │ o _f_i_l_e___p_a_t_h_(_) │ │ │ │ │ * _t_o_r_r_e_n_t___d_e_l_e_t_e_d___a_l_e_r_t │ │ │ │ │ * _t_o_r_r_e_n_t___d_e_l_e_t_e___f_a_i_l_e_d___a_l_e_r_t │ │ │ │ │ * _s_a_v_e___r_e_s_u_m_e___d_a_t_a___a_l_e_r_t │ │ │ │ │ * _s_a_v_e___r_e_s_u_m_e___d_a_t_a___f_a_i_l_e_d___a_l_e_r_t │ │ │ │ │ * _t_o_r_r_e_n_t___p_a_u_s_e_d___a_l_e_r_t │ │ │ │ │ @@ -375,31 +217,14 @@ │ │ │ │ │ o _m_e_s_s_a_g_e_(_) │ │ │ │ │ o _c_a_t_e_g_o_r_y_(_) │ │ │ │ │ * _o_p_e_r_a_t_i_o_n___n_a_m_e_(_) │ │ │ │ │ * _a_l_e_r_t___c_a_s_t_(_) │ │ │ │ │ * _e_n_u_m_ _o_p_e_r_a_t_i_o_n___t │ │ │ │ │ * _i_n_t │ │ │ │ │ * _a_l_e_r_t___c_a_t_e_g_o_r_y___t │ │ │ │ │ - * _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 _l_i_s_t_(_)_ _p_r_e_f_o_r_m_a_t_t_e_d_(_)_ _d_i_c_t_(_)_ _i_n_t_e_g_e_r_(_)_ _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 │ │ │ │ │ - * _o_p_e_r_a_t_o_r_<_<_(_) │ │ │ │ │ - * _b_e_n_c_o_d_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_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_(_) │ │ │ │ │ @@ -408,205 +233,380 @@ │ │ │ │ │ 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___d_o_n_t___h_a_v_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___a_l_l_o_w_e_d___f_a_s_t_(_)_ _o_n___u_n_c_h_o_k_e_(_)_ _o_n___r_e_q_u_e_s_t_(_)_ _o_n___h_a_v_e_(_)_ _o_n___c_h_o_k_e_(_) │ │ │ │ │ - _o_n___n_o_t___i_n_t_e_r_e_s_t_e_d_(_)_ _o_n___i_n_t_e_r_e_s_t_e_d_(_) │ │ │ │ │ + o _o_n___r_e_q_u_e_s_t_(_)_ _o_n___h_a_v_e___n_o_n_e_(_)_ _o_n___h_a_v_e___a_l_l_(_)_ _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___d_o_n_t___h_a_v_e_(_)_ _o_n___u_n_c_h_o_k_e_(_)_ _o_n___h_a_v_e_(_) │ │ │ │ │ + _o_n___a_l_l_o_w_e_d___f_a_s_t_(_)_ _o_n___c_h_o_k_e_(_)_ _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___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___i_n_t_e_r_e_s_t_e_d_(_)_ _s_e_n_t___u_n_c_h_o_k_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___h_a_v_e_(_)_ _s_e_n_t___u_n_c_h_o_k_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_(_) │ │ │ │ │ * _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 │ │ │ │ │ + * _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_(_) │ │ │ │ │ * _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_(_) │ │ │ │ │ - * _i_p___f_i_l_t_e_r │ │ │ │ │ + * _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 │ │ │ │ │ + * _p_e_e_r___c_l_a_s_s___i_n_f_o │ │ │ │ │ + * _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_[_]_(_) │ │ │ │ │ + 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 _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_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___s_i_z_e_(_)_ _l_i_s_t___s_t_r_i_n_g___v_a_l_u_e___a_t_(_)_ _l_i_s_t___a_t_(_)_ _l_i_s_t___i_n_t___v_a_l_u_e___a_t_(_) │ │ │ │ │ - o _d_i_c_t___a_t_(_)_ _d_i_c_t___f_i_n_d___s_t_r_i_n_g___v_a_l_u_e_(_)_ _d_i_c_t___s_i_z_e_(_)_ _d_i_c_t___f_i_n_d_(_) │ │ │ │ │ - _d_i_c_t___a_t___n_o_d_e_(_)_ _d_i_c_t___f_i_n_d___s_t_r_i_n_g_(_)_ _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___i_n_t___v_a_l_u_e_(_)_ _d_i_c_t___f_i_n_d___l_i_s_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___l_e_n_g_t_h_(_)_ _s_t_r_i_n_g___o_f_f_s_e_t_(_)_ _s_t_r_i_n_g___p_t_r_(_) │ │ │ │ │ - o _c_l_e_a_r_(_) │ │ │ │ │ + o _d_a_t_a_(_) │ │ │ │ │ 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 _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_(_) │ │ │ │ │ + * _h_a_s_h_e_r │ │ │ │ │ + o _h_a_s_h_e_r_(_)_ _o_p_e_r_a_t_o_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_(_) │ │ │ │ │ + * _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 │ │ │ │ │ - * _p_r_i_n_t___e_n_t_r_y_(_) │ │ │ │ │ - * _b_d_e_c_o_d_e_(_) │ │ │ │ │ - * _s_t_o_r_a_g_e___p_a_r_a_m_s │ │ │ │ │ + * _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 _t_r_a_c_k_e_r_s_(_)_ _c_l_e_a_r___t_r_a_c_k_e_r_s_(_)_ _a_d_d___t_r_a_c_k_e_r_(_) │ │ │ │ │ + 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___h_t_t_p___s_e_e_d_(_)_ _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_(_) │ │ │ │ │ + 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 _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_(_) │ │ │ │ │ + o _p_i_e_c_e___s_i_z_e_(_) │ │ │ │ │ + o _h_a_s_h___f_o_r___p_i_e_c_e___p_t_r_(_)_ _h_a_s_h___f_o_r___p_i_e_c_e_(_) │ │ │ │ │ + o _n_a_m_e_(_) │ │ │ │ │ + o _c_r_e_a_t_i_o_n___d_a_t_e_(_) │ │ │ │ │ + o _c_r_e_a_t_o_r_(_) │ │ │ │ │ + o _c_o_m_m_e_n_t_(_) │ │ │ │ │ + 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_(_) │ │ │ │ │ + * _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 │ │ │ │ │ + * _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 _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_(_)_ _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 │ │ │ │ │ + * _o_p_e_r_a_t_o_r_<_<_(_) │ │ │ │ │ + * _b_e_n_c_o_d_e_(_) │ │ │ │ │ * _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 _n_u_m___p_i_e_c_e_s_(_)_ _s_e_t___n_u_m___p_i_e_c_e_s_(_) │ │ │ │ │ + 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 _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 _s_y_m_l_i_n_k_(_)_ _h_a_s_h_(_)_ _f_i_l_e___p_a_t_h_(_)_ _m_t_i_m_e_(_)_ _f_i_l_e___n_a_m_e_(_)_ _f_i_l_e___s_i_z_e_(_) │ │ │ │ │ - _f_i_l_e___o_f_f_s_e_t_(_)_ _p_a_d___f_i_l_e___a_t_(_)_ _r_o_o_t___p_t_r_(_)_ _r_o_o_t_(_) │ │ │ │ │ + o _f_i_l_e___s_i_z_e_(_)_ _r_o_o_t___p_t_r_(_)_ _m_t_i_m_e_(_)_ _f_i_l_e___n_a_m_e_(_)_ _r_o_o_t_(_)_ _f_i_l_e___o_f_f_s_e_t_(_) │ │ │ │ │ + _f_i_l_e___p_a_t_h_(_)_ _p_a_d___f_i_l_e___a_t_(_)_ _s_y_m_l_i_n_k_(_)_ _h_a_s_h_(_) │ │ │ │ │ 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___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___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_(_) │ │ │ │ │ - * _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_(_) │ │ │ │ │ + * _s_t_o_r_a_g_e___p_a_r_a_m_s │ │ │ │ │ * _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_(_) │ │ │ │ │ + * _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_(_) │ │ │ │ │ * _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_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 _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 │ │ │ │ │ + * _s_t_o_r_a_g_e___e_r_r_o_r │ │ │ │ │ + o _b_o_o_l_(_) │ │ │ │ │ + o _f_i_l_e_(_) │ │ │ │ │ + * _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_(_) │ │ │ │ │ + * _s_o_c_k_s___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_(_) │ │ │ │ │ + * _u_p_n_p___c_a_t_e_g_o_r_y_(_) │ │ │ │ │ + * _p_c_p___c_a_t_e_g_o_r_y_(_) │ │ │ │ │ + * _g_z_i_p___c_a_t_e_g_o_r_y_(_) │ │ │ │ │ + * _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_ _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_ _h_t_t_p___e_r_r_o_r_s │ │ │ │ │ + * _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_ _e_r_r_o_r___c_o_d_e___e_n_u_m │ │ │ │ │ + * _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___w_r_i_t_e_(_)_ _a_s_y_n_c___r_e_a_d_(_) │ │ │ │ │ + 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 │ │ │ │ │ + * _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_(_) │ │ │ │ │ + * _s_e_t_t_i_n_g_s___i_n_t_e_r_f_a_c_e │ │ │ │ │ + * _f_i_l_e___o_p_e_n___m_o_d_e___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 _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_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_(_)_ _p_a_u_s_e_(_)_ _i_s___p_a_u_s_e_d_(_) │ │ │ │ │ + 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___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 _g_e_t___i_p___f_i_l_t_e_r_(_)_ _s_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_(_)_ _s_s_l___l_i_s_t_e_n___p_o_r_t_(_)_ _l_i_s_t_e_n___p_o_r_t_(_) │ │ │ │ │ + o _s_e_t___p_e_e_r___c_l_a_s_s___f_i_l_t_e_r_(_)_ _g_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 _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_(_) │ │ │ │ │ + * _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_(_)_ _~_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 │ │ │ │ │ + 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_(_) │ │ │ │ │ + * _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_(_) │ │ │ │ │ + * _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_[_]_(_) │ │ │ │ │ + * _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 │ │ │ │ │ + * _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 _c_o_n_s_t_*_(_)_ _v_o_i_d_*_(_)_ _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___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 _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_(_) │ │ │ │ │ + o _p_i_e_c_e___s_i_z_e_(_)_ _p_i_e_c_e___l_e_n_g_t_h_(_) │ │ │ │ │ + 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_(_) │ │ │ │ │ - * _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 _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_(_)_ _c_l_e_a_r___p_i_e_c_e___d_e_a_d_l_i_n_e_s_(_) │ │ │ │ │ - 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 _t_r_a_c_k_e_r_s_(_)_ _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_(_)_ _a_d_d___t_r_a_c_k_e_r_(_) │ │ │ │ │ - o _u_r_l___s_e_e_d_s_(_)_ _a_d_d___u_r_l___s_e_e_d_(_)_ _r_e_m_o_v_e___u_r_l___s_e_e_d_(_) │ │ │ │ │ - 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___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_(_)_ _s_e_t___f_l_a_g_s_(_)_ _u_n_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_(_)_ _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___b_o_t_t_o_m_(_) │ │ │ │ │ - _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_(_) │ │ │ │ │ - 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_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_(_)_ _g_e_t___p_i_e_c_e___p_r_i_o_r_i_t_i_e_s_(_)_ _p_r_i_o_r_i_t_i_z_e___p_i_e_c_e_s_(_) │ │ │ │ │ - o _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_(_)_ _g_e_t___f_i_l_e___p_r_i_o_r_i_t_i_e_s_(_) │ │ │ │ │ - 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 _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_(_) │ │ │ │ │ - _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 _m_a_x___u_p_l_o_a_d_s_(_)_ _s_e_t___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_(_)_ _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_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_(_) │ │ │ │ │ + * _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_(_)_ _h_a_s___v_2_(_) │ │ │ │ │ + o _g_e_t_(_) │ │ │ │ │ + o _g_e_t___b_e_s_t_(_) │ │ │ │ │ + o _f_o_r___e_a_c_h_(_) │ │ │ │ │ + * _p_e_e_r___r_e_q_u_e_s_t │ │ │ │ │ + o _o_p_e_r_a_t_o_r_=_=_(_) │ │ │ │ │ + * _p_e_e_r___i_n_f_o │ │ │ │ │ + o _i_2_p___d_e_s_t_i_n_a_t_i_o_n_(_) │ │ │ │ │ + * _p_i_e_c_e___b_l_o_c_k │ │ │ │ │ + * _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_(_) │ │ │ │ │ + * _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_(_) │ │ │ │ │ + * _t_r_u_n_c_a_t_e___f_i_l_e_s_(_) │ │ │ │ │ + * _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_ _p_r_o_t_o_c_o_l___v_e_r_s_i_o_n │ │ │ │ │ + * _e_n_u_m_ _c_o_n_n_e_c_t_i_o_n___t_y_p_e │ │ │ │ │ + * _d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y___t │ │ │ │ │ + * _i_n_t │ │ │ │ │ + * _t_o_r_r_e_n_t___f_l_a_g_s___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 │ │ │ │ │ + * _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 │ │ │ │ │ + * _s_e_t_t_i_n_g_s___p_a_c_k │ │ │ │ │ + o _s_e_t___i_n_t_(_)_ _s_e_t___s_t_r_(_)_ _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___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 │ │ │ │ │ + * _g_e_n_e_r_a_t_e___f_i_n_g_e_r_p_r_i_n_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_(_) │ │ │ │ │ + * _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_(_) │ │ │ │ │ + * _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 │ │ │ │ │ * _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_(_) │ │ │ │ │ @@ -614,5569 +614,1332 @@ │ │ │ │ │ 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 │ │ │ │ │ - * _s_i_g_n___m_u_t_a_b_l_e___i_t_e_m_(_) │ │ │ │ │ * _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 │ │ │ │ │ * _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_(_)_ _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e___b_u_f_(_) │ │ │ │ │ * _r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_) │ │ │ │ │ * _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_(_) │ │ │ │ │ [_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 (); │ │ │ │ │ - sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept; │ │ │ │ │ - session_proxy& ooppeerraattoorr== (session_proxy&&) & noexcept; │ │ │ │ │ - ~~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(()) sseessssiioonn__pprrooxxyy(()) ooppeerraattoorr==(()) ********** │ │ │ │ │ -sseessssiioonn__pprrooxxyy (); │ │ │ │ │ -sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept; │ │ │ │ │ -session_proxy& ooppeerraattoorr== (session_proxy&&) & noexcept; │ │ │ │ │ -~~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 │ │ │ │ │ -will be idle as long it doesn't have any torrents to participate in. │ │ │ │ │ -You have some control over _s_e_s_s_i_o_n configuration through the session_handle:: │ │ │ │ │ -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 (); │ │ │ │ │ - sseessssiioonn (session_params const& 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 (session_params const& params, io_context& ios, session_flags_t); │ │ │ │ │ - sseessssiioonn (session_params const& params, io_context& ios); │ │ │ │ │ - sseessssiioonn (session_params&& params, io_context& ios, session_flags_t); │ │ │ │ │ - ~~sseessssiioonn (); │ │ │ │ │ - session_proxy aabboorrtt (); │ │ │ │ │ -}; │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** sseessssiioonn(()) ********** │ │ │ │ │ -sseessssiioonn (); │ │ │ │ │ -sseessssiioonn (session_params const& params, session_flags_t flags); │ │ │ │ │ -explicit sseessssiioonn (session_params const& params); │ │ │ │ │ -explicit sseessssiioonn (session_params&& params); │ │ │ │ │ -sseessssiioonn (session_params&& params, session_flags_t flags); │ │ │ │ │ -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, session_flags_t); │ │ │ │ │ -sseessssiioonn (session_params const& params, io_context& ios); │ │ │ │ │ -sseessssiioonn (session_params&& params, io_context& ios, session_flags_t); │ │ │ │ │ -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 │ │ │ │ │ -io_context::run() call mmuusstt have returned before it's safe to destruct the │ │ │ │ │ -_s_e_s_s_i_o_n. Which means you MMUUSSTT call _s_e_s_s_i_o_n_:_:_a_b_o_r_t_(_) and save the _s_e_s_s_i_o_n___p_r_o_x_y │ │ │ │ │ -first, then destruct the _s_e_s_s_i_o_n object, then sync with the io_context, then │ │ │ │ │ -destruct the _s_e_s_s_i_o_n___p_r_o_x_y object. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ~~sseessssiioonn(()) ********** │ │ │ │ │ -~~sseessssiioonn (); │ │ │ │ │ -The destructor of _s_e_s_s_i_o_n 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 _s_e_s_s_i_o_n returns. So, it's advised that any kind of interface │ │ │ │ │ -(such as windows) are closed before destructing the _s_e_s_s_i_o_n object. Because it │ │ │ │ │ -can take a few second for it to finish. The timeout can be set with │ │ │ │ │ -_a_p_p_l_y___s_e_t_t_i_n_g_s_(_). │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** aabboorrtt(()) ********** │ │ │ │ │ -session_proxy aabboorrtt (); │ │ │ │ │ -In case you want to destruct the _s_e_s_s_i_o_n asynchronously, you can request a │ │ │ │ │ -_s_e_s_s_i_o_n destruction proxy. If you don't do this, the destructor of the _s_e_s_s_i_o_n │ │ │ │ │ -object will block while the trackers are contacted. If you keep one │ │ │ │ │ -session_proxy to the _s_e_s_s_i_o_n when destructing it, the destructor will not │ │ │ │ │ -block, but start to close down the _s_e_s_s_i_o_n, the destructor of the proxy will │ │ │ │ │ -then synchronize the threads. So, the destruction of the _s_e_s_s_i_o_n is performed │ │ │ │ │ -from the session destructor call until the session_proxy destructor call. The │ │ │ │ │ -session_proxy does not have any operations on it (since the _s_e_s_s_i_o_n is being │ │ │ │ │ -closed down, no operations are allowed on it). The only valid operation is │ │ │ │ │ -calling the destructor: │ │ │ │ │ -struct session_proxy {}; │ │ │ │ │ -[_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&& sp); │ │ │ │ │ - sseessssiioonn__ppaarraammss (settings_pack const& sp); │ │ │ │ │ - sseessssiioonn__ppaarraammss (); │ │ │ │ │ - sseessssiioonn__ppaarraammss (settings_pack&& sp │ │ │ │ │ - , std::vector> exts); │ │ │ │ │ - sseessssiioonn__ppaarraammss (settings_pack const& sp │ │ │ │ │ - , std::vector> exts); │ │ │ │ │ - │ │ │ │ │ - settings_pack settings; │ │ │ │ │ - std::vector> extensions; │ │ │ │ │ - dht::dht_state dht_state; │ │ │ │ │ - dht::dht_storage_constructor_type dht_storage_constructor; │ │ │ │ │ - disk_io_constructor_type disk_io_constructor; │ │ │ │ │ - std::map ext_state; │ │ │ │ │ - libtorrent::ip_filter ip_filter; │ │ │ │ │ -}; │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** sseessssiioonn__ppaarraammss(()) ********** │ │ │ │ │ -sseessssiioonn__ppaarraammss (settings_pack&& sp); │ │ │ │ │ -sseessssiioonn__ppaarraammss (settings_pack const& sp); │ │ │ │ │ -sseessssiioonn__ppaarraammss (); │ │ │ │ │ -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&& sp │ │ │ │ │ - , std::vector> exts); │ │ │ │ │ -sseessssiioonn__ppaarraammss (settings_pack const& sp │ │ │ │ │ - , std::vector> 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 │ │ │ │ │ - the plugins to add to the _s_e_s_s_i_o_n as it is constructed │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - dht_state │ │ │ │ │ - DHT node ID and node addresses to bootstrap the DHT with. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - dht_storage_constructor │ │ │ │ │ - function object to construct the storage object for DHT items. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - disk_io_constructor │ │ │ │ │ - function object to create the disk I/O subsystem. Defaults to │ │ │ │ │ - default_disk_io_constructor. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - ext_state │ │ │ │ │ - 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 _r_e_a_d___s_e_s_s_i_o_n___p_a_r_a_m_s_(_) and _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s_(_). │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - ip_filter │ │ │ │ │ - the IP filter to use for the _s_e_s_s_i_o_n. This restricts which peers are │ │ │ │ │ - allowed to connect. As if passed to _s_e_t___i_p___f_i_l_t_e_r_(_). │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -************ sseessssiioonn__hhaannddllee ************ │ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n___h_a_n_d_l_e_._h_p_p" │ │ │ │ │ -this class provides a non-owning handle to a _s_e_s_s_i_o_n and a subset of the │ │ │ │ │ -interface of the _s_e_s_s_i_o_n class. If the underlying _s_e_s_s_i_o_n is destructed any │ │ │ │ │ -handle to it will no longer be valid. _i_s___v_a_l_i_d_(_) will return false and any │ │ │ │ │ -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* ret │ │ │ │ │ - , status_flags_t flags = {}) const; │ │ │ │ │ - std::vector ggeett__ttoorrrreenntt__ssttaattuuss ( │ │ │ │ │ - std::function 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 const& st); │ │ │ │ │ - void sseett__ddhhtt__ssttaattee (dht::dht_state&& st); │ │ │ │ │ - std::vector ggeett__ttoorrrreennttss () const; │ │ │ │ │ - torrent_handle ffiinndd__ttoorrrreenntt (sha1_hash const& info_hash) const; │ │ │ │ │ - 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&& params, error_code& ec); │ │ │ │ │ - torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ │ - void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ │ - bool iiss__ppaauusseedd () const; │ │ │ │ │ - void rreessuummee (); │ │ │ │ │ - void ppaauussee (); │ │ │ │ │ - bool iiss__ddhhtt__rruunnnniinngg () const; │ │ │ │ │ - void sseett__ddhhtt__ssttoorraaggee (dht::dht_storage_constructor_type sc); │ │ │ │ │ - void aadddd__ddhhtt__nnooddee (std::pair const& node); │ │ │ │ │ - void ddhhtt__ggeett__iitteemm (sha1_hash const& target); │ │ │ │ │ - void ddhhtt__ggeett__iitteemm (std::array key │ │ │ │ │ - , std::string salt = std::string()); │ │ │ │ │ - sha1_hash ddhhtt__ppuutt__iitteemm (entry data); │ │ │ │ │ - void ddhhtt__ppuutt__iitteemm (std::array key │ │ │ │ │ - , std::function& │ │ │ │ │ - , std::int64_t&, std::string const&)> cb │ │ │ │ │ - , std::string salt = std::string()); │ │ │ │ │ - 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 ext); │ │ │ │ │ - void aadddd__eexxtteennssiioonn (std::function( │ │ │ │ │ - torrent_handle const&, client_data_t)> ext); │ │ │ │ │ - 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; │ │ │ │ │ - unsigned short ssssll__lliisstteenn__ppoorrtt () const; │ │ │ │ │ - bool iiss__lliisstteenniinngg () const; │ │ │ │ │ - void sseett__ppeeeerr__ccllaassss__ffiilltteerr (ip_filter const& f); │ │ │ │ │ - ip_filter ggeett__ppeeeerr__ccllaassss__ffiilltteerr () const; │ │ │ │ │ - void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f); │ │ │ │ │ - peer_class_type_filter ggeett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr () const; │ │ │ │ │ - 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 = {}); │ │ │ │ │ - void aappppllyy__sseettttiinnggss (settings_pack const&); │ │ │ │ │ - settings_pack ggeett__sseettttiinnggss () const; │ │ │ │ │ - void aappppllyy__sseettttiinnggss (settings_pack&&); │ │ │ │ │ - void ppoopp__aalleerrttss (std::vector* alerts); │ │ │ │ │ - alert* wwaaiitt__ffoorr__aalleerrtt (time_duration max_wait); │ │ │ │ │ - void sseett__aalleerrtt__nnoottiiffyy (std::function const& fun); │ │ │ │ │ - std::vector 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 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; │ │ │ │ │ - static constexpr save_state_flags_t ssaavvee__iipp__ffiilltteerr = 12_bit; │ │ │ │ │ - static constexpr peer_class_t gglloobbaall__ppeeeerr__ccllaassss__iidd {0}; │ │ │ │ │ - static constexpr peer_class_t ttccpp__ppeeeerr__ccllaassss__iidd {1}; │ │ │ │ │ - static constexpr peer_class_t llooccaall__ppeeeerr__ccllaassss__iidd {2}; │ │ │ │ │ - static constexpr remove_flags_t ddeelleettee__ffiilleess = 0_bit; │ │ │ │ │ - static constexpr remove_flags_t ddeelleettee__ppaarrttffiillee = 1_bit; │ │ │ │ │ - static constexpr session_flags_t ppaauusseedd = 2_bit; │ │ │ │ │ - static constexpr portmap_protocol uuddpp = portmap_protocol::udp; │ │ │ │ │ - static constexpr portmap_protocol ttccpp = portmap_protocol::tcp; │ │ │ │ │ - static constexpr reopen_network_flags_t rreeooppeenn__mmaapp__ppoorrttss = 0_bit; │ │ │ │ │ -}; │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** iiss__vvaalliidd(()) ********** │ │ │ │ │ -bool iiss__vvaalliidd () const; │ │ │ │ │ -returns true if this handle refers to a valid _s_e_s_s_i_o_n object. If the _s_e_s_s_i_o_n │ │ │ │ │ -has been destroyed, all _s_e_s_s_i_o_n___h_a_n_d_l_e objects will expire and not be valid. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** sseessssiioonn__ssttaattee(()) ********** │ │ │ │ │ -session_params sseessssiioonn__ssttaattee (save_state_flags_t flags = save_state_flags_t:: │ │ │ │ │ -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(()) ********** │ │ │ │ │ -void rreeffrreesshh__ttoorrrreenntt__ssttaattuuss (std::vector* ret │ │ │ │ │ - , status_flags_t flags = {}) const; │ │ │ │ │ -std::vector ggeett__ttoorrrreenntt__ssttaattuuss ( │ │ │ │ │ - std::function const& pred │ │ │ │ │ - , 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 │ │ │ │ │ -should be included and false means excluded. The flags argument is the same as │ │ │ │ │ -to _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_s_t_a_t_u_s_(_). Since pred is guaranteed to be called for every │ │ │ │ │ -torrent, it may be used to count the number of torrents of different categories │ │ │ │ │ -as well. │ │ │ │ │ -refresh_torrent_status takes a vector of _t_o_r_r_e_n_t___s_t_a_t_u_s structs (for instance │ │ │ │ │ -the same vector that was returned by _g_e_t___t_o_r_r_e_n_t___s_t_a_t_u_s_(_) ) and refreshes the │ │ │ │ │ -status based on the handle member. It is possible to use this function by first │ │ │ │ │ -setting up a vector of default constructed torrent_status objects, only │ │ │ │ │ -initializing the handle 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. │ │ │ │ │ -Any _t_o_r_r_e_n_t___s_t_a_t_u_s object whose handle member is not referring to a valid │ │ │ │ │ -torrent are ignored. │ │ │ │ │ -The intended use of these functions is to start off by calling │ │ │ │ │ -get_torrent_status() to get a list of all torrents that match your criteria. │ │ │ │ │ -Then call refresh_torrent_status() 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 get_torrent_status() 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ppoosstt__ttoorrrreenntt__uuppddaatteess(()) ********** │ │ │ │ │ -void ppoosstt__ttoorrrreenntt__uuppddaatteess (status_flags_t flags = status_flags_t::all()); │ │ │ │ │ -This functions instructs the _s_e_s_s_i_o_n to post the _s_t_a_t_e___u_p_d_a_t_e___a_l_e_r_t, containing │ │ │ │ │ -the status of all torrents whose state changed since the last time this │ │ │ │ │ -function was called. │ │ │ │ │ -Only torrents who has the state subscription flag set will be included. This │ │ │ │ │ -flag is on by default. See _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s. the flags argument is the same │ │ │ │ │ -as for _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_s_t_a_t_u_s_(_). see status_flags_t in _t_o_r_r_e_n_t___h_a_n_d_l_e. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ppoosstt__sseessssiioonn__ssttaattss(()) ********** │ │ │ │ │ -void ppoosstt__sseessssiioonn__ssttaattss (); │ │ │ │ │ -This function will post a _s_e_s_s_i_o_n___s_t_a_t_s___a_l_e_r_t object, containing a snapshot of │ │ │ │ │ -the performance _c_o_u_n_t_e_r_s from the internals of libtorrent. To interpret these │ │ │ │ │ -_c_o_u_n_t_e_r_s, query the _s_e_s_s_i_o_n via _s_e_s_s_i_o_n___s_t_a_t_s___m_e_t_r_i_c_s_(_). │ │ │ │ │ -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 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(()) ********** │ │ │ │ │ -std::vector 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] │ │ │ │ │ -********** aassyynncc__aadddd__ttoorrrreenntt(()) aadddd__ttoorrrreenntt(()) ********** │ │ │ │ │ -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&& params, error_code& ec); │ │ │ │ │ -torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ │ -void aassyynncc__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 │ │ │ │ │ -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_d_d___t_o_r_r_e_n_t_(_) will throw a system_error exception. │ │ │ │ │ -The overload that does not take an error_code throws an exception on error and │ │ │ │ │ -is not available when building without exception support. The _t_o_r_r_e_n_t___h_a_n_d_l_e │ │ │ │ │ -returned by _a_d_d___t_o_r_r_e_n_t_(_) can be used to retrieve information about the │ │ │ │ │ -torrent's progress, its peers etc. It is also used to abort a torrent. │ │ │ │ │ -If the torrent you are trying to add already exists in the _s_e_s_s_i_o_n (is either │ │ │ │ │ -queued for checking, being checked or downloading) add_torrent() will throw │ │ │ │ │ -system_error which derives from std::exception unless duplicate_is_error is set │ │ │ │ │ -to false. In that case, _a_d_d___t_o_r_r_e_n_t_(_) will return the handle to the existing │ │ │ │ │ -torrent. │ │ │ │ │ -The _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s 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. │ │ │ │ │ -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(()) ppaauussee(()) iiss__ppaauusseedd(()) ********** │ │ │ │ │ -bool iiss__ppaauusseedd () const; │ │ │ │ │ -void rreessuummee (); │ │ │ │ │ -void ppaauussee (); │ │ │ │ │ -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 │ │ │ │ │ -paused or if the _s_e_s_s_i_o_n is paused. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** iiss__ddhhtt__rruunnnniinngg(()) ********** │ │ │ │ │ -bool iiss__ddhhtt__rruunnnniinngg () const; │ │ │ │ │ -is_dht_running() returns true if the DHT support has been started and false │ │ │ │ │ -otherwise. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** sseett__ddhhtt__ssttoorraaggee(()) ********** │ │ │ │ │ -void sseett__ddhhtt__ssttoorraaggee (dht::dht_storage_constructor_type sc); │ │ │ │ │ -set_dht_storage set a dht custom storage constructor function to be used │ │ │ │ │ -internally when the dht is created. │ │ │ │ │ -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. │ │ │ │ │ -If you want to make sure the dht is initially created with your custom storage, │ │ │ │ │ -create a _s_e_s_s_i_o_n with the setting settings_pack::enable_dht to false, set your │ │ │ │ │ -constructor function and call apply_settings with settings_pack::enable_dht to │ │ │ │ │ -true. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** aadddd__ddhhtt__nnooddee(()) ********** │ │ │ │ │ -void aadddd__ddhhtt__nnooddee (std::pair const& node); │ │ │ │ │ -add_dht_node 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ddhhtt__ggeett__iitteemm(()) ********** │ │ │ │ │ -void ddhhtt__ggeett__iitteemm (sha1_hash const& target); │ │ │ │ │ -query the DHT for an immutable item at the target hash. the result is posted as │ │ │ │ │ -a _d_h_t___i_m_m_u_t_a_b_l_e___i_t_e_m___a_l_e_r_t. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ddhhtt__ggeett__iitteemm(()) ********** │ │ │ │ │ -void ddhhtt__ggeett__iitteemm (std::array key │ │ │ │ │ - , std::string salt = std::string()); │ │ │ │ │ -query the DHT for a mutable item under the public key key. this is an ed25519 │ │ │ │ │ -key. salt 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 _d_h_t___m_u_t_a_b_l_e___i_t_e_m___a_l_e_r_t is posted. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ddhhtt__ppuutt__iitteemm(()) ********** │ │ │ │ │ -sha1_hash ddhhtt__ppuutt__iitteemm (entry data); │ │ │ │ │ -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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ddhhtt__ppuutt__iitteemm(()) ********** │ │ │ │ │ -void ddhhtt__ppuutt__iitteemm (std::array key │ │ │ │ │ - , std::function& │ │ │ │ │ - , std::int64_t&, std::string const&)> cb │ │ │ │ │ - , std::string salt = std::string()); │ │ │ │ │ -store a mutable item. The key is the public key the blob is to be stored under. │ │ │ │ │ -The optional salt 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: │ │ │ │ │ - entry& value │ │ │ │ │ - the current value stored under the key (may be empty). Also expected to │ │ │ │ │ - be set to the value to be stored by the function. │ │ │ │ │ - std::array& signature │ │ │ │ │ - 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 sign_mutable_item function. │ │ │ │ │ - std::int64_t& seq │ │ │ │ │ - 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. │ │ │ │ │ - std::string const& salt │ │ │ │ │ - this is the salt that was used for this put call. │ │ │ │ │ -Since the callback function cb 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 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__aannnnoouunnccee(()) ddhhtt__ggeett__ppeeeerrss(()) ********** │ │ │ │ │ -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 │ │ │ │ │ -announce_port override setting. │ │ │ │ │ -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. │ │ │ │ │ -For possible flags, see _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__lliivvee__nnooddeess(()) ********** │ │ │ │ │ -void ddhhtt__lliivvee__nnooddeess (sha1_hash const& nid); │ │ │ │ │ -Retrieve all the live DHT (identified by nid) nodes. All the nodes id and │ │ │ │ │ -endpoint will be returned in the list of nodes in the _a_l_e_r_t │ │ │ │ │ -dht_live_nodes_alert. 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] │ │ │ │ │ -********** ddhhtt__ssaammppllee__iinnffoohhaasshheess(()) ********** │ │ │ │ │ -void ddhhtt__ssaammppllee__iinnffoohhaasshheess (udp::endpoint const& ep, sha1_hash const& target); │ │ │ │ │ -Query the DHT node specified by ep to retrieve a sample of the info-hashes that │ │ │ │ │ -the node currently have in their storage. The target 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 │ │ │ │ │ -dht_sample_infohashes_alert. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ddhhtt__ddiirreecctt__rreeqquueesstt(()) ********** │ │ │ │ │ -void ddhhtt__ddiirreecctt__rreeqquueesstt (udp::endpoint const& ep, entry const& e, client_data_t │ │ │ │ │ -userdata = {}); │ │ │ │ │ -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 ext); │ │ │ │ │ -void aadddd__eexxtteennssiioonn (std::function( │ │ │ │ │ - torrent_handle const&, client_data_t)> 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. 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 │ │ │ │ │ - directly. Makes it possible to join a swarm with just a tracker and info- │ │ │ │ │ - hash. │ │ │ │ │ -#include │ │ │ │ │ -ses.add_extension(<::create_ut_metadata_plugin); │ │ │ │ │ - uTorrent peer exchange │ │ │ │ │ - Exchanges peers between clients. │ │ │ │ │ -#include │ │ │ │ │ -ses.add_extension(<::create_ut_pex_plugin); │ │ │ │ │ - smart ban _p_l_u_g_i_n │ │ │ │ │ - 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 │ │ │ │ │ -ses.add_extension(<::create_smart_ban_plugin); │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** sseett__iipp__ffiilltteerr(()) ggeett__iipp__ffiilltteerr(()) ********** │ │ │ │ │ -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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** 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; │ │ │ │ │ -unsigned short ssssll__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(()) ********** │ │ │ │ │ -void sseett__ppeeeerr__ccllaassss__ffiilltteerr (ip_filter const& f); │ │ │ │ │ -ip_filter ggeett__ppeeeerr__ccllaassss__ffiilltteerr () const; │ │ │ │ │ -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. │ │ │ │ │ -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: │ │ │ │ │ -ip_filter f = ses.get_peer_class_filter(); │ │ │ │ │ -peer_class_t my_class = ses.create_peer_class("200.1.x.x IP range"); │ │ │ │ │ -f.add_rule(make_address("200.1.1.0"), make_address("200.1.255.255") │ │ │ │ │ - , 1 << static_cast(my_class)); │ │ │ │ │ -ses.set_peer_class_filter(f); │ │ │ │ │ -This setting only applies to new connections, it won't affect existing peer │ │ │ │ │ -connections. │ │ │ │ │ -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. │ │ │ │ │ -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] │ │ │ │ │ -********** ggeett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr(()) sseett__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; │ │ │ │ │ -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 │ │ │ │ │ - 3. peer-class type filter, adding classes │ │ │ │ │ -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] │ │ │ │ │ -********** ccrreeaattee__ppeeeerr__ccllaassss(()) ********** │ │ │ │ │ -peer_class_t ccrreeaattee__ppeeeerr__ccllaassss (char const* name); │ │ │ │ │ -Creates a new peer class (see _p_e_e_r_ _c_l_a_s_s_e_s) 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. │ │ │ │ │ -Identifiers are assigned from low numbers to higher. So if you plan on using │ │ │ │ │ -certain peer classes in a call to _s_e_t___p_e_e_r___c_l_a_s_s___f_i_l_t_e_r_(_), make sure to create │ │ │ │ │ -those early on, to get low identifiers. │ │ │ │ │ -For more information on peer classes, see _p_e_e_r_ _c_l_a_s_s_e_s. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ddeelleettee__ppeeeerr__ccllaassss(()) ********** │ │ │ │ │ -void ddeelleettee__ppeeeerr__ccllaassss (peer_class_t cid); │ │ │ │ │ -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 oonnccee per peer class you create. Calling it more than once for the same │ │ │ │ │ -class will lead to memory corruption. │ │ │ │ │ -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. │ │ │ │ │ -There is no need to call this function for custom peer classes. All peer │ │ │ │ │ -classes will be properly destructed when the _s_e_s_s_i_o_n object destructs. │ │ │ │ │ -For more information on peer classes, see _p_e_e_r_ _c_l_a_s_s_e_s. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ggeett__ppeeeerr__ccllaassss(()) sseett__ppeeeerr__ccllaassss(()) ********** │ │ │ │ │ -peer_class_info ggeett__ppeeeerr__ccllaassss (peer_class_t cid) const; │ │ │ │ │ -void sseett__ppeeeerr__ccllaassss (peer_class_t cid, peer_class_info const& pci); │ │ │ │ │ -These functions queries information from a peer class and updates the │ │ │ │ │ -configuration of a peer class, respectively. │ │ │ │ │ -cid must refer to an existing peer class. If it does not, the return value of │ │ │ │ │ -get_peer_class() is undefined. │ │ │ │ │ -set_peer_class() sets all the information in the _p_e_e_r___c_l_a_s_s___i_n_f_o object in the │ │ │ │ │ -specified peer class. There is no option to only update a single property. │ │ │ │ │ -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. │ │ │ │ │ -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] │ │ │ │ │ -********** rreemmoovvee__ttoorrrreenntt(()) ********** │ │ │ │ │ -void rreemmoovvee__ttoorrrreenntt (const torrent_handle&, remove_flags_t = {}); │ │ │ │ │ -remove_torrent() 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 │ │ │ │ │ -_t_o_r_r_e_n_t___r_e_m_o_v_e_d___a_l_e_r_t. │ │ │ │ │ -_r_e_m_o_v_e___t_o_r_r_e_n_t_(_) is non-blocking, but will remove the torrent from the _s_e_s_s_i_o_n │ │ │ │ │ -synchronously. Calling _s_e_s_s_i_o_n___h_a_n_d_l_e_:_:_a_d_d___t_o_r_r_e_n_t_(_) immediately afterward with │ │ │ │ │ -the same torrent will succeed. Note that this creates a new handle which is not │ │ │ │ │ -equal to the removed one. │ │ │ │ │ -The optional second argument options can be used to delete all the files │ │ │ │ │ -downloaded by this torrent. To do so, pass in the value session_handle:: │ │ │ │ │ -delete_files. Once the torrent is deleted, a _t_o_r_r_e_n_t___d_e_l_e_t_e_d___a_l_e_r_t is posted. │ │ │ │ │ -The _t_o_r_r_e_n_t___h_a_n_d_l_e remains valid for some time after _r_e_m_o_v_e___t_o_r_r_e_n_t_(_) 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, │ │ │ │ │ -_t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_i_s___v_a_l_i_d_(_) will return true, and other calls such as │ │ │ │ │ -_t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_s_t_a_t_u_s_(_) will succeed. Because of this, and because │ │ │ │ │ -_r_e_m_o_v_e___t_o_r_r_e_n_t_(_) is non-blocking, the following sequence usually succeeds (does │ │ │ │ │ -not throw system_error): .. code:: c++ │ │ │ │ │ - session.remove_handle(handle); handle.save_resume_data(); │ │ │ │ │ -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] │ │ │ │ │ -********** aappppllyy__sseettttiinnggss(()) ggeett__sseettttiinnggss(()) ********** │ │ │ │ │ -void aappppllyy__sseettttiinnggss (settings_pack const&); │ │ │ │ │ -settings_pack ggeett__sseettttiinnggss () const; │ │ │ │ │ -void aappppllyy__sseettttiinnggss (settings_pack&&); │ │ │ │ │ -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] │ │ │ │ │ -********** wwaaiitt__ffoorr__aalleerrtt(()) sseett__aalleerrtt__nnoottiiffyy(()) ppoopp__aalleerrttss(()) ********** │ │ │ │ │ -void ppoopp__aalleerrttss (std::vector* alerts); │ │ │ │ │ -alert* wwaaiitt__ffoorr__aalleerrtt (time_duration max_wait); │ │ │ │ │ -void sseett__aalleerrtt__nnoottiiffyy (std::function 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. │ │ │ │ │ -wait_for_alert will block the current thread for max_wait time duration, or │ │ │ │ │ -until another _a_l_e_r_t is posted. If an _a_l_e_r_t is available at the time of the │ │ │ │ │ -call, it returns immediately. The returned _a_l_e_r_t pointer is the head of the │ │ │ │ │ -_a_l_e_r_t queue. wait_for_alert does not pop alerts from the queue, it merely peeks │ │ │ │ │ -at it. The returned _a_l_e_r_t will stay valid until pop_alerts is called twice. The │ │ │ │ │ -first time will pop it and the second will free it. │ │ │ │ │ -If there is no _a_l_e_r_t in the queue and no _a_l_e_r_t arrives within the specified │ │ │ │ │ -timeout, wait_for_alert returns nullptr. │ │ │ │ │ -In the python binding, wait_for_alert takes the number of milliseconds to wait │ │ │ │ │ -as an integer. │ │ │ │ │ -The _a_l_e_r_t queue in the _s_e_s_s_i_o_n 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 _s_e_s_s_i_o_n, see settings_pack::alert_queue_size. │ │ │ │ │ -Some alerts are considered so important that they are posted even when the │ │ │ │ │ -_a_l_e_r_t queue is full. Some alerts are considered mandatory and cannot be │ │ │ │ │ -disabled by the alert_mask. For instance, _s_a_v_e___r_e_s_u_m_e___d_a_t_a___a_l_e_r_t and │ │ │ │ │ -_s_a_v_e___r_e_s_u_m_e___d_a_t_a___f_a_i_l_e_d___a_l_e_r_t are always posted, regardless of the _a_l_e_r_t mask. │ │ │ │ │ -To control which alerts are posted, set the alert_mask (_s_e_t_t_i_n_g_s___p_a_c_k_:_: │ │ │ │ │ -_a_l_e_r_t___m_a_s_k). │ │ │ │ │ -If the _a_l_e_r_t queue fills up to the point where alerts are dropped, this will be │ │ │ │ │ -indicated by a _a_l_e_r_t_s___d_r_o_p_p_e_d___a_l_e_r_t, which contains a bitmask of which types of │ │ │ │ │ -alerts were dropped. Generally it is a good idea to make sure the _a_l_e_r_t queue │ │ │ │ │ -is large enough, the alert_mask doesn't have unnecessary categories enabled and │ │ │ │ │ -to call pop_alert() frequently, to avoid alerts being dropped. │ │ │ │ │ -the set_alert_notify function lets the client set a function object to be │ │ │ │ │ -invoked every time the _a_l_e_r_t queue goes from having 0 alerts to 1 _a_l_e_r_t. 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 pop_alerts(). If the │ │ │ │ │ -notify function fails to do so, it won't be called again, until pop_alerts 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. │ │ │ │ │ -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(()) ********** │ │ │ │ │ -std::vector 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 = │ │ │ │ │ -reopen_map_ports); │ │ │ │ │ -Instructs the _s_e_s_s_i_o_n to reopen all listen and outgoing sockets. │ │ │ │ │ -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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** nnaattiivvee__hhaannddllee(()) ********** │ │ │ │ │ -std::shared_ptr nnaattiivvee__hhaannddllee () const; │ │ │ │ │ -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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - save_settings │ │ │ │ │ - saves settings (i.e. the _s_e_t_t_i_n_g_s___p_a_c_k) │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - save_dht_state │ │ │ │ │ - saves dht state such as nodes and node-id, possibly accelerating joining │ │ │ │ │ - the DHT if provided at next _s_e_s_s_i_o_n startup. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - save_extension_state │ │ │ │ │ - load or save state from plugins │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - save_ip_filter │ │ │ │ │ - load or save the IP filter set on the _s_e_s_s_i_o_n │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - global_peer_class_id tcp_peer_class_id local_peer_class_id │ │ │ │ │ - built-in peer classes │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - delete_files │ │ │ │ │ - delete the files belonging to the torrent from disk. including the part- │ │ │ │ │ - file, if there is one │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - delete_partfile │ │ │ │ │ - delete just the part-file associated with this torrent │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - paused │ │ │ │ │ - when set, the _s_e_s_s_i_o_n will start paused. Call _s_e_s_s_i_o_n___h_a_n_d_l_e_:_:_r_e_s_u_m_e_(_) to │ │ │ │ │ - start │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - udp tcp │ │ │ │ │ - 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] │ │ │ │ │ -************ rreeaadd__sseessssiioonn__ppaarraammss(()) wwrriittee__sseessssiioonn__ppaarraammss(()) wwrriittee__sseessssiioonn__ppaarraammss__bbuuff(()) │ │ │ │ │ -************ │ │ │ │ │ -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 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()); │ │ │ │ │ -std::vector 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()); │ │ │ │ │ -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 │ │ │ │ │ -separately. │ │ │ │ │ -[_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 (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__vv11 () 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 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 (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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** hhaass__vv22(()) hhaass__vv11(()) hhaass(()) ********** │ │ │ │ │ -bool hhaass__vv22 () const; │ │ │ │ │ -bool hhaass__vv11 () 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] │ │ │ │ │ -********** 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 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; │ │ │ │ │ - │ │ │ │ │ - std::string client; │ │ │ │ │ - typed_bitfield 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] │ │ │ │ │ -********** 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] │ │ │ │ │ - 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] │ │ │ │ │ - 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] │ │ │ │ │ - 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] │ │ │ │ │ - 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] │ │ │ │ │ - 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] │ │ │ │ │ - interesting │ │ │ │ │ - wwee are interested in pieces from this peer. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - choked │ │ │ │ │ - wwee have choked this peer. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - remote_interested │ │ │ │ │ - the peer is interested in uuss │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - remote_choked │ │ │ │ │ - the peer has choked uuss. │ │ │ │ │ -[_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. │ │ │ │ │ -[_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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - local_connection │ │ │ │ │ - deprecated synonym for outgoing_connection │ │ │ │ │ -[_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. │ │ │ │ │ -[_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). │ │ │ │ │ -[_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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - seed │ │ │ │ │ - This peer is a seed (it has all the pieces). │ │ │ │ │ -[_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. │ │ │ │ │ -[_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. │ │ │ │ │ -[_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. │ │ │ │ │ -[_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. │ │ │ │ │ -[_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. │ │ │ │ │ -[_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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - utp_socket │ │ │ │ │ - indicates that this socket is a uTP socket │ │ │ │ │ -[_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 │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - rc4_encrypted │ │ │ │ │ - this connection is obfuscated with RC4 │ │ │ │ │ -[_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 │ │ │ │ │ -[_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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - tracker │ │ │ │ │ - The peer was received from the tracker. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - dht │ │ │ │ │ - The peer was received from the kademlia DHT. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - pex │ │ │ │ │ - The peer was received from the peer exchange extension. │ │ │ │ │ -[_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). │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - resume_data │ │ │ │ │ - The peer was added from the fast resume data. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - incoming │ │ │ │ │ - we received an incoming connection from this peer │ │ │ │ │ -[_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. │ │ │ │ │ -[_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 │ │ │ │ │ -[_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 │ │ │ │ │ -[_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()_ │ │ │ │ │ -[_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. │ │ │ │ │ -[_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. │ │ │ │ │ -[_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. │ │ │ │ │ -[_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. │ │ │ │ │ -[_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] │ │ │ │ │ -************ 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] │ │ │ │ │ -************ 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] │ │ │ │ │ -************ 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, 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__bbuuffffeerr ( │ │ │ │ │ - span buffer); │ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__ffiillee ( │ │ │ │ │ - std::string const& filename); │ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr ( │ │ │ │ │ - span buffer, load_torrent_limits const& cfg); │ │ │ │ │ -add_torrent_params llooaadd__ttoorrrreenntt__ppaarrsseedd ( │ │ │ │ │ - bdecode_node const& torrent_file); │ │ │ │ │ -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 (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 │ │ │ │ │ -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] │ │ │ │ │ -************ 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); │ │ │ │ │ -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); │ │ │ │ │ -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] │ │ │ │ │ -************ 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: │ │ │ │ │ -"..." │ │ │ │ │ -[_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); │ │ │ │ │ -[_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 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_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -[_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 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] │ │ │ │ │ -************ 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] │ │ │ │ │ -************ 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] │ │ │ │ │ -************ 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] │ │ │ │ │ -************ 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] │ │ │ │ │ -************ 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] │ │ │ │ │ -************ 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 ti; │ │ │ │ │ - aux::noexcept_movable> trackers; │ │ │ │ │ - aux::noexcept_movable> tracker_tiers; │ │ │ │ │ - aux::noexcept_movable>> dht_nodes; │ │ │ │ │ - std::string name; │ │ │ │ │ - std::string save_path; │ │ │ │ │ - storage_mode_t ssttoorraaggee__mmooddee = storage_mode_sparse; │ │ │ │ │ - client_data_t userdata; │ │ │ │ │ - aux::noexcept_movable> 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> http_seeds; │ │ │ │ │ - aux::noexcept_movable> url_seeds; │ │ │ │ │ - aux::noexcept_movable> peers; │ │ │ │ │ - aux::noexcept_movable> banned_peers; │ │ │ │ │ - aux::noexcept_movable> unfinished_pieces; │ │ │ │ │ - typed_bitfield have_pieces; │ │ │ │ │ - typed_bitfield verified_pieces; │ │ │ │ │ - aux::noexcept_movable> piece_priorities; │ │ │ │ │ - aux::vector, file_index_t> merkle_trees; │ │ │ │ │ - aux::vector, file_index_t> merkle_tree_mask; │ │ │ │ │ - aux::vector, file_index_t> verified_leaf_hashes; │ │ │ │ │ - aux::noexcept_movable> 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] │ │ │ │ │ -************ 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 const*) = delete; │ │ │ │ │ - client_data_t& ooppeerraattoorr== (void*) = delete; │ │ │ │ │ - operator vvooiidd** () const = delete; │ │ │ │ │ - operator void ccoonnsstt** () const = delete; │ │ │ │ │ - │ │ │ │ │ - template ::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 │ │ │ │ │ -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] │ │ │ │ │ -************ 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] │ │ │ │ │ - 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] │ │ │ │ │ - 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 │ │ │ │ │ +************ 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 storage_holder nneeww__ttoorrrreenntt (storage_params const& p │ │ │ │ │ - , std::shared_ptr const& torrent) = 0; │ │ │ │ │ - virtual void rreemmoovvee__ttoorrrreenntt (storage_index_t) = 0; │ │ │ │ │ - virtual bool aassyynncc__wwrriittee (storage_index_t storage, peer_request const& r │ │ │ │ │ - , char const* buf, std::shared_ptr o │ │ │ │ │ - , std::function handler │ │ │ │ │ - , disk_job_flags_t flags = {}) = 0; │ │ │ │ │ - virtual void aassyynncc__rreeaadd (storage_index_t storage, peer_request const& r │ │ │ │ │ - , std::function handler │ │ │ │ │ - , disk_job_flags_t flags = {}) = 0; │ │ │ │ │ - virtual void aassyynncc__hhaasshh (storage_index_t storage, piece_index_t piece, │ │ │ │ │ -span v2 │ │ │ │ │ - , disk_job_flags_t flags │ │ │ │ │ - , std::function handler) = 0; │ │ │ │ │ - virtual void aassyynncc__hhaasshh22 (storage_index_t storage, piece_index_t piece, int │ │ │ │ │ -offset, disk_job_flags_t flags │ │ │ │ │ - , std::function handler) = 0; │ │ │ │ │ - virtual void aassyynncc__mmoovvee__ssttoorraaggee (storage_index_t storage, std::string p, │ │ │ │ │ -move_flags_t flags │ │ │ │ │ - , std::function │ │ │ │ │ -handler) = 0; │ │ │ │ │ - virtual void aassyynncc__rreelleeaassee__ffiilleess (storage_index_t storage │ │ │ │ │ - , std::function handler = std::function()) = 0; │ │ │ │ │ - virtual void aassyynncc__cchheecckk__ffiilleess (storage_index_t storage │ │ │ │ │ - , add_torrent_params const* resume_data │ │ │ │ │ - , aux::vector links │ │ │ │ │ - , std::function handler) = 0; │ │ │ │ │ - virtual void aassyynncc__ssttoopp__ttoorrrreenntt (storage_index_t storage │ │ │ │ │ - , std::function handler = std::function()) = 0; │ │ │ │ │ - virtual void aassyynncc__rreennaammee__ffiillee (storage_index_t storage │ │ │ │ │ - , file_index_t index, std::string name │ │ │ │ │ - , std::function handler) = 0; │ │ │ │ │ - virtual void aassyynncc__ddeelleettee__ffiilleess (storage_index_t storage, remove_flags_t │ │ │ │ │ -options │ │ │ │ │ - , std::function handler) = 0; │ │ │ │ │ - virtual void aassyynncc__sseett__ffiillee__pprriioorriittyy (storage_index_t storage │ │ │ │ │ - , aux::vector prio │ │ │ │ │ - , std::function)> handler) = 0; │ │ │ │ │ - virtual void aassyynncc__cclleeaarr__ppiieeccee (storage_index_t storage, piece_index_t index │ │ │ │ │ - , std::function handler) = 0; │ │ │ │ │ - virtual void uuppddaattee__ssttaattss__ccoouunntteerrss (counters& c) const = 0; │ │ │ │ │ - virtual std::vector ggeett__ssttaattuuss (storage_index_t) const = 0; │ │ │ │ │ - virtual void aabboorrtt (bool wait) = 0; │ │ │ │ │ - virtual void ssuubbmmiitt__jjoobbss () = 0; │ │ │ │ │ - virtual void sseettttiinnggss__uuppddaatteedd () = 0; │ │ │ │ │ + bbddeeccooddee__nnooddee () = default; │ │ │ │ │ + bbddeeccooddee__nnooddee (bdecode_node const&); │ │ │ │ │ + bbddeeccooddee__nnooddee (bdecode_node&&) noexcept; │ │ │ │ │ + bdecode_node& ooppeerraattoorr== (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 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; │ │ │ │ │ + int ddiicctt__ssiizzee () const; │ │ │ │ │ + bdecode_node ddiicctt__ffiinndd (string_view key) const; │ │ │ │ │ + bdecode_node ddiicctt__ffiinndd__lliisstt (string_view key) const; │ │ │ │ │ + bdecode_node ddiicctt__ffiinndd__ssttrriinngg (string_view key) const; │ │ │ │ │ + std::int64_t ddiicctt__ffiinndd__iinntt__vvaalluuee (string_view key │ │ │ │ │ + , std::int64_t default_val = 0) const; │ │ │ │ │ + std::pair ddiicctt__aatt (int i) const; │ │ │ │ │ + std::pair ddiicctt__aatt__nnooddee (int i) const; │ │ │ │ │ + bdecode_node ddiicctt__ffiinndd__iinntt (string_view key) const; │ │ │ │ │ + bdecode_node ddiicctt__ffiinndd__ddiicctt (string_view key) const; │ │ │ │ │ + string_view ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee (string_view key │ │ │ │ │ + , string_view default_value = string_view()) const; │ │ │ │ │ + std::int64_t iinntt__vvaalluuee () const; │ │ │ │ │ + char const* ssttrriinngg__ppttrr () const; │ │ │ │ │ + string_view ssttrriinngg__vvaalluuee () const; │ │ │ │ │ + std::ptrdiff_t ssttrriinngg__ooffffsseett () 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 error) const; │ │ │ │ │ │ │ │ │ │ - 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; │ │ │ │ │ + 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__ttoorrrreenntt(()) ********** │ │ │ │ │ -virtual storage_holder nneeww__ttoorrrreenntt (storage_params const& p │ │ │ │ │ - , std::shared_ptr 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 bool aassyynncc__wwrriittee (storage_index_t storage, peer_request const& r │ │ │ │ │ - , char const* buf, std::shared_ptr o │ │ │ │ │ - , std::function handler │ │ │ │ │ - , disk_job_flags_t flags = {}) = 0; │ │ │ │ │ -virtual void aassyynncc__rreeaadd (storage_index_t storage, peer_request const& r │ │ │ │ │ - , std::function 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 v2 │ │ │ │ │ - , disk_job_flags_t flags │ │ │ │ │ - , std::function 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 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 │ │ │ │ │ -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 handler = std::function()) = 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 links │ │ │ │ │ - , std::function 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 handler = std::function()) = 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 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 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 prio │ │ │ │ │ - , std::function)> 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 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 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. │ │ │ │ │ +********** 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] │ │ │ │ │ - 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. │ │ │ │ │ +********** bbddeeccooddee__nnooddee(()) ooppeerraattoorr==(()) ********** │ │ │ │ │ +bbddeeccooddee__nnooddee (bdecode_node const&); │ │ │ │ │ +bbddeeccooddee__nnooddee (bdecode_node&&) noexcept; │ │ │ │ │ +bdecode_node& ooppeerraattoorr== (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] │ │ │ │ │ - flush_piece │ │ │ │ │ - this flag instructs a hash job that we just completed this piece, and it │ │ │ │ │ - should be flushed to disk │ │ │ │ │ +********** 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] │ │ │ │ │ -************ 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 (storage_index_t idx, disk_interface& disk_io); │ │ │ │ │ - ~~ssttoorraaggee__hhoollddeerr (); │ │ │ │ │ - ssttoorraaggee__hhoollddeerr () = default; │ │ │ │ │ - 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; │ │ │ │ │ -}; │ │ │ │ │ +********** 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] │ │ │ │ │ -************ 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 void sseett__bbooooll (int name, bool val) = 0; │ │ │ │ │ - virtual void sseett__ssttrr (int name, std::string val) = 0; │ │ │ │ │ - virtual bool hhaass__vvaall (int name) const = 0; │ │ │ │ │ - virtual std::string const& ggeett__ssttrr (int name) const = 0; │ │ │ │ │ - virtual bool ggeett__bbooooll (int name) const = 0; │ │ │ │ │ - virtual int ggeett__iinntt (int name) const = 0; │ │ │ │ │ -}; │ │ │ │ │ +********** 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] │ │ │ │ │ -************ 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; │ │ │ │ │ -}; │ │ │ │ │ +********** ddaattaa__ooffffsseett(()) ddaattaa__sseeccttiioonn(()) ********** │ │ │ │ │ +std::ptrdiff_t ddaattaa__ooffffsseett () const noexcept; │ │ │ │ │ +span 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] │ │ │ │ │ -********** 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 │ │ │ │ │ +********** lliisstt__iinntt__vvaalluuee__aatt(()) lliisstt__ssttrriinngg__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] │ │ │ │ │ -************ 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; │ │ │ │ │ -}; │ │ │ │ │ +********** ddiicctt__aatt__nnooddee(()) ddiicctt__ffiinndd__ssttrriinngg(()) ddiicctt__ffiinndd__iinntt(()) ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee │ │ │ │ │ +(()) ddiicctt__ffiinndd__lliisstt(()) ddiicctt__ffiinndd__ddiicctt(()) ddiicctt__ffiinndd__iinntt__vvaalluuee(()) ddiicctt__aatt(()) ddiicctt__ssiizzee │ │ │ │ │ +(()) ddiicctt__ffiinndd(()) ********** │ │ │ │ │ +int ddiicctt__ssiizzee () const; │ │ │ │ │ +bdecode_node ddiicctt__ffiinndd (string_view key) const; │ │ │ │ │ +bdecode_node ddiicctt__ffiinndd__lliisstt (string_view key) const; │ │ │ │ │ +bdecode_node ddiicctt__ffiinndd__ssttrriinngg (string_view key) const; │ │ │ │ │ +std::int64_t ddiicctt__ffiinndd__iinntt__vvaalluuee (string_view key │ │ │ │ │ + , std::int64_t default_val = 0) const; │ │ │ │ │ +std::pair ddiicctt__aatt (int i) const; │ │ │ │ │ +std::pair ddiicctt__aatt__nnooddee (int i) const; │ │ │ │ │ +bdecode_node ddiicctt__ffiinndd__iinntt (string_view key) const; │ │ │ │ │ +bdecode_node ddiicctt__ffiinndd__ddiicctt (string_view key) const; │ │ │ │ │ +string_view ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee (string_view key │ │ │ │ │ + , string_view default_value = string_view()) 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] │ │ │ │ │ -************ 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; │ │ │ │ │ - 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; │ │ │ │ │ -}; │ │ │ │ │ +********** 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] │ │ │ │ │ -********** 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) │ │ │ │ │ +********** ssttrriinngg__ppttrr(()) ssttrriinngg__vvaalluuee(()) ssttrriinngg__ooffffsseett(()) ssttrriinngg__lleennggtthh(()) ********** │ │ │ │ │ +char const* ssttrriinngg__ppttrr () const; │ │ │ │ │ +string_view ssttrriinngg__vvaalluuee () const; │ │ │ │ │ +std::ptrdiff_t ssttrriinngg__ooffffsseett () 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] │ │ │ │ │ -********** ddiisskk__bbuuffffeerr__hhoollddeerr(()) ********** │ │ │ │ │ -ddiisskk__bbuuffffeerr__hhoollddeerr () noexcept = default; │ │ │ │ │ -default construct a holder that does not own any buffer │ │ │ │ │ +********** 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] │ │ │ │ │ -********** ~~ddiisskk__bbuuffffeerr__hhoollddeerr(()) ********** │ │ │ │ │ -~~ddiisskk__bbuuffffeerr__hhoollddeerr (); │ │ │ │ │ -frees disk buffer held by this object │ │ │ │ │ +********** sswwaapp(()) ********** │ │ │ │ │ +void sswwaapp (bdecode_node& n); │ │ │ │ │ +Swap contents. │ │ │ │ │ [_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. │ │ │ │ │ +********** 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] │ │ │ │ │ -********** rreesseett(()) ********** │ │ │ │ │ -void rreesseett (); │ │ │ │ │ -free the held disk buffer, if any, and clear the holder. This sets the holder │ │ │ │ │ -object to a default-constructed state │ │ │ │ │ +********** 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] │ │ │ │ │ -********** sswwaapp(()) ********** │ │ │ │ │ -void sswwaapp (disk_buffer_holder& h) noexcept; │ │ │ │ │ -swap pointers of two disk buffer holders. │ │ │ │ │ +********** hhaass__ssoofftt__eerrrroorr(()) ********** │ │ │ │ │ +bool hhaass__ssoofftt__eerrrroorr (span 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] │ │ │ │ │ -********** iiss__mmuuttaabbllee(()) ********** │ │ │ │ │ -bool iiss__mmuuttaabbllee () const noexcept; │ │ │ │ │ -if this returns true, the buffer may not be modified in place │ │ │ │ │ +********** 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] │ │ │ │ │ -********** bbooooll(()) ********** │ │ │ │ │ -explicit operator bbooooll () const noexcept; │ │ │ │ │ -implicitly convertible to true if the object is currently holding a buffer │ │ │ │ │ +************ 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] │ │ │ │ │ -************ 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 │ │ │ │ │ +************ 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 buffer │ │ │ │ │ + , error_code& ec, int* error_pos = nullptr, int depth_limit = 100 │ │ │ │ │ + , int token_limit = 2000000); │ │ │ │ │ +bdecode_node bbddeeccooddee (span 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. │ │ │ │ │ +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] │ │ │ │ │ -************ 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 │ │ │ │ │ +************ 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 │ │ │ │ │ { │ │ │ │ │ - bool ooppeerraattoorr==== (web_seed_entry const& e) const; │ │ │ │ │ - bool ooppeerraattoorr<< (web_seed_entry const& e) const; │ │ │ │ │ + void sseett__ppeeeerr (tcp::endpoint const& ep); │ │ │ │ │ + _t_c_p_:_:_e_n_d_p_o_i_n_t ppeeeerr () const; │ │ │ │ │ │ │ │ │ │ - enum type_t │ │ │ │ │ + enum block_state_t │ │ │ │ │ { │ │ │ │ │ - url_seed, │ │ │ │ │ - http_seed, │ │ │ │ │ + none, │ │ │ │ │ + requested, │ │ │ │ │ + writing, │ │ │ │ │ + finished, │ │ │ │ │ }; │ │ │ │ │ │ │ │ │ │ - std::string url; │ │ │ │ │ - std::string auth; │ │ │ │ │ - headers_t extra_headers; │ │ │ │ │ - std::uint8_t type; │ │ │ │ │ + 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] │ │ │ │ │ -********** 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 │ │ │ │ │ +********** 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 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_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +********** 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 | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_e_e_r_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|requested|1 |The block has been requested, but not completely downloaded| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_y_e_t_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|writing |2 |The block has been downloaded and is currently queued for | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_b_e_i_n_g_ _w_r_i_t_t_e_n_ _t_o_ _d_i_s_k_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_f_i_n_i_s_h_e_d_ _|_3_ _ _ _ _|_T_h_e_ _b_l_o_c_k_ _h_a_s_ _b_e_e_n_ _w_r_i_t_t_e_n_ _t_o_ _d_i_s_k_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - url │ │ │ │ │ - The URL of the web seed │ │ │ │ │ + bytes_progress │ │ │ │ │ + the number of bytes that have been received for this block │ │ │ │ │ [_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. │ │ │ │ │ + block_size │ │ │ │ │ + the total number of bytes in this block. │ │ │ │ │ [_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 │ │ │ │ │ + state │ │ │ │ │ + the state this block is in (see _b_l_o_c_k___s_t_a_t_e___t) │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - type │ │ │ │ │ - The type of web seed (see _t_y_p_e___t) │ │ │ │ │ + num_peers │ │ │ │ │ + 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. │ │ │ │ │ [_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 │ │ │ │ │ +************ ppaarrttiiaall__ppiieeccee__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" │ │ │ │ │ +This class holds information about pieces that have outstanding requests or │ │ │ │ │ +outstanding writes │ │ │ │ │ +struct partial_piece_info │ │ │ │ │ { │ │ │ │ │ - int mmaaxx__bbuuffffeerr__ssiizzee = 10000000; │ │ │ │ │ - int mmaaxx__ppiieecceess = 0x200000; │ │ │ │ │ - int mmaaxx__ddeeccooddee__ddeepptthh = 100; │ │ │ │ │ - int mmaaxx__ddeeccooddee__ttookkeennss = 3000000; │ │ │ │ │ + piece_index_t piece_index; │ │ │ │ │ + int blocks_in_piece; │ │ │ │ │ + int finished; │ │ │ │ │ + int writing; │ │ │ │ │ + int requested; │ │ │ │ │ + block_info const* blocks; │ │ │ │ │ }; │ │ │ │ │ [_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 │ │ │ │ │ + piece_index │ │ │ │ │ + the index of the piece in question. blocks_in_piece 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - max_pieces │ │ │ │ │ - the max number of pieces allowed in the torrent │ │ │ │ │ + blocks_in_piece │ │ │ │ │ + the number of blocks in this piece │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - max_decode_depth │ │ │ │ │ - the max recursion depth in the bdecoded structure │ │ │ │ │ + finished │ │ │ │ │ + the number of blocks that are in the finished state │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - max_decode_tokens │ │ │ │ │ - the max number of bdecode tokens │ │ │ │ │ + writing │ │ │ │ │ + the number of blocks that are in the writing state │ │ │ │ │ [_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 │ │ │ │ │ + requested │ │ │ │ │ + the number of blocks that are in the requested state │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + blocks │ │ │ │ │ + this is an array of blocks_in_piece number of items. One for each block │ │ │ │ │ + in the piece. │ │ │ │ │ + Warning │ │ │ │ │ + This is a pointer that points to an array that's owned by the _s_e_s_s_i_o_n │ │ │ │ │ + object. The next time _g_e_t___d_o_w_n_l_o_a_d___q_u_e_u_e_(_) is called, it will be │ │ │ │ │ + invalidated. In the case of _p_i_e_c_e___i_n_f_o___a_l_e_r_t, these pointers point into │ │ │ │ │ + the _a_l_e_r_t object itself, and will be invalidated when the _a_l_e_r_t destruct. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +************ ttoorrrreenntt__hhaannddllee ************ │ │ │ │ │ +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" │ │ │ │ │ +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. │ │ │ │ │ +Warning │ │ │ │ │ +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 │ │ │ │ │ +_t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_s_t_a_t_u_s_(_) call. │ │ │ │ │ +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 invalid_handle. │ │ │ │ │ +Warning │ │ │ │ │ +All operations on a _t_o_r_r_e_n_t___h_a_n_d_l_e may throw system_error exception, in case │ │ │ │ │ +the handle is no longer referring to a torrent. There is one exception _i_s___v_a_l_i_d │ │ │ │ │ +_(_) 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. │ │ │ │ │ +struct torrent_handle │ │ │ │ │ { │ │ │ │ │ - explicit ttoorrrreenntt__iinnffoo (span buffer, from_span_t); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (span buffer, load_torrent_limits const& cfg, │ │ │ │ │ -from_span_t); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, error_code& ec); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (char const* buffer, int size); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, load_torrent_limits const& │ │ │ │ │ -cfg); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (torrent_info const& t); │ │ │ │ │ - explicit ttoorrrreenntt__iinnffoo (info_hash_t const& info_hash); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (std::string const& filename, load_torrent_limits const& cfg); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec); │ │ │ │ │ - explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file); │ │ │ │ │ - explicit ttoorrrreenntt__iinnffoo (std::string const& filename); │ │ │ │ │ - ttoorrrreenntt__iinnffoo (span buffer, error_code& ec, from_span_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); │ │ │ │ │ - std::vector const& ttrraacckkeerrss () const; │ │ │ │ │ - void aadddd__ttrraacckkeerr (std::string const& url, int tier = 0); │ │ │ │ │ - void cclleeaarr__ttrraacckkeerrss (); │ │ │ │ │ - std::vector ssiimmiillaarr__ttoorrrreennttss () const; │ │ │ │ │ - std::vector ccoolllleeccttiioonnss () const; │ │ │ │ │ - void sseett__wweebb__sseeeeddss (std::vector 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 const& wweebb__sseeeeddss () const; │ │ │ │ │ - std::int64_t ttoottaall__ssiizzee () const; │ │ │ │ │ - int nnuumm__ppiieecceess () const; │ │ │ │ │ - int ppiieeccee__lleennggtthh () const; │ │ │ │ │ - int bblloocckkss__ppeerr__ppiieeccee () const; │ │ │ │ │ - piece_index_t llaasstt__ppiieeccee () const; │ │ │ │ │ - piece_index_t eenndd__ppiieeccee () const; │ │ │ │ │ - index_range ppiieeccee__rraannggee () const; │ │ │ │ │ - sha1_hash iinnffoo__hhaasshh () const noexcept; │ │ │ │ │ - info_hash_t const& iinnffoo__hhaasshheess () const; │ │ │ │ │ - bool vv11 () const; │ │ │ │ │ - bool vv22 () const; │ │ │ │ │ - int nnuumm__ffiilleess () const; │ │ │ │ │ - std::vector 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; │ │ │ │ │ + friend std::size_t hhaasshh__vvaalluuee (torrent_handle const& th); │ │ │ │ │ + ttoorrrreenntt__hhaannddllee () noexcept = default; │ │ │ │ │ + void aadddd__ppiieeccee (piece_index_t piece, std::vector 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& v) const; │ │ │ │ │ + void ppoosstt__ssttaattuuss (status_flags_t flags = status_flags_t::all()) const; │ │ │ │ │ + torrent_status ssttaattuuss (status_flags_t flags = status_flags_t::all()) const; │ │ │ │ │ + void ggeett__ddoowwnnllooaadd__qquueeuuee (std::vector& queue) const; │ │ │ │ │ + std::vector ggeett__ddoowwnnllooaadd__qquueeuuee () const; │ │ │ │ │ + void ppoosstt__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 ffiillee__pprrooggrreessss (std::vector& progress, │ │ │ │ │ +file_progress_flags_t flags = {}) const; │ │ │ │ │ + void ppoosstt__ffiillee__pprrooggrreessss (file_progress_flags_t flags) const; │ │ │ │ │ + std::vector ffiillee__pprrooggrreessss (file_progress_flags_t flags = {}) │ │ │ │ │ +const; │ │ │ │ │ + std::vector ffiillee__ssttaattuuss () const; │ │ │ │ │ + void cclleeaarr__eerrrroorr () const; │ │ │ │ │ + void aadddd__ttrraacckkeerr (announce_entry const&) const; │ │ │ │ │ + void ppoosstt__ttrraacckkeerrss () const; │ │ │ │ │ + std::vector ttrraacckkeerrss () const; │ │ │ │ │ + void rreeppllaaccee__ttrraacckkeerrss (std::vector const&) const; │ │ │ │ │ + void rreemmoovvee__uurrll__sseeeedd (std::string const& url) const; │ │ │ │ │ + std::set uurrll__sseeeeddss () const; │ │ │ │ │ + void aadddd__uurrll__sseeeedd (std::string const& url) const; │ │ │ │ │ + void aadddd__hhttttpp__sseeeedd (std::string const& url) const; │ │ │ │ │ + std::set hhttttpp__sseeeeddss () const; │ │ │ │ │ + void rreemmoovvee__hhttttpp__sseeeedd (std::string const& url) const; │ │ │ │ │ + void aadddd__eexxtteennssiioonn ( │ │ │ │ │ + std::function(torrent_handle const&, │ │ │ │ │ +client_data_t)> const& ext │ │ │ │ │ + , client_data_t userdata = client_data_t{}); │ │ │ │ │ + bool sseett__mmeettaaddaattaa (span metadata) 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> const& nnooddeess () const; │ │ │ │ │ - void aadddd__nnooddee (std::pair const& node); │ │ │ │ │ - bool ppaarrssee__iinnffoo__sseeccttiioonn (bdecode_node const& info, error_code& ec, int │ │ │ │ │ -max_pieces); │ │ │ │ │ - bdecode_node iinnffoo (char const* key) const; │ │ │ │ │ - span iinnffoo__sseeccttiioonn () const; │ │ │ │ │ - span ppiieeccee__llaayyeerr (file_index_t) const; │ │ │ │ │ - void ffrreeee__ppiieeccee__llaayyeerrss (); │ │ │ │ │ + void rreessuummee () const; │ │ │ │ │ + void ppaauussee (pause_flags_t flags = {}) const; │ │ │ │ │ + torrent_flags_t ffllaaggss () const; │ │ │ │ │ + void sseett__ffllaaggss (torrent_flags_t flags, torrent_flags_t mask) const; │ │ │ │ │ + void uunnsseett__ffllaaggss (torrent_flags_t flags) const; │ │ │ │ │ + void sseett__ffllaaggss (torrent_flags_t flags) 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__uupp () const; │ │ │ │ │ + void qquueeuuee__ppoossiittiioonn__ddoowwnn () const; │ │ │ │ │ + queue_position_t qquueeuuee__ppoossiittiioonn () 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 ttoorrrreenntt__ffiillee () const; │ │ │ │ │ + std::shared_ptr ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess () const; │ │ │ │ │ + std::vector> ppiieeccee__llaayyeerrss () const; │ │ │ │ │ + void ppiieeccee__aavvaaiillaabbiilliittyy (std::vector& avail) const; │ │ │ │ │ + void ppoosstt__ppiieeccee__aavvaaiillaabbiilliittyy () const; │ │ │ │ │ + void pprriioorriittiizzee__ppiieecceess (std::vector> const& pieces) const; │ │ │ │ │ + std::vector ggeett__ppiieeccee__pprriioorriittiieess () const; │ │ │ │ │ + download_priority_t ppiieeccee__pprriioorriittyy (piece_index_t index) const; │ │ │ │ │ + void ppiieeccee__pprriioorriittyy (piece_index_t index, download_priority_t priority) │ │ │ │ │ +const; │ │ │ │ │ + void pprriioorriittiizzee__ppiieecceess (std::vector const& pieces) │ │ │ │ │ +const; │ │ │ │ │ + void ffiillee__pprriioorriittyy (file_index_t index, download_priority_t priority) const; │ │ │ │ │ + void pprriioorriittiizzee__ffiilleess (std::vector const& files) const; │ │ │ │ │ + download_priority_t ffiillee__pprriioorriittyy (file_index_t index) const; │ │ │ │ │ + std::vector ggeett__ffiillee__pprriioorriittiieess () const; │ │ │ │ │ + void ffoorrccee__rreeaannnnoouunnccee (int seconds = 0, int idx = -1, reannounce_flags_t = │ │ │ │ │ +{}) const; │ │ │ │ │ + void ffoorrccee__llssdd__aannnnoouunnccee () const; │ │ │ │ │ + void ffoorrccee__ddhhtt__aannnnoouunnccee () const; │ │ │ │ │ + void ssccrraappee__ttrraacckkeerr (int idx = -1) const; │ │ │ │ │ + int ddoowwnnllooaadd__lliimmiitt () const; │ │ │ │ │ + void sseett__ddoowwnnllooaadd__lliimmiitt (int limit) const; │ │ │ │ │ + void sseett__uuppllooaadd__lliimmiitt (int limit) const; │ │ │ │ │ + int uuppllooaadd__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; │ │ │ │ │ + int mmaaxx__ccoonnnneeccttiioonnss () const; │ │ │ │ │ + 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; │ │ │ │ │ + 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; │ │ │ │ │ + std::uint32_t iidd () const; │ │ │ │ │ + std::shared_ptr 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; │ │ │ │ │ + static constexpr status_flags_t qquueerryy__aaccccuurraattee__ddoowwnnllooaadd__ccoouunntteerrss = 1_bit; │ │ │ │ │ + static constexpr status_flags_t qquueerryy__llaasstt__sseeeenn__ccoommpplleettee = 2_bit; │ │ │ │ │ + static constexpr status_flags_t qquueerryy__ppiieecceess = 3_bit; │ │ │ │ │ + static constexpr status_flags_t qquueerryy__vveerriiffiieedd__ppiieecceess = 4_bit; │ │ │ │ │ + static constexpr status_flags_t qquueerryy__ttoorrrreenntt__ffiillee = 5_bit; │ │ │ │ │ + static constexpr status_flags_t qquueerryy__nnaammee = 6_bit; │ │ │ │ │ + static constexpr status_flags_t qquueerryy__ssaavvee__ppaatthh = 7_bit; │ │ │ │ │ + static constexpr deadline_flags_t aalleerrtt__wwhheenn__aavvaaiillaabbllee = 0_bit; │ │ │ │ │ + static constexpr file_progress_flags_t ppiieeccee__ggrraannuullaarriittyy = 0_bit; │ │ │ │ │ + static constexpr pause_flags_t ggrraacceeffuull__ppaauussee = 0_bit; │ │ │ │ │ + static constexpr resume_data_flags_t fflluusshh__ddiisskk__ccaacchhee = 0_bit; │ │ │ │ │ + static constexpr resume_data_flags_t ssaavvee__iinnffoo__ddiicctt = 1_bit; │ │ │ │ │ + static constexpr resume_data_flags_t oonnllyy__iiff__mmooddiiffiieedd = 2_bit; │ │ │ │ │ + static constexpr resume_data_flags_t iiff__ccoouunntteerrss__cchhaannggeedd = 3_bit; │ │ │ │ │ + static constexpr resume_data_flags_t iiff__ddoowwnnllooaadd__pprrooggrreessss = 4_bit; │ │ │ │ │ + static constexpr resume_data_flags_t iiff__ccoonnffiigg__cchhaannggeedd = 5_bit; │ │ │ │ │ + static constexpr resume_data_flags_t iiff__ssttaattee__cchhaannggeedd = 6_bit; │ │ │ │ │ + static constexpr resume_data_flags_t iiff__mmeettaaddaattaa__cchhaannggeedd = 7_bit; │ │ │ │ │ + static constexpr reannounce_flags_t iiggnnoorree__mmiinn__iinntteerrvvaall = 0_bit; │ │ │ │ │ }; │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ttoorrrreenntt__iinnffoo(()) ********** │ │ │ │ │ -explicit ttoorrrreenntt__iinnffoo (span buffer, from_span_t); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (span buffer, load_torrent_limits const& cfg, │ │ │ │ │ -from_span_t); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, error_code& ec); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (char const* buffer, int size); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, load_torrent_limits const& │ │ │ │ │ -cfg); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (torrent_info const& t); │ │ │ │ │ -explicit ttoorrrreenntt__iinnffoo (info_hash_t const& info_hash); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (std::string const& filename, load_torrent_limits const& cfg); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec); │ │ │ │ │ -explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file); │ │ │ │ │ -explicit ttoorrrreenntt__iinnffoo (std::string const& filename); │ │ │ │ │ -ttoorrrreenntt__iinnffoo (span buffer, error_code& ec, from_span_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 │ │ │ │ │ +********** ttoorrrreenntt__hhaannddllee(()) ********** │ │ │ │ │ +ttoorrrreenntt__hhaannddllee () noexcept = default; │ │ │ │ │ +constructs a torrent handle that does not refer to a torrent. i.e. _i_s___v_a_l_i_d_(_) │ │ │ │ │ +will return false. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** oorriigg__ffiilleess(()) 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. │ │ │ │ │ +********** aadddd__ppiieeccee(()) ********** │ │ │ │ │ +void aadddd__ppiieeccee (piece_index_t piece, std::vector data, add_piece_flags_t │ │ │ │ │ +flags = {}) const; │ │ │ │ │ +void aadddd__ppiieeccee (piece_index_t piece, char const* data, add_piece_flags_t flags │ │ │ │ │ += {}) const; │ │ │ │ │ +This function will write data to the storage as piece piece, as if it had been │ │ │ │ │ +downloaded from a peer. │ │ │ │ │ +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. │ │ │ │ │ +Since the data is written asynchronously, you may know that is passed or failed │ │ │ │ │ +the hash check by waiting for _p_i_e_c_e___f_i_n_i_s_h_e_d___a_l_e_r_t or _h_a_s_h___f_a_i_l_e_d___a_l_e_r_t. │ │ │ │ │ +Adding pieces while the torrent is being checked (i.e. in _t_o_r_r_e_n_t___s_t_a_t_u_s_:_: │ │ │ │ │ +_c_h_e_c_k_i_n_g___f_i_l_e_s state) is not supported. │ │ │ │ │ +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. data is expected to point to a buffer of as many bytes as the size of │ │ │ │ │ +the specified piece. See _f_i_l_e___s_t_o_r_a_g_e_:_:_p_i_e_c_e___s_i_z_e_(_). │ │ │ │ │ +The data in the buffer is copied and passed on to the disk IO thread to be │ │ │ │ │ +written at a later point. │ │ │ │ │ +The overload taking a std::vector is not blocking, it will send the │ │ │ │ │ +buffer to the main thread and return immediately. │ │ │ │ │ [_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. │ │ │ │ │ +********** rreeaadd__ppiieeccee(()) ********** │ │ │ │ │ +void rreeaadd__ppiieeccee (piece_index_t piece) const; │ │ │ │ │ +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. │ │ │ │ │ +When the read operation is completed, it is passed back through an _a_l_e_r_t, │ │ │ │ │ +_r_e_a_d___p_i_e_c_e___a_l_e_r_t. 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. │ │ │ │ │ +Note that if you read multiple pieces, the read operations are not guaranteed │ │ │ │ │ +to finish in the same order as you initiated them. │ │ │ │ │ [_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. │ │ │ │ │ +********** 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] │ │ │ │ │ -********** cclleeaarr__ttrraacckkeerrss(()) ttrraacckkeerrss(()) aadddd__ttrraacckkeerr(()) ********** │ │ │ │ │ -void aadddd__ttrraacckkeerr (std::string const& url, int tier │ │ │ │ │ - , announce_entry::tracker_source source); │ │ │ │ │ -std::vector const& ttrraacckkeerrss () const; │ │ │ │ │ -void aadddd__ttrraacckkeerr (std::string const& url, int tier = 0); │ │ │ │ │ -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. │ │ │ │ │ +********** ppoosstt__ppeeeerr__iinnffoo(()) ggeett__ppeeeerr__iinnffoo(()) ********** │ │ │ │ │ +void ppoosstt__ppeeeerr__iinnffoo () const; │ │ │ │ │ +void ggeett__ppeeeerr__iinnffoo (std::vector& 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, │ │ │ │ │ +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] │ │ │ │ │ -********** ssiimmiillaarr__ttoorrrreennttss(()) ccoolllleeccttiioonnss(()) ********** │ │ │ │ │ -std::vector ssiimmiillaarr__ttoorrrreennttss () const; │ │ │ │ │ -std::vector 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. │ │ │ │ │ +********** ppoosstt__ssttaattuuss(()) ssttaattuuss(()) ********** │ │ │ │ │ +void ppoosstt__ssttaattuuss (status_flags_t flags = status_flags_t::all()) const; │ │ │ │ │ +torrent_status 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 │ │ │ │ │ +issues), you can filter them out. │ │ │ │ │ +The status() function will block until the internal libtorrent thread responds │ │ │ │ │ +with the _t_o_r_r_e_n_t___s_t_a_t_u_s object. To avoid blocking, instead call post_status(). │ │ │ │ │ +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] │ │ │ │ │ -********** wweebb__sseeeeddss(()) aadddd__uurrll__sseeeedd(()) sseett__wweebb__sseeeeddss(()) aadddd__hhttttpp__sseeeedd(()) ********** │ │ │ │ │ -void sseett__wweebb__sseeeeddss (std::vector 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 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 │ │ │ │ │ +********** ppoosstt__ddoowwnnllooaadd__qquueeuuee(()) ggeett__ddoowwnnllooaadd__qquueeuuee(()) ********** │ │ │ │ │ +void ggeett__ddoowwnnllooaadd__qquueeuuee (std::vector& queue) const; │ │ │ │ │ +std::vector ggeett__ddoowwnnllooaadd__qquueeuuee () const; │ │ │ │ │ +void ppoosstt__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. │ │ │ │ │ -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] │ │ │ │ │ -********** nnuumm__ppiieecceess(()) ppiieeccee__lleennggtthh(()) ********** │ │ │ │ │ -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. │ │ │ │ │ +********** sseett__ppiieeccee__ddeeaaddlliinnee(()) cclleeaarr__ppiieeccee__ddeeaaddlliinneess(()) 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; │ │ │ │ │ +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, │ │ │ │ │ +unless the alert_when_available flag is set, in which case it will have the │ │ │ │ │ +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] │ │ │ │ │ -********** 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) │ │ │ │ │ +********** ppoosstt__ffiillee__pprrooggrreessss(()) ffiillee__pprrooggrreessss(()) ********** │ │ │ │ │ +void ffiillee__pprrooggrreessss (std::vector& progress, file_progress_flags_t │ │ │ │ │ +flags = {}) const; │ │ │ │ │ +void ppoosstt__ffiillee__pprrooggrreessss (file_progress_flags_t flags) const; │ │ │ │ │ +std::vector 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 │ │ │ │ │ +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 │ │ │ │ │ +progress. If left at the default value of 0, the progress will be as accurate │ │ │ │ │ +as possible, but also more expensive to calculate. If torrent_handle:: │ │ │ │ │ +piece_granularity 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. │ │ │ │ │ [_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 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. │ │ │ │ │ +********** ffiillee__ssttaattuuss(()) ********** │ │ │ │ │ +std::vector ffiillee__ssttaattuuss () const; │ │ │ │ │ +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. │ │ │ │ │ +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] │ │ │ │ │ -********** iinnffoo__hhaasshh(()) iinnffoo__hhaasshheess(()) ********** │ │ │ │ │ -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 │ │ │ │ │ +********** 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] │ │ │ │ │ -********** vv22(()) vv11(()) ********** │ │ │ │ │ -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. │ │ │ │ │ +********** ttrraacckkeerrss(()) rreeppllaaccee__ttrraacckkeerrss(()) ppoosstt__ttrraacckkeerrss(()) aadddd__ttrraacckkeerr(()) ********** │ │ │ │ │ +void aadddd__ttrraacckkeerr (announce_entry const&) const; │ │ │ │ │ +void ppoosstt__ttrraacckkeerrss () const; │ │ │ │ │ +std::vector ttrraacckkeerrss () const; │ │ │ │ │ +void rreeppllaaccee__ttrraacckkeerrss (std::vector 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, │ │ │ │ │ +you have to call _f_o_r_c_e___r_e_a_n_n_o_u_n_c_e_(_). See _a_n_n_o_u_n_c_e___e_n_t_r_y. │ │ │ │ │ +post_trackers() is the asynchronous version of trackers(). It will trigger a │ │ │ │ │ +_t_r_a_c_k_e_r___l_i_s_t___a_l_e_r_t 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 _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] │ │ │ │ │ -********** 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. │ │ │ │ │ +********** aadddd__uurrll__sseeeedd(()) rreemmoovvee__uurrll__sseeeedd(()) uurrll__sseeeeddss(()) ********** │ │ │ │ │ +void rreemmoovvee__uurrll__sseeeedd (std::string const& url) const; │ │ │ │ │ +std::set 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] │ │ │ │ │ -********** mmaapp__bblloocckk(()) ********** │ │ │ │ │ -std::vector 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. │ │ │ │ │ +********** aadddd__hhttttpp__sseeeedd(()) rreemmoovvee__hhttttpp__sseeeedd(()) hhttttpp__sseeeeddss(()) ********** │ │ │ │ │ +void aadddd__hhttttpp__sseeeedd (std::string const& url) const; │ │ │ │ │ +std::set hhttttpp__sseeeeddss () 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] │ │ │ │ │ -********** 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(). │ │ │ │ │ +********** aadddd__eexxtteennssiioonn(()) ********** │ │ │ │ │ +void aadddd__eexxtteennssiioonn ( │ │ │ │ │ + std::function(torrent_handle const&, │ │ │ │ │ +client_data_t)> const& ext │ │ │ │ │ + , client_data_t userdata = client_data_t{}); │ │ │ │ │ +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 _t_o_r_r_e_n_t___p_l_u_g_i_n instance. │ │ │ │ │ [_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. │ │ │ │ │ +********** sseett__mmeettaaddaattaa(()) ********** │ │ │ │ │ +bool sseett__mmeettaaddaattaa (span metadata) const; │ │ │ │ │ +set_metadata expects the iinnffoo section of metadata. i.e. The buffer passed in │ │ │ │ │ +will be hashed and verified against the info-hash. If it fails, a │ │ │ │ │ +metadata_failed_alert will be generated. If it passes, a │ │ │ │ │ +metadata_received_alert 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. │ │ │ │ │ [_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(()) hhaasshh__ffoorr__ppiieeccee__ppttrr(()) ********** │ │ │ │ │ -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> 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 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_(_). │ │ │ │ │ +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 │ │ │ │ │ +_s_e_s_s_i_o_n AND destructed. │ │ │ │ │ +To tell if the _t_o_r_r_e_n_t___h_a_n_d_l_e is in the _s_e_s_s_i_o_n, use _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_i_n___s_e_s_s_i_o_n │ │ │ │ │ +_(_). This will return true before _s_e_s_s_i_o_n___h_a_n_d_l_e_:_:_r_e_m_o_v_e___t_o_r_r_e_n_t_(_) is called, │ │ │ │ │ +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] │ │ │ │ │ -********** 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. │ │ │ │ │ +********** rreessuummee(()) ppaauussee(()) ********** │ │ │ │ │ +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. │ │ │ │ │ +For possible values of the flags parameter, see pause_flags_t. │ │ │ │ │ +To know if a torrent is paused or not, call torrent_handle::flags() and check │ │ │ │ │ +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] │ │ │ │ │ -********** iinnffoo__sseeccttiioonn(()) ********** │ │ │ │ │ -span 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 │ │ │ │ │ +********** uunnsseett__ffllaaggss(()) sseett__ffllaaggss(()) ffllaaggss(()) ********** │ │ │ │ │ +torrent_flags_t ffllaaggss () const; │ │ │ │ │ +void sseett__ffllaaggss (torrent_flags_t flags, torrent_flags_t mask) const; │ │ │ │ │ +void uunnsseett__ffllaaggss (torrent_flags_t flags) const; │ │ │ │ │ +void sseett__ffllaaggss (torrent_flags_t flags) 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 │ │ │ │ │ +added, and it can only be set as part of the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s flags, when │ │ │ │ │ +adding the torrent. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ppiieeccee__llaayyeerr(()) ********** │ │ │ │ │ -span 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. │ │ │ │ │ +********** fflluusshh__ccaacchhee(()) ********** │ │ │ │ │ +void fflluusshh__ccaacchhee () const; │ │ │ │ │ +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 _c_a_c_h_e___f_l_u_s_h_e_d___a_l_e_r_t. │ │ │ │ │ +Note that by the time you get the _a_l_e_r_t, libtorrent may have cached more data │ │ │ │ │ +for the torrent, but you are guaranteed that whatever cached data libtorrent │ │ │ │ │ +had by the time you called torrent_handle::flush_cache() has been written to │ │ │ │ │ +disk. │ │ │ │ │ [_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. │ │ │ │ │ -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: │ │ │ │ │ +********** ffoorrccee__rreecchheecckk(()) ********** │ │ │ │ │ +void ffoorrccee__rreecchheecckk () const; │ │ │ │ │ +force_recheck 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 _s_e_s_s_i_o_n. │ │ │ │ │ [_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 │ │ │ │ │ +********** ssaavvee__rreessuummee__ddaattaa(()) ********** │ │ │ │ │ +void ssaavvee__rreessuummee__ddaattaa (resume_data_flags_t flags = {}) const; │ │ │ │ │ +save_resume_data() asks libtorrent to generate fast-resume data for this │ │ │ │ │ +torrent. The fast resume data (stored in an _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object) can be │ │ │ │ │ +used to resume a torrent in the next _s_e_s_s_i_o_n without having to check all files │ │ │ │ │ +for which pieces have been downloaded. It can also be used to save a .torrent │ │ │ │ │ +file for a _t_o_r_r_e_n_t___h_a_n_d_l_e. │ │ │ │ │ +This operation is asynchronous, save_resume_data will return immediately. The │ │ │ │ │ +resume data is delivered when it's done through a _s_a_v_e___r_e_s_u_m_e___d_a_t_a___a_l_e_r_t. │ │ │ │ │ +The operation will fail, and post a _s_a_v_e___r_e_s_u_m_e___d_a_t_a___f_a_i_l_e_d___a_l_e_r_t instead, in │ │ │ │ │ +the following cases: │ │ │ │ │ + 1. The torrent is in the process of being removed. │ │ │ │ │ + 2. No torrent state has changed since the last saving of resume │ │ │ │ │ + data, and the only_if_modified flag is set. metadata (see │ │ │ │ │ + libtorrent's _m_e_t_a_d_a_t_a_ _f_r_o_m_ _p_e_e_r_s extension) │ │ │ │ │ +Note that some _c_o_u_n_t_e_r_s may be outdated by the time you receive the fast resume │ │ │ │ │ +data │ │ │ │ │ +When saving resume data because of shutting down, make sure not to │ │ │ │ │ +_r_e_m_o_v_e___t_o_r_r_e_n_t_(_) before you receive the _s_a_v_e___r_e_s_u_m_e___d_a_t_a___a_l_e_r_t. There's no need │ │ │ │ │ +to pause the _s_e_s_s_i_o_n or torrent when saving resume data. │ │ │ │ │ +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. │ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ │ │ │ │ │ -|_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 │ │ │ │ │ +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. │ │ │ │ │ +Example code to pause and save resume data for all torrents and wait for the │ │ │ │ │ +alerts: │ │ │ │ │ +extern int outstanding_resume_data; // global counter of outstanding resume │ │ │ │ │ +data │ │ │ │ │ +std::vector handles = ses.get_torrents(); │ │ │ │ │ +for (torrent_handle const& h : handles) try │ │ │ │ │ { │ │ │ │ │ - friend void aappppllyy__ppaacckk__iimmppll (settings_pack const* │ │ │ │ │ - , aux::session_settings_single_thread& │ │ │ │ │ - , std::vector*); │ │ │ │ │ - void sseett__iinntt (int name, int val) override; │ │ │ │ │ - void sseett__bbooooll (int name, bool val) override; │ │ │ │ │ - void sseett__iinntt (int name, flags::bitfield_flag const val); │ │ │ │ │ - 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; │ │ │ │ │ - std::string const& ggeett__ssttrr (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, │ │ │ │ │ - }; │ │ │ │ │ + h.save_resume_data(torrent_handle::only_if_modified); │ │ │ │ │ + ++outstanding_resume_data; │ │ │ │ │ +} │ │ │ │ │ +catch (lt::system_error const& e) │ │ │ │ │ +{ │ │ │ │ │ + // the handle was invalid, ignore this one and move to the next │ │ │ │ │ +} │ │ │ │ │ │ │ │ │ │ - enum seed_choking_algorithm_t │ │ │ │ │ - { │ │ │ │ │ - round_robin, │ │ │ │ │ - fastest_upload, │ │ │ │ │ - anti_leech, │ │ │ │ │ - }; │ │ │ │ │ +while (outstanding_resume_data > 0) │ │ │ │ │ +{ │ │ │ │ │ + alert const* a = ses.wait_for_alert(seconds(30)); │ │ │ │ │ │ │ │ │ │ - enum io_buffer_mode_t │ │ │ │ │ - { │ │ │ │ │ - enable_os_cache, │ │ │ │ │ - deprecated_disable_os_cache_for_aligned_files, │ │ │ │ │ - disable_os_cache, │ │ │ │ │ - write_through, │ │ │ │ │ - }; │ │ │ │ │ + // if we don't get an alert within 30 seconds, abort │ │ │ │ │ + if (a == nullptr) break; │ │ │ │ │ │ │ │ │ │ - enum bandwidth_mixed_algo_t │ │ │ │ │ - { │ │ │ │ │ - prefer_tcp, │ │ │ │ │ - peer_proportional, │ │ │ │ │ - }; │ │ │ │ │ + std::vector alerts; │ │ │ │ │ + ses.pop_alerts(&alerts); │ │ │ │ │ │ │ │ │ │ - enum enc_policy │ │ │ │ │ - { │ │ │ │ │ - pe_forced, │ │ │ │ │ - pe_enabled, │ │ │ │ │ - pe_disabled, │ │ │ │ │ - }; │ │ │ │ │ + for (alert* i : alerts) │ │ │ │ │ + { │ │ │ │ │ + if (alert_cast(i)) │ │ │ │ │ + { │ │ │ │ │ + process_alert(i); │ │ │ │ │ + --outstanding_resume_data; │ │ │ │ │ + continue; │ │ │ │ │ + } │ │ │ │ │ │ │ │ │ │ - enum enc_level │ │ │ │ │ - { │ │ │ │ │ - pe_plaintext, │ │ │ │ │ - pe_rc4, │ │ │ │ │ - pe_both, │ │ │ │ │ - }; │ │ │ │ │ + save_resume_data_alert const* rd = │ │ │ │ │ +alert_cast(i); │ │ │ │ │ + if (rd == nullptr) │ │ │ │ │ + { │ │ │ │ │ + process_alert(i); │ │ │ │ │ + continue; │ │ │ │ │ + } │ │ │ │ │ │ │ │ │ │ - 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 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__ssttrr(()) ggeett__iinntt(()) ggeett__bbooooll(()) ********** │ │ │ │ │ -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. │ │ │ │ │ -[_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] │ │ │ │ │ -************ 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] │ │ │ │ │ -************ 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. │ │ │ │ │ -[_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 (bitfield&& rhs) noexcept = default; │ │ │ │ │ - explicit bbiittffiieelldd (int bits); │ │ │ │ │ - bbiittffiieelldd (char const* b, int bits); │ │ │ │ │ - bbiittffiieelldd (bitfield const& rhs); │ │ │ │ │ - bbiittffiieelldd () noexcept = default; │ │ │ │ │ - bbiittffiieelldd (int bits, bool val); │ │ │ │ │ - void aassssiiggnn (char const* b, int const bits); │ │ │ │ │ - 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; │ │ │ │ │ - bool eemmppttyy () const noexcept; │ │ │ │ │ - char const* ddaattaa () const noexcept; │ │ │ │ │ - char* ddaattaa () 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 (bitfield&& rhs) noexcept = default; │ │ │ │ │ -explicit bbiittffiieelldd (int bits); │ │ │ │ │ -bbiittffiieelldd (char const* b, int bits); │ │ │ │ │ -bbiittffiieelldd (bitfield const& rhs); │ │ │ │ │ -bbiittffiieelldd () noexcept = default; │ │ │ │ │ -bbiittffiieelldd (int bits, bool val); │ │ │ │ │ -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 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] │ │ │ │ │ -********** 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 const* ddaattaa () const noexcept; │ │ │ │ │ -char* ddaattaa () 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] │ │ │ │ │ -************ 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 data); │ │ │ │ │ - hasher& ooppeerraattoorr== (hasher const&) &; │ │ │ │ │ - hhaasshheerr (hasher const&); │ │ │ │ │ - hasher& uuppddaattee (char const* data, int len); │ │ │ │ │ - hasher& uuppddaattee (span data); │ │ │ │ │ - sha1_hash ffiinnaall (); │ │ │ │ │ - void rreesseett (); │ │ │ │ │ -}; │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** hhaasshheerr(()) ooppeerraattoorr==(()) ********** │ │ │ │ │ -hhaasshheerr (char const* data, int len); │ │ │ │ │ -explicit hhaasshheerr (span 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 (char const* data, int len); │ │ │ │ │ -hasher& uuppddaattee (span data); │ │ │ │ │ -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. │ │ │ │ │ + std::ofstream out((rd->params.save_path │ │ │ │ │ + + "/" + rd->params.name + ".fastresume").c_str() │ │ │ │ │ + , std::ios_base::binary); │ │ │ │ │ + std::vector buf = write_resume_data_buf(rd->params); │ │ │ │ │ + out.write(buf.data(), buf.size()); │ │ │ │ │ + --outstanding_resume_data; │ │ │ │ │ + } │ │ │ │ │ +} │ │ │ │ │ +Note │ │ │ │ │ +Note how outstanding_resume_data 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_l_e_r_t, 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. │ │ │ │ │ [_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. │ │ │ │ │ +********** nneeeedd__ssaavvee__rreessuummee__ddaattaa(()) ********** │ │ │ │ │ +bool nneeeedd__ssaavvee__rreessuummee__ddaattaa (resume_data_flags_t flags) const; │ │ │ │ │ +bool nneeeedd__ssaavvee__rreessuummee__ddaattaa () const; │ │ │ │ │ +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 │ │ │ │ │ +flags let you ask if specific categories of properties have changed. These │ │ │ │ │ +flags have the same behavior as in the _s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_) call. │ │ │ │ │ +This is a bblloocckkiinngg call. It will wait for a response from libtorrent's main │ │ │ │ │ +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] │ │ │ │ │ -************ 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 (char const* data, int len); │ │ │ │ │ - explicit hhaasshheerr225566 (span data); │ │ │ │ │ - hhaasshheerr225566 (hasher256 const&); │ │ │ │ │ - hasher256& ooppeerraattoorr== (hasher256 const&) &; │ │ │ │ │ - hasher256& uuppddaattee (span data); │ │ │ │ │ - hasher256& uuppddaattee (char const* data, int len); │ │ │ │ │ - sha256_hash ffiinnaall (); │ │ │ │ │ - void rreesseett (); │ │ │ │ │ - ~~hhaasshheerr225566 (); │ │ │ │ │ -}; │ │ │ │ │ +********** qquueeuuee__ppoossiittiioonn__uupp(()) qquueeuuee__ppoossiittiioonn__ttoopp(()) qquueeuuee__ppoossiittiioonn(()) │ │ │ │ │ +qquueeuuee__ppoossiittiioonn__bboottttoomm(()) qquueeuuee__ppoossiittiioonn__ddoowwnn(()) ********** │ │ │ │ │ +void qquueeuuee__ppoossiittiioonn__bboottttoomm () const; │ │ │ │ │ +void qquueeuuee__ppoossiittiioonn__uupp () const; │ │ │ │ │ +void qquueeuuee__ppoossiittiioonn__ddoowwnn () const; │ │ │ │ │ +queue_position_t qquueeuuee__ppoossiittiioonn () 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 │ │ │ │ │ +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. │ │ │ │ │ +The queue position is also available in the _t_o_r_r_e_n_t___s_t_a_t_u_s. │ │ │ │ │ +The queue_position_*() 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** hhaasshheerr225566(()) ooppeerraattoorr==(()) ********** │ │ │ │ │ -hhaasshheerr225566 (char const* data, int len); │ │ │ │ │ -explicit hhaasshheerr225566 (span data); │ │ │ │ │ -hhaasshheerr225566 (hasher256 const&); │ │ │ │ │ -hasher256& ooppeerraattoorr== (hasher256 const&) &; │ │ │ │ │ -this is the same as default constructing followed by a call to update(data, │ │ │ │ │ -len). │ │ │ │ │ +********** 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] │ │ │ │ │ -********** uuppddaattee(()) ********** │ │ │ │ │ -hasher256& uuppddaattee (span data); │ │ │ │ │ -hasher256& uuppddaattee (char const* data, int len); │ │ │ │ │ -append the following bytes to what is being hashed │ │ │ │ │ +********** sseett__ssssll__cceerrttiiffiiccaattee__bbuuffffeerr(()) sseett__ssssll__cceerrttiiffiiccaattee(()) ********** │ │ │ │ │ +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 = ""); │ │ │ │ │ +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. │ │ │ │ │ +private_key is a path to the private key for the specified certificate. This │ │ │ │ │ +must be in .pem format. │ │ │ │ │ +dh_params 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: │ │ │ │ │ +openssl dhparam -outform PEM -out dhparams.pem 512. │ │ │ │ │ +passphrase may be specified if the private key is encrypted and requires a │ │ │ │ │ +passphrase to be decrypted. │ │ │ │ │ +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] │ │ │ │ │ -********** 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. │ │ │ │ │ +********** ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess(()) ttoorrrreenntt__ffiillee(()) ********** │ │ │ │ │ +std::shared_ptr ttoorrrreenntt__ffiillee () const; │ │ │ │ │ +std::shared_ptr ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess () 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, │ │ │ │ │ +dht nodes and trackers. A _t_o_r_r_e_n_t___i_n_f_o object does not round-trip cleanly when │ │ │ │ │ +added to a _s_e_s_s_i_o_n. │ │ │ │ │ +If you want to save a .torrent file from the _t_o_r_r_e_n_t___h_a_n_d_l_e, instead call │ │ │ │ │ +_s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_) and _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_) the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object │ │ │ │ │ +passed back in the _a_l_e_r_t. │ │ │ │ │ +_t_o_r_r_e_n_t___f_i_l_e___w_i_t_h___h_a_s_h_e_s_(_) returns a ccooppyy of the internal _t_o_r_r_e_n_t___i_n_f_o 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 _t_o_r_r_e_n_t___f_i_l_e_(_) since it needs to make copies of │ │ │ │ │ +this information. │ │ │ │ │ +The _t_o_r_r_e_n_t___f_i_l_e___w_i_t_h___h_a_s_h_e_s_(_) is here for backwards compatibility when │ │ │ │ │ +constructing a _c_r_e_a_t_e___t_o_r_r_e_n_t object from a _t_o_r_r_e_n_t___i_n_f_o that's in a _s_e_s_s_i_o_n. │ │ │ │ │ +Prefer _s_a_v_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_(_). │ │ │ │ │ +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 _t_o_r_r_e_n_t___i_n_f_o returned from │ │ │ │ │ +_t_o_r_r_e_n_t___f_i_l_e___w_i_t_h___h_a_s_h_e_s_(_). Once the torrent completes downloading all files, │ │ │ │ │ +becoming a seed, you can make a .torrent file from it. │ │ │ │ │ [_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. │ │ │ │ │ +********** ppiieeccee__llaayyeerrss(()) ********** │ │ │ │ │ +std::vector> 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] │ │ │ │ │ -************ 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 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 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, │ │ │ │ │ - }; │ │ │ │ │ -}; │ │ │ │ │ +********** ppoosstt__ppiieeccee__aavvaaiillaabbiilliittyy(()) ppiieeccee__aavvaaiillaabbiilliittyy(()) ********** │ │ │ │ │ +void ppiieeccee__aavvaaiillaabbiilliittyy (std::vector& avail) const; │ │ │ │ │ +void ppoosstt__ppiieeccee__aavvaaiillaabbiilliittyy () 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 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] │ │ │ │ │ -********** 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. │ │ │ │ │ +********** ggeett__ppiieeccee__pprriioorriittiieess(()) pprriioorriittiizzee__ppiieecceess(()) ppiieeccee__pprriioorriittyy(()) ********** │ │ │ │ │ +void pprriioorriittiizzee__ppiieecceess (std::vector> const& pieces) const; │ │ │ │ │ +std::vector ggeett__ppiieeccee__pprriioorriittiieess () const; │ │ │ │ │ +download_priority_t ppiieeccee__pprriioorriittyy (piece_index_t index) const; │ │ │ │ │ +void ppiieeccee__pprriioorriittyy (piece_index_t index, download_priority_t priority) const; │ │ │ │ │ +void pprriioorriittiizzee__ppiieecceess (std::vector const& pieces) 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 │ │ │ │ │ +and so on. │ │ │ │ │ +The default priority of pieces is 4. │ │ │ │ │ +Piece priorities can not be changed for torrents that have not downloaded the │ │ │ │ │ +metadata yet. Magnet links won't have metadata immediately. see the │ │ │ │ │ +_m_e_t_a_d_a_t_a___r_e_c_e_i_v_e_d___a_l_e_r_t. │ │ │ │ │ +piece_priority sets or gets the priority for an individual piece, specified by │ │ │ │ │ +index. │ │ │ │ │ +prioritize_pieces 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 prioritize_pieces 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. │ │ │ │ │ +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] │ │ │ │ │ -********** 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. │ │ │ │ │ +********** pprriioorriittiizzee__ffiilleess(()) ffiillee__pprriioorriittyy(()) ggeett__ffiillee__pprriioorriittiieess(()) ********** │ │ │ │ │ +void ffiillee__pprriioorriittyy (file_index_t index, download_priority_t priority) const; │ │ │ │ │ +void pprriioorriittiizzee__ffiilleess (std::vector const& files) const; │ │ │ │ │ +download_priority_t ffiillee__pprriioorriittyy (file_index_t index) const; │ │ │ │ │ +std::vector 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 │ │ │ │ │ +_d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y___t. │ │ │ │ │ +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, _p_i_e_c_e___p_r_i_o_r_i_t_y_(_) has to be called again for those pieces. │ │ │ │ │ +You cannot set the file priorities on a torrent that does not yet have metadata │ │ │ │ │ +or a torrent that is a seed. file_priority(int, int) and _p_r_i_o_r_i_t_i_z_e___f_i_l_e_s_(_) are │ │ │ │ │ +both no-ops for such torrents. │ │ │ │ │ +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 _f_i_l_e___p_r_i_o___a_l_e_r_t. │ │ │ │ │ +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] │ │ │ │ │ -********** 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). │ │ │ │ │ +********** ffoorrccee__rreeaannnnoouunnccee(()) ffoorrccee__ddhhtt__aannnnoouunnccee(()) ffoorrccee__llssdd__aannnnoouunnccee(()) ********** │ │ │ │ │ +void ffoorrccee__rreeaannnnoouunnccee (int seconds = 0, int idx = -1, reannounce_flags_t = {}) │ │ │ │ │ +const; │ │ │ │ │ +void ffoorrccee__llssdd__aannnnoouunnccee () const; │ │ │ │ │ +void ffoorrccee__ddhhtt__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 - │ │ │ │ │ +1 (which is the default), all trackers are re-announce. │ │ │ │ │ +The flags argument can be used to affect the re-announce. See │ │ │ │ │ +ignore_min_interval. │ │ │ │ │ +force_dht_announce will announce the torrent to the DHT immediately. │ │ │ │ │ +force_lsd_announce will announce the torrent on LSD immediately. │ │ │ │ │ [_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_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +********** ssccrraappee__ttrraacckkeerr(()) ********** │ │ │ │ │ +void ssccrraappee__ttrraacckkeerr (int idx = -1) const; │ │ │ │ │ +scrape_tracker() will send a scrape request to a tracker. By default (idx = -1) │ │ │ │ │ +it will scrape the last working tracker. If idx is >= 0, the tracker with the │ │ │ │ │ +specified index will scraped. │ │ │ │ │ +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] │ │ │ │ │ -************ 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; │ │ │ │ │ -}; │ │ │ │ │ +********** sseett__ddoowwnnllooaadd__lliimmiitt(()) sseett__uuppllooaadd__lliimmiitt(()) uuppllooaadd__lliimmiitt(()) ddoowwnnllooaadd__lliimmiitt(()) │ │ │ │ │ +********** │ │ │ │ │ +int ddoowwnnllooaadd__lliimmiitt () const; │ │ │ │ │ +void sseett__ddoowwnnllooaadd__lliimmiitt (int limit) const; │ │ │ │ │ +void sseett__uuppllooaadd__lliimmiitt (int limit) const; │ │ │ │ │ +int uuppllooaadd__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. │ │ │ │ │ +upload_limit and download_limit will return the current limit setting, for │ │ │ │ │ +upload and download, respectively. │ │ │ │ │ +Local peers are not rate limited by default. see _p_e_e_r_ _c_l_a_s_s_e_s. │ │ │ │ │ [_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. │ │ │ │ │ +********** ccoonnnneecctt__ppeeeerr(()) ********** │ │ │ │ │ +void ccoonnnneecctt__ppeeeerr (tcp::endpoint const& adr, peer_source_flags_t source = {} │ │ │ │ │ + , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const; │ │ │ │ │ +connect_peer() 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 _p_e_e_r___i_n_f_o. i.e. tracker, │ │ │ │ │ +pex, dht etc. │ │ │ │ │ +For possible values of flags, see _p_e_x___f_l_a_g_s___t. │ │ │ │ │ [_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. │ │ │ │ │ +********** cclleeaarr__ppeeeerrss(()) ********** │ │ │ │ │ +void cclleeaarr__ppeeeerrss (); │ │ │ │ │ +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. │ │ │ │ │ [_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. │ │ │ │ │ +********** mmaaxx__uuppllooaaddss(()) sseett__mmaaxx__uuppllooaaddss(()) ********** │ │ │ │ │ +void sseett__mmaaxx__uuppllooaaddss (int max_uploads) const; │ │ │ │ │ +int mmaaxx__uuppllooaaddss () const; │ │ │ │ │ +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] │ │ │ │ │ - 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. │ │ │ │ │ +********** mmaaxx__ccoonnnneeccttiioonnss(()) sseett__mmaaxx__ccoonnnneeccttiioonnss(()) ********** │ │ │ │ │ +int mmaaxx__ccoonnnneeccttiioonnss () const; │ │ │ │ │ +void sseett__mmaaxx__ccoonnnneeccttiioonnss (int max_connections) 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. │ │ │ │ │ [_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. │ │ │ │ │ +********** mmoovvee__ssttoorraaggee(()) ********** │ │ │ │ │ +void mmoovvee__ssttoorraaggee (std::string const& save_path │ │ │ │ │ + , move_flags_t flags = move_flags_t::always_replace_files │ │ │ │ │ + ) const; │ │ │ │ │ +Moves the file(s) that this torrent are currently seeding from or downloading │ │ │ │ │ +to. If the given save_path 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. │ │ │ │ │ +Since disk IO is performed in a separate thread, this operation is also │ │ │ │ │ +asynchronous. Once the operation completes, the storage_moved_alert is │ │ │ │ │ +generated, with the new path as the message. If the move fails for some reason, │ │ │ │ │ +storage_moved_failed_alert is generated instead, containing the error message. │ │ │ │ │ +The flags argument determines the behavior of the copying/moving of the files │ │ │ │ │ +in the torrent. see _m_o_v_e___f_l_a_g_s___t. │ │ │ │ │ +always_replace_files is the default and replaces any file that exist in both │ │ │ │ │ +the source directory and the target directory. │ │ │ │ │ +fail_if_exist 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 always_replace_files 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 error of │ │ │ │ │ +move_storage_failed_alert is set to boost::system::errc::file_exists. │ │ │ │ │ +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 move_storage call │ │ │ │ │ +with one of the other modes. │ │ │ │ │ +dont_replace 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. │ │ │ │ │ +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. │ │ │ │ │ +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. │ │ │ │ │ [_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; │ │ │ │ │ - void ffiillee (file_index_t f); │ │ │ │ │ - file_index_t ffiillee () const; │ │ │ │ │ - │ │ │ │ │ - error_code ec; │ │ │ │ │ - operation_t operation; │ │ │ │ │ -}; │ │ │ │ │ +********** 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] │ │ │ │ │ -********** bbooooll(()) ********** │ │ │ │ │ -explicit operator bbooooll () const; │ │ │ │ │ -explicitly converts to true if this object represents an error, and false if it │ │ │ │ │ -does not. │ │ │ │ │ +********** 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] │ │ │ │ │ -********** ffiillee(()) ********** │ │ │ │ │ -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. │ │ │ │ │ +********** ooppeerraattoorr====(()) ooppeerraattoorr<<(()) ooppeerraattoorr!!==(()) ********** │ │ │ │ │ +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] │ │ │ │ │ - ec │ │ │ │ │ - the error that occurred │ │ │ │ │ +********** 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] │ │ │ │ │ - operation │ │ │ │ │ - A code from _o_p_e_r_a_t_i_o_n___t enum, indicating what kind of operation failed. │ │ │ │ │ +********** nnaattiivvee__hhaannddllee(()) ********** │ │ │ │ │ +std::shared_ptr nnaattiivvee__hhaannddllee () const; │ │ │ │ │ +This function is intended only for use by plugins and the _a_l_e_r_t 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 │ │ │ │ │ +_p_l_u_g_i_n callbacks). The torrent 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 TORRENT_ │ │ │ │ │ +macros must match between libtorrent and the client builds. │ │ │ │ │ [_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. │ │ │ │ │ +********** uusseerrddaattaa(()) ********** │ │ │ │ │ +client_data_t uusseerrddaattaa () const; │ │ │ │ │ +returns the userdata pointer as set in _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] │ │ │ │ │ -************ 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 │ │ │ │ │ +********** iinn__sseessssiioonn(()) ********** │ │ │ │ │ +bool iinn__sseessssiioonn () const; │ │ │ │ │ +Returns true if the torrent is in the _s_e_s_s_i_o_n. It returns true before session:: │ │ │ │ │ +remove_torrent() is called, and false afterward. │ │ │ │ │ +Note that this is a blocking function, unlike _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_i_s___v_a_l_i_d_(_) which │ │ │ │ │ +returns immediately. │ │ │ │ │ [_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 (); │ │ │ │ │ + overwrite_existing │ │ │ │ │ + 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. │ │ │ │ │ [_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 │ │ │ │ │ + query_distributed_copies │ │ │ │ │ + calculates distributed_copies, distributed_full_copies and │ │ │ │ │ + distributed_fraction. │ │ │ │ │ [_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 │ │ │ │ │ + query_accurate_download_counters │ │ │ │ │ + includes partial downloaded blocks in total_done and total_wanted_done. │ │ │ │ │ [_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 │ │ │ │ │ + query_last_seen_complete │ │ │ │ │ + includes last_seen_complete. │ │ │ │ │ [_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 │ │ │ │ │ + query_pieces │ │ │ │ │ + populate the pieces field 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] │ │ │ │ │ -************ 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 (); │ │ │ │ │ + query_verified_pieces │ │ │ │ │ + includes verified_pieces (only applies to torrents in sseeeedd mmooddee). │ │ │ │ │ [_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 | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_u_p_ _o_v_e_r_w_r_i_t_i_n_g_ _e_a_c_h_ _o_t_h_e_r_ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|failed_hash_check |2 |A piece did not match its piece | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_h_a_s_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The .torrent file does not contain| │ │ │ │ │ -|torrent_is_no_dict |3 |a bencoded dictionary at its top | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_l_e_v_e_l_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|torrent_missing_info |4 |The .torrent file does not have an| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_f_o_ _d_i_c_t_i_o_n_a_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|torrent_info_no_dict |5 |The .torrent file's info _e_n_t_r_y is | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_n_o_t_ _a_ _d_i_c_t_i_o_n_a_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|torrent_missing_piece_length |6 |The .torrent file does not have a | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_i_e_c_e_ _l_e_n_g_t_h_ _e_n_t_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|torrent_missing_name |7 |The .torrent file does not have a | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_n_a_m_e_ _e_n_t_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|torrent_invalid_name |8 |The .torrent file's name _e_n_t_r_y is | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The length of a file, or of the | │ │ │ │ │ -|torrent_invalid_length |9 |whole .torrent file is invalid. | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_E_i_t_h_e_r_ _n_e_g_a_t_i_v_e_ _o_r_ _n_o_t_ _a_n_ _i_n_t_e_g_e_r_ | │ │ │ │ │ -|torrent_file_parse_failed |10 |Failed to parse a file _e_n_t_r_y in | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _._t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|torrent_missing_pieces |11 |The pieces field is missing or | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _i_n_ _t_h_e_ _._t_o_r_r_e_n_t_ _f_i_l_e_ _ _ _ _ _ | │ │ │ │ │ -|torrent_invalid_hashes |12 |The pieces string has incorrect | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_l_e_n_g_t_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|too_many_pieces_in_torrent |13 |The .torrent file has more pieces | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_a_n_ _i_s_ _s_u_p_p_o_r_t_e_d_ _b_y_ _l_i_b_t_o_r_r_e_n_t_ _ _ | │ │ │ │ │ -| | |The metadata (.torrent file) that | │ │ │ │ │ -|invalid_swarm_metadata |14 |was received from the swarm | │ │ │ │ │ -| | |matched the info-hash, but failed | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_o_ _b_e_ _p_a_r_s_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_bencoding |15 |The file or buffer is not | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_r_r_e_c_t_l_y_ _b_e_n_c_o_d_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|no_files_in_torrent |16 |The .torrent file does not contain| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_n_y_ _f_i_l_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_escaped_string |17 |The string was not properly url- | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_n_c_o_d_e_d_ _a_s_ _e_x_p_e_c_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|session_is_closing |18 |Operation is not permitted since | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _s_e_s_s_i_o_n_ _i_s_ _s_h_u_t_t_i_n_g_ _d_o_w_n_ _ _ _ _ _ | │ │ │ │ │ -| | |There's already a torrent with | │ │ │ │ │ -|duplicate_torrent |19 |that info-hash added to the | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_e_s_s_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_torrent_handle |20 |The supplied _t_o_r_r_e_n_t___h_a_n_d_l_e is not| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_f_e_r_r_i_n_g_ _t_o_ _a_ _v_a_l_i_d_ _t_o_r_r_e_n_t_ _ _ _ _ _ | │ │ │ │ │ -|invalid_entry_type |21 |The type requested from the _e_n_t_r_y | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_d_i_d_ _n_o_t_ _m_a_t_c_h_ _i_t_s_ _t_y_p_e_ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|missing_info_hash_in_uri |22 |The specified URI does not contain| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_ _v_a_l_i_d_ _i_n_f_o_-_h_a_s_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |One of the files in the torrent | │ │ │ │ │ -|file_too_short |23 |was unexpectedly small. This might| │ │ │ │ │ -| | |be caused by files being changed | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_b_y_ _a_n_ _e_x_t_e_r_n_a_l_ _p_r_o_c_e_s_s_ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The URL used an unknown protocol. | │ │ │ │ │ -| | |Currently http and https (if built| │ │ │ │ │ -|unsupported_url_protocol |24 |with openssl support) are | │ │ │ │ │ -| | |recognized. For trackers udp is | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_c_o_g_n_i_z_e_d_ _a_s_ _w_e_l_l_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|url_parse_error |25 |The URL did not conform to URL | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_y_n_t_a_x_ _a_n_d_ _f_a_i_l_e_d_ _t_o_ _b_e_ _p_a_r_s_e_d_ _ _ _ | │ │ │ │ │ -|peer_sent_empty_piece |26 |The peer sent a piece message of | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_l_e_n_g_t_h_ _0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|parse_failed |27 |A bencoded structure was corrupt | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_n_d_ _f_a_i_l_e_d_ _t_o_ _b_e_ _p_a_r_s_e_d_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_file_tag |28 |The fast resume file was missing | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_r_ _h_a_d_ _a_n_ _i_n_v_a_l_i_d_ _f_i_l_e_ _v_e_r_s_i_o_n_ _t_a_g| │ │ │ │ │ -|missing_info_hash |29 |The fast resume file was missing | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_r_ _h_a_d_ _a_n_ _i_n_v_a_l_i_d_ _i_n_f_o_-_h_a_s_h_ _ _ _ _ _ _ | │ │ │ │ │ -|mismatching_info_hash |30 |The info-hash did not match the | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_hostname |31 |The URL contained an invalid | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_h_o_s_t_n_a_m_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_i_n_v_a_l_i_d___p_o_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_3_2_ _ _ _|_T_h_e_ _U_R_L_ _h_a_d_ _a_n_ _i_n_v_a_l_i_d_ _p_o_r_t_ _ _ _ _ _ _ | │ │ │ │ │ -| | |The port is blocked by the port- | │ │ │ │ │ -|port_blocked |33 |filter, and prevented the | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_n_n_e_c_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|expected_close_bracket_in_address |34 |The IPv6 address was expected to | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_n_d_ _w_i_t_h_ _"_]_"_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The torrent is being destructed, | │ │ │ │ │ -|destructing_torrent |35 |preventing the operation to | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_u_c_c_e_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_t_i_m_e_d___o_u_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_3_6_ _ _ _|_T_h_e_ _c_o_n_n_e_c_t_i_o_n_ _t_i_m_e_d_ _o_u_t_ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer is upload only, and we | │ │ │ │ │ -|upload_upload_connection |37 |are upload only. There's no point | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_ _k_e_e_p_i_n_g_ _t_h_e_ _c_o_n_n_e_c_t_i_o_n_ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer is upload only, and we're| │ │ │ │ │ -|uninteresting_upload_peer |38 |not interested in it. There's no | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_o_i_n_t_ _i_n_ _k_e_e_p_i_n_g_ _t_h_e_ _c_o_n_n_e_c_t_i_o_n_ _ _ | │ │ │ │ │ -|_i_n_v_a_l_i_d___i_n_f_o___h_a_s_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_3_9_ _ _ _|_T_h_e_ _p_e_e_r_ _s_e_n_t_ _a_n_ _u_n_k_n_o_w_n_ _i_n_f_o_-_h_a_s_h| │ │ │ │ │ -|torrent_paused |40 |The torrent is paused, preventing | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _o_p_e_r_a_t_i_o_n_ _f_r_o_m_ _s_u_c_c_e_e_d_i_n_g_ _ _ _ _ | │ │ │ │ │ -| | |The peer sent an invalid have | │ │ │ │ │ -|invalid_have |41 |message, either wrong size or | │ │ │ │ │ -| | |referring to a piece that doesn't | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_x_i_s_t_ _i_n_ _t_h_e_ _t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_bitfield_size |42 |The _b_i_t_f_i_e_l_d message had the | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_c_o_r_r_e_c_t_ _s_i_z_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer kept requesting pieces | │ │ │ │ │ -|too_many_requests_when_choked |43 |after it was choked, possible | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_b_u_s_e_ _a_t_t_e_m_p_t_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer sent a piece message that| │ │ │ │ │ -|invalid_piece |44 |does not correspond to a piece | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_q_u_e_s_t_ _s_e_n_t_ _b_y_ _t_h_e_ _c_l_i_e_n_t_ _ _ _ _ _ _ _ | │ │ │ │ │ -|_n_o___m_e_m_o_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_4_5_ _ _ _|_m_e_m_o_r_y_ _a_l_l_o_c_a_t_i_o_n_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|torrent_aborted |46 |The torrent is aborted, preventing| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _o_p_e_r_a_t_i_o_n_ _t_o_ _s_u_c_c_e_e_d_ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|self_connection |47 |The peer is a connection to | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_u_r_s_e_l_f_,_ _n_o_ _p_o_i_n_t_ _i_n_ _k_e_e_p_i_n_g_ _i_t_ _ _ | │ │ │ │ │ -| | |The peer sent a piece message with| │ │ │ │ │ -|invalid_piece_size |48 |invalid size, either negative or | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_g_r_e_a_t_e_r_ _t_h_a_n_ _o_n_e_ _b_l_o_c_k_ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer has not been interesting | │ │ │ │ │ -|timed_out_no_interest |49 |or interested in us for too long, | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_n_o_ _p_o_i_n_t_ _i_n_ _k_e_e_p_i_n_g_ _i_t_ _a_r_o_u_n_d_ _ _ _ _ | │ │ │ │ │ -|timed_out_inactivity |50 |The peer has not said anything in | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_ _l_o_n_g_ _t_i_m_e_,_ _p_o_s_s_i_b_l_y_ _d_e_a_d_ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer did not send a handshake | │ │ │ │ │ -|timed_out_no_handshake |51 |within a reasonable amount of | │ │ │ │ │ -| | |time, it might not be a bittorrent| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_e_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer has been unchoked for too| │ │ │ │ │ -|timed_out_no_request |52 |long without requesting any data. | │ │ │ │ │ -| | |It might be lying about its | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_t_e_r_e_s_t_ _i_n_ _u_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_choke |53 |The peer sent an invalid choke | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_unchoke |54 |The peer send an invalid unchoke | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_interested |55 |The peer sent an invalid | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_t_e_r_e_s_t_e_d_ _m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_not_interested |56 |The peer sent an invalid not- | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_t_e_r_e_s_t_e_d_ _m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_request |57 |The peer sent an invalid piece | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_q_u_e_s_t_ _m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer sent an invalid hash-list| │ │ │ │ │ -|invalid_hash_list |58 |message (this is part of the | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_r_k_l_e_-_t_o_r_r_e_n_t_ _e_x_t_e_n_s_i_o_n_)_ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer sent an invalid hash- | │ │ │ │ │ -|invalid_hash_piece |59 |piece message (this is part of the| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_r_k_l_e_-_t_o_r_r_e_n_t_ _e_x_t_e_n_s_i_o_n_)_ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_cancel |60 |The peer sent an invalid cancel | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_dht_port |61 |The peer sent an invalid DHT port-| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_suggest |62 |The peer sent an invalid suggest | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_i_e_c_e_-_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_have_all |63 |The peer sent an invalid have all-| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_have_none |64 |The peer sent an invalid have | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_n_o_n_e_-_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_reject |65 |The peer sent an invalid reject | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_allow_fast |66 |The peer sent an invalid allow | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_f_a_s_t_-_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_extended |67 |The peer sent an invalid extension| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _I_D_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_message |68 |The peer sent an invalid message | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_I_D_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|sync_hash_not_found |69 |The synchronization hash was not | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_f_o_u_n_d_ _i_n_ _t_h_e_ _e_n_c_r_y_p_t_e_d_ _h_a_n_d_s_h_a_k_e_ _ | │ │ │ │ │ -|invalid_encryption_constant |70 |The encryption constant in the | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_h_a_n_d_s_h_a_k_e_ _i_s_ _i_n_v_a_l_i_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|no_plaintext_mode |71 |The peer does not support plain | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_e_x_t_,_ _w_h_i_c_h_ _i_s_ _t_h_e_ _s_e_l_e_c_t_e_d_ _m_o_d_e_ _ | │ │ │ │ │ -|no_rc4_mode |72 |The peer does not support RC4, | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_w_h_i_c_h_ _i_s_ _t_h_e_ _s_e_l_e_c_t_e_d_ _m_o_d_e_ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer does not support any of | │ │ │ │ │ -|unsupported_encryption_mode |73 |the encryption modes that the | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_l_i_e_n_t_ _s_u_p_p_o_r_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer selected an encryption | │ │ │ │ │ -|unsupported_encryption_mode_selected|74 |mode that the client did not | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_d_v_e_r_t_i_s_e_ _a_n_d_ _d_o_e_s_ _n_o_t_ _s_u_p_p_o_r_t_ _ _ _ | │ │ │ │ │ -| | |The pad size used in the | │ │ │ │ │ -|invalid_pad_size |75 |encryption handshake is of invalid| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_i_z_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_encrypt_handshake |76 |The encryption handshake is | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The client is set to not support | │ │ │ │ │ -|no_incoming_encrypted |77 |incoming encrypted connections and| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_i_s_ _i_s_ _a_n_ _e_n_c_r_y_p_t_e_d_ _c_o_n_n_e_c_t_i_o_n_ _ _ | │ │ │ │ │ -| | |The client is set to not support | │ │ │ │ │ -|no_incoming_regular |78 |incoming regular bittorrent | │ │ │ │ │ -| | |connections, and this is a regular| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_n_n_e_c_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|duplicate_peer_id |79 |The client is already connected to| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_i_s_ _p_e_e_r_-_I_D_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_t_o_r_r_e_n_t___r_e_m_o_v_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_8_0_ _ _ _|_T_o_r_r_e_n_t_ _w_a_s_ _r_e_m_o_v_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|packet_too_large |81 |The packet size exceeded the upper| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_a_n_i_t_y_ _c_h_e_c_k_-_l_i_m_i_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_r_e_s_e_r_v_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_8_2_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|http_error |83 |The web server responded with an | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|missing_location |84 |The web server response is missing| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_ _l_o_c_a_t_i_o_n_ _h_e_a_d_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The web seed redirected to a path | │ │ │ │ │ -|invalid_redirection |85 |that no longer matches the | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_._t_o_r_r_e_n_t_ _d_i_r_e_c_t_o_r_y_ _s_t_r_u_c_t_u_r_e_ _ _ _ _ _ | │ │ │ │ │ -|redirecting |86 |The connection was closed because | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_t_ _r_e_d_i_r_e_c_t_e_d_ _t_o_ _a_ _d_i_f_f_e_r_e_n_t_ _U_R_L_ _ | │ │ │ │ │ -|_i_n_v_a_l_i_d___r_a_n_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_8_7_ _ _ _|_T_h_e_ _H_T_T_P_ _r_a_n_g_e_ _h_e_a_d_e_r_ _i_s_ _i_n_v_a_l_i_d_ _ | │ │ │ │ │ -|no_content_length |88 |The HTTP response did not have a | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_n_t_e_n_t_ _l_e_n_g_t_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_b_a_n_n_e_d___b_y___i_p___f_i_l_t_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_8_9_ _ _ _|_T_h_e_ _I_P_ _i_s_ _b_l_o_c_k_e_d_ _b_y_ _t_h_e_ _I_P_ _f_i_l_t_e_r| │ │ │ │ │ -|_t_o_o___m_a_n_y___c_o_n_n_e_c_t_i_o_n_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_9_0_ _ _ _|_A_t_ _t_h_e_ _c_o_n_n_e_c_t_i_o_n_ _l_i_m_i_t_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_p_e_e_r___b_a_n_n_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_9_1_ _ _ _|_T_h_e_ _p_e_e_r_ _i_s_ _m_a_r_k_e_d_ _a_s_ _b_a_n_n_e_d_ _ _ _ _ _ | │ │ │ │ │ -|stopping_torrent |92 |The torrent is stopping, causing | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _o_p_e_r_a_t_i_o_n_ _t_o_ _f_a_i_l_ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|too_many_corrupt_pieces |93 |The peer has sent too many corrupt| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_i_e_c_e_s_ _a_n_d_ _i_s_ _b_a_n_n_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|torrent_not_ready |94 |The torrent is not ready to | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_c_e_i_v_e_ _p_e_e_r_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|peer_not_constructed |95 |The peer is not completely | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_n_s_t_r_u_c_t_e_d_ _y_e_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|session_closing |96 |The _s_e_s_s_i_o_n is closing, causing | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _o_p_e_r_a_t_i_o_n_ _t_o_ _f_a_i_l_ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer was disconnected in order| │ │ │ │ │ -|optimistic_disconnect |97 |to leave room for a potentially | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_b_e_t_t_e_r_ _p_e_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_t_o_r_r_e_n_t___f_i_n_i_s_h_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_9_8_ _ _ _|_T_h_e_ _t_o_r_r_e_n_t_ _i_s_ _f_i_n_i_s_h_e_d_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_n_o___r_o_u_t_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_9_9_ _ _ _|_N_o_ _U_P_n_P_ _r_o_u_t_e_r_ _f_o_u_n_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|metadata_too_large |100 |The metadata message says the | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_t_a_d_a_t_a_ _e_x_c_e_e_d_s_ _t_h_e_ _l_i_m_i_t_ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_metadata_request |101 |The peer sent an invalid metadata | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_q_u_e_s_t_ _m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_metadata_size |102 |The peer advertised an invalid | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_t_a_d_a_t_a_ _s_i_z_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_metadata_offset |103 |The peer sent a message with an | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _m_e_t_a_d_a_t_a_ _o_f_f_s_e_t_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_metadata_message |104 |The peer sent an invalid metadata | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|pex_message_too_large |105 |The peer sent a peer exchange | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _t_h_a_t_ _w_a_s_ _t_o_o_ _l_a_r_g_e_ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_pex_message |106 |The peer sent an invalid peer | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_x_c_h_a_n_g_e_ _m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_lt_tracker_message |107 |The peer sent an invalid tracker | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_x_c_h_a_n_g_e_ _m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer sent an pex messages too | │ │ │ │ │ -|too_frequent_pex |108 |often. This is a possible attempt | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_f_ _a_n_d_ _a_t_t_a_c_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The operation failed because it | │ │ │ │ │ -| | |requires the torrent to have the | │ │ │ │ │ -| | |metadata (.torrent file) and it | │ │ │ │ │ -|no_metadata |109 |doesn't have it yet. This happens | │ │ │ │ │ -| | |for magnet links before they have | │ │ │ │ │ -| | |downloaded the metadata, and also | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_o_r_r_e_n_t_s_ _a_d_d_e_d_ _b_y_ _U_R_L_._ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer sent an invalid dont_have| │ │ │ │ │ -| | |message. The don't have message is| │ │ │ │ │ -|invalid_dont_have |110 |an extension to allow peers to | │ │ │ │ │ -| | |advertise that the no longer has a| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_i_e_c_e_ _t_h_e_y_ _p_r_e_v_i_o_u_s_l_y_ _h_a_d_._ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer tried to connect to an | │ │ │ │ │ -|requires_ssl_connection |111 |SSL torrent without connecting | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_v_e_r_ _S_S_L_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The peer tried to connect to a | │ │ │ │ │ -|invalid_ssl_cert |112 |torrent with a certificate for a | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_d_i_f_f_e_r_e_n_t_ _t_o_r_r_e_n_t_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |the torrent is not an SSL torrent,| │ │ │ │ │ -|not_an_ssl_torrent |113 |and the operation requires an SSL | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |peer was banned because its listen| │ │ │ │ │ -|banned_by_port_filter |114 |port is within a banned port | │ │ │ │ │ -| | |range, as specified by the | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_o_r_t___f_i_l_t_e_r_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_session_handle |115 |The _s_e_s_s_i_o_n___h_a_n_d_l_e is not | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_f_e_r_r_i_n_g_ _t_o_ _a_ _v_a_l_i_d_ _s_e_s_s_i_o_n___i_m_p_l_ | │ │ │ │ │ -|invalid_listen_socket |116 |the listen socket associated with | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_i_s_ _r_e_q_u_e_s_t_ _w_a_s_ _c_l_o_s_e_d_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_i_n_v_a_l_i_d___h_a_s_h___r_e_q_u_e_s_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_1_7_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_i_n_v_a_l_i_d___h_a_s_h_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_1_8_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_i_n_v_a_l_i_d___h_a_s_h___r_e_j_e_c_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_1_9_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_d_e_p_r_e_c_a_t_e_d___1_2_0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_2_0_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_d_e_p_r_e_c_a_t_e_d___1_2_1_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_2_1_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_d_e_p_r_e_c_a_t_e_d___1_2_2_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_2_2_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_d_e_p_r_e_c_a_t_e_d___1_2_3_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_2_3_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_d_e_p_r_e_c_a_t_e_d___1_2_4_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_2_4_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|missing_file_sizes |130 |The resume data file is missing | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _f_i_l_e_ _s_i_z_e_s_ _e_n_t_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|no_files_in_resume_data |131 |The resume data file file sizes | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_n_t_r_y_ _i_s_ _e_m_p_t_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|missing_pieces |132 |The resume data file is missing | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _p_i_e_c_e_s_ _a_n_d_ _s_l_o_t_s_ _e_n_t_r_y_ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The number of files in the resume | │ │ │ │ │ -|mismatching_number_of_files |133 |data does not match the number of | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_f_i_l_e_s_ _i_n_ _t_h_e_ _t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |One of the files on disk has a | │ │ │ │ │ -|mismatching_file_size |134 |different size than in the fast | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_s_u_m_e_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |One of the files on disk has a | │ │ │ │ │ -|mismatching_file_timestamp |135 |different timestamp than in the | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_f_a_s_t_ _r_e_s_u_m_e_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|not_a_dictionary |136 |The resume data file is not a | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_d_i_c_t_i_o_n_a_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_blocks_per_piece |137 |The blocks per piece _e_n_t_r_y is | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _i_n_ _t_h_e_ _r_e_s_u_m_e_ _d_a_t_a_ _f_i_l_e_ _ _ | │ │ │ │ │ -| | |The resume file is missing the | │ │ │ │ │ -|missing_slots |138 |slots _e_n_t_r_y, which is required for| │ │ │ │ │ -| | |torrents with compact allocation. | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_DD_EE_PP_RR_EE_CC_AA_TT_EE_DD_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|too_many_slots |139 |The resume file contains more | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_l_o_t_s_ _t_h_a_n_ _t_h_e_ _t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_slot_list |140 |The slot _e_n_t_r_y is invalid in the | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_s_u_m_e_ _d_a_t_a_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_piece_index |141 |One index in the slot list is | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The pieces on disk needs to be re-| │ │ │ │ │ -| | |ordered for the specified | │ │ │ │ │ -| | |allocation mode. This happens if | │ │ │ │ │ -|pieces_need_reorder |142 |you specify sparse allocation and | │ │ │ │ │ -| | |the files on disk are using | │ │ │ │ │ -| | |compact storage. The pieces needs | │ │ │ │ │ -| | |to be moved to their right | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_o_s_i_t_i_o_n_._ _DD_EE_PP_RR_EE_CC_AA_TT_EE_DD_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |this error is returned when asking| │ │ │ │ │ -| | |to save resume data and specifying| │ │ │ │ │ -|resume_data_not_modified |143 |the flag to only save when there's| │ │ │ │ │ -| | |anything new to save | │ │ │ │ │ -| | |(_t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_o_n_l_y___i_f___m_o_d_i_f_i_e_d)| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_n_d_ _t_h_e_r_e_ _w_a_s_n_'_t_ _a_n_y_t_h_i_n_g_ _c_h_a_n_g_e_d_.| │ │ │ │ │ -|invalid_save_path |144 |the save_path in | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s_ _i_s_ _n_o_t_ _v_a_l_i_d_ _ _ | │ │ │ │ │ -|http_parse_error |150 |The HTTP header was not correctly | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_f_o_r_m_a_t_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The HTTP response was in the 300- | │ │ │ │ │ -|http_missing_location |151 |399 range but lacked a location | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_h_e_a_d_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The HTTP response was encoded with| │ │ │ │ │ -|http_failed_decompress |152 |gzip or deflate but decompressing | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_t_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|no_i2p_router |160 |The URL specified an i2p address, | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_b_u_t_ _n_o_ _i_2_p_ _r_o_u_t_e_r_ _i_s_ _c_o_n_f_i_g_u_r_e_d_ _ _ | │ │ │ │ │ -|no_i2p_endpoint |161 |i2p acceptor is not available yet,| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_a_n_'_t_ _a_n_n_o_u_n_c_e_ _w_i_t_h_o_u_t_ _e_n_d_p_o_i_n_t_ _ _ | │ │ │ │ │ -| | |The tracker URL doesn't support | │ │ │ │ │ -|scrape_not_available |170 |transforming it into a scrape URL.| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_._e_._ _i_t_ _d_o_e_s_n_'_t_ _c_o_n_t_a_i_n_ _"_a_n_n_o_u_n_c_e_.| │ │ │ │ │ -|_i_n_v_a_l_i_d___t_r_a_c_k_e_r___r_e_s_p_o_n_s_e_ _ _ _ _ _ _ _ _ _ _ _ _|_1_7_1_ _ _|_i_n_v_a_l_i_d_ _t_r_a_c_k_e_r_ _r_e_s_p_o_n_s_e_ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_peer_dict |172 |invalid peer dictionary _e_n_t_r_y. Not| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_ _d_i_c_t_i_o_n_a_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_t_r_a_c_k_e_r___f_a_i_l_u_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_7_3_ _ _|_t_r_a_c_k_e_r_ _s_e_n_t_ _a_ _f_a_i_l_u_r_e_ _m_e_s_s_a_g_e_ _ _ _ | │ │ │ │ │ -|_i_n_v_a_l_i_d___f_i_l_e_s___e_n_t_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_7_4_ _ _|_m_i_s_s_i_n_g_ _o_r_ _i_n_v_a_l_i_d_ _f_i_l_e_s_ _e_n_t_r_y_ _ _ _ | │ │ │ │ │ -|_i_n_v_a_l_i_d___h_a_s_h___e_n_t_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_7_5_ _ _|_m_i_s_s_i_n_g_ _o_r_ _i_n_v_a_l_i_d_ _h_a_s_h_ _e_n_t_r_y_ _ _ _ _ | │ │ │ │ │ -|invalid_peers_entry |176 |missing or invalid peers and | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_e_e_r_s_6_ _e_n_t_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_tracker_response_length |177 |UDP tracker response packet has | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _s_i_z_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_tracker_transaction_id |178 |invalid transaction id in UDP | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_r_a_c_k_e_r_ _r_e_s_p_o_n_s_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|invalid_tracker_action |179 |invalid action field in UDP | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_r_a_c_k_e_r_ _r_e_s_p_o_n_s_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |skipped announce (because it's | │ │ │ │ │ -|announce_skipped |180 |assumed to be unreachable over the| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_g_i_v_e_n_ _s_o_u_r_c_e_ _n_e_t_w_o_r_k_ _i_n_t_e_r_f_a_c_e_)_ _ _ | │ │ │ │ │ -|_n_o___e_n_t_r_o_p_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_0_0_ _ _|_r_a_n_d_o_m_ _n_u_m_b_e_r_ _g_e_n_e_r_a_t_i_o_n_ _f_a_i_l_e_d_ _ _ | │ │ │ │ │ -|_s_s_r_f___m_i_t_i_g_a_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_0_1_ _ _|_b_l_o_c_k_e_d_ _b_y_ _S_S_R_F_ _m_i_t_i_g_a_t_i_o_n_ _ _ _ _ _ _ _ | │ │ │ │ │ -|blocked_by_idna |202 |blocked because IDNA host names | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_r_e_ _b_a_n_n_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|torrent_unknown_version |210 |the torrent file has an unknown | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_t_a_ _v_e_r_s_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|torrent_missing_file_tree |211 |the v2 torrent file has no file | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_r_e_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|torrent_missing_meta_version |212 |the torrent contains v2 keys but | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_d_o_e_s_ _n_o_t_ _s_p_e_c_i_f_y_ _m_e_t_a_ _v_e_r_s_i_o_n_ _2_ _ _ | │ │ │ │ │ -|torrent_inconsistent_files |213 |the v1 and v2 file metadata does | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_n_o_t_ _m_a_t_c_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|torrent_missing_piece_layer |214 |one or more files are missing | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_i_e_c_e_ _l_a_y_e_r_ _h_a_s_h_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|torrent_invalid_piece_layer |215 |a piece layer has the wrong size | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_r_ _f_a_i_l_e_d_ _h_a_s_h_ _c_h_e_c_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_t_o_r_r_e_n_t___m_i_s_s_i_n_g___p_i_e_c_e_s___r_o_o_t_ _ _ _ _ _ _ _ _ _|_2_1_6_ _ _|_a_ _v_2_ _f_i_l_e_ _e_n_t_r_y_ _h_a_s_ _n_o_ _r_o_o_t_ _h_a_s_h_ _ | │ │ │ │ │ -|torrent_inconsistent_hashes |217 |the v1 and v2 hashes do not | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_d_e_s_c_r_i_b_e_ _t_h_e_ _s_a_m_e_ _d_a_t_a_ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|torrent_invalid_pad_file |218 |a file in the v2 metadata has the | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_a_d_ _a_t_t_r_i_b_u_t_e_ _s_e_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_e_r_r_o_r___c_o_d_e___m_a_x_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_1_9_ _ _|_t_h_e_ _n_u_m_b_e_r_ _o_f_ _e_r_r_o_r_ _c_o_d_e_s_ _ _ _ _ _ _ _ _ | │ │ │ │ │ + query_torrent_file │ │ │ │ │ + includes torrent_file, which is all the static information from the │ │ │ │ │ + .torrent file. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -************ eennuumm hhttttpp__eerrrroorrss ************ │ │ │ │ │ -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| │ │ │ │ │ -|_c_o_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_0_0_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_o_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_0_0_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_c_r_e_a_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_0_1_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_a_c_c_e_p_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_0_2_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_n_o___c_o_n_t_e_n_t_ _ _ _ _ _ _ _ _ _ _ _|_2_0_4_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_m_u_l_t_i_p_l_e___c_h_o_i_c_e_s_ _ _ _ _ _|_3_0_0_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_m_o_v_e_d___p_e_r_m_a_n_e_n_t_l_y_ _ _ _ _|_3_0_1_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_m_o_v_e_d___t_e_m_p_o_r_a_r_i_l_y_ _ _ _ _|_3_0_2_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_n_o_t___m_o_d_i_f_i_e_d_ _ _ _ _ _ _ _ _ _|_3_0_4_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_b_a_d___r_e_q_u_e_s_t_ _ _ _ _ _ _ _ _ _ _|_4_0_0_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_u_n_a_u_t_h_o_r_i_z_e_d_ _ _ _ _ _ _ _ _ _|_4_0_1_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ + query_name │ │ │ │ │ + includes name, the name of the torrent. This is either derived from the │ │ │ │ │ + .torrent file, or from the &dn= magnet link argument or possibly some │ │ │ │ │ + other source. If the name of the torrent is not known, this is an empty │ │ │ │ │ + string. │ │ │ │ │ [_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_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ + query_save_path │ │ │ │ │ + includes save_path, the path to the directory the files of the torrent │ │ │ │ │ + are saved to. │ │ │ │ │ [_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_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ + alert_when_available │ │ │ │ │ + used to ask libtorrent to send an _a_l_e_r_t once the piece has been │ │ │ │ │ + downloaded, by passing alert_when_available. When set, the │ │ │ │ │ + _r_e_a_d___p_i_e_c_e___a_l_e_r_t _a_l_e_r_t will be delivered, with the piece data, when it's │ │ │ │ │ + downloaded. │ │ │ │ │ [_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_ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ + piece_granularity │ │ │ │ │ + only calculate file progress at piece granularity. This makes the │ │ │ │ │ + _f_i_l_e___p_r_o_g_r_e_s_s_(_) call cheaper and also only takes bytes that have passed │ │ │ │ │ + the hash check into account, so progress cannot regress in this mode. │ │ │ │ │ [_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_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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___v_e_r_s_i_o_n_|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ + graceful_pause │ │ │ │ │ + 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. │ │ │ │ │ [_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_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ + flush_disk_cache │ │ │ │ │ + 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. │ │ │ │ │ [_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_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ + save_info_dict │ │ │ │ │ + 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. │ │ │ │ │ [_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 sseett__vvaalluuee (int c, std::int64_t value) ; │ │ │ │ │ - void bblleenndd__ssttaattss__ccoouunntteerr (int c, std::int64_t value, int ratio) ; │ │ │ │ │ -}; │ │ │ │ │ + only_if_modified │ │ │ │ │ + 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 │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** iinncc__ssttaattss__ccoouunntteerr(()) ooppeerraattoorr[[]](()) ********** │ │ │ │ │ -std::int64_t iinncc__ssttaattss__ccoouunntteerr (int c, std::int64_t value = 1) ; │ │ │ │ │ -std::int64_t ooppeerraattoorr[[]] (int i) const ; │ │ │ │ │ -returns the new value │ │ │ │ │ + if_counters_changed │ │ │ │ │ + save resume data if any _c_o_u_n_t_e_r_s has changed since the last time resume │ │ │ │ │ + data was saved. This includes upload/download _c_o_u_n_t_e_r_s, active time │ │ │ │ │ + _c_o_u_n_t_e_r_s and scrape data. A torrent that is not paused will have its │ │ │ │ │ + active time _c_o_u_n_t_e_r_s incremented continuously. │ │ │ │ │ [_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; │ │ │ │ │ - int value_index; │ │ │ │ │ - metric_type_t type; │ │ │ │ │ -}; │ │ │ │ │ + if_download_progress │ │ │ │ │ + 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 │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - name │ │ │ │ │ - the name of the counter or gauge │ │ │ │ │ + if_config_changed │ │ │ │ │ + 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) │ │ │ │ │ [_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. │ │ │ │ │ + if_state_changed │ │ │ │ │ + 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 │ │ │ │ │ [_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 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 │ │ │ │ │ -_p_o_s_t___s_e_s_s_i_o_n___s_t_a_t_s_(_)). │ │ │ │ │ + if_metadata_changed │ │ │ │ │ + save the resume data if any mmeettaaddaattaa changed since the last time resume │ │ │ │ │ + data was saved. This includes: * add/remove web seeds * add/remove │ │ │ │ │ + trackers * receiving metadata for a magnet link │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -************ ffiinndd__mmeettrriicc__iiddxx(()) ************ │ │ │ │ │ -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" │ │ │ │ │ -int ffiinndd__mmeettrriicc__iiddxx (string_view name); │ │ │ │ │ -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 _s_e_s_s_i_o_n___s_t_a_t_s___a_l_e_r_t. │ │ │ │ │ + ignore_min_interval │ │ │ │ │ + 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -************ 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_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +************ 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.) │ │ │ │ │ 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 │ │ │ │ │ @@ -6973,24 +2736,24 @@ │ │ │ │ │ The storage_moved_alert is generated when all the disk IO has completed and the │ │ │ │ │ files have been moved, as an effect of a call to torrent_handle::move_storage. │ │ │ │ │ This is useful to synchronize with the actual disk. The storage_path() member │ │ │ │ │ return the new path of the storage. │ │ │ │ │ struct storage_moved_alert final : torrent_alert │ │ │ │ │ { │ │ │ │ │ std::string mmeessssaaggee () const override; │ │ │ │ │ - char const* oolldd__ppaatthh () const; │ │ │ │ │ char const* ssttoorraaggee__ppaatthh () const; │ │ │ │ │ + char const* oolldd__ppaatthh () const; │ │ │ │ │ │ │ │ │ │ static constexpr alert_category_t ssttaattiicc__ccaatteeggoorryy = alert_category:: │ │ │ │ │ storage; │ │ │ │ │ }; │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ssttoorraaggee__ppaatthh(()) oolldd__ppaatthh(()) ********** │ │ │ │ │ -char const* oolldd__ppaatthh () const; │ │ │ │ │ +********** oolldd__ppaatthh(()) ssttoorraaggee__ppaatthh(()) ********** │ │ │ │ │ char const* ssttoorraaggee__ppaatthh () const; │ │ │ │ │ +char const* oolldd__ppaatthh () const; │ │ │ │ │ the path the torrent was moved to and from, respectively. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ ************ ssttoorraaggee__mmoovveedd__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" │ │ │ │ │ The storage_moved_failed_alert is generated when an attempt to move the │ │ │ │ │ storage, via _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_m_o_v_e___s_t_o_r_a_g_e_(_), fails. │ │ │ │ │ struct storage_moved_failed_alert final : torrent_alert │ │ │ │ │ @@ -8264,30 +4027,30 @@ │ │ │ │ │ ************ ddhhtt__ssaammppllee__iinnffoohhaasshheess__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" │ │ │ │ │ posted as a response to a call to session::dht_sample_infohashes() with the │ │ │ │ │ information from the DHT response message. │ │ │ │ │ struct dht_sample_infohashes_alert final : alert │ │ │ │ │ { │ │ │ │ │ std::string mmeessssaaggee () const override; │ │ │ │ │ - std::vector ssaammpplleess () const; │ │ │ │ │ int nnuumm__ssaammpplleess () const; │ │ │ │ │ + std::vector ssaammpplleess () const; │ │ │ │ │ int nnuumm__nnooddeess () const; │ │ │ │ │ std::vector> nnooddeess () const; │ │ │ │ │ │ │ │ │ │ static constexpr alert_category_t ssttaattiicc__ccaatteeggoorryy = alert_category:: │ │ │ │ │ dht_operation; │ │ │ │ │ sha1_hash node_id; │ │ │ │ │ aux::noexcept_movable endpoint; │ │ │ │ │ time_duration const interval; │ │ │ │ │ int const num_infohashes; │ │ │ │ │ }; │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ ********** nnuumm__ssaammpplleess(()) ssaammpplleess(()) ********** │ │ │ │ │ -std::vector ssaammpplleess () const; │ │ │ │ │ int nnuumm__ssaammpplleess () const; │ │ │ │ │ +std::vector 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; │ │ │ │ │ The total number of nodes returned by nodes(). │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ @@ -8332,17 +4095,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 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 │ │ │ │ │ @@ -8549,904 +4312,225 @@ │ │ │ │ │ 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 alerts; │ │ │ │ │ -ses.pop_alerts(&alerts); │ │ │ │ │ -for (alert* a : alerts) { │ │ │ │ │ - switch (a->type()) { │ │ │ │ │ - │ │ │ │ │ - case read_piece_alert::alert_type: │ │ │ │ │ - { │ │ │ │ │ - auto* p = static_cast(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] │ │ │ │ │ -************ 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" │ │ │ │ │ -char const* ooppeerraattiioonn__nnaammee (operation_t op); │ │ │ │ │ -maps an operation id (from _p_e_e_r___e_r_r_o_r___a_l_e_r_t and _p_e_e_r___d_i_s_c_o_n_n_e_c_t_e_d___a_l_e_r_t) to its │ │ │ │ │ -name. See _o_p_e_r_a_t_i_o_n___t for the constants │ │ │ │ │ -[_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 T const* aalleerrtt__ccaasstt (alert const* a); │ │ │ │ │ -template T* aalleerrtt__ccaasstt (alert* 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] │ │ │ │ │ -************ eennuumm ooppeerraattiioonn__tt ************ │ │ │ │ │ -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" │ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ │ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|unknown |0 |the error was unexpected and it is unknown which | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_p_e_r_a_t_i_o_n_ _c_a_u_s_e_d_ _i_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|bittorrent |1 |this is used when the bittorrent logic determines | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_o_ _d_i_s_c_o_n_n_e_c_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_i_o_c_o_n_t_r_o_l_ _ _ _ _ _ _ _ _ _ _|_2_ _ _ _ _|_a_ _c_a_l_l_ _t_o_ _i_o_c_o_n_t_r_o_l_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|getpeername |3 |a call to getpeername() failed (querying the remote| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_I_P_ _o_f_ _a_ _c_o_n_n_e_c_t_i_o_n_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|getname |4 |a call to getname failed (querying the local IP of | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_ _c_o_n_n_e_c_t_i_o_n_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_a_l_l_o_c___r_e_c_v_b_u_f_ _ _ _ _ _ _|_5_ _ _ _ _|_a_n_ _a_t_t_e_m_p_t_ _t_o_ _a_l_l_o_c_a_t_e_ _a_ _r_e_c_e_i_v_e_ _b_u_f_f_e_r_ _f_a_i_l_e_d_ _ _ _ _ | │ │ │ │ │ -|_a_l_l_o_c___s_n_d_b_u_f_ _ _ _ _ _ _ _|_6_ _ _ _ _|_a_n_ _a_t_t_e_m_p_t_ _t_o_ _a_l_l_o_c_a_t_e_ _a_ _s_e_n_d_ _b_u_f_f_e_r_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ | │ │ │ │ │ -|_f_i_l_e___w_r_i_t_e_ _ _ _ _ _ _ _ _ _|_7_ _ _ _ _|_w_r_i_t_i_n_g_ _t_o_ _a_ _f_i_l_e_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_f_i_l_e___r_e_a_d_ _ _ _ _ _ _ _ _ _ _|_8_ _ _ _ _|_r_e_a_d_i_n_g_ _f_r_o_m_ _a_ _f_i_l_e_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_9_ _ _ _ _|_a_ _n_o_n_-_r_e_a_d_ _a_n_d_ _n_o_n_-_w_r_i_t_e_ _f_i_l_e_ _o_p_e_r_a_t_i_o_n_ _f_a_i_l_e_d_ _ _ _ _ | │ │ │ │ │ -|_s_o_c_k___w_r_i_t_e_ _ _ _ _ _ _ _ _ _|_1_0_ _ _ _|_a_ _s_o_c_k_e_t_ _w_r_i_t_e_ _o_p_e_r_a_t_i_o_n_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_s_o_c_k___r_e_a_d_ _ _ _ _ _ _ _ _ _ _|_1_1_ _ _ _|_a_ _s_o_c_k_e_t_ _r_e_a_d_ _o_p_e_r_a_t_i_o_n_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_s_o_c_k___o_p_e_n_ _ _ _ _ _ _ _ _ _ _|_1_2_ _ _ _|_a_ _c_a_l_l_ _t_o_ _o_p_e_n_(_)_,_ _t_o_ _c_r_e_a_t_e_ _a_ _s_o_c_k_e_t_ _s_o_c_k_e_t_ _f_a_i_l_e_d_ | │ │ │ │ │ -|_s_o_c_k___b_i_n_d_ _ _ _ _ _ _ _ _ _ _|_1_3_ _ _ _|_a_ _c_a_l_l_ _t_o_ _b_i_n_d_(_)_ _o_n_ _a_ _s_o_c_k_e_t_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|available |14 |an attempt to query the number of bytes available | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_o_ _r_e_a_d_ _f_r_o_m_ _a_ _s_o_c_k_e_t_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|encryption |15 |a call related to bittorrent protocol encryption | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_c_o_n_n_e_c_t_ _ _ _ _ _ _ _ _ _ _ _ _|_1_6_ _ _ _|_a_n_ _a_t_t_e_m_p_t_ _t_o_ _c_o_n_n_e_c_t_ _a_ _s_o_c_k_e_t_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_s_s_l___h_a_n_d_s_h_a_k_e_ _ _ _ _ _ _|_1_7_ _ _ _|_e_s_t_a_b_l_i_s_h_i_n_g_ _a_n_ _S_S_L_ _c_o_n_n_e_c_t_i_o_n_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|get_interface |18 |a connection failed to satisfy the bind interface | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_e_t_t_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_s_o_c_k___l_i_s_t_e_n_ _ _ _ _ _ _ _ _|_1_9_ _ _ _|_a_ _c_a_l_l_ _t_o_ _l_i_s_t_e_n_(_)_ _o_n_ _a_ _s_o_c_k_e_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|sock_bind_to_device|20 |a call to the ioctl to bind a socket to a specific | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_n_e_t_w_o_r_k_ _d_e_v_i_c_e_ _o_r_ _a_d_a_p_t_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_s_o_c_k___a_c_c_e_p_t_ _ _ _ _ _ _ _ _|_2_1_ _ _ _|_a_ _c_a_l_l_ _t_o_ _a_c_c_e_p_t_(_)_ _o_n_ _a_ _s_o_c_k_e_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_p_a_r_s_e___a_d_d_r_e_s_s_ _ _ _ _ _ _|_2_2_ _ _ _|_c_o_n_v_e_r_t_ _a_ _s_t_r_i_n_g_ _i_n_t_o_ _a_ _v_a_l_i_d_ _n_e_t_w_o_r_k_ _a_d_d_r_e_s_s_ _ _ _ _ _ | │ │ │ │ │ -|_e_n_u_m___i_f_ _ _ _ _ _ _ _ _ _ _ _ _|_2_3_ _ _ _|_e_n_u_m_e_r_a_t_i_o_n_ _n_e_t_w_o_r_k_ _d_e_v_i_c_e_s_ _o_r_ _a_d_a_p_t_e_r_s_ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_f_i_l_e___s_t_a_t_ _ _ _ _ _ _ _ _ _ _|_2_4_ _ _ _|_i_n_v_o_k_i_n_g_ _s_t_a_t_(_)_ _o_n_ _a_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_f_i_l_e___c_o_p_y_ _ _ _ _ _ _ _ _ _ _|_2_5_ _ _ _|_c_o_p_y_i_n_g_ _a_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_f_i_l_e___f_a_l_l_o_c_a_t_e_ _ _ _ _ _|_2_6_ _ _ _|_a_l_l_o_c_a_t_i_n_g_ _s_t_o_r_a_g_e_ _f_o_r_ _a_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_f_i_l_e___h_a_r_d___l_i_n_k_ _ _ _ _ _|_2_7_ _ _ _|_c_r_e_a_t_i_n_g_ _a_ _h_a_r_d_ _l_i_n_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_f_i_l_e___r_e_m_o_v_e_ _ _ _ _ _ _ _ _|_2_8_ _ _ _|_r_e_m_o_v_i_n_g_ _a_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_f_i_l_e___r_e_n_a_m_e_ _ _ _ _ _ _ _ _|_2_9_ _ _ _|_r_e_n_a_m_i_n_g_ _a_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_f_i_l_e___o_p_e_n_ _ _ _ _ _ _ _ _ _ _|_3_0_ _ _ _|_o_p_e_n_i_n_g_ _a_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_m_k_d_i_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_3_1_ _ _ _|_c_r_e_a_t_i_n_g_ _a_ _d_i_r_e_c_t_o_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_c_h_e_c_k___r_e_s_u_m_e_ _ _ _ _ _ _ _|_3_2_ _ _ _|_c_h_e_c_k_ _f_a_s_t_ _r_e_s_u_m_e_ _d_a_t_a_ _a_g_a_i_n_s_t_ _f_i_l_e_s_ _o_n_ _d_i_s_k_ _ _ _ _ _ _ | │ │ │ │ │ -|_e_x_c_e_p_t_i_o_n_ _ _ _ _ _ _ _ _ _ _|_3_3_ _ _ _|_a_n_ _u_n_k_n_o_w_n_ _e_x_c_e_p_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_a_l_l_o_c___c_a_c_h_e___p_i_e_c_e_ _ _|_3_4_ _ _ _|_a_l_l_o_c_a_t_e_ _s_p_a_c_e_ _f_o_r_ _a_ _p_i_e_c_e_ _i_n_ _t_h_e_ _c_a_c_h_e_ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_p_a_r_t_f_i_l_e___m_o_v_e_ _ _ _ _ _ _|_3_5_ _ _ _|_m_o_v_e_ _a_ _p_a_r_t_-_f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_p_a_r_t_f_i_l_e___r_e_a_d_ _ _ _ _ _ _|_3_6_ _ _ _|_r_e_a_d_ _f_r_o_m_ _a_ _p_a_r_t_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_p_a_r_t_f_i_l_e___w_r_i_t_e_ _ _ _ _ _|_3_7_ _ _ _|_w_r_i_t_e_ _t_o_ _a_ _p_a_r_t_-_f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_h_o_s_t_n_a_m_e___l_o_o_k_u_p_ _ _ _ _|_3_8_ _ _ _|_a_ _h_o_s_t_n_a_m_e_ _l_o_o_k_u_p_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_s_y_m_l_i_n_k_ _ _ _ _ _ _ _ _ _ _ _ _|_3_9_ _ _ _|_c_r_e_a_t_e_ _o_r_ _r_e_a_d_ _a_ _s_y_m_l_i_n_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_h_a_n_d_s_h_a_k_e_ _ _ _ _ _ _ _ _ _ _|_4_0_ _ _ _|_h_a_n_d_s_h_a_k_e_ _w_i_t_h_ _a_ _p_e_e_r_ _o_r_ _s_e_r_v_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_s_o_c_k___o_p_t_i_o_n_ _ _ _ _ _ _ _ _|_4_1_ _ _ _|_s_e_t_ _s_o_c_k_e_t_ _o_p_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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 │ │ │ │ │ - * resume data failures │ │ │ │ │ - * web seed errors │ │ │ │ │ - * .torrent files errors │ │ │ │ │ - * listen socket errors │ │ │ │ │ - * port mapping errors │ │ │ │ │ - peer │ │ │ │ │ - Enables alerts when peers send invalid requests, get banned or snubbed. │ │ │ │ │ - port_mapping │ │ │ │ │ - Enables alerts for port mapping events. For NAT-PMP and UPnP. │ │ │ │ │ - storage │ │ │ │ │ - Enables alerts for events related to the storage. File errors and │ │ │ │ │ - synchronization events for moving the storage, renaming files etc. │ │ │ │ │ - tracker │ │ │ │ │ - Enables all tracker events. Includes announcing to trackers, receiving │ │ │ │ │ - responses, warnings and errors. │ │ │ │ │ - connect │ │ │ │ │ - Low level alerts for when peers are connected and disconnected. │ │ │ │ │ - status │ │ │ │ │ - Enables alerts for when a torrent or the _s_e_s_s_i_o_n changes state. │ │ │ │ │ - ip_block │ │ │ │ │ - Alerts when a peer is blocked by the ip blocker or port blocker. │ │ │ │ │ - performance_warning │ │ │ │ │ - Alerts when some limit is reached that might limit the download or upload │ │ │ │ │ - rate. │ │ │ │ │ - dht │ │ │ │ │ - Alerts on events in the DHT node. For incoming searches or bootstrapping │ │ │ │ │ - being done etc. │ │ │ │ │ - stats │ │ │ │ │ - If you enable these alerts, you will receive a stats_alert approximately │ │ │ │ │ - once every second, for every active torrent. These alerts contain all │ │ │ │ │ - statistics _c_o_u_n_t_e_r_s for the interval since the lasts stats _a_l_e_r_t. │ │ │ │ │ - session_log │ │ │ │ │ - Enables debug logging alerts. These are available unless libtorrent was │ │ │ │ │ - built with logging disabled (TORRENT_DISABLE_LOGGING). The alerts being │ │ │ │ │ - posted are _l_o_g___a_l_e_r_t and are _s_e_s_s_i_o_n wide. │ │ │ │ │ - torrent_log │ │ │ │ │ - Enables debug logging alerts for torrents. These are available unless │ │ │ │ │ - libtorrent was built with logging disabled (TORRENT_DISABLE_LOGGING). The │ │ │ │ │ - alerts being posted are _t_o_r_r_e_n_t___l_o_g___a_l_e_r_t and are torrent wide debug │ │ │ │ │ - events. │ │ │ │ │ - peer_log │ │ │ │ │ - Enables debug logging alerts for peers. These are available unless │ │ │ │ │ - libtorrent was built with logging disabled (TORRENT_DISABLE_LOGGING). The │ │ │ │ │ - alerts being posted are _p_e_e_r___l_o_g___a_l_e_r_t and low-level peer events and │ │ │ │ │ - messages. │ │ │ │ │ - incoming_request │ │ │ │ │ - enables the _i_n_c_o_m_i_n_g___r_e_q_u_e_s_t___a_l_e_r_t. │ │ │ │ │ - dht_log │ │ │ │ │ - enables _d_h_t___l_o_g___a_l_e_r_t, debug logging for the DHT │ │ │ │ │ - dht_operation │ │ │ │ │ - enable events from pure dht operations not related to torrents │ │ │ │ │ - port_mapping_log │ │ │ │ │ - enables port mapping log events. This log is useful for debugging the │ │ │ │ │ - UPnP or NAT-PMP implementation │ │ │ │ │ - picker_log │ │ │ │ │ - enables verbose logging from the piece picker. │ │ │ │ │ - file_progress │ │ │ │ │ - alerts when files complete downloading │ │ │ │ │ - piece_progress │ │ │ │ │ - alerts when pieces complete downloading or fail hash check │ │ │ │ │ - upload │ │ │ │ │ - alerts when we upload blocks to other peers │ │ │ │ │ - block_progress │ │ │ │ │ - alerts on individual blocks being requested, downloading, finished, │ │ │ │ │ - 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] │ │ │ │ │ -************ 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 │ │ │ │ │ -{ │ │ │ │ │ - bool ooppeerraattoorr==== (torrent_status const& 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 eerrrroorr__ffiillee = torrent_status::error_file_none; │ │ │ │ │ - static constexpr file_index_t eerrrroorr__ffiillee__nnoonnee {-1}; │ │ │ │ │ - static constexpr file_index_t eerrrroorr__ffiillee__ssssll__ccttxx {-3}; │ │ │ │ │ - static constexpr file_index_t eerrrroorr__ffiillee__mmeettaaddaattaa {-4}; │ │ │ │ │ - static constexpr file_index_t eerrrroorr__ffiillee__eexxcceeppttiioonn {-5}; │ │ │ │ │ - static constexpr file_index_t eerrrroorr__ffiillee__ppaarrttffiillee {-6}; │ │ │ │ │ - std::string save_path; │ │ │ │ │ - std::string name; │ │ │ │ │ - std::weak_ptr torrent_file; │ │ │ │ │ - time_duration nneexxtt__aannnnoouunnccee = seconds{0}; │ │ │ │ │ - std::string current_tracker; │ │ │ │ │ - std::int64_t ttoottaall__ddoowwnnllooaadd = 0; │ │ │ │ │ - std::int64_t ttoottaall__uuppllooaadd = 0; │ │ │ │ │ - std::int64_t ttoottaall__ppaayyllooaadd__ddoowwnnllooaadd = 0; │ │ │ │ │ - std::int64_t ttoottaall__ppaayyllooaadd__uuppllooaadd = 0; │ │ │ │ │ - std::int64_t ttoottaall__ffaaiilleedd__bbyytteess = 0; │ │ │ │ │ - std::int64_t ttoottaall__rreedduunnddaanntt__bbyytteess = 0; │ │ │ │ │ - typed_bitfield pieces; │ │ │ │ │ - typed_bitfield verified_pieces; │ │ │ │ │ - std::int64_t ttoottaall__ddoonnee = 0; │ │ │ │ │ - std::int64_t ttoottaall = 0; │ │ │ │ │ - std::int64_t ttoottaall__wwaanntteedd__ddoonnee = 0; │ │ │ │ │ - std::int64_t ttoottaall__wwaanntteedd = 0; │ │ │ │ │ - std::int64_t aallll__ttiimmee__uuppllooaadd = 0; │ │ │ │ │ - std::int64_t aallll__ttiimmee__ddoowwnnllooaadd = 0; │ │ │ │ │ - std::time_t aaddddeedd__ttiimmee = 0; │ │ │ │ │ - std::time_t ccoommpplleetteedd__ttiimmee = 0; │ │ │ │ │ - std::time_t llaasstt__sseeeenn__ccoommpplleettee = 0; │ │ │ │ │ - storage_mode_t ssttoorraaggee__mmooddee = storage_mode_sparse; │ │ │ │ │ - float pprrooggrreessss = 0.f; │ │ │ │ │ - int pprrooggrreessss__ppppmm = 0; │ │ │ │ │ - queue_position_t qquueeuuee__ppoossiittiioonn {}; │ │ │ │ │ - int ddoowwnnllooaadd__rraattee = 0; │ │ │ │ │ - int uuppllooaadd__rraattee = 0; │ │ │ │ │ - int ddoowwnnllooaadd__ppaayyllooaadd__rraattee = 0; │ │ │ │ │ - int uuppllooaadd__ppaayyllooaadd__rraattee = 0; │ │ │ │ │ - int nnuumm__sseeeeddss = 0; │ │ │ │ │ - int nnuumm__ppeeeerrss = 0; │ │ │ │ │ - int nnuumm__ccoommpplleettee = -1; │ │ │ │ │ - int nnuumm__iinnccoommpplleettee = -1; │ │ │ │ │ - int lliisstt__sseeeeddss = 0; │ │ │ │ │ - int lliisstt__ppeeeerrss = 0; │ │ │ │ │ - int ccoonnnneecctt__ccaannddiiddaatteess = 0; │ │ │ │ │ - int nnuumm__ppiieecceess = 0; │ │ │ │ │ - int ddiissttrriibbuutteedd__ffuullll__ccooppiieess = 0; │ │ │ │ │ - int ddiissttrriibbuutteedd__ffrraaccttiioonn = 0; │ │ │ │ │ - float ddiissttrriibbuutteedd__ccooppiieess = 0.f; │ │ │ │ │ - int bblloocckk__ssiizzee = 0; │ │ │ │ │ - int nnuumm__uuppllooaaddss = 0; │ │ │ │ │ - int nnuumm__ccoonnnneeccttiioonnss = 0; │ │ │ │ │ - int uuppllooaaddss__lliimmiitt = 0; │ │ │ │ │ - int ccoonnnneeccttiioonnss__lliimmiitt = 0; │ │ │ │ │ - int uupp__bbaannddwwiiddtthh__qquueeuuee = 0; │ │ │ │ │ - int ddoowwnn__bbaannddwwiiddtthh__qquueeuuee = 0; │ │ │ │ │ - int sseeeedd__rraannkk = 0; │ │ │ │ │ - state_t ssttaattee = checking_resume_data; │ │ │ │ │ - bool nneeeedd__ssaavvee__rreessuummee = false; │ │ │ │ │ - bool iiss__sseeeeddiinngg = false; │ │ │ │ │ - bool iiss__ffiinniisshheedd = false; │ │ │ │ │ - bool hhaass__mmeettaaddaattaa = false; │ │ │ │ │ - bool hhaass__iinnccoommiinngg = false; │ │ │ │ │ - bool mmoovviinngg__ssttoorraaggee = false; │ │ │ │ │ - bool aannnnoouunncciinngg__ttoo__ttrraacckkeerrss = false; │ │ │ │ │ - bool aannnnoouunncciinngg__ttoo__llssdd = false; │ │ │ │ │ - bool aannnnoouunncciinngg__ttoo__ddhhtt = 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 ffllaaggss {}; │ │ │ │ │ -}; │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ooppeerraattoorr====(()) ********** │ │ │ │ │ -bool ooppeerraattoorr==== (torrent_status const& st) const; │ │ │ │ │ -compares if the torrent status objects come from the same torrent. i.e. only │ │ │ │ │ -the _t_o_r_r_e_n_t___h_a_n_d_l_e field is compared. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** eennuumm ssttaattee__tt ********** │ │ │ │ │ -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" │ │ │ │ │ - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ │ │ │ │ │ -|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The torrent has not | │ │ │ │ │ -| | |started its download| │ │ │ │ │ -|checking_files |1 |yet, and is | │ │ │ │ │ -| | |currently checking | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_x_i_s_t_i_n_g_ _f_i_l_e_s_._ _ _ _ _ | │ │ │ │ │ -| | |The torrent is | │ │ │ │ │ -| | |trying to download | │ │ │ │ │ -|downloading_metadata |2 |metadata from peers.| │ │ │ │ │ -| | |This implies the | │ │ │ │ │ -| | |ut_metadata | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_x_t_e_n_s_i_o_n_ _i_s_ _i_n_ _u_s_e_.| │ │ │ │ │ -| | |The torrent is being| │ │ │ │ │ -| | |downloaded. This is | │ │ │ │ │ -| | |the state most | │ │ │ │ │ -| | |torrents will be in | │ │ │ │ │ -|downloading |3 |most of the time. | │ │ │ │ │ -| | |The progress meter | │ │ │ │ │ -| | |will tell how much | │ │ │ │ │ -| | |of the files that | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_h_a_s_ _b_e_e_n_ _d_o_w_n_l_o_a_d_e_d_.| │ │ │ │ │ -| | |In this state the | │ │ │ │ │ -| | |torrent has finished| │ │ │ │ │ -| | |downloading but | │ │ │ │ │ -|finished |4 |still doesn't have | │ │ │ │ │ -| | |the entire torrent. | │ │ │ │ │ -| | |i.e. some pieces are| │ │ │ │ │ -| | |filtered and won't | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_g_e_t_ _d_o_w_n_l_o_a_d_e_d_._ _ _ _ _ | │ │ │ │ │ -| | |In this state the | │ │ │ │ │ -|seeding |5 |torrent has finished| │ │ │ │ │ -| | |downloading and is a| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_u_r_e_ _s_e_e_d_e_r_._ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |If the torrent was | │ │ │ │ │ -| | |started in full | │ │ │ │ │ -| | |allocation mode, | │ │ │ │ │ -|unused_enum_for_backwards_compatibility_allocating|6 |this indicates that | │ │ │ │ │ -| | |the (disk) storage | │ │ │ │ │ -| | |for the torrent is | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_l_l_o_c_a_t_e_d_._ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |The torrent is | │ │ │ │ │ -| | |currently checking | │ │ │ │ │ -| | |the fast resume data| │ │ │ │ │ -| | |and comparing it to | │ │ │ │ │ -| | |the files on disk. | │ │ │ │ │ -|checking_resume_data |7 |This is typically | │ │ │ │ │ -| | |completed in a | │ │ │ │ │ -| | |fraction of a | │ │ │ │ │ -| | |second, but if you | │ │ │ │ │ -| | |add a large number | │ │ │ │ │ -| | |of torrents at once,| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_y_ _w_i_l_l_ _q_u_e_u_e_ _u_p_._ | │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - handle │ │ │ │ │ - a handle to the torrent whose status the object represents. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - errc │ │ │ │ │ - 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - error_file │ │ │ │ │ - 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; │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - error_file_none │ │ │ │ │ - special values for error_file to describe which file or component │ │ │ │ │ - encountered the error (errc). the error did not occur on a file │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - error_file_ssl_ctx │ │ │ │ │ - the error occurred setting up the SSL context │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - error_file_metadata │ │ │ │ │ - the error occurred while loading the metadata for the torrent │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - error_file_exception │ │ │ │ │ - there was a serious error reported in this torrent. The error code or a │ │ │ │ │ - torrent log _a_l_e_r_t may provide more information. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - error_file_partfile │ │ │ │ │ - the error occurred with the partfile │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - save_path │ │ │ │ │ - the path to the directory where this torrent's files are stored. It's │ │ │ │ │ - typically the path as was given to _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_) or _a_d_d___t_o_r_r_e_n_t_(_) │ │ │ │ │ - when this torrent was started. This field is only included if the torrent │ │ │ │ │ - status is queried with torrent_handle::query_save_path. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - name │ │ │ │ │ - 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 _s_e_s_s_i_o_n. See session::add_torrent. This field is only included if the │ │ │ │ │ - torrent status is queried with torrent_handle::query_name. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - torrent_file │ │ │ │ │ - set to point to the torrent_info object for this torrent. It's only │ │ │ │ │ - included if the torrent status is queried with torrent_handle:: │ │ │ │ │ - query_torrent_file. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - next_announce │ │ │ │ │ - the time until the torrent will announce itself to the tracker. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - current_tracker │ │ │ │ │ - the URL of the last working tracker. If no tracker request has been │ │ │ │ │ - successful yet, it's set to an empty string. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - total_download total_upload │ │ │ │ │ - the number of bytes downloaded and uploaded to all peers, accumulated, │ │ │ │ │ - tthhiiss sseessssiioonn only. The _s_e_s_s_i_o_n is considered to restart when a torrent is │ │ │ │ │ - paused and restarted again. When a torrent is paused, these _c_o_u_n_t_e_r_s are │ │ │ │ │ - reset to 0. If you want complete, persistent, stats, see all_time_upload │ │ │ │ │ - and all_time_download. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - total_payload_download total_payload_upload │ │ │ │ │ - counts the amount of bytes send and received this _s_e_s_s_i_o_n, but only the │ │ │ │ │ - actual payload data (i.e the interesting data), these _c_o_u_n_t_e_r_s ignore any │ │ │ │ │ - protocol overhead. The _s_e_s_s_i_o_n is considered to restart when a torrent is │ │ │ │ │ - paused and restarted again. When a torrent is paused, these _c_o_u_n_t_e_r_s are │ │ │ │ │ - reset to 0. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - total_failed_bytes │ │ │ │ │ - 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - total_redundant_bytes │ │ │ │ │ - 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - pieces │ │ │ │ │ - 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - verified_pieces │ │ │ │ │ - a bitmask representing which pieces has had their hash checked. This only │ │ │ │ │ - applies to torrents in sseeeedd mmooddee. If the torrent is not in seed mode, │ │ │ │ │ - this bitmask may be empty. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - total_done │ │ │ │ │ - the total number of bytes of the file(s) that we have. All this does not │ │ │ │ │ - necessarily has to be downloaded during this _s_e_s_s_i_o_n (that's │ │ │ │ │ - total_payload_download). │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - total │ │ │ │ │ - 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - total_wanted_done │ │ │ │ │ - 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 │ │ │ │ │ - "wanted". │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - total_wanted │ │ │ │ │ - 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 "wanted". │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - all_time_upload all_time_download │ │ │ │ │ - are accumulated upload and download payload byte _c_o_u_n_t_e_r_s. They are saved │ │ │ │ │ - in and restored from resume data to keep totals across sessions. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - added_time │ │ │ │ │ - the posix-time when this torrent was added. i.e. what time(nullptr) │ │ │ │ │ - returned at the time. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - completed_time │ │ │ │ │ - the posix-time when this torrent was finished. If the torrent is not yet │ │ │ │ │ - finished, this is 0. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - last_seen_complete │ │ │ │ │ - the time when we, or one of our peers, last saw a complete copy of this │ │ │ │ │ - torrent. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - storage_mode │ │ │ │ │ - The allocation mode for the torrent. See _s_t_o_r_a_g_e___m_o_d_e___t for the options. │ │ │ │ │ - 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] │ │ │ │ │ - progress │ │ │ │ │ - a value in the range [0, 1], that represents the progress of the │ │ │ │ │ - torrent's current task. It may be checking files or downloading. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - progress_ppm │ │ │ │ │ - progress parts per million (progress * 1000000) when disabling floating │ │ │ │ │ - point operations, this is the only option to query progress │ │ │ │ │ - reflects the same value as progress, 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - queue_position │ │ │ │ │ - the position this torrent has in the download queue. If the torrent is a │ │ │ │ │ - seed or finished, this is -1. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - download_rate upload_rate │ │ │ │ │ - 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - download_payload_rate upload_payload_rate │ │ │ │ │ - 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - num_seeds │ │ │ │ │ - the number of peers that are seeding that this client is currently │ │ │ │ │ - connected to. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - num_peers │ │ │ │ │ - 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 _g_e_t___p_e_e_r___i_n_f_o_(_). │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - num_complete num_incomplete │ │ │ │ │ - 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - list_seeds list_peers │ │ │ │ │ - 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - connect_candidates │ │ │ │ │ - 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - num_pieces │ │ │ │ │ - the number of pieces that has been downloaded. It is equivalent to: std:: │ │ │ │ │ - accumulate(pieces->begin(), pieces->end()). 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - distributed_full_copies │ │ │ │ │ - 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - distributed_fraction │ │ │ │ │ - tells the share of pieces that have more copies than the rarest piece(s). │ │ │ │ │ - Divide this number by 1000 to get the fraction. │ │ │ │ │ - For example, if distributed_full_copies is 2 and distributed_fraction 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. │ │ │ │ │ - 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - distributed_copies │ │ │ │ │ - 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. │ │ │ │ │ - the integer part tells how many copies │ │ │ │ │ - there are of the rarest piece(s) │ │ │ │ │ - the fractional part tells the fraction of pieces that │ │ │ │ │ - have more copies than the rarest piece(s). │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - block_size │ │ │ │ │ - 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 partial_piece_info's bitset represents, see │ │ │ │ │ - _g_e_t___d_o_w_n_l_o_a_d___q_u_e_u_e_(_). This is typically 16 kB, but it may be smaller, if │ │ │ │ │ - the pieces are smaller. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - num_uploads │ │ │ │ │ - the number of unchoked peers in this torrent. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - num_connections │ │ │ │ │ - the number of peer connections this torrent has, including half-open │ │ │ │ │ - connections that hasn't completed the bittorrent handshake yet. This is │ │ │ │ │ - always >= num_peers. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - uploads_limit │ │ │ │ │ - the set limit of upload slots (unchoked peers) for this torrent. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - connections_limit │ │ │ │ │ - the set limit of number of connections for this torrent. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - up_bandwidth_queue down_bandwidth_queue │ │ │ │ │ - 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 │ │ │ │ │ - session_status object. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - seed_rank │ │ │ │ │ - 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 │ │ │ │ │ - _q_u_e_u_i_n_g. Higher value means more important to seed │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - state │ │ │ │ │ - the main state the torrent is in. See _t_o_r_r_e_n_t___s_t_a_t_u_s_:_:_s_t_a_t_e___t. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - need_save_resume │ │ │ │ │ - true if this torrent has unsaved changes to its download state and │ │ │ │ │ - statistics since the last resume data was saved. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - is_seeding │ │ │ │ │ - true if all pieces have been downloaded. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - is_finished │ │ │ │ │ - true if all pieces that have a priority > 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - has_metadata │ │ │ │ │ - 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). │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - has_incoming │ │ │ │ │ - true if there has ever been an incoming connection attempt to this │ │ │ │ │ - torrent. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - moving_storage │ │ │ │ │ - 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - announcing_to_trackers announcing_to_lsd announcing_to_dht │ │ │ │ │ - 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - info_hashes │ │ │ │ │ - the info-hash for this torrent │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - last_upload last_download │ │ │ │ │ - the timestamps of the last time this torrent uploaded or downloaded │ │ │ │ │ - payload to any peer. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - active_duration finished_duration seeding_duration │ │ │ │ │ - these are cumulative _c_o_u_n_t_e_r_s of for how long the torrent has been in │ │ │ │ │ - different states. active means not paused and added to _s_e_s_s_i_o_n. 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. │ │ │ │ │ -[_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] │ │ │ │ │ -************ 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 (preformatted_type); │ │ │ │ │ - eennttrryy (integer_type); │ │ │ │ │ - eennttrryy (dictionary_type); │ │ │ │ │ - eennttrryy (span); │ │ │ │ │ - eennttrryy (list_type); │ │ │ │ │ - eennttrryy (U v); │ │ │ │ │ - eennttrryy (data_type t); │ │ │ │ │ - eennttrryy (bdecode_node const& n); │ │ │ │ │ - entry& ooppeerraattoorr== (preformatted_type) &; │ │ │ │ │ - entry& ooppeerraattoorr== (bdecode_node const&) &; │ │ │ │ │ - entry& ooppeerraattoorr== (entry const&) &; │ │ │ │ │ - entry& ooppeerraattoorr== (integer_type) &; │ │ │ │ │ - entry& ooppeerraattoorr== (span) &; │ │ │ │ │ - entry& ooppeerraattoorr== (entry&&) & noexcept; │ │ │ │ │ - entry& ooppeerraattoorr== (dictionary_type) &; │ │ │ │ │ - entry& ooppeerraattoorr== (list_type) &; │ │ │ │ │ - entry& ooppeerraattoorr== (U v) &; │ │ │ │ │ - integer_type& iinntteeggeerr (); │ │ │ │ │ - string_type const& ssttrriinngg () const; │ │ │ │ │ - preformatted_type const& pprreeffoorrmmaatttteedd () const; │ │ │ │ │ - list_type& lliisstt (); │ │ │ │ │ - string_type& ssttrriinngg (); │ │ │ │ │ - preformatted_type& pprreeffoorrmmaatttteedd (); │ │ │ │ │ - integer_type const& iinntteeggeerr () const; │ │ │ │ │ - dictionary_type& ddiicctt (); │ │ │ │ │ - dictionary_type const& ddiicctt () const; │ │ │ │ │ - list_type const& lliisstt () 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 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 (preformatted_type); │ │ │ │ │ -eennttrryy (integer_type); │ │ │ │ │ -eennttrryy (dictionary_type); │ │ │ │ │ -eennttrryy (span); │ │ │ │ │ -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== (preformatted_type) &; │ │ │ │ │ -entry& ooppeerraattoorr== (bdecode_node const&) &; │ │ │ │ │ -entry& ooppeerraattoorr== (entry const&) &; │ │ │ │ │ -entry& ooppeerraattoorr== (integer_type) &; │ │ │ │ │ -entry& ooppeerraattoorr== (span) &; │ │ │ │ │ -entry& ooppeerraattoorr== (entry&&) & noexcept; │ │ │ │ │ -entry& ooppeerraattoorr== (dictionary_type) &; │ │ │ │ │ -entry& ooppeerraattoorr== (list_type) &; │ │ │ │ │ -copies the structure of the right hand side into this _e_n_t_r_y. │ │ │ │ │ +********** ttiimmeessttaammpp(()) ********** │ │ │ │ │ +time_point ttiimmeessttaammpp () const; │ │ │ │ │ +a timestamp is automatically created in the constructor │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** lliisstt(()) pprreeffoorrmmaatttteedd(()) ddiicctt(()) iinntteeggeerr(()) ssttrriinngg(()) ********** │ │ │ │ │ -integer_type& iinntteeggeerr (); │ │ │ │ │ -string_type const& ssttrriinngg () const; │ │ │ │ │ -preformatted_type const& pprreeffoorrmmaatttteedd () const; │ │ │ │ │ -list_type& lliisstt (); │ │ │ │ │ -string_type& ssttrriinngg (); │ │ │ │ │ -preformatted_type& pprreeffoorrmmaatttteedd (); │ │ │ │ │ -integer_type const& iinntteeggeerr () const; │ │ │ │ │ -dictionary_type& ddiicctt (); │ │ │ │ │ -dictionary_type const& ddiicctt () const; │ │ │ │ │ -list_type const& lliisstt () 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; │ │ │ │ │ -// ... │ │ │ │ │ +********** 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 alerts; │ │ │ │ │ +ses.pop_alerts(&alerts); │ │ │ │ │ +for (alert* a : alerts) { │ │ │ │ │ + switch (a->type()) { │ │ │ │ │ │ │ │ │ │ -// 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"; │ │ │ │ │ + case read_piece_alert::alert_type: │ │ │ │ │ + { │ │ │ │ │ + auto* p = static_cast(a); │ │ │ │ │ + if (p->ec) { │ │ │ │ │ + // read_piece failed │ │ │ │ │ + break; │ │ │ │ │ + } │ │ │ │ │ + // use p │ │ │ │ │ + break; │ │ │ │ │ + } │ │ │ │ │ + case file_renamed_alert::alert_type: │ │ │ │ │ + { │ │ │ │ │ + // etc... │ │ │ │ │ + } │ │ │ │ │ + } │ │ │ │ │ } │ │ │ │ │ -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. │ │ │ │ │ +********** 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] │ │ │ │ │ -********** 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. │ │ │ │ │ +********** 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] │ │ │ │ │ -********** 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. │ │ │ │ │ +********** 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] │ │ │ │ │ -********** 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 │ │ │ │ │ +************ 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" │ │ │ │ │ +char const* ooppeerraattiioonn__nnaammee (operation_t op); │ │ │ │ │ +maps an operation id (from _p_e_e_r___e_r_r_o_r___a_l_e_r_t and _p_e_e_r___d_i_s_c_o_n_n_e_c_t_e_d___a_l_e_r_t) to its │ │ │ │ │ +name. See _o_p_e_r_a_t_i_o_n___t for the constants │ │ │ │ │ [_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_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +************ aalleerrtt__ccaasstt(()) ************ │ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_a_l_e_r_t_._h_p_p" │ │ │ │ │ +template T* aalleerrtt__ccaasstt (alert* a); │ │ │ │ │ +template 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] │ │ │ │ │ -************ 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. │ │ │ │ │ +************ eennuumm ooppeerraattiioonn__tt ************ │ │ │ │ │ +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" │ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ │ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|unknown |0 |the error was unexpected and it is unknown which | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_p_e_r_a_t_i_o_n_ _c_a_u_s_e_d_ _i_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|bittorrent |1 |this is used when the bittorrent logic determines | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_o_ _d_i_s_c_o_n_n_e_c_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_i_o_c_o_n_t_r_o_l_ _ _ _ _ _ _ _ _ _ _|_2_ _ _ _ _|_a_ _c_a_l_l_ _t_o_ _i_o_c_o_n_t_r_o_l_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|getpeername |3 |a call to getpeername() failed (querying the remote| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_I_P_ _o_f_ _a_ _c_o_n_n_e_c_t_i_o_n_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|getname |4 |a call to getname failed (querying the local IP of | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_ _c_o_n_n_e_c_t_i_o_n_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_a_l_l_o_c___r_e_c_v_b_u_f_ _ _ _ _ _ _|_5_ _ _ _ _|_a_n_ _a_t_t_e_m_p_t_ _t_o_ _a_l_l_o_c_a_t_e_ _a_ _r_e_c_e_i_v_e_ _b_u_f_f_e_r_ _f_a_i_l_e_d_ _ _ _ _ | │ │ │ │ │ +|_a_l_l_o_c___s_n_d_b_u_f_ _ _ _ _ _ _ _|_6_ _ _ _ _|_a_n_ _a_t_t_e_m_p_t_ _t_o_ _a_l_l_o_c_a_t_e_ _a_ _s_e_n_d_ _b_u_f_f_e_r_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ | │ │ │ │ │ +|_f_i_l_e___w_r_i_t_e_ _ _ _ _ _ _ _ _ _|_7_ _ _ _ _|_w_r_i_t_i_n_g_ _t_o_ _a_ _f_i_l_e_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_f_i_l_e___r_e_a_d_ _ _ _ _ _ _ _ _ _ _|_8_ _ _ _ _|_r_e_a_d_i_n_g_ _f_r_o_m_ _a_ _f_i_l_e_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_9_ _ _ _ _|_a_ _n_o_n_-_r_e_a_d_ _a_n_d_ _n_o_n_-_w_r_i_t_e_ _f_i_l_e_ _o_p_e_r_a_t_i_o_n_ _f_a_i_l_e_d_ _ _ _ _ | │ │ │ │ │ +|_s_o_c_k___w_r_i_t_e_ _ _ _ _ _ _ _ _ _|_1_0_ _ _ _|_a_ _s_o_c_k_e_t_ _w_r_i_t_e_ _o_p_e_r_a_t_i_o_n_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_s_o_c_k___r_e_a_d_ _ _ _ _ _ _ _ _ _ _|_1_1_ _ _ _|_a_ _s_o_c_k_e_t_ _r_e_a_d_ _o_p_e_r_a_t_i_o_n_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_s_o_c_k___o_p_e_n_ _ _ _ _ _ _ _ _ _ _|_1_2_ _ _ _|_a_ _c_a_l_l_ _t_o_ _o_p_e_n_(_)_,_ _t_o_ _c_r_e_a_t_e_ _a_ _s_o_c_k_e_t_ _s_o_c_k_e_t_ _f_a_i_l_e_d_ | │ │ │ │ │ +|_s_o_c_k___b_i_n_d_ _ _ _ _ _ _ _ _ _ _|_1_3_ _ _ _|_a_ _c_a_l_l_ _t_o_ _b_i_n_d_(_)_ _o_n_ _a_ _s_o_c_k_e_t_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|available |14 |an attempt to query the number of bytes available | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_o_ _r_e_a_d_ _f_r_o_m_ _a_ _s_o_c_k_e_t_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|encryption |15 |a call related to bittorrent protocol encryption | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_c_o_n_n_e_c_t_ _ _ _ _ _ _ _ _ _ _ _ _|_1_6_ _ _ _|_a_n_ _a_t_t_e_m_p_t_ _t_o_ _c_o_n_n_e_c_t_ _a_ _s_o_c_k_e_t_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_s_s_l___h_a_n_d_s_h_a_k_e_ _ _ _ _ _ _|_1_7_ _ _ _|_e_s_t_a_b_l_i_s_h_i_n_g_ _a_n_ _S_S_L_ _c_o_n_n_e_c_t_i_o_n_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|get_interface |18 |a connection failed to satisfy the bind interface | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_e_t_t_i_n_g_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_s_o_c_k___l_i_s_t_e_n_ _ _ _ _ _ _ _ _|_1_9_ _ _ _|_a_ _c_a_l_l_ _t_o_ _l_i_s_t_e_n_(_)_ _o_n_ _a_ _s_o_c_k_e_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|sock_bind_to_device|20 |a call to the ioctl to bind a socket to a specific | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_n_e_t_w_o_r_k_ _d_e_v_i_c_e_ _o_r_ _a_d_a_p_t_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_s_o_c_k___a_c_c_e_p_t_ _ _ _ _ _ _ _ _|_2_1_ _ _ _|_a_ _c_a_l_l_ _t_o_ _a_c_c_e_p_t_(_)_ _o_n_ _a_ _s_o_c_k_e_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_p_a_r_s_e___a_d_d_r_e_s_s_ _ _ _ _ _ _|_2_2_ _ _ _|_c_o_n_v_e_r_t_ _a_ _s_t_r_i_n_g_ _i_n_t_o_ _a_ _v_a_l_i_d_ _n_e_t_w_o_r_k_ _a_d_d_r_e_s_s_ _ _ _ _ _ | │ │ │ │ │ +|_e_n_u_m___i_f_ _ _ _ _ _ _ _ _ _ _ _ _|_2_3_ _ _ _|_e_n_u_m_e_r_a_t_i_o_n_ _n_e_t_w_o_r_k_ _d_e_v_i_c_e_s_ _o_r_ _a_d_a_p_t_e_r_s_ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_f_i_l_e___s_t_a_t_ _ _ _ _ _ _ _ _ _ _|_2_4_ _ _ _|_i_n_v_o_k_i_n_g_ _s_t_a_t_(_)_ _o_n_ _a_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_f_i_l_e___c_o_p_y_ _ _ _ _ _ _ _ _ _ _|_2_5_ _ _ _|_c_o_p_y_i_n_g_ _a_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_f_i_l_e___f_a_l_l_o_c_a_t_e_ _ _ _ _ _|_2_6_ _ _ _|_a_l_l_o_c_a_t_i_n_g_ _s_t_o_r_a_g_e_ _f_o_r_ _a_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_f_i_l_e___h_a_r_d___l_i_n_k_ _ _ _ _ _|_2_7_ _ _ _|_c_r_e_a_t_i_n_g_ _a_ _h_a_r_d_ _l_i_n_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_f_i_l_e___r_e_m_o_v_e_ _ _ _ _ _ _ _ _|_2_8_ _ _ _|_r_e_m_o_v_i_n_g_ _a_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_f_i_l_e___r_e_n_a_m_e_ _ _ _ _ _ _ _ _|_2_9_ _ _ _|_r_e_n_a_m_i_n_g_ _a_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_f_i_l_e___o_p_e_n_ _ _ _ _ _ _ _ _ _ _|_3_0_ _ _ _|_o_p_e_n_i_n_g_ _a_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_m_k_d_i_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_3_1_ _ _ _|_c_r_e_a_t_i_n_g_ _a_ _d_i_r_e_c_t_o_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_c_h_e_c_k___r_e_s_u_m_e_ _ _ _ _ _ _ _|_3_2_ _ _ _|_c_h_e_c_k_ _f_a_s_t_ _r_e_s_u_m_e_ _d_a_t_a_ _a_g_a_i_n_s_t_ _f_i_l_e_s_ _o_n_ _d_i_s_k_ _ _ _ _ _ _ | │ │ │ │ │ +|_e_x_c_e_p_t_i_o_n_ _ _ _ _ _ _ _ _ _ _|_3_3_ _ _ _|_a_n_ _u_n_k_n_o_w_n_ _e_x_c_e_p_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_a_l_l_o_c___c_a_c_h_e___p_i_e_c_e_ _ _|_3_4_ _ _ _|_a_l_l_o_c_a_t_e_ _s_p_a_c_e_ _f_o_r_ _a_ _p_i_e_c_e_ _i_n_ _t_h_e_ _c_a_c_h_e_ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_p_a_r_t_f_i_l_e___m_o_v_e_ _ _ _ _ _ _|_3_5_ _ _ _|_m_o_v_e_ _a_ _p_a_r_t_-_f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_p_a_r_t_f_i_l_e___r_e_a_d_ _ _ _ _ _ _|_3_6_ _ _ _|_r_e_a_d_ _f_r_o_m_ _a_ _p_a_r_t_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_p_a_r_t_f_i_l_e___w_r_i_t_e_ _ _ _ _ _|_3_7_ _ _ _|_w_r_i_t_e_ _t_o_ _a_ _p_a_r_t_-_f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_h_o_s_t_n_a_m_e___l_o_o_k_u_p_ _ _ _ _|_3_8_ _ _ _|_a_ _h_o_s_t_n_a_m_e_ _l_o_o_k_u_p_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_s_y_m_l_i_n_k_ _ _ _ _ _ _ _ _ _ _ _ _|_3_9_ _ _ _|_c_r_e_a_t_e_ _o_r_ _r_e_a_d_ _a_ _s_y_m_l_i_n_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_h_a_n_d_s_h_a_k_e_ _ _ _ _ _ _ _ _ _ _|_4_0_ _ _ _|_h_a_n_d_s_h_a_k_e_ _w_i_t_h_ _a_ _p_e_e_r_ _o_r_ _s_e_r_v_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_s_o_c_k___o_p_t_i_o_n_ _ _ _ _ _ _ _ _|_4_1_ _ _ _|_s_e_t_ _s_o_c_k_e_t_ _o_p_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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] │ │ │ │ │ -************ bbeennccooddee(()) ************ │ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_e_n_c_o_d_e_._h_p_p" │ │ │ │ │ -template 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 buf; │ │ │ │ │ -bencode(std::back_inserter(buf), 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 │ │ │ │ │ + * resume data failures │ │ │ │ │ + * web seed errors │ │ │ │ │ + * .torrent files errors │ │ │ │ │ + * listen socket errors │ │ │ │ │ + * port mapping errors │ │ │ │ │ + peer │ │ │ │ │ + Enables alerts when peers send invalid requests, get banned or snubbed. │ │ │ │ │ + port_mapping │ │ │ │ │ + Enables alerts for port mapping events. For NAT-PMP and UPnP. │ │ │ │ │ + storage │ │ │ │ │ + Enables alerts for events related to the storage. File errors and │ │ │ │ │ + synchronization events for moving the storage, renaming files etc. │ │ │ │ │ + tracker │ │ │ │ │ + Enables all tracker events. Includes announcing to trackers, receiving │ │ │ │ │ + responses, warnings and errors. │ │ │ │ │ + connect │ │ │ │ │ + Low level alerts for when peers are connected and disconnected. │ │ │ │ │ + status │ │ │ │ │ + Enables alerts for when a torrent or the _s_e_s_s_i_o_n changes state. │ │ │ │ │ + ip_block │ │ │ │ │ + Alerts when a peer is blocked by the ip blocker or port blocker. │ │ │ │ │ + performance_warning │ │ │ │ │ + Alerts when some limit is reached that might limit the download or upload │ │ │ │ │ + rate. │ │ │ │ │ + dht │ │ │ │ │ + Alerts on events in the DHT node. For incoming searches or bootstrapping │ │ │ │ │ + being done etc. │ │ │ │ │ + stats │ │ │ │ │ + If you enable these alerts, you will receive a stats_alert approximately │ │ │ │ │ + once every second, for every active torrent. These alerts contain all │ │ │ │ │ + statistics _c_o_u_n_t_e_r_s for the interval since the lasts stats _a_l_e_r_t. │ │ │ │ │ + session_log │ │ │ │ │ + Enables debug logging alerts. These are available unless libtorrent was │ │ │ │ │ + built with logging disabled (TORRENT_DISABLE_LOGGING). The alerts being │ │ │ │ │ + posted are _l_o_g___a_l_e_r_t and are _s_e_s_s_i_o_n wide. │ │ │ │ │ + torrent_log │ │ │ │ │ + Enables debug logging alerts for torrents. These are available unless │ │ │ │ │ + libtorrent was built with logging disabled (TORRENT_DISABLE_LOGGING). The │ │ │ │ │ + alerts being posted are _t_o_r_r_e_n_t___l_o_g___a_l_e_r_t and are torrent wide debug │ │ │ │ │ + events. │ │ │ │ │ + peer_log │ │ │ │ │ + Enables debug logging alerts for peers. These are available unless │ │ │ │ │ + libtorrent was built with logging disabled (TORRENT_DISABLE_LOGGING). The │ │ │ │ │ + alerts being posted are _p_e_e_r___l_o_g___a_l_e_r_t and low-level peer events and │ │ │ │ │ + messages. │ │ │ │ │ + incoming_request │ │ │ │ │ + enables the _i_n_c_o_m_i_n_g___r_e_q_u_e_s_t___a_l_e_r_t. │ │ │ │ │ + dht_log │ │ │ │ │ + enables _d_h_t___l_o_g___a_l_e_r_t, debug logging for the DHT │ │ │ │ │ + dht_operation │ │ │ │ │ + enable events from pure dht operations not related to torrents │ │ │ │ │ + port_mapping_log │ │ │ │ │ + enables port mapping log events. This log is useful for debugging the │ │ │ │ │ + UPnP or NAT-PMP implementation │ │ │ │ │ + picker_log │ │ │ │ │ + enables verbose logging from the piece picker. │ │ │ │ │ + file_progress │ │ │ │ │ + alerts when files complete downloading │ │ │ │ │ + piece_progress │ │ │ │ │ + alerts when pieces complete downloading or fail hash check │ │ │ │ │ + upload │ │ │ │ │ + alerts when we upload blocks to other peers │ │ │ │ │ + block_progress │ │ │ │ │ + alerts on individual blocks being requested, downloading, finished, │ │ │ │ │ + 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. │ │ │ │ │ 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. │ │ │ │ │ @@ -9650,16 +4734,16 @@ │ │ │ │ │ struct torrent_plugin │ │ │ │ │ { │ │ │ │ │ virtual std::shared_ptr 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__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; │ │ │ │ │ @@ -9676,30 +4760,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(()) ********** │ │ │ │ │ +********** 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 │ │ │ │ │ @@ -9745,43 +4829,43 @@ │ │ │ │ │ { │ │ │ │ │ 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); │ │ │ │ │ virtual bool oonn__eexxtteennssiioonn__hhaannddsshhaakkee (bdecode_node const&); │ │ │ │ │ - virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//); │ │ │ │ │ - virtual bool oonn__hhaavvee__nnoonnee (); │ │ │ │ │ - virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t); │ │ │ │ │ - virtual bool oonn__rreeqquueesstt (peer_request const&); │ │ │ │ │ - virtual bool oonn__uunncchhookkee (); │ │ │ │ │ - virtual bool oonn__hhaavvee (piece_index_t); │ │ │ │ │ - virtual bool oonn__nnoott__iinntteerreesstteedd (); │ │ │ │ │ virtual bool oonn__hhaavvee__aallll (); │ │ │ │ │ - virtual bool oonn__cchhookkee (); │ │ │ │ │ virtual bool oonn__ddoonntt__hhaavvee (piece_index_t); │ │ │ │ │ virtual bool oonn__iinntteerreesstteedd (); │ │ │ │ │ + virtual bool oonn__cchhookkee (); │ │ │ │ │ + virtual bool oonn__nnoott__iinntteerreesstteedd (); │ │ │ │ │ + virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//); │ │ │ │ │ + virtual bool oonn__uunncchhookkee (); │ │ │ │ │ + virtual bool oonn__rreeqquueesstt (peer_request const&); │ │ │ │ │ + virtual bool oonn__hhaavvee (piece_index_t); │ │ │ │ │ + virtual bool oonn__hhaavvee__nnoonnee (); │ │ │ │ │ + virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t); │ │ │ │ │ virtual bool oonn__ppiieeccee (peer_request const& //**ppiieeccee**// │ │ │ │ │ , span //**bbuuff**//); │ │ │ │ │ - virtual bool oonn__ssuuggggeesstt (piece_index_t); │ │ │ │ │ virtual bool oonn__ccaanncceell (peer_request const&); │ │ │ │ │ virtual bool oonn__rreejjeecctt (peer_request const&); │ │ │ │ │ - virtual void sseenntt__rreeqquueesstt (peer_request const&); │ │ │ │ │ + virtual bool oonn__ssuuggggeesstt (piece_index_t); │ │ │ │ │ + virtual void sseenntt__aallllooww__ffaasstt (piece_index_t); │ │ │ │ │ + virtual void sseenntt__hhaavvee__nnoonnee (); │ │ │ │ │ virtual void sseenntt__ssuuggggeesstt (piece_index_t); │ │ │ │ │ virtual void sseenntt__ccaanncceell (peer_request const&); │ │ │ │ │ - virtual void sseenntt__hhaavvee__aallll (); │ │ │ │ │ - virtual void sseenntt__cchhookkee (); │ │ │ │ │ - virtual void sseenntt__hhaavvee__nnoonnee (); │ │ │ │ │ - virtual void sseenntt__aallllooww__ffaasstt (piece_index_t); │ │ │ │ │ virtual void sseenntt__rreejjeecctt__rreeqquueesstt (peer_request const&); │ │ │ │ │ + virtual void sseenntt__rreeqquueesstt (peer_request const&); │ │ │ │ │ + virtual void sseenntt__cchhookkee (); │ │ │ │ │ + virtual void sseenntt__hhaavvee__aallll (); │ │ │ │ │ + virtual void sseenntt__nnoott__iinntteerreesstteedd (); │ │ │ │ │ virtual void sseenntt__uunncchhookkee (); │ │ │ │ │ + virtual void sseenntt__ppiieeccee (peer_request const&); │ │ │ │ │ virtual void sseenntt__hhaavvee (piece_index_t); │ │ │ │ │ - virtual void sseenntt__nnoott__iinntteerreesstteedd (); │ │ │ │ │ virtual void sseenntt__iinntteerreesstteedd (); │ │ │ │ │ - virtual void sseenntt__ppiieeccee (peer_request const&); │ │ │ │ │ virtual void sseenntt__ppaayyllooaadd (int //** bbyytteess **//); │ │ │ │ │ virtual bool ccaann__ddiissccoonnnneecctt (error_code const& //**eecc**//); │ │ │ │ │ virtual bool oonn__eexxtteennddeedd (int //**lleennggtthh**//, int //**mmssgg**//, │ │ │ │ │ span //**bbooddyy**//); │ │ │ │ │ virtual bool oonn__uunnkknnoowwnn__mmeessssaaggee (int //**lleennggtthh**//, int //**mmssgg**//, │ │ │ │ │ span //**bbooddyy**//); │ │ │ │ │ virtual void oonn__ppiieeccee__ppaassss (piece_index_t); │ │ │ │ │ @@ -9817,48 +4901,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__ddoonntt__hhaavvee(()) oonn__hhaavvee__aallll(()) oonn__hhaavvee__nnoonnee(()) oonn__bbiittffiieelldd(()) oonn__aalllloowweedd__ffaasstt │ │ │ │ │ -(()) oonn__uunncchhookkee(()) oonn__rreeqquueesstt(()) oonn__hhaavvee(()) oonn__cchhookkee(()) oonn__nnoott__iinntteerreesstteedd(()) │ │ │ │ │ +********** oonn__rreeqquueesstt(()) oonn__hhaavvee__nnoonnee(()) oonn__hhaavvee__aallll(()) oonn__bbiittffiieelldd(()) oonn__nnoott__iinntteerreesstteedd │ │ │ │ │ +(()) oonn__ddoonntt__hhaavvee(()) oonn__uunncchhookkee(()) oonn__hhaavvee(()) oonn__aalllloowweedd__ffaasstt(()) oonn__cchhookkee(()) │ │ │ │ │ oonn__iinntteerreesstteedd(()) ********** │ │ │ │ │ -virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//); │ │ │ │ │ -virtual bool oonn__hhaavvee__nnoonnee (); │ │ │ │ │ -virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t); │ │ │ │ │ -virtual bool oonn__rreeqquueesstt (peer_request const&); │ │ │ │ │ -virtual bool oonn__uunncchhookkee (); │ │ │ │ │ -virtual bool oonn__hhaavvee (piece_index_t); │ │ │ │ │ -virtual bool oonn__nnoott__iinntteerreesstteedd (); │ │ │ │ │ virtual bool oonn__hhaavvee__aallll (); │ │ │ │ │ -virtual bool oonn__cchhookkee (); │ │ │ │ │ virtual bool oonn__ddoonntt__hhaavvee (piece_index_t); │ │ │ │ │ virtual bool oonn__iinntteerreesstteedd (); │ │ │ │ │ +virtual bool oonn__cchhookkee (); │ │ │ │ │ +virtual bool oonn__nnoott__iinntteerreesstteedd (); │ │ │ │ │ +virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//); │ │ │ │ │ +virtual bool oonn__uunncchhookkee (); │ │ │ │ │ +virtual bool oonn__rreeqquueesstt (peer_request const&); │ │ │ │ │ +virtual bool oonn__hhaavvee (piece_index_t); │ │ │ │ │ +virtual bool oonn__hhaavvee__nnoonnee (); │ │ │ │ │ +virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t); │ │ │ │ │ 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 //**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__hhaavvee(()) sseenntt__nnoott__iinntteerreesstteedd(()) sseenntt__iinntteerreesstteedd(()) sseenntt__uunncchhookkee(()) │ │ │ │ │ +********** sseenntt__iinntteerreesstteedd(()) sseenntt__nnoott__iinntteerreesstteedd(()) sseenntt__hhaavvee(()) sseenntt__uunncchhookkee(()) │ │ │ │ │ sseenntt__ppiieeccee(()) ********** │ │ │ │ │ +virtual void sseenntt__nnoott__iinntteerreesstteedd (); │ │ │ │ │ virtual void sseenntt__uunncchhookkee (); │ │ │ │ │ +virtual void sseenntt__ppiieeccee (peer_request const&); │ │ │ │ │ virtual void sseenntt__hhaavvee (piece_index_t); │ │ │ │ │ -virtual void sseenntt__nnoott__iinntteerreesstteedd (); │ │ │ │ │ virtual void sseenntt__iinntteerreesstteedd (); │ │ │ │ │ -virtual void sseenntt__ppiieeccee (peer_request const&); │ │ │ │ │ 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] │ │ │ │ │ @@ -9881,15 +4965,15 @@ │ │ │ │ │ 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 //**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(()) ********** │ │ │ │ │ +********** 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 (); │ │ │ │ │ @@ -9901,16 +4985,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__iinnccoommiinngg__kkeeyy (span key) = 0; │ │ │ │ │ virtual void sseett__oouuttggooiinngg__kkeeyy (span key) = 0; │ │ │ │ │ + virtual void sseett__iinnccoommiinngg__kkeeyy (span key) = 0; │ │ │ │ │ eennccrryypptt (span> //**sseenndd__vveecc**//) = 0; │ │ │ │ │ virtual std::tuple ddeeccrryypptt (span> //**rreecceeiivvee__vveecc**// │ │ │ │ │ ) = 0; │ │ │ │ │ }; │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ ********** ddeeccrryypptt(()) ********** │ │ │ │ │ virtual std::tuple ddeeccrryypptt (span> //**rreecceeiivvee__vveecc**//) = │ │ │ │ │ @@ -9937,62 +5021,73 @@ │ │ │ │ │ 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; │ │ │ │ │ + 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; │ │ │ │ │ - bool iiss__ddiissccoonnnneeccttiinngg () const; │ │ │ │ │ - bool iiss__ccoonnnneeccttiinngg () 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 iiggnnoorree__uunncchhookkee__sslloottss () const; │ │ │ │ │ + bool iiss__ccoonnnneeccttiinngg () const; │ │ │ │ │ + bool iiss__ddiissccoonnnneeccttiinngg () const; │ │ │ │ │ + bool iiss__oouuttggooiinngg () const; │ │ │ │ │ bool oonn__llooccaall__nneettwwoorrkk () const; │ │ │ │ │ + bool iiggnnoorree__uunncchhookkee__sslloottss () 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 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); │ │ │ │ │ - time_point ttiimmee__ooff__llaasstt__uunncchhookkee () const; │ │ │ │ │ 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; │ │ │ │ │ - bool ooppeerraattoorr!!== (peer_connection_handle const& o) const; │ │ │ │ │ std::shared_ptr 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 ppaacckkeett__ffiinniisshheedd () const; │ │ │ │ │ bool ssuuppppoorrtt__eexxtteennssiioonnss () const; │ │ │ │ │ + bool ppaacckkeett__ffiinniisshheedd () const; │ │ │ │ │ bool ssuuppppoorrttss__eennccrryyppttiioonn () const; │ │ │ │ │ void sswwiittcchh__rreeccvv__ccrryyppttoo (std::shared_ptr crypto); │ │ │ │ │ void sswwiittcchh__sseenndd__ccrryyppttoo (std::shared_ptr crypto); │ │ │ │ │ std::shared_ptr nnaattiivvee__hhaannddllee () const; │ │ │ │ │ }; │ │ │ │ │ [_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 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__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 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 │ │ │ │ │ @@ -10007,372 +5102,1116 @@ │ │ │ │ │ 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 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] │ │ │ │ │ -************ 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 │ │ │ │ │ +************ 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 │ │ │ │ │ { │ │ │ │ │ - iipp__ffiilltteerr (ip_filter&&); │ │ │ │ │ - iipp__ffiilltteerr (); │ │ │ │ │ - iipp__ffiilltteerr (ip_filter const&); │ │ │ │ │ - ip_filter& ooppeerraattoorr== (ip_filter const&); │ │ │ │ │ - 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; │ │ │ │ │ + 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 access_flags │ │ │ │ │ + enum socket_type_t │ │ │ │ │ { │ │ │ │ │ - blocked, │ │ │ │ │ + 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] │ │ │ │ │ +********** ddiissaallllooww(()) aallllooww(()) ********** │ │ │ │ │ +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] │ │ │ │ │ +************ 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] │ │ │ │ │ +************ 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 (char const* b, int bits); │ │ │ │ │ + bbiittffiieelldd (bitfield&& rhs) noexcept = default; │ │ │ │ │ + bbiittffiieelldd (bitfield const& rhs); │ │ │ │ │ + bbiittffiieelldd () noexcept = default; │ │ │ │ │ + bbiittffiieelldd (int bits, bool val); │ │ │ │ │ + explicit bbiittffiieelldd (int bits); │ │ │ │ │ + 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 const* ddaattaa () const noexcept; │ │ │ │ │ + char* ddaattaa () 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 (char const* b, int bits); │ │ │ │ │ +bbiittffiieelldd (bitfield&& rhs) noexcept = default; │ │ │ │ │ +bbiittffiieelldd (bitfield const& rhs); │ │ │ │ │ +bbiittffiieelldd () noexcept = default; │ │ │ │ │ +bbiittffiieelldd (int bits, bool val); │ │ │ │ │ +explicit bbiittffiieelldd (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; │ │ │ │ │ +query bit at index. Returns true if bit is 1, otherwise false. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** 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; │ │ │ │ │ -returns true if the filter does not contain any rules │ │ │ │ │ +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] │ │ │ │ │ -********** 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. │ │ │ │ │ +********** ddaattaa(()) ********** │ │ │ │ │ +char const* ddaattaa () const noexcept; │ │ │ │ │ +char* ddaattaa () 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] │ │ │ │ │ -********** 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. │ │ │ │ │ +********** 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] │ │ │ │ │ -********** 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. │ │ │ │ │ +********** 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] │ │ │ │ │ -********** 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_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +********** 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] │ │ │ │ │ -************ 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 │ │ │ │ │ +********** 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] │ │ │ │ │ +************ 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 │ │ │ │ │ { │ │ │ │ │ - port_filter& ooppeerraattoorr== (port_filter const&); │ │ │ │ │ - ppoorrtt__ffiilltteerr (); │ │ │ │ │ - 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, │ │ │ │ │ - }; │ │ │ │ │ + hhaasshheerr (); │ │ │ │ │ + hhaasshheerr (hasher const&); │ │ │ │ │ + hhaasshheerr (char const* data, int len); │ │ │ │ │ + explicit hhaasshheerr (span data); │ │ │ │ │ + hasher& ooppeerraattoorr== (hasher const&) &; │ │ │ │ │ + hasher& uuppddaattee (span data); │ │ │ │ │ + hasher& uuppddaattee (char const* data, int len); │ │ │ │ │ + sha1_hash ffiinnaall (); │ │ │ │ │ + void rreesseett (); │ │ │ │ │ }; │ │ │ │ │ [_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. │ │ │ │ │ +********** hhaasshheerr(()) ooppeerraattoorr==(()) ********** │ │ │ │ │ +hhaasshheerr (hasher const&); │ │ │ │ │ +hhaasshheerr (char const* data, int len); │ │ │ │ │ +explicit hhaasshheerr (span data); │ │ │ │ │ +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] │ │ │ │ │ -********** 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. │ │ │ │ │ +********** uuppddaattee(()) ********** │ │ │ │ │ +hasher& uuppddaattee (span 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] │ │ │ │ │ -********** 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_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +********** 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] │ │ │ │ │ -************ 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 │ │ │ │ │ +********** 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 │ │ │ │ │ { │ │ │ │ │ - bbddeeccooddee__nnooddee () = default; │ │ │ │ │ - bdecode_node& ooppeerraattoorr== (bdecode_node const&) &; │ │ │ │ │ - bbddeeccooddee__nnooddee (bdecode_node&&) noexcept; │ │ │ │ │ - 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 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; │ │ │ │ │ - int lliisstt__ssiizzee () const; │ │ │ │ │ - bdecode_node lliisstt__aatt (int i) const; │ │ │ │ │ - std::int64_t ddiicctt__ffiinndd__iinntt__vvaalluuee (string_view key │ │ │ │ │ - , std::int64_t default_val = 0) const; │ │ │ │ │ - std::pair ddiicctt__aatt__nnooddee (int i) const; │ │ │ │ │ - bdecode_node ddiicctt__ffiinndd__lliisstt (string_view key) const; │ │ │ │ │ - bdecode_node ddiicctt__ffiinndd__ssttrriinngg (string_view key) const; │ │ │ │ │ - bdecode_node ddiicctt__ffiinndd (string_view key) const; │ │ │ │ │ - int ddiicctt__ssiizzee () const; │ │ │ │ │ - std::pair ddiicctt__aatt (int i) const; │ │ │ │ │ - bdecode_node ddiicctt__ffiinndd__ddiicctt (string_view key) 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; │ │ │ │ │ - std::int64_t iinntt__vvaalluuee () const; │ │ │ │ │ - string_view ssttrriinngg__vvaalluuee () const; │ │ │ │ │ - std::ptrdiff_t ssttrriinngg__ooffffsseett () const; │ │ │ │ │ - char const* ssttrriinngg__ppttrr () 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 error) const; │ │ │ │ │ + hhaasshheerr225566 (); │ │ │ │ │ + hhaasshheerr225566 (hasher256 const&); │ │ │ │ │ + hasher256& ooppeerraattoorr== (hasher256 const&) &; │ │ │ │ │ + explicit hhaasshheerr225566 (span data); │ │ │ │ │ + hhaasshheerr225566 (char const* data, int len); │ │ │ │ │ + hasher256& uuppddaattee (char const* data, int len); │ │ │ │ │ + hasher256& uuppddaattee (span data); │ │ │ │ │ + sha256_hash ffiinnaall (); │ │ │ │ │ + void rreesseett (); │ │ │ │ │ + ~~hhaasshheerr225566 (); │ │ │ │ │ +}; │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** ooppeerraattoorr==(()) hhaasshheerr225566(()) ********** │ │ │ │ │ +hhaasshheerr225566 (hasher256 const&); │ │ │ │ │ +hasher256& ooppeerraattoorr== (hasher256 const&) &; │ │ │ │ │ +explicit hhaasshheerr225566 (span data); │ │ │ │ │ +hhaasshheerr225566 (char const* data, int len); │ │ │ │ │ +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 data); │ │ │ │ │ +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] │ │ │ │ │ +************ 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 │ │ │ │ │ { │ │ │ │ │ - none_t, │ │ │ │ │ - dict_t, │ │ │ │ │ - list_t, │ │ │ │ │ - string_t, │ │ │ │ │ - int_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] │ │ │ │ │ -********** bbddeeccooddee__nnooddee(()) ********** │ │ │ │ │ -bbddeeccooddee__nnooddee () = default; │ │ │ │ │ -creates a default constructed node, it will have the type none_t. │ │ │ │ │ +********** ooppeerraattoorr====(()) ********** │ │ │ │ │ +bool ooppeerraattoorr==== (web_seed_entry const& e) const; │ │ │ │ │ +URL and type comparison │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** bbddeeccooddee__nnooddee(()) ooppeerraattoorr==(()) ********** │ │ │ │ │ -bdecode_node& ooppeerraattoorr== (bdecode_node const&) &; │ │ │ │ │ -bbddeeccooddee__nnooddee (bdecode_node&&) noexcept; │ │ │ │ │ -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. │ │ │ │ │ +********** 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] │ │ │ │ │ -********** ttyyppee(()) ********** │ │ │ │ │ -type_t ttyyppee () const noexcept; │ │ │ │ │ -the type of this node. See _t_y_p_e___t. │ │ │ │ │ +********** 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] │ │ │ │ │ -********** bbooooll(()) ********** │ │ │ │ │ -explicit operator bbooooll () const noexcept; │ │ │ │ │ -returns true if _t_y_p_e_(_) != none_t. │ │ │ │ │ + url │ │ │ │ │ + The URL of the web seed │ │ │ │ │ [_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. │ │ │ │ │ + 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] │ │ │ │ │ -********** ddaattaa__sseeccttiioonn(()) ddaattaa__ooffffsseett(()) ********** │ │ │ │ │ -std::ptrdiff_t ddaattaa__ooffffsseett () const noexcept; │ │ │ │ │ -span 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. │ │ │ │ │ + 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] │ │ │ │ │ -********** lliisstt__ssiizzee(()) lliisstt__ssttrriinngg__vvaalluuee__aatt(()) lliisstt__aatt(()) lliisstt__iinntt__vvaalluuee__aatt(()) ********** │ │ │ │ │ -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; │ │ │ │ │ -int lliisstt__ssiizzee () 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. │ │ │ │ │ + type │ │ │ │ │ + The type of web seed (see _t_y_p_e___t) │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ddiicctt__aatt(()) ddiicctt__ffiinndd__ssttrriinngg__vvaalluuee(()) ddiicctt__ssiizzee(()) ddiicctt__ffiinndd(()) ddiicctt__aatt__nnooddee(()) │ │ │ │ │ -ddiicctt__ffiinndd__ssttrriinngg(()) ddiicctt__ffiinndd__ddiicctt(()) ddiicctt__ffiinndd__iinntt(()) ddiicctt__ffiinndd__iinntt__vvaalluuee(()) │ │ │ │ │ -ddiicctt__ffiinndd__lliisstt(()) ********** │ │ │ │ │ -std::int64_t ddiicctt__ffiinndd__iinntt__vvaalluuee (string_view key │ │ │ │ │ - , std::int64_t default_val = 0) const; │ │ │ │ │ -std::pair ddiicctt__aatt__nnooddee (int i) const; │ │ │ │ │ -bdecode_node ddiicctt__ffiinndd__lliisstt (string_view key) const; │ │ │ │ │ -bdecode_node ddiicctt__ffiinndd__ssttrriinngg (string_view key) const; │ │ │ │ │ -bdecode_node ddiicctt__ffiinndd (string_view key) const; │ │ │ │ │ -int ddiicctt__ssiizzee () const; │ │ │ │ │ -std::pair ddiicctt__aatt (int i) const; │ │ │ │ │ -bdecode_node ddiicctt__ffiinndd__ddiicctt (string_view key) 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; │ │ │ │ │ -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). │ │ │ │ │ +************ 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] │ │ │ │ │ -********** iinntt__vvaalluuee(()) ********** │ │ │ │ │ -std::int64_t iinntt__vvaalluuee () const; │ │ │ │ │ -this function is only valid if type() == int_t. It returns the value of the │ │ │ │ │ -integer. │ │ │ │ │ + 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] │ │ │ │ │ -********** ssttrriinngg__vvaalluuee(()) ssttrriinngg__lleennggtthh(()) ssttrriinngg__ooffffsseett(()) ssttrriinngg__ppttrr(()) ********** │ │ │ │ │ -string_view ssttrriinngg__vvaalluuee () const; │ │ │ │ │ -std::ptrdiff_t ssttrriinngg__ooffffsseett () const; │ │ │ │ │ -char const* ssttrriinngg__ppttrr () 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. │ │ │ │ │ + max_pieces │ │ │ │ │ + the max number of pieces allowed in the torrent │ │ │ │ │ [_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. │ │ │ │ │ + max_decode_depth │ │ │ │ │ + the max recursion depth in the bdecoded structure │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** sswwaapp(()) ********** │ │ │ │ │ -void sswwaapp (bdecode_node& n); │ │ │ │ │ -Swap contents. │ │ │ │ │ + max_decode_tokens │ │ │ │ │ + the max number of bdecode tokens │ │ │ │ │ [_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_(_). │ │ │ │ │ +************ 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 (std::string const& filename, error_code& ec); │ │ │ │ │ + ttoorrrreenntt__iinnffoo (span buffer, error_code& ec, from_span_t); │ │ │ │ │ + ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, error_code& ec); │ │ │ │ │ + explicit ttoorrrreenntt__iinnffoo (std::string const& filename); │ │ │ │ │ + explicit ttoorrrreenntt__iinnffoo (span buffer, from_span_t); │ │ │ │ │ + ttoorrrreenntt__iinnffoo (char const* buffer, int size); │ │ │ │ │ + ttoorrrreenntt__iinnffoo (torrent_info const& t); │ │ │ │ │ + explicit ttoorrrreenntt__iinnffoo (info_hash_t const& info_hash); │ │ │ │ │ + ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec); │ │ │ │ │ + ttoorrrreenntt__iinnffoo (span buffer, load_torrent_limits const& cfg, │ │ │ │ │ +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); │ │ │ │ │ + explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file); │ │ │ │ │ + ~~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); │ │ │ │ │ + std::vector const& ttrraacckkeerrss () const; │ │ │ │ │ + void aadddd__ttrraacckkeerr (std::string const& url, int tier = 0); │ │ │ │ │ + void cclleeaarr__ttrraacckkeerrss (); │ │ │ │ │ + std::vector ssiimmiillaarr__ttoorrrreennttss () const; │ │ │ │ │ + std::vector ccoolllleeccttiioonnss () const; │ │ │ │ │ + std::vector 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()); │ │ │ │ │ + void sseett__wweebb__sseeeeddss (std::vector 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::int64_t ttoottaall__ssiizzee () const; │ │ │ │ │ + int ppiieeccee__lleennggtthh () const; │ │ │ │ │ + int nnuumm__ppiieecceess () const; │ │ │ │ │ + int bblloocckkss__ppeerr__ppiieeccee () const; │ │ │ │ │ + piece_index_t llaasstt__ppiieeccee () const; │ │ │ │ │ + index_range ppiieeccee__rraannggee () const; │ │ │ │ │ + piece_index_t eenndd__ppiieeccee () const; │ │ │ │ │ + info_hash_t const& iinnffoo__hhaasshheess () const; │ │ │ │ │ + sha1_hash iinnffoo__hhaasshh () const noexcept; │ │ │ │ │ + bool vv22 () const; │ │ │ │ │ + bool vv11 () const; │ │ │ │ │ + int nnuumm__ffiilleess () const; │ │ │ │ │ + std::vector 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> const& nnooddeess () const; │ │ │ │ │ + void aadddd__nnooddee (std::pair const& node); │ │ │ │ │ + bool ppaarrssee__iinnffoo__sseeccttiioonn (bdecode_node const& info, error_code& ec, int │ │ │ │ │ +max_pieces); │ │ │ │ │ + bdecode_node iinnffoo (char const* key) const; │ │ │ │ │ + span iinnffoo__sseeccttiioonn () const; │ │ │ │ │ + span ppiieeccee__llaayyeerr (file_index_t) const; │ │ │ │ │ + void ffrreeee__ppiieeccee__llaayyeerrss (); │ │ │ │ │ +}; │ │ │ │ │ [_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(). │ │ │ │ │ +********** ttoorrrreenntt__iinnffoo(()) ********** │ │ │ │ │ +ttoorrrreenntt__iinnffoo (std::string const& filename, error_code& ec); │ │ │ │ │ +ttoorrrreenntt__iinnffoo (span buffer, error_code& ec, from_span_t); │ │ │ │ │ +ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file, error_code& ec); │ │ │ │ │ +explicit ttoorrrreenntt__iinnffoo (std::string const& filename); │ │ │ │ │ +explicit ttoorrrreenntt__iinnffoo (span buffer, from_span_t); │ │ │ │ │ +ttoorrrreenntt__iinnffoo (char const* buffer, int size); │ │ │ │ │ +ttoorrrreenntt__iinnffoo (torrent_info const& t); │ │ │ │ │ +explicit ttoorrrreenntt__iinnffoo (info_hash_t const& info_hash); │ │ │ │ │ +ttoorrrreenntt__iinnffoo (char const* buffer, int size, error_code& ec); │ │ │ │ │ +ttoorrrreenntt__iinnffoo (span buffer, load_torrent_limits const& cfg, │ │ │ │ │ +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); │ │ │ │ │ +explicit ttoorrrreenntt__iinnffoo (bdecode_node const& torrent_file); │ │ │ │ │ +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] │ │ │ │ │ -********** hhaass__ssoofftt__eerrrroorr(()) ********** │ │ │ │ │ -bool hhaass__ssoofftt__eerrrroorr (span error) const; │ │ │ │ │ -returns true if there is a non-fatal error in the bencoding of this node or its │ │ │ │ │ -children │ │ │ │ │ +********** ~~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] │ │ │ │ │ -********** 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_._ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +********** 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] │ │ │ │ │ -************ 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. │ │ │ │ │ +********** 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] │ │ │ │ │ -************ 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 buffer │ │ │ │ │ - , int depth_limit = 100, int token_limit = 2000000); │ │ │ │ │ -bdecode_node bbddeeccooddee (span 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. │ │ │ │ │ +********** 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] │ │ │ │ │ -************ 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 │ │ │ │ │ +********** ttrraacckkeerrss(()) cclleeaarr__ttrraacckkeerrss(()) aadddd__ttrraacckkeerr(()) ********** │ │ │ │ │ +void aadddd__ttrraacckkeerr (std::string const& url, int tier │ │ │ │ │ + , announce_entry::tracker_source source); │ │ │ │ │ +std::vector const& ttrraacckkeerrss () const; │ │ │ │ │ +void aadddd__ttrraacckkeerr (std::string const& url, int tier = 0); │ │ │ │ │ +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] │ │ │ │ │ +********** ssiimmiillaarr__ttoorrrreennttss(()) ccoolllleeccttiioonnss(()) ********** │ │ │ │ │ +std::vector ssiimmiillaarr__ttoorrrreennttss () const; │ │ │ │ │ +std::vector 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(()) aadddd__uurrll__sseeeedd(()) wweebb__sseeeeddss(()) sseett__wweebb__sseeeeddss(()) ********** │ │ │ │ │ +std::vector 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()); │ │ │ │ │ +void sseett__wweebb__sseeeeddss (std::vector 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()); │ │ │ │ │ +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; │ │ │ │ │ +index_range ppiieeccee__rraannggee () 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__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 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 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> 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 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 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 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] │ │ │ │ │ +************ 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 │ │ │ │ │ { │ │ │ │ │ - ssttoorraaggee__ppaarraammss (file_storage const& f, file_storage const* mf │ │ │ │ │ - , std::string const& sp, storage_mode_t const sm │ │ │ │ │ - , aux::vector const& prio │ │ │ │ │ - , sha1_hash const& ih); │ │ │ │ │ + std::string message; │ │ │ │ │ + error_code last_error; │ │ │ │ │ + int ssccrraappee__iinnccoommpplleettee = -1; │ │ │ │ │ + int ssccrraappee__ccoommpplleettee = -1; │ │ │ │ │ + int ssccrraappee__ddoowwnnllooaaddeedd = -1; │ │ │ │ │ + std::uint8_t fails : 7; │ │ │ │ │ + bool updating : 1; │ │ │ │ │ + bool start_sent : 1; │ │ │ │ │ + bool complete_sent : 1; │ │ │ │ │ +}; │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + message │ │ │ │ │ + if this tracker has returned an error or warning message that message is │ │ │ │ │ + stored here │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + last_error │ │ │ │ │ + if this tracker failed the last time it was contacted this error code │ │ │ │ │ + specifies what error occurred │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + scrape_incomplete scrape_complete scrape_downloaded │ │ │ │ │ + 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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + fails │ │ │ │ │ + the number of times in a row we have failed to announce to this tracker. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + updating │ │ │ │ │ + true while we're waiting for a response from the tracker. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + start_sent │ │ │ │ │ + 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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + complete_sent │ │ │ │ │ + set to true when we send a event=completed. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +************ aannnnoouunnccee__eennddppooiinntt ************ │ │ │ │ │ +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" │ │ │ │ │ +announces are sent to each tracker using every listen socket this class holds │ │ │ │ │ +information about one listen socket for one tracker │ │ │ │ │ +struct announce_endpoint │ │ │ │ │ +{ │ │ │ │ │ + aannnnoouunnccee__eennddppooiinntt (); │ │ │ │ │ │ │ │ │ │ - file_storage const& files; │ │ │ │ │ - file_storage const* mmaappppeedd__ffiilleess = nullptr; │ │ │ │ │ - std::string const& path; │ │ │ │ │ - storage_mode_t mmooddee {storage_mode_sparse}; │ │ │ │ │ - aux::vector const& priorities; │ │ │ │ │ - sha1_hash info_hash; │ │ │ │ │ + _t_c_p_:_:_e_n_d_p_o_i_n_t local_endpoint; │ │ │ │ │ + aux::array info_hashes; │ │ │ │ │ + bool eennaabblleedd = true; │ │ │ │ │ +}; │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + local_endpoint │ │ │ │ │ + the local endpoint of the listen interface associated with this endpoint │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + info_hashes │ │ │ │ │ + info_hashes[0] is the v1 info hash (SHA1) info_hashes[1] is the v2 info │ │ │ │ │ + hash (truncated SHA-256) │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + enabled │ │ │ │ │ + set to false to not announce from this endpoint │ │ │ │ │ +[_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 │ │ │ │ │ +{ │ │ │ │ │ + explicit aannnnoouunnccee__eennttrryy (string_view u); │ │ │ │ │ + aannnnoouunnccee__eennttrryy (); │ │ │ │ │ + aannnnoouunnccee__eennttrryy (announce_entry const&); │ │ │ │ │ + ~~aannnnoouunnccee__eennttrryy (); │ │ │ │ │ + announce_entry& ooppeerraattoorr== (announce_entry const&) &; │ │ │ │ │ + │ │ │ │ │ + enum tracker_source │ │ │ │ │ + { │ │ │ │ │ + source_torrent, │ │ │ │ │ + source_client, │ │ │ │ │ + source_magnet_link, │ │ │ │ │ + source_tex, │ │ │ │ │ + }; │ │ │ │ │ + │ │ │ │ │ + std::string url; │ │ │ │ │ + std::string trackerid; │ │ │ │ │ + std::vector 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(()) ********** │ │ │ │ │ +explicit aannnnoouunnccee__eennttrryy (string_view u); │ │ │ │ │ +aannnnoouunnccee__eennttrryy (); │ │ │ │ │ +aannnnoouunnccee__eennttrryy (announce_entry const&); │ │ │ │ │ +~~aannnnoouunnccee__eennttrryy (); │ │ │ │ │ +announce_entry& ooppeerraattoorr== (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_ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|source_client |2 |the tracker was added programmatically via the | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_d_d___t_r_a_c_k_e_r_(_)_ _f_u_n_c_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_s_o_u_r_c_e___m_a_g_n_e_t___l_i_n_k_|_4_ _ _ _ _|_t_h_e_ _t_r_a_c_k_e_r_ _w_a_s_ _p_a_r_t_ _o_f_ _a_ _m_a_g_n_e_t_ _l_i_n_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|source_tex |8 |the tracker was received from the swarm via tracker| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_x_c_h_a_n_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + url │ │ │ │ │ + tracker URL as it appeared in the torrent file │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + trackerid │ │ │ │ │ + the current &trackerid= argument passed to the tracker. this is optional │ │ │ │ │ + and is normally empty (in which case no trackerid is sent). │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + endpoints │ │ │ │ │ + each local listen socket (endpoint) will announce to the tracker. This │ │ │ │ │ + list contains state per endpoint. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + tier │ │ │ │ │ + the tier this tracker belongs to │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + fail_limit │ │ │ │ │ + the max number of failures to announce to this tracker in a row, before │ │ │ │ │ + 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. │ │ │ │ │ +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 (preformatted_type); │ │ │ │ │ + eennttrryy (list_type); │ │ │ │ │ + eennttrryy (span); │ │ │ │ │ + eennttrryy (dictionary_type); │ │ │ │ │ + eennttrryy (integer_type); │ │ │ │ │ + eennttrryy (U v); │ │ │ │ │ + eennttrryy (data_type t); │ │ │ │ │ + eennttrryy (bdecode_node const& n); │ │ │ │ │ + entry& ooppeerraattoorr== (bdecode_node const&) &; │ │ │ │ │ + entry& ooppeerraattoorr== (span) &; │ │ │ │ │ + entry& ooppeerraattoorr== (integer_type) &; │ │ │ │ │ + entry& ooppeerraattoorr== (preformatted_type) &; │ │ │ │ │ + entry& ooppeerraattoorr== (entry&&) & noexcept; │ │ │ │ │ + entry& ooppeerraattoorr== (dictionary_type) &; │ │ │ │ │ + entry& ooppeerraattoorr== (entry const&) &; │ │ │ │ │ + entry& ooppeerraattoorr== (list_type) &; │ │ │ │ │ + entry& ooppeerraattoorr== (U v) &; │ │ │ │ │ + preformatted_type& pprreeffoorrmmaatttteedd (); │ │ │ │ │ + preformatted_type const& pprreeffoorrmmaatttteedd () const; │ │ │ │ │ + string_type& ssttrriinngg (); │ │ │ │ │ + dictionary_type& ddiicctt (); │ │ │ │ │ + string_type const& ssttrriinngg () const; │ │ │ │ │ + integer_type& iinntteeggeerr (); │ │ │ │ │ + dictionary_type const& ddiicctt () const; │ │ │ │ │ + integer_type const& iinntteeggeerr () const; │ │ │ │ │ + list_type const& lliisstt () const; │ │ │ │ │ + list_type& lliisstt (); │ │ │ │ │ + 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; │ │ │ │ │ + │ │ │ │ │ + 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 (preformatted_type); │ │ │ │ │ +eennttrryy (list_type); │ │ │ │ │ +eennttrryy (span); │ │ │ │ │ +eennttrryy (dictionary_type); │ │ │ │ │ +eennttrryy (integer_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== (bdecode_node const&) &; │ │ │ │ │ +entry& ooppeerraattoorr== (span) &; │ │ │ │ │ +entry& ooppeerraattoorr== (integer_type) &; │ │ │ │ │ +entry& ooppeerraattoorr== (preformatted_type) &; │ │ │ │ │ +entry& ooppeerraattoorr== (entry&&) & noexcept; │ │ │ │ │ +entry& ooppeerraattoorr== (dictionary_type) &; │ │ │ │ │ +entry& ooppeerraattoorr== (entry const&) &; │ │ │ │ │ +entry& ooppeerraattoorr== (list_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] │ │ │ │ │ +********** iinntteeggeerr(()) pprreeffoorrmmaatttteedd(()) ssttrriinngg(()) lliisstt(()) ddiicctt(()) ********** │ │ │ │ │ +preformatted_type& pprreeffoorrmmaatttteedd (); │ │ │ │ │ +preformatted_type const& pprreeffoorrmmaatttteedd () const; │ │ │ │ │ +string_type& ssttrriinngg (); │ │ │ │ │ +dictionary_type& ddiicctt (); │ │ │ │ │ +string_type const& ssttrriinngg () const; │ │ │ │ │ +integer_type& iinntteeggeerr (); │ │ │ │ │ +dictionary_type const& ddiicctt () const; │ │ │ │ │ +integer_type const& iinntteeggeerr () const; │ │ │ │ │ +list_type const& lliisstt () const; │ │ │ │ │ +list_type& lliisstt (); │ │ │ │ │ +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 const* ffiinndd__kkeeyy (string_view key) const; │ │ │ │ │ +entry* ffiinndd__kkeeyy (string_view key); │ │ │ │ │ +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] │ │ │ │ │ +************ 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] │ │ │ │ │ +************ bbeennccooddee(()) ************ │ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_b_e_n_c_o_d_e_._h_p_p" │ │ │ │ │ +template 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 buf; │ │ │ │ │ +bencode(std::back_inserter(buf), e); │ │ │ │ │ +[_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 │ │ │ │ │ @@ -10397,24 +6236,24 @@ │ │ │ │ │ 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 (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__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 (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 (error_code& ec, string_view filename │ │ │ │ │ , std::string const& path, std::int64_t file_size │ │ │ │ │ , file_flags_t file_flags = {}, char const* filehash = nullptr │ │ │ │ │ @@ -10425,45 +6264,45 @@ │ │ │ │ │ , 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 ffiillee__rraannggee () const noexcept; │ │ │ │ │ std::int64_t ttoottaall__ssiizzee () const; │ │ │ │ │ - int nnuumm__ppiieecceess () const; │ │ │ │ │ void sseett__nnuumm__ppiieecceess (int n); │ │ │ │ │ + int nnuumm__ppiieecceess () const; │ │ │ │ │ piece_index_t eenndd__ppiieeccee () const; │ │ │ │ │ piece_index_t llaasstt__ppiieeccee () const; │ │ │ │ │ index_range ppiieeccee__rraannggee () const noexcept; │ │ │ │ │ - int ppiieeccee__lleennggtthh () const; │ │ │ │ │ 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; │ │ │ │ │ - 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 (); │ │ │ │ │ sha1_hash hhaasshh (file_index_t index) const; │ │ │ │ │ - std::int64_t ffiillee__ssiizzee (file_index_t index) const; │ │ │ │ │ - std::string ffiillee__ppaatthh (file_index_t index, std::string const& save_path = │ │ │ │ │ -"") const; │ │ │ │ │ bool ppaadd__ffiillee__aatt (file_index_t index) const; │ │ │ │ │ + string_view ffiillee__nnaammee (file_index_t index) const; │ │ │ │ │ std::int64_t ffiillee__ooffffsseett (file_index_t index) const; │ │ │ │ │ std::time_t mmttiimmee (file_index_t index) const; │ │ │ │ │ std::string ssyymmlliinnkk (file_index_t index) const; │ │ │ │ │ + std::string ffiillee__ppaatthh (file_index_t index, std::string const& save_path = │ │ │ │ │ +"") const; │ │ │ │ │ + std::int64_t ffiillee__ssiizzee (file_index_t index) const; │ │ │ │ │ char const* rroooott__ppttrr (file_index_t const index) const; │ │ │ │ │ sha256_hash rroooott (file_index_t index) const; │ │ │ │ │ - string_view ffiillee__nnaammee (file_index_t index) const; │ │ │ │ │ - int ffiillee__nnuumm__ppiieecceess (file_index_t index) const; │ │ │ │ │ index_range 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; │ │ │ │ │ + int ffiillee__ffiirrsstt__bblloocckk__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& 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__ppiieeccee (piece_index_t piece) const; │ │ │ │ │ file_index_t ffiillee__iinnddeexx__aatt__ooffffsseett (std::int64_t offset) const; │ │ │ │ │ @@ -10487,23 +6326,23 @@ │ │ │ │ │ ********** 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 (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__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 (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 (error_code& ec, string_view filename │ │ │ │ │ , std::string const& path, std::int64_t file_size │ │ │ │ │ , file_flags_t file_flags = {}, char const* filehash = nullptr │ │ │ │ │ @@ -10581,17 +6420,17 @@ │ │ │ │ │ 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] │ │ │ │ │ -********** nnuumm__ppiieecceess(()) sseett__nnuumm__ppiieecceess(()) ********** │ │ │ │ │ -int nnuumm__ppiieecceess () const; │ │ │ │ │ +********** sseett__nnuumm__ppiieecceess(()) nnuumm__ppiieecceess(()) ********** │ │ │ │ │ void sseett__nnuumm__ppiieecceess (int n); │ │ │ │ │ +int nnuumm__ppiieecceess () const; │ │ │ │ │ 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(()) ********** │ │ │ │ │ @@ -10603,16 +6442,16 @@ │ │ │ │ │ ********** ppiieeccee__rraannggee(()) ********** │ │ │ │ │ index_range 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(()) ********** │ │ │ │ │ -int ppiieeccee__lleennggtthh () const; │ │ │ │ │ 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. │ │ │ │ │ @@ -10630,40 +6469,40 @@ │ │ │ │ │ [_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(()) ********** │ │ │ │ │ -void sseett__nnaammee (std::string const& n); │ │ │ │ │ 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] │ │ │ │ │ -********** ssyymmlliinnkk(()) hhaasshh(()) ffiillee__ppaatthh(()) mmttiimmee(()) ffiillee__nnaammee(()) ffiillee__ssiizzee(()) ffiillee__ooffffsseett │ │ │ │ │ -(()) ppaadd__ffiillee__aatt(()) rroooott__ppttrr(()) rroooott(()) ********** │ │ │ │ │ +********** ffiillee__ssiizzee(()) rroooott__ppttrr(()) mmttiimmee(()) ffiillee__nnaammee(()) rroooott(()) ffiillee__ooffffsseett(()) ffiillee__ppaatthh │ │ │ │ │ +(()) ppaadd__ffiillee__aatt(()) ssyymmlliinnkk(()) hhaasshh(()) ********** │ │ │ │ │ sha1_hash hhaasshh (file_index_t index) const; │ │ │ │ │ -std::int64_t ffiillee__ssiizzee (file_index_t index) const; │ │ │ │ │ -std::string ffiillee__ppaatthh (file_index_t index, std::string const& save_path = "") │ │ │ │ │ -const; │ │ │ │ │ bool ppaadd__ffiillee__aatt (file_index_t index) const; │ │ │ │ │ +string_view ffiillee__nnaammee (file_index_t index) const; │ │ │ │ │ std::int64_t ffiillee__ooffffsseett (file_index_t index) const; │ │ │ │ │ std::time_t mmttiimmee (file_index_t index) const; │ │ │ │ │ std::string ssyymmlliinnkk (file_index_t index) const; │ │ │ │ │ +std::string ffiillee__ppaatthh (file_index_t index, std::string const& save_path = "") │ │ │ │ │ +const; │ │ │ │ │ +std::int64_t ffiillee__ssiizzee (file_index_t index) const; │ │ │ │ │ char const* rroooott__ppttrr (file_index_t const index) const; │ │ │ │ │ sha256_hash rroooott (file_index_t index) const; │ │ │ │ │ -string_view ffiillee__nnaammee (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 │ │ │ │ │ @@ -10677,25 +6516,25 @@ │ │ │ │ │ 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(()) ********** │ │ │ │ │ -int ffiillee__nnuumm__ppiieecceess (file_index_t index) const; │ │ │ │ │ index_range 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. │ │ │ │ │ [_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; │ │ │ │ │ +int ffiillee__ffiirrsstt__bblloocckk__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] │ │ │ │ │ @@ -10712,15 +6551,15 @@ │ │ │ │ │ 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__ooffffsseett(()) ffiillee__iinnddeexx__aatt__ppiieeccee(()) ********** │ │ │ │ │ +********** ffiillee__iinnddeexx__aatt__ppiieeccee(()) ffiillee__iinnddeexx__aatt__ooffffsseett(()) ********** │ │ │ │ │ file_index_t ffiillee__iinnddeexx__aatt__ppiieeccee (piece_index_t piece) const; │ │ │ │ │ file_index_t ffiillee__iinnddeexx__aatt__ooffffsseett (std::int64_t offset) 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 │ │ │ │ │ @@ -10751,35 +6590,54 @@ │ │ │ │ │ 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] │ │ │ │ │ -************ 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 ddeeffaauulltt__ddiisskk__iioo__ccoonnssttrruuccttoorr ( │ │ │ │ │ +************ 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 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 const& priorities; │ │ │ │ │ + sha1_hash info_hash; │ │ │ │ │ +}; │ │ │ │ │ +[_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 mmmmaapp__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. │ │ │ │ │ +constructs a memory mapped file disk I/O object. │ │ │ │ │ [_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 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] │ │ │ │ │ -************ 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 mmmmaapp__ddiisskk__iioo__ccoonnssttrruuccttoorr ( │ │ │ │ │ +************ 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 ddeeffaauulltt__ddiisskk__iioo__ccoonnssttrruuccttoorr ( │ │ │ │ │ io_context& ios, settings_interface const&, counters& cnt); │ │ │ │ │ -constructs a memory mapped file disk I/O object. │ │ │ │ │ +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 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. │ │ │ │ │ @@ -10831,152 +6689,2238 @@ │ │ │ │ │ |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_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_ | │ │ │ │ │ [_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 │ │ │ │ │ +************ 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 │ │ │ │ │ { │ │ │ │ │ - std::string message; │ │ │ │ │ - error_code last_error; │ │ │ │ │ - int ssccrraappee__iinnccoommpplleettee = -1; │ │ │ │ │ - int ssccrraappee__ccoommpplleettee = -1; │ │ │ │ │ - int ssccrraappee__ddoowwnnllooaaddeedd = -1; │ │ │ │ │ - std::uint8_t fails : 7; │ │ │ │ │ - bool updating : 1; │ │ │ │ │ - bool start_sent : 1; │ │ │ │ │ - bool complete_sent : 1; │ │ │ │ │ + explicit operator bbooooll () 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] │ │ │ │ │ - message │ │ │ │ │ - if this tracker has returned an error or warning message that message is │ │ │ │ │ - stored here │ │ │ │ │ +********** 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] │ │ │ │ │ - last_error │ │ │ │ │ - if this tracker failed the last time it was contacted this error code │ │ │ │ │ - specifies what error occurred │ │ │ │ │ +********** ffiillee(()) ********** │ │ │ │ │ +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] │ │ │ │ │ - scrape_incomplete scrape_complete scrape_downloaded │ │ │ │ │ - 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. │ │ │ │ │ + ec │ │ │ │ │ + the error that occurred │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - fails │ │ │ │ │ - the number of times in a row we have failed to announce to this tracker. │ │ │ │ │ + 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] │ │ │ │ │ - updating │ │ │ │ │ - true while we're waiting for a response from the tracker. │ │ │ │ │ +************ 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] │ │ │ │ │ - start_sent │ │ │ │ │ - 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. │ │ │ │ │ +************ 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] │ │ │ │ │ - complete_sent │ │ │ │ │ - set to true when we send a event=completed. │ │ │ │ │ +************ 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] │ │ │ │ │ -************ aannnnoouunnccee__eennddppooiinntt ************ │ │ │ │ │ -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" │ │ │ │ │ -announces are sent to each tracker using every listen socket this class holds │ │ │ │ │ -information about one listen socket for one tracker │ │ │ │ │ -struct announce_endpoint │ │ │ │ │ +************ 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] │ │ │ │ │ +************ 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] │ │ │ │ │ +************ 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] │ │ │ │ │ +************ 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] │ │ │ │ │ +************ 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 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_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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___v_e_r_s_i_o_n_|_3_ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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_/_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 | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_u_p_ _o_v_e_r_w_r_i_t_i_n_g_ _e_a_c_h_ _o_t_h_e_r_ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|failed_hash_check |2 |A piece did not match its piece | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_h_a_s_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The .torrent file does not contain| │ │ │ │ │ +|torrent_is_no_dict |3 |a bencoded dictionary at its top | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_l_e_v_e_l_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|torrent_missing_info |4 |The .torrent file does not have an| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_f_o_ _d_i_c_t_i_o_n_a_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|torrent_info_no_dict |5 |The .torrent file's info _e_n_t_r_y is | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_n_o_t_ _a_ _d_i_c_t_i_o_n_a_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|torrent_missing_piece_length |6 |The .torrent file does not have a | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_i_e_c_e_ _l_e_n_g_t_h_ _e_n_t_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|torrent_missing_name |7 |The .torrent file does not have a | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_n_a_m_e_ _e_n_t_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|torrent_invalid_name |8 |The .torrent file's name _e_n_t_r_y is | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The length of a file, or of the | │ │ │ │ │ +|torrent_invalid_length |9 |whole .torrent file is invalid. | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_E_i_t_h_e_r_ _n_e_g_a_t_i_v_e_ _o_r_ _n_o_t_ _a_n_ _i_n_t_e_g_e_r_ | │ │ │ │ │ +|torrent_file_parse_failed |10 |Failed to parse a file _e_n_t_r_y in | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _._t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|torrent_missing_pieces |11 |The pieces field is missing or | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _i_n_ _t_h_e_ _._t_o_r_r_e_n_t_ _f_i_l_e_ _ _ _ _ _ | │ │ │ │ │ +|torrent_invalid_hashes |12 |The pieces string has incorrect | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_l_e_n_g_t_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|too_many_pieces_in_torrent |13 |The .torrent file has more pieces | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_a_n_ _i_s_ _s_u_p_p_o_r_t_e_d_ _b_y_ _l_i_b_t_o_r_r_e_n_t_ _ _ | │ │ │ │ │ +| | |The metadata (.torrent file) that | │ │ │ │ │ +|invalid_swarm_metadata |14 |was received from the swarm | │ │ │ │ │ +| | |matched the info-hash, but failed | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_o_ _b_e_ _p_a_r_s_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_bencoding |15 |The file or buffer is not | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_r_r_e_c_t_l_y_ _b_e_n_c_o_d_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|no_files_in_torrent |16 |The .torrent file does not contain| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_n_y_ _f_i_l_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_escaped_string |17 |The string was not properly url- | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_n_c_o_d_e_d_ _a_s_ _e_x_p_e_c_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|session_is_closing |18 |Operation is not permitted since | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _s_e_s_s_i_o_n_ _i_s_ _s_h_u_t_t_i_n_g_ _d_o_w_n_ _ _ _ _ _ | │ │ │ │ │ +| | |There's already a torrent with | │ │ │ │ │ +|duplicate_torrent |19 |that info-hash added to the | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_e_s_s_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_torrent_handle |20 |The supplied _t_o_r_r_e_n_t___h_a_n_d_l_e is not| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_f_e_r_r_i_n_g_ _t_o_ _a_ _v_a_l_i_d_ _t_o_r_r_e_n_t_ _ _ _ _ _ | │ │ │ │ │ +|invalid_entry_type |21 |The type requested from the _e_n_t_r_y | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_d_i_d_ _n_o_t_ _m_a_t_c_h_ _i_t_s_ _t_y_p_e_ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|missing_info_hash_in_uri |22 |The specified URI does not contain| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_ _v_a_l_i_d_ _i_n_f_o_-_h_a_s_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |One of the files in the torrent | │ │ │ │ │ +|file_too_short |23 |was unexpectedly small. This might| │ │ │ │ │ +| | |be caused by files being changed | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_b_y_ _a_n_ _e_x_t_e_r_n_a_l_ _p_r_o_c_e_s_s_ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The URL used an unknown protocol. | │ │ │ │ │ +| | |Currently http and https (if built| │ │ │ │ │ +|unsupported_url_protocol |24 |with openssl support) are | │ │ │ │ │ +| | |recognized. For trackers udp is | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_c_o_g_n_i_z_e_d_ _a_s_ _w_e_l_l_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|url_parse_error |25 |The URL did not conform to URL | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_y_n_t_a_x_ _a_n_d_ _f_a_i_l_e_d_ _t_o_ _b_e_ _p_a_r_s_e_d_ _ _ _ | │ │ │ │ │ +|peer_sent_empty_piece |26 |The peer sent a piece message of | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_l_e_n_g_t_h_ _0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|parse_failed |27 |A bencoded structure was corrupt | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_n_d_ _f_a_i_l_e_d_ _t_o_ _b_e_ _p_a_r_s_e_d_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_file_tag |28 |The fast resume file was missing | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_r_ _h_a_d_ _a_n_ _i_n_v_a_l_i_d_ _f_i_l_e_ _v_e_r_s_i_o_n_ _t_a_g| │ │ │ │ │ +|missing_info_hash |29 |The fast resume file was missing | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_r_ _h_a_d_ _a_n_ _i_n_v_a_l_i_d_ _i_n_f_o_-_h_a_s_h_ _ _ _ _ _ _ | │ │ │ │ │ +|mismatching_info_hash |30 |The info-hash did not match the | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_hostname |31 |The URL contained an invalid | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_h_o_s_t_n_a_m_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_i_n_v_a_l_i_d___p_o_r_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_3_2_ _ _ _|_T_h_e_ _U_R_L_ _h_a_d_ _a_n_ _i_n_v_a_l_i_d_ _p_o_r_t_ _ _ _ _ _ _ | │ │ │ │ │ +| | |The port is blocked by the port- | │ │ │ │ │ +|port_blocked |33 |filter, and prevented the | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_n_n_e_c_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|expected_close_bracket_in_address |34 |The IPv6 address was expected to | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_n_d_ _w_i_t_h_ _"_]_"_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The torrent is being destructed, | │ │ │ │ │ +|destructing_torrent |35 |preventing the operation to | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_u_c_c_e_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_t_i_m_e_d___o_u_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_3_6_ _ _ _|_T_h_e_ _c_o_n_n_e_c_t_i_o_n_ _t_i_m_e_d_ _o_u_t_ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer is upload only, and we | │ │ │ │ │ +|upload_upload_connection |37 |are upload only. There's no point | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_ _k_e_e_p_i_n_g_ _t_h_e_ _c_o_n_n_e_c_t_i_o_n_ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer is upload only, and we're| │ │ │ │ │ +|uninteresting_upload_peer |38 |not interested in it. There's no | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_o_i_n_t_ _i_n_ _k_e_e_p_i_n_g_ _t_h_e_ _c_o_n_n_e_c_t_i_o_n_ _ _ | │ │ │ │ │ +|_i_n_v_a_l_i_d___i_n_f_o___h_a_s_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_3_9_ _ _ _|_T_h_e_ _p_e_e_r_ _s_e_n_t_ _a_n_ _u_n_k_n_o_w_n_ _i_n_f_o_-_h_a_s_h| │ │ │ │ │ +|torrent_paused |40 |The torrent is paused, preventing | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _o_p_e_r_a_t_i_o_n_ _f_r_o_m_ _s_u_c_c_e_e_d_i_n_g_ _ _ _ _ | │ │ │ │ │ +| | |The peer sent an invalid have | │ │ │ │ │ +|invalid_have |41 |message, either wrong size or | │ │ │ │ │ +| | |referring to a piece that doesn't | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_x_i_s_t_ _i_n_ _t_h_e_ _t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_bitfield_size |42 |The _b_i_t_f_i_e_l_d message had the | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_c_o_r_r_e_c_t_ _s_i_z_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer kept requesting pieces | │ │ │ │ │ +|too_many_requests_when_choked |43 |after it was choked, possible | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_b_u_s_e_ _a_t_t_e_m_p_t_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer sent a piece message that| │ │ │ │ │ +|invalid_piece |44 |does not correspond to a piece | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_q_u_e_s_t_ _s_e_n_t_ _b_y_ _t_h_e_ _c_l_i_e_n_t_ _ _ _ _ _ _ _ | │ │ │ │ │ +|_n_o___m_e_m_o_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_4_5_ _ _ _|_m_e_m_o_r_y_ _a_l_l_o_c_a_t_i_o_n_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|torrent_aborted |46 |The torrent is aborted, preventing| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _o_p_e_r_a_t_i_o_n_ _t_o_ _s_u_c_c_e_e_d_ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|self_connection |47 |The peer is a connection to | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_u_r_s_e_l_f_,_ _n_o_ _p_o_i_n_t_ _i_n_ _k_e_e_p_i_n_g_ _i_t_ _ _ | │ │ │ │ │ +| | |The peer sent a piece message with| │ │ │ │ │ +|invalid_piece_size |48 |invalid size, either negative or | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_g_r_e_a_t_e_r_ _t_h_a_n_ _o_n_e_ _b_l_o_c_k_ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer has not been interesting | │ │ │ │ │ +|timed_out_no_interest |49 |or interested in us for too long, | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_n_o_ _p_o_i_n_t_ _i_n_ _k_e_e_p_i_n_g_ _i_t_ _a_r_o_u_n_d_ _ _ _ _ | │ │ │ │ │ +|timed_out_inactivity |50 |The peer has not said anything in | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_ _l_o_n_g_ _t_i_m_e_,_ _p_o_s_s_i_b_l_y_ _d_e_a_d_ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer did not send a handshake | │ │ │ │ │ +|timed_out_no_handshake |51 |within a reasonable amount of | │ │ │ │ │ +| | |time, it might not be a bittorrent| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_e_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer has been unchoked for too| │ │ │ │ │ +|timed_out_no_request |52 |long without requesting any data. | │ │ │ │ │ +| | |It might be lying about its | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_t_e_r_e_s_t_ _i_n_ _u_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_choke |53 |The peer sent an invalid choke | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_unchoke |54 |The peer send an invalid unchoke | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_interested |55 |The peer sent an invalid | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_t_e_r_e_s_t_e_d_ _m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_not_interested |56 |The peer sent an invalid not- | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_t_e_r_e_s_t_e_d_ _m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_request |57 |The peer sent an invalid piece | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_q_u_e_s_t_ _m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer sent an invalid hash-list| │ │ │ │ │ +|invalid_hash_list |58 |message (this is part of the | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_r_k_l_e_-_t_o_r_r_e_n_t_ _e_x_t_e_n_s_i_o_n_)_ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer sent an invalid hash- | │ │ │ │ │ +|invalid_hash_piece |59 |piece message (this is part of the| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_r_k_l_e_-_t_o_r_r_e_n_t_ _e_x_t_e_n_s_i_o_n_)_ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_cancel |60 |The peer sent an invalid cancel | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_dht_port |61 |The peer sent an invalid DHT port-| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_suggest |62 |The peer sent an invalid suggest | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_i_e_c_e_-_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_have_all |63 |The peer sent an invalid have all-| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_have_none |64 |The peer sent an invalid have | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_n_o_n_e_-_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_reject |65 |The peer sent an invalid reject | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_allow_fast |66 |The peer sent an invalid allow | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_f_a_s_t_-_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_extended |67 |The peer sent an invalid extension| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _I_D_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_message |68 |The peer sent an invalid message | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_I_D_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|sync_hash_not_found |69 |The synchronization hash was not | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_f_o_u_n_d_ _i_n_ _t_h_e_ _e_n_c_r_y_p_t_e_d_ _h_a_n_d_s_h_a_k_e_ _ | │ │ │ │ │ +|invalid_encryption_constant |70 |The encryption constant in the | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_h_a_n_d_s_h_a_k_e_ _i_s_ _i_n_v_a_l_i_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|no_plaintext_mode |71 |The peer does not support plain | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_e_x_t_,_ _w_h_i_c_h_ _i_s_ _t_h_e_ _s_e_l_e_c_t_e_d_ _m_o_d_e_ _ | │ │ │ │ │ +|no_rc4_mode |72 |The peer does not support RC4, | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_w_h_i_c_h_ _i_s_ _t_h_e_ _s_e_l_e_c_t_e_d_ _m_o_d_e_ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer does not support any of | │ │ │ │ │ +|unsupported_encryption_mode |73 |the encryption modes that the | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_l_i_e_n_t_ _s_u_p_p_o_r_t_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer selected an encryption | │ │ │ │ │ +|unsupported_encryption_mode_selected|74 |mode that the client did not | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_d_v_e_r_t_i_s_e_ _a_n_d_ _d_o_e_s_ _n_o_t_ _s_u_p_p_o_r_t_ _ _ _ | │ │ │ │ │ +| | |The pad size used in the | │ │ │ │ │ +|invalid_pad_size |75 |encryption handshake is of invalid| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_i_z_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_encrypt_handshake |76 |The encryption handshake is | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The client is set to not support | │ │ │ │ │ +|no_incoming_encrypted |77 |incoming encrypted connections and| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_i_s_ _i_s_ _a_n_ _e_n_c_r_y_p_t_e_d_ _c_o_n_n_e_c_t_i_o_n_ _ _ | │ │ │ │ │ +| | |The client is set to not support | │ │ │ │ │ +|no_incoming_regular |78 |incoming regular bittorrent | │ │ │ │ │ +| | |connections, and this is a regular| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_n_n_e_c_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|duplicate_peer_id |79 |The client is already connected to| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_i_s_ _p_e_e_r_-_I_D_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_t_o_r_r_e_n_t___r_e_m_o_v_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_8_0_ _ _ _|_T_o_r_r_e_n_t_ _w_a_s_ _r_e_m_o_v_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|packet_too_large |81 |The packet size exceeded the upper| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_a_n_i_t_y_ _c_h_e_c_k_-_l_i_m_i_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_r_e_s_e_r_v_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_8_2_ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|http_error |83 |The web server responded with an | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_r_r_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|missing_location |84 |The web server response is missing| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_ _l_o_c_a_t_i_o_n_ _h_e_a_d_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The web seed redirected to a path | │ │ │ │ │ +|invalid_redirection |85 |that no longer matches the | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_._t_o_r_r_e_n_t_ _d_i_r_e_c_t_o_r_y_ _s_t_r_u_c_t_u_r_e_ _ _ _ _ _ | │ │ │ │ │ +|redirecting |86 |The connection was closed because | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_t_ _r_e_d_i_r_e_c_t_e_d_ _t_o_ _a_ _d_i_f_f_e_r_e_n_t_ _U_R_L_ _ | │ │ │ │ │ +|_i_n_v_a_l_i_d___r_a_n_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_8_7_ _ _ _|_T_h_e_ _H_T_T_P_ _r_a_n_g_e_ _h_e_a_d_e_r_ _i_s_ _i_n_v_a_l_i_d_ _ | │ │ │ │ │ +|no_content_length |88 |The HTTP response did not have a | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_n_t_e_n_t_ _l_e_n_g_t_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_b_a_n_n_e_d___b_y___i_p___f_i_l_t_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_8_9_ _ _ _|_T_h_e_ _I_P_ _i_s_ _b_l_o_c_k_e_d_ _b_y_ _t_h_e_ _I_P_ _f_i_l_t_e_r| │ │ │ │ │ +|_t_o_o___m_a_n_y___c_o_n_n_e_c_t_i_o_n_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_9_0_ _ _ _|_A_t_ _t_h_e_ _c_o_n_n_e_c_t_i_o_n_ _l_i_m_i_t_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_p_e_e_r___b_a_n_n_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_9_1_ _ _ _|_T_h_e_ _p_e_e_r_ _i_s_ _m_a_r_k_e_d_ _a_s_ _b_a_n_n_e_d_ _ _ _ _ _ | │ │ │ │ │ +|stopping_torrent |92 |The torrent is stopping, causing | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _o_p_e_r_a_t_i_o_n_ _t_o_ _f_a_i_l_ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|too_many_corrupt_pieces |93 |The peer has sent too many corrupt| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_i_e_c_e_s_ _a_n_d_ _i_s_ _b_a_n_n_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|torrent_not_ready |94 |The torrent is not ready to | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_c_e_i_v_e_ _p_e_e_r_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|peer_not_constructed |95 |The peer is not completely | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_o_n_s_t_r_u_c_t_e_d_ _y_e_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|session_closing |96 |The _s_e_s_s_i_o_n is closing, causing | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _o_p_e_r_a_t_i_o_n_ _t_o_ _f_a_i_l_ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer was disconnected in order| │ │ │ │ │ +|optimistic_disconnect |97 |to leave room for a potentially | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_b_e_t_t_e_r_ _p_e_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_t_o_r_r_e_n_t___f_i_n_i_s_h_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_9_8_ _ _ _|_T_h_e_ _t_o_r_r_e_n_t_ _i_s_ _f_i_n_i_s_h_e_d_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_n_o___r_o_u_t_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_9_9_ _ _ _|_N_o_ _U_P_n_P_ _r_o_u_t_e_r_ _f_o_u_n_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|metadata_too_large |100 |The metadata message says the | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_t_a_d_a_t_a_ _e_x_c_e_e_d_s_ _t_h_e_ _l_i_m_i_t_ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_metadata_request |101 |The peer sent an invalid metadata | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_q_u_e_s_t_ _m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_metadata_size |102 |The peer advertised an invalid | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_t_a_d_a_t_a_ _s_i_z_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_metadata_offset |103 |The peer sent a message with an | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _m_e_t_a_d_a_t_a_ _o_f_f_s_e_t_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_metadata_message |104 |The peer sent an invalid metadata | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|pex_message_too_large |105 |The peer sent a peer exchange | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_s_s_a_g_e_ _t_h_a_t_ _w_a_s_ _t_o_o_ _l_a_r_g_e_ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_pex_message |106 |The peer sent an invalid peer | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_x_c_h_a_n_g_e_ _m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_lt_tracker_message |107 |The peer sent an invalid tracker | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_x_c_h_a_n_g_e_ _m_e_s_s_a_g_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer sent an pex messages too | │ │ │ │ │ +|too_frequent_pex |108 |often. This is a possible attempt | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_f_ _a_n_d_ _a_t_t_a_c_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The operation failed because it | │ │ │ │ │ +| | |requires the torrent to have the | │ │ │ │ │ +| | |metadata (.torrent file) and it | │ │ │ │ │ +|no_metadata |109 |doesn't have it yet. This happens | │ │ │ │ │ +| | |for magnet links before they have | │ │ │ │ │ +| | |downloaded the metadata, and also | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_o_r_r_e_n_t_s_ _a_d_d_e_d_ _b_y_ _U_R_L_._ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer sent an invalid dont_have| │ │ │ │ │ +| | |message. The don't have message is| │ │ │ │ │ +|invalid_dont_have |110 |an extension to allow peers to | │ │ │ │ │ +| | |advertise that the no longer has a| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_i_e_c_e_ _t_h_e_y_ _p_r_e_v_i_o_u_s_l_y_ _h_a_d_._ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer tried to connect to an | │ │ │ │ │ +|requires_ssl_connection |111 |SSL torrent without connecting | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_v_e_r_ _S_S_L_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The peer tried to connect to a | │ │ │ │ │ +|invalid_ssl_cert |112 |torrent with a certificate for a | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_d_i_f_f_e_r_e_n_t_ _t_o_r_r_e_n_t_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |the torrent is not an SSL torrent,| │ │ │ │ │ +|not_an_ssl_torrent |113 |and the operation requires an SSL | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |peer was banned because its listen| │ │ │ │ │ +|banned_by_port_filter |114 |port is within a banned port | │ │ │ │ │ +| | |range, as specified by the | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_o_r_t___f_i_l_t_e_r_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_session_handle |115 |The _s_e_s_s_i_o_n___h_a_n_d_l_e is not | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_f_e_r_r_i_n_g_ _t_o_ _a_ _v_a_l_i_d_ _s_e_s_s_i_o_n___i_m_p_l_ | │ │ │ │ │ +|invalid_listen_socket |116 |the listen socket associated with | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_i_s_ _r_e_q_u_e_s_t_ _w_a_s_ _c_l_o_s_e_d_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_i_n_v_a_l_i_d___h_a_s_h___r_e_q_u_e_s_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_1_7_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_i_n_v_a_l_i_d___h_a_s_h_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_1_8_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_i_n_v_a_l_i_d___h_a_s_h___r_e_j_e_c_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_1_9_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_d_e_p_r_e_c_a_t_e_d___1_2_0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_2_0_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_d_e_p_r_e_c_a_t_e_d___1_2_1_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_2_1_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_d_e_p_r_e_c_a_t_e_d___1_2_2_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_2_2_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_d_e_p_r_e_c_a_t_e_d___1_2_3_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_2_3_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_d_e_p_r_e_c_a_t_e_d___1_2_4_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_2_4_ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|missing_file_sizes |130 |The resume data file is missing | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _f_i_l_e_ _s_i_z_e_s_ _e_n_t_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|no_files_in_resume_data |131 |The resume data file file sizes | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_n_t_r_y_ _i_s_ _e_m_p_t_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|missing_pieces |132 |The resume data file is missing | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_ _p_i_e_c_e_s_ _a_n_d_ _s_l_o_t_s_ _e_n_t_r_y_ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The number of files in the resume | │ │ │ │ │ +|mismatching_number_of_files |133 |data does not match the number of | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_f_i_l_e_s_ _i_n_ _t_h_e_ _t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |One of the files on disk has a | │ │ │ │ │ +|mismatching_file_size |134 |different size than in the fast | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_s_u_m_e_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |One of the files on disk has a | │ │ │ │ │ +|mismatching_file_timestamp |135 |different timestamp than in the | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_f_a_s_t_ _r_e_s_u_m_e_ _f_i_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|not_a_dictionary |136 |The resume data file is not a | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_d_i_c_t_i_o_n_a_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_blocks_per_piece |137 |The blocks per piece _e_n_t_r_y is | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _i_n_ _t_h_e_ _r_e_s_u_m_e_ _d_a_t_a_ _f_i_l_e_ _ _ | │ │ │ │ │ +| | |The resume file is missing the | │ │ │ │ │ +|missing_slots |138 |slots _e_n_t_r_y, which is required for| │ │ │ │ │ +| | |torrents with compact allocation. | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_DD_EE_PP_RR_EE_CC_AA_TT_EE_DD_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|too_many_slots |139 |The resume file contains more | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_s_l_o_t_s_ _t_h_a_n_ _t_h_e_ _t_o_r_r_e_n_t_ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_slot_list |140 |The slot _e_n_t_r_y is invalid in the | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_r_e_s_u_m_e_ _d_a_t_a_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_piece_index |141 |One index in the slot list is | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The pieces on disk needs to be re-| │ │ │ │ │ +| | |ordered for the specified | │ │ │ │ │ +| | |allocation mode. This happens if | │ │ │ │ │ +|pieces_need_reorder |142 |you specify sparse allocation and | │ │ │ │ │ +| | |the files on disk are using | │ │ │ │ │ +| | |compact storage. The pieces needs | │ │ │ │ │ +| | |to be moved to their right | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_o_s_i_t_i_o_n_._ _DD_EE_PP_RR_EE_CC_AA_TT_EE_DD_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |this error is returned when asking| │ │ │ │ │ +| | |to save resume data and specifying| │ │ │ │ │ +|resume_data_not_modified |143 |the flag to only save when there's| │ │ │ │ │ +| | |anything new to save | │ │ │ │ │ +| | |(_t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_o_n_l_y___i_f___m_o_d_i_f_i_e_d)| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_n_d_ _t_h_e_r_e_ _w_a_s_n_'_t_ _a_n_y_t_h_i_n_g_ _c_h_a_n_g_e_d_.| │ │ │ │ │ +|invalid_save_path |144 |the save_path in | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s_ _i_s_ _n_o_t_ _v_a_l_i_d_ _ _ | │ │ │ │ │ +|http_parse_error |150 |The HTTP header was not correctly | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_f_o_r_m_a_t_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The HTTP response was in the 300- | │ │ │ │ │ +|http_missing_location |151 |399 range but lacked a location | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_h_e_a_d_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The HTTP response was encoded with| │ │ │ │ │ +|http_failed_decompress |152 |gzip or deflate but decompressing | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_t_ _f_a_i_l_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|no_i2p_router |160 |The URL specified an i2p address, | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_b_u_t_ _n_o_ _i_2_p_ _r_o_u_t_e_r_ _i_s_ _c_o_n_f_i_g_u_r_e_d_ _ _ | │ │ │ │ │ +|no_i2p_endpoint |161 |i2p acceptor is not available yet,| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_c_a_n_'_t_ _a_n_n_o_u_n_c_e_ _w_i_t_h_o_u_t_ _e_n_d_p_o_i_n_t_ _ _ | │ │ │ │ │ +| | |The tracker URL doesn't support | │ │ │ │ │ +|scrape_not_available |170 |transforming it into a scrape URL.| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_._e_._ _i_t_ _d_o_e_s_n_'_t_ _c_o_n_t_a_i_n_ _"_a_n_n_o_u_n_c_e_.| │ │ │ │ │ +|_i_n_v_a_l_i_d___t_r_a_c_k_e_r___r_e_s_p_o_n_s_e_ _ _ _ _ _ _ _ _ _ _ _ _|_1_7_1_ _ _|_i_n_v_a_l_i_d_ _t_r_a_c_k_e_r_ _r_e_s_p_o_n_s_e_ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_peer_dict |172 |invalid peer dictionary _e_n_t_r_y. Not| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_ _d_i_c_t_i_o_n_a_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_t_r_a_c_k_e_r___f_a_i_l_u_r_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_7_3_ _ _|_t_r_a_c_k_e_r_ _s_e_n_t_ _a_ _f_a_i_l_u_r_e_ _m_e_s_s_a_g_e_ _ _ _ | │ │ │ │ │ +|_i_n_v_a_l_i_d___f_i_l_e_s___e_n_t_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_7_4_ _ _|_m_i_s_s_i_n_g_ _o_r_ _i_n_v_a_l_i_d_ _f_i_l_e_s_ _e_n_t_r_y_ _ _ _ | │ │ │ │ │ +|_i_n_v_a_l_i_d___h_a_s_h___e_n_t_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_7_5_ _ _|_m_i_s_s_i_n_g_ _o_r_ _i_n_v_a_l_i_d_ _h_a_s_h_ _e_n_t_r_y_ _ _ _ _ | │ │ │ │ │ +|invalid_peers_entry |176 |missing or invalid peers and | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_e_e_r_s_6_ _e_n_t_r_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_tracker_response_length |177 |UDP tracker response packet has | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_i_n_v_a_l_i_d_ _s_i_z_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_tracker_transaction_id |178 |invalid transaction id in UDP | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_r_a_c_k_e_r_ _r_e_s_p_o_n_s_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|invalid_tracker_action |179 |invalid action field in UDP | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_r_a_c_k_e_r_ _r_e_s_p_o_n_s_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |skipped announce (because it's | │ │ │ │ │ +|announce_skipped |180 |assumed to be unreachable over the| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_g_i_v_e_n_ _s_o_u_r_c_e_ _n_e_t_w_o_r_k_ _i_n_t_e_r_f_a_c_e_)_ _ _ | │ │ │ │ │ +|_n_o___e_n_t_r_o_p_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_0_0_ _ _|_r_a_n_d_o_m_ _n_u_m_b_e_r_ _g_e_n_e_r_a_t_i_o_n_ _f_a_i_l_e_d_ _ _ | │ │ │ │ │ +|_s_s_r_f___m_i_t_i_g_a_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_0_1_ _ _|_b_l_o_c_k_e_d_ _b_y_ _S_S_R_F_ _m_i_t_i_g_a_t_i_o_n_ _ _ _ _ _ _ _ | │ │ │ │ │ +|blocked_by_idna |202 |blocked because IDNA host names | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_r_e_ _b_a_n_n_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|torrent_unknown_version |210 |the torrent file has an unknown | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_m_e_t_a_ _v_e_r_s_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|torrent_missing_file_tree |211 |the v2 torrent file has no file | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_r_e_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|torrent_missing_meta_version |212 |the torrent contains v2 keys but | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_d_o_e_s_ _n_o_t_ _s_p_e_c_i_f_y_ _m_e_t_a_ _v_e_r_s_i_o_n_ _2_ _ _ | │ │ │ │ │ +|torrent_inconsistent_files |213 |the v1 and v2 file metadata does | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_n_o_t_ _m_a_t_c_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|torrent_missing_piece_layer |214 |one or more files are missing | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_i_e_c_e_ _l_a_y_e_r_ _h_a_s_h_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|torrent_invalid_piece_layer |215 |a piece layer has the wrong size | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_o_r_ _f_a_i_l_e_d_ _h_a_s_h_ _c_h_e_c_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_t_o_r_r_e_n_t___m_i_s_s_i_n_g___p_i_e_c_e_s___r_o_o_t_ _ _ _ _ _ _ _ _ _|_2_1_6_ _ _|_a_ _v_2_ _f_i_l_e_ _e_n_t_r_y_ _h_a_s_ _n_o_ _r_o_o_t_ _h_a_s_h_ _ | │ │ │ │ │ +|torrent_inconsistent_hashes |217 |the v1 and v2 hashes do not | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_d_e_s_c_r_i_b_e_ _t_h_e_ _s_a_m_e_ _d_a_t_a_ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|torrent_invalid_pad_file |218 |a file in the v2 metadata has the | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_a_d_ _a_t_t_r_i_b_u_t_e_ _s_e_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_e_r_r_o_r___c_o_d_e___m_a_x_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_1_9_ _ _|_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 hhttttpp__eerrrroorrss ************ │ │ │ │ │ +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| │ │ │ │ │ +|_c_o_n_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_1_0_0_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_o_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_0_0_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_c_r_e_a_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_0_1_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_a_c_c_e_p_t_e_d_ _ _ _ _ _ _ _ _ _ _ _ _ _|_2_0_2_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_n_o___c_o_n_t_e_n_t_ _ _ _ _ _ _ _ _ _ _ _|_2_0_4_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_m_u_l_t_i_p_l_e___c_h_o_i_c_e_s_ _ _ _ _ _|_3_0_0_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_m_o_v_e_d___p_e_r_m_a_n_e_n_t_l_y_ _ _ _ _|_3_0_1_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_m_o_v_e_d___t_e_m_p_o_r_a_r_i_l_y_ _ _ _ _|_3_0_2_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_n_o_t___m_o_d_i_f_i_e_d_ _ _ _ _ _ _ _ _ _|_3_0_4_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_b_a_d___r_e_q_u_e_s_t_ _ _ _ _ _ _ _ _ _ _|_4_0_0_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_u_n_a_u_t_h_o_r_i_z_e_d_ _ _ _ _ _ _ _ _ _|_4_0_1_ _ _|_ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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 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] │ │ │ │ │ +************ 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 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_ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +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] │ │ │ │ │ +************ 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 │ │ │ │ │ { │ │ │ │ │ - aannnnoouunnccee__eennddppooiinntt (); │ │ │ │ │ + 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] │ │ │ │ │ + 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] │ │ │ │ │ + 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 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 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 o │ │ │ │ │ + , std::function handler │ │ │ │ │ + , disk_job_flags_t flags = {}) = 0; │ │ │ │ │ + virtual void aassyynncc__hhaasshh (storage_index_t storage, piece_index_t piece, │ │ │ │ │ +span v2 │ │ │ │ │ + , disk_job_flags_t flags │ │ │ │ │ + , std::function handler) = 0; │ │ │ │ │ + virtual void aassyynncc__hhaasshh22 (storage_index_t storage, piece_index_t piece, int │ │ │ │ │ +offset, disk_job_flags_t flags │ │ │ │ │ + , std::function handler) = 0; │ │ │ │ │ + virtual void aassyynncc__mmoovvee__ssttoorraaggee (storage_index_t storage, std::string p, │ │ │ │ │ +move_flags_t flags │ │ │ │ │ + , std::function │ │ │ │ │ +handler) = 0; │ │ │ │ │ + virtual void aassyynncc__rreelleeaassee__ffiilleess (storage_index_t storage │ │ │ │ │ + , std::function handler = std::function()) = 0; │ │ │ │ │ + virtual void aassyynncc__cchheecckk__ffiilleess (storage_index_t storage │ │ │ │ │ + , add_torrent_params const* resume_data │ │ │ │ │ + , aux::vector links │ │ │ │ │ + , std::function handler) = 0; │ │ │ │ │ + virtual void aassyynncc__ssttoopp__ttoorrrreenntt (storage_index_t storage │ │ │ │ │ + , std::function handler = std::function()) = 0; │ │ │ │ │ + virtual void aassyynncc__rreennaammee__ffiillee (storage_index_t storage │ │ │ │ │ + , file_index_t index, std::string name │ │ │ │ │ + , std::function handler) = 0; │ │ │ │ │ + virtual void aassyynncc__ddeelleettee__ffiilleess (storage_index_t storage, remove_flags_t │ │ │ │ │ +options │ │ │ │ │ + , std::function handler) = 0; │ │ │ │ │ + virtual void aassyynncc__sseett__ffiillee__pprriioorriittyy (storage_index_t storage │ │ │ │ │ + , aux::vector prio │ │ │ │ │ + , std::function)> handler) = 0; │ │ │ │ │ + virtual void aassyynncc__cclleeaarr__ppiieeccee (storage_index_t storage, piece_index_t index │ │ │ │ │ + , std::function handler) = 0; │ │ │ │ │ + virtual void uuppddaattee__ssttaattss__ccoouunntteerrss (counters& c) const = 0; │ │ │ │ │ + virtual std::vector ggeett__ssttaattuuss (storage_index_t) const = 0; │ │ │ │ │ + virtual void aabboorrtt (bool wait) = 0; │ │ │ │ │ + virtual void ssuubbmmiitt__jjoobbss () = 0; │ │ │ │ │ + virtual void sseettttiinnggss__uuppddaatteedd () = 0; │ │ │ │ │ │ │ │ │ │ - _t_c_p_:_:_e_n_d_p_o_i_n_t local_endpoint; │ │ │ │ │ - aux::array info_hashes; │ │ │ │ │ - bool eennaabblleedd = true; │ │ │ │ │ + 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] │ │ │ │ │ - local_endpoint │ │ │ │ │ - the local endpoint of the listen interface associated with this endpoint │ │ │ │ │ +********** nneeww__ttoorrrreenntt(()) ********** │ │ │ │ │ +virtual storage_holder nneeww__ttoorrrreenntt (storage_params const& p │ │ │ │ │ + , std::shared_ptr 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] │ │ │ │ │ - info_hashes │ │ │ │ │ - info_hashes[0] is the v1 info hash (SHA1) info_hashes[1] is the v2 info │ │ │ │ │ - hash (truncated SHA-256) │ │ │ │ │ +********** 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] │ │ │ │ │ - enabled │ │ │ │ │ - set to false to not announce from this endpoint │ │ │ │ │ +********** aassyynncc__wwrriittee(()) aassyynncc__rreeaadd(()) ********** │ │ │ │ │ +virtual void aassyynncc__rreeaadd (storage_index_t storage, peer_request const& r │ │ │ │ │ + , std::function 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 o │ │ │ │ │ + , std::function 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] │ │ │ │ │ -************ 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 │ │ │ │ │ +********** aassyynncc__hhaasshh(()) ********** │ │ │ │ │ +virtual void aassyynncc__hhaasshh (storage_index_t storage, piece_index_t piece, │ │ │ │ │ +span v2 │ │ │ │ │ + , disk_job_flags_t flags │ │ │ │ │ + , std::function 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 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 │ │ │ │ │ +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 handler = std::function()) = 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 links │ │ │ │ │ + , std::function 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 handler = std::function()) = 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 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 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 prio │ │ │ │ │ + , std::function)> 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 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 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 │ │ │ │ │ { │ │ │ │ │ - ~~aannnnoouunnccee__eennttrryy (); │ │ │ │ │ - aannnnoouunnccee__eennttrryy (announce_entry const&); │ │ │ │ │ - explicit aannnnoouunnccee__eennttrryy (string_view u); │ │ │ │ │ - announce_entry& ooppeerraattoorr== (announce_entry const&) &; │ │ │ │ │ - aannnnoouunnccee__eennttrryy (); │ │ │ │ │ + ssttoorraaggee__hhoollddeerr (storage_index_t idx, disk_interface& disk_io); │ │ │ │ │ + ~~ssttoorraaggee__hhoollddeerr (); │ │ │ │ │ + ssttoorraaggee__hhoollddeerr () = default; │ │ │ │ │ + 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] │ │ │ │ │ +************ 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; │ │ │ │ │ + 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 │ │ │ │ │ +[_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] │ │ │ │ │ +************ 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] │ │ │ │ │ +************ 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] │ │ │ │ │ +************ 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 │ │ │ │ │ +[_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 (); │ │ │ │ │ + sseessssiioonn__ppaarraammss (settings_pack const& sp); │ │ │ │ │ + sseessssiioonn__ppaarraammss (settings_pack&& sp); │ │ │ │ │ + sseessssiioonn__ppaarraammss (settings_pack&& sp │ │ │ │ │ + , std::vector> exts); │ │ │ │ │ + sseessssiioonn__ppaarraammss (settings_pack const& sp │ │ │ │ │ + , std::vector> exts); │ │ │ │ │ │ │ │ │ │ - enum tracker_source │ │ │ │ │ - { │ │ │ │ │ - source_torrent, │ │ │ │ │ - source_client, │ │ │ │ │ - source_magnet_link, │ │ │ │ │ - source_tex, │ │ │ │ │ - }; │ │ │ │ │ + settings_pack settings; │ │ │ │ │ + std::vector> extensions; │ │ │ │ │ + dht::dht_state dht_state; │ │ │ │ │ + dht::dht_storage_constructor_type dht_storage_constructor; │ │ │ │ │ + disk_io_constructor_type disk_io_constructor; │ │ │ │ │ + std::map 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 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&& sp │ │ │ │ │ + , std::vector> exts); │ │ │ │ │ +sseessssiioonn__ppaarraammss (settings_pack const& sp │ │ │ │ │ + , std::vector> 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 │ │ │ │ │ + the plugins to add to the _s_e_s_s_i_o_n as it is constructed │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + dht_state │ │ │ │ │ + DHT node ID and node addresses to bootstrap the DHT with. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + dht_storage_constructor │ │ │ │ │ + function object to construct the storage object for DHT items. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + disk_io_constructor │ │ │ │ │ + function object to create the disk I/O subsystem. Defaults to │ │ │ │ │ + default_disk_io_constructor. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + ext_state │ │ │ │ │ + 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 _r_e_a_d___s_e_s_s_i_o_n___p_a_r_a_m_s_(_) and _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s_(_). │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + ip_filter │ │ │ │ │ + the IP filter to use for the _s_e_s_s_i_o_n. This restricts which peers are │ │ │ │ │ + allowed to connect. As if passed to _s_e_t___i_p___f_i_l_t_e_r_(_). │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +************ sseessssiioonn__hhaannddllee ************ │ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n___h_a_n_d_l_e_._h_p_p" │ │ │ │ │ +this class provides a non-owning handle to a _s_e_s_s_i_o_n and a subset of the │ │ │ │ │ +interface of the _s_e_s_s_i_o_n class. If the underlying _s_e_s_s_i_o_n is destructed any │ │ │ │ │ +handle to it will no longer be valid. _i_s___v_a_l_i_d_(_) will return false and any │ │ │ │ │ +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* ret │ │ │ │ │ + , status_flags_t flags = {}) const; │ │ │ │ │ + std::vector ggeett__ttoorrrreenntt__ssttaattuuss ( │ │ │ │ │ + std::function 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 const& st); │ │ │ │ │ + void sseett__ddhhtt__ssttaattee (dht::dht_state&& st); │ │ │ │ │ + std::vector ggeett__ttoorrrreennttss () const; │ │ │ │ │ + torrent_handle ffiinndd__ttoorrrreenntt (sha1_hash const& info_hash) const; │ │ │ │ │ + torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ │ + torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& 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); │ │ │ │ │ + void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ │ + void ppaauussee (); │ │ │ │ │ + bool iiss__ppaauusseedd () const; │ │ │ │ │ + void rreessuummee (); │ │ │ │ │ + bool iiss__ddhhtt__rruunnnniinngg () const; │ │ │ │ │ + void sseett__ddhhtt__ssttoorraaggee (dht::dht_storage_constructor_type sc); │ │ │ │ │ + void aadddd__ddhhtt__nnooddee (std::pair const& node); │ │ │ │ │ + void ddhhtt__ggeett__iitteemm (sha1_hash const& target); │ │ │ │ │ + void ddhhtt__ggeett__iitteemm (std::array key │ │ │ │ │ + , std::string salt = std::string()); │ │ │ │ │ + sha1_hash ddhhtt__ppuutt__iitteemm (entry data); │ │ │ │ │ + void ddhhtt__ppuutt__iitteemm (std::array key │ │ │ │ │ + , std::function& │ │ │ │ │ + , 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__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 ext); │ │ │ │ │ + void aadddd__eexxtteennssiioonn (std::function( │ │ │ │ │ + torrent_handle const&, client_data_t)> ext); │ │ │ │ │ + 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); │ │ │ │ │ + ip_filter ggeett__ppeeeerr__ccllaassss__ffiilltteerr () const; │ │ │ │ │ + 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 = {}); │ │ │ │ │ + void aappppllyy__sseettttiinnggss (settings_pack&&); │ │ │ │ │ + settings_pack ggeett__sseettttiinnggss () const; │ │ │ │ │ + void aappppllyy__sseettttiinnggss (settings_pack const&); │ │ │ │ │ + void sseett__aalleerrtt__nnoottiiffyy (std::function const& fun); │ │ │ │ │ + alert* wwaaiitt__ffoorr__aalleerrtt (time_duration max_wait); │ │ │ │ │ + void ppoopp__aalleerrttss (std::vector* alerts); │ │ │ │ │ + void ddeelleettee__ppoorrtt__mmaappppiinngg (port_mapping_t handle); │ │ │ │ │ + std::vector aadddd__ppoorrtt__mmaappppiinngg (portmap_protocol t, int │ │ │ │ │ +external_port, int local_port); │ │ │ │ │ + void rreeooppeenn__nneettwwoorrkk__ssoocckkeettss (reopen_network_flags_t options = │ │ │ │ │ +reopen_map_ports); │ │ │ │ │ + std::shared_ptr nnaattiivvee__hhaannddllee () const; │ │ │ │ │ │ │ │ │ │ - std::string url; │ │ │ │ │ + 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; │ │ │ │ │ + static constexpr save_state_flags_t ssaavvee__iipp__ffiilltteerr = 12_bit; │ │ │ │ │ + static constexpr peer_class_t gglloobbaall__ppeeeerr__ccllaassss__iidd {0}; │ │ │ │ │ + static constexpr peer_class_t ttccpp__ppeeeerr__ccllaassss__iidd {1}; │ │ │ │ │ + static constexpr peer_class_t llooccaall__ppeeeerr__ccllaassss__iidd {2}; │ │ │ │ │ + static constexpr remove_flags_t ddeelleettee__ffiilleess = 0_bit; │ │ │ │ │ + static constexpr remove_flags_t ddeelleettee__ppaarrttffiillee = 1_bit; │ │ │ │ │ + static constexpr session_flags_t ppaauusseedd = 2_bit; │ │ │ │ │ + static constexpr portmap_protocol uuddpp = portmap_protocol::udp; │ │ │ │ │ + static constexpr portmap_protocol ttccpp = portmap_protocol::tcp; │ │ │ │ │ + static constexpr reopen_network_flags_t rreeooppeenn__mmaapp__ppoorrttss = 0_bit; │ │ │ │ │ +}; │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** iiss__vvaalliidd(()) ********** │ │ │ │ │ +bool iiss__vvaalliidd () const; │ │ │ │ │ +returns true if this handle refers to a valid _s_e_s_s_i_o_n object. If the _s_e_s_s_i_o_n │ │ │ │ │ +has been destroyed, all _s_e_s_s_i_o_n___h_a_n_d_l_e objects will expire and not be valid. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** sseessssiioonn__ssttaattee(()) ********** │ │ │ │ │ +session_params sseessssiioonn__ssttaattee (save_state_flags_t flags = save_state_flags_t:: │ │ │ │ │ +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(()) ********** │ │ │ │ │ +void rreeffrreesshh__ttoorrrreenntt__ssttaattuuss (std::vector* ret │ │ │ │ │ + , status_flags_t flags = {}) const; │ │ │ │ │ +std::vector ggeett__ttoorrrreenntt__ssttaattuuss ( │ │ │ │ │ + std::function const& pred │ │ │ │ │ + , 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 │ │ │ │ │ +should be included and false means excluded. The flags argument is the same as │ │ │ │ │ +to _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_s_t_a_t_u_s_(_). Since pred is guaranteed to be called for every │ │ │ │ │ +torrent, it may be used to count the number of torrents of different categories │ │ │ │ │ +as well. │ │ │ │ │ +refresh_torrent_status takes a vector of _t_o_r_r_e_n_t___s_t_a_t_u_s structs (for instance │ │ │ │ │ +the same vector that was returned by _g_e_t___t_o_r_r_e_n_t___s_t_a_t_u_s_(_) ) and refreshes the │ │ │ │ │ +status based on the handle member. It is possible to use this function by first │ │ │ │ │ +setting up a vector of default constructed torrent_status objects, only │ │ │ │ │ +initializing the handle 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. │ │ │ │ │ +Any _t_o_r_r_e_n_t___s_t_a_t_u_s object whose handle member is not referring to a valid │ │ │ │ │ +torrent are ignored. │ │ │ │ │ +The intended use of these functions is to start off by calling │ │ │ │ │ +get_torrent_status() to get a list of all torrents that match your criteria. │ │ │ │ │ +Then call refresh_torrent_status() 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 get_torrent_status() 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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** ppoosstt__ttoorrrreenntt__uuppddaatteess(()) ********** │ │ │ │ │ +void ppoosstt__ttoorrrreenntt__uuppddaatteess (status_flags_t flags = status_flags_t::all()); │ │ │ │ │ +This functions instructs the _s_e_s_s_i_o_n to post the _s_t_a_t_e___u_p_d_a_t_e___a_l_e_r_t, containing │ │ │ │ │ +the status of all torrents whose state changed since the last time this │ │ │ │ │ +function was called. │ │ │ │ │ +Only torrents who has the state subscription flag set will be included. This │ │ │ │ │ +flag is on by default. See _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s. the flags argument is the same │ │ │ │ │ +as for _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_s_t_a_t_u_s_(_). see status_flags_t in _t_o_r_r_e_n_t___h_a_n_d_l_e. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** ppoosstt__sseessssiioonn__ssttaattss(()) ********** │ │ │ │ │ +void ppoosstt__sseessssiioonn__ssttaattss (); │ │ │ │ │ +This function will post a _s_e_s_s_i_o_n___s_t_a_t_s___a_l_e_r_t object, containing a snapshot of │ │ │ │ │ +the performance _c_o_u_n_t_e_r_s from the internals of libtorrent. To interpret these │ │ │ │ │ +_c_o_u_n_t_e_r_s, query the _s_e_s_s_i_o_n via _s_e_s_s_i_o_n___s_t_a_t_s___m_e_t_r_i_c_s_(_). │ │ │ │ │ +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 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(()) ********** │ │ │ │ │ +std::vector 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] │ │ │ │ │ +********** aassyynncc__aadddd__ttoorrrreenntt(()) aadddd__ttoorrrreenntt(()) ********** │ │ │ │ │ +torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ │ +torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& 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); │ │ │ │ │ +void aassyynncc__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 │ │ │ │ │ +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_d_d___t_o_r_r_e_n_t_(_) will throw a system_error exception. │ │ │ │ │ +The overload that does not take an error_code throws an exception on error and │ │ │ │ │ +is not available when building without exception support. The _t_o_r_r_e_n_t___h_a_n_d_l_e │ │ │ │ │ +returned by _a_d_d___t_o_r_r_e_n_t_(_) can be used to retrieve information about the │ │ │ │ │ +torrent's progress, its peers etc. It is also used to abort a torrent. │ │ │ │ │ +If the torrent you are trying to add already exists in the _s_e_s_s_i_o_n (is either │ │ │ │ │ +queued for checking, being checked or downloading) add_torrent() will throw │ │ │ │ │ +system_error which derives from std::exception unless duplicate_is_error is set │ │ │ │ │ +to false. In that case, _a_d_d___t_o_r_r_e_n_t_(_) will return the handle to the existing │ │ │ │ │ +torrent. │ │ │ │ │ +The _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s 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. │ │ │ │ │ +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(()) ppaauussee(()) iiss__ppaauusseedd(()) ********** │ │ │ │ │ +void ppaauussee (); │ │ │ │ │ +bool iiss__ppaauusseedd () const; │ │ │ │ │ +void rreessuummee (); │ │ │ │ │ +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 │ │ │ │ │ +paused or if the _s_e_s_s_i_o_n is paused. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** iiss__ddhhtt__rruunnnniinngg(()) ********** │ │ │ │ │ +bool iiss__ddhhtt__rruunnnniinngg () const; │ │ │ │ │ +is_dht_running() returns true if the DHT support has been started and false │ │ │ │ │ +otherwise. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** sseett__ddhhtt__ssttoorraaggee(()) ********** │ │ │ │ │ +void sseett__ddhhtt__ssttoorraaggee (dht::dht_storage_constructor_type sc); │ │ │ │ │ +set_dht_storage set a dht custom storage constructor function to be used │ │ │ │ │ +internally when the dht is created. │ │ │ │ │ +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. │ │ │ │ │ +If you want to make sure the dht is initially created with your custom storage, │ │ │ │ │ +create a _s_e_s_s_i_o_n with the setting settings_pack::enable_dht to false, set your │ │ │ │ │ +constructor function and call apply_settings with settings_pack::enable_dht to │ │ │ │ │ +true. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** aadddd__ddhhtt__nnooddee(()) ********** │ │ │ │ │ +void aadddd__ddhhtt__nnooddee (std::pair const& node); │ │ │ │ │ +add_dht_node 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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** ddhhtt__ggeett__iitteemm(()) ********** │ │ │ │ │ +void ddhhtt__ggeett__iitteemm (sha1_hash const& target); │ │ │ │ │ +query the DHT for an immutable item at the target hash. the result is posted as │ │ │ │ │ +a _d_h_t___i_m_m_u_t_a_b_l_e___i_t_e_m___a_l_e_r_t. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** ddhhtt__ggeett__iitteemm(()) ********** │ │ │ │ │ +void ddhhtt__ggeett__iitteemm (std::array key │ │ │ │ │ + , std::string salt = std::string()); │ │ │ │ │ +query the DHT for a mutable item under the public key key. this is an ed25519 │ │ │ │ │ +key. salt 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 _d_h_t___m_u_t_a_b_l_e___i_t_e_m___a_l_e_r_t is posted. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** ddhhtt__ppuutt__iitteemm(()) ********** │ │ │ │ │ +sha1_hash ddhhtt__ppuutt__iitteemm (entry data); │ │ │ │ │ +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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** ddhhtt__ppuutt__iitteemm(()) ********** │ │ │ │ │ +void ddhhtt__ppuutt__iitteemm (std::array key │ │ │ │ │ + , std::function& │ │ │ │ │ + , std::int64_t&, std::string const&)> cb │ │ │ │ │ + , std::string salt = std::string()); │ │ │ │ │ +store a mutable item. The key is the public key the blob is to be stored under. │ │ │ │ │ +The optional salt 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: │ │ │ │ │ + entry& value │ │ │ │ │ + the current value stored under the key (may be empty). Also expected to │ │ │ │ │ + be set to the value to be stored by the function. │ │ │ │ │ + std::array& signature │ │ │ │ │ + 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 sign_mutable_item function. │ │ │ │ │ + std::int64_t& seq │ │ │ │ │ + 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. │ │ │ │ │ + std::string const& salt │ │ │ │ │ + this is the salt that was used for this put call. │ │ │ │ │ +Since the callback function cb 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 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__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 │ │ │ │ │ +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 │ │ │ │ │ +announce_port override setting. │ │ │ │ │ +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. │ │ │ │ │ +For possible flags, see _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__lliivvee__nnooddeess(()) ********** │ │ │ │ │ +void ddhhtt__lliivvee__nnooddeess (sha1_hash const& nid); │ │ │ │ │ +Retrieve all the live DHT (identified by nid) nodes. All the nodes id and │ │ │ │ │ +endpoint will be returned in the list of nodes in the _a_l_e_r_t │ │ │ │ │ +dht_live_nodes_alert. 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] │ │ │ │ │ +********** ddhhtt__ssaammppllee__iinnffoohhaasshheess(()) ********** │ │ │ │ │ +void ddhhtt__ssaammppllee__iinnffoohhaasshheess (udp::endpoint const& ep, sha1_hash const& target); │ │ │ │ │ +Query the DHT node specified by ep to retrieve a sample of the info-hashes that │ │ │ │ │ +the node currently have in their storage. The target 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 │ │ │ │ │ +dht_sample_infohashes_alert. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** ddhhtt__ddiirreecctt__rreeqquueesstt(()) ********** │ │ │ │ │ +void ddhhtt__ddiirreecctt__rreeqquueesstt (udp::endpoint const& ep, entry const& e, client_data_t │ │ │ │ │ +userdata = {}); │ │ │ │ │ +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 ext); │ │ │ │ │ +void aadddd__eexxtteennssiioonn (std::function( │ │ │ │ │ + torrent_handle const&, client_data_t)> 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. 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 │ │ │ │ │ + directly. Makes it possible to join a swarm with just a tracker and info- │ │ │ │ │ + hash. │ │ │ │ │ +#include │ │ │ │ │ +ses.add_extension(<::create_ut_metadata_plugin); │ │ │ │ │ + uTorrent peer exchange │ │ │ │ │ + Exchanges peers between clients. │ │ │ │ │ +#include │ │ │ │ │ +ses.add_extension(<::create_ut_pex_plugin); │ │ │ │ │ + smart ban _p_l_u_g_i_n │ │ │ │ │ + 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 │ │ │ │ │ +ses.add_extension(<::create_smart_ban_plugin); │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** ggeett__iipp__ffiilltteerr(()) sseett__iipp__ffiilltteerr(()) ********** │ │ │ │ │ +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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** 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] │ │ │ │ │ +********** iiss__lliisstteenniinngg(()) ssssll__lliisstteenn__ppoorrtt(()) lliisstteenn__ppoorrtt(()) ********** │ │ │ │ │ +unsigned short lliisstteenn__ppoorrtt () const; │ │ │ │ │ +bool iiss__lliisstteenniinngg () const; │ │ │ │ │ +unsigned short ssssll__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] │ │ │ │ │ +********** sseett__ppeeeerr__ccllaassss__ffiilltteerr(()) ggeett__ppeeeerr__ccllaassss__ffiilltteerr(()) ********** │ │ │ │ │ +void sseett__ppeeeerr__ccllaassss__ffiilltteerr (ip_filter const& f); │ │ │ │ │ +ip_filter ggeett__ppeeeerr__ccllaassss__ffiilltteerr () const; │ │ │ │ │ +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. │ │ │ │ │ +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: │ │ │ │ │ +ip_filter f = ses.get_peer_class_filter(); │ │ │ │ │ +peer_class_t my_class = ses.create_peer_class("200.1.x.x IP range"); │ │ │ │ │ +f.add_rule(make_address("200.1.1.0"), make_address("200.1.255.255") │ │ │ │ │ + , 1 << static_cast(my_class)); │ │ │ │ │ +ses.set_peer_class_filter(f); │ │ │ │ │ +This setting only applies to new connections, it won't affect existing peer │ │ │ │ │ +connections. │ │ │ │ │ +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. │ │ │ │ │ +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(()) ********** │ │ │ │ │ +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 │ │ │ │ │ + 3. peer-class type filter, adding classes │ │ │ │ │ +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] │ │ │ │ │ +********** ccrreeaattee__ppeeeerr__ccllaassss(()) ********** │ │ │ │ │ +peer_class_t ccrreeaattee__ppeeeerr__ccllaassss (char const* name); │ │ │ │ │ +Creates a new peer class (see _p_e_e_r_ _c_l_a_s_s_e_s) 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. │ │ │ │ │ +Identifiers are assigned from low numbers to higher. So if you plan on using │ │ │ │ │ +certain peer classes in a call to _s_e_t___p_e_e_r___c_l_a_s_s___f_i_l_t_e_r_(_), make sure to create │ │ │ │ │ +those early on, to get low identifiers. │ │ │ │ │ +For more information on peer classes, see _p_e_e_r_ _c_l_a_s_s_e_s. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** ddeelleettee__ppeeeerr__ccllaassss(()) ********** │ │ │ │ │ +void ddeelleettee__ppeeeerr__ccllaassss (peer_class_t cid); │ │ │ │ │ +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 oonnccee per peer class you create. Calling it more than once for the same │ │ │ │ │ +class will lead to memory corruption. │ │ │ │ │ +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. │ │ │ │ │ +There is no need to call this function for custom peer classes. All peer │ │ │ │ │ +classes will be properly destructed when the _s_e_s_s_i_o_n object destructs. │ │ │ │ │ +For more information on peer classes, see _p_e_e_r_ _c_l_a_s_s_e_s. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** ggeett__ppeeeerr__ccllaassss(()) sseett__ppeeeerr__ccllaassss(()) ********** │ │ │ │ │ +peer_class_info ggeett__ppeeeerr__ccllaassss (peer_class_t cid) const; │ │ │ │ │ +void sseett__ppeeeerr__ccllaassss (peer_class_t cid, peer_class_info const& pci); │ │ │ │ │ +These functions queries information from a peer class and updates the │ │ │ │ │ +configuration of a peer class, respectively. │ │ │ │ │ +cid must refer to an existing peer class. If it does not, the return value of │ │ │ │ │ +get_peer_class() is undefined. │ │ │ │ │ +set_peer_class() sets all the information in the _p_e_e_r___c_l_a_s_s___i_n_f_o object in the │ │ │ │ │ +specified peer class. There is no option to only update a single property. │ │ │ │ │ +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. │ │ │ │ │ +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] │ │ │ │ │ +********** rreemmoovvee__ttoorrrreenntt(()) ********** │ │ │ │ │ +void rreemmoovvee__ttoorrrreenntt (const torrent_handle&, remove_flags_t = {}); │ │ │ │ │ +remove_torrent() 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 │ │ │ │ │ +_t_o_r_r_e_n_t___r_e_m_o_v_e_d___a_l_e_r_t. │ │ │ │ │ +_r_e_m_o_v_e___t_o_r_r_e_n_t_(_) is non-blocking, but will remove the torrent from the _s_e_s_s_i_o_n │ │ │ │ │ +synchronously. Calling _s_e_s_s_i_o_n___h_a_n_d_l_e_:_:_a_d_d___t_o_r_r_e_n_t_(_) immediately afterward with │ │ │ │ │ +the same torrent will succeed. Note that this creates a new handle which is not │ │ │ │ │ +equal to the removed one. │ │ │ │ │ +The optional second argument options can be used to delete all the files │ │ │ │ │ +downloaded by this torrent. To do so, pass in the value session_handle:: │ │ │ │ │ +delete_files. Once the torrent is deleted, a _t_o_r_r_e_n_t___d_e_l_e_t_e_d___a_l_e_r_t is posted. │ │ │ │ │ +The _t_o_r_r_e_n_t___h_a_n_d_l_e remains valid for some time after _r_e_m_o_v_e___t_o_r_r_e_n_t_(_) 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, │ │ │ │ │ +_t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_i_s___v_a_l_i_d_(_) will return true, and other calls such as │ │ │ │ │ +_t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_s_t_a_t_u_s_(_) will succeed. Because of this, and because │ │ │ │ │ +_r_e_m_o_v_e___t_o_r_r_e_n_t_(_) is non-blocking, the following sequence usually succeeds (does │ │ │ │ │ +not throw system_error): .. code:: c++ │ │ │ │ │ + session.remove_handle(handle); handle.save_resume_data(); │ │ │ │ │ +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] │ │ │ │ │ +********** aappppllyy__sseettttiinnggss(()) ggeett__sseettttiinnggss(()) ********** │ │ │ │ │ +void aappppllyy__sseettttiinnggss (settings_pack&&); │ │ │ │ │ +settings_pack ggeett__sseettttiinnggss () const; │ │ │ │ │ +void aappppllyy__sseettttiinnggss (settings_pack 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(()) ********** │ │ │ │ │ +void sseett__aalleerrtt__nnoottiiffyy (std::function const& fun); │ │ │ │ │ +alert* wwaaiitt__ffoorr__aalleerrtt (time_duration max_wait); │ │ │ │ │ +void ppoopp__aalleerrttss (std::vector* 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. │ │ │ │ │ +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. │ │ │ │ │ +wait_for_alert will block the current thread for max_wait time duration, or │ │ │ │ │ +until another _a_l_e_r_t is posted. If an _a_l_e_r_t is available at the time of the │ │ │ │ │ +call, it returns immediately. The returned _a_l_e_r_t pointer is the head of the │ │ │ │ │ +_a_l_e_r_t queue. wait_for_alert does not pop alerts from the queue, it merely peeks │ │ │ │ │ +at it. The returned _a_l_e_r_t will stay valid until pop_alerts is called twice. The │ │ │ │ │ +first time will pop it and the second will free it. │ │ │ │ │ +If there is no _a_l_e_r_t in the queue and no _a_l_e_r_t arrives within the specified │ │ │ │ │ +timeout, wait_for_alert returns nullptr. │ │ │ │ │ +In the python binding, wait_for_alert takes the number of milliseconds to wait │ │ │ │ │ +as an integer. │ │ │ │ │ +The _a_l_e_r_t queue in the _s_e_s_s_i_o_n 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 _s_e_s_s_i_o_n, see settings_pack::alert_queue_size. │ │ │ │ │ +Some alerts are considered so important that they are posted even when the │ │ │ │ │ +_a_l_e_r_t queue is full. Some alerts are considered mandatory and cannot be │ │ │ │ │ +disabled by the alert_mask. For instance, _s_a_v_e___r_e_s_u_m_e___d_a_t_a___a_l_e_r_t and │ │ │ │ │ +_s_a_v_e___r_e_s_u_m_e___d_a_t_a___f_a_i_l_e_d___a_l_e_r_t are always posted, regardless of the _a_l_e_r_t mask. │ │ │ │ │ +To control which alerts are posted, set the alert_mask (_s_e_t_t_i_n_g_s___p_a_c_k_:_: │ │ │ │ │ +_a_l_e_r_t___m_a_s_k). │ │ │ │ │ +If the _a_l_e_r_t queue fills up to the point where alerts are dropped, this will be │ │ │ │ │ +indicated by a _a_l_e_r_t_s___d_r_o_p_p_e_d___a_l_e_r_t, which contains a bitmask of which types of │ │ │ │ │ +alerts were dropped. Generally it is a good idea to make sure the _a_l_e_r_t queue │ │ │ │ │ +is large enough, the alert_mask doesn't have unnecessary categories enabled and │ │ │ │ │ +to call pop_alert() frequently, to avoid alerts being dropped. │ │ │ │ │ +the set_alert_notify function lets the client set a function object to be │ │ │ │ │ +invoked every time the _a_l_e_r_t queue goes from having 0 alerts to 1 _a_l_e_r_t. 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 pop_alerts(). If the │ │ │ │ │ +notify function fails to do so, it won't be called again, until pop_alerts 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. │ │ │ │ │ +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 aadddd__ppoorrtt__mmaappppiinngg (portmap_protocol t, int │ │ │ │ │ +external_port, int local_port); │ │ │ │ │ +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 = │ │ │ │ │ +reopen_map_ports); │ │ │ │ │ +Instructs the _s_e_s_s_i_o_n to reopen all listen and outgoing sockets. │ │ │ │ │ +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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** nnaattiivvee__hhaannddllee(()) ********** │ │ │ │ │ +std::shared_ptr nnaattiivvee__hhaannddllee () const; │ │ │ │ │ +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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + save_settings │ │ │ │ │ + saves settings (i.e. the _s_e_t_t_i_n_g_s___p_a_c_k) │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + save_dht_state │ │ │ │ │ + saves dht state such as nodes and node-id, possibly accelerating joining │ │ │ │ │ + the DHT if provided at next _s_e_s_s_i_o_n startup. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + save_extension_state │ │ │ │ │ + load or save state from plugins │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + save_ip_filter │ │ │ │ │ + load or save the IP filter set on the _s_e_s_s_i_o_n │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + global_peer_class_id tcp_peer_class_id local_peer_class_id │ │ │ │ │ + built-in peer classes │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + delete_files │ │ │ │ │ + delete the files belonging to the torrent from disk. including the part- │ │ │ │ │ + file, if there is one │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + delete_partfile │ │ │ │ │ + delete just the part-file associated with this torrent │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + paused │ │ │ │ │ + when set, the _s_e_s_s_i_o_n will start paused. Call _s_e_s_s_i_o_n___h_a_n_d_l_e_:_:_r_e_s_u_m_e_(_) to │ │ │ │ │ + start │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + udp tcp │ │ │ │ │ + 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] │ │ │ │ │ +************ 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&&) noexcept; │ │ │ │ │ + session_proxy& ooppeerraattoorr== (session_proxy&&) & noexcept; │ │ │ │ │ + session_proxy& ooppeerraattoorr== (session_proxy const&) &; │ │ │ │ │ + sseessssiioonn__pprrooxxyy (session_proxy const&); │ │ │ │ │ + sseessssiioonn__pprrooxxyy (); │ │ │ │ │ + ~~sseessssiioonn__pprrooxxyy (); │ │ │ │ │ +}; │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** sseessssiioonn__pprrooxxyy(()) ~~sseessssiioonn__pprrooxxyy(()) ooppeerraattoorr==(()) ********** │ │ │ │ │ +sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept; │ │ │ │ │ +session_proxy& ooppeerraattoorr== (session_proxy&&) & noexcept; │ │ │ │ │ +session_proxy& ooppeerraattoorr== (session_proxy const&) &; │ │ │ │ │ +sseessssiioonn__pprrooxxyy (session_proxy const&); │ │ │ │ │ +sseessssiioonn__pprrooxxyy (); │ │ │ │ │ +~~sseessssiioonn__pprrooxxyy (); │ │ │ │ │ +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 │ │ │ │ │ +will be idle as long it doesn't have any torrents to participate in. │ │ │ │ │ +You have some control over _s_e_s_s_i_o_n configuration through the session_handle:: │ │ │ │ │ +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 (); │ │ │ │ │ + explicit sseessssiioonn (session_params&& params); │ │ │ │ │ + sseessssiioonn (session_params&& params, session_flags_t flags); │ │ │ │ │ + explicit sseessssiioonn (session_params const& params); │ │ │ │ │ + sseessssiioonn (session_params const& params, io_context& ios); │ │ │ │ │ + sseessssiioonn (session_params&& 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_proxy aabboorrtt (); │ │ │ │ │ +}; │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** sseessssiioonn(()) ********** │ │ │ │ │ +sseessssiioonn (session_params const& params, session_flags_t flags); │ │ │ │ │ +sseessssiioonn (); │ │ │ │ │ +explicit sseessssiioonn (session_params&& params); │ │ │ │ │ +sseessssiioonn (session_params&& params, session_flags_t flags); │ │ │ │ │ +explicit sseessssiioonn (session_params const& 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 const& params, io_context& ios); │ │ │ │ │ +sseessssiioonn (session_params&& 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); │ │ │ │ │ +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 │ │ │ │ │ +io_context::run() call mmuusstt have returned before it's safe to destruct the │ │ │ │ │ +_s_e_s_s_i_o_n. Which means you MMUUSSTT call _s_e_s_s_i_o_n_:_:_a_b_o_r_t_(_) and save the _s_e_s_s_i_o_n___p_r_o_x_y │ │ │ │ │ +first, then destruct the _s_e_s_s_i_o_n object, then sync with the io_context, then │ │ │ │ │ +destruct the _s_e_s_s_i_o_n___p_r_o_x_y object. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** ~~sseessssiioonn(()) ********** │ │ │ │ │ +~~sseessssiioonn (); │ │ │ │ │ +The destructor of _s_e_s_s_i_o_n 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 _s_e_s_s_i_o_n returns. So, it's advised that any kind of interface │ │ │ │ │ +(such as windows) are closed before destructing the _s_e_s_s_i_o_n object. Because it │ │ │ │ │ +can take a few second for it to finish. The timeout can be set with │ │ │ │ │ +_a_p_p_l_y___s_e_t_t_i_n_g_s_(_). │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** aabboorrtt(()) ********** │ │ │ │ │ +session_proxy aabboorrtt (); │ │ │ │ │ +In case you want to destruct the _s_e_s_s_i_o_n asynchronously, you can request a │ │ │ │ │ +_s_e_s_s_i_o_n destruction proxy. If you don't do this, the destructor of the _s_e_s_s_i_o_n │ │ │ │ │ +object will block while the trackers are contacted. If you keep one │ │ │ │ │ +session_proxy to the _s_e_s_s_i_o_n when destructing it, the destructor will not │ │ │ │ │ +block, but start to close down the _s_e_s_s_i_o_n, the destructor of the proxy will │ │ │ │ │ +then synchronize the threads. So, the destruction of the _s_e_s_s_i_o_n is performed │ │ │ │ │ +from the session destructor call until the session_proxy destructor call. The │ │ │ │ │ +session_proxy does not have any operations on it (since the _s_e_s_s_i_o_n is being │ │ │ │ │ +closed down, no operations are allowed on it). The only valid operation is │ │ │ │ │ +calling the destructor: │ │ │ │ │ +struct session_proxy {}; │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +************ wwrriittee__sseessssiioonn__ppaarraammss__bbuuff(()) rreeaadd__sseessssiioonn__ppaarraammss(()) 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 (bdecode_node const& e │ │ │ │ │ + , save_state_flags_t flags = save_state_flags_t::all()); │ │ │ │ │ +std::vector wwrriittee__sseessssiioonn__ppaarraammss__bbuuff (session_params const& sp │ │ │ │ │ + , save_state_flags_t flags = save_state_flags_t::all()); │ │ │ │ │ +session_params rreeaadd__sseessssiioonn__ppaarraammss (span 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()); │ │ │ │ │ +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 │ │ │ │ │ +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 sseett__vvaalluuee (int c, std::int64_t value) ; │ │ │ │ │ + void bblleenndd__ssttaattss__ccoouunntteerr (int c, std::int64_t value, int ratio) ; │ │ │ │ │ +}; │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +********** iinncc__ssttaattss__ccoouunntteerr(()) ooppeerraattoorr[[]](()) ********** │ │ │ │ │ +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; │ │ │ │ │ + int value_index; │ │ │ │ │ + metric_type_t type; │ │ │ │ │ +}; │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + name │ │ │ │ │ + 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] │ │ │ │ │ +************ 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 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 │ │ │ │ │ +_p_o_s_t___s_e_s_s_i_o_n___s_t_a_t_s_(_)). │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +************ ffiinndd__mmeettrriicc__iiddxx(()) ************ │ │ │ │ │ +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" │ │ │ │ │ +int ffiinndd__mmeettrriicc__iiddxx (string_view name); │ │ │ │ │ +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 _s_e_s_s_i_o_n___s_t_a_t_s___a_l_e_r_t. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ +************ 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] │ │ │ │ │ +************ 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 ti; │ │ │ │ │ + aux::noexcept_movable> trackers; │ │ │ │ │ + aux::noexcept_movable> tracker_tiers; │ │ │ │ │ + aux::noexcept_movable>> dht_nodes; │ │ │ │ │ + std::string name; │ │ │ │ │ + std::string save_path; │ │ │ │ │ + storage_mode_t ssttoorraaggee__mmooddee = storage_mode_sparse; │ │ │ │ │ + client_data_t userdata; │ │ │ │ │ + aux::noexcept_movable> file_priorities; │ │ │ │ │ std::string trackerid; │ │ │ │ │ - std::vector endpoints; │ │ │ │ │ - std::uint8_t ttiieerr = 0; │ │ │ │ │ - std::uint8_t ffaaiill__lliimmiitt = 0; │ │ │ │ │ - std::uint8_t source:4; │ │ │ │ │ - bool verified:1; │ │ │ │ │ + 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> http_seeds; │ │ │ │ │ + aux::noexcept_movable> url_seeds; │ │ │ │ │ + aux::noexcept_movable> peers; │ │ │ │ │ + aux::noexcept_movable> banned_peers; │ │ │ │ │ + aux::noexcept_movable> unfinished_pieces; │ │ │ │ │ + typed_bitfield have_pieces; │ │ │ │ │ + typed_bitfield verified_pieces; │ │ │ │ │ + aux::noexcept_movable> piece_priorities; │ │ │ │ │ + aux::vector, file_index_t> merkle_trees; │ │ │ │ │ + aux::vector, file_index_t> merkle_tree_mask; │ │ │ │ │ + aux::vector, file_index_t> verified_leaf_hashes; │ │ │ │ │ + aux::noexcept_movable> 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] │ │ │ │ │ -********** aannnnoouunnccee__eennttrryy(()) ooppeerraattoorr==(()) ~~aannnnoouunnccee__eennttrryy(()) ********** │ │ │ │ │ -~~aannnnoouunnccee__eennttrryy (); │ │ │ │ │ -aannnnoouunnccee__eennttrryy (announce_entry const&); │ │ │ │ │ -explicit aannnnoouunnccee__eennttrryy (string_view u); │ │ │ │ │ -announce_entry& ooppeerraattoorr== (announce_entry const&) &; │ │ │ │ │ -aannnnoouunnccee__eennttrryy (); │ │ │ │ │ -constructs a tracker announce _e_n_t_r_y with u as the URL. │ │ │ │ │ + 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] │ │ │ │ │ -********** 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_ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|source_client |2 |the tracker was added programmatically via the | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_d_d___t_r_a_c_k_e_r_(_)_ _f_u_n_c_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_s_o_u_r_c_e___m_a_g_n_e_t___l_i_n_k_|_4_ _ _ _ _|_t_h_e_ _t_r_a_c_k_e_r_ _w_a_s_ _p_a_r_t_ _o_f_ _a_ _m_a_g_n_e_t_ _l_i_n_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|source_tex |8 |the tracker was received from the swarm via tracker| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_x_c_h_a_n_g_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] │ │ │ │ │ - url │ │ │ │ │ - tracker URL as it appeared in the torrent file │ │ │ │ │ + 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 current &trackerid= argument passed to the tracker. this is optional │ │ │ │ │ - and is normally empty (in which case no trackerid is sent). │ │ │ │ │ + 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] │ │ │ │ │ - endpoints │ │ │ │ │ - each local listen socket (endpoint) will announce to the tracker. This │ │ │ │ │ - list contains state per endpoint. │ │ │ │ │ + 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] │ │ │ │ │ - tier │ │ │ │ │ - the tier this tracker belongs to │ │ │ │ │ + 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] │ │ │ │ │ - fail_limit │ │ │ │ │ - the max number of failures to announce to this tracker in a row, before │ │ │ │ │ - this tracker is not used anymore. 0 means unlimited │ │ │ │ │ + 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] │ │ │ │ │ +************ 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; │ │ │ │ │ + operator void ccoonnsstt** () const = delete; │ │ │ │ │ + client_data_t& ooppeerraattoorr== (void*) = delete; │ │ │ │ │ + client_data_t& ooppeerraattoorr== (void const*) = delete; │ │ │ │ │ + │ │ │ │ │ + template ::value>::type> │ │ │ │ │ +}; │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - source │ │ │ │ │ - a bitmask specifying which sources we got this tracker from. │ │ │ │ │ +********** cclliieenntt__ddaattaa__tt(()) ********** │ │ │ │ │ +cclliieenntt__ddaattaa__tt () = default; │ │ │ │ │ +construct a nullptr client data │ │ │ │ │ [_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. │ │ │ │ │ +********** ccoonnsstt**(()) vvooiidd**(()) ooppeerraattoorr==(()) ********** │ │ │ │ │ +operator vvooiidd** () const = delete; │ │ │ │ │ +operator void ccoonnsstt** () const = delete; │ │ │ │ │ +client_data_t& ooppeerraattoorr== (void*) = delete; │ │ │ │ │ +client_data_t& ooppeerraattoorr== (void const*) = delete; │ │ │ │ │ +we don't allow type-unsafe operations │ │ │ │ │ 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 │ │ │ │ │ @@ -11025,34 +8969,34 @@ │ │ │ │ │ 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__hhttttpp__sseeeedd (string_view url); │ │ │ │ │ void aadddd__nnooddee (std::pair 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; │ │ │ │ │ + bool iiss__vv11__oonnllyy () const; │ │ │ │ │ int nnuumm__ppiieecceess () const; │ │ │ │ │ piece_index_t eenndd__ppiieeccee () const; │ │ │ │ │ index_range ppiieeccee__rraannggee () const noexcept; │ │ │ │ │ file_index_t eenndd__ffiillee () const; │ │ │ │ │ index_range ffiillee__rraannggee () const noexcept; │ │ │ │ │ index_range 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; │ │ │ │ │ @@ -11145,17 +9089,17 @@ │ │ │ │ │ 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); │ │ │ │ │ +********** 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] │ │ │ │ │ @@ -11210,24 +9154,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__lleennggtthh(()) ppiieeccee__ssiizzee(()) ********** │ │ │ │ │ -int ppiieeccee__lleennggtthh () const; │ │ │ │ │ +********** ppiieeccee__ssiizzee(()) ppiieeccee__lleennggtthh(()) ********** │ │ │ │ │ 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); │ │ │ │ │ +********** 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 │ │ │ │ │ @@ -11295,1122 +9239,3178 @@ │ │ │ │ │ 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" │ │ │ │ │ +inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p │ │ │ │ │ + , settings_interface const& settings │ │ │ │ │ + , std::function const& f); │ │ │ │ │ +void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p │ │ │ │ │ + , std::function const& f, error_code& ec); │ │ │ │ │ +inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p │ │ │ │ │ + , std::function const& f); │ │ │ │ │ +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 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 const& f, error_code& ec); │ │ │ │ │ -inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p); │ │ │ │ │ -inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p │ │ │ │ │ - , settings_interface const& settings │ │ │ │ │ - , std::function const& f); │ │ │ │ │ -inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p │ │ │ │ │ - , std::function const& f); │ │ │ │ │ -void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p │ │ │ │ │ - , std::function 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. │ │ │ │ │ [_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 │ │ │ │ │ +************ 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 │ │ │ │ │ { │ │ │ │ │ - _t_c_p_:_:_e_n_d_p_o_i_n_t ppeeeerr () const; │ │ │ │ │ - void sseett__ppeeeerr (tcp::endpoint const& ep); │ │ │ │ │ - │ │ │ │ │ - enum block_state_t │ │ │ │ │ - { │ │ │ │ │ - none, │ │ │ │ │ - requested, │ │ │ │ │ - writing, │ │ │ │ │ - finished, │ │ │ │ │ - }; │ │ │ │ │ + explicit iinnffoo__hhaasshh__tt (sha256_hash h2) noexcept; │ │ │ │ │ + iinnffoo__hhaasshh__tt (sha1_hash h1, sha256_hash h2) noexcept; │ │ │ │ │ + explicit iinnffoo__hhaasshh__tt (sha1_hash h1) noexcept; │ │ │ │ │ + iinnffoo__hhaasshh__tt () noexcept = default; │ │ │ │ │ + bool hhaass (protocol_version v) const; │ │ │ │ │ + bool hhaass__vv11 () const; │ │ │ │ │ + bool hhaass__vv22 () 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 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); │ │ │ │ │ │ │ │ │ │ - unsigned bytes_progress:15; │ │ │ │ │ - unsigned block_size:15; │ │ │ │ │ - unsigned state:2; │ │ │ │ │ - unsigned num_peers:14; │ │ │ │ │ + sha1_hash v1; │ │ │ │ │ + sha256_hash v2; │ │ │ │ │ }; │ │ │ │ │ [_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); │ │ │ │ │ -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 | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_e_e_r_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|requested|1 |The block has been requested, but not completely downloaded| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_y_e_t_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|writing |2 |The block has been downloaded and is currently queued for | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_b_e_i_n_g_ _w_r_i_t_t_e_n_ _t_o_ _d_i_s_k_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_f_i_n_i_s_h_e_d_ _|_3_ _ _ _ _|_T_h_e_ _b_l_o_c_k_ _h_a_s_ _b_e_e_n_ _w_r_i_t_t_e_n_ _t_o_ _d_i_s_k_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +********** iinnffoo__hhaasshh__tt(()) ********** │ │ │ │ │ +explicit iinnffoo__hhaasshh__tt (sha256_hash h2) noexcept; │ │ │ │ │ +iinnffoo__hhaasshh__tt (sha1_hash h1, sha256_hash h2) noexcept; │ │ │ │ │ +explicit iinnffoo__hhaasshh__tt (sha1_hash h1) noexcept; │ │ │ │ │ +iinnffoo__hhaasshh__tt () noexcept = default; │ │ │ │ │ +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] │ │ │ │ │ - bytes_progress │ │ │ │ │ - the number of bytes that have been received for this block │ │ │ │ │ +********** hhaass__vv11(()) hhaass(()) hhaass__vv22(()) ********** │ │ │ │ │ +bool hhaass (protocol_version v) const; │ │ │ │ │ +bool hhaass__vv11 () const; │ │ │ │ │ +bool hhaass__vv22 () const; │ │ │ │ │ +returns true if the corresponding info hash is present in this object. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - block_size │ │ │ │ │ - the total number of bytes in this block. │ │ │ │ │ +********** 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] │ │ │ │ │ - state │ │ │ │ │ - the state this block is in (see _b_l_o_c_k___s_t_a_t_e___t) │ │ │ │ │ +********** 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] │ │ │ │ │ - num_peers │ │ │ │ │ - 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. │ │ │ │ │ +********** ffoorr__eeaacchh(()) ********** │ │ │ │ │ +template 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] │ │ │ │ │ -************ ppaarrttiiaall__ppiieeccee__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" │ │ │ │ │ -This class holds information about pieces that have outstanding requests or │ │ │ │ │ -outstanding writes │ │ │ │ │ -struct partial_piece_info │ │ │ │ │ +************ 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 │ │ │ │ │ { │ │ │ │ │ - piece_index_t piece_index; │ │ │ │ │ - int blocks_in_piece; │ │ │ │ │ - int finished; │ │ │ │ │ - int writing; │ │ │ │ │ - int requested; │ │ │ │ │ - block_info const* blocks; │ │ │ │ │ + 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] │ │ │ │ │ - piece_index │ │ │ │ │ - the index of the piece in question. blocks_in_piece 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - blocks_in_piece │ │ │ │ │ - the number of blocks in this piece │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - finished │ │ │ │ │ - the number of blocks that are in the finished state │ │ │ │ │ +********** 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] │ │ │ │ │ - writing │ │ │ │ │ - the number of blocks that are in the writing state │ │ │ │ │ + piece │ │ │ │ │ + The index of the piece in which the range starts. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - requested │ │ │ │ │ - the number of blocks that are in the requested state │ │ │ │ │ + start │ │ │ │ │ + The byte offset within that piece where the range starts. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - blocks │ │ │ │ │ - this is an array of blocks_in_piece number of items. One for each block │ │ │ │ │ - in the piece. │ │ │ │ │ - Warning │ │ │ │ │ - This is a pointer that points to an array that's owned by the _s_e_s_s_i_o_n │ │ │ │ │ - object. The next time _g_e_t___d_o_w_n_l_o_a_d___q_u_e_u_e_(_) is called, it will be │ │ │ │ │ - invalidated. In the case of _p_i_e_c_e___i_n_f_o___a_l_e_r_t, these pointers point into │ │ │ │ │ - the _a_l_e_r_t object itself, and will be invalidated when the _a_l_e_r_t destruct. │ │ │ │ │ + length │ │ │ │ │ + The size of the range, in bytes. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -************ ttoorrrreenntt__hhaannddllee ************ │ │ │ │ │ -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" │ │ │ │ │ -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. │ │ │ │ │ -Warning │ │ │ │ │ -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 │ │ │ │ │ -_t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_s_t_a_t_u_s_(_) call. │ │ │ │ │ -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 invalid_handle. │ │ │ │ │ -Warning │ │ │ │ │ -All operations on a _t_o_r_r_e_n_t___h_a_n_d_l_e may throw system_error exception, in case │ │ │ │ │ -the handle is no longer referring to a torrent. There is one exception _i_s___v_a_l_i_d │ │ │ │ │ -_(_) 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. │ │ │ │ │ -struct torrent_handle │ │ │ │ │ +************ 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 │ │ │ │ │ { │ │ │ │ │ - friend std::size_t hhaasshh__vvaalluuee (torrent_handle const& th); │ │ │ │ │ - ttoorrrreenntt__hhaannddllee () noexcept = default; │ │ │ │ │ - void aadddd__ppiieeccee (piece_index_t piece, std::vector 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& v) const; │ │ │ │ │ - void ppoosstt__ssttaattuuss (status_flags_t flags = status_flags_t::all()) const; │ │ │ │ │ - torrent_status ssttaattuuss (status_flags_t flags = status_flags_t::all()) const; │ │ │ │ │ - void ppoosstt__ddoowwnnllooaadd__qquueeuuee () const; │ │ │ │ │ - std::vector ggeett__ddoowwnnllooaadd__qquueeuuee () const; │ │ │ │ │ - void ggeett__ddoowwnnllooaadd__qquueeuuee (std::vector& queue) 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; │ │ │ │ │ - std::vector ffiillee__pprrooggrreessss (file_progress_flags_t flags = {}) │ │ │ │ │ -const; │ │ │ │ │ - void ppoosstt__ffiillee__pprrooggrreessss (file_progress_flags_t flags) const; │ │ │ │ │ - void ffiillee__pprrooggrreessss (std::vector& progress, │ │ │ │ │ -file_progress_flags_t flags = {}) const; │ │ │ │ │ - std::vector ffiillee__ssttaattuuss () const; │ │ │ │ │ - void cclleeaarr__eerrrroorr () const; │ │ │ │ │ - void aadddd__ttrraacckkeerr (announce_entry const&) const; │ │ │ │ │ - std::vector ttrraacckkeerrss () const; │ │ │ │ │ - void rreeppllaaccee__ttrraacckkeerrss (std::vector const&) const; │ │ │ │ │ - void ppoosstt__ttrraacckkeerrss () const; │ │ │ │ │ - void rreemmoovvee__uurrll__sseeeedd (std::string const& url) const; │ │ │ │ │ - std::set uurrll__sseeeeddss () const; │ │ │ │ │ - void aadddd__uurrll__sseeeedd (std::string const& url) const; │ │ │ │ │ - void rreemmoovvee__hhttttpp__sseeeedd (std::string const& url) const; │ │ │ │ │ - void aadddd__hhttttpp__sseeeedd (std::string const& url) const; │ │ │ │ │ - std::set hhttttpp__sseeeeddss () const; │ │ │ │ │ - void aadddd__eexxtteennssiioonn ( │ │ │ │ │ - std::function(torrent_handle const&, │ │ │ │ │ -client_data_t)> const& ext │ │ │ │ │ - , client_data_t userdata = client_data_t{}); │ │ │ │ │ - bool sseett__mmeettaaddaattaa (span 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; │ │ │ │ │ - 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; │ │ │ │ │ - queue_position_t qquueeuuee__ppoossiittiioonn () const; │ │ │ │ │ - void qquueeuuee__ppoossiittiioonn__bboottttoomm () const; │ │ │ │ │ - void qquueeuuee__ppoossiittiioonn__ttoopp () const; │ │ │ │ │ - void qquueeuuee__ppoossiittiioonn__ddoowwnn () const; │ │ │ │ │ - void qquueeuuee__ppoossiittiioonn__uupp () const; │ │ │ │ │ - void qquueeuuee__ppoossiittiioonn__sseett (queue_position_t p) const; │ │ │ │ │ - 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); │ │ │ │ │ - std::shared_ptr ttoorrrreenntt__ffiillee () const; │ │ │ │ │ - std::shared_ptr ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess () const; │ │ │ │ │ - std::vector> ppiieeccee__llaayyeerrss () const; │ │ │ │ │ - void ppoosstt__ppiieeccee__aavvaaiillaabbiilliittyy () const; │ │ │ │ │ - void ppiieeccee__aavvaaiillaabbiilliittyy (std::vector& avail) const; │ │ │ │ │ - void pprriioorriittiizzee__ppiieecceess (std::vector 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; │ │ │ │ │ - void pprriioorriittiizzee__ppiieecceess (std::vector> const& pieces) const; │ │ │ │ │ - std::vector ggeett__ppiieeccee__pprriioorriittiieess () const; │ │ │ │ │ - std::vector ggeett__ffiillee__pprriioorriittiieess () const; │ │ │ │ │ - void ffiillee__pprriioorriittyy (file_index_t index, download_priority_t priority) const; │ │ │ │ │ - void pprriioorriittiizzee__ffiilleess (std::vector const& files) const; │ │ │ │ │ - download_priority_t ffiillee__pprriioorriittyy (file_index_t index) const; │ │ │ │ │ - void ffoorrccee__ddhhtt__aannnnoouunnccee () const; │ │ │ │ │ - void ffoorrccee__llssdd__aannnnoouunnccee () const; │ │ │ │ │ - void ffoorrccee__rreeaannnnoouunnccee (int seconds = 0, int idx = -1, reannounce_flags_t = │ │ │ │ │ -{}) const; │ │ │ │ │ - void ssccrraappee__ttrraacckkeerr (int idx = -1) const; │ │ │ │ │ - int ddoowwnnllooaadd__lliimmiitt () const; │ │ │ │ │ - void sseett__uuppllooaadd__lliimmiitt (int limit) const; │ │ │ │ │ - void sseett__ddoowwnnllooaadd__lliimmiitt (int limit) const; │ │ │ │ │ - int uuppllooaadd__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; │ │ │ │ │ - int mmaaxx__ccoonnnneeccttiioonnss () const; │ │ │ │ │ - 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; │ │ │ │ │ - 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; │ │ │ │ │ - std::uint32_t iidd () const; │ │ │ │ │ - std::shared_ptr nnaattiivvee__hhaannddllee () const; │ │ │ │ │ - client_data_t uusseerrddaattaa () const; │ │ │ │ │ - bool iinn__sseessssiioonn () const; │ │ │ │ │ + sha256_hash ii22pp__ddeessttiinnaattiioonn () const; │ │ │ │ │ │ │ │ │ │ - static constexpr add_piece_flags_t oovveerrwwrriittee__eexxiissttiinngg = 0_bit; │ │ │ │ │ - static constexpr status_flags_t qquueerryy__ddiissttrriibbuutteedd__ccooppiieess = 0_bit; │ │ │ │ │ - static constexpr status_flags_t qquueerryy__aaccccuurraattee__ddoowwnnllooaadd__ccoouunntteerrss = 1_bit; │ │ │ │ │ - static constexpr status_flags_t qquueerryy__llaasstt__sseeeenn__ccoommpplleettee = 2_bit; │ │ │ │ │ - static constexpr status_flags_t qquueerryy__ppiieecceess = 3_bit; │ │ │ │ │ - static constexpr status_flags_t qquueerryy__vveerriiffiieedd__ppiieecceess = 4_bit; │ │ │ │ │ - static constexpr status_flags_t qquueerryy__ttoorrrreenntt__ffiillee = 5_bit; │ │ │ │ │ - static constexpr status_flags_t qquueerryy__nnaammee = 6_bit; │ │ │ │ │ - static constexpr status_flags_t qquueerryy__ssaavvee__ppaatthh = 7_bit; │ │ │ │ │ - static constexpr deadline_flags_t aalleerrtt__wwhheenn__aavvaaiillaabbllee = 0_bit; │ │ │ │ │ - static constexpr file_progress_flags_t ppiieeccee__ggrraannuullaarriittyy = 0_bit; │ │ │ │ │ - static constexpr pause_flags_t ggrraacceeffuull__ppaauussee = 0_bit; │ │ │ │ │ - static constexpr resume_data_flags_t fflluusshh__ddiisskk__ccaacchhee = 0_bit; │ │ │ │ │ - static constexpr resume_data_flags_t ssaavvee__iinnffoo__ddiicctt = 1_bit; │ │ │ │ │ - static constexpr resume_data_flags_t oonnllyy__iiff__mmooddiiffiieedd = 2_bit; │ │ │ │ │ - static constexpr resume_data_flags_t iiff__ccoouunntteerrss__cchhaannggeedd = 3_bit; │ │ │ │ │ - static constexpr resume_data_flags_t iiff__ddoowwnnllooaadd__pprrooggrreessss = 4_bit; │ │ │ │ │ - static constexpr resume_data_flags_t iiff__ccoonnffiigg__cchhaannggeedd = 5_bit; │ │ │ │ │ - static constexpr resume_data_flags_t iiff__ssttaattee__cchhaannggeedd = 6_bit; │ │ │ │ │ - static constexpr resume_data_flags_t iiff__mmeettaaddaattaa__cchhaannggeedd = 7_bit; │ │ │ │ │ - static constexpr reannounce_flags_t iiggnnoorree__mmiinn__iinntteerrvvaall = 0_bit; │ │ │ │ │ + std::string client; │ │ │ │ │ + typed_bitfield 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] │ │ │ │ │ -********** ttoorrrreenntt__hhaannddllee(()) ********** │ │ │ │ │ -ttoorrrreenntt__hhaannddllee () noexcept = default; │ │ │ │ │ -constructs a torrent handle that does not refer to a torrent. i.e. _i_s___v_a_l_i_d_(_) │ │ │ │ │ -will return false. │ │ │ │ │ +********** 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] │ │ │ │ │ -********** aadddd__ppiieeccee(()) ********** │ │ │ │ │ -void aadddd__ppiieeccee (piece_index_t piece, std::vector data, add_piece_flags_t │ │ │ │ │ -flags = {}) const; │ │ │ │ │ -void aadddd__ppiieeccee (piece_index_t piece, char const* data, add_piece_flags_t flags │ │ │ │ │ -= {}) const; │ │ │ │ │ -This function will write data to the storage as piece piece, as if it had been │ │ │ │ │ -downloaded from a peer. │ │ │ │ │ -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. │ │ │ │ │ -Since the data is written asynchronously, you may know that is passed or failed │ │ │ │ │ -the hash check by waiting for _p_i_e_c_e___f_i_n_i_s_h_e_d___a_l_e_r_t or _h_a_s_h___f_a_i_l_e_d___a_l_e_r_t. │ │ │ │ │ -Adding pieces while the torrent is being checked (i.e. in _t_o_r_r_e_n_t___s_t_a_t_u_s_:_: │ │ │ │ │ -_c_h_e_c_k_i_n_g___f_i_l_e_s state) is not supported. │ │ │ │ │ -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. data is expected to point to a buffer of as many bytes as the size of │ │ │ │ │ -the specified piece. See _f_i_l_e___s_t_o_r_a_g_e_:_:_p_i_e_c_e___s_i_z_e_(_). │ │ │ │ │ -The data in the buffer is copied and passed on to the disk IO thread to be │ │ │ │ │ -written at a later point. │ │ │ │ │ -The overload taking a std::vector is not blocking, it will send the │ │ │ │ │ -buffer to the main thread and return immediately. │ │ │ │ │ + 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] │ │ │ │ │ -********** rreeaadd__ppiieeccee(()) ********** │ │ │ │ │ -void rreeaadd__ppiieeccee (piece_index_t piece) const; │ │ │ │ │ -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. │ │ │ │ │ -When the read operation is completed, it is passed back through an _a_l_e_r_t, │ │ │ │ │ -_r_e_a_d___p_i_e_c_e___a_l_e_r_t. 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. │ │ │ │ │ -Note that if you read multiple pieces, the read operations are not guaranteed │ │ │ │ │ -to finish in the same order as you initiated them. │ │ │ │ │ + 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] │ │ │ │ │ -********** 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. │ │ │ │ │ + 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] │ │ │ │ │ -********** ggeett__ppeeeerr__iinnffoo(()) ppoosstt__ppeeeerr__iinnffoo(()) ********** │ │ │ │ │ -void ppoosstt__ppeeeerr__iinnffoo () const; │ │ │ │ │ -void ggeett__ppeeeerr__iinnffoo (std::vector& 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, │ │ │ │ │ -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. │ │ │ │ │ + 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] │ │ │ │ │ -********** ppoosstt__ssttaattuuss(()) ssttaattuuss(()) ********** │ │ │ │ │ -void ppoosstt__ssttaattuuss (status_flags_t flags = status_flags_t::all()) const; │ │ │ │ │ -torrent_status 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 │ │ │ │ │ -issues), you can filter them out. │ │ │ │ │ -The status() function will block until the internal libtorrent thread responds │ │ │ │ │ -with the _t_o_r_r_e_n_t___s_t_a_t_u_s object. To avoid blocking, instead call post_status(). │ │ │ │ │ -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. │ │ │ │ │ + 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] │ │ │ │ │ -********** ppoosstt__ddoowwnnllooaadd__qquueeuuee(()) ggeett__ddoowwnnllooaadd__qquueeuuee(()) ********** │ │ │ │ │ -void ppoosstt__ddoowwnnllooaadd__qquueeuuee () const; │ │ │ │ │ -std::vector ggeett__ddoowwnnllooaadd__qquueeuuee () const; │ │ │ │ │ -void ggeett__ddoowwnnllooaadd__qquueeuuee (std::vector& 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. │ │ │ │ │ + interesting │ │ │ │ │ + wwee are interested in pieces from this peer. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** rreesseett__ppiieeccee__ddeeaaddlliinnee(()) sseett__ppiieeccee__ddeeaaddlliinnee(()) cclleeaarr__ppiieeccee__ddeeaaddlliinneess(()) ********** │ │ │ │ │ -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, │ │ │ │ │ -unless the alert_when_available flag is set, in which case it will have the │ │ │ │ │ -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. │ │ │ │ │ + choked │ │ │ │ │ + wwee have choked this peer. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ppoosstt__ffiillee__pprrooggrreessss(()) ffiillee__pprrooggrreessss(()) ********** │ │ │ │ │ -std::vector ffiillee__pprrooggrreessss (file_progress_flags_t flags = {}) │ │ │ │ │ -const; │ │ │ │ │ -void ppoosstt__ffiillee__pprrooggrreessss (file_progress_flags_t flags) const; │ │ │ │ │ -void ffiillee__pprrooggrreessss (std::vector& 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 │ │ │ │ │ -progress. If left at the default value of 0, the progress will be as accurate │ │ │ │ │ -as possible, but also more expensive to calculate. If torrent_handle:: │ │ │ │ │ -piece_granularity 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. │ │ │ │ │ + remote_interested │ │ │ │ │ + the peer is interested in uuss │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ffiillee__ssttaattuuss(()) ********** │ │ │ │ │ -std::vector ffiillee__ssttaattuuss () const; │ │ │ │ │ -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. │ │ │ │ │ -See _o_p_e_n___f_i_l_e___s_t_a_t_e │ │ │ │ │ + remote_choked │ │ │ │ │ + the peer has choked uuss. │ │ │ │ │ [_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. │ │ │ │ │ + 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] │ │ │ │ │ -********** ttrraacckkeerrss(()) ppoosstt__ttrraacckkeerrss(()) rreeppllaaccee__ttrraacckkeerrss(()) aadddd__ttrraacckkeerr(()) ********** │ │ │ │ │ -void aadddd__ttrraacckkeerr (announce_entry const&) const; │ │ │ │ │ -std::vector ttrraacckkeerrss () const; │ │ │ │ │ -void rreeppllaaccee__ttrraacckkeerrss (std::vector 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, │ │ │ │ │ -you have to call _f_o_r_c_e___r_e_a_n_n_o_u_n_c_e_(_). See _a_n_n_o_u_n_c_e___e_n_t_r_y. │ │ │ │ │ -post_trackers() is the asynchronous version of trackers(). It will trigger a │ │ │ │ │ -_t_r_a_c_k_e_r___l_i_s_t___a_l_e_r_t 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 _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. │ │ │ │ │ + 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] │ │ │ │ │ -********** uurrll__sseeeeddss(()) aadddd__uurrll__sseeeedd(()) rreemmoovvee__uurrll__sseeeedd(()) ********** │ │ │ │ │ -void rreemmoovvee__uurrll__sseeeedd (std::string const& url) const; │ │ │ │ │ -std::set 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. │ │ │ │ │ + local_connection │ │ │ │ │ + deprecated synonym for outgoing_connection │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** hhttttpp__sseeeeddss(()) aadddd__hhttttpp__sseeeedd(()) rreemmoovvee__hhttttpp__sseeeedd(()) ********** │ │ │ │ │ -void rreemmoovvee__hhttttpp__sseeeedd (std::string const& url) const; │ │ │ │ │ -void aadddd__hhttttpp__sseeeedd (std::string const& url) const; │ │ │ │ │ -std::set 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. │ │ │ │ │ + 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] │ │ │ │ │ -********** aadddd__eexxtteennssiioonn(()) ********** │ │ │ │ │ -void aadddd__eexxtteennssiioonn ( │ │ │ │ │ - std::function(torrent_handle const&, │ │ │ │ │ -client_data_t)> const& ext │ │ │ │ │ - , client_data_t userdata = client_data_t{}); │ │ │ │ │ -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 _t_o_r_r_e_n_t___p_l_u_g_i_n instance. │ │ │ │ │ + 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] │ │ │ │ │ -********** sseett__mmeettaaddaattaa(()) ********** │ │ │ │ │ -bool sseett__mmeettaaddaattaa (span metadata) const; │ │ │ │ │ -set_metadata expects the iinnffoo section of metadata. i.e. The buffer passed in │ │ │ │ │ -will be hashed and verified against the info-hash. If it fails, a │ │ │ │ │ -metadata_failed_alert will be generated. If it passes, a │ │ │ │ │ -metadata_received_alert 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. │ │ │ │ │ + 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] │ │ │ │ │ -********** iiss__vvaalliidd(()) ********** │ │ │ │ │ -bool iiss__vvaalliidd () const; │ │ │ │ │ -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 │ │ │ │ │ -_s_e_s_s_i_o_n AND destructed. │ │ │ │ │ -To tell if the _t_o_r_r_e_n_t___h_a_n_d_l_e is in the _s_e_s_s_i_o_n, use _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_i_n___s_e_s_s_i_o_n │ │ │ │ │ -_(_). This will return true before _s_e_s_s_i_o_n___h_a_n_d_l_e_:_:_r_e_m_o_v_e___t_o_r_r_e_n_t_(_) is called, │ │ │ │ │ -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. │ │ │ │ │ + seed │ │ │ │ │ + This peer is a seed (it has all the pieces). │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** rreessuummee(()) ppaauussee(()) ********** │ │ │ │ │ -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. │ │ │ │ │ -For possible values of the flags parameter, see pause_flags_t. │ │ │ │ │ -To know if a torrent is paused or not, call torrent_handle::flags() and check │ │ │ │ │ -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. │ │ │ │ │ + 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] │ │ │ │ │ -********** ffllaaggss(()) sseett__ffllaaggss(()) uunnsseett__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; │ │ │ │ │ -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 │ │ │ │ │ -added, and it can only be set as part of the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s flags, when │ │ │ │ │ -adding the torrent. │ │ │ │ │ + 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] │ │ │ │ │ -********** fflluusshh__ccaacchhee(()) ********** │ │ │ │ │ -void fflluusshh__ccaacchhee () const; │ │ │ │ │ -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 _c_a_c_h_e___f_l_u_s_h_e_d___a_l_e_r_t. │ │ │ │ │ -Note that by the time you get the _a_l_e_r_t, libtorrent may have cached more data │ │ │ │ │ -for the torrent, but you are guaranteed that whatever cached data libtorrent │ │ │ │ │ -had by the time you called torrent_handle::flush_cache() has been written to │ │ │ │ │ -disk. │ │ │ │ │ + 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] │ │ │ │ │ -********** ffoorrccee__rreecchheecckk(()) ********** │ │ │ │ │ -void ffoorrccee__rreecchheecckk () const; │ │ │ │ │ -force_recheck 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 _s_e_s_s_i_o_n. │ │ │ │ │ + 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] │ │ │ │ │ -********** ssaavvee__rreessuummee__ddaattaa(()) ********** │ │ │ │ │ -void ssaavvee__rreessuummee__ddaattaa (resume_data_flags_t flags = {}) const; │ │ │ │ │ -save_resume_data() asks libtorrent to generate fast-resume data for this │ │ │ │ │ -torrent. The fast resume data (stored in an _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object) can be │ │ │ │ │ -used to resume a torrent in the next _s_e_s_s_i_o_n without having to check all files │ │ │ │ │ -for which pieces have been downloaded. It can also be used to save a .torrent │ │ │ │ │ -file for a _t_o_r_r_e_n_t___h_a_n_d_l_e. │ │ │ │ │ -This operation is asynchronous, save_resume_data will return immediately. The │ │ │ │ │ -resume data is delivered when it's done through a _s_a_v_e___r_e_s_u_m_e___d_a_t_a___a_l_e_r_t. │ │ │ │ │ -The operation will fail, and post a _s_a_v_e___r_e_s_u_m_e___d_a_t_a___f_a_i_l_e_d___a_l_e_r_t instead, in │ │ │ │ │ -the following cases: │ │ │ │ │ - 1. The torrent is in the process of being removed. │ │ │ │ │ - 2. No torrent state has changed since the last saving of resume │ │ │ │ │ - data, and the only_if_modified flag is set. metadata (see │ │ │ │ │ - libtorrent's _m_e_t_a_d_a_t_a_ _f_r_o_m_ _p_e_e_r_s extension) │ │ │ │ │ -Note that some _c_o_u_n_t_e_r_s may be outdated by the time you receive the fast resume │ │ │ │ │ -data │ │ │ │ │ -When saving resume data because of shutting down, make sure not to │ │ │ │ │ -_r_e_m_o_v_e___t_o_r_r_e_n_t_(_) before you receive the _s_a_v_e___r_e_s_u_m_e___d_a_t_a___a_l_e_r_t. There's no need │ │ │ │ │ -to pause the _s_e_s_s_i_o_n or torrent when saving resume data. │ │ │ │ │ -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. │ │ │ │ │ -Note │ │ │ │ │ -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. │ │ │ │ │ -Example code to pause and save resume data for all torrents and wait for the │ │ │ │ │ -alerts: │ │ │ │ │ -extern int outstanding_resume_data; // global counter of outstanding resume │ │ │ │ │ -data │ │ │ │ │ -std::vector handles = ses.get_torrents(); │ │ │ │ │ -for (torrent_handle const& h : handles) try │ │ │ │ │ -{ │ │ │ │ │ - h.save_resume_data(torrent_handle::only_if_modified); │ │ │ │ │ - ++outstanding_resume_data; │ │ │ │ │ -} │ │ │ │ │ -catch (lt::system_error const& 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. │ │ │ │ │ +[_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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + utp_socket │ │ │ │ │ + indicates that this socket is a uTP socket │ │ │ │ │ +[_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 │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + rc4_encrypted │ │ │ │ │ + this connection is obfuscated with RC4 │ │ │ │ │ +[_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 │ │ │ │ │ +[_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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + tracker │ │ │ │ │ + The peer was received from the tracker. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + dht │ │ │ │ │ + The peer was received from the kademlia DHT. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + pex │ │ │ │ │ + The peer was received from the peer exchange extension. │ │ │ │ │ +[_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). │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + resume_data │ │ │ │ │ + The peer was added from the fast resume data. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + incoming │ │ │ │ │ + we received an incoming connection from this peer │ │ │ │ │ +[_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. │ │ │ │ │ +[_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 │ │ │ │ │ +[_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 │ │ │ │ │ +[_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()_ │ │ │ │ │ +[_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. │ │ │ │ │ +[_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. │ │ │ │ │ +[_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. │ │ │ │ │ +[_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. │ │ │ │ │ +[_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] │ │ │ │ │ +************ 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 │ │ │ │ │ { │ │ │ │ │ - // the handle was invalid, ignore this one and move to the next │ │ │ │ │ -} │ │ │ │ │ + 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; │ │ │ │ │ │ │ │ │ │ -while (outstanding_resume_data > 0) │ │ │ │ │ + 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] │ │ │ │ │ +************ 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_handle const& handle); │ │ │ │ │ +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. │ │ │ │ │ +[_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. │ │ │ │ │ +[_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); │ │ │ │ │ +[_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__ppaarrsseedd ( │ │ │ │ │ + bdecode_node const& torrent_file); │ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr ( │ │ │ │ │ + span buffer); │ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__bbuuffffeerr ( │ │ │ │ │ + span buffer, 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__ffiillee ( │ │ │ │ │ + std::string const& filename); │ │ │ │ │ +add_torrent_params llooaadd__ttoorrrreenntt__ffiillee ( │ │ │ │ │ + std::string const& filename, 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] │ │ │ │ │ +************ 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: │ │ │ │ │ +"..." │ │ │ │ │ +[_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 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 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] │ │ │ │ │ +************ 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] │ │ │ │ │ +************ 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] │ │ │ │ │ +************ 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] │ │ │ │ │ +************ 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] │ │ │ │ │ +************ 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 │ │ │ │ │ { │ │ │ │ │ - alert const* a = ses.wait_for_alert(seconds(30)); │ │ │ │ │ - │ │ │ │ │ - // if we don't get an alert within 30 seconds, abort │ │ │ │ │ - if (a == nullptr) break; │ │ │ │ │ - │ │ │ │ │ - std::vector alerts; │ │ │ │ │ - ses.pop_alerts(&alerts); │ │ │ │ │ - │ │ │ │ │ - for (alert* i : alerts) │ │ │ │ │ - { │ │ │ │ │ - if (alert_cast(i)) │ │ │ │ │ - { │ │ │ │ │ - process_alert(i); │ │ │ │ │ - --outstanding_resume_data; │ │ │ │ │ - continue; │ │ │ │ │ - } │ │ │ │ │ + bool ooppeerraattoorr==== (torrent_status const& st) const; │ │ │ │ │ │ │ │ │ │ - save_resume_data_alert const* rd = │ │ │ │ │ -alert_cast(i); │ │ │ │ │ - if (rd == nullptr) │ │ │ │ │ - { │ │ │ │ │ - process_alert(i); │ │ │ │ │ - continue; │ │ │ │ │ - } │ │ │ │ │ + enum state_t │ │ │ │ │ + { │ │ │ │ │ + checking_files, │ │ │ │ │ + downloading_metadata, │ │ │ │ │ + downloading, │ │ │ │ │ + finished, │ │ │ │ │ + seeding, │ │ │ │ │ + unused_enum_for_backwards_compatibility_allocating, │ │ │ │ │ + checking_resume_data, │ │ │ │ │ + }; │ │ │ │ │ │ │ │ │ │ - std::ofstream out((rd->params.save_path │ │ │ │ │ - + "/" + rd->params.name + ".fastresume").c_str() │ │ │ │ │ - , std::ios_base::binary); │ │ │ │ │ - std::vector buf = write_resume_data_buf(rd->params); │ │ │ │ │ - out.write(buf.data(), buf.size()); │ │ │ │ │ - --outstanding_resume_data; │ │ │ │ │ - } │ │ │ │ │ -} │ │ │ │ │ -Note │ │ │ │ │ -Note how outstanding_resume_data 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_l_e_r_t, 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. │ │ │ │ │ + torrent_handle handle; │ │ │ │ │ + error_code errc; │ │ │ │ │ + file_index_t eerrrroorr__ffiillee = torrent_status::error_file_none; │ │ │ │ │ + static constexpr file_index_t eerrrroorr__ffiillee__nnoonnee {-1}; │ │ │ │ │ + static constexpr file_index_t eerrrroorr__ffiillee__ssssll__ccttxx {-3}; │ │ │ │ │ + static constexpr file_index_t eerrrroorr__ffiillee__mmeettaaddaattaa {-4}; │ │ │ │ │ + static constexpr file_index_t eerrrroorr__ffiillee__eexxcceeppttiioonn {-5}; │ │ │ │ │ + static constexpr file_index_t eerrrroorr__ffiillee__ppaarrttffiillee {-6}; │ │ │ │ │ + std::string save_path; │ │ │ │ │ + std::string name; │ │ │ │ │ + std::weak_ptr torrent_file; │ │ │ │ │ + time_duration nneexxtt__aannnnoouunnccee = seconds{0}; │ │ │ │ │ + std::string current_tracker; │ │ │ │ │ + std::int64_t ttoottaall__ddoowwnnllooaadd = 0; │ │ │ │ │ + std::int64_t ttoottaall__uuppllooaadd = 0; │ │ │ │ │ + std::int64_t ttoottaall__ppaayyllooaadd__ddoowwnnllooaadd = 0; │ │ │ │ │ + std::int64_t ttoottaall__ppaayyllooaadd__uuppllooaadd = 0; │ │ │ │ │ + std::int64_t ttoottaall__ffaaiilleedd__bbyytteess = 0; │ │ │ │ │ + std::int64_t ttoottaall__rreedduunnddaanntt__bbyytteess = 0; │ │ │ │ │ + typed_bitfield pieces; │ │ │ │ │ + typed_bitfield verified_pieces; │ │ │ │ │ + std::int64_t ttoottaall__ddoonnee = 0; │ │ │ │ │ + std::int64_t ttoottaall = 0; │ │ │ │ │ + std::int64_t ttoottaall__wwaanntteedd__ddoonnee = 0; │ │ │ │ │ + std::int64_t ttoottaall__wwaanntteedd = 0; │ │ │ │ │ + std::int64_t aallll__ttiimmee__uuppllooaadd = 0; │ │ │ │ │ + std::int64_t aallll__ttiimmee__ddoowwnnllooaadd = 0; │ │ │ │ │ + std::time_t aaddddeedd__ttiimmee = 0; │ │ │ │ │ + std::time_t ccoommpplleetteedd__ttiimmee = 0; │ │ │ │ │ + std::time_t llaasstt__sseeeenn__ccoommpplleettee = 0; │ │ │ │ │ + storage_mode_t ssttoorraaggee__mmooddee = storage_mode_sparse; │ │ │ │ │ + float pprrooggrreessss = 0.f; │ │ │ │ │ + int pprrooggrreessss__ppppmm = 0; │ │ │ │ │ + queue_position_t qquueeuuee__ppoossiittiioonn {}; │ │ │ │ │ + int ddoowwnnllooaadd__rraattee = 0; │ │ │ │ │ + int uuppllooaadd__rraattee = 0; │ │ │ │ │ + int ddoowwnnllooaadd__ppaayyllooaadd__rraattee = 0; │ │ │ │ │ + int uuppllooaadd__ppaayyllooaadd__rraattee = 0; │ │ │ │ │ + int nnuumm__sseeeeddss = 0; │ │ │ │ │ + int nnuumm__ppeeeerrss = 0; │ │ │ │ │ + int nnuumm__ccoommpplleettee = -1; │ │ │ │ │ + int nnuumm__iinnccoommpplleettee = -1; │ │ │ │ │ + int lliisstt__sseeeeddss = 0; │ │ │ │ │ + int lliisstt__ppeeeerrss = 0; │ │ │ │ │ + int ccoonnnneecctt__ccaannddiiddaatteess = 0; │ │ │ │ │ + int nnuumm__ppiieecceess = 0; │ │ │ │ │ + int ddiissttrriibbuutteedd__ffuullll__ccooppiieess = 0; │ │ │ │ │ + int ddiissttrriibbuutteedd__ffrraaccttiioonn = 0; │ │ │ │ │ + float ddiissttrriibbuutteedd__ccooppiieess = 0.f; │ │ │ │ │ + int bblloocckk__ssiizzee = 0; │ │ │ │ │ + int nnuumm__uuppllooaaddss = 0; │ │ │ │ │ + int nnuumm__ccoonnnneeccttiioonnss = 0; │ │ │ │ │ + int uuppllooaaddss__lliimmiitt = 0; │ │ │ │ │ + int ccoonnnneeccttiioonnss__lliimmiitt = 0; │ │ │ │ │ + int uupp__bbaannddwwiiddtthh__qquueeuuee = 0; │ │ │ │ │ + int ddoowwnn__bbaannddwwiiddtthh__qquueeuuee = 0; │ │ │ │ │ + int sseeeedd__rraannkk = 0; │ │ │ │ │ + state_t ssttaattee = checking_resume_data; │ │ │ │ │ + bool nneeeedd__ssaavvee__rreessuummee = false; │ │ │ │ │ + bool iiss__sseeeeddiinngg = false; │ │ │ │ │ + bool iiss__ffiinniisshheedd = false; │ │ │ │ │ + bool hhaass__mmeettaaddaattaa = false; │ │ │ │ │ + bool hhaass__iinnccoommiinngg = false; │ │ │ │ │ + bool mmoovviinngg__ssttoorraaggee = false; │ │ │ │ │ + bool aannnnoouunncciinngg__ttoo__ttrraacckkeerrss = false; │ │ │ │ │ + bool aannnnoouunncciinngg__ttoo__llssdd = false; │ │ │ │ │ + bool aannnnoouunncciinngg__ttoo__ddhhtt = 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 ffllaaggss {}; │ │ │ │ │ +}; │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** nneeeedd__ssaavvee__rreessuummee__ddaattaa(()) ********** │ │ │ │ │ -bool nneeeedd__ssaavvee__rreessuummee__ddaattaa (resume_data_flags_t flags) const; │ │ │ │ │ -bool nneeeedd__ssaavvee__rreessuummee__ddaattaa () const; │ │ │ │ │ -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 │ │ │ │ │ -flags let you ask if specific categories of properties have changed. These │ │ │ │ │ -flags have the same behavior as in the _s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_) call. │ │ │ │ │ -This is a bblloocckkiinngg call. It will wait for a response from libtorrent's main │ │ │ │ │ -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. │ │ │ │ │ +********** ooppeerraattoorr====(()) ********** │ │ │ │ │ +bool ooppeerraattoorr==== (torrent_status const& st) const; │ │ │ │ │ +compares if the torrent status objects come from the same torrent. i.e. only │ │ │ │ │ +the _t_o_r_r_e_n_t___h_a_n_d_l_e field is compared. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** qquueeuuee__ppoossiittiioonn(()) qquueeuuee__ppoossiittiioonn__uupp(()) qquueeuuee__ppoossiittiioonn__bboottttoomm(()) │ │ │ │ │ -qquueeuuee__ppoossiittiioonn__ttoopp(()) qquueeuuee__ppoossiittiioonn__ddoowwnn(()) ********** │ │ │ │ │ -queue_position_t qquueeuuee__ppoossiittiioonn () const; │ │ │ │ │ -void qquueeuuee__ppoossiittiioonn__bboottttoomm () const; │ │ │ │ │ -void qquueeuuee__ppoossiittiioonn__ttoopp () const; │ │ │ │ │ -void qquueeuuee__ppoossiittiioonn__ddoowwnn () 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 │ │ │ │ │ -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. │ │ │ │ │ -The queue position is also available in the _t_o_r_r_e_n_t___s_t_a_t_u_s. │ │ │ │ │ -The queue_position_*() 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. │ │ │ │ │ +********** eennuumm ssttaattee__tt ********** │ │ │ │ │ +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" │ │ │ │ │ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ │ │ │ │ │ +|_nn_aa_mm_ee_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_vv_aa_ll_uu_ee_|_dd_ee_ss_cc_rr_ii_pp_tt_ii_oo_nn_ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The torrent has not | │ │ │ │ │ +| | |started its download| │ │ │ │ │ +|checking_files |1 |yet, and is | │ │ │ │ │ +| | |currently checking | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_x_i_s_t_i_n_g_ _f_i_l_e_s_._ _ _ _ _ | │ │ │ │ │ +| | |The torrent is | │ │ │ │ │ +| | |trying to download | │ │ │ │ │ +|downloading_metadata |2 |metadata from peers.| │ │ │ │ │ +| | |This implies the | │ │ │ │ │ +| | |ut_metadata | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_e_x_t_e_n_s_i_o_n_ _i_s_ _i_n_ _u_s_e_.| │ │ │ │ │ +| | |The torrent is being| │ │ │ │ │ +| | |downloaded. This is | │ │ │ │ │ +| | |the state most | │ │ │ │ │ +| | |torrents will be in | │ │ │ │ │ +|downloading |3 |most of the time. | │ │ │ │ │ +| | |The progress meter | │ │ │ │ │ +| | |will tell how much | │ │ │ │ │ +| | |of the files that | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_h_a_s_ _b_e_e_n_ _d_o_w_n_l_o_a_d_e_d_.| │ │ │ │ │ +| | |In this state the | │ │ │ │ │ +| | |torrent has finished| │ │ │ │ │ +| | |downloading but | │ │ │ │ │ +|finished |4 |still doesn't have | │ │ │ │ │ +| | |the entire torrent. | │ │ │ │ │ +| | |i.e. some pieces are| │ │ │ │ │ +| | |filtered and won't | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_g_e_t_ _d_o_w_n_l_o_a_d_e_d_._ _ _ _ _ | │ │ │ │ │ +| | |In this state the | │ │ │ │ │ +|seeding |5 |torrent has finished| │ │ │ │ │ +| | |downloading and is a| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_p_u_r_e_ _s_e_e_d_e_r_._ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |If the torrent was | │ │ │ │ │ +| | |started in full | │ │ │ │ │ +| | |allocation mode, | │ │ │ │ │ +|unused_enum_for_backwards_compatibility_allocating|6 |this indicates that | │ │ │ │ │ +| | |the (disk) storage | │ │ │ │ │ +| | |for the torrent is | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_a_l_l_o_c_a_t_e_d_._ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |The torrent is | │ │ │ │ │ +| | |currently checking | │ │ │ │ │ +| | |the fast resume data| │ │ │ │ │ +| | |and comparing it to | │ │ │ │ │ +| | |the files on disk. | │ │ │ │ │ +|checking_resume_data |7 |This is typically | │ │ │ │ │ +| | |completed in a | │ │ │ │ │ +| | |fraction of a | │ │ │ │ │ +| | |second, but if you | │ │ │ │ │ +| | |add a large number | │ │ │ │ │ +| | |of torrents at once,| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _|_t_h_e_y_ _w_i_l_l_ _q_u_e_u_e_ _u_p_._ | │ │ │ │ │ [_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 │ │ │ │ │ + handle │ │ │ │ │ + a handle to the torrent whose status the object represents. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** 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. │ │ │ │ │ -private_key is a path to the private key for the specified certificate. This │ │ │ │ │ -must be in .pem format. │ │ │ │ │ -dh_params 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: │ │ │ │ │ -openssl dhparam -outform PEM -out dhparams.pem 512. │ │ │ │ │ -passphrase may be specified if the private key is encrypted and requires a │ │ │ │ │ -passphrase to be decrypted. │ │ │ │ │ -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. │ │ │ │ │ + errc │ │ │ │ │ + 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ttoorrrreenntt__ffiillee(()) ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess(()) ********** │ │ │ │ │ -std::shared_ptr ttoorrrreenntt__ffiillee () const; │ │ │ │ │ -std::shared_ptr ttoorrrreenntt__ffiillee__wwiitthh__hhaasshheess () 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, │ │ │ │ │ -dht nodes and trackers. A _t_o_r_r_e_n_t___i_n_f_o object does not round-trip cleanly when │ │ │ │ │ -added to a _s_e_s_s_i_o_n. │ │ │ │ │ -If you want to save a .torrent file from the _t_o_r_r_e_n_t___h_a_n_d_l_e, instead call │ │ │ │ │ -_s_a_v_e___r_e_s_u_m_e___d_a_t_a_(_) and _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_) the _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object │ │ │ │ │ -passed back in the _a_l_e_r_t. │ │ │ │ │ -_t_o_r_r_e_n_t___f_i_l_e___w_i_t_h___h_a_s_h_e_s_(_) returns a ccooppyy of the internal _t_o_r_r_e_n_t___i_n_f_o 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 _t_o_r_r_e_n_t___f_i_l_e_(_) since it needs to make copies of │ │ │ │ │ -this information. │ │ │ │ │ -The _t_o_r_r_e_n_t___f_i_l_e___w_i_t_h___h_a_s_h_e_s_(_) is here for backwards compatibility when │ │ │ │ │ -constructing a _c_r_e_a_t_e___t_o_r_r_e_n_t object from a _t_o_r_r_e_n_t___i_n_f_o that's in a _s_e_s_s_i_o_n. │ │ │ │ │ -Prefer _s_a_v_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_(_). │ │ │ │ │ -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 _t_o_r_r_e_n_t___i_n_f_o returned from │ │ │ │ │ -_t_o_r_r_e_n_t___f_i_l_e___w_i_t_h___h_a_s_h_e_s_(_). Once the torrent completes downloading all files, │ │ │ │ │ -becoming a seed, you can make a .torrent file from it. │ │ │ │ │ + error_file │ │ │ │ │ + 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; │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ppiieeccee__llaayyeerrss(()) ********** │ │ │ │ │ -std::vector> 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. │ │ │ │ │ + error_file_none │ │ │ │ │ + special values for error_file to describe which file or component │ │ │ │ │ + encountered the error (errc). the error did not occur on a file │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ppoosstt__ppiieeccee__aavvaaiillaabbiilliittyy(()) ppiieeccee__aavvaaiillaabbiilliittyy(()) ********** │ │ │ │ │ -void ppoosstt__ppiieeccee__aavvaaiillaabbiilliittyy () const; │ │ │ │ │ -void ppiieeccee__aavvaaiillaabbiilliittyy (std::vector& 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 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. │ │ │ │ │ + error_file_ssl_ctx │ │ │ │ │ + the error occurred setting up the SSL context │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ppiieeccee__pprriioorriittyy(()) ggeett__ppiieeccee__pprriioorriittiieess(()) pprriioorriittiizzee__ppiieecceess(()) ********** │ │ │ │ │ -void pprriioorriittiizzee__ppiieecceess (std::vector 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; │ │ │ │ │ -void pprriioorriittiizzee__ppiieecceess (std::vector> const& pieces) const; │ │ │ │ │ -std::vector 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 │ │ │ │ │ -and so on. │ │ │ │ │ -The default priority of pieces is 4. │ │ │ │ │ -Piece priorities can not be changed for torrents that have not downloaded the │ │ │ │ │ -metadata yet. Magnet links won't have metadata immediately. see the │ │ │ │ │ -_m_e_t_a_d_a_t_a___r_e_c_e_i_v_e_d___a_l_e_r_t. │ │ │ │ │ -piece_priority sets or gets the priority for an individual piece, specified by │ │ │ │ │ -index. │ │ │ │ │ -prioritize_pieces 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 prioritize_pieces 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. │ │ │ │ │ -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. │ │ │ │ │ + error_file_metadata │ │ │ │ │ + the error occurred while loading the metadata for the torrent │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** pprriioorriittiizzee__ffiilleess(()) ffiillee__pprriioorriittyy(()) ggeett__ffiillee__pprriioorriittiieess(()) ********** │ │ │ │ │ -std::vector ggeett__ffiillee__pprriioorriittiieess () const; │ │ │ │ │ -void ffiillee__pprriioorriittyy (file_index_t index, download_priority_t priority) const; │ │ │ │ │ -void pprriioorriittiizzee__ffiilleess (std::vector const& files) const; │ │ │ │ │ -download_priority_t ffiillee__pprriioorriittyy (file_index_t index) 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 │ │ │ │ │ -_d_o_w_n_l_o_a_d___p_r_i_o_r_i_t_y___t. │ │ │ │ │ -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, _p_i_e_c_e___p_r_i_o_r_i_t_y_(_) has to be called again for those pieces. │ │ │ │ │ -You cannot set the file priorities on a torrent that does not yet have metadata │ │ │ │ │ -or a torrent that is a seed. file_priority(int, int) and _p_r_i_o_r_i_t_i_z_e___f_i_l_e_s_(_) are │ │ │ │ │ -both no-ops for such torrents. │ │ │ │ │ -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 _f_i_l_e___p_r_i_o___a_l_e_r_t. │ │ │ │ │ -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. │ │ │ │ │ + error_file_exception │ │ │ │ │ + there was a serious error reported in this torrent. The error code or a │ │ │ │ │ + torrent log _a_l_e_r_t may provide more information. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ffoorrccee__llssdd__aannnnoouunnccee(()) ffoorrccee__rreeaannnnoouunnccee(()) ffoorrccee__ddhhtt__aannnnoouunnccee(()) ********** │ │ │ │ │ -void ffoorrccee__ddhhtt__aannnnoouunnccee () const; │ │ │ │ │ -void ffoorrccee__llssdd__aannnnoouunnccee () const; │ │ │ │ │ -void ffoorrccee__rreeaannnnoouunnccee (int seconds = 0, int idx = -1, reannounce_flags_t = {}) │ │ │ │ │ -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 - │ │ │ │ │ -1 (which is the default), all trackers are re-announce. │ │ │ │ │ -The flags argument can be used to affect the re-announce. See │ │ │ │ │ -ignore_min_interval. │ │ │ │ │ -force_dht_announce will announce the torrent to the DHT immediately. │ │ │ │ │ -force_lsd_announce will announce the torrent on LSD immediately. │ │ │ │ │ + error_file_partfile │ │ │ │ │ + the error occurred with the partfile │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ssccrraappee__ttrraacckkeerr(()) ********** │ │ │ │ │ -void ssccrraappee__ttrraacckkeerr (int idx = -1) const; │ │ │ │ │ -scrape_tracker() will send a scrape request to a tracker. By default (idx = -1) │ │ │ │ │ -it will scrape the last working tracker. If idx is >= 0, the tracker with the │ │ │ │ │ -specified index will scraped. │ │ │ │ │ -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. │ │ │ │ │ + save_path │ │ │ │ │ + the path to the directory where this torrent's files are stored. It's │ │ │ │ │ + typically the path as was given to _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_) or _a_d_d___t_o_r_r_e_n_t_(_) │ │ │ │ │ + when this torrent was started. This field is only included if the torrent │ │ │ │ │ + status is queried with torrent_handle::query_save_path. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** uuppllooaadd__lliimmiitt(()) ddoowwnnllooaadd__lliimmiitt(()) sseett__ddoowwnnllooaadd__lliimmiitt(()) sseett__uuppllooaadd__lliimmiitt(()) │ │ │ │ │ -********** │ │ │ │ │ -int ddoowwnnllooaadd__lliimmiitt () const; │ │ │ │ │ -void sseett__uuppllooaadd__lliimmiitt (int limit) const; │ │ │ │ │ -void sseett__ddoowwnnllooaadd__lliimmiitt (int limit) const; │ │ │ │ │ -int uuppllooaadd__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. │ │ │ │ │ -upload_limit and download_limit will return the current limit setting, for │ │ │ │ │ -upload and download, respectively. │ │ │ │ │ -Local peers are not rate limited by default. see _p_e_e_r_ _c_l_a_s_s_e_s. │ │ │ │ │ + name │ │ │ │ │ + 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 _s_e_s_s_i_o_n. See session::add_torrent. This field is only included if the │ │ │ │ │ + torrent status is queried with torrent_handle::query_name. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** ccoonnnneecctt__ppeeeerr(()) ********** │ │ │ │ │ -void ccoonnnneecctt__ppeeeerr (tcp::endpoint const& adr, peer_source_flags_t source = {} │ │ │ │ │ - , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const; │ │ │ │ │ -connect_peer() 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 _p_e_e_r___i_n_f_o. i.e. tracker, │ │ │ │ │ -pex, dht etc. │ │ │ │ │ -For possible values of flags, see _p_e_x___f_l_a_g_s___t. │ │ │ │ │ + torrent_file │ │ │ │ │ + set to point to the torrent_info object for this torrent. It's only │ │ │ │ │ + included if the torrent status is queried with torrent_handle:: │ │ │ │ │ + query_torrent_file. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** cclleeaarr__ppeeeerrss(()) ********** │ │ │ │ │ -void cclleeaarr__ppeeeerrss (); │ │ │ │ │ -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. │ │ │ │ │ + next_announce │ │ │ │ │ + the time until the torrent will announce itself to the tracker. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** mmaaxx__uuppllooaaddss(()) sseett__mmaaxx__uuppllooaaddss(()) ********** │ │ │ │ │ -void sseett__mmaaxx__uuppllooaaddss (int max_uploads) const; │ │ │ │ │ -int mmaaxx__uuppllooaaddss () const; │ │ │ │ │ -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. │ │ │ │ │ + current_tracker │ │ │ │ │ + the URL of the last working tracker. If no tracker request has been │ │ │ │ │ + successful yet, it's set to an empty string. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** mmaaxx__ccoonnnneeccttiioonnss(()) sseett__mmaaxx__ccoonnnneeccttiioonnss(()) ********** │ │ │ │ │ -int mmaaxx__ccoonnnneeccttiioonnss () const; │ │ │ │ │ -void sseett__mmaaxx__ccoonnnneeccttiioonnss (int max_connections) 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. │ │ │ │ │ + total_download total_upload │ │ │ │ │ + the number of bytes downloaded and uploaded to all peers, accumulated, │ │ │ │ │ + tthhiiss sseessssiioonn only. The _s_e_s_s_i_o_n is considered to restart when a torrent is │ │ │ │ │ + paused and restarted again. When a torrent is paused, these _c_o_u_n_t_e_r_s are │ │ │ │ │ + reset to 0. If you want complete, persistent, stats, see all_time_upload │ │ │ │ │ + and all_time_download. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** mmoovvee__ssttoorraaggee(()) ********** │ │ │ │ │ -void mmoovvee__ssttoorraaggee (std::string const& save_path │ │ │ │ │ - , move_flags_t flags = move_flags_t::always_replace_files │ │ │ │ │ - ) const; │ │ │ │ │ -Moves the file(s) that this torrent are currently seeding from or downloading │ │ │ │ │ -to. If the given save_path 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. │ │ │ │ │ -Since disk IO is performed in a separate thread, this operation is also │ │ │ │ │ -asynchronous. Once the operation completes, the storage_moved_alert is │ │ │ │ │ -generated, with the new path as the message. If the move fails for some reason, │ │ │ │ │ -storage_moved_failed_alert is generated instead, containing the error message. │ │ │ │ │ -The flags argument determines the behavior of the copying/moving of the files │ │ │ │ │ -in the torrent. see _m_o_v_e___f_l_a_g_s___t. │ │ │ │ │ -always_replace_files is the default and replaces any file that exist in both │ │ │ │ │ -the source directory and the target directory. │ │ │ │ │ -fail_if_exist 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 always_replace_files 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 error of │ │ │ │ │ -move_storage_failed_alert is set to boost::system::errc::file_exists. │ │ │ │ │ -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 move_storage call │ │ │ │ │ -with one of the other modes. │ │ │ │ │ -dont_replace 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. │ │ │ │ │ -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. │ │ │ │ │ -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. │ │ │ │ │ + total_payload_download total_payload_upload │ │ │ │ │ + counts the amount of bytes send and received this _s_e_s_s_i_o_n, but only the │ │ │ │ │ + actual payload data (i.e the interesting data), these _c_o_u_n_t_e_r_s ignore any │ │ │ │ │ + protocol overhead. The _s_e_s_s_i_o_n is considered to restart when a torrent is │ │ │ │ │ + paused and restarted again. When a torrent is paused, these _c_o_u_n_t_e_r_s are │ │ │ │ │ + reset to 0. │ │ │ │ │ [_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. │ │ │ │ │ + total_failed_bytes │ │ │ │ │ + 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** iinnffoo__hhaasshh(()) iinnffoo__hhaasshheess(()) ********** │ │ │ │ │ -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. │ │ │ │ │ + total_redundant_bytes │ │ │ │ │ + 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. │ │ │ │ │ [_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; │ │ │ │ │ -comparison operators. The order of the torrents is unspecified but stable. │ │ │ │ │ + pieces │ │ │ │ │ + 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. │ │ │ │ │ [_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. │ │ │ │ │ + verified_pieces │ │ │ │ │ + a bitmask representing which pieces has had their hash checked. This only │ │ │ │ │ + applies to torrents in sseeeedd mmooddee. If the torrent is not in seed mode, │ │ │ │ │ + this bitmask may be empty. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** nnaattiivvee__hhaannddllee(()) ********** │ │ │ │ │ -std::shared_ptr nnaattiivvee__hhaannddllee () const; │ │ │ │ │ -This function is intended only for use by plugins and the _a_l_e_r_t 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 │ │ │ │ │ -_p_l_u_g_i_n callbacks). The torrent 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 TORRENT_ │ │ │ │ │ -macros must match between libtorrent and the client builds. │ │ │ │ │ + total_done │ │ │ │ │ + the total number of bytes of the file(s) that we have. All this does not │ │ │ │ │ + necessarily has to be downloaded during this _s_e_s_s_i_o_n (that's │ │ │ │ │ + total_payload_download). │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** uusseerrddaattaa(()) ********** │ │ │ │ │ -client_data_t uusseerrddaattaa () const; │ │ │ │ │ -returns the userdata pointer as set in _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s │ │ │ │ │ + total │ │ │ │ │ + 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ -********** iinn__sseessssiioonn(()) ********** │ │ │ │ │ -bool iinn__sseessssiioonn () const; │ │ │ │ │ -Returns true if the torrent is in the _s_e_s_s_i_o_n. It returns true before session:: │ │ │ │ │ -remove_torrent() is called, and false afterward. │ │ │ │ │ -Note that this is a blocking function, unlike _t_o_r_r_e_n_t___h_a_n_d_l_e_:_:_i_s___v_a_l_i_d_(_) which │ │ │ │ │ -returns immediately. │ │ │ │ │ + total_wanted_done │ │ │ │ │ + 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 │ │ │ │ │ + "wanted". │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - overwrite_existing │ │ │ │ │ - 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. │ │ │ │ │ + total_wanted │ │ │ │ │ + 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 "wanted". │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - query_distributed_copies │ │ │ │ │ - calculates distributed_copies, distributed_full_copies and │ │ │ │ │ - distributed_fraction. │ │ │ │ │ + all_time_upload all_time_download │ │ │ │ │ + are accumulated upload and download payload byte _c_o_u_n_t_e_r_s. They are saved │ │ │ │ │ + in and restored from resume data to keep totals across sessions. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - query_accurate_download_counters │ │ │ │ │ - includes partial downloaded blocks in total_done and total_wanted_done. │ │ │ │ │ + added_time │ │ │ │ │ + the posix-time when this torrent was added. i.e. what time(nullptr) │ │ │ │ │ + returned at the time. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - query_last_seen_complete │ │ │ │ │ - includes last_seen_complete. │ │ │ │ │ + completed_time │ │ │ │ │ + the posix-time when this torrent was finished. If the torrent is not yet │ │ │ │ │ + finished, this is 0. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - query_pieces │ │ │ │ │ - populate the pieces field in _t_o_r_r_e_n_t___s_t_a_t_u_s. │ │ │ │ │ + last_seen_complete │ │ │ │ │ + the time when we, or one of our peers, last saw a complete copy of this │ │ │ │ │ + torrent. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - query_verified_pieces │ │ │ │ │ - includes verified_pieces (only applies to torrents in sseeeedd mmooddee). │ │ │ │ │ + storage_mode │ │ │ │ │ + The allocation mode for the torrent. See _s_t_o_r_a_g_e___m_o_d_e___t for the options. │ │ │ │ │ + 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] │ │ │ │ │ - query_torrent_file │ │ │ │ │ - includes torrent_file, which is all the static information from the │ │ │ │ │ - .torrent file. │ │ │ │ │ + progress │ │ │ │ │ + a value in the range [0, 1], that represents the progress of the │ │ │ │ │ + torrent's current task. It may be checking files or downloading. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - query_name │ │ │ │ │ - includes name, the name of the torrent. This is either derived from the │ │ │ │ │ - .torrent file, or from the &dn= magnet link argument or possibly some │ │ │ │ │ - other source. If the name of the torrent is not known, this is an empty │ │ │ │ │ - string. │ │ │ │ │ + progress_ppm │ │ │ │ │ + progress parts per million (progress * 1000000) when disabling floating │ │ │ │ │ + point operations, this is the only option to query progress │ │ │ │ │ + reflects the same value as progress, 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - query_save_path │ │ │ │ │ - includes save_path, the path to the directory the files of the torrent │ │ │ │ │ - are saved to. │ │ │ │ │ + queue_position │ │ │ │ │ + the position this torrent has in the download queue. If the torrent is a │ │ │ │ │ + seed or finished, this is -1. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - alert_when_available │ │ │ │ │ - used to ask libtorrent to send an _a_l_e_r_t once the piece has been │ │ │ │ │ - downloaded, by passing alert_when_available. When set, the │ │ │ │ │ - _r_e_a_d___p_i_e_c_e___a_l_e_r_t _a_l_e_r_t will be delivered, with the piece data, when it's │ │ │ │ │ - downloaded. │ │ │ │ │ + download_rate upload_rate │ │ │ │ │ + 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - piece_granularity │ │ │ │ │ - only calculate file progress at piece granularity. This makes the │ │ │ │ │ - _f_i_l_e___p_r_o_g_r_e_s_s_(_) call cheaper and also only takes bytes that have passed │ │ │ │ │ - the hash check into account, so progress cannot regress in this mode. │ │ │ │ │ + download_payload_rate upload_payload_rate │ │ │ │ │ + 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - graceful_pause │ │ │ │ │ - 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. │ │ │ │ │ + num_seeds │ │ │ │ │ + the number of peers that are seeding that this client is currently │ │ │ │ │ + connected to. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - flush_disk_cache │ │ │ │ │ - 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. │ │ │ │ │ + num_peers │ │ │ │ │ + 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 _g_e_t___p_e_e_r___i_n_f_o_(_). │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - save_info_dict │ │ │ │ │ - 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. │ │ │ │ │ + num_complete num_incomplete │ │ │ │ │ + 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - only_if_modified │ │ │ │ │ - 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 │ │ │ │ │ + list_seeds list_peers │ │ │ │ │ + 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - if_counters_changed │ │ │ │ │ - save resume data if any _c_o_u_n_t_e_r_s has changed since the last time resume │ │ │ │ │ - data was saved. This includes upload/download _c_o_u_n_t_e_r_s, active time │ │ │ │ │ - _c_o_u_n_t_e_r_s and scrape data. A torrent that is not paused will have its │ │ │ │ │ - active time _c_o_u_n_t_e_r_s incremented continuously. │ │ │ │ │ + connect_candidates │ │ │ │ │ + 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - if_download_progress │ │ │ │ │ - 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 │ │ │ │ │ + num_pieces │ │ │ │ │ + the number of pieces that has been downloaded. It is equivalent to: std:: │ │ │ │ │ + accumulate(pieces->begin(), pieces->end()). 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - if_config_changed │ │ │ │ │ - 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) │ │ │ │ │ + distributed_full_copies │ │ │ │ │ + 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - if_state_changed │ │ │ │ │ - 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 │ │ │ │ │ + distributed_fraction │ │ │ │ │ + tells the share of pieces that have more copies than the rarest piece(s). │ │ │ │ │ + Divide this number by 1000 to get the fraction. │ │ │ │ │ + For example, if distributed_full_copies is 2 and distributed_fraction 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. │ │ │ │ │ + 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. │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - if_metadata_changed │ │ │ │ │ - save the resume data if any mmeettaaddaattaa changed since the last time resume │ │ │ │ │ - data was saved. This includes: * add/remove web seeds * add/remove │ │ │ │ │ - trackers * receiving metadata for a magnet link │ │ │ │ │ + distributed_copies │ │ │ │ │ + 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. │ │ │ │ │ + the integer part tells how many copies │ │ │ │ │ + there are of the rarest piece(s) │ │ │ │ │ + the fractional part tells the fraction of pieces that │ │ │ │ │ + have more copies than the rarest piece(s). │ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ - ignore_min_interval │ │ │ │ │ - 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. │ │ │ │ │ + block_size │ │ │ │ │ + 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 partial_piece_info's bitset represents, see │ │ │ │ │ + _g_e_t___d_o_w_n_l_o_a_d___q_u_e_u_e_(_). This is typically 16 kB, but it may be smaller, if │ │ │ │ │ + the pieces are smaller. │ │ │ │ │ [_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.) │ │ │ │ │ + num_uploads │ │ │ │ │ + the number of unchoked peers in this torrent. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + num_connections │ │ │ │ │ + the number of peer connections this torrent has, including half-open │ │ │ │ │ + connections that hasn't completed the bittorrent handshake yet. This is │ │ │ │ │ + always >= num_peers. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + uploads_limit │ │ │ │ │ + the set limit of upload slots (unchoked peers) for this torrent. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + connections_limit │ │ │ │ │ + the set limit of number of connections for this torrent. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + up_bandwidth_queue down_bandwidth_queue │ │ │ │ │ + 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 │ │ │ │ │ + session_status object. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + seed_rank │ │ │ │ │ + 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 │ │ │ │ │ + _q_u_e_u_i_n_g. Higher value means more important to seed │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + state │ │ │ │ │ + the main state the torrent is in. See _t_o_r_r_e_n_t___s_t_a_t_u_s_:_:_s_t_a_t_e___t. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + need_save_resume │ │ │ │ │ + true if this torrent has unsaved changes to its download state and │ │ │ │ │ + statistics since the last resume data was saved. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + is_seeding │ │ │ │ │ + true if all pieces have been downloaded. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + is_finished │ │ │ │ │ + true if all pieces that have a priority > 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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + has_metadata │ │ │ │ │ + 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). │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + has_incoming │ │ │ │ │ + true if there has ever been an incoming connection attempt to this │ │ │ │ │ + torrent. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + moving_storage │ │ │ │ │ + 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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + announcing_to_trackers announcing_to_lsd announcing_to_dht │ │ │ │ │ + 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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + info_hashes │ │ │ │ │ + the info-hash for this torrent │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + last_upload last_download │ │ │ │ │ + the timestamps of the last time this torrent uploaded or downloaded │ │ │ │ │ + payload to any peer. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ + active_duration finished_duration seeding_duration │ │ │ │ │ + these are cumulative _c_o_u_n_t_e_r_s of for how long the torrent has been in │ │ │ │ │ + different states. active means not paused and added to _s_e_s_s_i_o_n. 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. │ │ │ │ │ +[_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(). │ │ │ │ │ +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 sseett__ssttrr (int name, std::string val) override; │ │ │ │ │ + void sseett__iinntt (int name, int val) override; │ │ │ │ │ + void sseett__iinntt (int name, flags::bitfield_flag const val); │ │ │ │ │ + void sseett__bbooooll (int name, bool 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; │ │ │ │ │ + │ │ │ │ │ + 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__iinntt(()) sseett__ssttrr(()) sseett__bbooooll(()) ********** │ │ │ │ │ +void sseett__ssttrr (int name, std::string val) override; │ │ │ │ │ +void sseett__iinntt (int name, int val) override; │ │ │ │ │ +void sseett__iinntt (int name, flags::bitfield_flag const val); │ │ │ │ │ +void sseett__bbooooll (int name, bool 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__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. │ │ │ │ │ +[_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] │ │ │ │ │ +************ 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. │ │ │ │ │ +[_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 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. │ │ │ │ │ +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] │ │ │ │ │ +************ 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 │ │ │ │ │ +[_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 (ip_filter&&); │ │ │ │ │ + iipp__ffiilltteerr (); │ │ │ │ │ + ip_filter& ooppeerraattoorr== (ip_filter const&); │ │ │ │ │ + ~~iipp__ffiilltteerr (); │ │ │ │ │ + iipp__ffiilltteerr (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 const&); │ │ │ │ │ + ppoorrtt__ffiilltteerr (port_filter&&); │ │ │ │ │ + ppoorrtt__ffiilltteerr (); │ │ │ │ │ + ~~ppoorrtt__ffiilltteerr (); │ │ │ │ │ + port_filter& ooppeerraattoorr== (port_filter&&); │ │ │ │ │ + port_filter& ooppeerraattoorr== (port_filter const&); │ │ │ │ │ + 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] │ │ │ │ │ ************ 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 (); │ │ │ │ │ @@ -12596,52 +12596,52 @@ │ │ │ │ │ [_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 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. │ │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ ************ ssiiggnn__mmuuttaabbllee__iitteemm(()) ************ │ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_i_t_e_m_._h_p_p" │ │ │ │ │ signature ssiiggnn__mmuuttaabbllee__iitteemm ( │ │ │ │ │ span v │ │ │ │ │ , span salt │ │ │ │ │ , sequence_number seq │ │ │ │ │ , public_key const& pk │ │ │ │ │ , secret_key const& sk); │ │ │ │ │ given a byte range v and an optional byte range salt, a sequence number, public │ │ │ │ │ key pk (must be 32 bytes) and a secret key sk (must be 64 bytes), this function │ │ │ │ │ produces a signature which is written into a 64 byte buffer pointed to by sig. │ │ │ │ │ The caller is responsible for allocating the destination buffer that's passed │ │ │ │ │ in as the sig argument. Typically it would be allocated on the stack. │ │ │ │ │ [_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 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. │ │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ │ ************ aannnnoouunnccee__ffllaaggss__tt ************ │ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_a_n_n_o_u_n_c_e___f_l_a_g_s_._h_p_p" │ │ │ │ │ seed │ │ │ │ │ announce to DHT as a seed │ │ │ │ │ implied_port │ │ │ │ │ announce to DHT with the implied-port flag set. This tells the network to │ │ │ │ │ use your source UDP port as your listen port, rather than the one │ │ │ │ │ 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] │ │ │ │ │ ************ 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" │ │ │ │ │ -std::vector wwrriittee__rreessuummee__ddaattaa__bbuuff (add_torrent_params const& atp); │ │ │ │ │ entry wwrriittee__rreessuummee__ddaattaa (add_torrent_params const& atp); │ │ │ │ │ +std::vector 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(()) ************ │ │ │ │ │ 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); │ │ │ │ │ @@ -12656,21 +12656,21 @@ │ │ │ │ │ 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 │ │ │ │ │ add custom fields. │ │ │ │ │ [_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 buffer │ │ │ │ │ + , error_code& ec, load_torrent_limits const& cfg = {}); │ │ │ │ │ +add_torrent_params rreeaadd__rreessuummee__ddaattaa (span 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 buffer │ │ │ │ │ - , error_code& ec, load_torrent_limits const& cfg = {}); │ │ │ │ │ +add_torrent_params rreeaadd__rreessuummee__ddaattaa (bdecode_node const& rd │ │ │ │ │ + , 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. │ │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/todo.html │ │ │ │ @@ -459,15 +459,174 @@ │ │ │ │ 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; │ │ │ │ rpc.invoke(req, source, o); │ │ │ │ │ │ │ │ -relevance 3../src/web_peer_connection.cpp:199this should be an optional, piece index -1 should not be allowed

    this should be an optional, piece index -1 should │ │ │ │ +relevance 3../src/peer_connection.cpp:3133instead 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.

    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.

    ../src/peer_connection.cpp:3133

    		// 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 │ │ │ │ + if (m_outstanding_writing_bytes == 0 │ │ │ │ +
    relevance 3../src/peer_connection.cpp:4044once peers are properly put in graceful pause mode, they can cancel all outstanding requests and this test can be removed.

    once peers are properly put in graceful pause mode, they can │ │ │ │ +cancel all outstanding requests and this test can be removed.

    ../src/peer_connection.cpp:4044

    │ │ │ │ +			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../src/peer_connection.cpp:4730new_piece should be an optional. piece index -1 should not be allowed

    new_piece should be an optional. piece index -1 │ │ │ │ +should not be allowed

    ../src/peer_connection.cpp:4730

    │ │ │ │ +		// 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)); │ │ │ │ + │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ +
    relevance 3../src/web_peer_connection.cpp:199this should be an optional, piece index -1 should not be allowed

    this should be an optional, piece index -1 should │ │ │ │ not be allowed

    ../src/web_peer_connection.cpp:199

    │ │ │ │  			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);
    │ │ │ │  		}
    │ │ │ │  		t->set_seed(peer_info_struct(), false);
    │ │ │ │  		if (have.none_set())
    │ │ │ │ @@ -511,15 +670,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
    │ │ │ │ -
    relevance 3../src/web_peer_connection.cpp:419do we really need a special case here? wouldn't the multi-file case handle single file torrents correctly too?

    do we really need a special case here? wouldn't the multi-file │ │ │ │ +relevance 3../src/web_peer_connection.cpp:419do we really need a special case here? wouldn't the multi-file case handle single file torrents correctly too?

    do we really need a special case here? wouldn't the multi-file │ │ │ │ case handle single file torrents correctly too?

    ../src/web_peer_connection.cpp:419

    		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<int>(r.piece), r.start
    │ │ │ │  		, static_cast<int>(pr.piece), pr.start + pr.length);
    │ │ │ │ @@ -563,15 +722,15 @@
    │ │ │ │  	{
    │ │ │ │  		std::vector<file_slice> files = info.orig_files().map_block(req.piece, req.start
    │ │ │ │  			, req.length);
    │ │ │ │  
    │ │ │ │  		for (auto const &f : files)
    │ │ │ │  		{
    │ │ │ │  			file_request_t file_req;
    │ │ │ │ -
    relevance 3../src/web_peer_connection.cpp:504file_index_t should not allow negative values

    file_index_t should not allow negative values

    ../src/web_peer_connection.cpp:504

    					// with the correct slashes. Don't encode it again
    │ │ │ │ +
    relevance 3../src/web_peer_connection.cpp:504file_index_t should not allow negative values

    file_index_t should not allow negative values

    ../src/web_peer_connection.cpp:504

    					// 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);
    │ │ │ │ @@ -614,15 +773,15 @@
    │ │ │ │  	{
    │ │ │ │  		std::string const& server_version = p.header("server");
    │ │ │ │  		if (!server_version.empty())
    │ │ │ │  			return server_version;
    │ │ │ │  		return host;
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ -
    relevance 3../src/web_peer_connection.cpp:695this 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.

    this could be made more efficient for the case when we use an │ │ │ │ +relevance 3../src/web_peer_connection.cpp:695this 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.

    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.

    ../src/web_peer_connection.cpp:695

    	bool const single_file_request = !m_path.empty()
    │ │ │ │  		&& 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
    │ │ │ │ @@ -667,15 +826,338 @@
    │ │ │ │  		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)
    │ │ │ │  		{
    │ │ │ │ -
    relevance 3../src/session_impl.cpp:1142closing the udp sockets here means that the uTP connections cannot be closed gracefully

    closing the udp sockets here means that │ │ │ │ +relevance 3../src/ut_metadata.cpp:268use the aux::write_* functions and the span here instead, it will fit better with send_buffer()

    use the aux::write_* functions and the span here instead, it │ │ │ │ +will fit better with send_buffer()

    ../src/ut_metadata.cpp:268

    			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_pc.send_buffer({msg, len + 6}); │ │ │ │ +
    relevance 3../src/torrent.cpp:419we could probably get away with just saving a few fields here

    we could probably get away with just saving a few fields here

    ../src/torrent.cpp:419

    		// --- 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); │ │ │ │ + } │ │ │ │ + } │ │ │ │ + } │ │ │ │ + │ │ │ │ + void torrent::inc_stats_counter(int c, int value) │ │ │ │ +
    relevance 3../src/torrent.cpp:715assert there are no outstanding async operations on this torrent

    assert there are no outstanding async operations on this │ │ │ │ +torrent

    ../src/torrent.cpp:715

    #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); │ │ │ │ + } │ │ │ │ + │ │ │ │ + void torrent::read_piece(piece_index_t const piece) │ │ │ │ +
    relevance 3../src/torrent.cpp:1331there's some duplication between this function and peer_connection::incoming_piece(). is there a way to merge something?

    there's some duplication between this function and │ │ │ │ +peer_connection::incoming_piece(). is there a way to merge something?

    ../src/torrent.cpp:1331

    		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)) │ │ │ │ + return; │ │ │ │ + │ │ │ │ +
    relevance 3../src/torrent.cpp:3966this could probably be pulled out into a free function

    this could probably be pulled out into a free function

    ../src/torrent.cpp:3966

    	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; │ │ │ │ + st.total_wanted_done = 0; │ │ │ │ +
    relevance 3../src/torrent.cpp:4905should this alert have an error code in it?

    should this alert have an error code in it?

    ../src/torrent.cpp:4905

    		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()); │ │ │ │ + } │ │ │ │ + │ │ │ │ +
    relevance 3../src/torrent.cpp:4975this should return optional<>. piece index -1 should not be allowed

    this should return optional<>. piece index -1 should not be │ │ │ │ +allowed

    ../src/torrent.cpp:4975

    	}
    │ │ │ │ +
    │ │ │ │ +#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) │ │ │ │ + { │ │ │ │ + avail_vec.push_back(i); │ │ │ │ +
    relevance 3../src/session_impl.cpp:1142closing the udp sockets here means that the uTP connections cannot be closed gracefully

    closing the udp sockets here means that │ │ │ │ the uTP connections cannot be closed gracefully

    ../src/session_impl.cpp:1142

    #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();
    │ │ │ │ @@ -719,15 +1201,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->abort(false);
    │ │ │ │  
    │ │ │ │  		// now it's OK for the network thread to exit
    │ │ │ │ -
    relevance 3../src/session_impl.cpp:1638the logic in this if-block should be factored out into a separate function. At least most of it

    the logic in this if-block should be factored out into a │ │ │ │ +relevance 3../src/session_impl.cpp:1638the logic in this if-block should be factored out into a separate function. At least most of it

    the logic in this if-block should be factored out into a │ │ │ │ separate function. At least most of it

    ../src/session_impl.cpp:1638

    				, (lep.flags & listen_socket_t::local_network) ? "local-network " : ""
    │ │ │ │  				, (lep.flags & listen_socket_t::accept_incoming) ? "accept-incoming " : "no-incoming "
    │ │ │ │  				, (lep.flags & listen_socket_t::was_expanded) ? "expanded-ip " : ""
    │ │ │ │  				, (lep.flags & listen_socket_t::proxy) ? "proxy " : "");
    │ │ │ │  		}
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │ @@ -771,15 +1253,15 @@
    │ │ │ │  				error_code err;
    │ │ │ │  				ret->sock->set_option(exclusive_address_use(true), err);
    │ │ │ │  #ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │  				if (err && should_log())
    │ │ │ │  				{
    │ │ │ │  					session_log("failed enable exclusive address use on listen socket: %s"
    │ │ │ │  						, err.message().c_str());
    │ │ │ │ -
    relevance 3../src/session_impl.cpp:2606it would be neat if the utp socket manager would handle ICMP errors too

    it would be neat if the utp socket manager would │ │ │ │ +relevance 3../src/session_impl.cpp:2606it would be neat if the utp socket manager would handle ICMP errors too

    it would be neat if the utp socket manager would │ │ │ │ handle ICMP errors too

    ../src/session_impl.cpp:2606

    │ │ │ │  		std::shared_ptr<session_udp_socket> s = socket.lock();
    │ │ │ │  		if (!s) return;
    │ │ │ │  
    │ │ │ │  		struct utp_socket_manager& mgr =
    │ │ │ │  #ifdef TORRENT_SSL_PEERS
    │ │ │ │  			ssl == transport::ssl ? m_ssl_utp_socket_manager :
    │ │ │ │ @@ -823,15 +1305,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 && buf.size() > 20
    │ │ │ │  						&& buf.front() == 'd'
    │ │ │ │ -
    relevance 3../src/session_impl.cpp:4155it 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).

    it would probably make sense to have a separate list of peers │ │ │ │ +relevance 3../src/session_impl.cpp:4155it 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).

    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).

    ../src/session_impl.cpp:4155

    	}
    │ │ │ │  
    │ │ │ │ @@ -865,15 +1347,15 @@
    │ │ │ │  			{
    │ │ │ │  				prev_opt_unchoke.push_back(pi);
    │ │ │ │  			}
    │ │ │ │  
    │ │ │ │  			torrent const* t = p->associated_torrent().lock().get();
    │ │ │ │  			if (!t) continue;
    │ │ │ │  
    │ │ │ │ -
    relevance 3../src/session_impl.cpp:4178peers should know whether their torrent is paused or not, instead of having to ask it over and over again

    peers should know whether their torrent is paused or not, │ │ │ │ +relevance 3../src/session_impl.cpp:4178peers should know whether their torrent is paused or not, instead of having to ask it over and over again

    peers should know whether their torrent is paused or not, │ │ │ │ instead of having to ask it over and over again

    ../src/session_impl.cpp:4178

    		// collect the currently optimistically unchoked peers here, so we can
    │ │ │ │  		// choke them when we've found new optimistic unchoke candidates.
    │ │ │ │  		std::vector<torrent_peer*> prev_opt_unchoke;
    │ │ │ │  
    │ │ │ │  		for (auto& i : m_connections)
    │ │ │ │  		{
    │ │ │ │  			peer_connection* const p = i.get();
    │ │ │ │ @@ -917,15 +1399,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()
    │ │ │ │ -
    relevance 3../src/session_impl.cpp:4424there should be a pre-calculated list of all peers eligible for unchoking

    there should be a pre-calculated list of all peers eligible for │ │ │ │ +relevance 3../src/session_impl.cpp:4424there should be a pre-calculated list of all peers eligible for unchoking

    there should be a pre-calculated list of all peers eligible for │ │ │ │ unchoking

    ../src/session_impl.cpp:4424

    	}
    │ │ │ │  
    │ │ │ │  	void session_impl::recalculate_unchoke_slots()
    │ │ │ │  	{
    │ │ │ │  		TORRENT_ASSERT(is_single_thread());
    │ │ │ │  
    │ │ │ │  		time_point const now = aux::time_now();
    │ │ │ │ @@ -969,15 +1451,15 @@
    │ │ │ │  					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;
    │ │ │ │ -
    relevance 3../src/session_impl.cpp:6136use public_key here instead of std::array

    use public_key here instead of std::array

    ../src/session_impl.cpp:6136

    │ │ │ │ +
    relevance 3../src/session_impl.cpp:6136use public_key here instead of std::array

    use public_key here instead of std::array

    ../src/session_impl.cpp:6136

    │ │ │ │  	void session_impl::dht_get_immutable_item(sha1_hash const& target)
    │ │ │ │  	{
    │ │ │ │  		if (!m_dht) return;
    │ │ │ │  		m_dht->get_item(target, std::bind(&session_impl::get_immutable_callback
    │ │ │ │  			, this, target, _1));
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ @@ -1020,465 +1502,15 @@
    │ │ │ │  				alerts.emplace_alert<dht_put_alert>(pk.bytes, sig.bytes
    │ │ │ │  					, std::move(salt), seq.value, num);
    │ │ │ │  			}
    │ │ │ │  		}
    │ │ │ │  
    │ │ │ │  		void put_mutable_callback(dht::item& i
    │ │ │ │  			, std::function<void(entry&, std::array<char, 64>&
    │ │ │ │ -
    relevance 3../src/torrent.cpp:419we could probably get away with just saving a few fields here

    we could probably get away with just saving a few fields here

    ../src/torrent.cpp:419

    		// --- 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); │ │ │ │ - } │ │ │ │ - } │ │ │ │ - } │ │ │ │ - │ │ │ │ - void torrent::inc_stats_counter(int c, int value) │ │ │ │ -
    relevance 3../src/torrent.cpp:715assert there are no outstanding async operations on this torrent

    assert there are no outstanding async operations on this │ │ │ │ -torrent

    ../src/torrent.cpp:715

    #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); │ │ │ │ - } │ │ │ │ - │ │ │ │ - void torrent::read_piece(piece_index_t const piece) │ │ │ │ -
    relevance 3../src/torrent.cpp:1331there's some duplication between this function and peer_connection::incoming_piece(). is there a way to merge something?

    there's some duplication between this function and │ │ │ │ -peer_connection::incoming_piece(). is there a way to merge something?

    ../src/torrent.cpp:1331

    		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)) │ │ │ │ - return; │ │ │ │ - │ │ │ │ -
    relevance 3../src/torrent.cpp:3966this could probably be pulled out into a free function

    this could probably be pulled out into a free function

    ../src/torrent.cpp:3966

    	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; │ │ │ │ - st.total_wanted_done = 0; │ │ │ │ -
    relevance 3../src/torrent.cpp:4905should this alert have an error code in it?

    should this alert have an error code in it?

    ../src/torrent.cpp:4905

    		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()); │ │ │ │ - } │ │ │ │ - │ │ │ │ -
    relevance 3../src/torrent.cpp:4975this should return optional<>. piece index -1 should not be allowed

    this should return optional<>. piece index -1 should not be │ │ │ │ -allowed

    ../src/torrent.cpp:4975

    	}
    │ │ │ │ -
    │ │ │ │ -#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) │ │ │ │ - { │ │ │ │ - avail_vec.push_back(i); │ │ │ │ -
    relevance 3../src/peer_connection.cpp:3133instead 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.

    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.

    ../src/peer_connection.cpp:3133

    		// 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 │ │ │ │ - if (m_outstanding_writing_bytes == 0 │ │ │ │ -
    relevance 3../src/peer_connection.cpp:4044once peers are properly put in graceful pause mode, they can cancel all outstanding requests and this test can be removed.

    once peers are properly put in graceful pause mode, they can │ │ │ │ -cancel all outstanding requests and this test can be removed.

    ../src/peer_connection.cpp:4044

    │ │ │ │ -			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../src/peer_connection.cpp:4730new_piece should be an optional. piece index -1 should not be allowed

    new_piece should be an optional. piece index -1 │ │ │ │ -should not be allowed

    ../src/peer_connection.cpp:4730

    │ │ │ │ -		// 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)); │ │ │ │ - │ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ -
    relevance 3../src/session_handle.cpp:691expose the sequence_number, public_key, secret_key and signature types to the client

    expose the sequence_number, public_key, secret_key and signature │ │ │ │ +relevance 3../src/session_handle.cpp:691expose the sequence_number, public_key, secret_key and signature types to the client

    expose the sequence_number, public_key, secret_key and signature │ │ │ │ types to the client

    ../src/session_handle.cpp:691

    	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
    │ │ │ │ @@ -1522,46 +1554,14 @@
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │  	void session_handle::dht_get_peers(sha1_hash const& info_hash)
    │ │ │ │  	{
    │ │ │ │  #ifndef TORRENT_DISABLE_DHT
    │ │ │ │  		async_call(&session_impl::dht_get_peers, info_hash);
    │ │ │ │  #else
    │ │ │ │ -
    relevance 3../src/ut_metadata.cpp:268use the aux::write_* functions and the span here instead, it will fit better with send_buffer()

    use the aux::write_* functions and the span here instead, it │ │ │ │ -will fit better with send_buffer()

    ../src/ut_metadata.cpp:268

    			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_pc.send_buffer({msg, len + 6}); │ │ │ │
    relevance 3../src/kademlia/rpc_manager.cpp:71move this into it's own .cpp file

    move this into it's own .cpp file

    ../src/kademlia/rpc_manager.cpp:71

    #include <libtorrent/kademlia/get_item.hpp>
    │ │ │ │  #include <libtorrent/kademlia/sample_infohashes.hpp>
    │ │ │ │  #include <libtorrent/aux_/session_settings.hpp>
    │ │ │ │  
    │ │ │ │  #include <libtorrent/socket_io.hpp> // for print_endpoint
    │ │ │ │  #include <libtorrent/aux_/time.hpp> // for aux::time_now
    │ │ │ │  #include <libtorrent/aux_/aligned_union.hpp>
    │ │ │ │ @@ -1605,15 +1605,165 @@
    │ │ │ │  	}
    │ │ │ │  	else
    │ │ │ │  	{
    │ │ │ │  		flags &= ~flag_ipv6_address;
    │ │ │ │  		m_addr.v4 = ep.address().to_v4().to_bytes();
    │ │ │ │  	}
    │ │ │ │  }
    │ │ │ │ -
    relevance 3../include/libtorrent/torrent.hpp:1423factor out predictive pieces and all operations on it into a separate class (to use as member here instead)

    factor out predictive pieces and all operations on it into a │ │ │ │ +relevance 3../include/libtorrent/torrent_handle.hpp:535unify url_seed and http_seed with just web_seed, using the web_seed_entry.

    unify url_seed and http_seed with just web_seed, using the │ │ │ │ +web_seed_entry.

    ../include/libtorrent/torrent_handle.hpp:535

    		// 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 │ │ │ │ + , client_data_t userdata = client_data_t{}); │ │ │ │ +
    relevance 3../include/libtorrent/web_peer_connection.hpp:119if we make this be a disk_buffer_holder instead we would save a copy use allocate_disk_receive_buffer and release_disk_receive_buffer

    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

    ../include/libtorrent/web_peer_connection.hpp:119

    		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)
    │ │ │ │ +		struct file_request_t
    │ │ │ │ +		{
    │ │ │ │ +			file_index_t file_index;
    │ │ │ │ +			int length;
    │ │ │ │ +			std::int64_t start;
    │ │ │ │ +		};
    │ │ │ │ +		std::deque<file_request_t> m_file_requests;
    │ │ │ │ +
    │ │ │ │ +		std::string m_url;
    │ │ │ │ +
    │ │ │ │ +		web_seed_t* m_web;
    │ │ │ │ +
    │ │ │ │ +		// this is used for intermediate storage of pieces to be delivered to the
    │ │ │ │ +		// bittorrent engine
    │ │ │ │ +
    aux::vector<char> m_piece; │ │ │ │ +
    │ │ │ │ + // the number of bytes we've forwarded to the incoming_payload() function │ │ │ │ + // in the current HTTP response. used to know where in the buffer the │ │ │ │ + // next response starts │ │ │ │ + int m_received_body; │ │ │ │ + │ │ │ │ + // this is the offset inside the current receive │ │ │ │ + // buffer where the next chunk header will be. │ │ │ │ + // this is updated for each chunk header that's │ │ │ │ + // parsed. It does not necessarily point to a valid │ │ │ │ + // offset in the receive buffer, if we haven't received │ │ │ │ + // it yet. This offset never includes the HTTP header │ │ │ │ + int m_chunk_pos; │ │ │ │ + │ │ │ │ + // this is the number of bytes we've already received │ │ │ │ + // from the next chunk header we're waiting for │ │ │ │ + int m_partial_chunk_header; │ │ │ │ + │ │ │ │ + // the number of responses we've received so far on │ │ │ │ + // this connection │ │ │ │ + int m_num_responses; │ │ │ │ + }; │ │ │ │ +} │ │ │ │ + │ │ │ │ +#endif // TORRENT_WEB_PEER_CONNECTION_HPP_INCLUDED │ │ │ │ +
    relevance 3../include/libtorrent/stat.hpp:257everything but payload counters and rates could probably be removed from here

    everything but payload counters and rates could probably be │ │ │ │ +removed from here

    ../include/libtorrent/stat.hpp:257

    		// 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);
    │ │ │ │ +		}
    │ │ │ │ +
    │ │ │ │ +		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(); }
    │ │ │ │ +
    │ │ │ │ +		// 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 │ │ │ │ + }; │ │ │ │ + │ │ │ │ + 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]; │ │ │ │ + }; │ │ │ │ + │ │ │ │ +} │ │ │ │ + │ │ │ │ +#endif // TORRENT_STAT_HPP_INCLUDED │ │ │ │ +
    relevance 3../include/libtorrent/torrent.hpp:1423factor out predictive pieces and all operations on it into a separate class (to use as member here instead)

    factor out predictive pieces and all operations on it into a │ │ │ │ separate class (to use as member here instead)

    ../include/libtorrent/torrent.hpp:1423

    #endif
    │ │ │ │  
    │ │ │ │  		std::string m_trackerid;
    │ │ │ │  #if TORRENT_ABI_VERSION == 1
    │ │ │ │  		// deprecated in 1.1
    │ │ │ │  		std::string m_username;
    │ │ │ │  		std::string m_password;
    │ │ │ │ @@ -1657,15 +1807,15 @@
    │ │ │ │  		// cycle, and not in the constructor. So we need to save if away here
    │ │ │ │  		std::unique_ptr<add_torrent_params> 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
    │ │ │ │ -
    relevance 3../include/libtorrent/torrent.hpp:1483factor out the links (as well as update_list() to a separate class that torrent can inherit)

    factor out the links (as well as update_list() to a separate │ │ │ │ +relevance 3../include/libtorrent/torrent.hpp:1483factor out the links (as well as update_list() to a separate class that torrent can inherit)

    factor out the links (as well as update_list() to a separate │ │ │ │ class that torrent can inherit)

    ../include/libtorrent/torrent.hpp:1483

    │ │ │ │  		// 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;
    │ │ │ │ @@ -1709,65 +1859,15 @@
    │ │ │ │  
    │ │ │ │  		// 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()
    │ │ │ │ -
    relevance 3../include/libtorrent/stat.hpp:257everything but payload counters and rates could probably be removed from here

    everything but payload counters and rates could probably be │ │ │ │ -removed from here

    ../include/libtorrent/stat.hpp:257

    		// 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);
    │ │ │ │ -		}
    │ │ │ │ -
    │ │ │ │ -		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(); }
    │ │ │ │ -
    │ │ │ │ -		// 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 │ │ │ │ - }; │ │ │ │ - │ │ │ │ - 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]; │ │ │ │ - }; │ │ │ │ - │ │ │ │ -} │ │ │ │ - │ │ │ │ -#endif // TORRENT_STAT_HPP_INCLUDED │ │ │ │ -
    relevance 3../include/libtorrent/pe_crypto.hpp:72dh_key_exchange should probably move into its own file

    dh_key_exchange should probably move into its own file

    ../include/libtorrent/pe_crypto.hpp:72

    │ │ │ │ +
    relevance 3../include/libtorrent/pe_crypto.hpp:72dh_key_exchange should probably move into its own file

    dh_key_exchange should probably move into its own file

    ../include/libtorrent/pe_crypto.hpp:72

    │ │ │ │  #include <list>
    │ │ │ │  #include <array>
    │ │ │ │  #include <cstdint>
    │ │ │ │  
    │ │ │ │  namespace libtorrent {
    │ │ │ │  
    │ │ │ │  	namespace mp = boost::multiprecision;
    │ │ │ │ @@ -1810,15 +1910,15 @@
    │ │ │ │  
    │ │ │ │  	struct TORRENT_EXTRA_EXPORT encryption_handler
    │ │ │ │  	{
    │ │ │ │  		std::tuple<int, span<span<char const>>>
    │ │ │ │  		encrypt(span<span<char>> iovec);
    │ │ │ │  
    │ │ │ │  		int decrypt(aux::crypto_receive_buffer& recv_buffer
    │ │ │ │ -
    relevance 3../include/libtorrent/enum_net.hpp:164use string_view for device_name

    use string_view for device_name

    ../include/libtorrent/enum_net.hpp:164

    	// return nullopt.
    │ │ │ │ +
    relevance 3../include/libtorrent/enum_net.hpp:164use string_view for device_name

    use string_view for device_name

    ../include/libtorrent/enum_net.hpp:164

    	// return nullopt.
    │ │ │ │  	TORRENT_EXTRA_EXPORT boost::optional<address> get_gateway(
    │ │ │ │  		ip_interface const& iface, span<ip_route const> routes);
    │ │ │ │  
    │ │ │ │  	// 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);
    │ │ │ │ @@ -1861,114 +1961,14 @@
    │ │ │ │  		// 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();
    │ │ │ │ -
    relevance 3../include/libtorrent/web_peer_connection.hpp:119if we make this be a disk_buffer_holder instead we would save a copy use allocate_disk_receive_buffer and release_disk_receive_buffer

    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

    ../include/libtorrent/web_peer_connection.hpp:119

    		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)
    │ │ │ │ -		struct file_request_t
    │ │ │ │ -		{
    │ │ │ │ -			file_index_t file_index;
    │ │ │ │ -			int length;
    │ │ │ │ -			std::int64_t start;
    │ │ │ │ -		};
    │ │ │ │ -		std::deque<file_request_t> m_file_requests;
    │ │ │ │ -
    │ │ │ │ -		std::string m_url;
    │ │ │ │ -
    │ │ │ │ -		web_seed_t* m_web;
    │ │ │ │ -
    │ │ │ │ -		// this is used for intermediate storage of pieces to be delivered to the
    │ │ │ │ -		// bittorrent engine
    │ │ │ │ -
    aux::vector<char> m_piece; │ │ │ │ -
    │ │ │ │ - // the number of bytes we've forwarded to the incoming_payload() function │ │ │ │ - // in the current HTTP response. used to know where in the buffer the │ │ │ │ - // next response starts │ │ │ │ - int m_received_body; │ │ │ │ - │ │ │ │ - // this is the offset inside the current receive │ │ │ │ - // buffer where the next chunk header will be. │ │ │ │ - // this is updated for each chunk header that's │ │ │ │ - // parsed. It does not necessarily point to a valid │ │ │ │ - // offset in the receive buffer, if we haven't received │ │ │ │ - // it yet. This offset never includes the HTTP header │ │ │ │ - int m_chunk_pos; │ │ │ │ - │ │ │ │ - // this is the number of bytes we've already received │ │ │ │ - // from the next chunk header we're waiting for │ │ │ │ - int m_partial_chunk_header; │ │ │ │ - │ │ │ │ - // the number of responses we've received so far on │ │ │ │ - // this connection │ │ │ │ - int m_num_responses; │ │ │ │ - }; │ │ │ │ -} │ │ │ │ - │ │ │ │ -#endif // TORRENT_WEB_PEER_CONNECTION_HPP_INCLUDED │ │ │ │ -
    relevance 3../include/libtorrent/torrent_handle.hpp:535unify url_seed and http_seed with just web_seed, using the web_seed_entry.

    unify url_seed and http_seed with just web_seed, using the │ │ │ │ -web_seed_entry.

    ../include/libtorrent/torrent_handle.hpp:535

    		// 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 │ │ │ │ - , client_data_t userdata = client_data_t{}); │ │ │ │
    relevance 3../include/libtorrent/kademlia/routing_table.hpp:153to 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.

    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.

    ../include/libtorrent/kademlia/routing_table.hpp:153

    // * 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,66 @@
    │ │ │ │  
    │ │ │ │  	// 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
    │ │ │ │  		, std::string const& part_file_name, remove_flags_t options, storage_error& ec);
    │ │ │ │  
    │ │ │ │ -
    relevance 2../test/test_dht.cpp:1642test num_global_nodes

    test num_global_nodes

    ../test/test_dht.cpp:1642

    relevance 2../test/test_dht.cpp:1643test need_refresh

    test need_refresh

    ../test/test_dht.cpp:1643

    │ │ │ │ +
    relevance 2../test/test_storage.cpp:769split this test up into smaller parts

    split this test up into smaller parts

    ../test/test_storage.cpp:769

    	io->submit_jobs();
    │ │ │ │ +	ios.restart();
    │ │ │ │ +	run_until(ios, done);
    │ │ │ │ +
    │ │ │ │ +	TEST_EQUAL(oversized, bool(flags & test_oversized));
    │ │ │ │ +
    │ │ │ │ +	for (auto const i : info->piece_range())
    │ │ │ │ +	{
    │ │ │ │ +		done = false;
    │ │ │ │ +		io->async_hash(st, i, {}
    │ │ │ │ +			, disk_interface::sequential_access | disk_interface::volatile_read | disk_interface::v1_hash
    │ │ │ │ +			, std::bind(&on_piece_checked, _1, _2, _3, &done));
    │ │ │ │ +		io->submit_jobs();
    │ │ │ │ +		ios.restart();
    │ │ │ │ +		run_until(ios, done);
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	io->abort(true);
    │ │ │ │ +}
    │ │ │ │ +
    │ │ │ │ +
    template <typename StorageType> │ │ │ │ +
    void run_test() │ │ │ │ +{ │ │ │ │ + std::string const test_path = current_working_directory(); │ │ │ │ + std::cout << "\n=== " << test_path << " ===\n" << std::endl; │ │ │ │ + │ │ │ │ + std::shared_ptr<torrent_info> info; │ │ │ │ + │ │ │ │ + std::vector<char> piece0 = new_piece(piece_size); │ │ │ │ + std::vector<char> piece1 = new_piece(piece_size); │ │ │ │ + std::vector<char> piece2 = new_piece(piece_size); │ │ │ │ + std::vector<char> piece3 = new_piece(piece_size); │ │ │ │ + │ │ │ │ + delete_dirs("temp_storage"); │ │ │ │ + │ │ │ │ + file_storage fs; │ │ │ │ + fs.add_file("temp_storage/test1.tmp", 17); │ │ │ │ + fs.add_file("temp_storage/test2.tmp", 612); │ │ │ │ + fs.add_file("temp_storage/test3.tmp", 0); │ │ │ │ + fs.add_file("temp_storage/test4.tmp", 0); │ │ │ │ + fs.add_file("temp_storage/test5.tmp", 3253); │ │ │ │ + fs.add_file("temp_storage/test6.tmp", 841); │ │ │ │ + int const last_file_size = 4 * int(piece_size) - int(fs.total_size()); │ │ │ │ + fs.add_file("temp_storage/test7.tmp", last_file_size); │ │ │ │ + │ │ │ │ + // File layout │ │ │ │ + // +-+--+++-------+-------+----------------------------------------------------------------------------------------+ │ │ │ │ + // |1| 2||| file5 | file6 | file7 | │ │ │ │ + // +-+--+++-------+-------+----------------------------------------------------------------------------------------+ │ │ │ │ + // | | | | | │ │ │ │ + // | piece 0 | piece 1 | piece 2 | piece 3 | │ │ │ │ +
    relevance 2../test/test_dht.cpp:1642test num_global_nodes

    test num_global_nodes

    ../test/test_dht.cpp:1642

    relevance 2../test/test_dht.cpp:1643test need_refresh

    test need_refresh

    ../test/test_dht.cpp:1643

    │ │ │ │  	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);
    │ │ │ │  	}
    │ │ │ │ @@ -2117,15 +2168,15 @@
    │ │ │ │  		std::vector<node_entry> 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(&compare_ref
    │ │ │ │  				, std::bind(&node_entry::id, _1)
    │ │ │ │  				, std::bind(&node_entry::id, _2), id));
    │ │ │ │  
    │ │ │ │ -
    relevance 2../test/test_dht.cpp:2828split this up into smaller test cases

    split this up into smaller test cases

    ../test/test_dht.cpp:2828

    │ │ │ │ +
    relevance 2../test/test_dht.cpp:2828split this up into smaller test cases

    split this up into smaller test cases

    ../test/test_dht.cpp:2828

    │ │ │ │  	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");
    │ │ │ │  }
    │ │ │ │ @@ -2168,119 +2219,230 @@
    │ │ │ │  	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");
    │ │ │ │ -
    relevance 2../test/test_storage.cpp:769split this test up into smaller parts

    split this test up into smaller parts

    ../test/test_storage.cpp:769

    	io->submit_jobs();
    │ │ │ │ -	ios.restart();
    │ │ │ │ -	run_until(ios, done);
    │ │ │ │ +
    relevance 2../test/test_piece_picker.cpp:2870test picking with partial pieces and other peers present so that both backup_pieces and backup_pieces2 are used

    test picking with partial pieces and other peers present so that both │ │ │ │ +backup_pieces and backup_pieces2 are used

    ../test/test_piece_picker.cpp:2870

    relevance 2../src/peer_connection.cpp:2562this 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

    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

    ../src/peer_connection.cpp:2562

    			}
    │ │ │ │ +#endif
    │ │ │ │  
    │ │ │ │ -	TEST_EQUAL(oversized, bool(flags & test_oversized));
    │ │ │ │ +			write_reject_request(r);
    │ │ │ │ +			if (m_num_invalid_requests < std::numeric_limits<decltype(m_num_invalid_requests)>::max())
    │ │ │ │ +				++m_num_invalid_requests;
    │ │ │ │  
    │ │ │ │ -	for (auto const i : info->piece_range())
    │ │ │ │ -	{
    │ │ │ │ -		done = false;
    │ │ │ │ -		io->async_hash(st, i, {}
    │ │ │ │ -			, disk_interface::sequential_access | disk_interface::volatile_read | disk_interface::v1_hash
    │ │ │ │ -			, std::bind(&on_piece_checked, _1, _2, _3, &done));
    │ │ │ │ -		io->submit_jobs();
    │ │ │ │ -		ios.restart();
    │ │ │ │ -		run_until(ios, done);
    │ │ │ │ -	}
    │ │ │ │ +			if (t->alerts().should_post<invalid_request_alert>())
    │ │ │ │ +			{
    │ │ │ │ +				// msvc 12 appears to deduce the rvalue reference template
    │ │ │ │ +				// incorrectly for bool temporaries. So, create a dummy instance
    │ │ │ │ +				bool const peer_interested = bool(m_peer_interested);
    │ │ │ │ +				t->alerts().emplace_alert<invalid_request_alert>(
    │ │ │ │ +					t->get_handle(), m_remote, m_peer_id, r
    │ │ │ │ +					, t->user_have_piece(r.piece), peer_interested, false);
    │ │ │ │ +			}
    │ │ │ │  
    │ │ │ │ -	io->abort(true);
    │ │ │ │ -}
    │ │ │ │ +			// every ten invalid request, remind the peer that it's choked
    │ │ │ │ +			if (!m_peer_interested && m_num_invalid_requests % 10 == 0 && m_choked)
    │ │ │ │ +			{
    │ │ │ │ +
    if (m_num_invalid_requests > 300 && !m_peer_choked │ │ │ │ +
    && can_disconnect(errors::too_many_requests_when_choked)) │ │ │ │ + { │ │ │ │ + disconnect(errors::too_many_requests_when_choked, operation_t::bittorrent, peer_error); │ │ │ │ + return; │ │ │ │ + } │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ + peer_log(peer_log_alert::outgoing_message, "CHOKE"); │ │ │ │ +#endif │ │ │ │ + write_choke(); │ │ │ │ + } │ │ │ │ │ │ │ │ -
    template <typename StorageType> │ │ │ │ -
    void run_test() │ │ │ │ -{ │ │ │ │ - std::string const test_path = current_working_directory(); │ │ │ │ - std::cout << "\n=== " << test_path << " ===\n" << std::endl; │ │ │ │ + return; │ │ │ │ + } │ │ │ │ │ │ │ │ - std::shared_ptr<torrent_info> info; │ │ │ │ + // if we have choked the client │ │ │ │ + // ignore the request │ │ │ │ + int const blocks_per_piece = │ │ │ │ + (ti.piece_length() + t->block_size() - 1) / t->block_size(); │ │ │ │ │ │ │ │ - std::vector<char> piece0 = new_piece(piece_size); │ │ │ │ - std::vector<char> piece1 = new_piece(piece_size); │ │ │ │ - std::vector<char> piece2 = new_piece(piece_size); │ │ │ │ - std::vector<char> piece3 = new_piece(piece_size); │ │ │ │ + // disconnect peers that downloads more than foo times an allowed │ │ │ │ + // fast piece │ │ │ │ + if (m_choked && fast_idx != -1 && m_accept_fast_piece_cnt[fast_idx] >= 3 * blocks_per_piece │ │ │ │ + && can_disconnect(errors::too_many_requests_when_choked)) │ │ │ │ + { │ │ │ │ + disconnect(errors::too_many_requests_when_choked, operation_t::bittorrent, peer_error); │ │ │ │ + return; │ │ │ │ + } │ │ │ │ │ │ │ │ - delete_dirs("temp_storage"); │ │ │ │ + if (m_choked && fast_idx == -1) │ │ │ │ + { │ │ │ │ +
    relevance 2../src/peer_connection.cpp:3309since 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?

    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?

    ../src/peer_connection.cpp:3309

    │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │ +		peer_log(peer_log_alert::incoming_message, "CANCEL"
    │ │ │ │ +			, "piece: %d s: %x l: %x", static_cast<int>(r.piece), r.start, r.length);
    │ │ │ │ +#endif
    │ │ │ │  
    │ │ │ │ -	file_storage fs;
    │ │ │ │ -	fs.add_file("temp_storage/test1.tmp", 17);
    │ │ │ │ -	fs.add_file("temp_storage/test2.tmp", 612);
    │ │ │ │ -	fs.add_file("temp_storage/test3.tmp", 0);
    │ │ │ │ -	fs.add_file("temp_storage/test4.tmp", 0);
    │ │ │ │ -	fs.add_file("temp_storage/test5.tmp", 3253);
    │ │ │ │ -	fs.add_file("temp_storage/test6.tmp", 841);
    │ │ │ │ -	int const last_file_size = 4 * int(piece_size) - int(fs.total_size());
    │ │ │ │ -	fs.add_file("temp_storage/test7.tmp", last_file_size);
    │ │ │ │ +		auto const i = std::find(m_requests.begin(), m_requests.end(), r);
    │ │ │ │  
    │ │ │ │ -	// File layout
    │ │ │ │ -	// +-+--+++-------+-------+----------------------------------------------------------------------------------------+
    │ │ │ │ -	// |1| 2||| file5 | file6 | file7                                                                                  |
    │ │ │ │ -	// +-+--+++-------+-------+----------------------------------------------------------------------------------------+
    │ │ │ │ -	// |                           |                           |                           |                           |
    │ │ │ │ -	// | piece 0                   | piece 1                   | piece 2                   | piece 3                   |
    │ │ │ │ -
    relevance 2../test/test_piece_picker.cpp:2870test picking with partial pieces and other peers present so that both backup_pieces and backup_pieces2 are used

    test picking with partial pieces and other peers present so that both │ │ │ │ -backup_pieces and backup_pieces2 are used

    ../test/test_piece_picker.cpp:2870

    relevance 2../src/alert.cpp:2021the salt here is allocated on the heap. It would be nice to allocate in the stack_allocator

    the salt here is allocated on the heap. It would be nice to │ │ │ │ -allocate in the stack_allocator

    ../src/alert.cpp:2021

    	}
    │ │ │ │ +		if (i != m_requests.end())
    │ │ │ │ +		{
    │ │ │ │ +			m_counters.inc_stats_counter(counters::cancelled_piece_requests);
    │ │ │ │ +			m_requests.erase(i);
    │ │ │ │  
    │ │ │ │ -	dht_immutable_item_alert::dht_immutable_item_alert(aux::stack_allocator&
    │ │ │ │ -		, sha1_hash const& t, entry i)
    │ │ │ │ -		: target(t), item(std::move(i))
    │ │ │ │ -	{}
    │ │ │ │ +			if (m_requests.empty())
    │ │ │ │ +				m_counters.inc_stats_counter(counters::num_peers_up_requests, -1);
    │ │ │ │  
    │ │ │ │ -	std::string dht_immutable_item_alert::message() const
    │ │ │ │ -	{
    │ │ │ │ -#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;
    │ │ │ │ +			write_reject_request(r);
    │ │ │ │ +		}
    │ │ │ │ +		else
    │ │ │ │ +		{
    │ │ │ │ +
    #ifndef TORRENT_DISABLE_LOGGING │ │ │ │ +
    peer_log(peer_log_alert::info, "INVALID_CANCEL", "got cancel not in the queue"); │ │ │ │ #endif │ │ │ │ + } │ │ │ │ } │ │ │ │ │ │ │ │ -
    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) │ │ │ │ - {} │ │ │ │ + // ----------------------------- │ │ │ │ + // --------- DHT PORT ---------- │ │ │ │ + // ----------------------------- │ │ │ │ │ │ │ │ - std::string dht_mutable_item_alert::message() const │ │ │ │ + void peer_connection::incoming_dht_port(int const listen_port) │ │ │ │ { │ │ │ │ -#ifdef TORRENT_DISABLE_ALERT_MSG │ │ │ │ - return {}; │ │ │ │ + TORRENT_ASSERT(is_single_thread()); │ │ │ │ + INVARIANT_CHECK; │ │ │ │ + │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ + peer_log(peer_log_alert::incoming_message, "DHT_PORT", "p: %d", listen_port); │ │ │ │ +#endif │ │ │ │ +#ifndef TORRENT_DISABLE_DHT │ │ │ │ + m_ses.add_dht_node({m_remote.address(), std::uint16_t(listen_port)}); │ │ │ │ #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; │ │ │ │ + TORRENT_UNUSED(listen_port); │ │ │ │ #endif │ │ │ │ } │ │ │ │ │ │ │ │ - dht_put_alert::dht_put_alert(aux::stack_allocator&, sha1_hash const& t, int n) │ │ │ │ - : target(t) │ │ │ │ - , public_key() │ │ │ │ - , signature() │ │ │ │ - , salt() │ │ │ │ -
    relevance 2../src/web_peer_connection.cpp:626just 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

    just make this peer not have the pieces │ │ │ │ + // ----------------------------- │ │ │ │ + // --------- HAVE ALL ---------- │ │ │ │ + // ----------------------------- │ │ │ │ + │ │ │ │ + void peer_connection::incoming_have_all() │ │ │ │ + { │ │ │ │ +relevance 2../src/peer_connection.cpp:4975use 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

    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

    ../src/peer_connection.cpp:4975

    			if (d > seconds(connect_timeout)
    │ │ │ │ +				&& can_disconnect(errors::timed_out))
    │ │ │ │ +			{
    │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │ +				peer_log(peer_log_alert::info, "CONNECT_FAILED", "waited %d seconds"
    │ │ │ │ +					, int(total_seconds(d)));
    │ │ │ │ +#endif
    │ │ │ │ +				connect_failed(errors::timed_out);
    │ │ │ │ +				return;
    │ │ │ │ +			}
    │ │ │ │ +		}
    │ │ │ │ +
    │ │ │ │ +		// if the bw_network flag isn't set, it means we are not even trying to
    │ │ │ │ +		// read from this peer's socket. Most likely because we're applying a
    │ │ │ │ +		// rate limit. If the peer is "slow" because we are rate limiting it,
    │ │ │ │ +		// don't enforce timeouts. However, as soon as we *do* read from the
    │ │ │ │ +		// socket, we expect to receive data, and not have timed out. Then we
    │ │ │ │ +		// can enforce the timeouts.
    │ │ │ │ +		bool const reading_socket = bool(m_channel_state[download_channel] & peer_info::bw_network);
    │ │ │ │ +
    │ │ │ │ +
    if (reading_socket && d > seconds(timeout()) && !m_connecting && m_reading_bytes == 0 │ │ │ │ +
    && can_disconnect(errors::timed_out_inactivity)) │ │ │ │ + { │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ + peer_log(peer_log_alert::info, "LAST_ACTIVITY", "%d seconds ago" │ │ │ │ + , int(total_seconds(d))); │ │ │ │ +#endif │ │ │ │ + disconnect(errors::timed_out_inactivity, operation_t::bittorrent); │ │ │ │ + return; │ │ │ │ + } │ │ │ │ + │ │ │ │ + // do not stall waiting for a handshake │ │ │ │ + int timeout = m_settings.get_int (settings_pack::handshake_timeout); │ │ │ │ +#if TORRENT_USE_I2P │ │ │ │ + timeout *= is_i2p(m_socket) ? 4 : 1; │ │ │ │ +#endif │ │ │ │ + if (reading_socket │ │ │ │ + && !m_connecting │ │ │ │ + && in_handshake() │ │ │ │ + && d > seconds(timeout)) │ │ │ │ + { │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ + peer_log(peer_log_alert::info, "NO_HANDSHAKE", "waited %d seconds" │ │ │ │ + , int(total_seconds(d))); │ │ │ │ +#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 │ │ │ │ +
    relevance 2../src/instantiate_connection.cpp:44peer_connection and tracker_connection should probably be flags

    peer_connection and tracker_connection should probably be flags

    ../src/instantiate_connection.cpp:44

    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 {
    │ │ │ │ +
    │ │ │ │ +
    aux::socket_type instantiate_connection(io_context& ios │ │ │ │ +
    , aux::proxy_settings const& 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<utp_stream> s(ios, *static_cast<ssl::context*>(ssl_context)); │ │ │ │ + s.next_layer().set_impl(sm->new_utp_socket(&s.next_layer())); │ │ │ │ + return socket_type(std::move(s)); │ │ │ │ + } │ │ │ │ + else │ │ │ │ +#endif │ │ │ │ + { │ │ │ │ + utp_stream s(ios); │ │ │ │ + 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) │ │ │ │ + { │ │ │ │ +
    relevance 2../src/web_peer_connection.cpp:626just 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

    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

    ../src/web_peer_connection.cpp:626

    │ │ │ │  	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;
    │ │ │ │ @@ -2326,168 +2488,328 @@
    │ │ │ │  	}
    │ │ │ │  	m_web = nullptr;
    │ │ │ │  	TORRENT_ASSERT(is_disconnecting());
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │  void web_peer_connection::handle_redirect(int const bytes_left)
    │ │ │ │  {
    │ │ │ │ -
    relevance 2../src/instantiate_connection.cpp:44peer_connection and tracker_connection should probably be flags

    peer_connection and tracker_connection should probably be flags

    ../src/instantiate_connection.cpp:44

    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 {
    │ │ │ │ +
    relevance 2../src/path.cpp:429test this on a FAT volume to see what error we get!

    test this on a FAT volume to see what error we get!

    ../src/path.cpp:429

    			// it's possible CreateHardLink will copy the file internally too,
    │ │ │ │ +			// if the filesystem does not support it.
    │ │ │ │ +			ec.assign(GetLastError(), system_category());
    │ │ │ │ +			return;
    │ │ │ │ +		}
    │ │ │ │  
    │ │ │ │ -
    aux::socket_type instantiate_connection(io_context& ios │ │ │ │ -
    , aux::proxy_settings const& ps │ │ │ │ - , void* ssl_context │ │ │ │ - , utp_socket_manager* sm │ │ │ │ - , bool peer_connection │ │ │ │ - , bool tracker_connection) │ │ │ │ - { │ │ │ │ -#if !TORRENT_USE_SSL │ │ │ │ - TORRENT_UNUSED(ssl_context); │ │ │ │ + // 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 (sm) │ │ │ │ + if (ret == 0) │ │ │ │ { │ │ │ │ -#if TORRENT_USE_SSL │ │ │ │ - if (ssl_context) │ │ │ │ - { │ │ │ │ - ssl_stream<utp_stream> s(ios, *static_cast<ssl::context*>(ssl_context)); │ │ │ │ - s.next_layer().set_impl(sm->new_utp_socket(&s.next_layer())); │ │ │ │ - return socket_type(std::move(s)); │ │ │ │ - } │ │ │ │ - else │ │ │ │ -#endif │ │ │ │ - { │ │ │ │ - utp_stream s(ios); │ │ │ │ - s.set_impl(sm->new_utp_socket(&s)); │ │ │ │ - return socket_type(std::move(s)); │ │ │ │ - } │ │ │ │ + ec.clear(); │ │ │ │ + return; │ │ │ │ } │ │ │ │ -#if TORRENT_USE_I2P │ │ │ │ - else if (ps.type == settings_pack::i2p_proxy) │ │ │ │ - { │ │ │ │ -
    relevance 2../src/tracker_manager.cpp:369implement

    implement

    ../src/tracker_manager.cpp:369

    #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);
    │ │ │ │ -			}
    │ │ │ │ +
    │ │ │ │ +		// 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 │ │ │ │ - return false; │ │ │ │ + ) │ │ │ │ + { │ │ │ │ + // some error happened, report up to the caller │ │ │ │ + ec.assign(errno, system_category()); │ │ │ │ + return; │ │ │ │ } │ │ │ │ │ │ │ │ - std::shared_ptr<udp_tracker_connection> const p = i->second; │ │ │ │ - // on_receive() may remove the tracker connection from the list │ │ │ │ - return p->on_receive(ep, buf); │ │ │ │ + // fall back to making a copy │ │ │ │ + │ │ │ │ +#endif │ │ │ │ + │ │ │ │ + // if we get here, we should copy the file │ │ │ │ + storage_error se; │ │ │ │ + aux::copy_file(file, link, se); │ │ │ │ + ec = se.ec; │ │ │ │ } │ │ │ │ │ │ │ │ - void tracker_manager::incoming_error(error_code const& │ │ │ │ - , udp::endpoint const&) │ │ │ │ + bool is_directory(std::string const& f, error_code& ec) │ │ │ │ { │ │ │ │ - TORRENT_ASSERT(is_single_thread()); │ │ │ │ -
    } │ │ │ │ -
    │ │ │ │ - bool tracker_manager::incoming_packet(string_view const hostname │ │ │ │ - , span<char const> const buf) │ │ │ │ + ec.clear(); │ │ │ │ + error_code e; │ │ │ │ + file_status s; │ │ │ │ + stat_file(f, &s, e); │ │ │ │ + if (!e && s.mode & file_status::directory) return true; │ │ │ │ + ec = e; │ │ │ │ +
    relevance 2../src/bdecode.cpp:826attempt to simplify this implementation by embracing the span

    attempt to simplify this implementation by embracing the span

    ../src/bdecode.cpp:826

    	}
    │ │ │ │ +
    │ │ │ │ +	bdecode_node bdecode(span<char const> buffer
    │ │ │ │ +		, error_code& ec, int* error_pos, int depth_limit, int token_limit)
    │ │ │ │  	{
    │ │ │ │ -		TORRENT_ASSERT(is_single_thread());
    │ │ │ │ -		// ignore packets smaller than 8 bytes
    │ │ │ │ -		if (buf.size() < 16) return false;
    │ │ │ │ +		bdecode_node ret;
    │ │ │ │ +		ec.clear();
    │ │ │ │  
    │ │ │ │ -		// the first word is the action, if it's not [0, 3]
    │ │ │ │ -		// it's not a valid udp tracker response
    │ │ │ │ -		span<const char> ptr = buf;
    │ │ │ │ -		std::uint32_t const action = aux::read_uint32(ptr);
    │ │ │ │ -		if (action > 3) return false;
    │ │ │ │ +		if (buffer.size() > bdecode_token::max_offset)
    │ │ │ │ +		{
    │ │ │ │ +			if (error_pos) *error_pos = 0;
    │ │ │ │ +			ec = bdecode_errors::limit_exceeded;
    │ │ │ │ +			return ret;
    │ │ │ │ +		}
    │ │ │ │  
    │ │ │ │ -		std::uint32_t const transaction = aux::read_uint32(ptr);
    │ │ │ │ -		auto const i = m_udp_conns.find(transaction);
    │ │ │ │ +		// 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 (i == m_udp_conns.end())
    │ │ │ │ +
    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) │ │ │ │ { │ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ - // now, this may not have been meant to be a tracker response, │ │ │ │ - // but chances are pretty good, so it's probably worth logging │ │ │ │ - m_ses.session_log("incoming UDP tracker packet from %s has invalid " │ │ │ │ - "transaction ID (%x)", std::string(hostname).c_str(), int(transaction)); │ │ │ │ -#endif │ │ │ │ - return false; │ │ │ │ - } │ │ │ │ + if (start >= end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof); │ │ │ │ │ │ │ │ - std::shared_ptr<udp_tracker_connection> const p = i->second; │ │ │ │ - // on_receive() may remove the tracker connection from the list │ │ │ │ -
    relevance 2../src/escape_string.cpp:194this should probably be moved into string_util.cpp

    this should probably be moved into string_util.cpp

    ../src/escape_string.cpp:194

    	{
    │ │ │ │ -		return escape_string_impl(str.data(), int(str.size()), 10);
    │ │ │ │ +			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)
    │ │ │ │ +				{
    │ │ │ │ +					// the current parent is a dict and we are parsing a key.
    │ │ │ │ +
    relevance 2../src/alert_manager.cpp:80keep a count of the number of threads waiting. Only if it's > 0 notify them

    keep a count of the number of threads waiting. Only if it's │ │ │ │ +> 0 notify them

    ../src/alert_manager.cpp:80

    			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;
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ -	bool need_encoding(char const* str, int const len)
    │ │ │ │ +	void alert_manager::maybe_notify(alert* a)
    │ │ │ │  	{
    │ │ │ │ -		for (int i = 0; i < len; ++i)
    │ │ │ │ +		if (m_alerts[m_generation].size() == 1)
    │ │ │ │  		{
    │ │ │ │ -			if (std::strchr(unreserved_chars, *str) == nullptr || *str == 0)
    │ │ │ │ -				return true;
    │ │ │ │ -			++str;
    │ │ │ │ +			// 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(); │ │ │ │ } │ │ │ │ - return false; │ │ │ │ } │ │ │ │ │ │ │ │ - void convert_path_to_posix(std::string& path) │ │ │ │ +#ifndef TORRENT_DISABLE_EXTENSIONS │ │ │ │ + void alert_manager::add_extension(std::shared_ptr<plugin> ext) │ │ │ │ { │ │ │ │ - std::replace(path.begin(), path.end(), '\\', '/'); │ │ │ │ + m_ses_extensions.push_back(std::move(ext)); │ │ │ │ } │ │ │ │ +#endif │ │ │ │ │ │ │ │ -
    std::string read_until(char const*& str, char const delim, char const* end) │ │ │ │ -
    { │ │ │ │ - TORRENT_ASSERT(str <= end); │ │ │ │ + void alert_manager::get_all(std::vector<alert*>& alerts) │ │ │ │ + { │ │ │ │ + std::lock_guard<std::recursive_mutex> lock(m_mutex); │ │ │ │ +
    relevance 2../src/storage_utils.cpp:294technically, 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

    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

    ../src/storage_utils.cpp:294

    			while (--file_index >= file_index_t(0))
    │ │ │ │ +			{
    │ │ │ │ +				// files moved out to absolute paths are not moved
    │ │ │ │ +				if (f.file_absolute_path(file_index)) continue;
    │ │ │ │  
    │ │ │ │ -		std::string ret;
    │ │ │ │ -		while (str != end && *str != delim)
    │ │ │ │ +				// if we ended up copying the file, don't do anything during
    │ │ │ │ +				// roll-back
    │ │ │ │ +				if (copied_files[file_index]) continue;
    │ │ │ │ +
    │ │ │ │ +				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));
    │ │ │ │ +
    │ │ │ │ +				// ignore errors when rolling back
    │ │ │ │ +				storage_error ignore;
    │ │ │ │ +				move_file(new_path, old_path, ignore);
    │ │ │ │ +			}
    │ │ │ │ +
    │ │ │ │ +			return { status_t::fatal_disk_error, save_path };
    │ │ │ │ +		}
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    std::set<std::string> subdirs; │ │ │ │ + for (auto const i : f.file_range()) │ │ │ │ { │ │ │ │ - ret += *str; │ │ │ │ - ++str; │ │ │ │ + // 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; │ │ │ │ + │ │ │ │ + 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); │ │ │ │ } │ │ │ │ - // 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; │ │ │ │ + for (std::string const& s : subdirs) │ │ │ │ + { │ │ │ │ + error_code err; │ │ │ │ + std::string subdir = combine_path(save_path, s); │ │ │ │ │ │ │ │ - // first figure out if this url contains unencoded characters │ │ │ │ - if (!need_encoding(path.c_str(), int(path.size()))) │ │ │ │ - return url; │ │ │ │ + while (!path_equal(subdir, save_path) && !err) │ │ │ │ + { │ │ │ │ + remove(subdir, err); │ │ │ │ +
    relevance 2../src/storage_utils.cpp:486is 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

    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

    ../src/storage_utils.cpp:486

    				{
    │ │ │ │ +					// 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);
    │ │ │ │  
    │ │ │ │ -		std::string msg;
    │ │ │ │ -		std::string escaped_path { escape_path(path) };
    │ │ │ │ -		// reserve enough space so further append will
    │ │ │ │ -		// only copy values to existing location
    │ │ │ │ -
    relevance 2../src/http_tracker_connection.cpp:479returning a bool here is redundant. Instead this function should return the peer_entry

    returning a bool here is redundant. Instead this function should │ │ │ │ + if (err) │ │ │ │ + { │ │ │ │ + ec.file(idx); │ │ │ │ + ec.operation = operation_t::mkdir; │ │ │ │ + return false; │ │ │ │ + } │ │ │ │ + │ │ │ │ + hard_link(s, file_path, err); │ │ │ │ + } │ │ │ │ + │ │ │ │ + // if the file already exists, that's not an error │ │ │ │ + if (err == boost::system::errc::file_exists) │ │ │ │ + continue; │ │ │ │ + │ │ │ │ +
    if (err) │ │ │ │ +
    { │ │ │ │ + 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 │ │ │ │ + │ │ │ │ + bool const seed = (rd.have_pieces.size() >= fs.num_pieces() │ │ │ │ + && rd.have_pieces.all_set()) │ │ │ │ + || (rd.flags & torrent_flags::seed_mode); │ │ │ │ + │ │ │ │ + if (seed) │ │ │ │ + { │ │ │ │ + for (file_index_t const file_index : fs.file_range()) │ │ │ │ + { │ │ │ │ + if (fs.pad_file_at(file_index)) continue; │ │ │ │ + │ │ │ │ + // 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)) │ │ │ │ + continue; │ │ │ │ + │ │ │ │ +relevance 2../src/upnp.cpp:106use boost::asio::ip::network instead of netmask

    use boost::asio::ip::network instead of netmask

    ../src/upnp.cpp:106

    │ │ │ │ +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() │ │ │ │ +{ │ │ │ │ +
    relevance 2../src/http_tracker_connection.cpp:479returning a bool here is redundant. Instead this function should return the peer_entry

    returning a bool here is redundant. Instead this function should │ │ │ │ return the peer_entry

    ../src/http_tracker_connection.cpp:479

    		{
    │ │ │ │  			cb->tracker_scrape_response(tracker_req(), resp.complete
    │ │ │ │  				, resp.incomplete, resp.downloaded, resp.downloaders);
    │ │ │ │  		}
    │ │ │ │  		else
    │ │ │ │  		{
    │ │ │ │  			std::list<address> ip_list;
    │ │ │ │ @@ -2531,309 +2853,169 @@
    │ │ │ │  			return false;
    │ │ │ │  		}
    │ │ │ │  		ret.hostname = i.string_value().to_string();
    │ │ │ │  
    │ │ │ │  		// extract port
    │ │ │ │  		i = info.dict_find_int("port");
    │ │ │ │  		if (!i)
    │ │ │ │ -
    relevance 2../src/session_impl.cpp:599is there a reason not to move all of this into init()? and just post it to the io_context?

    is there a reason not to move all of this into init()? and just │ │ │ │ -post it to the io_context?

    ../src/session_impl.cpp:599

    	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 │ │ │ │ -#if defined TORRENT_WINDOWS && defined TORRENT_USE_OPENSSL && !defined TORRENT_WINRT │ │ │ │ -
    relevance 2../src/session_impl.cpp:761the ip filter should probably be saved here too

    the ip filter should probably be saved here too

    ../src/session_impl.cpp:761

    		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();
    │ │ │ │ +
    relevance 2../src/udp_tracker_connection.cpp:81support authentication here. tracker_req().auth

    support authentication here. tracker_req().auth

    ../src/udp_tracker_connection.cpp:81

    		udp_tracker_connection::m_connection_cache;
    │ │ │ │  
    │ │ │ │ -		// apply all m_settings to this session
    │ │ │ │ -		run_all_updates(*this);
    │ │ │ │ -		reopen_listen_sockets(false);
    │ │ │ │ +	std::mutex udp_tracker_connection::m_cache_mutex;
    │ │ │ │  
    │ │ │ │ -#if TORRENT_USE_INVARIANT_CHECKS
    │ │ │ │ -		check_invariant();
    │ │ │ │ -#endif
    │ │ │ │ +	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();
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ -#if TORRENT_ABI_VERSION <= 2
    │ │ │ │ -
    void session_impl::save_state(entry* eptr, save_state_flags_t const flags) const │ │ │ │ -
    { │ │ │ │ - TORRENT_ASSERT(is_single_thread()); │ │ │ │ + void udp_tracker_connection::start() │ │ │ │ + { │ │ │ │ +
    std::string hostname; │ │ │ │ +
    std::string protocol; │ │ │ │ + int port; │ │ │ │ + error_code ec; │ │ │ │ │ │ │ │ - entry& e = *eptr; │ │ │ │ - // make it a dict │ │ │ │ - e.dict(); │ │ │ │ + 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 (flags & session::save_settings) │ │ │ │ + if (ec) │ │ │ │ { │ │ │ │ - entry::dictionary_type& sett = e["settings"].dict(); │ │ │ │ - save_settings_to_dict(non_default_settings(m_settings), sett); │ │ │ │ + tracker_connection::fail(ec, operation_t::parse_address); │ │ │ │ + return; │ │ │ │ } │ │ │ │ │ │ │ │ -#ifndef TORRENT_DISABLE_DHT │ │ │ │ - if (flags & session::save_dht_settings) │ │ │ │ - { │ │ │ │ - e["dht"] = dht::save_dht_settings(get_dht_settings()); │ │ │ │ - } │ │ │ │ + aux::session_settings const& settings = m_man.settings(); │ │ │ │ │ │ │ │ - if (m_dht && (flags & session::save_dht_state)) │ │ │ │ - { │ │ │ │ - e["dht state"] = dht::save_dht_state(m_dht->state()); │ │ │ │ - } │ │ │ │ -#endif │ │ │ │ + int const proxy_type = settings.get_int(settings_pack::proxy_type); │ │ │ │ │ │ │ │ -#ifndef TORRENT_DISABLE_EXTENSIONS │ │ │ │ - for (auto const& ext : m_ses_extensions[plugins_all_idx]) │ │ │ │ + if (settings.get_bool(settings_pack::proxy_hostnames) │ │ │ │ + && (proxy_type == settings_pack::socks5 │ │ │ │ + || proxy_type == settings_pack::socks5_pw)) │ │ │ │ { │ │ │ │ - ext->save_state(*eptr); │ │ │ │ + m_hostname = hostname; │ │ │ │ + m_target.port(std::uint16_t(port)); │ │ │ │ + start_announce(); │ │ │ │ } │ │ │ │ -
    relevance 2../src/session_impl.cpp:3882make 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

    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

    ../src/session_impl.cpp:3882

    		if (!m_dht_torrents.empty())
    │ │ │ │ +		else
    │ │ │ │  		{
    │ │ │ │ -			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;
    │ │ │ │ +			using namespace std::placeholders;
    │ │ │ │ +			ADD_OUTSTANDING_ASYNC("udp_tracker_connection::name_lookup");
    │ │ │ │ +
    relevance 2../src/alert.cpp:2021the salt here is allocated on the heap. It would be nice to allocate in the stack_allocator

    the salt here is allocated on the heap. It would be nice to │ │ │ │ +allocate in the stack_allocator

    ../src/alert.cpp:2021

    	}
    │ │ │ │  
    │ │ │ │ -		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 │ │ │ │ + dht_immutable_item_alert::dht_immutable_item_alert(aux::stack_allocator& │ │ │ │ + , sha1_hash const& t, entry i) │ │ │ │ + : target(t), item(std::move(i)) │ │ │ │ + {} │ │ │ │ │ │ │ │ - void session_impl::on_lsd_announce(error_code const& e) │ │ │ │ + std::string dht_immutable_item_alert::message() const │ │ │ │ { │ │ │ │ - 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_next_lsd_torrent = 0; │ │ │ │ -
    relevance 2../src/session_impl.cpp:5515this function should be removed and users need to deal with the more generic case of having multiple listen ports

    this function should be removed and users need to deal with the │ │ │ │ -more generic case of having multiple listen ports

    ../src/session_impl.cpp:5515

    #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);
    │ │ │ │ +#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
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ -	void session_impl::update_count_slow()
    │ │ │ │ -	{
    │ │ │ │ -		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); │ │ │ │ - } │ │ │ │ +
    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) │ │ │ │ + {} │ │ │ │ │ │ │ │ - std::uint16_t session_impl::listen_port(listen_socket_t* sock) const │ │ │ │ + std::string dht_mutable_item_alert::message() const │ │ │ │ { │ │ │ │ - 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; │ │ │ │ - │ │ │ │ - if (!(sock->flags & listen_socket_t::accept_incoming)) │ │ │ │ - return 0; │ │ │ │ - │ │ │ │ - return std::uint16_t(sock->tcp_external_port()); │ │ │ │ - } │ │ │ │ - │ │ │ │ -#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; │ │ │ │ -
    relevance 2../src/session_impl.cpp:5555this function should be removed and users need to deal with the more generic case of having multiple ssl ports

    this function should be removed and users need to deal with the │ │ │ │ -more generic case of having multiple ssl ports

    ../src/session_impl.cpp:5555

    				return 0;
    │ │ │ │ -
    │ │ │ │ -			return std::uint16_t(sock->tcp_external_port());
    │ │ │ │ -		}
    │ │ │ │ -
    │ │ │ │ -#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;
    │ │ │ │ +#ifdef TORRENT_DISABLE_ALERT_MSG
    │ │ │ │ +		return {};
    │ │ │ │  #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());
    │ │ │ │ +		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
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ -
    std::uint16_t session_impl::ssl_listen_port() const │ │ │ │ -
    { │ │ │ │ - return ssl_listen_port(nullptr); │ │ │ │ + dht_put_alert::dht_put_alert(aux::stack_allocator&, sha1_hash const& t, int n) │ │ │ │ + : target(t) │ │ │ │ + , public_key() │ │ │ │ + , signature() │ │ │ │ + , salt() │ │ │ │ +
    relevance 2../src/escape_string.cpp:194this should probably be moved into string_util.cpp

    this should probably be moved into string_util.cpp

    ../src/escape_string.cpp:194

    	{
    │ │ │ │ +		return escape_string_impl(str.data(), int(str.size()), 10);
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ -	std::uint16_t session_impl::ssl_listen_port(listen_socket_t* sock) const
    │ │ │ │ +	bool need_encoding(char const* str, int const len)
    │ │ │ │  	{
    │ │ │ │ -#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)
    │ │ │ │ +		for (int i = 0; i < len; ++i)
    │ │ │ │  		{
    │ │ │ │ -			if (!(s->flags & listen_socket_t::accept_incoming)) continue;
    │ │ │ │ -			if (s->ssl == transport::ssl)
    │ │ │ │ -				return std::uint16_t(s->tcp_external_port());
    │ │ │ │ +			if (std::strchr(unreserved_chars, *str) == nullptr || *str == 0)
    │ │ │ │ +				return true;
    │ │ │ │ +			++str;
    │ │ │ │  		}
    │ │ │ │ -#else
    │ │ │ │ -		TORRENT_UNUSED(sock);
    │ │ │ │ -#endif
    │ │ │ │ -		return 0;
    │ │ │ │ -	}
    │ │ │ │ -
    │ │ │ │ -	int session_impl::get_listen_port(transport const ssl, aux::listen_socket_handle const& s)
    │ │ │ │ -
    relevance 2../src/session_impl.cpp:6390this should be factored into the udp socket, so we only have the code once

    this should be factored into the udp socket, so we only have the │ │ │ │ -code once

    ../src/session_impl.cpp:6390

    		return upload_rate_limit(m_local_peer_class);
    │ │ │ │ -	}
    │ │ │ │ -
    │ │ │ │ -	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);
    │ │ │ │ +		return false;
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ -	int session_impl::download_rate_limit_depr() const
    │ │ │ │ +	void convert_path_to_posix(std::string& path)
    │ │ │ │  	{
    │ │ │ │ -		return download_rate_limit(m_global_class);
    │ │ │ │ +		std::replace(path.begin(), path.end(), '\\', '/');
    │ │ │ │  	}
    │ │ │ │ -#endif // DEPRECATE
    │ │ │ │  
    │ │ │ │ -
    │ │ │ │ -
    void session_impl::update_peer_dscp() │ │ │ │ +
    std::string read_until(char const*& str, char const delim, char const* end) │ │ │ │
    { │ │ │ │ - int const value = m_settings.get_int(settings_pack::peer_dscp); │ │ │ │ - for (auto const& l : m_listen_sockets) │ │ │ │ + TORRENT_ASSERT(str <= end); │ │ │ │ + │ │ │ │ + std::string ret; │ │ │ │ + while (str != end && *str != delim) │ │ │ │ { │ │ │ │ - if (l->sock) │ │ │ │ - { │ │ │ │ - error_code ec; │ │ │ │ - set_traffic_class(*l->sock, value, ec); │ │ │ │ + ret += *str; │ │ │ │ + ++str; │ │ │ │ + } │ │ │ │ + // skip the delimiter as well │ │ │ │ + while (str != end && *str == delim) ++str; │ │ │ │ + return ret; │ │ │ │ + } │ │ │ │ │ │ │ │ -#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()); │ │ │ │ - } │ │ │ │ -#endif │ │ │ │ - } │ │ │ │ + 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; │ │ │ │ │ │ │ │ - if (l->udp_sock) │ │ │ │ - { │ │ │ │ - error_code ec; │ │ │ │ - set_traffic_class(l->udp_sock->sock, value, ec); │ │ │ │ + // first figure out if this url contains unencoded characters │ │ │ │ + if (!need_encoding(path.c_str(), int(path.size()))) │ │ │ │ + return url; │ │ │ │ │ │ │ │ -#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->udp_sock->sock.local_port() │ │ │ │ -
    relevance 2../src/torrent.cpp:504post alert

    post alert

    ../src/torrent.cpp:504

    		if (m_current_gauge_state != no_gauge_state)
    │ │ │ │ +		std::string msg;
    │ │ │ │ +		std::string escaped_path { escape_path(path) };
    │ │ │ │ +		// reserve enough space so further append will
    │ │ │ │ +		// only copy values to existing location
    │ │ │ │ +
    relevance 2../src/torrent.cpp:504post alert

    post alert

    ../src/torrent.cpp:504

    		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);
    │ │ │ │ @@ -2876,15 +3058,15 @@
    │ │ │ │  		set_need_save_resume(torrent_handle::if_state_changed);
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │  	void torrent::verified(piece_index_t const piece)
    │ │ │ │  	{
    │ │ │ │  		TORRENT_ASSERT(!m_verified.get_bit(piece));
    │ │ │ │  		++m_num_verified;
    │ │ │ │ -
    relevance 2../src/torrent.cpp:1852add 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

    add a unit test where we don't have metadata, connect to a peer │ │ │ │ +relevance 2../src/torrent.cpp:1852add 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

    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

    ../src/torrent.cpp:1852

    			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);
    │ │ │ │  			}
    │ │ │ │  		}
    │ │ │ │  
    │ │ │ │ @@ -2928,15 +3110,15 @@
    │ │ │ │  			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)
    │ │ │ │  		{
    │ │ │ │ -
    relevance 2../src/torrent.cpp:4492use chrono type for time duration

    use chrono type for time duration

    ../src/torrent.cpp:4492

    		}
    │ │ │ │ +
    relevance 2../src/torrent.cpp:4492use chrono type for time duration

    use chrono type for time duration

    ../src/torrent.cpp:4492

    		}
    │ │ │ │  
    │ │ │ │  		m_picker->piece_passed(index);
    │ │ │ │  		update_gauge();
    │ │ │ │  		we_have(index);
    │ │ │ │  
    │ │ │ │  #ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │  		if (should_log())
    │ │ │ │ @@ -2979,15 +3161,15 @@
    │ │ │ │  	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:
    │ │ │ │  		// (total_done == m_torrent_file->total_size()) => is_seed()
    │ │ │ │ -
    relevance 2../src/torrent.cpp:4919abort lookups this torrent has made via the session host resolver interface

    abort lookups this torrent has made via the │ │ │ │ +relevance 2../src/torrent.cpp:4919abort lookups this torrent has made via the session host resolver interface

    abort lookups this torrent has made via the │ │ │ │ session host resolver interface

    ../src/torrent.cpp:4919

    				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
    │ │ │ │ @@ -3031,15 +3213,15 @@
    │ │ │ │  		// 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_peers_to_disconnect.clear();
    │ │ │ │ -
    relevance 2../src/torrent.cpp:8032if 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)

    if peer is a really good peer, maybe we shouldn't disconnect it │ │ │ │ +relevance 2../src/torrent.cpp:8032if 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)

    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)

    ../src/torrent.cpp:8032

    │ │ │ │  		m_peers_to_disconnect.reserve(m_connections.size() + 1);
    │ │ │ │  		m_connections.reserve(m_connections.size() + 1);
    │ │ │ │  
    │ │ │ │  #if TORRENT_USE_ASSERTS
    │ │ │ │  		error_code ec;
    │ │ │ │ @@ -3084,117 +3266,309 @@
    │ │ │ │  						, 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
    │ │ │ │  				// to let peer_list know we're removing it
    │ │ │ │ -
    relevance 2../src/udp_tracker_connection.cpp:81support authentication here. tracker_req().auth

    support authentication here. tracker_req().auth

    ../src/udp_tracker_connection.cpp:81

    		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)
    │ │ │ │ +
    relevance 2../src/session_impl.cpp:599is there a reason not to move all of this into init()? and just post it to the io_context?

    is there a reason not to move all of this into init()? and just │ │ │ │ +post it to the io_context?

    ../src/session_impl.cpp:599

    	try
    │ │ │ │ +#endif
    │ │ │ │  	{
    │ │ │ │ -		update_transaction_id();
    │ │ │ │ +		(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
    │ │ │ │  
    │ │ │ │ -	void udp_tracker_connection::start()
    │ │ │ │ -	{
    │ │ │ │ -
    std::string hostname; │ │ │ │ -
    std::string protocol; │ │ │ │ - int port; │ │ │ │ + // 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 && defined TORRENT_USE_OPENSSL && !defined TORRENT_WINRT │ │ │ │ +
    relevance 2../src/session_impl.cpp:761the ip filter should probably be saved here too

    the ip filter should probably be saved here too

    ../src/session_impl.cpp:761

    		m_lsd_announce_timer.async_wait([this](error_code const& e) {
    │ │ │ │ +			wrap(&session_impl::on_lsd_announce, e); } );
    │ │ │ │  
    │ │ │ │ -		std::tie(protocol, std::ignore, hostname, port, std::ignore)
    │ │ │ │ -			= parse_url_components(tracker_req().url, ec);
    │ │ │ │ -		if (port == -1) port = protocol == "http" ? 80 : 443;
    │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │ +		session_log(" done starting session");
    │ │ │ │ +#endif
    │ │ │ │  
    │ │ │ │ -		if (ec)
    │ │ │ │ +		// 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) │ │ │ │ { │ │ │ │ - tracker_connection::fail(ec, operation_t::parse_address); │ │ │ │ - return; │ │ │ │ + entry::dictionary_type& sett = e["settings"].dict(); │ │ │ │ + save_settings_to_dict(non_default_settings(m_settings), sett); │ │ │ │ } │ │ │ │ │ │ │ │ - aux::session_settings const& settings = m_man.settings(); │ │ │ │ +#ifndef TORRENT_DISABLE_DHT │ │ │ │ + if (flags & session::save_dht_settings) │ │ │ │ + { │ │ │ │ + e["dht"] = dht::save_dht_settings(get_dht_settings()); │ │ │ │ + } │ │ │ │ │ │ │ │ - int const proxy_type = settings.get_int(settings_pack::proxy_type); │ │ │ │ + if (m_dht && (flags & session::save_dht_state)) │ │ │ │ + { │ │ │ │ + e["dht state"] = dht::save_dht_state(m_dht->state()); │ │ │ │ + } │ │ │ │ +#endif │ │ │ │ │ │ │ │ - if (settings.get_bool(settings_pack::proxy_hostnames) │ │ │ │ - && (proxy_type == settings_pack::socks5 │ │ │ │ - || proxy_type == settings_pack::socks5_pw)) │ │ │ │ +#ifndef TORRENT_DISABLE_EXTENSIONS │ │ │ │ + for (auto const& ext : m_ses_extensions[plugins_all_idx]) │ │ │ │ { │ │ │ │ - m_hostname = hostname; │ │ │ │ - m_target.port(std::uint16_t(port)); │ │ │ │ - start_announce(); │ │ │ │ + ext->save_state(*eptr); │ │ │ │ } │ │ │ │ - else │ │ │ │ +
    relevance 2../src/session_impl.cpp:3882make 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

    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

    ../src/session_impl.cpp:3882

    		if (!m_dht_torrents.empty())
    │ │ │ │  		{
    │ │ │ │ -			using namespace std::placeholders;
    │ │ │ │ -			ADD_OUTSTANDING_ASYNC("udp_tracker_connection::name_lookup");
    │ │ │ │ -
    relevance 2../src/bdecode.cpp:826attempt to simplify this implementation by embracing the span

    attempt to simplify this implementation by embracing the span

    ../src/bdecode.cpp:826

    	}
    │ │ │ │ +			std::shared_ptr<torrent> t;
    │ │ │ │ +			do
    │ │ │ │ +			{
    │ │ │ │ +				t = m_dht_torrents.front().lock();
    │ │ │ │ +				m_dht_torrents.pop_front();
    │ │ │ │ +			} while (!t && !m_dht_torrents.empty());
    │ │ │ │  
    │ │ │ │ -	bdecode_node bdecode(span<char const> buffer
    │ │ │ │ -		, error_code& ec, int* error_pos, int depth_limit, int token_limit)
    │ │ │ │ +			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 │ │ │ │ + │ │ │ │ + void session_impl::on_lsd_announce(error_code const& e) │ │ │ │ { │ │ │ │ - bdecode_node ret; │ │ │ │ - ec.clear(); │ │ │ │ + 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 (buffer.size() > bdecode_token::max_offset) │ │ │ │ + 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_next_lsd_torrent = 0; │ │ │ │ +
    relevance 2../src/session_impl.cpp:5515this function should be removed and users need to deal with the more generic case of having multiple listen ports

    this function should be removed and users need to deal with the │ │ │ │ +more generic case of having multiple listen ports

    ../src/session_impl.cpp:5515

    #ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │ +		if (!node_list.empty() && nodes.empty())
    │ │ │ │  		{
    │ │ │ │ -			if (error_pos) *error_pos = 0;
    │ │ │ │ -			ec = bdecode_errors::limit_exceeded;
    │ │ │ │ -			return ret;
    │ │ │ │ +			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
    │ │ │ │ +	}
    │ │ │ │  
    │ │ │ │ -		// 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);
    │ │ │ │ +	void session_impl::update_count_slow()
    │ │ │ │ +	{
    │ │ │ │ +		error_code ec;
    │ │ │ │ +		for (auto const& tp : m_torrents)
    │ │ │ │ +		{
    │ │ │ │ +			tp->on_inactivity_tick(ec);
    │ │ │ │ +		}
    │ │ │ │ +	}
    │ │ │ │  
    │ │ │ │ -
    char const* start = buffer.data(); │ │ │ │ -
    char const* end = start + buffer.size(); │ │ │ │ - char const* const orig_start = start; │ │ │ │ +
    std::uint16_t session_impl::listen_port() const │ │ │ │ +
    { │ │ │ │ + return listen_port(nullptr); │ │ │ │ + } │ │ │ │ │ │ │ │ - if (start == end) │ │ │ │ - TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof); │ │ │ │ + std::uint16_t session_impl::listen_port(listen_socket_t* sock) const │ │ │ │ + { │ │ │ │ + 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; │ │ │ │ │ │ │ │ - while (start <= end) │ │ │ │ + if (!(sock->flags & listen_socket_t::accept_incoming)) │ │ │ │ + return 0; │ │ │ │ + │ │ │ │ + return std::uint16_t(sock->tcp_external_port()); │ │ │ │ + } │ │ │ │ + │ │ │ │ +#ifdef TORRENT_SSL_PEERS │ │ │ │ + for (auto const& s : m_listen_sockets) │ │ │ │ { │ │ │ │ - if (start >= end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof); │ │ │ │ + if (!(s->flags & listen_socket_t::accept_incoming)) continue; │ │ │ │ + if (s->ssl == transport::plaintext) │ │ │ │ + return std::uint16_t(s->tcp_external_port()); │ │ │ │ + } │ │ │ │ + return 0; │ │ │ │ +
    relevance 2../src/session_impl.cpp:5555this function should be removed and users need to deal with the more generic case of having multiple ssl ports

    this function should be removed and users need to deal with the │ │ │ │ +more generic case of having multiple ssl ports

    ../src/session_impl.cpp:5555

    				return 0;
    │ │ │ │  
    │ │ │ │ -			if (sp >= depth_limit)
    │ │ │ │ -				TORRENT_FAIL_BDECODE(bdecode_errors::depth_exceeded);
    │ │ │ │ +			return std::uint16_t(sock->tcp_external_port());
    │ │ │ │ +		}
    │ │ │ │  
    │ │ │ │ -			--token_limit;
    │ │ │ │ -			if (token_limit < 0)
    │ │ │ │ -				TORRENT_FAIL_BDECODE(bdecode_errors::limit_exceeded);
    │ │ │ │ +#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
    │ │ │ │ +	}
    │ │ │ │  
    │ │ │ │ -			// look for a new token
    │ │ │ │ -			char const t = *start;
    │ │ │ │ +
    std::uint16_t session_impl::ssl_listen_port() const │ │ │ │ +
    { │ │ │ │ + return ssl_listen_port(nullptr); │ │ │ │ + } │ │ │ │ │ │ │ │ - int const current_frame = sp; │ │ │ │ + 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 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 (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; │ │ │ │ + } │ │ │ │ + │ │ │ │ + int session_impl::get_listen_port(transport const ssl, aux::listen_socket_handle const& s) │ │ │ │ +
    relevance 2../src/session_impl.cpp:6390this should be factored into the udp socket, so we only have the code once

    this should be factored into the udp socket, so we only have the │ │ │ │ +code once

    ../src/session_impl.cpp:6390

    		return upload_rate_limit(m_local_peer_class);
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	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 (stack[current_frame - 1].state == 0) │ │ │ │ + error_code ec; │ │ │ │ + set_traffic_class(*l->sock, value, ec); │ │ │ │ + │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ + if (should_log()) │ │ │ │ { │ │ │ │ - // the current parent is a dict and we are parsing a key. │ │ │ │ -
    relevance 2../src/piece_picker.cpp:1996make the 2048 limit configurable

    make the 2048 limit configurable

    ../src/piece_picker.cpp:1996

    	// indicating which path thought the picker we took to arrive at the
    │ │ │ │ +					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->udp_sock->sock.local_port()
    │ │ │ │ +
    relevance 2../src/piece_picker.cpp:1996make the 2048 limit configurable

    make the 2048 limit configurable

    ../src/piece_picker.cpp:1996

    	// indicating which path thought the picker we took to arrive at the
    │ │ │ │  	// returned block picks.
    │ │ │ │  	picker_flags_t piece_picker::pick_pieces(typed_bitfield<piece_index_t> const& pieces
    │ │ │ │  		, std::vector<piece_block>& interesting_blocks, int num_blocks
    │ │ │ │  		, int prefer_contiguous_blocks, torrent_peer* peer
    │ │ │ │  		, picker_options_t options, std::vector<piece_index_t> const& suggested_pieces
    │ │ │ │  		, int num_peers
    │ │ │ │  		, counters& pc
    │ │ │ │ @@ -3237,15 +3611,15 @@
    │ │ │ │  		TORRENT_ASSERT(!m_priority_boundaries.empty() || m_dirty);
    │ │ │ │  
    │ │ │ │  		// this will be filled with blocks that we should not request
    │ │ │ │  		// unless we can't find num_blocks among the other ones.
    │ │ │ │  		std::vector<piece_block> backup_blocks;
    │ │ │ │  		std::vector<piece_block> backup_blocks2;
    │ │ │ │  		std::vector<piece_index_t> ignored_pieces;
    │ │ │ │ -
    relevance 2../src/piece_picker.cpp:2594the first_block returned here is the largest free range, not the first-fit range, which would be better

    the first_block returned here is the largest free range, not │ │ │ │ +relevance 2../src/piece_picker.cpp:2594the first_block returned here is the largest free range, not the first-fit range, which would be better

    the first_block returned here is the largest free range, not │ │ │ │ the first-fit range, which would be better

    ../src/piece_picker.cpp:2594

    	{
    │ │ │ │  		for (auto const& b : m_block_info)
    │ │ │ │  		{
    │ │ │ │  			TORRENT_ASSERT(b.peer == nullptr || static_cast<torrent_peer*>(b.peer)->in_use);
    │ │ │ │  		}
    │ │ │ │  	}
    │ │ │ │  #endif
    │ │ │ │ @@ -3289,15 +3663,15 @@
    │ │ │ │  			}
    │ │ │ │  			contiguous_blocks = 0;
    │ │ │ │  			if (info.peer != peer)
    │ │ │ │  			{
    │ │ │ │  				exclusive = false;
    │ │ │ │  				if (info.state == piece_picker::block_info::state_requested
    │ │ │ │  					&& info.peer != nullptr)
    │ │ │ │ -
    relevance 2../src/piece_picker.cpp:3478it would be nice if this could be folded into lock_piece() the main distinction is that this also maintains the m_num_have counter and the passed_hash_check member Is there ever a case where we call write failed without also locking the piece? Perhaps write_failed() should imply locking it.

    it would be nice if this could be folded into lock_piece() │ │ │ │ +relevance 2../src/piece_picker.cpp:3478it would be nice if this could be folded into lock_piece() the main distinction is that this also maintains the m_num_have counter and the passed_hash_check member Is there ever a case where we call write failed without also locking the piece? Perhaps write_failed() should imply locking it.

    it would be nice if this could be folded into lock_piece() │ │ │ │ the main distinction is that this also maintains the m_num_have │ │ │ │ counter and the passed_hash_check member │ │ │ │ Is there ever a case where we call write failed without also locking │ │ │ │ the piece? Perhaps write_failed() should imply locking it.

    ../src/piece_picker.cpp:3478

    │ │ │ │  		auto const state = m_piece_map[piece].download_queue();
    │ │ │ │  		if (state == piece_pos::piece_open) return;
    │ │ │ │  		auto const i = find_dl_piece(state, piece);
    │ │ │ │ @@ -3344,15 +3718,66 @@
    │ │ │ │  
    │ │ │ │  		TORRENT_ASSERT(i->writing > 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->writing;
    │ │ │ │  
    │ │ │ │ -
    relevance 2../src/peer_list.cpp:539it 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

    it would be nice if there was a way to iterate over these │ │ │ │ +relevance 2../src/tracker_manager.cpp:369implement

    implement

    ../src/tracker_manager.cpp:369

    #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);
    │ │ │ │ +			}
    │ │ │ │ +#endif
    │ │ │ │ +			return false;
    │ │ │ │ +		}
    │ │ │ │ +
    │ │ │ │ +		std::shared_ptr<udp_tracker_connection> const p = i->second;
    │ │ │ │ +		// on_receive() may remove the tracker connection from the list
    │ │ │ │ +		return p->on_receive(ep, buf);
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	void tracker_manager::incoming_error(error_code const&
    │ │ │ │ +		, udp::endpoint const&)
    │ │ │ │ +	{
    │ │ │ │ +		TORRENT_ASSERT(is_single_thread());
    │ │ │ │ +
    } │ │ │ │ +
    │ │ │ │ + bool tracker_manager::incoming_packet(string_view const hostname │ │ │ │ + , span<char const> const buf) │ │ │ │ + { │ │ │ │ + TORRENT_ASSERT(is_single_thread()); │ │ │ │ + // ignore packets smaller than 8 bytes │ │ │ │ + if (buf.size() < 16) return false; │ │ │ │ + │ │ │ │ + // the first word is the action, if it's not [0, 3] │ │ │ │ + // it's not a valid udp tracker response │ │ │ │ + span<const char> ptr = buf; │ │ │ │ + std::uint32_t const action = aux::read_uint32(ptr); │ │ │ │ + if (action > 3) return false; │ │ │ │ + │ │ │ │ + std::uint32_t const transaction = aux::read_uint32(ptr); │ │ │ │ + auto const i = m_udp_conns.find(transaction); │ │ │ │ + │ │ │ │ + if (i == m_udp_conns.end()) │ │ │ │ + { │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ + // now, this may not have been meant to be a tracker response, │ │ │ │ + // but chances are pretty good, so it's probably worth logging │ │ │ │ + m_ses.session_log("incoming UDP tracker packet from %s has invalid " │ │ │ │ + "transaction ID (%x)", std::string(hostname).c_str(), int(transaction)); │ │ │ │ +#endif │ │ │ │ + return false; │ │ │ │ + } │ │ │ │ + │ │ │ │ + std::shared_ptr<udp_tracker_connection> const p = i->second; │ │ │ │ + // on_receive() may remove the tracker connection from the list │ │ │ │ +
    relevance 2../src/peer_list.cpp:539it 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

    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

    ../src/peer_list.cpp:539

    		, int session_time, torrent_state* state)
    │ │ │ │  	{
    │ │ │ │  		TORRENT_ASSERT(is_single_thread());
    │ │ │ │  		INVARIANT_CHECK;
    │ │ │ │  
    │ │ │ │  		const int candidate_count = 10;
    │ │ │ │ @@ -3397,440 +3822,66 @@
    │ │ │ │  						erase_peer(m_peers.begin() + current, state);
    │ │ │ │  						continue;
    │ │ │ │  					}
    │ │ │ │  					else
    │ │ │ │  					{
    │ │ │ │  						erase_candidate = current;
    │ │ │ │  					}
    │ │ │ │ -
    relevance 2../src/path.cpp:429test this on a FAT volume to see what error we get!

    test this on a FAT volume to see what error we get!

    ../src/path.cpp:429

    			// 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)
    │ │ │ │ -		{
    │ │ │ │ -			ec.clear();
    │ │ │ │ -			return;
    │ │ │ │ -		}
    │ │ │ │ -
    │ │ │ │ -		// 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; │ │ │ │ - } │ │ │ │ - │ │ │ │ - // fall back to making a copy │ │ │ │ - │ │ │ │ -#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; │ │ │ │ - ec = e; │ │ │ │ -
    relevance 2../src/storage_utils.cpp:294technically, 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

    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

    ../src/storage_utils.cpp:294

    			while (--file_index >= file_index_t(0))
    │ │ │ │ -			{
    │ │ │ │ -				// files moved out to absolute paths are not moved
    │ │ │ │ -				if (f.file_absolute_path(file_index)) continue;
    │ │ │ │ -
    │ │ │ │ -				// if we ended up copying the file, don't do anything during
    │ │ │ │ -				// roll-back
    │ │ │ │ -				if (copied_files[file_index]) continue;
    │ │ │ │ -
    │ │ │ │ -				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));
    │ │ │ │ -
    │ │ │ │ -				// ignore errors when rolling back
    │ │ │ │ -				storage_error ignore;
    │ │ │ │ -				move_file(new_path, old_path, ignore);
    │ │ │ │ -			}
    │ │ │ │ -
    │ │ │ │ -			return { status_t::fatal_disk_error, save_path };
    │ │ │ │ -		}
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    std::set<std::string> subdirs; │ │ │ │ - for (auto const i : f.file_range()) │ │ │ │ - { │ │ │ │ - // 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; │ │ │ │ - │ │ │ │ - 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); │ │ │ │ - } │ │ │ │ - │ │ │ │ - for (std::string const& s : subdirs) │ │ │ │ - { │ │ │ │ - error_code err; │ │ │ │ - std::string subdir = combine_path(save_path, s); │ │ │ │ - │ │ │ │ - while (!path_equal(subdir, save_path) && !err) │ │ │ │ - { │ │ │ │ - remove(subdir, err); │ │ │ │ -
    relevance 2../src/storage_utils.cpp:486is 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

    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

    ../src/storage_utils.cpp:486

    				{
    │ │ │ │ -					// 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)
    │ │ │ │ -					{
    │ │ │ │ -						ec.file(idx);
    │ │ │ │ -						ec.operation = operation_t::mkdir;
    │ │ │ │ -						return false;
    │ │ │ │ -					}
    │ │ │ │ -
    │ │ │ │ -					hard_link(s, file_path, err);
    │ │ │ │ -				}
    │ │ │ │ -
    │ │ │ │ -				// if the file already exists, that's not an error
    │ │ │ │ -				if (err == boost::system::errc::file_exists)
    │ │ │ │ -					continue;
    │ │ │ │ -
    │ │ │ │ -
    if (err) │ │ │ │ -
    { │ │ │ │ - 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 │ │ │ │ - │ │ │ │ - bool const seed = (rd.have_pieces.size() >= fs.num_pieces() │ │ │ │ - && rd.have_pieces.all_set()) │ │ │ │ - || (rd.flags & torrent_flags::seed_mode); │ │ │ │ - │ │ │ │ - if (seed) │ │ │ │ - { │ │ │ │ - for (file_index_t const file_index : fs.file_range()) │ │ │ │ - { │ │ │ │ - if (fs.pad_file_at(file_index)) continue; │ │ │ │ - │ │ │ │ - // 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)) │ │ │ │ - continue; │ │ │ │ - │ │ │ │ -
    relevance 2../src/peer_connection.cpp:2562this 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

    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

    ../src/peer_connection.cpp:2562

    			}
    │ │ │ │ -#endif
    │ │ │ │ -
    │ │ │ │ -			write_reject_request(r);
    │ │ │ │ -			if (m_num_invalid_requests < std::numeric_limits<decltype(m_num_invalid_requests)>::max())
    │ │ │ │ -				++m_num_invalid_requests;
    │ │ │ │ -
    │ │ │ │ -			if (t->alerts().should_post<invalid_request_alert>())
    │ │ │ │ -			{
    │ │ │ │ -				// msvc 12 appears to deduce the rvalue reference template
    │ │ │ │ -				// incorrectly for bool temporaries. So, create a dummy instance
    │ │ │ │ -				bool const peer_interested = bool(m_peer_interested);
    │ │ │ │ -				t->alerts().emplace_alert<invalid_request_alert>(
    │ │ │ │ -					t->get_handle(), m_remote, m_peer_id, r
    │ │ │ │ -					, t->user_have_piece(r.piece), peer_interested, false);
    │ │ │ │ -			}
    │ │ │ │ -
    │ │ │ │ -			// every ten invalid request, remind the peer that it's choked
    │ │ │ │ -			if (!m_peer_interested && m_num_invalid_requests % 10 == 0 && m_choked)
    │ │ │ │ -			{
    │ │ │ │ -
    if (m_num_invalid_requests > 300 && !m_peer_choked │ │ │ │ -
    && can_disconnect(errors::too_many_requests_when_choked)) │ │ │ │ - { │ │ │ │ - disconnect(errors::too_many_requests_when_choked, operation_t::bittorrent, peer_error); │ │ │ │ - return; │ │ │ │ - } │ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ - peer_log(peer_log_alert::outgoing_message, "CHOKE"); │ │ │ │ -#endif │ │ │ │ - write_choke(); │ │ │ │ - } │ │ │ │ - │ │ │ │ - return; │ │ │ │ - } │ │ │ │ - │ │ │ │ - // if we have choked the client │ │ │ │ - // ignore the request │ │ │ │ - int const blocks_per_piece = │ │ │ │ - (ti.piece_length() + t->block_size() - 1) / t->block_size(); │ │ │ │ - │ │ │ │ - // disconnect peers that downloads more than foo times an allowed │ │ │ │ - // fast piece │ │ │ │ - if (m_choked && fast_idx != -1 && m_accept_fast_piece_cnt[fast_idx] >= 3 * blocks_per_piece │ │ │ │ - && can_disconnect(errors::too_many_requests_when_choked)) │ │ │ │ - { │ │ │ │ - disconnect(errors::too_many_requests_when_choked, operation_t::bittorrent, peer_error); │ │ │ │ - return; │ │ │ │ - } │ │ │ │ - │ │ │ │ - if (m_choked && fast_idx == -1) │ │ │ │ - { │ │ │ │ -
    relevance 2../src/peer_connection.cpp:3309since 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?

    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?

    ../src/peer_connection.cpp:3309

    │ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │ -		peer_log(peer_log_alert::incoming_message, "CANCEL"
    │ │ │ │ -			, "piece: %d s: %x l: %x", static_cast<int>(r.piece), r.start, r.length);
    │ │ │ │ -#endif
    │ │ │ │ -
    │ │ │ │ -		auto const i = std::find(m_requests.begin(), m_requests.end(), r);
    │ │ │ │ -
    │ │ │ │ -		if (i != m_requests.end())
    │ │ │ │ -		{
    │ │ │ │ -			m_counters.inc_stats_counter(counters::cancelled_piece_requests);
    │ │ │ │ -			m_requests.erase(i);
    │ │ │ │ -
    │ │ │ │ -			if (m_requests.empty())
    │ │ │ │ -				m_counters.inc_stats_counter(counters::num_peers_up_requests, -1);
    │ │ │ │ -
    │ │ │ │ -			write_reject_request(r);
    │ │ │ │ -		}
    │ │ │ │ -		else
    │ │ │ │ -		{
    │ │ │ │ -
    #ifndef TORRENT_DISABLE_LOGGING │ │ │ │ -
    peer_log(peer_log_alert::info, "INVALID_CANCEL", "got cancel not in the queue"); │ │ │ │ -#endif │ │ │ │ - } │ │ │ │ - } │ │ │ │ - │ │ │ │ - // ----------------------------- │ │ │ │ - // --------- DHT PORT ---------- │ │ │ │ - // ----------------------------- │ │ │ │ - │ │ │ │ - void peer_connection::incoming_dht_port(int const listen_port) │ │ │ │ - { │ │ │ │ - TORRENT_ASSERT(is_single_thread()); │ │ │ │ - INVARIANT_CHECK; │ │ │ │ - │ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ - peer_log(peer_log_alert::incoming_message, "DHT_PORT", "p: %d", listen_port); │ │ │ │ -#endif │ │ │ │ -#ifndef TORRENT_DISABLE_DHT │ │ │ │ - m_ses.add_dht_node({m_remote.address(), std::uint16_t(listen_port)}); │ │ │ │ -#else │ │ │ │ - TORRENT_UNUSED(listen_port); │ │ │ │ -#endif │ │ │ │ - } │ │ │ │ - │ │ │ │ - // ----------------------------- │ │ │ │ - // --------- HAVE ALL ---------- │ │ │ │ - // ----------------------------- │ │ │ │ +
    relevance 2../src/kademlia/dht_storage.cpp:87make this configurable in dht_settings

    make this configurable in dht_settings

    ../src/kademlia/dht_storage.cpp:87

    		tcp::endpoint addr;
    │ │ │ │ +		bool seed = 0;
    │ │ │ │ +	};
    │ │ │ │  
    │ │ │ │ -	void peer_connection::incoming_have_all()
    │ │ │ │ +	// internal
    │ │ │ │ +	bool operator<(peer_entry const& lhs, peer_entry const& rhs)
    │ │ │ │  	{
    │ │ │ │ -
    relevance 2../src/peer_connection.cpp:4975use 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

    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

    ../src/peer_connection.cpp:4975

    			if (d > seconds(connect_timeout)
    │ │ │ │ -				&& can_disconnect(errors::timed_out))
    │ │ │ │ -			{
    │ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │ -				peer_log(peer_log_alert::info, "CONNECT_FAILED", "waited %d seconds"
    │ │ │ │ -					, int(total_seconds(d)));
    │ │ │ │ -#endif
    │ │ │ │ -				connect_failed(errors::timed_out);
    │ │ │ │ -				return;
    │ │ │ │ -			}
    │ │ │ │ -		}
    │ │ │ │ -
    │ │ │ │ -		// if the bw_network flag isn't set, it means we are not even trying to
    │ │ │ │ -		// read from this peer's socket. Most likely because we're applying a
    │ │ │ │ -		// rate limit. If the peer is "slow" because we are rate limiting it,
    │ │ │ │ -		// don't enforce timeouts. However, as soon as we *do* read from the
    │ │ │ │ -		// socket, we expect to receive data, and not have timed out. Then we
    │ │ │ │ -		// can enforce the timeouts.
    │ │ │ │ -		bool const reading_socket = bool(m_channel_state[download_channel] & peer_info::bw_network);
    │ │ │ │ -
    │ │ │ │ -
    if (reading_socket && d > seconds(timeout()) && !m_connecting && m_reading_bytes == 0 │ │ │ │ -
    && can_disconnect(errors::timed_out_inactivity)) │ │ │ │ - { │ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ - peer_log(peer_log_alert::info, "LAST_ACTIVITY", "%d seconds ago" │ │ │ │ - , int(total_seconds(d))); │ │ │ │ -#endif │ │ │ │ - disconnect(errors::timed_out_inactivity, operation_t::bittorrent); │ │ │ │ - return; │ │ │ │ - } │ │ │ │ - │ │ │ │ - // do not stall waiting for a handshake │ │ │ │ - int timeout = m_settings.get_int (settings_pack::handshake_timeout); │ │ │ │ -#if TORRENT_USE_I2P │ │ │ │ - timeout *= is_i2p(m_socket) ? 4 : 1; │ │ │ │ -#endif │ │ │ │ - if (reading_socket │ │ │ │ - && !m_connecting │ │ │ │ - && in_handshake() │ │ │ │ - && d > seconds(timeout)) │ │ │ │ - { │ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ - peer_log(peer_log_alert::info, "NO_HANDSHAKE", "waited %d seconds" │ │ │ │ - , int(total_seconds(d))); │ │ │ │ -#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 │ │ │ │ -
    relevance 2../src/upnp.cpp:106use boost::asio::ip::network instead of netmask

    use boost::asio::ip::network instead of netmask

    ../src/upnp.cpp:106

    │ │ │ │ -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() │ │ │ │ -{ │ │ │ │ -
    relevance 2../src/alert_manager.cpp:80keep a count of the number of threads waiting. Only if it's > 0 notify them

    keep a count of the number of threads waiting. Only if it's │ │ │ │ -> 0 notify them

    ../src/alert_manager.cpp:80

    			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;
    │ │ │ │ +		return lhs.addr.address() == rhs.addr.address()
    │ │ │ │ +			? lhs.addr.port() < rhs.addr.port()
    │ │ │ │ +			: lhs.addr.address() < rhs.addr.address();
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ -	void alert_manager::maybe_notify(alert* a)
    │ │ │ │ +	// this is a group. It contains a set of group members
    │ │ │ │ +	struct torrent_entry
    │ │ │ │  	{
    │ │ │ │ -		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 │ │ │ │ - } │ │ │ │ + std::string name; │ │ │ │ + std::vector<peer_entry> peers4; │ │ │ │ + std::vector<peer_entry> peers6; │ │ │ │ + }; │ │ │ │ │ │ │ │ - void alert_manager::set_notify_function(std::function<void()> const& fun) │ │ │ │ +
    constexpr time_duration announce_interval = minutes(30); │ │ │ │ +
    │ │ │ │ + struct dht_immutable_item │ │ │ │ { │ │ │ │ - std::unique_lock<std::recursive_mutex> lock(m_mutex); │ │ │ │ - m_notify = fun; │ │ │ │ - if (!m_alerts[m_generation].empty()) │ │ │ │ - { │ │ │ │ - if (m_notify) m_notify(); │ │ │ │ - } │ │ │ │ - } │ │ │ │ + // 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; │ │ │ │ + }; │ │ │ │ │ │ │ │ -#ifndef TORRENT_DISABLE_EXTENSIONS │ │ │ │ - void alert_manager::add_extension(std::shared_ptr<plugin> ext) │ │ │ │ + struct dht_mutable_item : dht_immutable_item │ │ │ │ { │ │ │ │ - m_ses_extensions.push_back(std::move(ext)); │ │ │ │ - } │ │ │ │ -#endif │ │ │ │ + signature sig{}; │ │ │ │ + sequence_number seq{}; │ │ │ │ + public_key key{}; │ │ │ │ + std::string salt; │ │ │ │ + }; │ │ │ │ │ │ │ │ - void alert_manager::get_all(std::vector<alert*>& alerts) │ │ │ │ + void set_value(dht_immutable_item& item, span<char const> buf) │ │ │ │ { │ │ │ │ - std::lock_guard<std::recursive_mutex> lock(m_mutex); │ │ │ │ -
    relevance 2../src/kademlia/node.cpp:684it would be nice to have a bias towards node-id prefixes that are missing in the bucket

    it would be nice to have a bias towards node-id prefixes that │ │ │ │ + int const size = int(buf.size()); │ │ │ │ +relevance 2../src/kademlia/node.cpp:684it would be nice to have a bias towards node-id prefixes that are missing in the bucket

    it would be nice to have a bias towards node-id prefixes that │ │ │ │ are missing in the bucket

    ../src/kademlia/node.cpp:684

    	node_entry const* ne = m_table.next_refresh();
    │ │ │ │  	if (ne == nullptr) return;
    │ │ │ │  
    │ │ │ │  	// this shouldn't happen
    │ │ │ │  	TORRENT_ASSERT(m_id != ne->id);
    │ │ │ │  	if (ne->id == m_id) return;
    │ │ │ │  
    │ │ │ │ @@ -3874,15 +3925,15 @@
    │ │ │ │  		e["q"] = "get_peers";
    │ │ │ │  		e["a"]["info_hash"] = target.to_string();
    │ │ │ │  		m_counters.inc_stats_counter(counters::dht_get_peers_out);
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │  	o->flags |= observer::flag_queried;
    │ │ │ │  	m_rpc.invoke(e, ep, o);
    │ │ │ │ -
    relevance 2../src/kademlia/node.cpp:757use the non deprecated function instead of this one

    use the non deprecated function instead of this one

    ../src/kademlia/node.cpp:757

    	ret.local_endpoint = make_udp(m_sock.get_local_endpoint());
    │ │ │ │ +
    relevance 2../src/kademlia/node.cpp:757use the non deprecated function instead of this one

    use the non deprecated function instead of this one

    ../src/kademlia/node.cpp:757

    	ret.local_endpoint = make_udp(m_sock.get_local_endpoint());
    │ │ │ │  	m_table.status(ret.table);
    │ │ │ │  
    │ │ │ │  	for (auto const& r : m_running_requests)
    │ │ │ │  	{
    │ │ │ │  		ret.requests.emplace_back();
    │ │ │ │  		dht_lookup& lookup = ret.requests.back();
    │ │ │ │  		r->status(lookup);
    │ │ │ │ @@ -3925,15 +3976,15 @@
    │ │ │ │  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)
    │ │ │ │  	{
    │ │ │ │  		std::copy(n.id.begin(), n.id.end(), out);
    │ │ │ │ -
    relevance 2../src/kademlia/routing_table.cpp:305use the non deprecated function instead of this one

    use the non deprecated function instead of this one

    ../src/kademlia/routing_table.cpp:305

    	static const aux::array<int, 4> size_exceptions{{{16, 8, 4, 2}}};
    │ │ │ │ +
    relevance 2../src/kademlia/routing_table.cpp:305use the non deprecated function instead of this one

    use the non deprecated function instead of this one

    ../src/kademlia/routing_table.cpp:305

    	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
    │ │ │ │  {
    │ │ │ │ @@ -3953,15 +4004,15 @@
    │ │ │ │  

    { │ │ │ │ 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; │ │ │ │ -relevance 2../src/kademlia/routing_table.cpp:940move the lowest priority nodes to the replacement bucket

    move the lowest priority nodes to the replacement bucket

    ../src/kademlia/routing_table.cpp:940

    	bucket_t& rb = m_buckets[bucket_index].replacements;
    │ │ │ │ +
    relevance 2../src/kademlia/routing_table.cpp:940move the lowest priority nodes to the replacement bucket

    move the lowest priority nodes to the replacement bucket

    ../src/kademlia/routing_table.cpp:940

    	bucket_t& rb = m_buckets[bucket_index].replacements;
    │ │ │ │  
    │ │ │ │  	// move any node whose (160 - distance_exp(m_id, id)) >= (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->id);
    │ │ │ │ @@ -4004,66 +4055,66 @@
    │ │ │ │  		{
    │ │ │ │  			// 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../src/kademlia/dht_storage.cpp:87make this configurable in dht_settings

    make this configurable in dht_settings

    ../src/kademlia/dht_storage.cpp:87

    		tcp::endpoint addr;
    │ │ │ │ -		bool seed = 0;
    │ │ │ │ -	};
    │ │ │ │ +
    relevance 2../include/libtorrent/socks5_stream.hpp:153add async_connect() that takes a hostname and port as well

    add async_connect() that takes a hostname and port as well

    ../include/libtorrent/socks5_stream.hpp:153

    		TORRENT_ASSERT(!aux::is_ip_address(host));
    │ │ │ │ +		m_dst_name = host;
    │ │ │ │ +		if (m_dst_name.size() > 255)
    │ │ │ │ +			m_dst_name.resize(255);
    │ │ │ │ +	}
    │ │ │ │  
    │ │ │ │ -	// internal
    │ │ │ │ -	bool operator<(peer_entry const& lhs, peer_entry const& rhs)
    │ │ │ │ +	void close(error_code& ec)
    │ │ │ │  	{
    │ │ │ │ -		return lhs.addr.address() == rhs.addr.address()
    │ │ │ │ -			? lhs.addr.port() < rhs.addr.port()
    │ │ │ │ -			: lhs.addr.address() < rhs.addr.address();
    │ │ │ │ +		m_dst_name.clear();
    │ │ │ │ +		proxy_base::close(ec);
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ -	// this is a group. It contains a set of group members
    │ │ │ │ -	struct torrent_entry
    │ │ │ │ +#ifndef BOOST_NO_EXCEPTIONS
    │ │ │ │ +	void close()
    │ │ │ │  	{
    │ │ │ │ -		std::string name;
    │ │ │ │ -		std::vector<peer_entry> peers4;
    │ │ │ │ -		std::vector<peer_entry> peers6;
    │ │ │ │ -	};
    │ │ │ │ +		m_dst_name.clear();
    │ │ │ │ +		proxy_base::close();
    │ │ │ │ +	}
    │ │ │ │ +#endif
    │ │ │ │  
    │ │ │ │ -
    constexpr time_duration announce_interval = minutes(30); │ │ │ │ -
    │ │ │ │ - struct dht_immutable_item │ │ │ │ +
    template <class Handler> │ │ │ │ +
    void async_connect(endpoint_type const& endpoint, Handler handler) │ │ │ │ { │ │ │ │ - // 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; │ │ │ │ - }; │ │ │ │ + // 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)); │ │ │ │ │ │ │ │ - struct dht_mutable_item : dht_immutable_item │ │ │ │ - { │ │ │ │ - signature sig{}; │ │ │ │ - sequence_number seq{}; │ │ │ │ - public_key key{}; │ │ │ │ - std::string salt; │ │ │ │ - }; │ │ │ │ + m_remote_endpoint = endpoint; │ │ │ │ │ │ │ │ - void set_value(dht_immutable_item& item, span<char const> buf) │ │ │ │ - { │ │ │ │ - int const size = int(buf.size()); │ │ │ │ -
    relevance 2../include/libtorrent/proxy_base.hpp:327use the resolver interface that has a built-in cache

    use the resolver interface that has a built-in cache

    ../include/libtorrent/proxy_base.hpp:327

    │ │ │ │ +		// 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
    │ │ │ │ +		, Handler h)
    │ │ │ │ +
    relevance 2../include/libtorrent/proxy_base.hpp:327use the resolver interface that has a built-in cache

    use the resolver interface that has a built-in cache

    ../include/libtorrent/proxy_base.hpp:327

    │ │ │ │  	// The handler must be taken as lvalue reference here since we may not call
    │ │ │ │  	// it. But if we do, we want the call operator to own the function object.
    │ │ │ │  	template <typename Handler>
    │ │ │ │  	bool handle_error(error_code e, Handler&& h)
    │ │ │ │  	{
    │ │ │ │  		TORRENT_ASSERT(m_magic == 0x1337);
    │ │ │ │  		if (!e) return false;
    │ │ │ │ @@ -4106,15 +4157,15 @@
    │ │ │ │  	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); }
    │ │ │ │  
    │ │ │ │  	executor_type get_executor() const noexcept
    │ │ │ │ -
    relevance 2../include/libtorrent/enum_net.hpp:196this could be done more efficiently by just looking up the interface with the given name, maybe even with if_nametoindex()

    this could be done more efficiently by just looking up │ │ │ │ +relevance 2../include/libtorrent/enum_net.hpp:196this could be done more efficiently by just looking up the interface with the given name, maybe even with if_nametoindex()

    this could be done more efficiently by just looking up │ │ │ │ the interface with the given name, maybe even with if_nametoindex()

    ../include/libtorrent/enum_net.hpp:196

    			// 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);
    │ │ │ │ @@ -4158,118 +4209,15 @@
    │ │ │ │  		}
    │ │ │ │  		sock.bind(bind_ep, ec);
    │ │ │ │  		return bind_ep.address();
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │  	// returns the device name whose local address is ``addr``. If
    │ │ │ │  	// no such device is found, an empty string is returned.
    │ │ │ │ -
    relevance 2../include/libtorrent/piece_picker.hpp:668having 8 priority levels is probably excessive. It should probably be changed to 3 levels + dont-download

    having 8 priority levels is probably excessive. It should │ │ │ │ -probably be changed to 3 levels + dont-download

    ../include/libtorrent/piece_picker.hpp:668

    				else if (state() == piece_full)
    │ │ │ │ -						state(piece_full_reverse);
    │ │ │ │ -			}
    │ │ │ │ -
    │ │ │ │ -			// the number of peers that has this piece
    │ │ │ │ -			// (availability)
    │ │ │ │ -			std::uint32_t peer_count : 26;
    │ │ │ │ -
    │ │ │ │ -			// one of the download_queue_t values. This indicates whether this piece
    │ │ │ │ -			// is currently being downloaded or not, and what state it's in if
    │ │ │ │ -			// it is. Specifically, as an optimization, pieces that have all blocks
    │ │ │ │ -			// requested from them are separated out into separate lists to make
    │ │ │ │ -			// lookups quicker. The main oddity is that whether a downloading piece
    │ │ │ │ -			// has only been requested from peers that are reverse, that's
    │ │ │ │ -			// recorded as piece_downloading_reverse, which really means the same
    │ │ │ │ -			// as piece_downloading, it just saves space to also indicate that it
    │ │ │ │ -			// has a bit lower priority. The reverse bit is only relevant if the
    │ │ │ │ -			// state is piece_downloading.
    │ │ │ │ -			std::uint32_t download_state : 3;
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    // is 0 if the piece is filtered (not to be downloaded) │ │ │ │ - // 1 is low priority │ │ │ │ - // 2 is low priority │ │ │ │ - // 3 is mid priority │ │ │ │ - // 4 is default priority │ │ │ │ - // 5 is mid priority │ │ │ │ - // 6 is high priority │ │ │ │ - // 7 is high priority │ │ │ │ - std::uint32_t piece_priority : 3; │ │ │ │ - │ │ │ │ - // index in to the piece_info vector │ │ │ │ - prio_index_t index; │ │ │ │ - │ │ │ │ -#ifdef TORRENT_DEBUG_REFCOUNTS │ │ │ │ - // all the peers that have this piece │ │ │ │ - std::set<const torrent_peer*> have_peers; │ │ │ │ -#endif │ │ │ │ - │ │ │ │ - // index is set to this to indicate that we have the │ │ │ │ - // piece. There is no entry for the piece in the │ │ │ │ - // buckets if this is the case. │ │ │ │ - static constexpr prio_index_t we_have_index{-1}; │ │ │ │ - │ │ │ │ - // the priority value that means the piece is filtered │ │ │ │ - static constexpr std::uint32_t filter_priority = 0; │ │ │ │ - │ │ │ │ - // the max number the peer count can hold │ │ │ │ - static constexpr std::uint32_t max_peer_count = 0xffff; │ │ │ │ - │ │ │ │ - bool have() const { return index == we_have_index; } │ │ │ │ -
    relevance 2../include/libtorrent/socks5_stream.hpp:153add async_connect() that takes a hostname and port as well

    add async_connect() that takes a hostname and port as well

    ../include/libtorrent/socks5_stream.hpp:153

    		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 │ │ │ │ - , Handler h) │ │ │ │ -
    relevance 2../include/libtorrent/peer_connection.hpp:996this should really be a circular buffer

    this should really be a circular buffer

    ../include/libtorrent/peer_connection.hpp:996

    		// it just serves as a queue to remember what we've sent, to avoid
    │ │ │ │ +
    relevance 2../include/libtorrent/peer_connection.hpp:996this should really be a circular buffer

    this should really be a circular buffer

    ../include/libtorrent/peer_connection.hpp:996

    		// 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<piece_index_t> m_suggest_pieces;
    │ │ │ │  
    │ │ │ │  		// the pieces we will send to the peer
    │ │ │ │  		// if requested (regardless of choke state)
    │ │ │ │  		std::vector<piece_index_t> m_accept_fast;
    │ │ │ │ @@ -4310,15 +4258,15 @@
    │ │ │ │  
    │ │ │ │  		template <typename Fun, typename... Args>
    │ │ │ │  		void wrap(Fun f, Args&&... a);
    │ │ │ │  
    │ │ │ │  		// statistics about upload and download speeds
    │ │ │ │  		// and total amount of uploads and downloads for
    │ │ │ │  		// this peer
    │ │ │ │ -
    relevance 2../include/libtorrent/peer_connection.hpp:1086rename this target queue size

    rename this target queue size

    ../include/libtorrent/peer_connection.hpp:1086

    		// this is the piece that is available to this peer. Only
    │ │ │ │ +
    relevance 2../include/libtorrent/peer_connection.hpp:1086rename this target queue size

    rename this target queue size

    ../include/libtorrent/peer_connection.hpp:1086

    		// 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<piece_index_t, 2> m_superseed_piece = {{piece_index_t(-1), piece_index_t(-1)}};
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  		// the number of bytes send to the disk-io
    │ │ │ │ @@ -4361,66 +4309,67 @@
    │ │ │ │  		// 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;
    │ │ │ │  
    │ │ │ │ -
    relevance 2../include/libtorrent/aux_/chained_buffer.hpp:59this type should probably be renamed to send_buffer

    this type should probably be renamed to send_buffer

    ../include/libtorrent/aux_/chained_buffer.hpp:59

    #include "libtorrent/aux_/buffer.hpp"
    │ │ │ │ +
    relevance 2../include/libtorrent/piece_picker.hpp:668having 8 priority levels is probably excessive. It should probably be changed to 3 levels + dont-download

    having 8 priority levels is probably excessive. It should │ │ │ │ +probably be changed to 3 levels + dont-download

    ../include/libtorrent/piece_picker.hpp:668

    				else if (state() == piece_full)
    │ │ │ │ +						state(piece_full_reverse);
    │ │ │ │ +			}
    │ │ │ │  
    │ │ │ │ -#include <deque>
    │ │ │ │ -#include <vector>
    │ │ │ │ +			// the number of peers that has this piece
    │ │ │ │ +			// (availability)
    │ │ │ │ +			std::uint32_t peer_count : 26;
    │ │ │ │  
    │ │ │ │ -#include "libtorrent/aux_/disable_warnings_push.hpp"
    │ │ │ │ -#include <boost/asio/buffer.hpp>
    │ │ │ │ -#include "libtorrent/aux_/disable_warnings_pop.hpp"
    │ │ │ │ +			// one of the download_queue_t values. This indicates whether this piece
    │ │ │ │ +			// is currently being downloaded or not, and what state it's in if
    │ │ │ │ +			// it is. Specifically, as an optimization, pieces that have all blocks
    │ │ │ │ +			// requested from them are separated out into separate lists to make
    │ │ │ │ +			// lookups quicker. The main oddity is that whether a downloading piece
    │ │ │ │ +			// has only been requested from peers that are reverse, that's
    │ │ │ │ +			// recorded as piece_downloading_reverse, which really means the same
    │ │ │ │ +			// as piece_downloading, it just saves space to also indicate that it
    │ │ │ │ +			// has a bit lower priority. The reverse bit is only relevant if the
    │ │ │ │ +			// state is piece_downloading.
    │ │ │ │ +			std::uint32_t download_state : 3;
    │ │ │ │  
    │ │ │ │ -#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
    │ │ │ │ +
    │ │ │ │ +
    // is 0 if the piece is filtered (not to be downloaded) │ │ │ │ + // 1 is low priority │ │ │ │ + // 2 is low priority │ │ │ │ + // 3 is mid priority │ │ │ │ + // 4 is default priority │ │ │ │ + // 5 is mid priority │ │ │ │ + // 6 is high priority │ │ │ │ + // 7 is high priority │ │ │ │ + std::uint32_t piece_priority : 3; │ │ │ │ │ │ │ │ -namespace libtorrent { │ │ │ │ -namespace aux { │ │ │ │ + // index in to the piece_info vector │ │ │ │ + prio_index_t index; │ │ │ │ │ │ │ │ -
    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; │ │ │ │ +#ifdef TORRENT_DEBUG_REFCOUNTS │ │ │ │ + // all the peers that have this piece │ │ │ │ + std::set<const torrent_peer*> have_peers; │ │ │ │ #endif │ │ │ │ - } │ │ │ │ │ │ │ │ - private: │ │ │ │ + // index is set to this to indicate that we have the │ │ │ │ + // piece. There is no entry for the piece in the │ │ │ │ + // buckets if this is the case. │ │ │ │ + static constexpr prio_index_t we_have_index{-1}; │ │ │ │ │ │ │ │ - // destructs/frees the holder object │ │ │ │ - using destruct_holder_fun = void (*)(void*); │ │ │ │ - using move_construct_holder_fun = void (*)(void*, void*); │ │ │ │ + // the priority value that means the piece is filtered │ │ │ │ + static constexpr std::uint32_t filter_priority = 0; │ │ │ │ │ │ │ │ - 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../include/libtorrent/aux_/session_interface.hpp:127make 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.

    make this interface a lot smaller. It could be split up into │ │ │ │ + // the max number the peer count can hold │ │ │ │ + static constexpr std::uint32_t max_peer_count = 0xffff; │ │ │ │ + │ │ │ │ + bool have() const { return index == we_have_index; } │ │ │ │ +relevance 2../include/libtorrent/aux_/session_interface.hpp:127make 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.

    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.

    ../include/libtorrent/aux_/session_interface.hpp:127

    	// 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;
    │ │ │ │ @@ -4440,15 +4389,15 @@
    │ │ │ │  
    │ │ │ │  
    struct TORRENT_EXTRA_EXPORT session_interface │ │ │ │
    #if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS │ │ │ │ : session_logger │ │ │ │ #endif │ │ │ │ { │ │ │ │ │ │ │ │ -
    relevance 2../include/libtorrent/aux_/session_interface.hpp:136the IP voting mechanism should be factored out to its own class, not part of the session and these constants should move too

    the IP voting mechanism should be factored out │ │ │ │ +relevance 2../include/libtorrent/aux_/session_interface.hpp:136the IP voting mechanism should be factored out to its own class, not part of the session and these constants should move too

    the IP voting mechanism should be factored out │ │ │ │ to its own class, not part of the session │ │ │ │ and these constants should move too

    ../include/libtorrent/aux_/session_interface.hpp:136

    		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;
    │ │ │ │ @@ -4493,67 +4442,66 @@
    │ │ │ │  		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;
    │ │ │ │  		virtual void ban_ip(address addr) = 0;
    │ │ │ │  
    │ │ │ │ -
    relevance 1../src/session_impl.cpp:5707report the proper address of the router as the source IP of this vote of our external address, instead of the empty address

    report the proper address of the router as the source IP of │ │ │ │ -this vote of our external address, instead of the empty address

    ../src/session_impl.cpp:5707

    		, listen_socket_handle const& ls)
    │ │ │ │ -	{
    │ │ │ │ -		TORRENT_ASSERT(is_single_thread());
    │ │ │ │ -
    │ │ │ │ -		listen_socket_t* listen_socket = ls.get();
    │ │ │ │ +
    relevance 2../include/libtorrent/aux_/chained_buffer.hpp:59this type should probably be renamed to send_buffer

    this type should probably be renamed to send_buffer

    ../include/libtorrent/aux_/chained_buffer.hpp:59

    #include "libtorrent/aux_/buffer.hpp"
    │ │ │ │  
    │ │ │ │ -		// 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());
    │ │ │ │ -		}
    │ │ │ │ +#include <deque>
    │ │ │ │ +#include <vector>
    │ │ │ │  
    │ │ │ │ -		if (!listen_socket) return;
    │ │ │ │ +#include "libtorrent/aux_/disable_warnings_push.hpp"
    │ │ │ │ +#include <boost/asio/buffer.hpp>
    │ │ │ │ +#include "libtorrent/aux_/disable_warnings_pop.hpp"
    │ │ │ │  
    │ │ │ │ -		if (!ec && !external_ip.is_unspecified())
    │ │ │ │ -		{
    │ │ │ │ -
    listen_socket->external_address.cast_vote(external_ip, source_router, address()); │ │ │ │ -
    } │ │ │ │ +#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 │ │ │ │ │ │ │ │ - // 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; │ │ │ │ +namespace libtorrent { │ │ │ │ +namespace aux { │ │ │ │ │ │ │ │ - if (!ec && m_alerts.should_post<portmap_alert>()) │ │ │ │ +
    struct TORRENT_EXTRA_EXPORT chained_buffer : private single_threaded │ │ │ │ +
    { │ │ │ │ + chained_buffer(): m_bytes(0), m_capacity(0) │ │ │ │ { │ │ │ │ - m_alerts.emplace_alert<portmap_alert>(mapping, port │ │ │ │ - , transport, proto, listen_socket->local_endpoint.address()); │ │ │ │ + thread_started(); │ │ │ │ +#if TORRENT_USE_ASSERTS │ │ │ │ + m_destructed = false; │ │ │ │ +#endif │ │ │ │ } │ │ │ │ - } │ │ │ │ - │ │ │ │ -#if TORRENT_ABI_VERSION == 1 │ │ │ │ - session_status session_impl::status() const │ │ │ │ - { │ │ │ │ -// INVARIANT_CHECK; │ │ │ │ - TORRENT_ASSERT(is_single_thread()); │ │ │ │ │ │ │ │ - session_status s; │ │ │ │ + private: │ │ │ │ │ │ │ │ - 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()); │ │ │ │ + // destructs/frees the holder object │ │ │ │ + using destruct_holder_fun = void (*)(void*); │ │ │ │ + using move_construct_holder_fun = void (*)(void*, void*); │ │ │ │ │ │ │ │ - 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]); │ │ │ │ -
    relevance 1../src/torrent.cpp:1126make 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

    make this depend on the error and on the filesystem the │ │ │ │ + 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 1../src/torrent.cpp:1126make 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

    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

    ../src/torrent.cpp:1126

    │ │ │ │  		// notify the user of the error
    │ │ │ │  		if (alerts().should_post<file_error_alert>())
    │ │ │ │  			alerts().emplace_alert<file_error_alert>(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;
    │ │ │ │  
    │ │ │ │ -
    relevance 1../src/torrent.cpp:8398should 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

    should disconnect all peers that have the pieces we have │ │ │ │ +relevance 1../src/torrent.cpp:8398should 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

    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

    ../src/torrent.cpp:8398

    │ │ │ │  		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(&torrent::on_cache_flushed, shared_from_this(), false));
    │ │ │ │  			m_ses.deferred_submit_jobs();
    │ │ │ │  		}
    │ │ │ │  
    │ │ │ │  		// this torrent just completed downloads, which means it will fall
    │ │ │ │ +
    relevance 1../src/session_impl.cpp:5707report the proper address of the router as the source IP of this vote of our external address, instead of the empty address

    report the proper address of the router as the source IP of │ │ │ │ +this vote of our external address, instead of the empty address

    ../src/session_impl.cpp:5707

    		, 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.allowed_upload_slots = int(m_stats_counters[counters::num_unchoke_slots]); │ │ │ │
    relevance 1../include/libtorrent/ip_voter.hpp:130have one instance per possible subnet, 192.168.x.x, 10.x.x.x, etc.

    have one instance per possible subnet, 192.168.x.x, 10.x.x.x, etc.

    ../include/libtorrent/ip_voter.hpp:130

    	// 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,18 +4679,17 @@
    │ │ │ │  		// [n][0] = IPv4 [n][1] = IPv6
    │ │ │ │  
    address m_addresses[2][2]; │ │ │ │
    }; │ │ │ │ │ │ │ │ } │ │ │ │ │ │ │ │ #endif │ │ │ │ -
    relevance 0../test/test_fast_extension.cpp:1135test sending invalid requests (out of bound piece index, offsets and sizes)

    test sending invalid requests (out of bound piece index, offsets and │ │ │ │ -sizes)

    ../test/test_fast_extension.cpp:1135

    relevance 0../test/test_torrent_info.cpp:459test remap_files

    test remap_files

    ../test/test_torrent_info.cpp:459

    relevance 0../test/test_torrent_info.cpp:460torrent with 'p' (padfile) attribute

    torrent with 'p' (padfile) attribute

    ../test/test_torrent_info.cpp:460

    relevance 0../test/test_torrent_info.cpp:461torrent with 'h' (hidden) attribute

    torrent with 'h' (hidden) attribute

    ../test/test_torrent_info.cpp:461

    relevance 0../test/test_torrent_info.cpp:462torrent with 'x' (executable) attribute

    torrent with 'x' (executable) attribute

    ../test/test_torrent_info.cpp:462

    relevance 0../test/test_torrent_info.cpp:463torrent with 'l' (symlink) attribute

    torrent with 'l' (symlink) attribute

    ../test/test_torrent_info.cpp:463

    relevance 0../test/test_torrent_info.cpp:464torrent 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)

    torrent with multiple trackers in multiple tiers, making sure we │ │ │ │ +relevance 0../test/test_torrent_info.cpp:459test remap_files

    test remap_files

    ../test/test_torrent_info.cpp:459

    relevance 0../test/test_torrent_info.cpp:460torrent with 'p' (padfile) attribute

    torrent with 'p' (padfile) attribute

    ../test/test_torrent_info.cpp:460

    relevance 0../test/test_torrent_info.cpp:461torrent with 'h' (hidden) attribute

    torrent with 'h' (hidden) attribute

    ../test/test_torrent_info.cpp:461

    relevance 0../test/test_torrent_info.cpp:462torrent with 'x' (executable) attribute

    torrent with 'x' (executable) attribute

    ../test/test_torrent_info.cpp:462

    relevance 0../test/test_torrent_info.cpp:463torrent with 'l' (symlink) attribute

    torrent with 'l' (symlink) attribute

    ../test/test_torrent_info.cpp:463

    relevance 0../test/test_torrent_info.cpp:464torrent 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)

    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)

    ../test/test_torrent_info.cpp:464

    relevance 0../test/test_torrent_info.cpp:467torrents with a zero-length name

    torrents with a zero-length name

    ../test/test_torrent_info.cpp:467

    relevance 0../test/test_torrent_info.cpp:468torrent with a non-dictionary info-section

    torrent with a non-dictionary info-section

    ../test/test_torrent_info.cpp:468

    relevance 0../test/test_torrent_info.cpp:469torrents with DHT nodes

    torrents with DHT nodes

    ../test/test_torrent_info.cpp:469

    relevance 0../test/test_torrent_info.cpp:470torrent with url-list as a single string

    torrent with url-list as a single string

    ../test/test_torrent_info.cpp:470

    relevance 0../test/test_torrent_info.cpp:471torrent with http seed as a single string

    torrent with http seed as a single string

    ../test/test_torrent_info.cpp:471

    relevance 0../test/test_torrent_info.cpp:472torrent with a comment

    torrent with a comment

    ../test/test_torrent_info.cpp:472

    relevance 0../test/test_torrent_info.cpp:473torrent with an SSL cert

    torrent with an SSL cert

    ../test/test_torrent_info.cpp:473

    relevance 0../test/test_torrent_info.cpp:474torrent with attributes (executable and hidden)

    torrent with attributes (executable and hidden)

    ../test/test_torrent_info.cpp:474

    relevance 0../test/test_torrent_info.cpp:475torrent_info constructor that takes an invalid bencoded buffer

    torrent_info constructor that takes an invalid bencoded buffer

    ../test/test_torrent_info.cpp:475

    relevance 0../test/test_torrent_info.cpp:476verify_encoding with a string that triggers character replacement

    verify_encoding with a string that triggers character replacement

    ../test/test_torrent_info.cpp:476

    	{ "v2_non_multiple_piece_layer.torrent", errors::torrent_invalid_piece_layer},
    │ │ │ │ +sure it's in different order at least once)

    ../test/test_torrent_info.cpp:464

    relevance 0../test/test_torrent_info.cpp:467torrents with a zero-length name

    torrents with a zero-length name

    ../test/test_torrent_info.cpp:467

    relevance 0../test/test_torrent_info.cpp:468torrent with a non-dictionary info-section

    torrent with a non-dictionary info-section

    ../test/test_torrent_info.cpp:468

    relevance 0../test/test_torrent_info.cpp:469torrents with DHT nodes

    torrents with DHT nodes

    ../test/test_torrent_info.cpp:469

    relevance 0../test/test_torrent_info.cpp:470torrent with url-list as a single string

    torrent with url-list as a single string

    ../test/test_torrent_info.cpp:470

    relevance 0../test/test_torrent_info.cpp:471torrent with http seed as a single string

    torrent with http seed as a single string

    ../test/test_torrent_info.cpp:471

    relevance 0../test/test_torrent_info.cpp:472torrent with a comment

    torrent with a comment

    ../test/test_torrent_info.cpp:472

    relevance 0../test/test_torrent_info.cpp:473torrent with an SSL cert

    torrent with an SSL cert

    ../test/test_torrent_info.cpp:473

    relevance 0../test/test_torrent_info.cpp:474torrent with attributes (executable and hidden)

    torrent with attributes (executable and hidden)

    ../test/test_torrent_info.cpp:474

    relevance 0../test/test_torrent_info.cpp:475torrent_info constructor that takes an invalid bencoded buffer

    torrent_info constructor that takes an invalid bencoded buffer

    ../test/test_torrent_info.cpp:475

    relevance 0../test/test_torrent_info.cpp:476verify_encoding with a string that triggers character replacement

    verify_encoding with a string that triggers character replacement

    ../test/test_torrent_info.cpp:476

    	{ "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},
    │ │ │ │ @@ -4733,212 +4732,196 @@
    │ │ │ │  	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;
    │ │ │ │ -
    relevance 0../test/test_peer_list.cpp:1241test erasing peers

    test erasing peers

    ../test/test_peer_list.cpp:1241

    relevance 0../test/test_peer_list.cpp:1242test update_peer_port with allow_multiple_connections_per_ip and without

    test update_peer_port with allow_multiple_connections_per_ip and without

    ../test/test_peer_list.cpp:1242

    relevance 0../test/test_peer_list.cpp:1243test add i2p peers

    test add i2p peers

    ../test/test_peer_list.cpp:1243

    relevance 0../test/test_peer_list.cpp:1244test allow_i2p_mixed

    test allow_i2p_mixed

    ../test/test_peer_list.cpp:1244

    relevance 0../test/test_peer_list.cpp:1245test insert_peer failing with all error conditions

    test insert_peer failing with all error conditions

    ../test/test_peer_list.cpp:1245

    relevance 0../test/test_peer_list.cpp:1246test IPv6

    test IPv6

    ../test/test_peer_list.cpp:1246

    relevance 0../test/test_peer_list.cpp:1247test connect_to_peer() failing

    test connect_to_peer() failing

    ../test/test_peer_list.cpp:1247

    relevance 0../test/test_peer_list.cpp:1248test connection_closed

    test connection_closed

    ../test/test_peer_list.cpp:1248

    relevance 0../test/test_peer_list.cpp:1249connect candidates recalculation when incrementing failcount

    connect candidates recalculation when incrementing failcount

    ../test/test_peer_list.cpp:1249

    relevance 0../test/test_timestamp_history.cpp:54test the case where we have > 120 samples (and have the base delay actually be updated)

    test the case where we have > 120 samples (and have the base delay actually be updated)

    ../test/test_timestamp_history.cpp:54

    relevance 0../test/test_timestamp_history.cpp:55test the case where a sample is lower than the history entry but not lower than the base

    test the case where a sample is lower than the history entry but not lower than the base

    ../test/test_timestamp_history.cpp:55

    #include "libtorrent/aux_/timestamp_history.hpp"
    │ │ │ │ +
    relevance 0../test/test_tracker.cpp:60test scrape requests

    test scrape requests

    ../test/test_tracker.cpp:60

    relevance 0../test/test_tracker.cpp:61test parse peers6

    test parse peers6

    ../test/test_tracker.cpp:61

    relevance 0../test/test_tracker.cpp:62test parse tracker-id

    test parse tracker-id

    ../test/test_tracker.cpp:62

    relevance 0../test/test_tracker.cpp:63test parse failure-reason

    test parse failure-reason

    ../test/test_tracker.cpp:63

    relevance 0../test/test_tracker.cpp:64test 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

    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

    ../test/test_tracker.cpp:64

    #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"
    │ │ │ │  
    │ │ │ │ -TORRENT_TEST(timestamp_history)
    │ │ │ │ -{
    │ │ │ │ -	using namespace lt;
    │ │ │ │ +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);
    │ │ │ │ +
    │ │ │ │ +
    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 that wrapping of the timestamp is properly handled │ │ │ │ - h.add_sample(0xfffffff3, false); │ │ │ │ - TEST_EQUAL(h.base(), 0xfffffff3); │ │ │ │ + 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")); │ │ │ │ │ │ │ │ -
    } │ │ │ │ -
    │ │ │ │ -
    relevance 0../test/test_merkle_tree.cpp:233use structured bindings in C++17

    use structured bindings in C++17

    ../test/test_merkle_tree.cpp:233

    			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));
    │ │ │ │ -		}
    │ │ │ │ +		TEST_EQUAL(e1.hostname, "another_host");
    │ │ │ │ +		TEST_EQUAL(e1.port, 1001);
    │ │ │ │ +		TEST_EQUAL(e1.pid, peer_id("bbbbabaababababababa"));
    │ │ │ │  	}
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │ -namespace {
    │ │ │ │ -void test_roundtrip(aux::merkle_tree const& t
    │ │ │ │ -	, int const block_count
    │ │ │ │ -	, int const blocks_per_piece)
    │ │ │ │ +TORRENT_TEST(parse_peers4)
    │ │ │ │  {
    │ │ │ │ -
    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)); │ │ │ │ + char const response[] = "d5:peers12:\x01\x02\x03\x04\x30\x10" │ │ │ │ + "\x09\x08\x07\x06\x20\x10" "e"; │ │ │ │ + error_code ec; │ │ │ │ +
    relevance 0../test/test_file_storage.cpp:1208test file attributes

    test file attributes

    ../test/test_file_storage.cpp:1208

    relevance 0../test/test_file_storage.cpp:1209test symlinks

    test symlinks

    ../test/test_file_storage.cpp:1209

    relevance 0../test/test_bloom_filter.cpp:135test size()

    test size()

    ../test/test_bloom_filter.cpp:135

    relevance 0../test/test_bloom_filter.cpp:136test clear()

    test clear()

    ../test/test_bloom_filter.cpp:136

    	sha1_hash k("\x01\x00\x02\x00                ");
    │ │ │ │ +	TEST_CHECK(!filter.find(k));
    │ │ │ │ +	filter.set(k);
    │ │ │ │ +	TEST_CHECK(filter.find(k));
    │ │ │ │  
    │ │ │ │ -		if (!t.has_node(i))
    │ │ │ │ -			TEST_CHECK(t[i].is_all_zeros());
    │ │ │ │ -		if (!t2.has_node(i))
    │ │ │ │ -			TEST_CHECK(t2[i].is_all_zeros());
    │ │ │ │ +	std::uint8_t compare[4] = { 0x16, 0xff, 0x55, 0xaa};
    │ │ │ │  
    │ │ │ │ -		TEST_CHECK(t.compare_node(i, t2[i]));
    │ │ │ │ -		TEST_CHECK(t2.compare_node(i, t[i]));
    │ │ │ │ -	}
    │ │ │ │ -}
    │ │ │ │ +	bits_out = filter.to_string();
    │ │ │ │ +	TEST_EQUAL(memcmp(compare, bits_out.c_str(), 4), 0);
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │ -TORRENT_TEST(roundtrip_empty_tree)
    │ │ │ │ +} // anonymous namespace
    │ │ │ │ +
    │ │ │ │ +TORRENT_TEST(bloom_filter)
    │ │ │ │  {
    │ │ │ │ -	aux::merkle_tree t(num_blocks, 1, f[0].data());
    │ │ │ │ -	test_roundtrip(t, num_blocks, 1);
    │ │ │ │ -}
    │ │ │ │ +	test_set_and_get();
    │ │ │ │ +	test_set_bits();
    │ │ │ │ +	test_count_zeroes();
    │ │ │ │ +	test_to_from_string();
    │ │ │ │  
    │ │ │ │ -TORRENT_TEST(roundtrip_full_tree)
    │ │ │ │ -
    relevance 0../test/test_merkle_tree.cpp:938add test for load_piece_layer()

    add test for load_piece_layer()

    ../test/test_merkle_tree.cpp:938

    relevance 0../test/test_merkle_tree.cpp:939add test for add_hashes() with an odd number of blocks

    add test for add_hashes() with an odd number of blocks

    ../test/test_merkle_tree.cpp:939

    relevance 0../test/test_merkle_tree.cpp:940add test for set_block() (setting the last block) with an odd number of blocks

    add test for set_block() (setting the last block) with an odd number of blocks

    ../test/test_merkle_tree.cpp:940

    │ │ │ │ -		for (int i = 0; i < 7; ++i)
    │ │ │ │ -			TEST_EQUAL(t[i], f[i]);
    │ │ │ │ -	}
    │ │ │ │ +
    } │ │ │ │ +
    relevance 0../test/test_transfer.cpp:173these settings_pack tests belong in their own test

    these settings_pack tests belong in their own test

    ../test/test_transfer.cpp:173

    	// 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);
    │ │ │ │  
    │ │ │ │ -	// 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));
    │ │ │ │ -	TEST_CHECK(result);
    │ │ │ │ +	// 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);
    │ │ │ │  
    │ │ │ │ -	auto const& res = *result;
    │ │ │ │ -	TEST_EQUAL(res.passed.size(), 0);
    │ │ │ │ -	TEST_EQUAL(res.failed.size(), 0);
    │ │ │ │ +	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 (int i = 127; i < 127 + 4; ++i)
    │ │ │ │ -		TEST_CHECK(t[i] == f[i]);
    │ │ │ │ +	pack.set_bool(settings_pack::allow_multiple_connections_per_ip, false);
    │ │ │ │  
    │ │ │ │ -	TEST_CHECK(t.verified_leafs() == none_set(num_blocks));
    │ │ │ │ -}
    │ │ │ │ +
    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); │ │ │ │ │ │ │ │ -
    │ │ │ │ -
    relevance 0../test/test_file_storage.cpp:1208test file attributes

    test file attributes

    ../test/test_file_storage.cpp:1208

    relevance 0../test/test_file_storage.cpp:1209test symlinks

    test symlinks

    ../test/test_file_storage.cpp:1209

    relevance 0../test/test_ssl.cpp:407test using a signed certificate with the wrong info-hash in DN

    test using a signed certificate with the wrong info-hash in DN

    ../test/test_ssl.cpp:407

    	// 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::unchoke_slots_limit, -1);
    │ │ │ │ +	ses1.apply_settings(pack);
    │ │ │ │ +	TEST_CHECK(ses1.get_settings().get_int(settings_pack::unchoke_slots_limit) == -1);
    │ │ │ │  
    │ │ │ │ -	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_int(settings_pack::unchoke_slots_limit, 8);
    │ │ │ │ +	ses1.apply_settings(pack);
    │ │ │ │ +	TEST_CHECK(ses1.get_settings().get_int(settings_pack::unchoke_slots_limit) == 8);
    │ │ │ │  
    │ │ │ │ -	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"));
    │ │ │ │ -	}
    │ │ │ │ +	ses2.apply_settings(pack);
    │ │ │ │  
    │ │ │ │ -
    │ │ │ │ -
    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_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"); │ │ │ │ + wait_for_listen(ses2, "ses2"); │ │ │ │ +
    relevance 0../test/test_upnp.cpp:156store the log and verify that some key messages are there

    store the log and verify that some key messages are there

    ../test/test_upnp.cpp:156

    			, portmap_protocol const protocol, error_code const& err
    │ │ │ │ +			, portmap_transport, aux::listen_socket_handle const&) override
    │ │ │ │  		{
    │ │ │ │ -			std::printf("Failed to set certificate passphrase: %s\n"
    │ │ │ │ -				, ec.message().c_str());
    │ │ │ │ -			TEST_CHECK(!ec);
    │ │ │ │ -			return false;
    │ │ │ │ +			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";
    │ │ │ │  		}
    │ │ │ │ -		std::printf("use_certificate_file \"%s\"\n", certificate.c_str());
    │ │ │ │ -		ctx.use_certificate_file(certificate, context::pem, ec);
    │ │ │ │ -		if (ec)
    │ │ │ │ +	#ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │ +		bool should_log_portmap(portmap_transport) const override
    │ │ │ │  		{
    │ │ │ │ -			std::printf("Failed to set certificate file: %s\n"
    │ │ │ │ -				, ec.message().c_str());
    │ │ │ │ -			TEST_CHECK(!ec);
    │ │ │ │ -			return false;
    │ │ │ │ +			return true;
    │ │ │ │  		}
    │ │ │ │ -		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;
    │ │ │ │ -
    relevance 0../test/test_ssl.cpp:509also test using a hash that refers to a valid torrent but that differs from the SNI hash

    also test using a hash that refers to a valid torrent │ │ │ │ -but that differs from the SNI hash

    ../test/test_ssl.cpp:509

    	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
    │ │ │ │ -
    │ │ │ │ -	// 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); │ │ │ │ -
    } │ │ │ │ │ │ │ │ - // fill in the peer-id │ │ │ │ - std::generate(handshake + 48, handshake + 68, &rand); │ │ │ │ + void log_portmap(portmap_transport, char const* msg │ │ │ │ + , aux::listen_socket_handle const&) const override │ │ │ │ + { │ │ │ │ + std::cout << "UPnP: " << msg << std::endl; │ │ │ │ +
    } │ │ │ │ +
    #endif │ │ │ │ + }; │ │ │ │ │ │ │ │ - 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); │ │ │ │ +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::printf("failed to write bittorrent handshake: %s\n" │ │ │ │ - , ec.message().c_str()); │ │ │ │ - return false; │ │ │ │ + std::cerr << "failed to enumerate routes: " << ec.message() << '\n'; │ │ │ │ + TEST_CHECK(false); │ │ │ │ + return {}; │ │ │ │ } │ │ │ │ - │ │ │ │ - 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); │ │ │ │ + std::vector<ip_interface> const ifs = enum_net_interfaces(ios, ec); │ │ │ │ if (ec) │ │ │ │ { │ │ │ │ - std::printf("failed to read bittorrent handshake: %s\n" │ │ │ │ - , ec.message().c_str()); │ │ │ │ - return false; │ │ │ │ + std::cerr << "failed to enumerate network interfaces: " << ec.message() << '\n'; │ │ │ │ + TEST_CHECK(false); │ │ │ │ + return {}; │ │ │ │ } │ │ │ │ - │ │ │ │ - if (memcmp(buf, "\x13" "BitTorrent protocol", 20) != 0) │ │ │ │ + int idx = 0; │ │ │ │ + for (auto const& face : ifs) │ │ │ │ { │ │ │ │ - std::printf("invalid bittorrent handshake\n"); │ │ │ │ - return false; │ │ │ │ -
    relevance 0../test/test_dht.cpp:472check to make sure the "best" items are stored

    check to make sure the "best" items are stored

    ../test/test_dht.cpp:472

    			, msg_args().target(items[j].target));
    │ │ │ │ +		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)
    │ │ │ │ +			<< ' ' << face.name << '\n';
    │ │ │ │ +
    relevance 0../test/test_peer_list.cpp:1241test erasing peers

    test erasing peers

    ../test/test_peer_list.cpp:1241

    relevance 0../test/test_peer_list.cpp:1242test update_peer_port with allow_multiple_connections_per_ip and without

    test update_peer_port with allow_multiple_connections_per_ip and without

    ../test/test_peer_list.cpp:1242

    relevance 0../test/test_peer_list.cpp:1243test add i2p peers

    test add i2p peers

    ../test/test_peer_list.cpp:1243

    relevance 0../test/test_peer_list.cpp:1244test allow_i2p_mixed

    test allow_i2p_mixed

    ../test/test_peer_list.cpp:1244

    relevance 0../test/test_peer_list.cpp:1245test insert_peer failing with all error conditions

    test insert_peer failing with all error conditions

    ../test/test_peer_list.cpp:1245

    relevance 0../test/test_peer_list.cpp:1246test IPv6

    test IPv6

    ../test/test_peer_list.cpp:1246

    relevance 0../test/test_peer_list.cpp:1247test connect_to_peer() failing

    test connect_to_peer() failing

    ../test/test_peer_list.cpp:1247

    relevance 0../test/test_peer_list.cpp:1248test connection_closed

    test connection_closed

    ../test/test_peer_list.cpp:1248

    relevance 0../test/test_peer_list.cpp:1249connect candidates recalculation when incrementing failcount

    connect candidates recalculation when incrementing failcount

    ../test/test_peer_list.cpp:1249

    relevance 0../test/test_fast_extension.cpp:1135test sending invalid requests (out of bound piece index, offsets and sizes)

    test sending invalid requests (out of bound piece index, offsets and │ │ │ │ +sizes)

    ../test/test_fast_extension.cpp:1135

    relevance 0../test/test_dht.cpp:472check to make sure the "best" items are stored

    check to make sure the "best" items are stored

    ../test/test_dht.cpp:472

    			, 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},
    │ │ │ │ @@ -4981,15 +4964,15 @@
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │  void put_mutable_item_data_cb(dht::item& i)
    │ │ │ │  {
    │ │ │ │  	if (!i.empty())
    │ │ │ │  		g_got_items.push_back(i);
    │ │ │ │  
    │ │ │ │ -
    relevance 0../test/test_dht.cpp:3223this won't work because the second node isn't pinged so it wont be added to the routing table

    this won't work because the second node isn't pinged so it wont │ │ │ │ +

    relevance 0../test/test_dht.cpp:3223this won't work because the second node isn't pinged so it wont be added to the routing table

    this won't work because the second node isn't pinged so it wont │ │ │ │ be added to the routing table

    ../test/test_dht.cpp:3223

    	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);
    │ │ │ │ @@ -5028,15 +5011,15 @@
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │  #ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │  // these tests rely on logging being enabled
    │ │ │ │  
    │ │ │ │  TORRENT_TEST(invalid_error_msg)
    │ │ │ │  {
    │ │ │ │ -
    relevance 0../test/test_dht.cpp:4081test obfuscated_get_peers

    test obfuscated_get_peers

    ../test/test_dht.cpp:4081

    		TEST_CHECK(sm.has_quota());
    │ │ │ │ +
    relevance 0../test/test_dht.cpp:4081test obfuscated_get_peers

    test obfuscated_get_peers

    ../test/test_dht.cpp:4081

    		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());
    │ │ │ │ @@ -5057,15 +5040,15 @@
    │ │ │ │  TORRENT_TEST(dht)
    │ │ │ │  {
    │ │ │ │  	// dummy dht test
    │ │ │ │  	TEST_CHECK(true);
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │  #endif
    │ │ │ │ -
    relevance 0../test/test_resume.cpp:582test what happens when loading a resume file with both piece priorities and file priorities (file prio should take precedence)

    test what happens when loading a resume file with both piece priorities │ │ │ │ +relevance 0../test/test_resume.cpp:582test what happens when loading a resume file with both piece priorities and file priorities (file prio should take precedence)

    test what happens when loading a resume file with both piece priorities │ │ │ │ and file priorities (file prio should take precedence)

    ../test/test_resume.cpp:582

    		{
    │ │ │ │  			TEST_EQUAL(pieces[i], true);
    │ │ │ │  		}
    │ │ │ │  	}
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │  } // anonymous namespace
    │ │ │ │ @@ -5079,15 +5062,15 @@
    │ │ │ │  {
    │ │ │ │  	settings_pack sett = settings();
    │ │ │ │  	sett.set_int(settings_pack::suggest_mode, settings_pack::suggest_read_cache);
    │ │ │ │  	test_piece_slots_seed(sett);
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │  
    │ │ │ │ -
    relevance 0../test/test_resume.cpp:585make sure a resume file only ever contain file priorities OR piece priorities. Never both.

    make sure a resume file only ever contain file priorities OR piece │ │ │ │ +

    relevance 0../test/test_resume.cpp:585make sure a resume file only ever contain file priorities OR piece priorities. Never both.

    make sure a resume file only ever contain file priorities OR piece │ │ │ │ priorities. Never both.

    ../test/test_resume.cpp:585

    			TEST_EQUAL(pieces[i], true);
    │ │ │ │  		}
    │ │ │ │  	}
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │  } // anonymous namespace
    │ │ │ │  
    │ │ │ │ @@ -5101,15 +5084,15 @@
    │ │ │ │  	settings_pack sett = settings();
    │ │ │ │  	sett.set_int(settings_pack::suggest_mode, settings_pack::suggest_read_cache);
    │ │ │ │  	test_piece_slots_seed(sett);
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │  
    │ │ │ │  
    │ │ │ │ -
    relevance 0../test/test_resume.cpp:588generally save

    generally save

    ../test/test_resume.cpp:588

    		}
    │ │ │ │ +
    relevance 0../test/test_resume.cpp:588generally save

    generally save

    ../test/test_resume.cpp:588

    		}
    │ │ │ │  	}
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │  } // anonymous namespace
    │ │ │ │  
    │ │ │ │  TORRENT_TEST(piece_slots_seed)
    │ │ │ │  {
    │ │ │ │ @@ -5152,15 +5135,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)
    │ │ │ │  {
    │ │ │ │ -
    relevance 0../test/test_resume.cpp:911test 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

    test all other resume flags here too. This would require returning │ │ │ │ +relevance 0../test/test_resume.cpp:911test 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

    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

    ../test/test_resume.cpp:911

    	TEST_EQUAL(s.connections_limit, 1345);
    │ │ │ │  	TEST_EQUAL(s.uploads_limit, 1346);
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │  TORRENT_TEST(paused_deprecated)
    │ │ │ │  {
    │ │ │ │ @@ -5205,15 +5188,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,
    │ │ │ │ -
    relevance 0../test/test_resume.cpp:1683test 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

    test all other resume flags here too. This would require returning │ │ │ │ +relevance 0../test/test_resume.cpp:1683test 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

    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

    ../test/test_resume.cpp:1683

    	TEST_EQUAL(s.connections_limit, 1345);
    │ │ │ │  	TEST_EQUAL(s.uploads_limit, 1346);
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │  TORRENT_TEST(paused)
    │ │ │ │  {
    │ │ │ │ @@ -5258,15 +5241,214 @@
    │ │ │ │  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);
    │ │ │ │  
    │ │ │ │  	add_torrent_params p;
    │ │ │ │ -
    relevance 0../test/test_flags.cpp:163change to a different test setup. currently always paused. test_set_after_add(torrent_flags::paused); test_unset_after_add(torrent_flags::paused);

    change to a different test setup. currently always paused. │ │ │ │ +relevance 0../test/test_ssl.cpp:407test using a signed certificate with the wrong info-hash in DN

    test using a signed certificate with the wrong info-hash in DN

    ../test/test_ssl.cpp:407

    	// 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 & invalid_certificate)
    │ │ │ │ +	{
    │ │ │ │ +		certificate = combine_path("..", combine_path("ssl", "invalid_peer_certificate.pem"));
    │ │ │ │ +		private_key = combine_path("..", combine_path("ssl", "invalid_peer_private_key.pem"));
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    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); │ │ │ │ + return false; │ │ │ │ +
    relevance 0../test/test_ssl.cpp:509also test using a hash that refers to a valid torrent but that differs from the SNI hash

    also test using a hash that refers to a valid torrent │ │ │ │ +but that differs from the SNI hash

    ../test/test_ssl.cpp:509

    	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
    │ │ │ │ +
    │ │ │ │ +	// 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); │ │ │ │ +
    } │ │ │ │ + │ │ │ │ + // 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"); │ │ │ │ + return false; │ │ │ │ +
    relevance 0../test/test_timestamp_history.cpp:54test the case where we have > 120 samples (and have the base delay actually be updated)

    test the case where we have > 120 samples (and have the base delay actually be updated)

    ../test/test_timestamp_history.cpp:54

    relevance 0../test/test_timestamp_history.cpp:55test the case where a sample is lower than the history entry but not lower than the base

    test the case where a sample is lower than the history entry but not lower than the base

    ../test/test_timestamp_history.cpp:55

    #include "libtorrent/aux_/timestamp_history.hpp"
    │ │ │ │ +
    │ │ │ │ +TORRENT_TEST(timestamp_history)
    │ │ │ │ +{
    │ │ │ │ +	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);
    │ │ │ │ +
    │ │ │ │ +
    } │ │ │ │ +
    │ │ │ │ +
    relevance 0../test/test_resolve_links.cpp:95test files with different piece size (negative test)

    test files with different piece size (negative test)

    ../test/test_resolve_links.cpp:95

    	{ "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../test/test_resolve_links.cpp:98it 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.

    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.

    ../test/test_resolve_links.cpp:98

    	{ "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) │ │ │ │ + { │ │ │ │ + file_storage const& fs = ti1->files(); │ │ │ │ +
    relevance 0../test/test_flags.cpp:163change to a different test setup. currently always paused. test_set_after_add(torrent_flags::paused); test_unset_after_add(torrent_flags::paused);

    change to a different test setup. currently always paused. │ │ │ │ test_set_after_add(torrent_flags::paused); │ │ │ │ test_unset_after_add(torrent_flags::paused);

    ../test/test_flags.cpp:163

    {
    │ │ │ │  	// 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);
    │ │ │ │  }
    │ │ │ │ @@ -5311,18 +5493,18 @@
    │ │ │ │  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../test/test_flags.cpp:205this 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.

    this test is flaky, since the torrent will become ready before │ │ │ │ +relevance 0../test/test_flags.cpp:205this 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.

    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.

    ../test/test_flags.cpp:205

    relevance 0../test/test_flags.cpp:209change to a different test setup. currently always paused. test_set_after_add(torrent_flags::stop_when_ready);

    change to a different test setup. currently always paused. │ │ │ │ +setting stop-when-ready when already stopped has no effect.

    ../test/test_flags.cpp:205

    relevance 0../test/test_flags.cpp:209change to a different test setup. currently always paused. test_set_after_add(torrent_flags::stop_when_ready);

    change to a different test setup. currently always paused. │ │ │ │ test_set_after_add(torrent_flags::stop_when_ready);

    ../test/test_flags.cpp:209

    	test_set_after_add(torrent_flags::super_seeding);
    │ │ │ │  }
    │ │ │ │  #endif
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  TORRENT_TEST(flag_sequential_download)
    │ │ │ │  {
    │ │ │ │ @@ -5360,823 +5542,240 @@
    │ │ │ │  
    │ │ │ │  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../test/test_transfer.cpp:173these settings_pack tests belong in their own test

    these settings_pack tests belong in their own test

    ../test/test_transfer.cpp:173

    	// 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);
    │ │ │ │ +
    relevance 0../test/test_merkle_tree.cpp:233use structured bindings in C++17

    use structured bindings in C++17

    ../test/test_merkle_tree.cpp:233

    			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));
    │ │ │ │ +		}
    │ │ │ │ +	}
    │ │ │ │ +}
    │ │ │ │  
    │ │ │ │ -	pack.set_int(settings_pack::out_enc_policy, settings_pack::pe_disabled);
    │ │ │ │ -	pack.set_int(settings_pack::in_enc_policy, settings_pack::pe_disabled);
    │ │ │ │ +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(); │ │ │ │ │ │ │ │ - pack.set_bool(settings_pack::allow_multiple_connections_per_ip, false); │ │ │ │ + aux::merkle_tree t2(block_count, blocks_per_piece, f[0].data()); │ │ │ │ + t2.load_sparse_tree(tree, mask, empty_verified); │ │ │ │ │ │ │ │ -
    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); │ │ │ │ + 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)); │ │ │ │ │ │ │ │ - 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 (!t.has_node(i)) │ │ │ │ + TEST_CHECK(t[i].is_all_zeros()); │ │ │ │ + if (!t2.has_node(i)) │ │ │ │ + TEST_CHECK(t2[i].is_all_zeros()); │ │ │ │ │ │ │ │ - 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); │ │ │ │ + TEST_CHECK(t.compare_node(i, t2[i])); │ │ │ │ + TEST_CHECK(t2.compare_node(i, t[i])); │ │ │ │ + } │ │ │ │ +} │ │ │ │ +} │ │ │ │ │ │ │ │ - ses2.apply_settings(pack); │ │ │ │ +TORRENT_TEST(roundtrip_empty_tree) │ │ │ │ +{ │ │ │ │ + aux::merkle_tree t(num_blocks, 1, f[0].data()); │ │ │ │ + test_roundtrip(t, num_blocks, 1); │ │ │ │ +} │ │ │ │ │ │ │ │ - torrent_handle tor1; │ │ │ │ - torrent_handle tor2; │ │ │ │ +TORRENT_TEST(roundtrip_full_tree) │ │ │ │ +
    relevance 0../test/test_merkle_tree.cpp:938add test for load_piece_layer()

    add test for load_piece_layer()

    ../test/test_merkle_tree.cpp:938

    relevance 0../test/test_merkle_tree.cpp:939add test for add_hashes() with an odd number of blocks

    add test for add_hashes() with an odd number of blocks

    ../test/test_merkle_tree.cpp:939

    relevance 0../test/test_merkle_tree.cpp:940add test for set_block() (setting the last block) with an odd number of blocks

    add test for set_block() (setting the last block) with an odd number of blocks

    ../test/test_merkle_tree.cpp:940

    │ │ │ │ +		for (int i = 0; i < 7; ++i)
    │ │ │ │ +			TEST_EQUAL(t[i], f[i]);
    │ │ │ │ +	}
    │ │ │ │  
    │ │ │ │ -	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");
    │ │ │ │ -	wait_for_listen(ses2, "ses2");
    │ │ │ │ -
    relevance 0../test/test_resolve_links.cpp:95test files with different piece size (negative test)

    test files with different piece size (negative test)

    ../test/test_resolve_links.cpp:95

    	{ "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../test/test_resolve_links.cpp:98it 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.

    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.

    ../test/test_resolve_links.cpp:98

    	{ "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},
    │ │ │ │ +	// 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));
    │ │ │ │ +	TEST_CHECK(result);
    │ │ │ │  
    │ │ │ │ -	// 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},
    │ │ │ │ +	auto const& res = *result;
    │ │ │ │ +	TEST_EQUAL(res.passed.size(), 0);
    │ │ │ │ +	TEST_EQUAL(res.failed.size(), 0);
    │ │ │ │  
    │ │ │ │ -	// if it's padded on the other hand, it will work
    │ │ │ │ -	{ "test1_pad_files", "test1_single_padded", 1},
    │ │ │ │ +	for (int i = 127; i < 127 + 4; ++i)
    │ │ │ │ +		TEST_CHECK(t[i] == f[i]);
    │ │ │ │  
    │ │ │ │ -};
    │ │ │ │ +	TEST_CHECK(t.verified_leafs() == none_set(num_blocks));
    │ │ │ │ +}
    │ │ │ │  
    │ │ │ │  
    │ │ │ │ -
    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))); │ │ │ │ +
    relevance 0../src/peer_connection.cpp:1105this should be the global download rate

    this should be the global download rate

    ../src/peer_connection.cpp:1105

    │ │ │ │ +		int rate = 0;
    │ │ │ │  
    │ │ │ │ -		// some debug output in case the test fails
    │ │ │ │ -		if (num_matches > e.expected_matches)
    │ │ │ │ -		{
    │ │ │ │ -			file_storage const& fs = ti1->files();
    │ │ │ │ -
    relevance 0../test/test_upnp.cpp:156store the log and verify that some key messages are there

    store the log and verify that some key messages are there

    ../test/test_upnp.cpp:156

    			, 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
    │ │ │ │ +		// 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)
    │ │ │ │  		{
    │ │ │ │ -			return true;
    │ │ │ │ +			rate = m_download_rate_peak;
    │ │ │ │  		}
    │ │ │ │ -
    │ │ │ │ -		void log_portmap(portmap_transport, char const* msg
    │ │ │ │ -			, aux::listen_socket_handle const&) const override
    │ │ │ │ +		else if (aux::time_now() - m_last_unchoked.get(m_connect) < seconds(5)
    │ │ │ │ +			&& m_statistics.total_payload_upload() < 2 * 0x4000)
    │ │ │ │  		{
    │ │ │ │ -			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) │ │ │ │ - << ' ' << face.name << '\n'; │ │ │ │ -
    relevance 0../test/test_tracker.cpp:60test scrape requests

    test scrape requests

    ../test/test_tracker.cpp:60

    relevance 0../test/test_tracker.cpp:61test parse peers6

    test parse peers6

    ../test/test_tracker.cpp:61

    relevance 0../test/test_tracker.cpp:62test parse tracker-id

    test parse tracker-id

    ../test/test_tracker.cpp:62

    relevance 0../test/test_tracker.cpp:63test parse failure-reason

    test parse failure-reason

    ../test/test_tracker.cpp:63

    relevance 0../test/test_tracker.cpp:64test 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

    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

    ../test/test_tracker.cpp:64

    #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) │ │ │ │ -{ │ │ │ │ - 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(parse_peers4) │ │ │ │ -{ │ │ │ │ - char const response[] = "d5:peers12:\x01\x02\x03\x04\x30\x10" │ │ │ │ - "\x09\x08\x07\x06\x20\x10" "e"; │ │ │ │ - error_code ec; │ │ │ │ -
    relevance 0../test/test_bloom_filter.cpp:135test size()

    test size()

    ../test/test_bloom_filter.cpp:135

    relevance 0../test/test_bloom_filter.cpp:136test clear()

    test clear()

    ../test/test_bloom_filter.cpp:136

    	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../src/alert.cpp:404move this field into tracker_alert

    move this field into tracker_alert

    ../src/alert.cpp:404

    │ │ │ │ -		return torrent_alert::message() + ": state changed to: "
    │ │ │ │ -			+ state_str[state];
    │ │ │ │ -#endif
    │ │ │ │ -	}
    │ │ │ │ -
    │ │ │ │ -	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()); │ │ │ │ - } │ │ │ │ - │ │ │ │ - char const* tracker_error_alert::failure_reason() const │ │ │ │ - { │ │ │ │ - return m_alloc.get().ptr(m_msg_idx); │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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; │ │ │ │ -#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)) │ │ │ │ -#if TORRENT_ABI_VERSION == 1 │ │ │ │ -
    relevance 0../src/alert.cpp:438move this into tracker_alert

    move this into tracker_alert

    ../src/alert.cpp:438

    		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
    │ │ │ │ -	}
    │ │ │ │ -
    │ │ │ │ -	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()); │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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 │ │ │ │ - return {}; │ │ │ │ -#else │ │ │ │ - return tracker_alert::message() + (version == protocol_version::V1 ? " v1" : " v2") + " warning: " + warning_message(); │ │ │ │ -#endif │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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) │ │ │ │ -
    relevance 0../src/alert.cpp:464move this into tracker_alert

    move this into tracker_alert

    ../src/alert.cpp:464

    	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
    │ │ │ │ -		return {};
    │ │ │ │ -#else
    │ │ │ │ -		return tracker_alert::message() + (version == protocol_version::V1 ? " v1" : " v2") + " warning: " + warning_message();
    │ │ │ │ -#endif
    │ │ │ │ -	}
    │ │ │ │ -
    │ │ │ │ -	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) │ │ │ │ -
    { │ │ │ │ - TORRENT_ASSERT(!u.empty()); │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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 │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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 │ │ │ │ -
    relevance 0../src/alert.cpp:493move this into tracker_alert

    move this into tracker_alert

    ../src/alert.cpp:493

    		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
    │ │ │ │ -	}
    │ │ │ │ -
    │ │ │ │ -	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()); │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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()); │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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 │ │ │ │ -
    relevance 0../src/alert.cpp:532move this field into tracker_alert

    move this field into tracker_alert

    ../src/alert.cpp:532

    	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
    │ │ │ │ -	}
    │ │ │ │ -
    │ │ │ │ -	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()); │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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 │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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 {}; │ │ │ │ -#else │ │ │ │ -
    relevance 0../src/alert.cpp:576move this to tracker_alert

    move this to tracker_alert

    ../src/alert.cpp:576

    		, 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;
    │ │ │ │ -#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()); │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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 │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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)); │ │ │ │ - } │ │ │ │ - │ │ │ │ - std::string hash_failed_alert::message() const │ │ │ │ - { │ │ │ │ -#ifdef TORRENT_DISABLE_ALERT_MSG │ │ │ │ - return {}; │ │ │ │ -
    relevance 0../src/utp_stream.cpp:1467this loop is not very efficient. It could be fixed by having a separate list of sequence numbers that need resending

    this loop is not very efficient. It could be fixed by having │ │ │ │ -a separate list of sequence numbers that need resending

    ../src/utp_stream.cpp:1467

    #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;
    │ │ │ │ -
    │ │ │ │ -	// 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'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; │ │ │ │ - } │ │ │ │ - │ │ │ │ - // 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. │ │ │ │ -
    relevance 0../src/create_torrent.cpp:618this can be optimized

    this can be optimized

    ../src/create_torrent.cpp:618

    		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';
    │ │ │ │ -		if (include_symlinks && (flags & file_storage::flag_symlink)) attr += 'l';
    │ │ │ │ -	}
    │ │ │ │ +		// avoid division by zero
    │ │ │ │ +		if (rate < 50) rate = 50;
    │ │ │ │  
    │ │ │ │ -	void add_symlink_path(entry& e, std::string symlink_path)
    │ │ │ │ -	{
    │ │ │ │ -		entry& sympath_e = e["symlink path"];
    │ │ │ │ +		// average of current rate and peak
    │ │ │ │ +//		rate = (rate + m_download_rate_peak) / 2;
    │ │ │ │  
    │ │ │ │ -		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);
    │ │ │ │ +		return milliseconds((m_outstanding_bytes + extra_bytes
    │ │ │ │ +			+ m_queued_time_critical * t->block_size() * 1000) / rate);
    │ │ │ │  	}
    │ │ │ │ -}
    │ │ │ │  
    │ │ │ │ -	std::vector<char> create_torrent::generate_buf() const
    │ │ │ │ +	void peer_connection::add_stat(std::int64_t const downloaded, std::int64_t const uploaded)
    │ │ │ │  	{
    │ │ │ │ -
    std::vector<char> ret; │ │ │ │ -
    bencode(std::back_inserter(ret), generate()); │ │ │ │ - return ret; │ │ │ │ + TORRENT_ASSERT(is_single_thread()); │ │ │ │ + m_statistics.add_stat(downloaded, uploaded); │ │ │ │ } │ │ │ │ │ │ │ │ - entry create_torrent::generate() const │ │ │ │ + sha1_hash peer_connection::associated_info_hash() const │ │ │ │ { │ │ │ │ - if (m_files.num_files() == 0 || m_files.total_size() == 0) │ │ │ │ - aux::throw_ex<system_error>(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 && !make_v2) │ │ │ │ - aux::throw_ex<system_error>(errors::invalid_hash_entry); │ │ │ │ - │ │ │ │ - TORRENT_ASSERT(m_files.piece_length() > 0); │ │ │ │ - │ │ │ │ - entry dict; │ │ │ │ - │ │ │ │ - if (!m_urls.empty()) dict["announce"] = m_urls.front().first; │ │ │ │ - │ │ │ │ - if (!m_nodes.empty()) │ │ │ │ + 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, │ │ │ │ + // otherwise something isn't right │ │ │ │ +
    relevance 0../src/peer_connection.cpp:3536sort the allowed fast set in priority order

    sort the allowed fast set in priority order

    ../src/peer_connection.cpp:3536

    │ │ │ │ +		// 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)
    │ │ │ │  		{
    │ │ │ │ -			entry& nodes = dict["nodes"];
    │ │ │ │ -			entry::list_type& nodes_list = nodes.list();
    │ │ │ │ -			for (auto const& n : m_nodes)
    │ │ │ │ -			{
    │ │ │ │ -
    relevance 0../src/file_storage.cpp:457maybe it would be nice to have a better index here

    maybe it would be nice to have a better index here

    ../src/file_storage.cpp:457

    		// 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()));
    │ │ │ │ -	}
    │ │ │ │ -
    │ │ │ │ -	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; │ │ │ │ + t->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<piece_index_t> const& peer_connection::allowed_fast() │ │ │ │ { │ │ │ │ - return piece_index_t{aux::numeric_cast<int>(file_offset(f) / piece_length())}; │ │ │ │ - } │ │ │ │ + TORRENT_ASSERT(is_single_thread()); │ │ │ │ + std::shared_ptr<torrent> t = m_torrent.lock(); │ │ │ │ + TORRENT_ASSERT(t); │ │ │ │ │ │ │ │ -#if TORRENT_ABI_VERSION <= 2 │ │ │ │ - char const* file_storage::file_name_ptr(file_index_t const index) const │ │ │ │ - { │ │ │ │ - return m_files[index].name; │ │ │ │ - } │ │ │ │ +
    return m_allowed_fast; │ │ │ │ +
    } │ │ │ │ │ │ │ │ - int file_storage::file_name_len(file_index_t const index) const │ │ │ │ + bool peer_connection::can_request_time_critical() const │ │ │ │ { │ │ │ │ - if (m_files[index].name_len == aux::file_entry::name_is_owned) │ │ │ │ - return -1; │ │ │ │ - return m_files[index].name_len; │ │ │ │ - } │ │ │ │ -#endif │ │ │ │ + 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; │ │ │ │ │ │ │ │ - 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}); │ │ │ │ - TORRENT_ASSERT_PRECOND(piece < end_piece()); │ │ │ │ -
    relevance 0../src/file_storage.cpp:1242this would be more efficient if m_paths was sorted first, such that a lower path index always meant sorted-before

    this would be more efficient if m_paths was sorted first, such │ │ │ │ -that a lower path index always meant sorted-before

    ../src/file_storage.cpp:1242

    	}
    │ │ │ │ +		// ignore snubbed peers, since they're not likely to return pieces in a
    │ │ │ │ +		// timely manner anyway
    │ │ │ │ +		if (m_snubbed) return false;
    │ │ │ │ +		return true;
    │ │ │ │ +	}
    │ │ │ │  
    │ │ │ │ -	void file_storage::canonicalize_impl(bool const backwards_compatible)
    │ │ │ │ +	bool peer_connection::make_time_critical(piece_block const& block)
    │ │ │ │  	{
    │ │ │ │ -		TORRENT_ASSERT(piece_length() >= 16 * 1024);
    │ │ │ │ +		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);
    │ │ │ │ +		TORRENT_ASSERT(t->has_picker());
    │ │ │ │ +
    relevance 0../src/choker.cpp:258make configurable

    make configurable

    ../src/choker.cpp:258

    			// first reset the number of unchoke slots, because we'll calculate
    │ │ │ │ +			// it purely based on the current state of our peers.
    │ │ │ │ +			upload_slots = 0;
    │ │ │ │  
    │ │ │ │ -		// 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;
    │ │ │ │ +			int rate_threshold = sett.get_int(settings_pack::rate_choker_initial_threshold);
    │ │ │ │  
    │ │ │ │ -		// 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());
    │ │ │ │ -		}
    │ │ │ │ +			std::sort(peers.begin(), peers.end()
    │ │ │ │ +				, [](peer_connection const* lhs, peer_connection const* rhs)
    │ │ │ │ +				{ return upload_rate_compare(lhs, rhs); });
    │ │ │ │  
    │ │ │ │ -
    │ │ │ │ -
    // 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) │ │ │ │ + for (auto const* p : peers) │ │ │ │ { │ │ │ │ - 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; │ │ │ │ + int const rate = int(p->uploaded_in_last_round() │ │ │ │ + * 1000 / total_milliseconds(unchoke_interval)); │ │ │ │ │ │ │ │ - // 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); │ │ │ │ + // always have at least 1 unchoke slot │ │ │ │ + if (rate < rate_threshold) break; │ │ │ │ │ │ │ │ - // re-compute offsets and insert pad files as necessary │ │ │ │ - std::int64_t off = 0; │ │ │ │ + ++upload_slots; │ │ │ │ │ │ │ │ -
    relevance 0../src/file_storage.cpp:1345in C++17 this could be string_view

    in C++17 this could be string_view

    ../src/file_storage.cpp:1345

    				add_pad_file(i);
    │ │ │ │ +
    rate_threshold += 2048; │ │ │ │ +
    } │ │ │ │ + ++upload_slots; │ │ │ │ } │ │ │ │ │ │ │ │ - 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; │ │ │ │ + // 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 │ │ │ │ │ │ │ │ - // symbolic links that points to directories │ │ │ │ - std::unordered_map<std::string, std::string> dir_links; │ │ │ │ + // we use partial sort here, because we only care about the top │ │ │ │ + // upload_slots peers. │ │ │ │ │ │ │ │ - // 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; │ │ │ │ + int const slots = std::min(upload_slots, int(peers.size())); │ │ │ │ │ │ │ │ - for (auto const i : file_range()) │ │ │ │ + if (sett.get_int(settings_pack::seed_choking_algorithm) │ │ │ │ + == settings_pack::round_robin) │ │ │ │ { │ │ │ │ - if (!(file_flags(i) & 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& 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]; │ │ │ │ + int const pieces = sett.get_int(settings_pack::seeding_piece_quota); │ │ │ │ │ │ │ │ - if (is_complete(target)) │ │ │ │ - { │ │ │ │ -
    relevance 0../src/merkle_tree.cpp:110in C++20, use std::identity

    in C++20, use std::identity

    ../src/merkle_tree.cpp:110

    		allocate_full();
    │ │ │ │ +			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()
    │ │ │ │ +				, [](peer_connection const* lhs, peer_connection const* rhs)
    │ │ │ │ +
    relevance 0../src/merkle_tree.cpp:110in C++20, use std::identity

    in C++20, use std::identity

    ../src/merkle_tree.cpp:110

    		allocate_full();
    │ │ │ │  
    │ │ │ │  		merkle_validate_copy(t, m_tree, root(), m_block_verified);
    │ │ │ │  
    │ │ │ │  		load_verified_bits(verified);
    │ │ │ │  
    │ │ │ │  		optimize_storage();
    │ │ │ │  		optimize_storage_piece_layer();
    │ │ │ │ @@ -6219,15 +5818,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() < block_index + m_num_blocks)
    │ │ │ │  				return clear();
    │ │ │ │  
    │ │ │ │ -
    relevance 0../src/merkle_tree.cpp:319this can be optimized by using m_tree as storage to fill this tree into, and then clear it if the hashes fail

    this can be optimized by using m_tree as storage to fill this │ │ │ │ +relevance 0../src/merkle_tree.cpp:319this can be optimized by using m_tree as storage to fill this tree into, and then clear it if the hashes fail

    this can be optimized by using m_tree as storage to fill this │ │ │ │ tree into, and then clear it if the hashes fail

    ../src/merkle_tree.cpp:319

    	{
    │ │ │ │  		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;
    │ │ │ │ @@ -6271,15 +5870,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 >> 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 {};
    │ │ │ │ -
    relevance 0../src/merkle_tree.cpp:367a piece outside of this range may also fail, if one of the uncle hashes is at the layer right above the block hashes

    a piece outside of this range may also fail, if one of the uncle │ │ │ │ +relevance 0../src/merkle_tree.cpp:367a piece outside of this range may also fail, if one of the uncle hashes is at the layer right above the block hashes

    a piece outside of this range may also fail, if one of the uncle │ │ │ │ hashes is at the layer right above the block hashes

    ../src/merkle_tree.cpp:367

    		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
    │ │ │ │ @@ -6323,15 +5922,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 >= first_leaf)
    │ │ │ │ -
    relevance 0../src/merkle_tree.cpp:447instead 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.

    instead of overwriting the root and comparing it │ │ │ │ +relevance 0../src/merkle_tree.cpp:447instead 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.

    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.

    ../src/merkle_tree.cpp:447

    			&& 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
    │ │ │ │ @@ -6366,15 +5965,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);
    │ │ │ │ -
    relevance 0../src/merkle_tree.cpp:471this could be done more efficiently if bitfield had a function to set a range of bits

    this could be done more efficiently if bitfield had a function │ │ │ │ +relevance 0../src/merkle_tree.cpp:471this could be done more efficiently if bitfield had a function to set a range of bits

    this could be done more efficiently if bitfield had a function │ │ │ │ to set a range of bits

    ../src/merkle_tree.cpp:471

    				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());
    │ │ │ │ @@ -6418,15 +6017,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);
    │ │ │ │ -
    relevance 0../src/merkle_tree.cpp:514use structured binding in C++17

    use structured binding in C++17

    ../src/merkle_tree.cpp:514

    		auto const first_leaf = merkle_first_leaf(num_leafs);
    │ │ │ │ +
    relevance 0../src/merkle_tree.cpp:514use structured binding in C++17

    use structured binding in C++17

    ../src/merkle_tree.cpp:514

    		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);
    │ │ │ │ @@ -6462,15 +6061,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);
    │ │ │ │  		}
    │ │ │ │  
    │ │ │ │ -
    relevance 0../src/merkle_tree.cpp:539this could be done more efficiently if bitfield had a function to set a range of bits

    this could be done more efficiently if bitfield had a function │ │ │ │ +relevance 0../src/merkle_tree.cpp:539this could be done more efficiently if bitfield had a function to set a range of bits

    this could be done more efficiently if bitfield had a function │ │ │ │ to set a range of bits

    ../src/merkle_tree.cpp:539

    			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
    │ │ │ │ @@ -6514,97 +6113,304 @@
    │ │ │ │  	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);
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ -
    relevance 0../src/pe_crypto.cpp:60it would be nice to get the literal working

    it would be nice to get the literal working

    ../src/pe_crypto.cpp:60

    #include <algorithm>
    │ │ │ │ -#include <random>
    │ │ │ │ +
    relevance 0../src/file_storage.cpp:457maybe it would be nice to have a better index here

    maybe it would be nice to have a better index here

    ../src/file_storage.cpp:457

    		// 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()));
    │ │ │ │  
    │ │ │ │ -#include "libtorrent/aux_/disable_warnings_push.hpp"
    │ │ │ │ +		auto file_iter = std::upper_bound(
    │ │ │ │ +			m_files.begin(), m_files.end(), target, compare_file_offset);
    │ │ │ │  
    │ │ │ │ -#include <boost/multiprecision/integer.hpp>
    │ │ │ │ -#include <boost/multiprecision/cpp_int.hpp>
    │ │ │ │ +		TORRENT_ASSERT(file_iter != m_files.begin());
    │ │ │ │ +		--file_iter;
    │ │ │ │ +		return file_index_t{int(file_iter - m_files.begin())};
    │ │ │ │ +	}
    │ │ │ │  
    │ │ │ │ -#include "libtorrent/aux_/disable_warnings_pop.hpp"
    │ │ │ │ +	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()));
    │ │ │ │ +	}
    │ │ │ │  
    │ │ │ │ -#include "libtorrent/random.hpp"
    │ │ │ │ -#include "libtorrent/aux_/alloca.hpp"
    │ │ │ │ -#include "libtorrent/pe_crypto.hpp"
    │ │ │ │ -#include "libtorrent/hasher.hpp"
    │ │ │ │ +	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}; │ │ │ │ + } │ │ │ │ │ │ │ │ -namespace libtorrent { │ │ │ │ + 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())}; │ │ │ │ + } │ │ │ │ │ │ │ │ - namespace mp = boost::multiprecision; │ │ │ │ +#if TORRENT_ABI_VERSION <= 2 │ │ │ │ + char const* file_storage::file_name_ptr(file_index_t const index) const │ │ │ │ + { │ │ │ │ + return m_files[index].name; │ │ │ │ + } │ │ │ │ │ │ │ │ - namespace { │ │ │ │ -
    key_t const dh_prime │ │ │ │ -
    ("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63A36210000000000090563"); │ │ │ │ + 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::array<char, 96> export_key(key_t const& k) │ │ │ │ + std::vector<file_slice> file_storage::map_block(piece_index_t const piece │ │ │ │ + , std::int64_t const offset, std::int64_t size) const │ │ │ │ { │ │ │ │ - std::array<char, 96> ret; │ │ │ │ - auto* begin = reinterpret_cast<std::uint8_t*>(ret.data()); │ │ │ │ - std::uint8_t* end = mp::export_bits(k, begin, 8); │ │ │ │ + TORRENT_ASSERT_PRECOND(piece >= piece_index_t{0}); │ │ │ │ + TORRENT_ASSERT_PRECOND(piece < end_piece()); │ │ │ │ +
    relevance 0../src/file_storage.cpp:1242this would be more efficient if m_paths was sorted first, such that a lower path index always meant sorted-before

    this would be more efficient if m_paths was sorted first, such │ │ │ │ +that a lower path index always meant sorted-before

    ../src/file_storage.cpp:1242

    	}
    │ │ │ │  
    │ │ │ │ -
    relevance 0../src/pe_crypto.cpp:71it would be nice to be able to export to a fixed width field, so we wouldn't have to shift it later

    it would be nice to be able to export to a fixed width field, so │ │ │ │ -we wouldn't have to shift it later

    ../src/pe_crypto.cpp:71

    #include "libtorrent/random.hpp"
    │ │ │ │ -#include "libtorrent/aux_/alloca.hpp"
    │ │ │ │ -#include "libtorrent/pe_crypto.hpp"
    │ │ │ │ -#include "libtorrent/hasher.hpp"
    │ │ │ │ +	void file_storage::canonicalize_impl(bool const backwards_compatible)
    │ │ │ │ +	{
    │ │ │ │ +		TORRENT_ASSERT(piece_length() >= 16 * 1024);
    │ │ │ │  
    │ │ │ │ -namespace libtorrent {
    │ │ │ │ +		// 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;
    │ │ │ │  
    │ │ │ │ -	namespace mp = boost::multiprecision;
    │ │ │ │ +		// 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());
    │ │ │ │ +		}
    │ │ │ │  
    │ │ │ │ -	namespace {
    │ │ │ │ -		key_t const dh_prime
    │ │ │ │ -			("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63A36210000000000090563");
    │ │ │ │ +
    │ │ │ │ +
    // 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) │ │ │ │ + { │ │ │ │ + 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 │ │ │ │ + std::int64_t off = 0; │ │ │ │ + │ │ │ │ +
    relevance 0../src/file_storage.cpp:1345in C++17 this could be string_view

    in C++17 this could be string_view

    ../src/file_storage.cpp:1345

    				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;
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ -	std::array<char, 96> export_key(key_t const& k)
    │ │ │ │ +	void file_storage::sanitize_symlinks()
    │ │ │ │  	{
    │ │ │ │ -		std::array<char, 96> ret;
    │ │ │ │ -		auto* begin = reinterpret_cast<std::uint8_t*>(ret.data());
    │ │ │ │ -		std::uint8_t* end = mp::export_bits(k, begin, 8);
    │ │ │ │ +		// 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;
    │ │ │ │  
    │ │ │ │ -
    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 │ │ │ │ -#endif │ │ │ │ - std::memset(begin, 0, aux::numeric_cast<std::size_t>(96 - len)); │ │ │ │ + // 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 (!(file_flags(i) & 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& 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../src/hash_picker.cpp:309use structured bindings in C++17

    use structured bindings in C++17

    ../src/hash_picker.cpp:309

    		, int const offset, sha256_hash const& h)
    │ │ │ │ +	{
    │ │ │ │ +		TORRENT_ASSERT(offset >= 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& 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<int>(piece) * std::int64_t(m_files.piece_length())
    │ │ │ │ +			+ offset - m_files.file_offset(f);
    │ │ │ │ +		int const block_index = aux::numeric_cast<int>(block_offset / default_block_size);
    │ │ │ │ +
    │ │ │ │ +		if (h.is_all_zeros())
    │ │ │ │ +		{
    │ │ │ │ +			TORRENT_ASSERT_FAIL();
    │ │ │ │ +			return set_block_hash_result::block_hash_failed();
    │ │ │ │  		}
    │ │ │ │ -		return ret;
    │ │ │ │ +
    │ │ │ │ +
    aux::merkle_tree::set_block_result result; │ │ │ │ +
    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<int>(piece - file_first_piece) * blocks_per_piece) │ │ │ │ + , std::min(leafs_size, m_files.file_num_pieces(f) * blocks_per_piece - leafs_index) }; │ │ │ │ } │ │ │ │ │ │ │ │ - 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); │ │ │ │ + void hash_picker::hashes_rejected(hash_request const& req) │ │ │ │ + { │ │ │ │ + TORRENT_ASSERT(req.base == m_piece_layer && req.index % 512 == 0); │ │ │ │ │ │ │ │ - // Set the prime P and the generator, generate local public key │ │ │ │ - dh_key_exchange::dh_key_exchange() │ │ │ │ + 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; │ │ │ │ + } │ │ │ │ + │ │ │ │ +
    relevance 0../src/torrent_info.cpp:887this should be considered a failure, and the .torrent file rejected

    this should be considered a failure, and the .torrent file │ │ │ │ +rejected

    ../src/torrent_info.cpp:887

    			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;
    │ │ │ │ +
    │ │ │ │ +				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) │ │ │ │ { │ │ │ │ - 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())}); │ │ │ │ + INVARIANT_CHECK; │ │ │ │ │ │ │ │ - // create local key (random) │ │ │ │ - mp::import_bits(m_dh_local_secret, random_key.begin(), random_key.end()); │ │ │ │ + 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()); │ │ │ │ │ │ │ │ - // key = (2 ^ secret) % prime │ │ │ │ - m_dh_local_key = mp::powm(key_t(2), m_dh_local_secret, dh_prime); │ │ │ │ -
    relevance 0../src/packet_buffer.cpp:157use compare_less_wrap for this comparison as well

    use compare_less_wrap for this comparison as well

    ../src/packet_buffer.cpp:157

    	{
    │ │ │ │ +		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);
    │ │ │ │ +		bencode(out, torrent_file);
    │ │ │ │ +
    relevance 0../src/session.cpp:540In C++17. use if constexpr instead

    In C++17. use if constexpr instead

    ../src/session.cpp:540

    	{}
    │ │ │ │ +	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();
    │ │ │ │ +		}
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	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 │ │ │ │ + } │ │ │ │ + │ │ │ │ +} │ │ │ │ +
    relevance 0../src/packet_buffer.cpp:157use compare_less_wrap for this comparison as well

    use compare_less_wrap for this comparison as well

    ../src/packet_buffer.cpp:157

    	{
    │ │ │ │  		INVARIANT_CHECK;
    │ │ │ │  		TORRENT_ASSERT_VAL(size <= 0xffff, size);
    │ │ │ │  		std::uint32_t new_size = m_capacity == 0 ? 16 : m_capacity;
    │ │ │ │  
    │ │ │ │  		while (new_size < size)
    │ │ │ │  			new_size <<= 1;
    │ │ │ │  
    │ │ │ │ @@ -6647,15 +6453,332 @@
    │ │ │ │  		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_last &= 0xffff;
    │ │ │ │ -
    relevance 0../src/ip_notifier.cpp:41simulator support

    simulator support

    ../src/ip_notifier.cpp:41

          from this software without specific prior written permission.
    │ │ │ │ +
    relevance 0../src/http_seed_connection.cpp:441technically, this isn't supposed to happen, but it seems to sometimes. Some of the accounting is probably wrong in certain cases

    technically, this isn't supposed to happen, but it seems to │ │ │ │ +sometimes. Some of the accounting is probably wrong in certain │ │ │ │ +cases

    ../src/http_seed_connection.cpp:441

    					// 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;
    │ │ │ │ +					}
    │ │ │ │ +				}
    │ │ │ │ +			}
    │ │ │ │ +
    │ │ │ │ +			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) │ │ │ │ + { │ │ │ │ + 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; │ │ │ │ + } │ │ │ │ + │ │ │ │ + │ │ │ │ + // 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 │ │ │ │ + if (m_parser.chunked_encoding() && m_chunk_pos >= 0) break; │ │ │ │ +
    relevance 0../src/posix_part_file.cpp:337what 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

    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

    ../src/posix_part_file.cpp:337

    │ │ │ │ +			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;
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    m_free_slots.push_back(i->second); │ │ │ │ + m_piece_map.erase(i); │ │ │ │ + m_dirty_metadata = true; │ │ │ │ + } │ │ │ │ + │ │ │ │ + void posix_part_file::move_partfile(std::string const& path, error_code& 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; │ │ │ │ + } │ │ │ │ +
    relevance 0../src/posix_part_file.cpp:424instead of rebuilding the whole file header and flushing it, update the slot entries as we go

    instead of rebuilding the whole file header │ │ │ │ +and flushing it, update the slot entries as we go

    ../src/posix_part_file.cpp:424

    				}
    │ │ │ │ +				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& ec)
    │ │ │ │ +	{
    │ │ │ │ +		flush_metadata_impl(ec);
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +
    void posix_part_file::flush_metadata_impl(error_code& ec) │ │ │ │ +
    { │ │ │ │ + // 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<char> header(static_cast<std::size_t>(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 < piece_index_t(m_max_pieces); ++piece) │ │ │ │ + { │ │ │ │ + auto const i = m_piece_map.find(piece); │ │ │ │ +
    relevance 0../src/udp_socket.cpp:659perhaps an attempt should be made to bind m_socks5_sock to the device of m_listen_socket

    perhaps an attempt should be made to bind m_socks5_sock to the │ │ │ │ +device of m_listen_socket

    ../src/udp_socket.cpp:659

    	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
    │ │ │ │ +
    │ │ │ │ +	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;
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    ADD_OUTSTANDING_ASYNC("socks5::on_connected"); │ │ │ │ + m_socks5_sock.async_connect(m_proxy_addr │ │ │ │ + , std::bind(&socks5::on_connected, self(), _1)); │ │ │ │ + │ │ │ │ + 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)); │ │ │ │ +} │ │ │ │ + │ │ │ │ +void socks5::on_connect_timeout(error_code const& e) │ │ │ │ +{ │ │ │ │ + COMPLETE_ASYNC("socks5::on_connect_timeout"); │ │ │ │ + │ │ │ │ + if (e == boost::asio::error::operation_aborted) return; │ │ │ │ + │ │ │ │ + if (m_abort) return; │ │ │ │ + │ │ │ │ + if (m_alerts.should_post<socks5_alert>()) │ │ │ │ + m_alerts.emplace_alert<socks5_alert>(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& e) │ │ │ │ +{ │ │ │ │ +
    relevance 0../src/storage_utils.cpp:230ideally, 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.

    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.

    ../src/storage_utils.cpp:230

    		// 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())
    │ │ │ │ +		{
    │ │ │ │ +			// 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 (!ec && move_partfile) │ │ │ │ + { │ │ │ │ + error_code e; │ │ │ │ + move_partfile(new_save_path, e); │ │ │ │ + if (e) │ │ │ │ +
    relevance 0../src/storage_utils.cpp:538it would seem reasonable to, instead, set the have_pieces bits for the pieces representing these files, and resume with the normal logic

    it would seem reasonable to, instead, set the have_pieces bits │ │ │ │ +for the pieces representing these files, and resume with the normal │ │ │ │ +logic

    ../src/storage_utils.cpp:538

    					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;
    │ │ │ │ +		}
    │ │ │ │ +
    │ │ │ │ +#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. │ │ │ │ + peer_request const pr = fs.map_file(file_index │ │ │ │ +
    relevance 0../src/ip_notifier.cpp:41simulator support

    simulator support

    ../src/ip_notifier.cpp:41

          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
    │ │ │ │ @@ -6698,15 +6821,1057 @@
    │ │ │ │  #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); }
    │ │ │ │  template <typename T> void CFRefRelease(T h) { CFRelease(h); }
    │ │ │ │  
    │ │ │ │ -
    relevance 0../src/add_torrent_params.cpp:78pre 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::value , "should be nothrow move assignable");

    pre C++17, GCC and msvc does not make std::string nothrow move │ │ │ │ +relevance 0../src/utp_stream.cpp:1467this loop is not very efficient. It could be fixed by having a separate list of sequence numbers that need resending

    this loop is not very efficient. It could be fixed by having │ │ │ │ +a separate list of sequence numbers that need resending

    ../src/utp_stream.cpp:1467

    #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;
    │ │ │ │ +
    │ │ │ │ +	// 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;
    │ │ │ │ +
    │ │ │ │ +	// first see if we need to resend any packets
    │ │ │ │ +
    │ │ │ │ +
    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)) │ │ │ │ + { │ │ │ │ + // 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) & 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. │ │ │ │ +
    relevance 0../src/performance_counters.cpp:40move stats_counter_t out of counters

    move stats_counter_t out of counters

    ../src/performance_counters.cpp:40

    relevance 0../src/performance_counters.cpp:41should bittorrent keep-alive messages have a counter too?

    should bittorrent keep-alive messages have a counter too?

    ../src/performance_counters.cpp:41

    relevance 0../src/performance_counters.cpp:42It would be nice if this could be an internal type. default_disk_constructor depends on it now

    It would be nice if this could be an internal type. default_disk_constructor depends on it now

    ../src/performance_counters.cpp:42

    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
    │ │ │ │ +
    │ │ │ │ +namespace libtorrent {
    │ │ │ │ +
    │ │ │ │ +
    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 │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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) │ │ │ │ + , std::memory_order_relaxed); │ │ │ │ +
    relevance 0../src/disabled_disk_io.cpp:106it would be nice to return a valid hash of zeroes here

    it would be nice to return a valid hash of zeroes here

    ../src/disabled_disk_io.cpp:106

    		});
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	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);
    │ │ │ │ +
    │ │ │ │ +		post(m_ios, [h = std::move(handler)] { h(storage_error{}); });
    │ │ │ │ +		return false;
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	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{}); }); │ │ │ │ +
    } │ │ │ │ + │ │ │ │ + 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{}); }); │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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 async_release_files(storage_index_t, std::function<void()> handler) override │ │ │ │ + { │ │ │ │ + post(m_ios, [h = std::move(handler)] { h(); }); │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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{}); }); │ │ │ │ + } │ │ │ │ + │ │ │ │ + void async_check_files(storage_index_t │ │ │ │ + , add_torrent_params const* │ │ │ │ +
    relevance 0../src/utp_socket_manager.cpp:204this should not be heap allocated, sockets should be movable

    this should not be heap allocated, sockets should be movable

    ../src/utp_socket_manager.cpp:204

    │ │ │ │ +//		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)); │ │ │ │ +
    │ │ │ │ + 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 (ph->get_type() == ST_RESET) return false; │ │ │ │ + │ │ │ │ + // #error send reset │ │ │ │ + │ │ │ │ + return false; │ │ │ │ + } │ │ │ │ + │ │ │ │ + void utp_socket_manager::subscribe_writable(utp_socket_impl* s) │ │ │ │ +
    relevance 0../src/create_torrent.cpp:618this can be optimized

    this can be optimized

    ../src/create_torrent.cpp:618

    		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';
    │ │ │ │ +		if (include_symlinks && (flags & file_storage::flag_symlink)) attr += 'l';
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	void add_symlink_path(entry& e, std::string symlink_path)
    │ │ │ │ +	{
    │ │ │ │ +		entry& 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<char> create_torrent::generate_buf() const
    │ │ │ │ +	{
    │ │ │ │ +
    std::vector<char> ret; │ │ │ │ +
    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<system_error>(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 && !make_v2) │ │ │ │ + aux::throw_ex<system_error>(errors::invalid_hash_entry); │ │ │ │ + │ │ │ │ + TORRENT_ASSERT(m_files.piece_length() > 0); │ │ │ │ + │ │ │ │ + entry dict; │ │ │ │ + │ │ │ │ + if (!m_urls.empty()) dict["announce"] = m_urls.front().first; │ │ │ │ + │ │ │ │ + if (!m_nodes.empty()) │ │ │ │ + { │ │ │ │ + entry& nodes = dict["nodes"]; │ │ │ │ + entry::list_type& nodes_list = nodes.list(); │ │ │ │ + for (auto const& n : m_nodes) │ │ │ │ + { │ │ │ │ +
    relevance 0../src/udp_tracker_connection.cpp:633why is this a linked list?

    why is this a linked list?

    ../src/udp_tracker_connection.cpp:633

    				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);
    │ │ │ │ +			}
    │ │ │ │ +		}
    │ │ │ │ +
    │ │ │ │ +
    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(); } ); │ │ │ │ + │ │ │ │ + cb->tracker_response(tracker_req(), m_target.address(), ip_list, resp); │ │ │ │ + │ │ │ │ + close(); │ │ │ │ + return true; │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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); │ │ │ │ + │ │ │ │ + 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) │ │ │ │ + { │ │ │ │ +
    relevance 0../src/cpuid.cpp:131enable when aarch64 is really tested

    enable when aarch64 is really tested

    ../src/cpuid.cpp:131

    	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
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	bool supports_arm_neon() noexcept
    │ │ │ │ +	{
    │ │ │ │ +#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 │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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 │ │ │ │ + } │ │ │ │ + │ │ │ │ +} // 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(); │ │ │ │ +} } │ │ │ │ +
    relevance 0../src/mmap_disk_io.cpp:578in the future, propagate exceptions back to the handlers

    in the future, propagate exceptions back to the handlers

    ../src/mmap_disk_io.cpp:578

    #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
    │ │ │ │ +
    │ │ │ │ +		std::shared_ptr<mmap_storage> storage = j->storage;
    │ │ │ │ +
    │ │ │ │ +		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 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&) │ │ │ │ + { │ │ │ │ + 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_stats_counters.inc_stats_counter(counters::num_running_disk_jobs, -1); │ │ │ │ + │ │ │ │ +
    relevance 0../src/mmap_disk_io.cpp:1017this 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

    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

    ../src/mmap_disk_io.cpp:1017

    		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../src/mmap_disk_io.cpp:1022Perhaps 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

    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

    ../src/mmap_disk_io.cpp:1022

    		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
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    add_fence_job(j); │ │ │ │ +
    } │ │ │ │ + │ │ │ │ + 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->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; │ │ │ │ + │ │ │ │ + DLOG("do_hash: reading (piece: %d block: %d)\n", int(j->piece), i); │ │ │ │ +
    relevance 0../src/magnet_uri.cpp:439what's the right number here?

    what's the right number here?

    ../src/magnet_uri.cpp:439

    			}
    │ │ │ │ +			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;
    │ │ │ │ +
    │ │ │ │ +				// 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;
    │ │ │ │ +
    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; │ │ │ │ + │ │ │ │ + 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; │ │ │ │ + │ │ │ │ + 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; │ │ │ │ + } │ │ │ │ + │ │ │ │ + if (int(p.file_priorities.size()) <= idx2) │ │ │ │ + p.file_priorities.resize(static_cast<std::size_t>(idx2) + 1, dont_download); │ │ │ │ + │ │ │ │ +
    relevance 0../src/alert.cpp:404move this field into tracker_alert

    move this field into tracker_alert

    ../src/alert.cpp:404

    │ │ │ │ +		return torrent_alert::message() + ": state changed to: "
    │ │ │ │ +			+ state_str[state];
    │ │ │ │ +#endif
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	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()); │ │ │ │ + } │ │ │ │ + │ │ │ │ + char const* tracker_error_alert::failure_reason() const │ │ │ │ + { │ │ │ │ + return m_alloc.get().ptr(m_msg_idx); │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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; │ │ │ │ +#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)) │ │ │ │ +#if TORRENT_ABI_VERSION == 1 │ │ │ │ +
    relevance 0../src/alert.cpp:438move this into tracker_alert

    move this into tracker_alert

    ../src/alert.cpp:438

    		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
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	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()); │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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 │ │ │ │ + return {}; │ │ │ │ +#else │ │ │ │ + return tracker_alert::message() + (version == protocol_version::V1 ? " v1" : " v2") + " warning: " + warning_message(); │ │ │ │ +#endif │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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) │ │ │ │ +
    relevance 0../src/alert.cpp:464move this into tracker_alert

    move this into tracker_alert

    ../src/alert.cpp:464

    	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
    │ │ │ │ +		return {};
    │ │ │ │ +#else
    │ │ │ │ +		return tracker_alert::message() + (version == protocol_version::V1 ? " v1" : " v2") + " warning: " + warning_message();
    │ │ │ │ +#endif
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	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) │ │ │ │ +
    { │ │ │ │ + TORRENT_ASSERT(!u.empty()); │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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 │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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 │ │ │ │ +
    relevance 0../src/alert.cpp:493move this into tracker_alert

    move this into tracker_alert

    ../src/alert.cpp:493

    		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
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	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()); │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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()); │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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 │ │ │ │ +
    relevance 0../src/alert.cpp:532move this field into tracker_alert

    move this field into tracker_alert

    ../src/alert.cpp:532

    	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
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	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()); │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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 │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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 {}; │ │ │ │ +#else │ │ │ │ +
    relevance 0../src/alert.cpp:576move this to tracker_alert

    move this to tracker_alert

    ../src/alert.cpp:576

    		, 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;
    │ │ │ │ +#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()); │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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 │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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)); │ │ │ │ + } │ │ │ │ + │ │ │ │ + std::string hash_failed_alert::message() const │ │ │ │ + { │ │ │ │ +#ifdef TORRENT_DISABLE_ALERT_MSG │ │ │ │ + return {}; │ │ │ │ +
    relevance 0../src/settings_pack.cpp:305deprecate this

    deprecate this

    ../src/settings_pack.cpp:305

    		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),
    │ │ │ │ +		SET(active_seeds, 5, &session_impl::trigger_auto_manage),
    │ │ │ │ +		SET(active_checking, 1, &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, &session_impl::trigger_auto_manage),
    │ │ │ │ +		DEPRECATED_SET(active_loaded_limit, 0, &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),
    │ │ │ │ +
    SET(max_rejects, 50, nullptr), │ │ │ │ +
    SET(recv_socket_buffer_size, 0, &session_impl::update_socket_buffer_size), │ │ │ │ + SET(send_socket_buffer_size, 0, &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, &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, &session_impl::update_upload_rate), │ │ │ │ + SET(download_rate_limit, 0, &session_impl::update_download_rate), │ │ │ │ + DEPRECATED_SET(local_upload_rate_limit, 0, &session_impl::update_local_upload_rate), │ │ │ │ + DEPRECATED_SET(local_download_rate_limit, 0, &session_impl::update_local_download_rate), │ │ │ │ + SET(dht_upload_rate_limit, 8000, &session_impl::update_dht_upload_rate_limit), │ │ │ │ + SET(unchoke_slots_limit, 8, &session_impl::update_unchoke_limit), │ │ │ │ + DEPRECATED_SET(half_open_limit, 0, nullptr), │ │ │ │ + SET(connections_limit, 200, &session_impl::update_connections_limit), │ │ │ │ + SET(connections_slack, 10, nullptr), │ │ │ │ + SET(utp_target_delay, 100, nullptr), │ │ │ │ + SET(utp_gain_factor, 3000, nullptr), │ │ │ │ +
    relevance 0../src/settings_pack.cpp:590it would be nice to reserve() these vectors up front

    it would be nice to reserve() these vectors up front

    ../src/settings_pack.cpp:590

    			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 < 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 < 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;
    │ │ │ │ +
    for (int i = 0; i < settings_pack::num_string_settings; ++i) │ │ │ │ +
    { │ │ │ │ + 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 < 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 < 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& sett │ │ │ │ + , aux::session_impl* ses) │ │ │ │ + { │ │ │ │ + using fun_t = void (aux::session_impl::*)(); │ │ │ │ + std::vector<fun_t> callbacks; │ │ │ │ + │ │ │ │ + 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 │ │ │ │ + // only once per callback │ │ │ │ +
    relevance 0../src/part_file.cpp:300what 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

    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

    ../src/part_file.cpp:300

    				create_directories(m_path, ec);
    │ │ │ │ +				if (ec) return {};
    │ │ │ │ +				return aux::file_handle(fn, 0, mode);
    │ │ │ │ +			}
    │ │ │ │ +			return {};
    │ │ │ │ +		}
    │ │ │ │ +	}
    │ │ │ │ +	catch (storage_error const& e)
    │ │ │ │ +	{
    │ │ │ │ +		ec = e.ec;
    │ │ │ │ +		return {};
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	void part_file::free_piece(piece_index_t const piece)
    │ │ │ │ +	{
    │ │ │ │ +		std::lock_guard<std::mutex> l(m_mutex);
    │ │ │ │ +
    │ │ │ │ +		auto const i = m_piece_map.find(piece);
    │ │ │ │ +		if (i == m_piece_map.end()) return;
    │ │ │ │ +
    │ │ │ │ +
    │ │ │ │ +
    m_free_slots.push_back(i->second); │ │ │ │ + m_piece_map.erase(i); │ │ │ │ + m_dirty_metadata = true; │ │ │ │ + } │ │ │ │ + │ │ │ │ + void part_file::move_partfile(std::string const& path, error_code& ec) │ │ │ │ + { │ │ │ │ + std::lock_guard<std::mutex> 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); │ │ │ │ + } │ │ │ │ + } │ │ │ │ +
    relevance 0../src/part_file.cpp:411instead of rebuilding the whole file header and flushing it, update the slot entries as we go

    instead of rebuilding the whole file header │ │ │ │ +and flushing it, update the slot entries as we go

    ../src/part_file.cpp:411

    						TORRENT_ASSERT(j->second == slot);
    │ │ │ │ +						m_free_slots.push_back(j->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& ec)
    │ │ │ │ +	{
    │ │ │ │ +		std::lock_guard<std::mutex> l(m_mutex);
    │ │ │ │ +
    │ │ │ │ +		flush_metadata_impl(ec);
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +
    void part_file::flush_metadata_impl(error_code& ec) │ │ │ │ +
    { │ │ │ │ + // 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<char> header(static_cast<std::size_t>(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 < piece_index_t(m_max_pieces); ++piece) │ │ │ │ + { │ │ │ │ + auto const i = m_piece_map.find(piece); │ │ │ │ +
    relevance 0../src/add_torrent_params.cpp:78pre 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::value , "should be nothrow move assignable");

    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::value │ │ │ │ , "should be nothrow move assignable");

    ../src/add_torrent_params.cpp:78

    			DECL_FLAG(sequential_download);
    │ │ │ │  			DECL_FLAG(pinned);
    │ │ │ │  			DECL_FLAG(stop_when_ready);
    │ │ │ │  			DECL_FLAG(override_trackers);
    │ │ │ │ @@ -6723,15 +7888,15 @@
    │ │ │ │  	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../src/add_torrent_params.cpp:84it would be nice if this was nothrow default constructible static_assert(std::is_nothrow_default_constructible::value , "should be nothrow default constructible");

    it would be nice if this was nothrow default constructible │ │ │ │ +

    relevance 0../src/add_torrent_params.cpp:84it would be nice if this was nothrow default constructible static_assert(std::is_nothrow_default_constructible::value , "should be nothrow default constructible");

    it would be nice if this was nothrow default constructible │ │ │ │ static_assert(std::is_nothrow_default_constructible::value │ │ │ │ , "should be nothrow default constructible");

    ../src/add_torrent_params.cpp:84

    			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);
    │ │ │ │ @@ -6758,47 +7923,246 @@
    │ │ │ │  	{
    │ │ │ │  		return !atp.have_pieces.empty()
    │ │ │ │  			|| (atp.flags & torrent_flags::seed_mode);
    │ │ │ │  	}
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │  }
    │ │ │ │ -
    relevance 0../src/session.cpp:540In C++17. use if constexpr instead

    In C++17. use if constexpr instead

    ../src/session.cpp:540

    	{}
    │ │ │ │ -	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()
    │ │ │ │ +
    relevance 0../src/load_torrent.cpp:121move the loading logic from torrent_info constructor into here

    move the loading logic from torrent_info constructor into here

    ../src/load_torrent.cpp:121

    				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();
    │ │ │ │ +	}
    │ │ │ │ +}
    │ │ │ │ +
    │ │ │ │ +	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{}); }
    │ │ │ │ +
    │ │ │ │ +
    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; │ │ │ │ + } │ │ │ │ + │ │ │ │ + add_torrent_params load_torrent_buffer(span<char const> buffer, load_torrent_limits const& cfg) │ │ │ │ { │ │ │ │ - if (m_thread && m_thread.use_count() == 1) │ │ │ │ + add_torrent_params ret; │ │ │ │ + ret.ti = std::make_shared<torrent_info>(buffer, cfg, from_span); │ │ │ │ + update_atp(ret); │ │ │ │ + return ret; │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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; │ │ │ │ + } │ │ │ │ + │ │ │ │ +} │ │ │ │ + │ │ │ │ +
    relevance 0../src/web_connection_base.cpp:72introduce a web-seed default class which has a low download priority

    introduce a web-seed default class which has a low download priority

    ../src/web_connection_base.cpp:72

    		: 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") │ │ │ │ { │ │ │ │ -#if defined TORRENT_ASIO_DEBUGGING │ │ │ │ - wait_for_asio_handlers(); │ │ │ │ -#endif │ │ │ │ - m_thread->join(); │ │ │ │ + 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); │ │ │ │ } │ │ │ │ │ │ │ │ - TORRENT_EXPORT std::unique_ptr<disk_interface> default_disk_io_constructor( │ │ │ │ - io_context& ios, settings_interface const& sett, counters& cnt) │ │ │ │ + int web_connection_base::timeout() const │ │ │ │ { │ │ │ │ -#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); │ │ │ │ + // since this is a web seed, change the timeout │ │ │ │ + // according to the settings. │ │ │ │ + return m_settings.get_int(settings_pack::urlseed_timeout); │ │ │ │ + } │ │ │ │ +
    relevance 0../src/pe_crypto.cpp:60it would be nice to get the literal working

    it would be nice to get the literal working

    ../src/pe_crypto.cpp:60

    #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"
    │ │ │ │ -#else
    │ │ │ │ -		return posix_disk_io_constructor(ios, sett, cnt);
    │ │ │ │ +
    │ │ │ │ +#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 │ │ │ │ +
    ("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63A36210000000000090563"); │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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); │ │ │ │ + │ │ │ │ +
    relevance 0../src/pe_crypto.cpp:71it would be nice to be able to export to a fixed width field, so we wouldn't have to shift it later

    it would be nice to be able to export to a fixed width field, so │ │ │ │ +we wouldn't have to shift it later

    ../src/pe_crypto.cpp:71

    #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
    │ │ │ │ +			("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63A36210000000000090563");
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +	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);
    │ │ │ │ +
    │ │ │ │ +
    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 │ │ │ │ #endif │ │ │ │ + std::memset(begin, 0, aux::numeric_cast<std::size_t>(96 - len)); │ │ │ │ + } │ │ │ │ + return ret; │ │ │ │ } │ │ │ │ │ │ │ │ -} │ │ │ │ -
    relevance 0../src/enum_net.cpp:144in C++17, use __has_include for this. Other operating systems are likely to require this as well

    in C++17, use __has_include for this. Other operating systems are │ │ │ │ + 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_dh_local_key = mp::powm(key_t(2), m_dh_local_secret, dh_prime); │ │ │ │ +relevance 0../src/ut_metadata.cpp:281we really need to increment the refcounter on the torrent while this buffer is still in the peer's send buffer

    we really need to increment the refcounter on the torrent │ │ │ │ +while this buffer is still in the peer's send buffer

    ../src/ut_metadata.cpp:281

    				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_pc.send_buffer({msg, len + 6});
    │ │ │ │ +
    if (metadata_piece_size) │ │ │ │ +
    { │ │ │ │ + m_pc.append_const_send_buffer( │ │ │ │ + span<char>(const_cast<char*>(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<char const> body) override │ │ │ │ + { │ │ │ │ + if (extended_msg != 2) return false; │ │ │ │ + if (m_message_index == 0) return false; │ │ │ │ + │ │ │ │ + if (length > 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) │ │ │ │ +
    relevance 0../src/enum_net.cpp:144in C++17, use __has_include for this. Other operating systems are likely to require this as well

    in C++17, use __has_include for this. Other operating systems are │ │ │ │ likely to require this as well

    ../src/enum_net.cpp:144

    #include <arpa/inet.h>
    │ │ │ │  #include <cstring>
    │ │ │ │  #include <cstdlib>
    │ │ │ │  #include <unistd.h>
    │ │ │ │  #include <sys/types.h>
    │ │ │ │  
    │ │ │ │  #if defined TORRENT_ANDROID && !defined IFA_F_DADFAILED
    │ │ │ │ @@ -6842,15 +8206,15 @@
    │ │ │ │  		~socket_closer() { ::close(m_socket); }
    │ │ │ │  	private:
    │ │ │ │  		int m_socket;
    │ │ │ │  	};
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  #if !defined TORRENT_BUILD_SIMULATOR
    │ │ │ │ -
    relevance 0../src/enum_net.cpp:268if we get here, the caller still assumes the error code is reported via errno

    if we get here, the caller still assumes the error code │ │ │ │ +relevance 0../src/enum_net.cpp:268if we get here, the caller still assumes the error code is reported via errno

    if we get here, the caller still assumes the error code │ │ │ │ is reported via errno

    ../src/enum_net.cpp:268

    		;
    │ │ │ │  	}
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  #if TORRENT_USE_NETLINK
    │ │ │ │  
    │ │ │ │  	int read_nl_sock(int sock, std::uint32_t const seq, std::uint32_t const pid
    │ │ │ │ @@ -6867,15 +8231,15 @@
    │ │ │ │  
    │ │ │ │  			for (; len > 0 && 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->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 │ │ │ │ -
    relevance 0../src/enum_net.cpp:274if we get here, the caller still assumes the error code is reported via errno

    if we get here, the caller still assumes the error code │ │ │ │ +relevance 0../src/enum_net.cpp:274if we get here, the caller still assumes the error code is reported via errno

    if we get here, the caller still assumes the error code │ │ │ │ is reported via errno

    ../src/enum_net.cpp:274

    #if TORRENT_USE_NETLINK
    │ │ │ │  
    │ │ │ │  	int read_nl_sock(int sock, std::uint32_t const seq, std::uint32_t const pid
    │ │ │ │  		, std::function<void(nlmsghdr const*)> on_msg)
    │ │ │ │  	{
    │ │ │ │  		std::array<char, 4096> buf;
    │ │ │ │  		for (;;)
    │ │ │ │ @@ -6919,274 +8283,498 @@
    │ │ │ │  			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<sockaddr*>(&sock_addr), &sock_addr_len) < 0)
    │ │ │ │  			return -1;
    │ │ │ │ -
    relevance 0../src/web_connection_base.cpp:72introduce a web-seed default class which has a low download priority

    introduce a web-seed default class which has a low download priority

    ../src/web_connection_base.cpp:72

    		: 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);
    │ │ │ │ +
    relevance 0../src/torrent.cpp:1951this could be optimized by looking up which files are complete and just look at those

    this could be optimized by looking up which files are │ │ │ │ +complete and just look at those

    ../src/torrent.cpp:1951

    //				TORRENT_ASSERT(picker().have_piece(i));
    │ │ │ │ +				we_have(i);
    │ │ │ │ +			}
    │ │ │ │ +		}
    │ │ │ │  
    │ │ │ │ -		INVARIANT_CHECK;
    │ │ │ │ +		set_state(torrent_status::checking_resume_data);
    │ │ │ │  
    │ │ │ │ -		TORRENT_ASSERT(is_outgoing());
    │ │ │ │ +		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);
    │ │ │ │  
    │ │ │ │ -		TORRENT_ASSERT(!m_torrent.lock()->is_upload_only());
    │ │ │ │ +			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;
    │ │ │ │  
    │ │ │ │ -		// 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); │ │ │ │ + // 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); │ │ │ │ │ │ │ │ - if (m_port == -1 && protocol == "http") │ │ │ │ - m_port = 80; │ │ │ │ + for (auto const& t : ts) │ │ │ │ + { │ │ │ │ + // Only attempt to reuse files from torrents that are seeding. │ │ │ │ +
    relevance 0../src/torrent.cpp:1964this could be optimized by looking up which files are complete and just look at those

    this could be optimized by looking up which files are │ │ │ │ +complete and just look at those

    ../src/torrent.cpp:1964

    		{
    │ │ │ │ +			resolve_links res(m_torrent_file);
    │ │ │ │  
    │ │ │ │ -#if TORRENT_USE_SSL
    │ │ │ │ -		if (protocol == "https")
    │ │ │ │ -		{
    │ │ │ │ -			m_ssl = true;
    │ │ │ │ -			if (m_port == -1) m_port = 443;
    │ │ │ │ +			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)
    │ │ │ │ +				{
    │ │ │ │ +					// Only attempt to reuse files from torrents that are seeding.
    │ │ │ │ +
    if (!t->is_seed()) continue; │ │ │ │ +
    │ │ │ │ + res.match(t->get_torrent_file(), t->save_path()); │ │ │ │ + } │ │ │ │ + } │ │ │ │ + │ │ │ │ + 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) │ │ │ │ + { │ │ │ │ + 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_basic_auth.empty()) │ │ │ │ - m_basic_auth = base64encode(m_basic_auth); │ │ │ │ + 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) │ │ │ │ + { self->on_resume_data_checked(st, error); }); │ │ │ │ +
    relevance 0../src/torrent.cpp:2728this pattern is repeated in a few places. Factor this into a function and generalize the concept of a torrent having a dedicated listen port

    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

    ../src/torrent.cpp:2728

    		// not ready for peers. Except, if we don't have metadata,
    │ │ │ │ +		// we need peers to download from
    │ │ │ │ +		if (!m_files_checked && valid_metadata()) return;
    │ │ │ │  
    │ │ │ │ -		m_server_string = m_host;
    │ │ │ │ -		aux::verify_encoding(m_server_string);
    │ │ │ │ -	}
    │ │ │ │ +		if (!m_announce_to_lsd) return;
    │ │ │ │  
    │ │ │ │ -	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);
    │ │ │ │ -	}
    │ │ │ │ -
    relevance 0../src/performance_counters.cpp:40move stats_counter_t out of counters

    move stats_counter_t out of counters

    ../src/performance_counters.cpp:40

    relevance 0../src/performance_counters.cpp:41should bittorrent keep-alive messages have a counter too?

    should bittorrent keep-alive messages have a counter too?

    ../src/performance_counters.cpp:41

    relevance 0../src/performance_counters.cpp:42It would be nice if this could be an internal type. default_disk_constructor depends on it now

    It would be nice if this could be an internal type. default_disk_constructor depends on it now

    ../src/performance_counters.cpp:42

    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.
    │ │ │ │ +		// private torrents are never announced on LSD
    │ │ │ │ +		if (m_torrent_file->is_valid() && m_torrent_file->priv()) return;
    │ │ │ │  
    │ │ │ │ -*/
    │ │ │ │ +#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
    │ │ │ │  
    │ │ │ │ -#include "libtorrent/performance_counters.hpp"
    │ │ │ │ -#include "libtorrent/assert.hpp"
    │ │ │ │ -#include <cstring> // for memset
    │ │ │ │ +		if (is_paused()) return;
    │ │ │ │  
    │ │ │ │ -namespace libtorrent {
    │ │ │ │ +		if (!m_ses.has_lsd()) return;
    │ │ │ │  
    │ │ │ │ -
    counters::counters() TORRENT_COUNTER_NOEXCEPT │ │ │ │ -
    { │ │ │ │ -#ifdef ATOMIC_LLONG_LOCK_FREE │ │ │ │ - for (auto& counter : m_stats_counter) │ │ │ │ - counter.store(0, std::memory_order_relaxed); │ │ │ │ +
    #ifdef TORRENT_SSL_PEERS │ │ │ │ +
    int port = is_ssl_torrent() ? m_ses.ssl_listen_port() : m_ses.listen_port(); │ │ │ │ #else │ │ │ │ - m_stats_counter.fill(0); │ │ │ │ + int port = m_ses.listen_port(); │ │ │ │ #endif │ │ │ │ + │ │ │ │ + // 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); │ │ │ │ + }); │ │ │ │ } │ │ │ │ │ │ │ │ - counters::counters(counters const& c) TORRENT_COUNTER_NOEXCEPT │ │ │ │ +#ifndef TORRENT_DISABLE_DHT │ │ │ │ + │ │ │ │ + void torrent::dht_announce() │ │ │ │ { │ │ │ │ -#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; │ │ │ │ + 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()) │ │ │ │ + { │ │ │ │ +#if TORRENT_USE_I2P │ │ │ │ +
    relevance 0../src/torrent.cpp:3885add one peer per IP the hostname resolves to

    add one peer per IP the hostname resolves to

    ../src/torrent.cpp:3885

    	catch (...) { handle_exception(); }
    │ │ │ │  #endif
    │ │ │ │ -	}
    │ │ │ │  
    │ │ │ │ -	counters& counters::operator=(counters const& c) & TORRENT_COUNTER_NOEXCEPT
    │ │ │ │ +	void torrent::on_peer_name_lookup(error_code const& e
    │ │ │ │ +		, std::vector<address> const& host_list, int const port
    │ │ │ │ +		, protocol_version const v) try
    │ │ │ │  	{
    │ │ │ │ -		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)
    │ │ │ │ -					, std::memory_order_relaxed);
    │ │ │ │ -
    relevance 0../src/torrent_handle.cpp:589support moving files into this call

    support moving files into this call

    ../src/torrent_handle.cpp:589

    		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;
    │ │ │ │ -	}
    │ │ │ │ +		TORRENT_ASSERT(is_single_thread());
    │ │ │ │ +
    │ │ │ │ +		INVARIANT_CHECK;
    │ │ │ │ +
    │ │ │ │ +		COMPLETE_ASYNC("torrent::on_peer_name_lookup");
    │ │ │ │ +
    │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │ +		if (e && should_log())
    │ │ │ │ +			debug_log("peer name lookup error: %s", e.message().c_str());
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │ -	void torrent_handle::file_priority(file_index_t index, download_priority_t priority) const
    │ │ │ │ -	{
    │ │ │ │ -		async_call(&torrent::set_file_priority, index, priority);
    │ │ │ │ -	}
    │ │ │ │ +		if (e || m_abort || host_list.empty() || m_ses.is_aborted()) return;
    │ │ │ │  
    │ │ │ │ -	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);
    │ │ │ │ -	}
    │ │ │ │ +
    tcp::endpoint host(host_list.front(), std::uint16_t(port)); │ │ │ │ +
    │ │ │ │ + if (m_ip_filter && m_ip_filter->access(host.address()) & ip_filter::blocked) │ │ │ │ + { │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ + if (should_log()) │ │ │ │ + { │ │ │ │ + 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; │ │ │ │ + } │ │ │ │ │ │ │ │ -
    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)); │ │ │ │ - } │ │ │ │ + if (add_peer(host, peer_info::tracker, v == protocol_version::V2 ? pex_lt_v2 : pex_flags_t(0))) │ │ │ │ + { │ │ │ │ + state_updated(); │ │ │ │ │ │ │ │ - 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); │ │ │ │ +#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); │ │ │ │ + } │ │ │ │ +#endif │ │ │ │ + } │ │ │ │ + update_want_peers(); │ │ │ │ } │ │ │ │ +
    relevance 0../src/torrent.cpp:4581only do this if the piece size > 1 blocks This is a v2 torrent so we can request get block level hashes.

    only do this if the piece size > 1 blocks │ │ │ │ +This is a v2 torrent so we can request get block │ │ │ │ +level hashes.

    ../src/torrent.cpp:4581

    		{
    │ │ │ │ +			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;
    │ │ │ │ +		}();
    │ │ │ │  
    │ │ │ │ -#if TORRENT_ABI_VERSION == 1
    │ │ │ │ +		// 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);
    │ │ │ │  
    │ │ │ │ -// ============ start deprecation ===============
    │ │ │ │ +		if (!torrent_file().info_hashes().has_v1() && blocks.empty() && !found_on_disk)
    │ │ │ │ +		{
    │ │ │ │ +
    verify_block_hashes(index); │ │ │ │ +
    } │ │ │ │ │ │ │ │ - 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))); │ │ │ │ + // 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); │ │ │ │ } │ │ │ │ - async_call(&torrent::prioritize_files, file_prio); │ │ │ │ - } │ │ │ │ │ │ │ │ - std::vector<int> torrent_handle::file_priorities() const │ │ │ │ - { │ │ │ │ - aux::vector<download_priority_t, file_index_t> prio; │ │ │ │ -
    relevance 0../src/posix_part_file.cpp:337what 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

    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

    ../src/posix_part_file.cpp:337

    │ │ │ │ -			if (ec) return {};
    │ │ │ │ +		// 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
    │ │ │ │ +
    relevance 0../src/torrent.cpp:7525come up with a better way of doing this, instead of an immediately invoked lambda expression.

    come up with a better way of doing this, instead of an │ │ │ │ +immediately invoked lambda expression.

    ../src/torrent.cpp:7525

    					|| peerinfo->confirmed_supports_utp))
    │ │ │ │ +			{
    │ │ │ │ +				sm = m_ses.utp_socket_manager();
    │ │ │ │ +			}
    │ │ │ │  
    │ │ │ │ -#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+"));
    │ │ │ │ +			// 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
    │ │ │ │ -			if (ret.file() == nullptr)
    │ │ │ │ -				ec.assign(errno, generic_category());
    │ │ │ │ +				return false;
    │ │ │ │ +			}
    │ │ │ │  		}
    │ │ │ │ -		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;
    │ │ │ │ +
    aux::socket_type s = [&] { │ │ │ │ +
    │ │ │ │ +#if TORRENT_USE_I2P │ │ │ │ + if (peerinfo->is_i2p_addr) │ │ │ │ + { │ │ │ │ + // 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. │ │ │ │ │ │ │ │ -
    │ │ │ │ -
    m_free_slots.push_back(i->second); │ │ │ │ - m_piece_map.erase(i); │ │ │ │ - m_dirty_metadata = true; │ │ │ │ + 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; │ │ │ │ + } │ │ │ │ + else │ │ │ │ +#endif │ │ │ │ + { │ │ │ │ + void* userdata = nullptr; │ │ │ │ +#ifdef TORRENT_SSL_PEERS │ │ │ │ + if (is_ssl_torrent()) │ │ │ │ + { │ │ │ │ +
    relevance 0../src/torrent.cpp:9118perhaps 0 should actually mean 0

    perhaps 0 should actually mean 0

    ../src/torrent.cpp:9118

    		// 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;
    │ │ │ │ +
    │ │ │ │ +		TORRENT_ASSERT(p >= no_pos);
    │ │ │ │ +
    │ │ │ │ +		state_updated();
    │ │ │ │ +
    │ │ │ │ +		m_ses.set_queue_position(this, p);
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ -	void posix_part_file::move_partfile(std::string const& path, error_code& ec)
    │ │ │ │ +	void torrent::set_max_uploads(int limit, bool const state_update)
    │ │ │ │  	{
    │ │ │ │ -		flush_metadata_impl(ec);
    │ │ │ │ -		if (ec) return;
    │ │ │ │ +		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 (!m_piece_map.empty()) │ │ │ │ - { │ │ │ │ - std::string old_path = combine_path(m_path, m_name); │ │ │ │ - std::string new_path = combine_path(path, m_name); │ │ │ │ + if (state_update) │ │ │ │ + set_need_save_resume(torrent_handle::if_config_changed); │ │ │ │ + } │ │ │ │ │ │ │ │ - rename(old_path, new_path, ec); │ │ │ │ - if (ec == boost::system::errc::no_such_file_or_directory) │ │ │ │ - ec.clear(); │ │ │ │ + void torrent::set_max_connections(int limit, bool const state_update) │ │ │ │ + { │ │ │ │ + TORRENT_ASSERT(is_single_thread()); │ │ │ │ +
    relevance 0../src/torrent.cpp:9135perhaps 0 should actually mean 0

    perhaps 0 should actually mean 0

    ../src/torrent.cpp:9135

    │ │ │ │ +	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
    │ │ │ │  
    │ │ │ │ -			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;
    │ │ │ │ +		if (state_update)
    │ │ │ │ +			set_need_save_resume(torrent_handle::if_config_changed);
    │ │ │ │  	}
    │ │ │ │ -
    relevance 0../src/posix_part_file.cpp:424instead of rebuilding the whole file header and flushing it, update the slot entries as we go

    instead of rebuilding the whole file header │ │ │ │ -and flushing it, update the slot entries as we go

    ../src/posix_part_file.cpp:424

    				}
    │ │ │ │ -				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;
    │ │ │ │ +	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(); │ │ │ │ │ │ │ │ - f(file_offset, {buf.get(), block_to_copy}); │ │ │ │ - } │ │ │ │ - file_offset += block_to_copy; │ │ │ │ - piece_offset = 0; │ │ │ │ - size -= block_to_copy; │ │ │ │ +#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)) │ │ │ │ + { │ │ │ │ + disconnect_peers(num_peers() - m_max_connections │ │ │ │ + , errors::too_many_connections); │ │ │ │ } │ │ │ │ + │ │ │ │ + if (state_update) │ │ │ │ + set_need_save_resume(torrent_handle::if_config_changed); │ │ │ │ } │ │ │ │ │ │ │ │ - void posix_part_file::flush_metadata(error_code& ec) │ │ │ │ + void torrent::set_upload_limit(int const limit) │ │ │ │ { │ │ │ │ - flush_metadata_impl(ec); │ │ │ │ + set_limit_impl(limit, peer_connection::upload_channel); │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ + debug_log("*** set-upload-limit: %d", limit); │ │ │ │ +#endif │ │ │ │ } │ │ │ │ │ │ │ │ -
    void posix_part_file::flush_metadata_impl(error_code& ec) │ │ │ │ -
    { │ │ │ │ - // do we need to flush the metadata? │ │ │ │ - if (m_dirty_metadata == false) return; │ │ │ │ + void torrent::set_download_limit(int const limit) │ │ │ │ + { │ │ │ │ +
    relevance 0../src/torrent.cpp:11061instead of resorting the whole list, insert the peers directly into the right place

    instead of resorting the whole list, insert the peers │ │ │ │ +directly into the right place

    ../src/torrent.cpp:11061

    				std::printf("timed out [average-piece-time: %d ms ]\n"
    │ │ │ │ +					, m_average_piece_time);
    │ │ │ │ +#endif
    │ │ │ │ +			}
    │ │ │ │  
    │ │ │ │ -		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);
    │ │ │ │ +			// 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);
    │ │ │ │  
    │ │ │ │ -			if (ec == boost::system::errc::no_such_file_or_directory)
    │ │ │ │ -				ec.clear();
    │ │ │ │ -			return;
    │ │ │ │ -		}
    │ │ │ │ +			// put back the peers we ignored into the peer list for the next piece
    │ │ │ │ +			if (!ignore_peers.empty())
    │ │ │ │ +			{
    │ │ │ │ +				peers.insert(peers.begin(), ignore_peers.begin(), ignore_peers.end());
    │ │ │ │ +				ignore_peers.clear();
    │ │ │ │  
    │ │ │ │ -		auto f = open_file(open_mode::read_write, ec);
    │ │ │ │ -		if (ec) return;
    │ │ │ │ +
    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); }); │ │ │ │ + } │ │ │ │ │ │ │ │ - std::vector<char> header(static_cast<std::size_t>(m_header_size)); │ │ │ │ + // 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; │ │ │ │ + } │ │ │ │ │ │ │ │ - using namespace libtorrent::aux; │ │ │ │ + // commit all the time critical requests │ │ │ │ + for (auto p : peers_with_requests) │ │ │ │ + { │ │ │ │ + p->send_block_requests(); │ │ │ │ + } │ │ │ │ + } │ │ │ │ +#endif // TORRENT_DISABLE_STREAMING │ │ │ │ │ │ │ │ - char* ptr = header.data(); │ │ │ │ - write_uint32(m_max_pieces, ptr); │ │ │ │ - write_uint32(m_piece_size, ptr); │ │ │ │ + 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); │ │ │ │ + } │ │ │ │ + return ret; │ │ │ │ +
    relevance 0../src/random.cpp:141improve calling RAND_bytes multiple times, using fallback for now

    improve calling RAND_bytes multiple times, using fallback for now

    ../src/random.cpp:141

    #else
    │ │ │ │ +			std::generate(buffer.begin(), buffer.end(), [] { return char(random(0xff)); });
    │ │ │ │ +#endif
    │ │ │ │ +		}
    │ │ │ │  
    │ │ │ │ -		for (piece_index_t piece(0); piece < piece_index_t(m_max_pieces); ++piece)
    │ │ │ │ +		void crypto_random_bytes(span<char> buffer)
    │ │ │ │  		{
    │ │ │ │ -			auto const i = m_piece_map.find(piece);
    │ │ │ │ -
    relevance 0../src/session_impl.cpp:615come up with some abstraction to do this for gnutls as well load certificates from the windows system certificate store

    come up with some abstraction to do this for gnutls as well │ │ │ │ +#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../src/session_impl.cpp:615come up with some abstraction to do this for gnutls as well load certificates from the windows system certificate store

    come up with some abstraction to do this for gnutls as well │ │ │ │ load certificates from the windows system certificate store

    ../src/session_impl.cpp:615

    		pause();
    │ │ │ │  	}
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  	// This function is called by the creating thread, not in the message loop's
    │ │ │ │  	// io_context thread.
    │ │ │ │  	void session_impl::start_session()
    │ │ │ │ @@ -7230,15 +8818,15 @@
    │ │ │ │  #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
    │ │ │ │ -
    relevance 0../src/session_impl.cpp:1484it would be nice to reserve() these vectors up front

    it would be nice to reserve() these vectors up front

    ../src/session_impl.cpp:1484

    			bandwidth_channel* ch = &p->channel[peer_connection::download_channel];
    │ │ │ │ +
    relevance 0../src/session_impl.cpp:1484it would be nice to reserve() these vectors up front

    it would be nice to reserve() these vectors up front

    ../src/session_impl.cpp:1484

    			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;
    │ │ │ │  		}
    │ │ │ │  		return ret;
    │ │ │ │ @@ -7281,15 +8869,15 @@
    │ │ │ │  	bool get_setting_impl(Pack const& p, int name, bool*)
    │ │ │ │  	{ return p.get_bool(name); }
    │ │ │ │  
    │ │ │ │  	template <typename Pack>
    │ │ │ │  	std::string get_setting_impl(Pack const& p, int name, std::string*)
    │ │ │ │  	{ return p.get_str(name); }
    │ │ │ │  
    │ │ │ │ -
    relevance 0../src/session_impl.cpp:1998could 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

    could this function be merged with expand_unspecified_addresses? │ │ │ │ +relevance 0../src/session_impl.cpp:1998could 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

    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

    ../src/session_impl.cpp:1998

    		session_log("FATAL SESSION ERROR (%s : %d) [%s]"
    │ │ │ │  			, ec.category().name(), ec.value(), ec.message().c_str());
    │ │ │ │  #endif
    │ │ │ │  		this->abort();
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ @@ -7334,15 +8922,15 @@
    │ │ │ │  				// (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);
    │ │ │ │ -
    relevance 0../src/session_impl.cpp:2306it 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

    it would probably be better to do this by having a │ │ │ │ +relevance 0../src/session_impl.cpp:2306it 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

    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

    ../src/session_impl.cpp:2306

    		{
    │ │ │ │  			for (auto const& s : m_listen_sockets)
    │ │ │ │  				remap_ports(remap_natpmp_and_upnp, *s);
    │ │ │ │  		}
    │ │ │ │ @@ -7389,15 +8977,15 @@
    │ │ │ │  			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& s)
    │ │ │ │ -
    relevance 0../src/session_impl.cpp:2866this size need to be capped

    this size need to be capped

    ../src/session_impl.cpp:2866

    				// handshaking
    │ │ │ │ +
    relevance 0../src/session_impl.cpp:2866this size need to be capped

    this size need to be capped

    ../src/session_impl.cpp:2866

    				// handshaking
    │ │ │ │  				return socket_type(ssl_stream<tcp::socket>(tcp::socket(std::move(s)), m_peer_ssl_ctx));
    │ │ │ │  			}
    │ │ │ │  			else
    │ │ │ │  #endif
    │ │ │ │  			{
    │ │ │ │  				return socket_type(tcp::socket(std::move(s)));
    │ │ │ │  			}
    │ │ │ │ @@ -7433,15 +9021,15 @@
    │ │ │ │  
    │ │ │ │  	void session_impl::on_incoming_utp_ssl(socket_type s)
    │ │ │ │  	{
    │ │ │ │  		TORRENT_ASSERT(is_ssl(s));
    │ │ │ │  
    │ │ │ │  		// save the socket so we can cancel the handshake
    │ │ │ │  
    │ │ │ │ -
    relevance 0../src/session_impl.cpp:2891this size need to be capped

    this size need to be capped

    ../src/session_impl.cpp:2891

    			// after the handshake is done
    │ │ │ │ +
    relevance 0../src/session_impl.cpp:2891this size need to be capped

    this size need to be capped

    ../src/session_impl.cpp:2891

    			// 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
    │ │ │ │  		{
    │ │ │ │ @@ -7484,15 +9072,15 @@
    │ │ │ │  		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;
    │ │ │ │ -
    relevance 0../src/session_impl.cpp:3590have a separate list for these connections, instead of having to loop through all of them

    have a separate list for these connections, instead of having to loop through all of them

    ../src/session_impl.cpp:3590

    		// --------------------------------------------------------------
    │ │ │ │ +
    relevance 0../src/session_impl.cpp:3590have a separate list for these connections, instead of having to loop through all of them

    have a separate list for these connections, instead of having to loop through all of them

    ../src/session_impl.cpp:3590

    		// --------------------------------------------------------------
    │ │ │ │  		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();
    │ │ │ │  		}
    │ │ │ │  
    │ │ │ │ @@ -7535,15 +9123,15 @@
    │ │ │ │  
    │ │ │ │  			// 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;
    │ │ │ │  		}
    │ │ │ │ -
    relevance 0../src/session_impl.cpp:3623this should apply to all bandwidth channels

    this should apply to all bandwidth channels

    ../src/session_impl.cpp:3623

    #if TORRENT_DEBUG_STREAMING > 0
    │ │ │ │ +
    relevance 0../src/session_impl.cpp:3623this should apply to all bandwidth channels

    this should apply to all bandwidth channels

    ../src/session_impl.cpp:3623

    #if TORRENT_DEBUG_STREAMING > 0
    │ │ │ │  		std::printf("\033[2J\033[0;0H");
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  		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];
    │ │ │ │ @@ -7586,15 +9174,15 @@
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  		m_stat.second_tick(tick_interval_ms);
    │ │ │ │  
    │ │ │ │  		// --------------------------------------------------------------
    │ │ │ │  		// scrape paused torrents that are auto managed
    │ │ │ │  		// (unless the session is paused)
    │ │ │ │ -
    relevance 0../src/session_impl.cpp:4314use 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

    use a lower limit than m_settings.connections_limit │ │ │ │ +relevance 0../src/session_impl.cpp:4314use 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

    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

    ../src/session_impl.cpp:4314

    		// 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)
    │ │ │ │  		{
    │ │ │ │ @@ -7640,15 +9228,15 @@
    │ │ │ │  
    │ │ │ │  			if (m_next_finished_connect_torrent >= 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())
    │ │ │ │ -
    relevance 0../src/session_impl.cpp:4459post a message to have this happen immediately instead of waiting for the next tick

    post a message to have this happen │ │ │ │ +relevance 0../src/session_impl.cpp:4459post a message to have this happen immediately instead of waiting for the next tick

    post a message to have this happen │ │ │ │ immediately instead of waiting for the next tick

    ../src/session_impl.cpp:4459

    				continue;
    │ │ │ │  			}
    │ │ │ │  
    │ │ │ │  			if (!p->is_peer_interested()
    │ │ │ │  				|| p->is_disconnecting()
    │ │ │ │  				|| p->is_connecting())
    │ │ │ │  			{
    │ │ │ │ @@ -7692,15 +9280,15 @@
    │ │ │ │  		if (should_log())
    │ │ │ │  		{
    │ │ │ │  			session_log("RECALCULATE UNCHOKE SLOTS: [ peers: %d "
    │ │ │ │  				"eligible-peers: %d"
    │ │ │ │  				" allowed-slots: %d ]"
    │ │ │ │  				, int(m_connections.size())
    │ │ │ │  				, int(peers.size())
    │ │ │ │ -
    relevance 0../src/session_impl.cpp:4786it 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.

    it might be a nice feature here to limit the number of torrents │ │ │ │ +relevance 0../src/session_impl.cpp:4786it 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.

    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.

    ../src/session_impl.cpp:4786

    			t->status(&st, flags);
    │ │ │ │  		}
    │ │ │ │  	}
    │ │ │ │ @@ -7748,15 +9336,15 @@
    │ │ │ │  			m_posted_stats_header = true;
    │ │ │ │  			m_alerts.emplace_alert<session_stats_header_alert>();
    │ │ │ │  		}
    │ │ │ │  		m_disk_thread->update_stats_counters(m_stats_counters);
    │ │ │ │  
    │ │ │ │  #ifndef TORRENT_DISABLE_DHT
    │ │ │ │  		if (m_dht)
    │ │ │ │ -
    relevance 0../src/session_impl.cpp:5161factor out this logic into a separate function for unit testing

    factor out this logic into a separate function for unit │ │ │ │ +relevance 0../src/session_impl.cpp:5161factor out this logic into a separate function for unit testing

    factor out this logic into a separate function for unit │ │ │ │ testing

    ../src/session_impl.cpp:5161

    		if (m_settings.get_int(settings_pack::outgoing_port) > 0)
    │ │ │ │  		{
    │ │ │ │  #ifdef TORRENT_WINDOWS
    │ │ │ │  			s.set_option(exclusive_address_use(true), ec);
    │ │ │ │  #else
    │ │ │ │  			s.set_option(tcp::acceptor::reuse_address(true), ec);
    │ │ │ │  #endif
    │ │ │ │ @@ -7800,15 +9388,15 @@
    │ │ │ │  
    │ │ │ │  				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;
    │ │ │ │  				}
    │ │ │ │ -
    relevance 0../src/session_impl.cpp:5880refactor, move the storage to dht_tracker

    refactor, move the storage to dht_tracker

    ../src/session_impl.cpp:5880

    #ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │ +
    relevance 0../src/session_impl.cpp:5880refactor, move the storage to dht_tracker

    refactor, move the storage to dht_tracker

    ../src/session_impl.cpp:5880

    #ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │  			session_log("not starting DHT, outstanding router lookups: %d"
    │ │ │ │  				, m_outstanding_router_lookups);
    │ │ │ │  #endif
    │ │ │ │  			return;
    │ │ │ │  		}
    │ │ │ │  
    │ │ │ │  		if (m_abort)
    │ │ │ │ @@ -7851,15 +9439,15 @@
    │ │ │ │  		for (auto const& n : m_dht_router_nodes)
    │ │ │ │  		{
    │ │ │ │  			m_dht->add_router_node(n);
    │ │ │ │  		}
    │ │ │ │  
    │ │ │ │  		for (auto const& n : m_dht_nodes)
    │ │ │ │  		{
    │ │ │ │ -
    relevance 0../src/session_impl.cpp:6267asserts that no outstanding async operations are still in flight

    asserts that no outstanding async operations are still in flight

    ../src/session_impl.cpp:6267

    		if (!m_dht) return;
    │ │ │ │ +
    relevance 0../src/session_impl.cpp:6267asserts that no outstanding async operations are still in flight

    asserts that no outstanding async operations are still in flight

    ../src/session_impl.cpp:6267

    		if (!m_dht) return;
    │ │ │ │  		m_dht->direct_request(ep, e, std::bind(&on_direct_response, std::ref(m_alerts), userdata, _1));
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  	bool session_impl::is_listening() const
    │ │ │ │  	{
    │ │ │ │ @@ -7902,903 +9490,15 @@
    │ │ │ │  			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.context_switches
    │ │ │ │ -
    relevance 0../src/load_torrent.cpp:121move the loading logic from torrent_info constructor into here

    move the loading logic from torrent_info constructor into here

    ../src/load_torrent.cpp:121

    				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();
    │ │ │ │ -	}
    │ │ │ │ -}
    │ │ │ │ -
    │ │ │ │ -	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{}); }
    │ │ │ │ -
    │ │ │ │ -
    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; │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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; │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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; │ │ │ │ - } │ │ │ │ - │ │ │ │ -} │ │ │ │ - │ │ │ │ -
    relevance 0../src/cpuid.cpp:131enable when aarch64 is really tested

    enable when aarch64 is really tested

    ../src/cpuid.cpp:131

    	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
    │ │ │ │ -	}
    │ │ │ │ -
    │ │ │ │ -	bool supports_arm_neon() noexcept
    │ │ │ │ -	{
    │ │ │ │ -#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 │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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 │ │ │ │ - } │ │ │ │ - │ │ │ │ -} // 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(); │ │ │ │ -} } │ │ │ │ -
    relevance 0../src/torrent_info.cpp:887this should be considered a failure, and the .torrent file rejected

    this should be considered a failure, and the .torrent file │ │ │ │ -rejected

    ../src/torrent_info.cpp:887

    			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;
    │ │ │ │ -
    │ │ │ │ -				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) │ │ │ │ - { │ │ │ │ - INVARIANT_CHECK; │ │ │ │ - │ │ │ │ - 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); │ │ │ │ - bencode(out, torrent_file); │ │ │ │ -
    relevance 0../src/settings_pack.cpp:305deprecate this

    deprecate this

    ../src/settings_pack.cpp:305

    		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),
    │ │ │ │ -		SET(active_seeds, 5, &session_impl::trigger_auto_manage),
    │ │ │ │ -		SET(active_checking, 1, &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, &session_impl::trigger_auto_manage),
    │ │ │ │ -		DEPRECATED_SET(active_loaded_limit, 0, &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),
    │ │ │ │ -
    SET(max_rejects, 50, nullptr), │ │ │ │ -
    SET(recv_socket_buffer_size, 0, &session_impl::update_socket_buffer_size), │ │ │ │ - SET(send_socket_buffer_size, 0, &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, &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, &session_impl::update_upload_rate), │ │ │ │ - SET(download_rate_limit, 0, &session_impl::update_download_rate), │ │ │ │ - DEPRECATED_SET(local_upload_rate_limit, 0, &session_impl::update_local_upload_rate), │ │ │ │ - DEPRECATED_SET(local_download_rate_limit, 0, &session_impl::update_local_download_rate), │ │ │ │ - SET(dht_upload_rate_limit, 8000, &session_impl::update_dht_upload_rate_limit), │ │ │ │ - SET(unchoke_slots_limit, 8, &session_impl::update_unchoke_limit), │ │ │ │ - DEPRECATED_SET(half_open_limit, 0, nullptr), │ │ │ │ - SET(connections_limit, 200, &session_impl::update_connections_limit), │ │ │ │ - SET(connections_slack, 10, nullptr), │ │ │ │ - SET(utp_target_delay, 100, nullptr), │ │ │ │ - SET(utp_gain_factor, 3000, nullptr), │ │ │ │ -
    relevance 0../src/settings_pack.cpp:590it would be nice to reserve() these vectors up front

    it would be nice to reserve() these vectors up front

    ../src/settings_pack.cpp:590

    			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 < 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 < 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;
    │ │ │ │ -
    for (int i = 0; i < settings_pack::num_string_settings; ++i) │ │ │ │ -
    { │ │ │ │ - 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 < 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 < 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& sett │ │ │ │ - , aux::session_impl* ses) │ │ │ │ - { │ │ │ │ - using fun_t = void (aux::session_impl::*)(); │ │ │ │ - std::vector<fun_t> callbacks; │ │ │ │ - │ │ │ │ - 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 │ │ │ │ - // only once per callback │ │ │ │ -
    relevance 0../src/udp_socket.cpp:659perhaps an attempt should be made to bind m_socks5_sock to the device of m_listen_socket

    perhaps an attempt should be made to bind m_socks5_sock to the │ │ │ │ -device of m_listen_socket

    ../src/udp_socket.cpp:659

    	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
    │ │ │ │ -
    │ │ │ │ -	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;
    │ │ │ │ -	}
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    ADD_OUTSTANDING_ASYNC("socks5::on_connected"); │ │ │ │ - m_socks5_sock.async_connect(m_proxy_addr │ │ │ │ - , std::bind(&socks5::on_connected, self(), _1)); │ │ │ │ - │ │ │ │ - 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)); │ │ │ │ -} │ │ │ │ - │ │ │ │ -void socks5::on_connect_timeout(error_code const& e) │ │ │ │ -{ │ │ │ │ - COMPLETE_ASYNC("socks5::on_connect_timeout"); │ │ │ │ - │ │ │ │ - if (e == boost::asio::error::operation_aborted) return; │ │ │ │ - │ │ │ │ - if (m_abort) return; │ │ │ │ - │ │ │ │ - if (m_alerts.should_post<socks5_alert>()) │ │ │ │ - m_alerts.emplace_alert<socks5_alert>(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& e) │ │ │ │ -{ │ │ │ │ -
    relevance 0../src/torrent.cpp:1951this could be optimized by looking up which files are complete and just look at those

    this could be optimized by looking up which files are │ │ │ │ -complete and just look at those

    ../src/torrent.cpp:1951

    //				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) │ │ │ │ - { │ │ │ │ - // Only attempt to reuse files from torrents that are seeding. │ │ │ │ -
    relevance 0../src/torrent.cpp:1964this could be optimized by looking up which files are complete and just look at those

    this could be optimized by looking up which files are │ │ │ │ -complete and just look at those

    ../src/torrent.cpp:1964

    		{
    │ │ │ │ -			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)
    │ │ │ │ -				{
    │ │ │ │ -					// Only attempt to reuse files from torrents that are seeding.
    │ │ │ │ -
    if (!t->is_seed()) continue; │ │ │ │ -
    │ │ │ │ - res.match(t->get_torrent_file(), t->save_path()); │ │ │ │ - } │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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) │ │ │ │ - { │ │ │ │ - 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) │ │ │ │ - { self->on_resume_data_checked(st, error); }); │ │ │ │ -
    relevance 0../src/torrent.cpp:2728this pattern is repeated in a few places. Factor this into a function and generalize the concept of a torrent having a dedicated listen port

    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

    ../src/torrent.cpp:2728

    		// 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;
    │ │ │ │ -
    │ │ │ │ -#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 (is_paused()) return;
    │ │ │ │ -
    │ │ │ │ -		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 │ │ │ │ - │ │ │ │ - // 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 │ │ │ │ - debug_log("DHT: no dht initialized"); │ │ │ │ -#endif │ │ │ │ - return; │ │ │ │ - } │ │ │ │ - if (!should_announce_dht()) │ │ │ │ - { │ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ - if (should_log()) │ │ │ │ - { │ │ │ │ -#if TORRENT_USE_I2P │ │ │ │ -
    relevance 0../src/torrent.cpp:3885add one peer per IP the hostname resolves to

    add one peer per IP the hostname resolves to

    ../src/torrent.cpp:3885

    	catch (...) { handle_exception(); }
    │ │ │ │ -#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");
    │ │ │ │ -
    │ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │ -		if (e && should_log())
    │ │ │ │ -			debug_log("peer name lookup error: %s", e.message().c_str());
    │ │ │ │ -#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) │ │ │ │ - { │ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ - if (should_log()) │ │ │ │ - { │ │ │ │ - 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; │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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); │ │ │ │ - } │ │ │ │ -#endif │ │ │ │ - } │ │ │ │ - update_want_peers(); │ │ │ │ - } │ │ │ │ -
    relevance 0../src/torrent.cpp:4581only do this if the piece size > 1 blocks This is a v2 torrent so we can request get block level hashes.

    only do this if the piece size > 1 blocks │ │ │ │ -This is a v2 torrent so we can request get block │ │ │ │ -level hashes.

    ../src/torrent.cpp:4581

    		{
    │ │ │ │ -			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;
    │ │ │ │ -		}();
    │ │ │ │ -
    │ │ │ │ -		// 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);
    │ │ │ │ -
    │ │ │ │ -		if (!torrent_file().info_hashes().has_v1() && blocks.empty() && !found_on_disk)
    │ │ │ │ -		{
    │ │ │ │ -
    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); │ │ │ │ - } │ │ │ │ - │ │ │ │ - // 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 │ │ │ │ -
    relevance 0../src/torrent.cpp:7525come up with a better way of doing this, instead of an immediately invoked lambda expression.

    come up with a better way of doing this, instead of an │ │ │ │ -immediately invoked lambda expression.

    ../src/torrent.cpp:7525

    					|| 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;
    │ │ │ │ -			}
    │ │ │ │ -		}
    │ │ │ │ -
    │ │ │ │ -
    aux::socket_type s = [&] { │ │ │ │ -
    │ │ │ │ -#if TORRENT_USE_I2P │ │ │ │ - if (peerinfo->is_i2p_addr) │ │ │ │ - { │ │ │ │ - // 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; │ │ │ │ - } │ │ │ │ - else │ │ │ │ -#endif │ │ │ │ - { │ │ │ │ - void* userdata = nullptr; │ │ │ │ -#ifdef TORRENT_SSL_PEERS │ │ │ │ - if (is_ssl_torrent()) │ │ │ │ - { │ │ │ │ -
    relevance 0../src/torrent.cpp:9118perhaps 0 should actually mean 0

    perhaps 0 should actually mean 0

    ../src/torrent.cpp:9118

    		// 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;
    │ │ │ │ -
    │ │ │ │ -		TORRENT_ASSERT(p >= no_pos);
    │ │ │ │ -
    │ │ │ │ -		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 │ │ │ │ - │ │ │ │ - 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()); │ │ │ │ -
    relevance 0../src/torrent.cpp:9135perhaps 0 should actually mean 0

    perhaps 0 should actually mean 0

    ../src/torrent.cpp:9135

    │ │ │ │ -	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
    │ │ │ │ -
    │ │ │ │ -		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());
    │ │ │ │ -
    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)) │ │ │ │ - { │ │ │ │ - disconnect_peers(num_peers() - m_max_connections │ │ │ │ - , errors::too_many_connections); │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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) │ │ │ │ - { │ │ │ │ -
    relevance 0../src/torrent.cpp:11061instead of resorting the whole list, insert the peers directly into the right place

    instead of resorting the whole list, insert the peers │ │ │ │ -directly into the right place

    ../src/torrent.cpp:11061

    				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())
    │ │ │ │ -			{
    │ │ │ │ -				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); }); │ │ │ │ - } │ │ │ │ - │ │ │ │ - // 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; │ │ │ │ - } │ │ │ │ - │ │ │ │ - // commit all the time critical requests │ │ │ │ - for (auto p : peers_with_requests) │ │ │ │ - { │ │ │ │ - p->send_block_requests(); │ │ │ │ - } │ │ │ │ - } │ │ │ │ -#endif // TORRENT_DISABLE_STREAMING │ │ │ │ - │ │ │ │ - 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); │ │ │ │ - } │ │ │ │ - return ret; │ │ │ │ -
    relevance 0../src/random.cpp:141improve calling RAND_bytes multiple times, using fallback for now

    improve calling RAND_bytes multiple times, using fallback for now

    ../src/random.cpp:141

    #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../src/magnet_uri.cpp:439what's the right number here?

    what's the right number here?

    ../src/magnet_uri.cpp:439

    			}
    │ │ │ │ -			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;
    │ │ │ │ -
    │ │ │ │ -				// 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;
    │ │ │ │ -
    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; │ │ │ │ - │ │ │ │ - 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; │ │ │ │ - │ │ │ │ - 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; │ │ │ │ - } │ │ │ │ - │ │ │ │ - if (int(p.file_priorities.size()) <= idx2) │ │ │ │ - p.file_priorities.resize(static_cast<std::size_t>(idx2) + 1, dont_download); │ │ │ │ - │ │ │ │ -
    relevance 0../src/udp_tracker_connection.cpp:633why is this a linked list?

    why is this a linked list?

    ../src/udp_tracker_connection.cpp:633

    				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);
    │ │ │ │ -			}
    │ │ │ │ -		}
    │ │ │ │ -
    │ │ │ │ -
    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(); } ); │ │ │ │ - │ │ │ │ - cb->tracker_response(tracker_req(), m_target.address(), ip_list, resp); │ │ │ │ - │ │ │ │ - close(); │ │ │ │ - return true; │ │ │ │ - } │ │ │ │ - │ │ │ │ - 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); │ │ │ │ - │ │ │ │ - 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) │ │ │ │ - { │ │ │ │ -
    relevance 0../src/piece_picker.cpp:121find a better place for this

    find a better place for this

    ../src/piece_picker.cpp:121

    			if (limit == 0)
    │ │ │ │ +
    relevance 0../src/piece_picker.cpp:121find a better place for this

    find a better place for this

    ../src/piece_picker.cpp:121

    			if (limit == 0)
    │ │ │ │  			{
    │ │ │ │  				std::cerr << " ...";
    │ │ │ │  				break;
    │ │ │ │  			}
    │ │ │ │  			if (*i == -1) break;
    │ │ │ │  			while (j != p.m_priority_boundaries.end() && *j <= index)
    │ │ │ │  			{
    │ │ │ │ @@ -8841,15 +9541,15 @@
    │ │ │ │  	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 > 0);
    │ │ │ │  		TORRENT_ASSERT(piece_size > 0);
    │ │ │ │ -
    relevance 0../src/piece_picker.cpp:2067this 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.

    this could probably be optimized by incrementally │ │ │ │ +relevance 0../src/piece_picker.cpp:2067this 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.

    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.

    ../src/piece_picker.cpp:2067

    			// 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& dp : m_downloads[piece_pos::piece_downloading])
    │ │ │ │ @@ -8896,15 +9596,15 @@
    │ │ │ │  			if (num_blocks <= 0) return ret;
    │ │ │ │  		}
    │ │ │ │  
    │ │ │ │  		if (!suggested_pieces.empty())
    │ │ │ │  		{
    │ │ │ │  			for (piece_index_t i : suggested_pieces)
    │ │ │ │  			{
    │ │ │ │ -
    relevance 0../src/piece_picker.cpp:2211Is it a good idea that this affinity takes precedence over piece priority?

    Is it a good idea that this affinity takes precedence over │ │ │ │ +relevance 0../src/piece_picker.cpp:2211Is it a good idea that this affinity takes precedence over piece priority?

    Is it a good idea that this affinity takes precedence over │ │ │ │ piece priority?

    ../src/piece_picker.cpp:2211

    					prio_index_t const end = priority_end(i);
    │ │ │ │  					for (prio_index_t p = prev(end); p >= start; --p)
    │ │ │ │  					{
    │ │ │ │  						pc.inc_stats_counter(counters::piece_picker_reverse_rare_loops);
    │ │ │ │  
    │ │ │ │  						if (!is_piece_free(m_pieces[p], pieces)) continue;
    │ │ │ │  
    │ │ │ │ @@ -8948,15 +9648,15 @@
    │ │ │ │  								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);
    │ │ │ │ -
    relevance 0../src/piece_picker.cpp:2566when expanding pieces for cache stripe reasons, the !downloading condition doesn't make much sense

    when expanding pieces for cache stripe reasons, │ │ │ │ +relevance 0../src/piece_picker.cpp:2566when expanding pieces for cache stripe reasons, the !downloading condition doesn't make much sense

    when expanding pieces for cache stripe reasons, │ │ │ │ the !downloading condition doesn't make much sense

    ../src/piece_picker.cpp:2566

    		TORRENT_ASSERT(index < m_piece_map.end_index());
    │ │ │ │  		if (next(index) == m_piece_map.end_index())
    │ │ │ │  			return m_blocks_in_last_piece;
    │ │ │ │  		else
    │ │ │ │  			return blocks_per_piece();
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │ @@ -8995,15 +9695,15 @@
    │ │ │ │  		}
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │  	// 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.
    │ │ │ │ -
    relevance 0../src/piece_picker.cpp:3144should 5 be configurable?

    should 5 be configurable?

    ../src/piece_picker.cpp:3144

    		bool have_all = true;
    │ │ │ │ +
    relevance 0../src/piece_picker.cpp:3144should 5 be configurable?

    should 5 be configurable?

    ../src/piece_picker.cpp:3144

    		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;
    │ │ │ │  
    │ │ │ │ @@ -9046,276 +9746,66 @@
    │ │ │ │  		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
    │ │ │ │  			INVARIANT_CHECK;
    │ │ │ │ -
    relevance 0../src/storage_utils.cpp:230ideally, 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.

    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.

    ../src/storage_utils.cpp:230

    		// 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())
    │ │ │ │ -		{
    │ │ │ │ -			// 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 (!ec && move_partfile) │ │ │ │ - { │ │ │ │ - error_code e; │ │ │ │ - move_partfile(new_save_path, e); │ │ │ │ - if (e) │ │ │ │ -
    relevance 0../src/storage_utils.cpp:538it would seem reasonable to, instead, set the have_pieces bits for the pieces representing these files, and resume with the normal logic

    it would seem reasonable to, instead, set the have_pieces bits │ │ │ │ -for the pieces representing these files, and resume with the normal │ │ │ │ -logic

    ../src/storage_utils.cpp:538

    					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;
    │ │ │ │ -		}
    │ │ │ │ -
    │ │ │ │ -#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. │ │ │ │ - peer_request const pr = fs.map_file(file_index │ │ │ │ -
    relevance 0../src/peer_connection.cpp:1105this should be the global download rate

    this should be the global download rate

    ../src/peer_connection.cpp:1105

    │ │ │ │ -		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; │ │ │ │ +
    relevance 0../src/torrent_peer.cpp:192how do we deal with our external address changing?

    how do we deal with our external address changing?

    ../src/torrent_peer.cpp:192

    		// 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)
    │ │ │ │ +	{}
    │ │ │ │  
    │ │ │ │ -		return milliseconds((m_outstanding_bytes + extra_bytes
    │ │ │ │ -			+ m_queued_time_critical * t->block_size() * 1000) / rate);
    │ │ │ │ +	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; │ │ │ │ } │ │ │ │ │ │ │ │ - void peer_connection::add_stat(std::int64_t const downloaded, std::int64_t const uploaded) │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING │ │ │ │ + std::string torrent_peer::to_string() const │ │ │ │ { │ │ │ │ - TORRENT_ASSERT(is_single_thread()); │ │ │ │ - m_statistics.add_stat(downloaded, uploaded); │ │ │ │ + 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 │ │ │ │ │ │ │ │ - sha1_hash peer_connection::associated_info_hash() const │ │ │ │ + std::int64_t torrent_peer::total_download() 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, │ │ │ │ - // otherwise something isn't right │ │ │ │ -
    relevance 0../src/peer_connection.cpp:3536sort the allowed fast set in priority order

    sort the allowed fast set in priority order

    ../src/peer_connection.cpp:3536

    │ │ │ │ -		// 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)
    │ │ │ │ +		TORRENT_ASSERT(in_use);
    │ │ │ │ +		if (connection != nullptr)
    │ │ │ │  		{
    │ │ │ │ -			t->peer_is_interesting(*this);
    │ │ │ │ +			TORRENT_ASSERT(prev_amount_download == 0);
    │ │ │ │ +			return connection->statistics().total_payload_download();
    │ │ │ │ +		}
    │ │ │ │ +		else
    │ │ │ │ +		{
    │ │ │ │ +			return std::int64_t(prev_amount_download) << 10;
    │ │ │ │  		}
    │ │ │ │  	}
    │ │ │ │ -
    │ │ │ │ -	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); │ │ │ │ - TORRENT_ASSERT(t->has_picker()); │ │ │ │ -
    relevance 0../src/http_seed_connection.cpp:441technically, this isn't supposed to happen, but it seems to sometimes. Some of the accounting is probably wrong in certain cases

    technically, this isn't supposed to happen, but it seems to │ │ │ │ -sometimes. Some of the accounting is probably wrong in certain │ │ │ │ -cases

    ../src/http_seed_connection.cpp:441

    					// 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;
    │ │ │ │ -					}
    │ │ │ │ -				}
    │ │ │ │ -			}
    │ │ │ │ -
    │ │ │ │ -			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) │ │ │ │ - { │ │ │ │ - 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; │ │ │ │ - } │ │ │ │ - │ │ │ │ - │ │ │ │ - // 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 │ │ │ │ - if (m_parser.chunked_encoding() && m_chunk_pos >= 0) break; │ │ │ │ -
    relevance 0../src/session_handle.cpp:499in C++14, use unique_ptr and move it into the lambda

    in C++14, use unique_ptr and move it into the lambda

    ../src/session_handle.cpp:499

    #ifndef BOOST_NO_EXCEPTIONS
    │ │ │ │ +
    relevance 0../src/session_handle.cpp:499in C++14, use unique_ptr and move it into the lambda

    in C++14, use unique_ptr and move it into the lambda

    ../src/session_handle.cpp:499

    #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());
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  #if TORRENT_ABI_VERSION < 3
    │ │ │ │ @@ -9358,556 +9848,267 @@
    │ │ │ │  		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;
    │ │ │ │ -
    relevance 0../src/part_file.cpp:300what 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

    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

    ../src/part_file.cpp:300

    				create_directories(m_path, ec);
    │ │ │ │ -				if (ec) return {};
    │ │ │ │ -				return aux::file_handle(fn, 0, mode);
    │ │ │ │ -			}
    │ │ │ │ -			return {};
    │ │ │ │ -		}
    │ │ │ │ -	}
    │ │ │ │ -	catch (storage_error const& e)
    │ │ │ │ -	{
    │ │ │ │ -		ec = e.ec;
    │ │ │ │ -		return {};
    │ │ │ │ +
    relevance 0../src/torrent_handle.cpp:589support moving files into this call

    support moving files into this call

    ../src/torrent_handle.cpp:589

    		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
    │ │ │ │  
    │ │ │ │ -	void part_file::free_piece(piece_index_t const piece)
    │ │ │ │ +	void torrent_handle::file_priority(file_index_t index, download_priority_t priority) const
    │ │ │ │  	{
    │ │ │ │ -		std::lock_guard<std::mutex> l(m_mutex);
    │ │ │ │ -
    │ │ │ │ -		auto const i = m_piece_map.find(piece);
    │ │ │ │ -		if (i == m_piece_map.end()) return;
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    m_free_slots.push_back(i->second); │ │ │ │ - m_piece_map.erase(i); │ │ │ │ - m_dirty_metadata = true; │ │ │ │ + async_call(&torrent::set_file_priority, index, priority); │ │ │ │ } │ │ │ │ │ │ │ │ - void part_file::move_partfile(std::string const& path, error_code& ec) │ │ │ │ + download_priority_t torrent_handle::file_priority(file_index_t index) const │ │ │ │ { │ │ │ │ - std::lock_guard<std::mutex> 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(); │ │ │ │ + return sync_call_ret<download_priority_t>(dont_download, &torrent::file_priority, index); │ │ │ │ + } │ │ │ │ │ │ │ │ - if (ec) │ │ │ │ - { │ │ │ │ - storage_error se; │ │ │ │ - aux::copy_file(old_path, new_path, se); │ │ │ │ - ec = se.ec; │ │ │ │ - if (ec) return; │ │ │ │ - remove(old_path, ec); │ │ │ │ - } │ │ │ │ - } │ │ │ │ -
    relevance 0../src/part_file.cpp:411instead of rebuilding the whole file header and flushing it, update the slot entries as we go

    instead of rebuilding the whole file header │ │ │ │ -and flushing it, update the slot entries as we go

    ../src/part_file.cpp:411

    						TORRENT_ASSERT(j->second == slot);
    │ │ │ │ -						m_free_slots.push_back(j->second);
    │ │ │ │ -						m_piece_map.erase(j);
    │ │ │ │ -						m_dirty_metadata = true;
    │ │ │ │ -					}
    │ │ │ │ -				}
    │ │ │ │ -			}
    │ │ │ │ -			file_offset += block_to_copy;
    │ │ │ │ -			piece_offset = 0;
    │ │ │ │ -			size -= block_to_copy;
    │ │ │ │ -		}
    │ │ │ │ +
    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)); │ │ │ │ } │ │ │ │ │ │ │ │ - void part_file::flush_metadata(error_code& ec) │ │ │ │ + std::vector<download_priority_t> torrent_handle::get_file_priorities() const │ │ │ │ { │ │ │ │ - std::lock_guard<std::mutex> l(m_mutex); │ │ │ │ - │ │ │ │ - flush_metadata_impl(ec); │ │ │ │ + aux::vector<download_priority_t, file_index_t> ret; │ │ │ │ + auto retp = &ret; │ │ │ │ + sync_call(&torrent::file_priorities, retp); │ │ │ │ + return TORRENT_RVO(ret); │ │ │ │ } │ │ │ │ │ │ │ │ -
    void part_file::flush_metadata_impl(error_code& ec) │ │ │ │ -
    { │ │ │ │ - // do we need to flush the metadata? │ │ │ │ - if (m_dirty_metadata == false) return; │ │ │ │ +#if TORRENT_ABI_VERSION == 1 │ │ │ │ │ │ │ │ - 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); │ │ │ │ +// ============ start deprecation =============== │ │ │ │ │ │ │ │ - if (ec == boost::system::errc::no_such_file_or_directory) │ │ │ │ - ec.clear(); │ │ │ │ - return; │ │ │ │ + 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); │ │ │ │ + } │ │ │ │ │ │ │ │ - auto f = open_file(aux::open_mode::write | aux::open_mode::hidden, ec); │ │ │ │ - if (ec) return; │ │ │ │ - │ │ │ │ - std::vector<char> header(static_cast<std::size_t>(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 < piece_index_t(m_max_pieces); ++piece) │ │ │ │ - { │ │ │ │ - auto const i = m_piece_map.find(piece); │ │ │ │ -
    relevance 0../src/utp_socket_manager.cpp:204this should not be heap allocated, sockets should be movable

    this should not be heap allocated, sockets should be movable

    ../src/utp_socket_manager.cpp:204

    │ │ │ │ -//		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)); │ │ │ │ -
    │ │ │ │ - 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); │ │ │ │ + std::vector<int> torrent_handle::file_priorities() const │ │ │ │ + { │ │ │ │ + aux::vector<download_priority_t, file_index_t> prio; │ │ │ │ +
    relevance 0../src/kademlia/node_id.cpp:66it'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)

    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)

    ../src/kademlia/node_id.cpp:66

    │ │ │ │ +// returns the distance between the two nodes
    │ │ │ │ +// using the kademlia XOR-metric
    │ │ │ │ +node_id distance(node_id const& n1, node_id const& n2)
    │ │ │ │ +{
    │ │ │ │ +	return n1 ^ n2;
    │ │ │ │ +}
    │ │ │ │  
    │ │ │ │ -			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;
    │ │ │ │ -		}
    │ │ │ │ +// returns true if: distance(n1, ref) < distance(n2, ref)
    │ │ │ │ +bool compare_ref(node_id const& n1, node_id const& n2, node_id const& ref)
    │ │ │ │ +{
    │ │ │ │ +	node_id const lhs = n1 ^ ref;
    │ │ │ │ +	node_id const rhs = n2 ^ ref;
    │ │ │ │ +	return lhs < rhs;
    │ │ │ │ +}
    │ │ │ │  
    │ │ │ │ -		if (ph->get_type() == ST_RESET) return false;
    │ │ │ │ +// returns n in: 2^n <= distance(n1, n2) < 2^(n+1)
    │ │ │ │ +// useful for finding out which bucket a node belongs to
    │ │ │ │ +int distance_exp(node_id const& n1, node_id const& n2)
    │ │ │ │ +{
    │ │ │ │ +
    return std::max(159 - distance(n1, n2).count_leading_zeroes(), 0); │ │ │ │ +
    } │ │ │ │ │ │ │ │ - // #error send reset │ │ │ │ +int min_distance_exp(node_id const& n1, std::vector<node_id> const& ids) │ │ │ │ +{ │ │ │ │ + TORRENT_ASSERT(ids.size() > 0); │ │ │ │ │ │ │ │ - return false; │ │ │ │ + int min = 160; // see distance_exp for the why of this constant │ │ │ │ + for (auto const& node_id : ids) │ │ │ │ + { │ │ │ │ + min = std::min(min, distance_exp(n1, node_id)); │ │ │ │ } │ │ │ │ │ │ │ │ - void utp_socket_manager::subscribe_writable(utp_socket_impl* s) │ │ │ │ -
    relevance 0../src/choker.cpp:258make configurable

    make configurable

    ../src/choker.cpp:258

    			// 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); });
    │ │ │ │ +	return min;
    │ │ │ │ +}
    │ │ │ │  
    │ │ │ │ -			for (auto const* p : peers)
    │ │ │ │ -			{
    │ │ │ │ -				int const rate = int(p->uploaded_in_last_round()
    │ │ │ │ -					* 1000 / total_milliseconds(unchoke_interval));
    │ │ │ │ +node_id generate_id_impl(address const& ip_, std::uint32_t r)
    │ │ │ │ +{
    │ │ │ │ +	std::uint8_t* ip = nullptr;
    │ │ │ │  
    │ │ │ │ -				// always have at least 1 unchoke slot
    │ │ │ │ -				if (rate < rate_threshold) break;
    │ │ │ │ +	static std::uint8_t const v4mask[] = { 0x03, 0x0f, 0x3f, 0xff };
    │ │ │ │ +	static std::uint8_t const v6mask[] = { 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
    │ │ │ │ +	std::uint8_t const* mask = nullptr;
    │ │ │ │ +	int num_octets = 0;
    │ │ │ │  
    │ │ │ │ -				++upload_slots;
    │ │ │ │ +	address_v4::bytes_type b4{};
    │ │ │ │ +	address_v6::bytes_type b6{};
    │ │ │ │ +	if (ip_.is_v6())
    │ │ │ │ +	{
    │ │ │ │ +		b6 = ip_.to_v6().to_bytes();
    │ │ │ │ +		ip = b6.data();
    │ │ │ │ +
    relevance 0../src/kademlia/item.cpp:143implement ctor for entry from bdecode_node?

    implement ctor for entry from bdecode_node?

    ../src/kademlia/item.cpp:143

    	, secret_key const& sk)
    │ │ │ │ +{
    │ │ │ │ +	char str[1200];
    │ │ │ │ +	int const len = canonical_string(v, seq, salt, str);
    │ │ │ │  
    │ │ │ │ -
    rate_threshold += 2048; │ │ │ │ -
    } │ │ │ │ - ++upload_slots; │ │ │ │ - } │ │ │ │ + return ed25519_sign({str, len}, pk, sk); │ │ │ │ +} │ │ │ │ │ │ │ │ - // 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 │ │ │ │ +item::item(public_key const& pk, span<char const> salt) │ │ │ │ + : m_salt(salt.data(), static_cast<std::size_t>(salt.size())) │ │ │ │ + , m_pk(pk) │ │ │ │ + , m_mutable(true) │ │ │ │ +{} │ │ │ │ │ │ │ │ - // we use partial sort here, because we only care about the top │ │ │ │ - // upload_slots peers. │ │ │ │ +item::item(entry v) │ │ │ │ + : m_value(std::move(v)) │ │ │ │ +{} │ │ │ │ │ │ │ │ - int const slots = std::min(upload_slots, int(peers.size())); │ │ │ │ +item::item(bdecode_node const& v) │ │ │ │ +{ │ │ │ │ +
    m_value = v; │ │ │ │ +
    } │ │ │ │ │ │ │ │ - if (sett.get_int(settings_pack::seed_choking_algorithm) │ │ │ │ - == settings_pack::round_robin) │ │ │ │ - { │ │ │ │ - int const pieces = sett.get_int(settings_pack::seeding_piece_quota); │ │ │ │ +item::item(entry v, span<char const> salt │ │ │ │ + , sequence_number const seq, public_key const& pk, secret_key const& sk) │ │ │ │ +{ │ │ │ │ + assign(std::move(v), salt, seq, pk, sk); │ │ │ │ +} │ │ │ │ │ │ │ │ - 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() │ │ │ │ - , [](peer_connection const* lhs, peer_connection const* rhs) │ │ │ │ -
    relevance 0../src/torrent_peer.cpp:192how do we deal with our external address changing?

    how do we deal with our external address changing?

    ../src/torrent_peer.cpp:192

    		// 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)
    │ │ │ │ -	{}
    │ │ │ │ +void item::assign(entry v)
    │ │ │ │ +{
    │ │ │ │ +	m_mutable = false;
    │ │ │ │ +	m_value = std::move(v);
    │ │ │ │ +}
    │ │ │ │  
    │ │ │ │ -	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; │ │ │ │ - } │ │ │ │ +void item::assign(entry v, span<char const> salt │ │ │ │ + , sequence_number const seq, public_key const& pk, secret_key const& sk) │ │ │ │ +{ │ │ │ │ + std::array<char, 1000> buffer; │ │ │ │ + int const bsize = bencode(buffer.begin(), v); │ │ │ │ + TORRENT_ASSERT(bsize <= 1000); │ │ │ │ + m_sig = sign_mutable_item(span<char const>(buffer).first(bsize) │ │ │ │ + , salt, seq, pk, sk); │ │ │ │ + m_salt.assign(salt.data(), static_cast<std::size_t>(salt.size())); │ │ │ │ + m_pk = pk; │ │ │ │ + m_seq = seq; │ │ │ │ + m_mutable = true; │ │ │ │ + m_value = std::move(v); │ │ │ │ +} │ │ │ │ │ │ │ │ +void item::assign(bdecode_node const& v) │ │ │ │ +
    relevance 0../src/kademlia/dht_tracker.cpp:317pick the closest node rather than the first

    pick the closest node rather than the first

    ../src/kademlia/dht_tracker.cpp:317

    │ │ │ │  #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();
    │ │ │ │ -	}
    │ │ │ │ +		m_log->log(dht_logger::tracker, "*** new write key*** %d nodes"
    │ │ │ │ +			, int(m_nodes.size()));
    │ │ │ │  #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;
    │ │ │ │ -		}
    │ │ │ │  	}
    │ │ │ │ -
    relevance 0../src/hash_picker.cpp:309use structured bindings in C++17

    use structured bindings in C++17

    ../src/hash_picker.cpp:309

    		, int const offset, sha256_hash const& h)
    │ │ │ │ -	{
    │ │ │ │ -		TORRENT_ASSERT(offset >= 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& 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<int>(piece) * std::int64_t(m_files.piece_length())
    │ │ │ │ -			+ offset - m_files.file_offset(f);
    │ │ │ │ -		int const block_index = aux::numeric_cast<int>(block_offset / default_block_size);
    │ │ │ │ -
    │ │ │ │ -		if (h.is_all_zeros())
    │ │ │ │ -		{
    │ │ │ │ -			TORRENT_ASSERT_FAIL();
    │ │ │ │ -			return set_block_hash_result::block_hash_failed();
    │ │ │ │ -		}
    │ │ │ │ -
    │ │ │ │ -
    aux::merkle_tree::set_block_result result; │ │ │ │ -
    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<int>(piece - file_first_piece) * blocks_per_piece) │ │ │ │ - , std::min(leafs_size, m_files.file_num_pieces(f) * blocks_per_piece - leafs_index) }; │ │ │ │ + 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); │ │ │ │ } │ │ │ │ │ │ │ │ - void hash_picker::hashes_rejected(hash_request const& req) │ │ │ │ + node* dht_tracker::get_node(node_id const& id, std::string const& family_name) │ │ │ │ { │ │ │ │ - TORRENT_ASSERT(req.base == m_piece_layer && req.index % 512 == 0); │ │ │ │ - │ │ │ │ - for (int i = req.index; i < req.index + req.count; i += 512) │ │ │ │ + TORRENT_UNUSED(id); │ │ │ │ + for (auto& n : m_nodes) │ │ │ │ { │ │ │ │ - m_piece_hash_requested[req.file][i / 512].last_request = min_time(); │ │ │ │ - --m_piece_hash_requested[req.file][i / 512].num_requests; │ │ │ │ +
    if (n.second.dht.protocol_family_name() == family_name) │ │ │ │ +
    return &n.second.dht; │ │ │ │ } │ │ │ │ │ │ │ │ -
    relevance 0../src/disabled_disk_io.cpp:106it would be nice to return a valid hash of zeroes here

    it would be nice to return a valid hash of zeroes here

    ../src/disabled_disk_io.cpp:106

    		});
    │ │ │ │ -	}
    │ │ │ │ -
    │ │ │ │ -	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);
    │ │ │ │ -
    │ │ │ │ -		post(m_ios, [h = std::move(handler)] { h(storage_error{}); });
    │ │ │ │ -		return false;
    │ │ │ │ -	}
    │ │ │ │ -
    │ │ │ │ -	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{}); }); │ │ │ │ -
    } │ │ │ │ - │ │ │ │ - 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{}); }); │ │ │ │ + return nullptr; │ │ │ │ } │ │ │ │ │ │ │ │ - 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 │ │ │ │ + void dht_tracker::get_peers(sha1_hash const& ih │ │ │ │ + , std::function<void(std::vector<tcp::endpoint> const&)> f) │ │ │ │ { │ │ │ │ - post(m_ios, [h = std::move(handler), path = std::move(p)] () mutable │ │ │ │ - { h(status_t::no_error, std::move(path), storage_error{}); }); │ │ │ │ + for (auto& n : m_nodes) │ │ │ │ + n.second.dht.get_peers(ih, f, {}, {}); │ │ │ │ } │ │ │ │ │ │ │ │ - void async_release_files(storage_index_t, std::function<void()> handler) override │ │ │ │ + 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) │ │ │ │ { │ │ │ │ - post(m_ios, [h = std::move(handler)] { h(); }); │ │ │ │ + for (auto& n : m_nodes) │ │ │ │ + n.second.dht.announce(ih, listen_port, flags, f); │ │ │ │ } │ │ │ │ │ │ │ │ - void async_delete_files(storage_index_t │ │ │ │ - , remove_flags_t, std::function<void(storage_error const&)> handler) override │ │ │ │ + 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) │ │ │ │ { │ │ │ │ - post(m_ios, [h = std::move(handler)] { h(storage_error{}); }); │ │ │ │ - } │ │ │ │ - │ │ │ │ - void async_check_files(storage_index_t │ │ │ │ - , add_torrent_params const* │ │ │ │ -
    relevance 0../src/mmap_disk_io.cpp:578in the future, propagate exceptions back to the handlers

    in the future, propagate exceptions back to the handlers

    ../src/mmap_disk_io.cpp:578

    #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
    │ │ │ │ -
    │ │ │ │ -		std::shared_ptr<mmap_storage> storage = j->storage;
    │ │ │ │ -
    │ │ │ │ -		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 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&) │ │ │ │ - { │ │ │ │ - ret = status_t::fatal_disk_error; │ │ │ │ - j->error.ec = errors::no_memory; │ │ │ │ - j->error.operation = operation_t::exception; │ │ │ │ - } │ │ │ │ - catch (std::exception const&) │ │ │ │ + for (auto& n : m_nodes) │ │ │ │ { │ │ │ │ - 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_stats_counters.inc_stats_counter(counters::num_running_disk_jobs, -1); │ │ │ │ - │ │ │ │ -
    relevance 0../src/mmap_disk_io.cpp:1017this 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

    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

    ../src/mmap_disk_io.cpp:1017

    		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../src/mmap_disk_io.cpp:1022Perhaps 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

    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

    ../src/mmap_disk_io.cpp:1022

    		j->storage = m_torrents[storage]->shared_from_this();
    │ │ │ │ -		j->argument = std::move(prios);
    │ │ │ │ -		j->callback = std::move(handler);
    │ │ │ │ -
    │ │ │ │ -		add_fence_job(j);
    │ │ │ │ -	}
    │ │ │ │ +			if (ep.protocol() != (n.first.get_external_address().is_v4() ? udp::v4() : udp::v6()))
    │ │ │ │ +
    relevance 0../src/kademlia/put_data.cpp:92what if o is not an instance of put_data_observer? This need to be redesigned for better type safety.

    what if o is not an instance of put_data_observer? This need to be │ │ │ │ +redesigned for better type safety.

    ../src/kademlia/put_data.cpp:92

    	}
    │ │ │ │ +}
    │ │ │ │  
    │ │ │ │ -	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);
    │ │ │ │ +void put_data::done()
    │ │ │ │ +{
    │ │ │ │ +	m_done = true;
    │ │ │ │  
    │ │ │ │ -		// 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
    │ │ │ │ +#ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │ +	get_node().observer()->log(dht_logger::traversal, "[%u] %s DONE, response %d, timeout %d"
    │ │ │ │ +		, id(), name(), num_responses(), num_timeouts());
    │ │ │ │ +#endif
    │ │ │ │  
    │ │ │ │ +	m_put_callback(m_data, num_responses());
    │ │ │ │ +	traversal_algorithm::done();
    │ │ │ │ +}
    │ │ │ │  
    │ │ │ │ -
    add_fence_job(j); │ │ │ │ -
    } │ │ │ │ +bool put_data::invoke(observer_ptr o) │ │ │ │ +{ │ │ │ │ + if (m_done) return false; │ │ │ │ │ │ │ │ - status_t mmap_disk_io::do_hash(aux::mmap_disk_job* j) │ │ │ │ +
    auto* po = static_cast<put_data_observer*>(o.get()); │ │ │ │ +
    │ │ │ │ + entry e; │ │ │ │ + e["y"] = "q"; │ │ │ │ + e["q"] = "put"; │ │ │ │ + entry& a = e["a"]; │ │ │ │ + a["v"] = m_data.value(); │ │ │ │ + a["token"] = po->m_token; │ │ │ │ + if (m_data.is_mutable()) │ │ │ │ { │ │ │ │ - // 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) │ │ │ │ + a["k"] = m_data.pk().bytes; │ │ │ │ + a["seq"] = m_data.seq().value; │ │ │ │ + a["sig"] = m_data.sig().bytes; │ │ │ │ + if (!m_data.salt().empty()) │ │ │ │ { │ │ │ │ - bool const v2_block = i < blocks_in_piece2; │ │ │ │ - │ │ │ │ - DLOG("do_hash: reading (piece: %d block: %d)\n", int(j->piece), i); │ │ │ │ -
    relevance 0../src/ut_metadata.cpp:281we really need to increment the refcounter on the torrent while this buffer is still in the peer's send buffer

    we really need to increment the refcounter on the torrent │ │ │ │ -while this buffer is still in the peer's send buffer

    ../src/ut_metadata.cpp:281

    				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_pc.send_buffer({msg, len + 6});
    │ │ │ │ -
    if (metadata_piece_size) │ │ │ │ -
    { │ │ │ │ - m_pc.append_const_send_buffer( │ │ │ │ - span<char>(const_cast<char*>(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); │ │ │ │ + a["salt"] = m_data.salt(); │ │ │ │ } │ │ │ │ + } │ │ │ │ │ │ │ │ - bool on_extended(int const length │ │ │ │ - , int const extended_msg, span<char const> body) override │ │ │ │ - { │ │ │ │ - if (extended_msg != 2) return false; │ │ │ │ - if (m_message_index == 0) return false; │ │ │ │ - │ │ │ │ - if (length > 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; │ │ │ │ - } │ │ │ │ + m_node.stats_counters().inc_stats_counter(counters::dht_put_out); │ │ │ │ │ │ │ │ - if (!m_pc.packet_finished()) return true; │ │ │ │ + return m_node.m_rpc.invoke(e, o->target_ep(), o); │ │ │ │ +} │ │ │ │ │ │ │ │ - error_code ec; │ │ │ │ - bdecode_node msg = bdecode(body, ec); │ │ │ │ - if (msg.type() != bdecode_node::dict_t) │ │ │ │ -
    relevance 0../src/kademlia/node.cpp:1177keep the returned value to pass as a limit to write_nodes_entries when implemented

    keep the returned value to pass as a limit │ │ │ │ +} } // namespace libtorrent::dht │ │ │ │ +relevance 0../src/kademlia/node.cpp:1177keep the returned value to pass as a limit to write_nodes_entries when implemented

    keep the returned value to pass as a limit │ │ │ │ to write_nodes_entries when implemented

    ../src/kademlia/node.cpp:1177

    		}
    │ │ │ │  	}
    │ │ │ │  	else if (query == "sample_infohashes")
    │ │ │ │  	{
    │ │ │ │  		static key_desc_t const msg_desc[] = {
    │ │ │ │  			{"target", bdecode_node::string_t, 20, 0},
    │ │ │ │  			{"want", bdecode_node::list_t, 0, key_desc_t::optional},
    │ │ │ │ @@ -9946,15 +10147,15 @@
    │ │ │ │  
    │ │ │ │  		sha1_hash const target(target_ent.string_ptr());
    │ │ │ │  		// always return nodes as well as peers
    │ │ │ │  		write_nodes_entries(target, arg_ent.dict_find_list("want"), reply);
    │ │ │ │  	}
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │ -
    relevance 0../src/kademlia/node.cpp:1205limit number of entries in the result

    limit number of entries in the result

    ../src/kademlia/node.cpp:1205

    		// if we don't recognize the message but there's a
    │ │ │ │ +
    relevance 0../src/kademlia/node.cpp:1205limit number of entries in the result

    limit number of entries in the result

    ../src/kademlia/node.cpp:1205

    		// if we don't recognize the message but there's a
    │ │ │ │  		// 'target' or 'info_hash' in the arguments, treat it
    │ │ │ │  		// as find_node to be future compatible
    │ │ │ │  		bdecode_node target_ent = arg_ent.dict_find_string("target");
    │ │ │ │  		if (!target_ent || target_ent.string_length() != 20)
    │ │ │ │  		{
    │ │ │ │  			target_ent = arg_ent.dict_find_string("info_hash");
    │ │ │ │  			if (!target_ent || target_ent.string_length() != 20)
    │ │ │ │ @@ -9997,15 +10198,15 @@
    │ │ │ │  		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../src/kademlia/routing_table.cpp:289This 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

    This is temporary. For now, only report the largest routing table │ │ │ │ +relevance 0../src/kademlia/routing_table.cpp:289This 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

    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

    ../src/kademlia/routing_table.cpp:289

    	, 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);
    │ │ │ │ @@ -10032,15 +10233,15 @@
    │ │ │ │  		b.num_nodes = int(i.live_nodes.size());
    │ │ │ │  		b.num_replacements = int(i.replacements.size());
    │ │ │ │  		s.push_back(b);
    │ │ │ │  	}
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │  #if TORRENT_ABI_VERSION == 1
    │ │ │ │ -
    relevance 0../src/kademlia/routing_table.cpp:314arvidn 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

    arvidn note │ │ │ │ +relevance 0../src/kademlia/routing_table.cpp:314arvidn 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

    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

    ../src/kademlia/routing_table.cpp:314

    	if (s.size() > m_buckets.size()) return;
    │ │ │ │  	s.clear();
    │ │ │ │  	for (auto const& i : m_buckets)
    │ │ │ │  	{
    │ │ │ │ @@ -10087,15 +10288,15 @@
    │ │ │ │  			, [](node_entry const& k) { return k.confirmed(); } ));
    │ │ │ │  
    │ │ │ │  		replacements += int(i.replacements.size());
    │ │ │ │  	}
    │ │ │ │  	return std::make_tuple(nodes, replacements, confirmed);
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │ -
    relevance 0../src/kademlia/routing_table.cpp:518this need to take bucket "prefix" into account. It should be unified with add_node_impl()

    this need to take bucket "prefix" into account. It should be unified │ │ │ │ +relevance 0../src/kademlia/routing_table.cpp:518this need to take bucket "prefix" into account. It should be unified with add_node_impl()

    this need to take bucket "prefix" into account. It should be unified │ │ │ │ with add_node_impl()

    ../src/kademlia/routing_table.cpp:518

    {
    │ │ │ │  	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;
    │ │ │ │ @@ -10139,216 +10340,299 @@
    │ │ │ │  		&& m_buckets.back().replacements.empty())
    │ │ │ │  	{
    │ │ │ │  		m_buckets.erase(m_buckets.end() - 1);
    │ │ │ │  	}
    │ │ │ │  }
    │ │ │ │  
    │ │ │ │  void routing_table::remove_node(node_entry* n, bucket_t* b)
    │ │ │ │ -
    relevance 0../src/kademlia/node_id.cpp:66it'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)

    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)

    ../src/kademlia/node_id.cpp:66

    │ │ │ │ -// returns the distance between the two nodes
    │ │ │ │ -// using the kademlia XOR-metric
    │ │ │ │ -node_id distance(node_id const& n1, node_id const& n2)
    │ │ │ │ -{
    │ │ │ │ -	return n1 ^ n2;
    │ │ │ │ -}
    │ │ │ │ +
    relevance 0../include/libtorrent/i2p_stream.hpp:533make this a string_view

    make this a string_view

    ../include/libtorrent/i2p_stream.hpp:533

    │ │ │ │ +		char tmp[20];
    │ │ │ │ +		aux::random_bytes(tmp);
    │ │ │ │ +		m_session_id.resize(sizeof(tmp)*2);
    │ │ │ │ +		aux::to_hex(tmp, &m_session_id[0]);
    │ │ │ │  
    │ │ │ │ -// returns true if: distance(n1, ref) < distance(n2, ref)
    │ │ │ │ -bool compare_ref(node_id const& n1, node_id const& n2, node_id const& ref)
    │ │ │ │ -{
    │ │ │ │ -	node_id const lhs = n1 ^ ref;
    │ │ │ │ -	node_id const rhs = n2 ^ ref;
    │ │ │ │ -	return lhs < rhs;
    │ │ │ │ -}
    │ │ │ │ +		m_sam_socket = std::make_shared<i2p_stream>(m_io_service);
    │ │ │ │ +		m_sam_socket->set_proxy(m_hostname, m_port);
    │ │ │ │ +		m_sam_socket->set_command(i2p_stream::cmd_create_session);
    │ │ │ │ +		m_sam_socket->set_session_id(m_session_id.c_str());
    │ │ │ │ +		m_sam_socket->set_session_options(session_options);
    │ │ │ │  
    │ │ │ │ -// returns n in: 2^n <= distance(n1, n2) < 2^(n+1)
    │ │ │ │ -// useful for finding out which bucket a node belongs to
    │ │ │ │ -int distance_exp(node_id const& n1, node_id const& n2)
    │ │ │ │ -{
    │ │ │ │ -
    return std::max(159 - distance(n1, n2).count_leading_zeroes(), 0); │ │ │ │ -
    } │ │ │ │ + ADD_OUTSTANDING_ASYNC("i2p_stream::on_sam_connect"); │ │ │ │ + m_sam_socket->async_connect(tcp::endpoint(), wrap_allocator( │ │ │ │ + [this,s=m_sam_socket](error_code const& ec, Handler hn) { │ │ │ │ + on_sam_connect(ec, s, std::move(hn)); │ │ │ │ + }, std::move(handler))); │ │ │ │ + } │ │ │ │ + void close(error_code&); │ │ │ │ │ │ │ │ -int min_distance_exp(node_id const& n1, std::vector<node_id> const& ids) │ │ │ │ -{ │ │ │ │ - TORRENT_ASSERT(ids.size() > 0); │ │ │ │ +
    char const* session_id() const { return m_session_id.c_str(); } │ │ │ │ +
    std::string const& local_endpoint() const { return m_i2p_local_endpoint; } │ │ │ │ │ │ │ │ - int min = 160; // see distance_exp for the why of this constant │ │ │ │ - for (auto const& node_id : ids) │ │ │ │ + template <typename Handler> │ │ │ │ + void async_name_lookup(char const* name, Handler handler) │ │ │ │ { │ │ │ │ - min = std::min(min, distance_exp(n1, node_id)); │ │ │ │ + if (m_state == sam_idle && m_name_lookup.empty() && is_open()) │ │ │ │ + do_name_lookup(name, std::move(handler)); │ │ │ │ + else │ │ │ │ + m_name_lookup.emplace_back(std::string(name) │ │ │ │ + , std::move(handler)); │ │ │ │ } │ │ │ │ │ │ │ │ - return min; │ │ │ │ -} │ │ │ │ +private: │ │ │ │ │ │ │ │ -node_id generate_id_impl(address const& ip_, std::uint32_t r) │ │ │ │ -{ │ │ │ │ - std::uint8_t* ip = nullptr; │ │ │ │ + template <typename Handler> │ │ │ │ + void on_sam_connect(error_code const& ec, std::shared_ptr<i2p_stream>, Handler h) │ │ │ │ + { │ │ │ │ + COMPLETE_ASYNC("i2p_stream::on_sam_connect"); │ │ │ │ + m_state = sam_idle; │ │ │ │ │ │ │ │ - static std::uint8_t const v4mask[] = { 0x03, 0x0f, 0x3f, 0xff }; │ │ │ │ - static std::uint8_t const v6mask[] = { 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; │ │ │ │ - std::uint8_t const* mask = nullptr; │ │ │ │ - int num_octets = 0; │ │ │ │ + if (ec) │ │ │ │ + { │ │ │ │ + h(ec); │ │ │ │ + return; │ │ │ │ + } │ │ │ │ │ │ │ │ - address_v4::bytes_type b4{}; │ │ │ │ - address_v6::bytes_type b6{}; │ │ │ │ - if (ip_.is_v6()) │ │ │ │ + do_name_lookup("ME", wrap_allocator( │ │ │ │ + [this](error_code const& e, char const* dst, Handler hn) { │ │ │ │ + set_local_endpoint(e, dst, std::move(hn)); │ │ │ │ + }, std::move(h))); │ │ │ │ +
    relevance 0../include/libtorrent/hash_picker.hpp:155support batched adding of block hashes for reduced overhead?

    support batched adding of block hashes for reduced overhead?

    ../include/libtorrent/hash_picker.hpp:155

    		// 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
    │ │ │ │  	{
    │ │ │ │ -		b6 = ip_.to_v6().to_bytes();
    │ │ │ │ -		ip = b6.data();
    │ │ │ │ -
    relevance 0../src/kademlia/put_data.cpp:92what if o is not an instance of put_data_observer? This need to be redesigned for better type safety.

    what if o is not an instance of put_data_observer? This need to be │ │ │ │ -redesigned for better type safety.

    ../src/kademlia/put_data.cpp:92

    	}
    │ │ │ │ -}
    │ │ │ │ +	public:
    │ │ │ │ +		hash_picker(file_storage const& files
    │ │ │ │ +			, aux::vector<aux::merkle_tree, file_index_t>& trees);
    │ │ │ │  
    │ │ │ │ -void put_data::done()
    │ │ │ │ -{
    │ │ │ │ -	m_done = true;
    │ │ │ │ +		hash_request pick_hashes(typed_bitfield<piece_index_t> const& pieces);
    │ │ │ │  
    │ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │ -	get_node().observer()->log(dht_logger::traversal, "[%u] %s DONE, response %d, timeout %d"
    │ │ │ │ -		, id(), name(), num_responses(), num_timeouts());
    │ │ │ │ -#endif
    │ │ │ │ +		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); │ │ │ │ │ │ │ │ - m_put_callback(m_data, num_responses()); │ │ │ │ - traversal_algorithm::done(); │ │ │ │ -} │ │ │ │ + // 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; │ │ │ │ │ │ │ │ -bool put_data::invoke(observer_ptr o) │ │ │ │ -{ │ │ │ │ - if (m_done) return false; │ │ │ │ + int piece_layer() const { return m_piece_layer; } │ │ │ │ │ │ │ │ -
    auto* po = static_cast<put_data_observer*>(o.get()); │ │ │ │ -
    │ │ │ │ - entry e; │ │ │ │ - e["y"] = "q"; │ │ │ │ - e["q"] = "put"; │ │ │ │ - entry& a = e["a"]; │ │ │ │ - a["v"] = m_data.value(); │ │ │ │ - a["token"] = po->m_token; │ │ │ │ - if (m_data.is_mutable()) │ │ │ │ + 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; │ │ │ │ + int block; │ │ │ │ +
    relevance 0../include/libtorrent/socks5_stream.hpp:197we could bind the socket here, since we know what the target endpoint is of the proxy

    we could bind the socket here, since we know what the │ │ │ │ +target endpoint is of the proxy

    ../include/libtorrent/socks5_stream.hpp:197

    			}, std::move(handler)));
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +private:
    │ │ │ │ +
    │ │ │ │ +	template <typename Handler>
    │ │ │ │ +	void name_lookup(error_code const& e, tcp::resolver::results_type ips
    │ │ │ │ +		, Handler h)
    │ │ │ │  	{
    │ │ │ │ -		a["k"] = m_data.pk().bytes;
    │ │ │ │ -		a["seq"] = m_data.seq().value;
    │ │ │ │ -		a["sig"] = m_data.sig().bytes;
    │ │ │ │ -		if (!m_data.salt().empty())
    │ │ │ │ +		COMPLETE_ASYNC("socks5_stream::name_lookup");
    │ │ │ │ +		if (handle_error(e, std::move(h))) return;
    │ │ │ │ +
    │ │ │ │ +		auto i = ips.begin();
    │ │ │ │ +		if (!m_sock.is_open())
    │ │ │ │  		{
    │ │ │ │ -			a["salt"] = m_data.salt();
    │ │ │ │ +			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))); │ │ │ │ } │ │ │ │ │ │ │ │ - m_node.stats_counters().inc_stats_counter(counters::dht_put_out); │ │ │ │ + template <typename Handler> │ │ │ │ + void connected(error_code const& e, Handler h) │ │ │ │ + { │ │ │ │ + COMPLETE_ASYNC("socks5_stream::connected"); │ │ │ │ + if (handle_error(e, std::move(h))) return; │ │ │ │ │ │ │ │ - return m_node.m_rpc.invoke(e, o->target_ep(), o); │ │ │ │ + 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 │ │ │ │ + } │ │ │ │ + ADD_OUTSTANDING_ASYNC("socks5_stream::handshake1"); │ │ │ │ +
    relevance 0../include/libtorrent/socket_type.hpp:60move to aux

    move to aux

    ../include/libtorrent/socket_type.hpp:60

    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 <= 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); │ │ │ │ +
    │ │ │ │ } │ │ │ │ │ │ │ │ -} } // namespace libtorrent::dht │ │ │ │ -
    relevance 0../src/kademlia/dht_tracker.cpp:317pick the closest node rather than the first

    pick the closest node rather than the first

    ../src/kademlia/dht_tracker.cpp:317

    │ │ │ │ -#ifndef TORRENT_DISABLE_LOGGING
    │ │ │ │ -		m_log->log(dht_logger::tracker, "*** new write key*** %d nodes"
    │ │ │ │ -			, int(m_nodes.size()));
    │ │ │ │  #endif
    │ │ │ │ -	}
    │ │ │ │ +
    relevance 0../include/libtorrent/torrent_info.hpp:729change the type to std::shared_ptr in C++17 it is used as if immutable, it cannot be const for technical reasons right now.

    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.

    ../include/libtorrent/torrent_info.hpp:729

    │ │ │ │ +		// 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<std::string> m_owned_collections;
    │ │ │ │  
    │ │ │ │ -	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);
    │ │ │ │ -	}
    │ │ │ │ +#if TORRENT_ABI_VERSION <= 2
    │ │ │ │ +		// if this is a merkle torrent, this is the merkle
    │ │ │ │ +		// tree. It has space for merkle_num_nodes(merkle_num_leafs(num_pieces))
    │ │ │ │ +		// hashes
    │ │ │ │ +		aux::vector<sha1_hash> m_merkle_tree;
    │ │ │ │ +#endif
    │ │ │ │  
    │ │ │ │ -	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; │ │ │ │ - } │ │ │ │ + // v2 merkle tree for each file │ │ │ │ + // the actual hash buffers are always divisible by 32 (sha256_hash::size()) │ │ │ │ + aux::vector<aux::vector<char>, file_index_t> m_piece_layers; │ │ │ │ │ │ │ │ - return nullptr; │ │ │ │ - } │ │ │ │ + // this is a copy of the info section from the torrent. │ │ │ │ + // it use maintained in this flat format in order to │ │ │ │ + // make it available through the metadata extension │ │ │ │ +
    boost::shared_array<char> m_info_section; │ │ │ │ +
    │ │ │ │ + // if a comment is found in the torrent file │ │ │ │ + // this will be set to that comment │ │ │ │ + std::string m_comment; │ │ │ │ │ │ │ │ - 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, {}, {}); │ │ │ │ - } │ │ │ │ + // an optional string naming the software used │ │ │ │ + // to create the torrent file │ │ │ │ + std::string m_created_by; │ │ │ │ │ │ │ │ - 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); │ │ │ │ - } │ │ │ │ + // the info section parsed. points into m_info_section │ │ │ │ + // parsed lazily │ │ │ │ + mutable bdecode_node m_info_dict; │ │ │ │ │ │ │ │ - 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) │ │ │ │ + // if a creation date is found in the torrent file │ │ │ │ + // this will be set to that, otherwise it'll be │ │ │ │ + // 1970, Jan 1 │ │ │ │ + std::time_t m_creation_date = 0; │ │ │ │ + │ │ │ │ + // the hash(es) that identify this torrent │ │ │ │ + info_hash_t m_info_hash; │ │ │ │ + │ │ │ │ + // this is the offset into the m_info_section buffer to the first byte of │ │ │ │ + // the first SHA-1 hash │ │ │ │ + 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 │ │ │ │ +
    relevance 0../include/libtorrent/announce_entry.hpp:76include the number of peers received from this tracker, at last announce

    include the number of peers received from this tracker, at last │ │ │ │ +announce

    ../include/libtorrent/announce_entry.hpp:76

    │ │ │ │ +	struct TORRENT_EXPORT announce_infohash
    │ │ │ │  	{
    │ │ │ │ -		for (auto& n : m_nodes)
    │ │ │ │ -		{
    │ │ │ │ -			if (ep.protocol() != (n.first.get_external_address().is_v4() ? udp::v4() : udp::v6()))
    │ │ │ │ -
    relevance 0../src/kademlia/item.cpp:143implement ctor for entry from bdecode_node?

    implement ctor for entry from bdecode_node?

    ../src/kademlia/item.cpp:143

    	, secret_key const& sk)
    │ │ │ │ -{
    │ │ │ │ -	char str[1200];
    │ │ │ │ -	int const len = canonical_string(v, seq, salt, str);
    │ │ │ │ +		// internal
    │ │ │ │ +		TORRENT_UNEXPORT announce_infohash();
    │ │ │ │  
    │ │ │ │ -	return ed25519_sign({str, len}, pk, sk);
    │ │ │ │ -}
    │ │ │ │ +		// if this tracker has returned an error or warning message
    │ │ │ │ +		// that message is stored here
    │ │ │ │ +		std::string message;
    │ │ │ │  
    │ │ │ │ -item::item(public_key const& pk, span<char const> salt)
    │ │ │ │ -	: m_salt(salt.data(), static_cast<std::size_t>(salt.size()))
    │ │ │ │ -	, m_pk(pk)
    │ │ │ │ -	, m_mutable(true)
    │ │ │ │ -{}
    │ │ │ │ +		// if this tracker failed the last time it was contacted
    │ │ │ │ +		// this error code specifies what error occurred
    │ │ │ │ +		error_code last_error;
    │ │ │ │  
    │ │ │ │ -item::item(entry v)
    │ │ │ │ -	: m_value(std::move(v))
    │ │ │ │ -{}
    │ │ │ │ +		// the time of next tracker announce
    │ │ │ │ +		time_point32 next_announce = (time_point32::min)();
    │ │ │ │  
    │ │ │ │ -item::item(bdecode_node const& v)
    │ │ │ │ -{
    │ │ │ │ -
    m_value = v; │ │ │ │ -
    } │ │ │ │ + // no announces before this time │ │ │ │ + time_point32 min_announce = (time_point32::min)(); │ │ │ │ │ │ │ │ -item::item(entry v, span<char const> salt │ │ │ │ - , sequence_number const seq, public_key const& pk, secret_key const& sk) │ │ │ │ -{ │ │ │ │ - assign(std::move(v), salt, seq, pk, sk); │ │ │ │ -} │ │ │ │ +
    │ │ │ │ +
    // 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). │ │ │ │ │ │ │ │ -void item::assign(entry v) │ │ │ │ -{ │ │ │ │ - m_mutable = false; │ │ │ │ - m_value = std::move(v); │ │ │ │ -} │ │ │ │ + // 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; │ │ │ │ │ │ │ │ -void item::assign(entry v, span<char const> salt │ │ │ │ - , sequence_number const seq, public_key const& pk, secret_key const& sk) │ │ │ │ -{ │ │ │ │ - std::array<char, 1000> buffer; │ │ │ │ - int const bsize = bencode(buffer.begin(), v); │ │ │ │ - TORRENT_ASSERT(bsize <= 1000); │ │ │ │ - m_sig = sign_mutable_item(span<char const>(buffer).first(bsize) │ │ │ │ - , salt, seq, pk, sk); │ │ │ │ - m_salt.assign(salt.data(), static_cast<std::size_t>(salt.size())); │ │ │ │ - m_pk = pk; │ │ │ │ - m_seq = seq; │ │ │ │ - m_mutable = true; │ │ │ │ - m_value = std::move(v); │ │ │ │ -} │ │ │ │ + // the number of times in a row we have failed to announce to this │ │ │ │ + // tracker. │ │ │ │ + std::uint8_t fails : 7; │ │ │ │ │ │ │ │ -void item::assign(bdecode_node const& v) │ │ │ │ -
    relevance 0../include/libtorrent/torrent.hpp:280make this a raw pointer. perhaps keep the shared_ptr around further down the object to maintain an owner

    make this a raw pointer. perhaps keep the shared_ptr │ │ │ │ + // 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; │ │ │ │ +relevance 0../include/libtorrent/torrent.hpp:280make this a raw pointer. perhaps keep the shared_ptr around further down the object to maintain an owner

    make this a raw pointer. perhaps keep the shared_ptr │ │ │ │ around further down the object to maintain an owner

    ../include/libtorrent/torrent.hpp:280

    #endif
    │ │ │ │  	};
    │ │ │ │  
    │ │ │ │  	struct TORRENT_EXTRA_EXPORT torrent_hot_members
    │ │ │ │  	{
    │ │ │ │  		torrent_hot_members(aux::session_interface& ses
    │ │ │ │  			, add_torrent_params const& p, bool session_paused);
    │ │ │ │ @@ -10392,15 +10676,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
    │ │ │ │ -
    relevance 0../include/libtorrent/torrent.hpp:463make graceful pause also finish all sending blocks before disconnecting

    make graceful pause also finish all sending blocks │ │ │ │ +relevance 0../include/libtorrent/torrent.hpp:463make graceful pause also finish all sending blocks before disconnecting

    make graceful pause also finish all sending blocks │ │ │ │ before disconnecting

    ../include/libtorrent/torrent.hpp:463

    │ │ │ │  		void on_resume_data_checked(status_t status, storage_error const& error);
    │ │ │ │  		void on_force_recheck(status_t status, storage_error const& error);
    │ │ │ │  		void on_piece_hashed(aux::vector<sha256_hash> block_hashes
    │ │ │ │  			, piece_index_t piece, sha1_hash const& piece_hash
    │ │ │ │  			, storage_error const& error);
    │ │ │ │  		void files_checked();
    │ │ │ │ @@ -10444,15 +10728,15 @@
    │ │ │ │  		void read_piece(piece_index_t);
    │ │ │ │  		void on_disk_read_complete(disk_buffer_holder, storage_error const&
    │ │ │ │  			, peer_request const&, std::shared_ptr<read_piece_struct>);
    │ │ │ │  
    │ │ │ │  		storage_mode_t storage_mode() const;
    │ │ │ │  
    │ │ │ │  		// this will flag the torrent as aborted. The main
    │ │ │ │ -
    relevance 0../include/libtorrent/torrent.hpp:600make this flag a combination of the other ones

    make this flag a combination │ │ │ │ +relevance 0../include/libtorrent/torrent.hpp:600make this flag a combination of the other ones

    make this flag a combination │ │ │ │ of the other ones

    ../include/libtorrent/torrent.hpp:600

    		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;
    │ │ │ │ @@ -10496,15 +10780,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<download_priority_t, piece_index_t> const& pieces);
    │ │ │ │  		void prioritize_piece_list(std::vector<std::pair<piece_index_t, download_priority_t>> const& pieces);
    │ │ │ │  		void piece_priorities(aux::vector<download_priority_t, piece_index_t>*) const;
    │ │ │ │  
    │ │ │ │ -
    relevance 0../include/libtorrent/torrent.hpp:1381this wastes 5 bits per file

    this wastes 5 bits per file

    ../include/libtorrent/torrent.hpp:1381

    #ifndef TORRENT_DISABLE_EXTENSIONS
    │ │ │ │ +
    relevance 0../include/libtorrent/torrent.hpp:1381this wastes 5 bits per file

    this wastes 5 bits per file

    ../include/libtorrent/torrent.hpp:1381

    #ifndef TORRENT_DISABLE_EXTENSIONS
    │ │ │ │  		std::list<std::shared_ptr<torrent_plugin>> m_extensions;
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  		// used for tracker announces
    │ │ │ │  		deadline_timer m_tracker_timer;
    │ │ │ │  
    │ │ │ │  		// used to detect when we are active or inactive for long enough
    │ │ │ │ @@ -10547,15 +10831,15 @@
    │ │ │ │  #if TORRENT_ABI_VERSION == 1
    │ │ │ │  		// deprecated in 1.1
    │ │ │ │  		std::string m_username;
    │ │ │ │  		std::string m_password;
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  		std::string m_save_path;
    │ │ │ │ -
    relevance 0../include/libtorrent/torrent.hpp:1696this member can probably be removed

    this member can probably be removed

    ../include/libtorrent/torrent.hpp:1696

    		unsigned int m_num_uploads:24;
    │ │ │ │ +
    relevance 0../include/libtorrent/torrent.hpp:1696this member can probably be removed

    this member can probably be removed

    ../include/libtorrent/torrent.hpp:1696

    		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
    │ │ │ │ @@ -10598,68 +10882,15 @@
    │ │ │ │  		// 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!
    │ │ │ │ -
    relevance 0../include/libtorrent/torrent_info.hpp:729change the type to std::shared_ptr in C++17 it is used as if immutable, it cannot be const for technical reasons right now.

    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.

    ../include/libtorrent/torrent_info.hpp:729

    │ │ │ │ -		// 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<std::string> m_owned_collections;
    │ │ │ │ -
    │ │ │ │ -#if TORRENT_ABI_VERSION <= 2
    │ │ │ │ -		// if this is a merkle torrent, this is the merkle
    │ │ │ │ -		// tree. It has space for merkle_num_nodes(merkle_num_leafs(num_pieces))
    │ │ │ │ -		// hashes
    │ │ │ │ -		aux::vector<sha1_hash> m_merkle_tree;
    │ │ │ │ -#endif
    │ │ │ │ -
    │ │ │ │ -		// v2 merkle tree for each file
    │ │ │ │ -		// the actual hash buffers are always divisible by 32 (sha256_hash::size())
    │ │ │ │ -		aux::vector<aux::vector<char>, file_index_t> m_piece_layers;
    │ │ │ │ -
    │ │ │ │ -		// this is a copy of the info section from the torrent.
    │ │ │ │ -		// it use maintained in this flat format in order to
    │ │ │ │ -		// make it available through the metadata extension
    │ │ │ │ -
    boost::shared_array<char> m_info_section; │ │ │ │ -
    │ │ │ │ - // if a comment is found in the torrent file │ │ │ │ - // this will be set to that comment │ │ │ │ - std::string m_comment; │ │ │ │ - │ │ │ │ - // an optional string naming the software used │ │ │ │ - // to create the torrent file │ │ │ │ - std::string m_created_by; │ │ │ │ - │ │ │ │ - // the info section parsed. points into m_info_section │ │ │ │ - // parsed lazily │ │ │ │ - mutable bdecode_node m_info_dict; │ │ │ │ - │ │ │ │ - // if a creation date is found in the torrent file │ │ │ │ - // this will be set to that, otherwise it'll be │ │ │ │ - // 1970, Jan 1 │ │ │ │ - std::time_t m_creation_date = 0; │ │ │ │ - │ │ │ │ - // the hash(es) that identify this torrent │ │ │ │ - info_hash_t m_info_hash; │ │ │ │ - │ │ │ │ - // this is the offset into the m_info_section buffer to the first byte of │ │ │ │ - // the first SHA-1 hash │ │ │ │ - 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 │ │ │ │ -
    relevance 0../include/libtorrent/proxy_base.hpp:227it would be nice to remember the bind port and bind once we know where the proxy is m_sock.bind(endpoint, ec);

    it would be nice to remember the bind port and bind once we know where the proxy is │ │ │ │ +relevance 0../include/libtorrent/proxy_base.hpp:227it would be nice to remember the bind port and bind once we know where the proxy is m_sock.bind(endpoint, ec);

    it would be nice to remember the bind port and bind once we know where the proxy is │ │ │ │ m_sock.bind(endpoint, ec);

    ../include/libtorrent/proxy_base.hpp:227

    		TORRENT_ASSERT(m_magic == 0x1337);
    │ │ │ │  		m_sock.cancel();
    │ │ │ │  	}
    │ │ │ │  
    │ │ │ │  	void cancel(error_code& ec)
    │ │ │ │  	{
    │ │ │ │  		TORRENT_ASSERT(m_magic == 0x1337);
    │ │ │ │ @@ -10703,49 +10934,15 @@
    │ │ │ │  		m_resolver.cancel();
    │ │ │ │  	}
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  	void close(error_code& ec)
    │ │ │ │  	{
    │ │ │ │  		TORRENT_ASSERT(m_magic == 0x1337);
    │ │ │ │ -
    relevance 0../include/libtorrent/performance_counters.hpp:485some space could be saved here by making gauges 32 bits

    some space could be saved here by making gauges 32 bits

    ../include/libtorrent/performance_counters.hpp:485

    relevance 0../include/libtorrent/performance_counters.hpp:486restore these to regular integers. Instead have one copy of the counters per thread and collect them at convenient synchronization points

    restore these to regular integers. Instead have one copy │ │ │ │ -of the counters per thread and collect them at convenient │ │ │ │ -synchronization points

    ../include/libtorrent/performance_counters.hpp:486

    #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 │ │ │ │ - }; │ │ │ │ -} │ │ │ │ - │ │ │ │ -#endif │ │ │ │ -
    relevance 0../include/libtorrent/peer_connection_interface.hpp:51make this interface smaller!

    make this interface smaller!

    ../include/libtorrent/peer_connection_interface.hpp:51

    │ │ │ │ +
    relevance 0../include/libtorrent/peer_connection_interface.hpp:51make this interface smaller!

    make this interface smaller!

    ../include/libtorrent/peer_connection_interface.hpp:51

    │ │ │ │  */
    │ │ │ │  
    │ │ │ │  #ifndef TORRENT_PEER_CONNECTION_INTERFACE_HPP
    │ │ │ │  #define TORRENT_PEER_CONNECTION_INTERFACE_HPP
    │ │ │ │  
    │ │ │ │  #include "libtorrent/fwd.hpp"
    │ │ │ │  #include "libtorrent/socket.hpp"
    │ │ │ │ @@ -10788,116 +10985,15 @@
    │ │ │ │  		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;
    │ │ │ │  #endif
    │ │ │ │ -
    relevance 0../include/libtorrent/piece_picker.hpp:823should this be allocated lazily?

    should this be allocated lazily?

    ../include/libtorrent/piece_picker.hpp:823

    		// download list it may live in now
    │ │ │ │ -		std::vector<downloading_piece>::iterator update_piece_state(
    │ │ │ │ -			std::vector<downloading_piece>::iterator dp);
    │ │ │ │ -
    │ │ │ │ -	private:
    │ │ │ │ -
    │ │ │ │ -#if TORRENT_USE_ASSERTS || TORRENT_USE_INVARIANT_CHECKS
    │ │ │ │ -		index_range<download_queue_t> categories() const
    │ │ │ │ -		{ return {{}, piece_picker::piece_pos::num_download_categories}; }
    │ │ │ │ -#endif
    │ │ │ │ -
    │ │ │ │ -		// the following vectors are mutable because they sometimes may
    │ │ │ │ -		// be updated lazily, triggered by const functions
    │ │ │ │ -
    │ │ │ │ -		// 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; │ │ │ │ -
    │ │ │ │ - // 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; │ │ │ │ - │ │ │ │ - // 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; │ │ │ │ - │ │ │ │ - // 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; │ │ │ │ - │ │ │ │ - // the number of pad blocks part of filtered pieces we don't have │ │ │ │ - std::int64_t m_filtered_pad_bytes = 0; │ │ │ │ - │ │ │ │ - // 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; │ │ │ │ - │ │ │ │ - // this vector contains all piece indices that are pickable │ │ │ │ -
    relevance 0../include/libtorrent/piece_picker.hpp:895it would be more intuitive to account "wanted" pieces instead of filtered

    it would be more intuitive to account "wanted" pieces │ │ │ │ -instead of filtered

    ../include/libtorrent/piece_picker.hpp:895

    │ │ │ │ -		// 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;
    │ │ │ │ -
    │ │ │ │ -		// 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;
    │ │ │ │ -
    │ │ │ │ -		std::uint16_t m_blocks_in_last_piece = 0;
    │ │ │ │ -		int m_piece_size = 0;
    │ │ │ │ -		std::int64_t m_total_size = 0;
    │ │ │ │ -
    │ │ │ │ -		// 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; │ │ │ │ -
    │ │ │ │ - // 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}; │ │ │ │ - │ │ │ │ - // 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}; │ │ │ │ - │ │ │ │ - // 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; │ │ │ │ - │ │ │ │ - // if this is set to true, it means update_pieces() │ │ │ │ - // has to be called before accessing m_pieces. │ │ │ │ - mutable bool m_dirty = false; │ │ │ │ - public: │ │ │ │ - │ │ │ │ - enum { max_pieces = (std::numeric_limits<int>::max)() - 1 }; │ │ │ │ - │ │ │ │ - }; │ │ │ │ -} │ │ │ │ - │ │ │ │ -#endif // TORRENT_PIECE_PICKER_HPP_INCLUDED │ │ │ │ -
    relevance 0../include/libtorrent/upnp.hpp:162support using the windows API for UPnP operations as well

    support using the windows API for UPnP operations as well

    ../include/libtorrent/upnp.hpp:162

    {
    │ │ │ │ +
    relevance 0../include/libtorrent/upnp.hpp:162support using the windows API for UPnP operations as well

    support using the windows API for UPnP operations as well

    ../include/libtorrent/upnp.hpp:162

    {
    │ │ │ │  	bool in_error_code = false;
    │ │ │ │  	bool exit = false;
    │ │ │ │  	int error_code = -1;
    │ │ │ │  };
    │ │ │ │  
    │ │ │ │  struct ip_address_parse_state: error_code_parse_state
    │ │ │ │  {
    │ │ │ │ @@ -10940,272 +11036,49 @@
    │ │ │ │  	// ``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
    │ │ │ │ -
    relevance 0../include/libtorrent/socks5_stream.hpp:197we could bind the socket here, since we know what the target endpoint is of the proxy

    we could bind the socket here, since we know what the │ │ │ │ -target endpoint is of the proxy

    ../include/libtorrent/socks5_stream.hpp:197

    			}, 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 │ │ │ │ - } │ │ │ │ - ADD_OUTSTANDING_ASYNC("socks5_stream::handshake1"); │ │ │ │ -
    relevance 0../include/libtorrent/string_view.hpp:40replace this by the standard string_view in C++17

    replace this by the standard string_view in C++17

    ../include/libtorrent/string_view.hpp:40

    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.
    │ │ │ │ -
    │ │ │ │ -*/
    │ │ │ │ -
    │ │ │ │ -#ifndef TORRENT_STRING_VIEW_HPP_INCLUDED
    │ │ │ │ -#define TORRENT_STRING_VIEW_HPP_INCLUDED
    │ │ │ │ -
    │ │ │ │ -#include <boost/version.hpp>
    │ │ │ │ -
    │ │ │ │ -#include "libtorrent/aux_/disable_warnings_push.hpp"
    │ │ │ │ -
    │ │ │ │ -
    │ │ │ │ -
    #if BOOST_VERSION < 106100 │ │ │ │ -#include <boost/utility/string_ref.hpp> │ │ │ │ -#include <cstring> // for strchr │ │ │ │ -namespace libtorrent { │ │ │ │ - │ │ │ │ -using string_view = boost::string_ref; │ │ │ │ -using wstring_view = boost::wstring_ref; │ │ │ │ - │ │ │ │ -// internal │ │ │ │ -inline string_view::size_type find_first_of(string_view const v, char const c │ │ │ │ - , string_view::size_type pos) │ │ │ │ -{ │ │ │ │ - while (pos < v.size()) │ │ │ │ - { │ │ │ │ - if (v[pos] == c) return pos; │ │ │ │ - ++pos; │ │ │ │ - } │ │ │ │ - return string_view::npos; │ │ │ │ -} │ │ │ │ - │ │ │ │ -// internal │ │ │ │ -inline string_view::size_type find_first_of(string_view const v, char const* c │ │ │ │ - , string_view::size_type pos) │ │ │ │ -{ │ │ │ │ - while (pos < v.size()) │ │ │ │ - { │ │ │ │ - if (std::strchr(c, v[pos]) != nullptr) return pos; │ │ │ │ - ++pos; │ │ │ │ - } │ │ │ │ - return string_view::npos; │ │ │ │ -
    relevance 0../include/libtorrent/identify_client.hpp:48hide this declaration when deprecated functions are disabled, and remove its internal use

    hide this declaration when deprecated functions are disabled, and │ │ │ │ -remove its internal use

    ../include/libtorrent/identify_client.hpp:48

    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"
    │ │ │ │ +
    relevance 0../include/libtorrent/performance_counters.hpp:485some space could be saved here by making gauges 32 bits

    some space could be saved here by making gauges 32 bits

    ../include/libtorrent/performance_counters.hpp:485

    relevance 0../include/libtorrent/performance_counters.hpp:486restore these to regular integers. Instead have one copy of the counters per thread and collect them at convenient synchronization points

    restore these to regular integers. Instead have one copy │ │ │ │ +of the counters per thread and collect them at convenient │ │ │ │ +synchronization points

    ../include/libtorrent/performance_counters.hpp:486

    #ifdef ATOMIC_LLONG_LOCK_FREE
    │ │ │ │ +#define TORRENT_COUNTER_NOEXCEPT noexcept
    │ │ │ │ +#else
    │ │ │ │ +#define TORRENT_COUNTER_NOEXCEPT
    │ │ │ │  #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); │ │ │ │ - │ │ │ │ -#if TORRENT_ABI_VERSION == 1 │ │ │ │ - │ │ │ │ -#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp" │ │ │ │ - │ │ │ │ - // 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); │ │ │ │ - │ │ │ │ -#include "libtorrent/aux_/disable_warnings_pop.hpp" │ │ │ │ -
    relevance 0../include/libtorrent/i2p_stream.hpp:533make this a string_view

    make this a string_view

    ../include/libtorrent/i2p_stream.hpp:533

    │ │ │ │ -		char tmp[20];
    │ │ │ │ -		aux::random_bytes(tmp);
    │ │ │ │ -		m_session_id.resize(sizeof(tmp)*2);
    │ │ │ │ -		aux::to_hex(tmp, &m_session_id[0]);
    │ │ │ │ -
    │ │ │ │ -		m_sam_socket = std::make_shared<i2p_stream>(m_io_service);
    │ │ │ │ -		m_sam_socket->set_proxy(m_hostname, m_port);
    │ │ │ │ -		m_sam_socket->set_command(i2p_stream::cmd_create_session);
    │ │ │ │ -		m_sam_socket->set_session_id(m_session_id.c_str());
    │ │ │ │ -		m_sam_socket->set_session_options(session_options);
    │ │ │ │ -
    │ │ │ │ -		ADD_OUTSTANDING_ASYNC("i2p_stream::on_sam_connect");
    │ │ │ │ -		m_sam_socket->async_connect(tcp::endpoint(), wrap_allocator(
    │ │ │ │ -			[this,s=m_sam_socket](error_code const& ec, Handler hn) {
    │ │ │ │ -				on_sam_connect(ec, s, std::move(hn));
    │ │ │ │ -			}, std::move(handler)));
    │ │ │ │ -	}
    │ │ │ │ -	void close(error_code&);
    │ │ │ │ -
    │ │ │ │ -
    char const* session_id() const { return m_session_id.c_str(); } │ │ │ │ -
    std::string const& local_endpoint() const { return m_i2p_local_endpoint; } │ │ │ │ - │ │ │ │ - template <typename Handler> │ │ │ │ - void async_name_lookup(char const* name, Handler handler) │ │ │ │ - { │ │ │ │ - if (m_state == sam_idle && m_name_lookup.empty() && is_open()) │ │ │ │ - do_name_lookup(name, std::move(handler)); │ │ │ │ - else │ │ │ │ - m_name_lookup.emplace_back(std::string(name) │ │ │ │ - , std::move(handler)); │ │ │ │ - } │ │ │ │ - │ │ │ │ -private: │ │ │ │ - │ │ │ │ - template <typename Handler> │ │ │ │ - void on_sam_connect(error_code const& ec, std::shared_ptr<i2p_stream>, Handler h) │ │ │ │ - { │ │ │ │ - COMPLETE_ASYNC("i2p_stream::on_sam_connect"); │ │ │ │ - m_state = sam_idle; │ │ │ │ - │ │ │ │ - if (ec) │ │ │ │ - { │ │ │ │ - h(ec); │ │ │ │ - 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)); │ │ │ │ - }, std::move(h))); │ │ │ │ -
    relevance 0../include/libtorrent/hash_picker.hpp:155support batched adding of block hashes for reduced overhead?

    support batched adding of block hashes for reduced overhead?

    ../include/libtorrent/hash_picker.hpp:155

    		// 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);
    │ │ │ │ +		counters() TORRENT_COUNTER_NOEXCEPT;
    │ │ │ │  
    │ │ │ │ -		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); │ │ │ │ + counters(counters const&) TORRENT_COUNTER_NOEXCEPT; │ │ │ │ + counters& operator=(counters const&) & TORRENT_COUNTER_NOEXCEPT; │ │ │ │ │ │ │ │ - // 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; │ │ │ │ + // 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; │ │ │ │ │ │ │ │ - int piece_layer() const { return m_piece_layer; } │ │ │ │ + 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: │ │ │ │ - // 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; │ │ │ │ - }; │ │ │ │ +
    #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 │ │ │ │ + }; │ │ │ │ +} │ │ │ │ │ │ │ │ - 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; │ │ │ │ -
    relevance 0../include/libtorrent/peer_connection.hpp:218make 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

    make this a raw pointer (to save size in │ │ │ │ +#endif │ │ │ │ +relevance 0../include/libtorrent/peer_connection.hpp:218make 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

    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

    ../include/libtorrent/peer_connection.hpp:218

    			, m_snubbed(false)
    │ │ │ │  			, m_interesting(false)
    │ │ │ │  			, m_choked(true)
    │ │ │ │  			, m_ignore_stats(false)
    │ │ │ │  		{}
    │ │ │ │ @@ -11251,15 +11124,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
    │ │ │ │ -
    relevance 0../include/libtorrent/peer_connection.hpp:1026factor this out into its own class with a virtual interface torrent and session should implement this interface

    factor this out into its own class with a virtual interface │ │ │ │ +relevance 0../include/libtorrent/peer_connection.hpp:1026factor this out into its own class with a virtual interface torrent and session should implement this interface

    factor this out into its own class with a virtual interface │ │ │ │ torrent and session should implement this interface

    ../include/libtorrent/peer_connection.hpp:1026

    │ │ │ │  		// 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.
    │ │ │ │ @@ -11303,92 +11176,255 @@
    │ │ │ │  		// 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
    │ │ │ │ -
    relevance 0../include/libtorrent/socket_type.hpp:60move to aux

    move to aux

    ../include/libtorrent/socket_type.hpp:60

    namespace libtorrent {
    │ │ │ │ +
    relevance 0../include/libtorrent/identify_client.hpp:48hide this declaration when deprecated functions are disabled, and remove its internal use

    hide this declaration when deprecated functions are disabled, and │ │ │ │ +remove its internal use

    ../include/libtorrent/identify_client.hpp:48

    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.
    │ │ │ │  
    │ │ │ │ -// 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,
    │ │ │ │ +#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
    │ │ │ │ -};
    │ │ │ │  
    │ │ │ │ -// return a short human readable name for types of socket
    │ │ │ │ -
    char const* socket_type_name(socket_type_t); │ │ │ │ +#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); │ │ │ │ + │ │ │ │ } │ │ │ │ │ │ │ │ -#endif │ │ │ │ -
    relevance 0../include/libtorrent/announce_entry.hpp:76include the number of peers received from this tracker, at last announce

    include the number of peers received from this tracker, at last │ │ │ │ -announce

    ../include/libtorrent/announce_entry.hpp:76

    │ │ │ │ -	struct TORRENT_EXPORT announce_infohash
    │ │ │ │ -	{
    │ │ │ │ -		// internal
    │ │ │ │ -		TORRENT_UNEXPORT announce_infohash();
    │ │ │ │ +	// these functions don't really need to be public. This mechanism of
    │ │ │ │ +	// advertising client software and version is also out-dated.
    │ │ │ │  
    │ │ │ │ -		// if this tracker has returned an error or warning message
    │ │ │ │ -		// that message is stored here
    │ │ │ │ -		std::string message;
    │ │ │ │ +	// 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);
    │ │ │ │  
    │ │ │ │ -		// if this tracker failed the last time it was contacted
    │ │ │ │ -		// this error code specifies what error occurred
    │ │ │ │ -		error_code last_error;
    │ │ │ │ +#if TORRENT_ABI_VERSION == 1
    │ │ │ │  
    │ │ │ │ -		// the time of next tracker announce
    │ │ │ │ -		time_point32 next_announce = (time_point32::min)();
    │ │ │ │ +#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
    │ │ │ │  
    │ │ │ │ -		// no announces before this time
    │ │ │ │ -		time_point32 min_announce = (time_point32::min)();
    │ │ │ │ +	// 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);
    │ │ │ │ +
    │ │ │ │ +#include "libtorrent/aux_/disable_warnings_pop.hpp"
    │ │ │ │ +
    relevance 0../include/libtorrent/string_view.hpp:40replace this by the standard string_view in C++17

    replace this by the standard string_view in C++17

    ../include/libtorrent/string_view.hpp:40

    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.
    │ │ │ │ +
    │ │ │ │ +*/
    │ │ │ │ +
    │ │ │ │ +#ifndef TORRENT_STRING_VIEW_HPP_INCLUDED
    │ │ │ │ +#define TORRENT_STRING_VIEW_HPP_INCLUDED
    │ │ │ │ +
    │ │ │ │ +#include <boost/version.hpp>
    │ │ │ │ +
    │ │ │ │ +#include "libtorrent/aux_/disable_warnings_push.hpp"
    │ │ │ │  
    │ │ │ │  
    │ │ │ │ -
    // 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 BOOST_VERSION < 106100 │ │ │ │ +#include <boost/utility/string_ref.hpp> │ │ │ │ +#include <cstring> // for strchr │ │ │ │ +namespace libtorrent { │ │ │ │ │ │ │ │ - // 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; │ │ │ │ +using string_view = boost::string_ref; │ │ │ │ +using wstring_view = boost::wstring_ref; │ │ │ │ │ │ │ │ - // the number of times in a row we have failed to announce to this │ │ │ │ - // tracker. │ │ │ │ - std::uint8_t fails : 7; │ │ │ │ +// internal │ │ │ │ +inline string_view::size_type find_first_of(string_view const v, char const c │ │ │ │ + , string_view::size_type pos) │ │ │ │ +{ │ │ │ │ + while (pos < v.size()) │ │ │ │ + { │ │ │ │ + if (v[pos] == c) return pos; │ │ │ │ + ++pos; │ │ │ │ + } │ │ │ │ + return string_view::npos; │ │ │ │ +} │ │ │ │ │ │ │ │ - // true while we're waiting for a response from the tracker. │ │ │ │ - bool updating : 1; │ │ │ │ +// internal │ │ │ │ +inline string_view::size_type find_first_of(string_view const v, char const* c │ │ │ │ + , string_view::size_type pos) │ │ │ │ +{ │ │ │ │ + while (pos < v.size()) │ │ │ │ + { │ │ │ │ + if (std::strchr(c, v[pos]) != nullptr) return pos; │ │ │ │ + ++pos; │ │ │ │ + } │ │ │ │ + return string_view::npos; │ │ │ │ +
    relevance 0../include/libtorrent/piece_picker.hpp:823should this be allocated lazily?

    should this be allocated lazily?

    ../include/libtorrent/piece_picker.hpp:823

    		// download list it may live in now
    │ │ │ │ +		std::vector<downloading_piece>::iterator update_piece_state(
    │ │ │ │ +			std::vector<downloading_piece>::iterator dp);
    │ │ │ │  
    │ │ │ │ -		// 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;
    │ │ │ │ +	private:
    │ │ │ │  
    │ │ │ │ -		// set to true when we send a event=completed.
    │ │ │ │ -		bool complete_sent : 1;
    │ │ │ │ -
    relevance 0../include/libtorrent/kademlia/item.hpp:61since this is a public function, it should probably be moved out of this header and into one with other public functions.

    since this is a public function, it should probably be moved │ │ │ │ +#if TORRENT_USE_ASSERTS || TORRENT_USE_INVARIANT_CHECKS │ │ │ │ + index_range<download_queue_t> categories() const │ │ │ │ + { return {{}, piece_picker::piece_pos::num_download_categories}; } │ │ │ │ +#endif │ │ │ │ + │ │ │ │ + // the following vectors are mutable because they sometimes may │ │ │ │ + // be updated lazily, triggered by const functions │ │ │ │ + │ │ │ │ + // 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; │ │ │ │ +
    │ │ │ │ + // 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; │ │ │ │ + │ │ │ │ + // 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; │ │ │ │ + │ │ │ │ + // 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; │ │ │ │ + │ │ │ │ + // the number of pad blocks part of filtered pieces we don't have │ │ │ │ + std::int64_t m_filtered_pad_bytes = 0; │ │ │ │ + │ │ │ │ + // 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; │ │ │ │ + │ │ │ │ + // this vector contains all piece indices that are pickable │ │ │ │ +relevance 0../include/libtorrent/piece_picker.hpp:895it would be more intuitive to account "wanted" pieces instead of filtered

    it would be more intuitive to account "wanted" pieces │ │ │ │ +instead of filtered

    ../include/libtorrent/piece_picker.hpp:895

    │ │ │ │ +		// 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;
    │ │ │ │ +
    │ │ │ │ +		// 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;
    │ │ │ │ +
    │ │ │ │ +		std::uint16_t m_blocks_in_last_piece = 0;
    │ │ │ │ +		int m_piece_size = 0;
    │ │ │ │ +		std::int64_t m_total_size = 0;
    │ │ │ │ +
    │ │ │ │ +		// 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; │ │ │ │ +
    │ │ │ │ + // 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}; │ │ │ │ + │ │ │ │ + // 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}; │ │ │ │ + │ │ │ │ + // 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; │ │ │ │ + │ │ │ │ + // if this is set to true, it means update_pieces() │ │ │ │ + // has to be called before accessing m_pieces. │ │ │ │ + mutable bool m_dirty = false; │ │ │ │ + public: │ │ │ │ + │ │ │ │ + enum { max_pieces = (std::numeric_limits<int>::max)() - 1 }; │ │ │ │ + │ │ │ │ + }; │ │ │ │ +} │ │ │ │ + │ │ │ │ +#endif // TORRENT_PIECE_PICKER_HPP_INCLUDED │ │ │ │ +
    relevance 0../include/libtorrent/kademlia/msg.hpp:87move this to its own .hpp/.cpp pair?

    move this to its own .hpp/.cpp pair?

    ../include/libtorrent/kademlia/msg.hpp:87

    	int flags;
    │ │ │ │ +
    │ │ │ │ +	enum {
    │ │ │ │ +		// this argument is optional, parsing will not
    │ │ │ │ +		// fail if it's not present
    │ │ │ │ +		optional = 1,
    │ │ │ │ +		// for dictionaries, the following entries refer
    │ │ │ │ +		// to child nodes to this node, up until and including
    │ │ │ │ +		// the next item that has the last_child flag set.
    │ │ │ │ +		// these flags are nestable
    │ │ │ │ +		parse_children = 2,
    │ │ │ │ +		// this is the last item in a child dictionary
    │ │ │ │ +		last_child = 4,
    │ │ │ │ +		// the size argument refers to that the size
    │ │ │ │ +		// has to be divisible by the number, instead
    │ │ │ │ +		// of having that exact size
    │ │ │ │ +		size_divisible = 8
    │ │ │ │ +	};
    │ │ │ │ +};
    │ │ │ │ +
    │ │ │ │ +
    TORRENT_EXTRA_EXPORT bool verify_message_impl(bdecode_node const& message, span<key_desc_t const> desc │ │ │ │ +
    , span<bdecode_node> ret, span<char> error); │ │ │ │ + │ │ │ │ +// verifies that a message has all the required │ │ │ │ +// entries and returns them in ret │ │ │ │ +template <int Size> │ │ │ │ +bool verify_message(bdecode_node const& msg, key_desc_t const (&desc)[Size] │ │ │ │ + , bdecode_node (&ret)[Size], span<char> error) │ │ │ │ +{ │ │ │ │ + return verify_message_impl(msg, desc, ret, error); │ │ │ │ +} │ │ │ │ + │ │ │ │ +} │ │ │ │ +} │ │ │ │ + │ │ │ │ +#endif │ │ │ │ +
    relevance 0../include/libtorrent/kademlia/item.hpp:61since this is a public function, it should probably be moved out of this header and into one with other public functions.

    since this is a public function, it should probably be moved │ │ │ │ out of this header and into one with other public functions.

    ../include/libtorrent/kademlia/item.hpp:61

    #include <libtorrent/span.hpp>
    │ │ │ │  #include <libtorrent/kademlia/types.hpp>
    │ │ │ │  
    │ │ │ │  namespace libtorrent {
    │ │ │ │  namespace dht {
    │ │ │ │  
    │ │ │ │  // calculate the target hash for an immutable item.
    │ │ │ │ @@ -11432,257 +11468,50 @@
    │ │ │ │  		, 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
    │ │ │ │  		, public_key const& pk
    │ │ │ │ -
    relevance 0../include/libtorrent/kademlia/msg.hpp:87move this to its own .hpp/.cpp pair?

    move this to its own .hpp/.cpp pair?

    ../include/libtorrent/kademlia/msg.hpp:87

    	int flags;
    │ │ │ │ +
    relevance 0../include/libtorrent/aux_/pool.hpp:49ensure the alignment is good here

    ensure the alignment is good here

    ../include/libtorrent/aux_/pool.hpp:49

    POSSIBILITY OF SUCH DAMAGE.
    │ │ │ │  
    │ │ │ │ -	enum {
    │ │ │ │ -		// this argument is optional, parsing will not
    │ │ │ │ -		// fail if it's not present
    │ │ │ │ -		optional = 1,
    │ │ │ │ -		// for dictionaries, the following entries refer
    │ │ │ │ -		// to child nodes to this node, up until and including
    │ │ │ │ -		// the next item that has the last_child flag set.
    │ │ │ │ -		// these flags are nestable
    │ │ │ │ -		parse_children = 2,
    │ │ │ │ -		// this is the last item in a child dictionary
    │ │ │ │ -		last_child = 4,
    │ │ │ │ -		// the size argument refers to that the size
    │ │ │ │ -		// has to be divisible by the number, instead
    │ │ │ │ -		// of having that exact size
    │ │ │ │ -		size_divisible = 8
    │ │ │ │ -	};
    │ │ │ │ -};
    │ │ │ │ -
    │ │ │ │ -
    TORRENT_EXTRA_EXPORT bool verify_message_impl(bdecode_node const& message, span<key_desc_t const> desc │ │ │ │ -
    , span<bdecode_node> ret, span<char> error); │ │ │ │ - │ │ │ │ -// verifies that a message has all the required │ │ │ │ -// entries and returns them in ret │ │ │ │ -template <int Size> │ │ │ │ -bool verify_message(bdecode_node const& msg, key_desc_t const (&desc)[Size] │ │ │ │ - , bdecode_node (&ret)[Size], span<char> error) │ │ │ │ -{ │ │ │ │ - return verify_message_impl(msg, desc, ret, error); │ │ │ │ -} │ │ │ │ +*/ │ │ │ │ │ │ │ │ -} │ │ │ │ -} │ │ │ │ +#ifndef TORRENT_POOL_HPP │ │ │ │ +#define TORRENT_POOL_HPP │ │ │ │ │ │ │ │ -#endif │ │ │ │ -
    relevance 0../include/libtorrent/aux_/merkle_tree.hpp:85remove 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

    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

    ../include/libtorrent/aux_/merkle_tree.hpp:85

    // 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.
    │ │ │ │ +#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"
    │ │ │ │  
    │ │ │ │ -// The leaf blocks on the other hand, MAY be invalid. For instance, when adding
    │ │ │ │ -// a magnet link for a torrent that we already have files for. Once we have the
    │ │ │ │ -// metadata, we have files on disk but no hashes. We won't know whether the data
    │ │ │ │ -// on disk is valid or not, until we've downloaded the hashes to validate them.
    │ │ │ │ +namespace libtorrent {
    │ │ │ │ +namespace aux {
    │ │ │ │  
    │ │ │ │ -// Idea for future space optimization:
    │ │ │ │ -// while downloading, we need to store interior nodes of this tree. However, we
    │ │ │ │ -// don't need to store the padding. a SHA-256 is 32 bytes. Instead of storing
    │ │ │ │ -// the full (padded) tree of SHA-256 hashes, store the full tree of 32 bit
    │ │ │ │ -// signed integers, being indices into the actual storage for the tree. We could
    │ │ │ │ -// even grow the storage lazily. Instead of storing the padding hashes, use
    │ │ │ │ -// negative indices to refer to fixed SHA-256(0), and SHA-256(SHA-256(0)) and so
    │ │ │ │ -// on
    │ │ │ │ -struct TORRENT_EXTRA_EXPORT merkle_tree
    │ │ │ │ +struct allocator_new_delete
    │ │ │ │  {
    │ │ │ │ -
    merkle_tree() = default; │ │ │ │ -
    merkle_tree(int num_blocks, int blocks_per_piece, char const* r); │ │ │ │ - │ │ │ │ - sha256_hash root() const; │ │ │ │ - │ │ │ │ - void load_tree(span<sha256_hash const> t, std::vector<bool> const& verified); │ │ │ │ - void load_sparse_tree(span<sha256_hash const> t, std::vector<bool> const& mask │ │ │ │ - , std::vector<bool> const& verified); │ │ │ │ - void load_verified_bits(std::vector<bool> const& verified); │ │ │ │ - │ │ │ │ - std::size_t size() const; │ │ │ │ - int end_index() const { return int(size()); } │ │ │ │ - │ │ │ │ - bool has_node(int idx) const; │ │ │ │ - │ │ │ │ - bool compare_node(int idx, sha256_hash const& h) const; │ │ │ │ - │ │ │ │ - sha256_hash operator[](int idx) const; │ │ │ │ - │ │ │ │ - std::vector<sha256_hash> build_vector() const; │ │ │ │ - std::pair<std::vector<sha256_hash>, aux::vector<bool>> build_sparse_vector() const; │ │ │ │ - │ │ │ │ - // get bits indicating if each leaf hash is verified │ │ │ │ - std::vector<bool> verified_leafs() const; │ │ │ │ - │ │ │ │ - // 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; │ │ │ │ - │ │ │ │ -
    relevance 0../include/libtorrent/aux_/merkle_tree.hpp:175make this a std::unique_ptr

    make this a std::unique_ptr

    ../include/libtorrent/aux_/merkle_tree.hpp:175

    │ │ │ │ -	int blocks_per_piece() const { return 1 << 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;
    │ │ │ │ -	int num_pieces() const;
    │ │ │ │ -	int num_leafs() const;
    │ │ │ │ -
    │ │ │ │ -	void optimize_storage();
    │ │ │ │ -	void optimize_storage_piece_layer();
    │ │ │ │ -	void allocate_full();
    │ │ │ │ -
    │ │ │ │ -	// a pointer to the root hash for this file.
    │ │ │ │ -	char const* m_root = nullptr;
    │ │ │ │ -
    │ │ │ │ -	// this is either the full tree, or some sparse representation of it,
    │ │ │ │ -	// depending on m_mode
    │ │ │ │ -
    aux::vector<sha256_hash> m_tree; │ │ │ │ -
    │ │ │ │ - // when the full tree is allocated, this has one bit for each block hash. a │ │ │ │ - // 1 means we have verified the block hash to be correct, otherwise the block │ │ │ │ - // hash may represent what's on disk, but we haven't been able to verify it │ │ │ │ - // yet │ │ │ │ - bitfield m_block_verified; │ │ │ │ - │ │ │ │ - // number of blocks in the file this tree represents. The number of leafs in │ │ │ │ - // the tree is rounded up to an even power of 2. │ │ │ │ - int m_num_blocks = 0; │ │ │ │ - │ │ │ │ - // the number of blocks per piece, specified as how many steps to shift │ │ │ │ - // right 1 to get the number of blocks in one piece. This is a compact │ │ │ │ - // representation that's valid because pieces are always powers of 2. │ │ │ │ - // this is necessary to know which layer in the tree the piece layer is. │ │ │ │ - std::uint8_t m_blocks_per_piece_log = 0; │ │ │ │ - │ │ │ │ - enum class mode_t : std::uint8_t │ │ │ │ - { │ │ │ │ - // a default constructed tree is truly empty. It does not even have a │ │ │ │ - // root hash │ │ │ │ - uninitialized_tree, │ │ │ │ - │ │ │ │ - // 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, │ │ │ │ - │ │ │ │ -
    relevance 0../include/libtorrent/aux_/allocating_handler.hpp:316in C++17, Handler and Storage could just use "auto"

    in C++17, Handler and Storage could just use "auto"

    ../include/libtorrent/aux_/allocating_handler.hpp:316

    │ │ │ │ -	private:
    │ │ │ │ -
    │ │ │ │ -		Handler handler;
    │ │ │ │ -		handler_storage<Size, Name>* storage;
    │ │ │ │ -#ifndef BOOST_NO_EXCEPTIONS
    │ │ │ │ -		error_handler_interface* error_handler;
    │ │ │ │ -#endif
    │ │ │ │ -	};
    │ │ │ │ -
    │ │ │ │ -	template <class Handler, size_t Size, HandlerName Name>
    │ │ │ │ -	aux::allocating_handler<Handler, Size, Name>
    │ │ │ │ -	make_handler(Handler handler
    │ │ │ │ -		, handler_storage<Size, Name>& storage
    │ │ │ │ -		, error_handler_interface& err_handler)
    │ │ │ │ -	{
    │ │ │ │ -		return aux::allocating_handler<Handler, Size, Name>(
    │ │ │ │ -			std::forward<Handler>(handler), &storage, &err_handler);
    │ │ │ │ -	}
    │ │ │ │ -
    │ │ │ │ -
    template <typename T │ │ │ │ -
    , typename HandlerType │ │ │ │ - , HandlerType Handler │ │ │ │ - , void (T::*ErrorHandler)(error_code const&) │ │ │ │ - , void (T::*ExceptHandler)(std::exception const&) │ │ │ │ - , typename StorageType │ │ │ │ - , StorageType T::* Storage> │ │ │ │ - struct handler │ │ │ │ - { │ │ │ │ - explicit handler(std::shared_ptr<T> p) : ptr_(std::move(p)) {} │ │ │ │ - │ │ │ │ - std::shared_ptr<T> ptr_; │ │ │ │ - │ │ │ │ - template <class... A> │ │ │ │ - void operator()(A&&... a) │ │ │ │ - { │ │ │ │ -#ifdef BOOST_NO_EXCEPTIONS │ │ │ │ - (ptr_.get()->*Handler)(std::forward<A>(a)...); │ │ │ │ -#else │ │ │ │ - try │ │ │ │ - { │ │ │ │ - (ptr_.get()->*Handler)(std::forward<A>(a)...); │ │ │ │ - } │ │ │ │ - catch (system_error const& e) │ │ │ │ - { │ │ │ │ - (ptr_.get()->*ErrorHandler)(e.code()); │ │ │ │ - } │ │ │ │ - catch (std::exception const& e) │ │ │ │ - { │ │ │ │ - (ptr_.get()->*ExceptHandler)(e); │ │ │ │ - } │ │ │ │ -
    relevance 0../include/libtorrent/aux_/session_interface.hpp:212it would be nice to not have this be part of session_interface

    it would be nice to not have this be part of session_interface

    ../include/libtorrent/aux_/session_interface.hpp:212

    		virtual void deferred_submit_jobs() = 0;
    │ │ │ │ +	using size_type = std::size_t;
    │ │ │ │ +	using difference_type = std::ptrdiff_t;
    │ │ │ │  
    │ │ │ │ -		virtual std::uint16_t listen_port() const = 0;
    │ │ │ │ -		virtual std::uint16_t ssl_listen_port() const = 0;
    │ │ │ │ +
    static char* malloc(size_type const bytes) │ │ │ │ +
    { return new char[bytes]; } │ │ │ │ + static void free(char* const block) │ │ │ │ + { delete [] block; } │ │ │ │ +}; │ │ │ │ │ │ │ │ - virtual int listen_port(aux::transport ssl, address const& local_addr) = 0; │ │ │ │ +using pool = boost::pool<allocator_new_delete>; │ │ │ │ │ │ │ │ - virtual void for_each_listen_socket(std::function<void(aux::listen_socket_handle const&)> f) = 0; │ │ │ │ +template <typename T> │ │ │ │ +using object_pool = boost::object_pool<T, allocator_new_delete>; │ │ │ │ │ │ │ │ - // 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; │ │ │ │ - virtual void trancieve_ip_packet(int bytes, bool ipv6) = 0; │ │ │ │ -
    relevance 0../include/libtorrent/aux_/session_impl.hpp:265make these direct members and generate shared_ptrs to them which alias the listen_socket_t shared_ptr

    make these direct members and generate shared_ptrs to them │ │ │ │ +relevance 0../include/libtorrent/aux_/session_impl.hpp:265make these direct members and generate shared_ptrs to them which alias the listen_socket_t shared_ptr

    make these direct members and generate shared_ptrs to them │ │ │ │ which alias the listen_socket_t shared_ptr

    ../include/libtorrent/aux_/session_impl.hpp:265

    			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
    │ │ │ │ @@ -11726,15 +11555,15 @@
    │ │ │ │  			{
    │ │ │ │  				return addr == o.addr
    │ │ │ │  					&& port == o.port
    │ │ │ │  					&& device == o.device
    │ │ │ │  					&& ssl == o.ssl
    │ │ │ │  					&& flags == o.flags;
    │ │ │ │  			}
    │ │ │ │ -
    relevance 0../include/libtorrent/aux_/session_impl.hpp:1068replace this by a proper asio timer

    replace this by a proper asio timer

    ../include/libtorrent/aux_/session_impl.hpp:1068

    #ifdef TORRENT_SSL_PEERS
    │ │ │ │ +
    relevance 0../include/libtorrent/aux_/session_impl.hpp:1068replace this by a proper asio timer

    replace this by a proper asio timer

    ../include/libtorrent/aux_/session_impl.hpp:1068

    #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;
    │ │ │ │  
    │ │ │ │ @@ -11750,15 +11579,15 @@
    │ │ │ │  			// 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 │ │ │ │ -
    relevance 0../include/libtorrent/aux_/session_impl.hpp:1073replace this by a proper asio timer

    replace this by a proper asio timer

    ../include/libtorrent/aux_/session_impl.hpp:1073

    │ │ │ │ +
    relevance 0../include/libtorrent/aux_/session_impl.hpp:1073replace this by a proper asio timer

    replace this by a proper asio timer

    ../include/libtorrent/aux_/session_impl.hpp:1073

    │ │ │ │  			// 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
    │ │ │ │ @@ -11776,15 +11605,15 @@
    │ │ │ │  			// 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. │ │ │ │ -
    relevance 0../include/libtorrent/aux_/session_impl.hpp:1080replace this by a proper asio timer

    replace this by a proper asio timer

    ../include/libtorrent/aux_/session_impl.hpp:1080

    │ │ │ │ +
    relevance 0../include/libtorrent/aux_/session_impl.hpp:1080replace this by a proper asio timer

    replace this by a proper asio timer

    ../include/libtorrent/aux_/session_impl.hpp:1080

    │ │ │ │  #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
    │ │ │ │ @@ -11827,15 +11656,15 @@
    │ │ │ │  			int m_peak_up_rate = 0;
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  			void on_tick(error_code const& e);
    │ │ │ │  
    │ │ │ │  			void try_connect_more_peers();
    │ │ │ │  			void auto_manage_checking_torrents(std::vector<torrent*>& list
    │ │ │ │ -
    relevance 0../include/libtorrent/aux_/utp_stream.hpp:693it would be nice to make this private

    it would be nice to make this private

    ../include/libtorrent/aux_/utp_stream.hpp:693

    	bool consume_incoming_data(
    │ │ │ │ +
    relevance 0../include/libtorrent/aux_/utp_stream.hpp:693it would be nice to make this private

    it would be nice to make this private

    ../include/libtorrent/aux_/utp_stream.hpp:693

    	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();
    │ │ │ │  
    │ │ │ │ @@ -11878,15 +11707,15 @@
    │ │ │ │  	// 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,
    │ │ │ │ -
    relevance 0../include/libtorrent/aux_/announce_entry.hpp:74include the number of peers received from this tracker, at last announce

    include the number of peers received from this tracker, at last │ │ │ │ +relevance 0../include/libtorrent/aux_/announce_entry.hpp:74include the number of peers received from this tracker, at last announce

    include the number of peers received from this tracker, at last │ │ │ │ announce

    ../include/libtorrent/aux_/announce_entry.hpp:74

    namespace aux {
    │ │ │ │  
    │ │ │ │  	struct TORRENT_EXTRA_EXPORT announce_infohash
    │ │ │ │  	{
    │ │ │ │  		announce_infohash();
    │ │ │ │  
    │ │ │ │  		// if this tracker has returned an error or warning message
    │ │ │ │ @@ -11930,15 +11759,221 @@
    │ │ │ │  		// 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;
    │ │ │ │ -
    relevance 0../include/libtorrent/aux_/deprecated.hpp:47figure out which version of clang this is supported in

    figure out which version of clang this is supported in

    ../include/libtorrent/aux_/deprecated.hpp:47

    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    │ │ │ │ +
    relevance 0../include/libtorrent/aux_/session_interface.hpp:212it would be nice to not have this be part of session_interface

    it would be nice to not have this be part of session_interface

    ../include/libtorrent/aux_/session_interface.hpp:212

    		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; │ │ │ │ + virtual void trancieve_ip_packet(int bytes, bool ipv6) = 0; │ │ │ │ +
    relevance 0../include/libtorrent/aux_/merkle_tree.hpp:85remove 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

    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

    ../include/libtorrent/aux_/merkle_tree.hpp:85

    // 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
    │ │ │ │ +// a magnet link for a torrent that we already have files for. Once we have the
    │ │ │ │ +// metadata, we have files on disk but no hashes. We won't know whether the data
    │ │ │ │ +// on disk is valid or not, until we've downloaded the hashes to validate them.
    │ │ │ │ +
    │ │ │ │ +// Idea for future space optimization:
    │ │ │ │ +// while downloading, we need to store interior nodes of this tree. However, we
    │ │ │ │ +// don't need to store the padding. a SHA-256 is 32 bytes. Instead of storing
    │ │ │ │ +// the full (padded) tree of SHA-256 hashes, store the full tree of 32 bit
    │ │ │ │ +// signed integers, being indices into the actual storage for the tree. We could
    │ │ │ │ +// even grow the storage lazily. Instead of storing the padding hashes, use
    │ │ │ │ +// negative indices to refer to fixed SHA-256(0), and SHA-256(SHA-256(0)) and so
    │ │ │ │ +// on
    │ │ │ │ +struct TORRENT_EXTRA_EXPORT merkle_tree
    │ │ │ │ +{
    │ │ │ │ +
    merkle_tree() = default; │ │ │ │ +
    merkle_tree(int num_blocks, int blocks_per_piece, char const* r); │ │ │ │ + │ │ │ │ + sha256_hash root() const; │ │ │ │ + │ │ │ │ + void load_tree(span<sha256_hash const> t, std::vector<bool> const& verified); │ │ │ │ + void load_sparse_tree(span<sha256_hash const> t, std::vector<bool> const& mask │ │ │ │ + , std::vector<bool> const& verified); │ │ │ │ + void load_verified_bits(std::vector<bool> const& verified); │ │ │ │ + │ │ │ │ + std::size_t size() const; │ │ │ │ + int end_index() const { return int(size()); } │ │ │ │ + │ │ │ │ + bool has_node(int idx) const; │ │ │ │ + │ │ │ │ + bool compare_node(int idx, sha256_hash const& h) const; │ │ │ │ + │ │ │ │ + sha256_hash operator[](int idx) const; │ │ │ │ + │ │ │ │ + std::vector<sha256_hash> build_vector() const; │ │ │ │ + std::pair<std::vector<sha256_hash>, aux::vector<bool>> build_sparse_vector() const; │ │ │ │ + │ │ │ │ + // get bits indicating if each leaf hash is verified │ │ │ │ + std::vector<bool> verified_leafs() const; │ │ │ │ + │ │ │ │ + // 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; │ │ │ │ + │ │ │ │ +
    relevance 0../include/libtorrent/aux_/merkle_tree.hpp:175make this a std::unique_ptr

    make this a std::unique_ptr

    ../include/libtorrent/aux_/merkle_tree.hpp:175

    │ │ │ │ +	int blocks_per_piece() const { return 1 << 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;
    │ │ │ │ +	int num_pieces() const;
    │ │ │ │ +	int num_leafs() const;
    │ │ │ │ +
    │ │ │ │ +	void optimize_storage();
    │ │ │ │ +	void optimize_storage_piece_layer();
    │ │ │ │ +	void allocate_full();
    │ │ │ │ +
    │ │ │ │ +	// a pointer to the root hash for this file.
    │ │ │ │ +	char const* m_root = nullptr;
    │ │ │ │ +
    │ │ │ │ +	// this is either the full tree, or some sparse representation of it,
    │ │ │ │ +	// depending on m_mode
    │ │ │ │ +
    aux::vector<sha256_hash> m_tree; │ │ │ │ +
    │ │ │ │ + // when the full tree is allocated, this has one bit for each block hash. a │ │ │ │ + // 1 means we have verified the block hash to be correct, otherwise the block │ │ │ │ + // hash may represent what's on disk, but we haven't been able to verify it │ │ │ │ + // yet │ │ │ │ + bitfield m_block_verified; │ │ │ │ + │ │ │ │ + // number of blocks in the file this tree represents. The number of leafs in │ │ │ │ + // the tree is rounded up to an even power of 2. │ │ │ │ + int m_num_blocks = 0; │ │ │ │ + │ │ │ │ + // the number of blocks per piece, specified as how many steps to shift │ │ │ │ + // right 1 to get the number of blocks in one piece. This is a compact │ │ │ │ + // representation that's valid because pieces are always powers of 2. │ │ │ │ + // this is necessary to know which layer in the tree the piece layer is. │ │ │ │ + std::uint8_t m_blocks_per_piece_log = 0; │ │ │ │ + │ │ │ │ + enum class mode_t : std::uint8_t │ │ │ │ + { │ │ │ │ + // a default constructed tree is truly empty. It does not even have a │ │ │ │ + // root hash │ │ │ │ + uninitialized_tree, │ │ │ │ + │ │ │ │ + // 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, │ │ │ │ + │ │ │ │ +
    relevance 0../include/libtorrent/aux_/allocating_handler.hpp:316in C++17, Handler and Storage could just use "auto"

    in C++17, Handler and Storage could just use "auto"

    ../include/libtorrent/aux_/allocating_handler.hpp:316

    │ │ │ │ +	private:
    │ │ │ │ +
    │ │ │ │ +		Handler handler;
    │ │ │ │ +		handler_storage<Size, Name>* storage;
    │ │ │ │ +#ifndef BOOST_NO_EXCEPTIONS
    │ │ │ │ +		error_handler_interface* error_handler;
    │ │ │ │ +#endif
    │ │ │ │ +	};
    │ │ │ │ +
    │ │ │ │ +	template <class Handler, size_t Size, HandlerName Name>
    │ │ │ │ +	aux::allocating_handler<Handler, Size, Name>
    │ │ │ │ +	make_handler(Handler handler
    │ │ │ │ +		, handler_storage<Size, Name>& storage
    │ │ │ │ +		, error_handler_interface& err_handler)
    │ │ │ │ +	{
    │ │ │ │ +		return aux::allocating_handler<Handler, Size, Name>(
    │ │ │ │ +			std::forward<Handler>(handler), &storage, &err_handler);
    │ │ │ │ +	}
    │ │ │ │ +
    │ │ │ │ +
    template <typename T │ │ │ │ +
    , typename HandlerType │ │ │ │ + , HandlerType Handler │ │ │ │ + , void (T::*ErrorHandler)(error_code const&) │ │ │ │ + , void (T::*ExceptHandler)(std::exception const&) │ │ │ │ + , typename StorageType │ │ │ │ + , StorageType T::* Storage> │ │ │ │ + struct handler │ │ │ │ + { │ │ │ │ + explicit handler(std::shared_ptr<T> p) : ptr_(std::move(p)) {} │ │ │ │ + │ │ │ │ + std::shared_ptr<T> ptr_; │ │ │ │ + │ │ │ │ + template <class... A> │ │ │ │ + void operator()(A&&... a) │ │ │ │ + { │ │ │ │ +#ifdef BOOST_NO_EXCEPTIONS │ │ │ │ + (ptr_.get()->*Handler)(std::forward<A>(a)...); │ │ │ │ +#else │ │ │ │ + try │ │ │ │ + { │ │ │ │ + (ptr_.get()->*Handler)(std::forward<A>(a)...); │ │ │ │ + } │ │ │ │ + catch (system_error const& e) │ │ │ │ + { │ │ │ │ + (ptr_.get()->*ErrorHandler)(e.code()); │ │ │ │ + } │ │ │ │ + catch (std::exception const& e) │ │ │ │ + { │ │ │ │ + (ptr_.get()->*ExceptHandler)(e); │ │ │ │ + } │ │ │ │ +
    relevance 0../include/libtorrent/aux_/deprecated.hpp:47figure out which version of clang this is supported in

    figure out which version of clang this is supported in

    ../include/libtorrent/aux_/deprecated.hpp:47

    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_DEPRECATED_HPP_INCLUDED
    │ │ │ │  #define TORRENT_DEPRECATED_HPP_INCLUDED
    │ │ │ │ @@ -11971,43 +12006,8 @@
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  #ifndef TORRENT_DEPRECATED_ENUM
    │ │ │ │  #define TORRENT_DEPRECATED_ENUM
    │ │ │ │  #endif
    │ │ │ │  
    │ │ │ │  #endif
    │ │ │ │ -
    relevance 0../include/libtorrent/aux_/pool.hpp:49ensure the alignment is good here

    ensure the alignment is good here

    ../include/libtorrent/aux_/pool.hpp:49

    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>; │ │ │ │ - │ │ │ │ -} │ │ │ │ -} │ │ │ │ - │ │ │ │ -#endif │ │ │ │
    │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -454,14 +454,179 @@ │ │ │ │ │ | | │ │ │ │ │ | auto o = rpc.allocate_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_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| |_._._/_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 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 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(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 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 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_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |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); | │ │ │ │ │ @@ -673,14 +838,352 @@ │ │ │ │ │ | 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; | │ │ │ │ │ +| | │ │ │ │ │ +| 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(std::move(p)); | │ │ │ │ │ +|} | │ │ │ │ │ +| | │ │ │ │ │ +| void torrent::load_merkle_trees( | │ │ │ │ │ +| aux::vector, file_index_t> trees_import | │ │ │ │ │ +| , aux::vector, file_index_t> mask | │ │ │ │ │ +| , aux::vector, file_index_t> verified) | │ │ │ │ │ +| { | │ │ │ │ │ +| auto const& fs = m_torrent_file->orig_files(); | │ │ │ │ │ +| | │ │ │ │ │ +| std::vector 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 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 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()) | │ │ │ │ │ +|alerts().emplace_alert(get_handle()); | │ │ │ │ │ +| } | │ │ │ │ │ +| m_ses.deferred_submit_jobs(); | │ │ │ │ │ +| } | │ │ │ │ │ +| else | │ │ │ │ │ +| { | │ │ │ │ │ +| if (alerts().should_post()) | │ │ │ │ │ +| alerts().emplace_alert(get_handle()); | │ │ │ │ │ +| alerts().emplace_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 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 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_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |_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 | │ │ │ │ │ @@ -1038,483 +1541,14 @@ │ │ │ │ │ | alerts.emplace_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_>_&_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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(std::move(p)); | │ │ │ │ │ -|} | │ │ │ │ │ -| | │ │ │ │ │ -| void torrent::load_merkle_trees( | │ │ │ │ │ -| aux::vector, file_index_t> trees_import | │ │ │ │ │ -| , aux::vector, file_index_t> mask | │ │ │ │ │ -| , aux::vector, file_index_t> verified) | │ │ │ │ │ -| { | │ │ │ │ │ -| auto const& fs = m_torrent_file->orig_files(); | │ │ │ │ │ -| | │ │ │ │ │ -| std::vector 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 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 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()) | │ │ │ │ │ -|alerts().emplace_alert(get_handle()); | │ │ │ │ │ -| } | │ │ │ │ │ -| m_ses.deferred_submit_jobs(); | │ │ │ │ │ -| } | │ │ │ │ │ -| else | │ │ │ │ │ -| { | │ │ │ │ │ -| if (alerts().should_post()) | │ │ │ │ │ -| alerts().emplace_alert(get_handle()); | │ │ │ │ │ -| alerts().emplace_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 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 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_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| |_._._/_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 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 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(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 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 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); | │ │ │ │ │ @@ -1561,48 +1595,14 @@ │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ | 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_/_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_}_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |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 | │ │ │ │ │ |#include | │ │ │ │ │ |#include | │ │ │ │ │ @@ -1650,14 +1650,172 @@ │ │ │ │ │ | } | │ │ │ │ │ | 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 trackers() const; | │ │ │ │ │ +| void replace_trackers(std::vector 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 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 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(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(); | │ │ │ │ │ +| | │ │ │ │ │ +| // this has one entry per http-request | │ │ │ │ │ +| // (might be more than the bt requests) | │ │ │ │ │ +| struct file_request_t | │ │ │ │ │ +| { | │ │ │ │ │ +| file_index_t file_index; | │ │ │ │ │ +| int length; | │ │ │ │ │ +| std::int64_t start; | │ │ │ │ │ +| }; | │ │ │ │ │ +| std::deque m_file_requests; | │ │ │ │ │ +| | │ │ │ │ │ +| std::string m_url; | │ │ │ │ │ +| | │ │ │ │ │ +| web_seed_t* m_web; | │ │ │ │ │ +| | │ │ │ │ │ +| // this is used for intermediate storage of pieces to be delivered to the | │ │ │ │ │ +| // bittorrent engine | │ │ │ │ │ +|aux::vector m_piece; | │ │ │ │ │ +| | │ │ │ │ │ +| // the number of bytes we've forwarded to the incoming_payload() function | │ │ │ │ │ +| // in the current HTTP response. used to know where in the buffer the | │ │ │ │ │ +| // next response starts | │ │ │ │ │ +| int m_received_body; | │ │ │ │ │ +| | │ │ │ │ │ +| // this is the offset inside the current receive | │ │ │ │ │ +| // buffer where the next chunk header will be. | │ │ │ │ │ +| // this is updated for each chunk header that's | │ │ │ │ │ +| // parsed. It does not necessarily point to a valid | │ │ │ │ │ +| // offset in the receive buffer, if we haven't received | │ │ │ │ │ +| // it yet. This offset never includes the HTTP header | │ │ │ │ │ +| int m_chunk_pos; | │ │ │ │ │ +| | │ │ │ │ │ +| // this is the number of bytes we've already received | │ │ │ │ │ +| // from the next chunk header we're waiting for | │ │ │ │ │ +| int m_partial_chunk_header; | │ │ │ │ │ +| | │ │ │ │ │ +| // 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_/ |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); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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(); } | │ │ │ │ │ +| | │ │ │ │ │ +| // 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 | │ │ │ │ │ +| }; | │ │ │ │ │ +| | │ │ │ │ │ +| 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_/ |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; | │ │ │ │ │ @@ -1759,67 +1917,14 @@ │ │ │ │ │ | | │ │ │ │ │ | // 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); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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(); } | │ │ │ │ │ -| | │ │ │ │ │ -| // 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 | │ │ │ │ │ -| }; | │ │ │ │ │ -| | │ │ │ │ │ -| 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_/ |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 | │ │ │ │ │ |#include | │ │ │ │ │ |#include | │ │ │ │ │ @@ -1921,119 +2026,14 @@ │ │ │ │ │ | // 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 | │ │ │ │ │ | { | │ │ │ │ │ |_ _ _ _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_/ |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(); | │ │ │ │ │ -| | │ │ │ │ │ -| // this has one entry per http-request | │ │ │ │ │ -| // (might be more than the bt requests) | │ │ │ │ │ -| struct file_request_t | │ │ │ │ │ -| { | │ │ │ │ │ -| file_index_t file_index; | │ │ │ │ │ -| int length; | │ │ │ │ │ -| std::int64_t start; | │ │ │ │ │ -| }; | │ │ │ │ │ -| std::deque m_file_requests; | │ │ │ │ │ -| | │ │ │ │ │ -| std::string m_url; | │ │ │ │ │ -| | │ │ │ │ │ -| web_seed_t* m_web; | │ │ │ │ │ -| | │ │ │ │ │ -| // this is used for intermediate storage of pieces to be delivered to the | │ │ │ │ │ -| // bittorrent engine | │ │ │ │ │ -|aux::vector m_piece; | │ │ │ │ │ -| | │ │ │ │ │ -| // the number of bytes we've forwarded to the incoming_payload() function | │ │ │ │ │ -| // in the current HTTP response. used to know where in the buffer the | │ │ │ │ │ -| // next response starts | │ │ │ │ │ -| int m_received_body; | │ │ │ │ │ -| | │ │ │ │ │ -| // this is the offset inside the current receive | │ │ │ │ │ -| // buffer where the next chunk header will be. | │ │ │ │ │ -| // this is updated for each chunk header that's | │ │ │ │ │ -| // parsed. It does not necessarily point to a valid | │ │ │ │ │ -| // offset in the receive buffer, if we haven't received | │ │ │ │ │ -| // it yet. This offset never includes the HTTP header | │ │ │ │ │ -| int m_chunk_pos; | │ │ │ │ │ -| | │ │ │ │ │ -| // this is the number of bytes we've already received | │ │ │ │ │ -| // from the next chunk header we're waiting for | │ │ │ │ │ -| int m_partial_chunk_header; | │ │ │ │ │ -| | │ │ │ │ │ -| // 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_/ |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 trackers() const; | │ │ │ │ │ -| void replace_trackers(std::vector 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 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 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(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_/ |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,68 @@ │ │ │ │ │ | , 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_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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); | │ │ │ │ │ +| | │ │ │ │ │ +| TEST_EQUAL(oversized, bool(flags & test_oversized)); | │ │ │ │ │ +| | │ │ │ │ │ +| for (auto const i : info->piece_range()) | │ │ │ │ │ +| { | │ │ │ │ │ +| done = false; | │ │ │ │ │ +| io->async_hash(st, i, {} | │ │ │ │ │ +| , disk_interface::sequential_access | disk_interface::volatile_read | disk_interface::v1_hash | │ │ │ │ │ +| , std::bind(&on_piece_checked, _1, _2, _3, &done)); | │ │ │ │ │ +| io->submit_jobs(); | │ │ │ │ │ +| ios.restart(); | │ │ │ │ │ +| run_until(ios, done); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| io->abort(true); | │ │ │ │ │ +|} | │ │ │ │ │ +| | │ │ │ │ │ +|template | │ │ │ │ │ +|void run_test() | │ │ │ │ │ +|{ | │ │ │ │ │ +| std::string const test_path = current_working_directory(); | │ │ │ │ │ +| std::cout << "\n=== " << test_path << " ===\n" << std::endl; | │ │ │ │ │ +| | │ │ │ │ │ +| std::shared_ptr info; | │ │ │ │ │ +| | │ │ │ │ │ +| std::vector piece0 = new_piece(piece_size); | │ │ │ │ │ +| std::vector piece1 = new_piece(piece_size); | │ │ │ │ │ +| std::vector piece2 = new_piece(piece_size); | │ │ │ │ │ +| std::vector piece3 = new_piece(piece_size); | │ │ │ │ │ +| | │ │ │ │ │ +| delete_dirs("temp_storage"); | │ │ │ │ │ +| | │ │ │ │ │ +| file_storage fs; | │ │ │ │ │ +| fs.add_file("temp_storage/test1.tmp", 17); | │ │ │ │ │ +| fs.add_file("temp_storage/test2.tmp", 612); | │ │ │ │ │ +| fs.add_file("temp_storage/test3.tmp", 0); | │ │ │ │ │ +| fs.add_file("temp_storage/test4.tmp", 0); | │ │ │ │ │ +| fs.add_file("temp_storage/test5.tmp", 3253); | │ │ │ │ │ +| fs.add_file("temp_storage/test6.tmp", 841); | │ │ │ │ │ +| int const last_file_size = 4 * int(piece_size) - int(fs.total_size()); | │ │ │ │ │ +| fs.add_file("temp_storage/test7.tmp", last_file_size); | │ │ │ │ │ +| | │ │ │ │ │ +| // File layout | │ │ │ │ │ +| // +-+--+++-------+-------+----------------------------------------------------------------------------------------+ | │ │ │ │ │ +| // |1| 2||| file5 | file6 | file7 | | │ │ │ │ │ +| // +-+--+++-------+-------+----------------------------------------------------------------------------------------+ | │ │ │ │ │ +| // | | | | | | │ │ │ │ │ +|_ _/_/_ _|_ _p_i_e_c_e_ _0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _p_i_e_c_e_ _1_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _p_i_e_c_e_ _2_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _p_i_e_c_e_ _3_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |_r_e_l_e_v_a_n_c_e_ _2_|_._._/_t_e_s_t_/_t_e_s_t___d_h_t_._c_p_p_:_1_6_4_2_ _ _ _ _ _|_t_e_s_t_ _n_u_m___g_l_o_b_a_l___n_o_d_e_s_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |********** tteesstt nnuumm__gglloobbaall__nnooddeess ********** | │ │ │ │ │ |_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____dd_hh_tt_.._cc_pp_pp_::_11_66_44_22_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |_r_e_l_e_v_a_n_c_e_ _2_|_._._/_t_e_s_t_/_t_e_s_t___d_h_t_._c_p_p_:_1_6_4_3_ _ _ _ _ _|_t_e_s_t_ _n_e_e_d___r_e_f_r_e_s_h_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |********** tteesstt nneeeedd__rreeffrreesshh ********** | │ │ │ │ │ |****** ....//tteesstt//tteesstt__ddhhtt..ccpppp::11664433 ****** | │ │ │ │ │ | s.set_bool(settings_pack::dht_restrict_routing_ips, false); | │ │ │ │ │ @@ -2244,181 +2298,186 @@ │ │ │ │ │ | 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_"_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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); | │ │ │ │ │ +|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_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|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 | │ │ │ │ │ | | │ │ │ │ │ -| TEST_EQUAL(oversized, bool(flags & test_oversized)); | │ │ │ │ │ +| write_reject_request(r); | │ │ │ │ │ +| if (m_num_invalid_requests < std::numeric_limits::max()) | │ │ │ │ │ +| ++m_num_invalid_requests; | │ │ │ │ │ | | │ │ │ │ │ -| for (auto const i : info->piece_range()) | │ │ │ │ │ -| { | │ │ │ │ │ -| done = false; | │ │ │ │ │ -| io->async_hash(st, i, {} | │ │ │ │ │ -| , disk_interface::sequential_access | disk_interface::volatile_read | disk_interface::v1_hash | │ │ │ │ │ -| , std::bind(&on_piece_checked, _1, _2, _3, &done)); | │ │ │ │ │ -| io->submit_jobs(); | │ │ │ │ │ -| ios.restart(); | │ │ │ │ │ -| run_until(ios, done); | │ │ │ │ │ -| } | │ │ │ │ │ +| if (t->alerts().should_post()) | │ │ │ │ │ +| { | │ │ │ │ │ +| // msvc 12 appears to deduce the rvalue reference template | │ │ │ │ │ +| // incorrectly for bool temporaries. So, create a dummy instance | │ │ │ │ │ +| bool const peer_interested = bool(m_peer_interested); | │ │ │ │ │ +| t->alerts().emplace_alert( | │ │ │ │ │ +| t->get_handle(), m_remote, m_peer_id, r | │ │ │ │ │ +| , t->user_have_piece(r.piece), peer_interested, false); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| io->abort(true); | │ │ │ │ │ -|} | │ │ │ │ │ +| // every ten invalid request, remind the peer that it's choked | │ │ │ │ │ +| if (!m_peer_interested && m_num_invalid_requests % 10 == 0 && m_choked) | │ │ │ │ │ +| { | │ │ │ │ │ +|if (m_num_invalid_requests > 300 && !m_peer_choked | │ │ │ │ │ +|&& can_disconnect(errors::too_many_requests_when_choked)) | │ │ │ │ │ +| { | │ │ │ │ │ +| disconnect(errors::too_many_requests_when_choked, operation_t::bittorrent, peer_error); | │ │ │ │ │ +| return; | │ │ │ │ │ +| } | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ +| peer_log(peer_log_alert::outgoing_message, "CHOKE"); | │ │ │ │ │ +|#endif | │ │ │ │ │ +| write_choke(); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -|template | │ │ │ │ │ -|void run_test() | │ │ │ │ │ -|{ | │ │ │ │ │ -| std::string const test_path = current_working_directory(); | │ │ │ │ │ -| std::cout << "\n=== " << test_path << " ===\n" << std::endl; | │ │ │ │ │ +| return; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| std::shared_ptr info; | │ │ │ │ │ +| // if we have choked the client | │ │ │ │ │ +| // ignore the request | │ │ │ │ │ +| int const blocks_per_piece = | │ │ │ │ │ +| (ti.piece_length() + t->block_size() - 1) / t->block_size(); | │ │ │ │ │ | | │ │ │ │ │ -| std::vector piece0 = new_piece(piece_size); | │ │ │ │ │ -| std::vector piece1 = new_piece(piece_size); | │ │ │ │ │ -| std::vector piece2 = new_piece(piece_size); | │ │ │ │ │ -| std::vector piece3 = new_piece(piece_size); | │ │ │ │ │ +| // disconnect peers that downloads more than foo times an allowed | │ │ │ │ │ +| // fast piece | │ │ │ │ │ +| if (m_choked && fast_idx != -1 && m_accept_fast_piece_cnt[fast_idx] >= 3 * blocks_per_piece | │ │ │ │ │ +| && can_disconnect(errors::too_many_requests_when_choked)) | │ │ │ │ │ +| { | │ │ │ │ │ +| disconnect(errors::too_many_requests_when_choked, operation_t::bittorrent, peer_error); | │ │ │ │ │ +| return; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| delete_dirs("temp_storage"); | │ │ │ │ │ +| if (m_choked && fast_idx == -1) | │ │ │ │ │ +|_ _ _{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| |_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_: |since we throw away the queue entry once we issue the disk job, this may happen. Instead, we should keep the queue entry around, | │ │ │ │ │ +|relevance 2|_3_3_0_9 |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| │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_t_o_ _c_a_n_c_e_l_ _d_i_s_k_ _j_o_b_s_?_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|********** ssiinnccee wwee tthhrrooww aawwaayy tthhee qquueeuuee eennttrryy oonnccee wwee iissssuuee tthhee ddiisskk jjoobb,, tthhiiss mmaayy hhaappppeenn.. IInnsstteeaadd,, wwee sshhoouulldd kkeeeepp tthhee qquueeuuee eennttrryy aarroouunndd,, mmaarrkk iitt aass hhaavviinngg bbeeeenn rreeqquueesstteedd ffrroomm | │ │ │ │ │ +|ddiisskk aanndd oonnccee tthhee ddiisskk jjoobb ccoommeess bbaacckk,, ddiissccaarrdd iitt iiff iitt hhaass bbeeeenn ccaanncceelllleedd.. MMaayybbee eevveenn bbee aabbllee ttoo ccaanncceell ddiisskk jjoobbss?? ********** | │ │ │ │ │ +|****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::33330099 ****** | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ +| peer_log(peer_log_alert::incoming_message, "CANCEL" | │ │ │ │ │ +| , "piece: %d s: %x l: %x", static_cast(r.piece), r.start, r.length); | │ │ │ │ │ +|#endif | │ │ │ │ │ | | │ │ │ │ │ -| file_storage fs; | │ │ │ │ │ -| fs.add_file("temp_storage/test1.tmp", 17); | │ │ │ │ │ -| fs.add_file("temp_storage/test2.tmp", 612); | │ │ │ │ │ -| fs.add_file("temp_storage/test3.tmp", 0); | │ │ │ │ │ -| fs.add_file("temp_storage/test4.tmp", 0); | │ │ │ │ │ -| fs.add_file("temp_storage/test5.tmp", 3253); | │ │ │ │ │ -| fs.add_file("temp_storage/test6.tmp", 841); | │ │ │ │ │ -| int const last_file_size = 4 * int(piece_size) - int(fs.total_size()); | │ │ │ │ │ -| fs.add_file("temp_storage/test7.tmp", last_file_size); | │ │ │ │ │ +| auto const i = std::find(m_requests.begin(), m_requests.end(), r); | │ │ │ │ │ | | │ │ │ │ │ -| // File layout | │ │ │ │ │ -| // +-+--+++-------+-------+----------------------------------------------------------------------------------------+ | │ │ │ │ │ -| // |1| 2||| file5 | file6 | file7 | | │ │ │ │ │ -| // +-+--+++-------+-------+----------------------------------------------------------------------------------------+ | │ │ │ │ │ -| // | | | | | | │ │ │ │ │ -|_ _/_/_ _|_ _p_i_e_c_e_ _0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _p_i_e_c_e_ _1_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _p_i_e_c_e_ _2_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _p_i_e_c_e_ _3_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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_/_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 ****** | │ │ │ │ │ -|} | │ │ │ │ │ +| if (i != m_requests.end()) | │ │ │ │ │ +| { | │ │ │ │ │ +| m_counters.inc_stats_counter(counters::cancelled_piece_requests); | │ │ │ │ │ +| m_requests.erase(i); | │ │ │ │ │ | | │ │ │ │ │ -| dht_immutable_item_alert::dht_immutable_item_alert(aux::stack_allocator& | │ │ │ │ │ -| , sha1_hash const& t, entry i) | │ │ │ │ │ -| : target(t), item(std::move(i)) | │ │ │ │ │ -| {} | │ │ │ │ │ +| if (m_requests.empty()) | │ │ │ │ │ +| m_counters.inc_stats_counter(counters::num_peers_up_requests, -1); | │ │ │ │ │ | | │ │ │ │ │ -| std::string dht_immutable_item_alert::message() const | │ │ │ │ │ -| { | │ │ │ │ │ -|#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; | │ │ │ │ │ +| write_reject_request(r); | │ │ │ │ │ +| } | │ │ │ │ │ +| else | │ │ │ │ │ +| { | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ +|peer_log(peer_log_alert::info, "INVALID_CANCEL", "got cancel not in the queue"); | │ │ │ │ │ |#endif | │ │ │ │ │ +| } | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -|dht_mutable_item_alert::dht_mutable_item_alert(aux::stack_allocator& | │ │ │ │ │ -|, std::array const& k | │ │ │ │ │ -| , std::array 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) | │ │ │ │ │ -| {} | │ │ │ │ │ +| // ----------------------------- | │ │ │ │ │ +| // --------- DHT PORT ---------- | │ │ │ │ │ +| // ----------------------------- | │ │ │ │ │ | | │ │ │ │ │ -| std::string dht_mutable_item_alert::message() const | │ │ │ │ │ +| void peer_connection::incoming_dht_port(int const listen_port) | │ │ │ │ │ | { | │ │ │ │ │ -|#ifdef TORRENT_DISABLE_ALERT_MSG | │ │ │ │ │ -| return {}; | │ │ │ │ │ +| TORRENT_ASSERT(is_single_thread()); | │ │ │ │ │ +| INVARIANT_CHECK; | │ │ │ │ │ +| | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ +| peer_log(peer_log_alert::incoming_message, "DHT_PORT", "p: %d", listen_port); | │ │ │ │ │ +|#endif | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_DHT | │ │ │ │ │ +| m_ses.add_dht_node({m_remote.address(), std::uint16_t(listen_port)}); | │ │ │ │ │ |#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; | │ │ │ │ │ +| TORRENT_UNUSED(listen_port); | │ │ │ │ │ |#endif | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| 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_/ |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(); | │ │ │ │ │ -|} | │ │ │ │ │ +| // ----------------------------- | │ │ │ │ │ +| // --------- HAVE ALL ---------- | │ │ │ │ │ +| // ----------------------------- | │ │ │ │ │ | | │ │ │ │ │ -|void web_peer_connection::handle_error(int const bytes_left) | │ │ │ │ │ -|{ | │ │ │ │ │ -| std::shared_ptr t = associated_torrent().lock(); | │ │ │ │ │ -| TORRENT_ASSERT(t); | │ │ │ │ │ +| void peer_connection::incoming_have_all() | │ │ │ │ │ +|_ _{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|relevance 2|_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_: |use a deadline_timer for timeouts. Don't rely on second_tick()! Hook this up to connect timeout as well. This would improve | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_4_9_7_5_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_p_e_r_f_o_r_m_a_n_c_e_ _b_e_c_a_u_s_e_ _o_f_ _l_e_s_s_ _w_o_r_k_ _i_n_ _s_e_c_o_n_d___t_i_c_k_(_)_,_ _a_n_d_ _m_i_g_h_t_ _l_e_t_ _u_s_e_ _r_e_m_o_v_e_ _t_i_c_k_i_n_g_ _e_n_t_i_r_e_l_y_ _e_v_e_n_t_u_a_l_l_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|********** uussee aa ddeeaaddlliinnee__ttiimmeerr ffoorr ttiimmeeoouuttss.. DDoonn''tt rreellyy oonn sseeccoonndd__ttiicckk(())!! HHooookk tthhiiss uupp ttoo ccoonnnneecctt ttiimmeeoouutt aass wweellll.. TThhiiss wwoouulldd iimmpprroovvee ppeerrffoorrmmaannccee bbeeccaauussee ooff lleessss wwoorrkk iinn | │ │ │ │ │ +|sseeccoonndd__ttiicckk(()),, aanndd mmiigghhtt lleett uussee rreemmoovvee ttiicckkiinngg eennttiirreellyy eevveennttuuaallllyy ********** | │ │ │ │ │ +|****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::44997755 ****** | │ │ │ │ │ +|if (d > seconds(connect_timeout) | │ │ │ │ │ +| && can_disconnect(errors::timed_out)) | │ │ │ │ │ +| { | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ +| peer_log(peer_log_alert::info, "CONNECT_FAILED", "waited %d seconds" | │ │ │ │ │ +| , int(total_seconds(d))); | │ │ │ │ │ +|#endif | │ │ │ │ │ +| connect_failed(errors::timed_out); | │ │ │ │ │ +| return; | │ │ │ │ │ +| } | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ +| // if the bw_network flag isn't set, it means we are not even trying to | │ │ │ │ │ +| // read from this peer's socket. Most likely because we're applying a | │ │ │ │ │ +| // rate limit. If the peer is "slow" because we are rate limiting it, | │ │ │ │ │ +| // don't enforce timeouts. However, as soon as we *do* read from the | │ │ │ │ │ +| // socket, we expect to receive data, and not have timed out. Then we | │ │ │ │ │ +| // can enforce the timeouts. | │ │ │ │ │ +| bool const reading_socket = bool(m_channel_state[download_channel] & peer_info::bw_network); | │ │ │ │ │ | | │ │ │ │ │ -|// temporarily unavailable, retry later | │ │ │ │ │ -| t->retry_web_seed(this, m_parser.header_duration("retry-after")); | │ │ │ │ │ -| if (t->alerts().should_post()) | │ │ │ │ │ -| { | │ │ │ │ │ -| std::string const error_msg = to_string(m_parser.status_code()).data() | │ │ │ │ │ -| + (" " + m_parser.message()); | │ │ │ │ │ -| t->alerts().emplace_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); | │ │ │ │ │ -|} | │ │ │ │ │ +|if (reading_socket && d > seconds(timeout()) && !m_connecting && m_reading_bytes == 0 | │ │ │ │ │ +|&& can_disconnect(errors::timed_out_inactivity)) | │ │ │ │ │ +| { | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ +| peer_log(peer_log_alert::info, "LAST_ACTIVITY", "%d seconds ago" | │ │ │ │ │ +| , int(total_seconds(d))); | │ │ │ │ │ +|#endif | │ │ │ │ │ +| disconnect(errors::timed_out_inactivity, operation_t::bittorrent); | │ │ │ │ │ +| return; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -|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 t = associated_torrent().lock(); | │ │ │ │ │ -| TORRENT_ASSERT(t); | │ │ │ │ │ -| t->remove_web_seed_conn(this); | │ │ │ │ │ -| } | │ │ │ │ │ -| m_web = nullptr; | │ │ │ │ │ -| TORRENT_ASSERT(is_disconnecting()); | │ │ │ │ │ -|} | │ │ │ │ │ +| // do not stall waiting for a handshake | │ │ │ │ │ +| int timeout = m_settings.get_int (settings_pack::handshake_timeout); | │ │ │ │ │ +|#if TORRENT_USE_I2P | │ │ │ │ │ +| timeout *= is_i2p(m_socket) ? 4 : 1; | │ │ │ │ │ +|#endif | │ │ │ │ │ +| if (reading_socket | │ │ │ │ │ +| && !m_connecting | │ │ │ │ │ +| && in_handshake() | │ │ │ │ │ +| && d > seconds(timeout)) | │ │ │ │ │ +| { | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ +| peer_log(peer_log_alert::info, "NO_HANDSHAKE", "waited %d seconds" | │ │ │ │ │ +| , int(total_seconds(d))); | │ │ │ │ │ +|#endif | │ │ │ │ │ +| disconnect(errors::timed_out_no_handshake, operation_t::bittorrent); | │ │ │ │ │ +| return; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -|void web_peer_connection::handle_redirect(int const bytes_left) | │ │ │ │ │ -|_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| // 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_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |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 | │ │ │ │ │ @@ -2466,122 +2525,395 @@ │ │ │ │ │ | 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_/_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 " | │ │ │ │ │ -| "transaction ID (%x)", print_endpoint(ep).c_str() | │ │ │ │ │ -| , transaction); | │ │ │ │ │ -| } | │ │ │ │ │ -|#endif | │ │ │ │ │ -| return false; | │ │ │ │ │ -| } | │ │ │ │ │ +|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); | │ │ │ │ │ | | │ │ │ │ │ -| std::shared_ptr const p = i->second; | │ │ │ │ │ -| // on_receive() may remove the tracker connection from the list | │ │ │ │ │ -| return p->on_receive(ep, buf); | │ │ │ │ │ -| } | │ │ │ │ │ +| // if we don't think we have any of the files, allow banning the web seed | │ │ │ │ │ +| if (num_have_pieces() == 0) return true; | │ │ │ │ │ | | │ │ │ │ │ -| void tracker_manager::incoming_error(error_code const& | │ │ │ │ │ -| , udp::endpoint const&) | │ │ │ │ │ +| // 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 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()) | │ │ │ │ │ | { | │ │ │ │ │ -| TORRENT_ASSERT(is_single_thread()); | │ │ │ │ │ +| std::string const error_msg = to_string(m_parser.status_code()).data() | │ │ │ │ │ +| + (" " + m_parser.message()); | │ │ │ │ │ +| t->alerts().emplace_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); | │ │ │ │ │ |} | │ │ │ │ │ | | │ │ │ │ │ -| bool tracker_manager::incoming_packet(string_view const hostname | │ │ │ │ │ -| , span const buf) | │ │ │ │ │ +|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) | │ │ │ │ │ | { | │ │ │ │ │ -| TORRENT_ASSERT(is_single_thread()); | │ │ │ │ │ -| // ignore packets smaller than 8 bytes | │ │ │ │ │ -| if (buf.size() < 16) return false; | │ │ │ │ │ +| std::shared_ptr t = associated_torrent().lock(); | │ │ │ │ │ +| TORRENT_ASSERT(t); | │ │ │ │ │ +| t->remove_web_seed_conn(this); | │ │ │ │ │ +| } | │ │ │ │ │ +| m_web = nullptr; | │ │ │ │ │ +| TORRENT_ASSERT(is_disconnecting()); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| // the first word is the action, if it's not [0, 3] | │ │ │ │ │ -| // it's not a valid udp tracker response | │ │ │ │ │ -| span ptr = buf; | │ │ │ │ │ -| std::uint32_t const action = aux::read_uint32(ptr); | │ │ │ │ │ -| if (action > 3) return false; | │ │ │ │ │ +|void web_peer_connection::handle_redirect(int const bytes_left) | │ │ │ │ │ +|_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| std::uint32_t const transaction = aux::read_uint32(ptr); | │ │ │ │ │ -| auto const i = m_udp_conns.find(transaction); | │ │ │ │ │ +| // 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 (i == m_udp_conns.end()) | │ │ │ │ │ +| if (ret == 0) | │ │ │ │ │ | { | │ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ -| // now, this may not have been meant to be a tracker response, | │ │ │ │ │ -| // but chances are pretty good, so it's probably worth logging | │ │ │ │ │ -| m_ses.session_log("incoming UDP tracker packet from %s has invalid " | │ │ │ │ │ -| "transaction ID (%x)", std::string(hostname).c_str(), int(transaction)); | │ │ │ │ │ +| ec.clear(); | │ │ │ │ │ +| return; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| // 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 | │ │ │ │ │ -| return false; | │ │ │ │ │ +| ) | │ │ │ │ │ +| { | │ │ │ │ │ +| // some error happened, report up to the caller | │ │ │ │ │ +| ec.assign(errno, system_category()); | │ │ │ │ │ +| return; | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| std::shared_ptr const p = i->second; | │ │ │ │ │ -|_ _ _/_/_ _o_n___r_e_c_e_i_v_e_(_)_ _m_a_y_ _r_e_m_o_v_e_ _t_h_e_ _t_r_a_c_k_e_r_ _c_o_n_n_e_c_t_i_o_n_ _f_r_o_m_ _t_h_e_ _l_i_s_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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); | │ │ │ │ │ +| // fall back to making a copy | │ │ │ │ │ +| | │ │ │ │ │ +|#endif | │ │ │ │ │ +| | │ │ │ │ │ +| // if we get here, we should copy the file | │ │ │ │ │ +| storage_error se; | │ │ │ │ │ +| aux::copy_file(file, link, se); | │ │ │ │ │ +| ec = se.ec; | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| bool need_encoding(char const* str, int const len) | │ │ │ │ │ +| bool is_directory(std::string const& f, error_code& ec) | │ │ │ │ │ | { | │ │ │ │ │ -| for (int i = 0; i < len; ++i) | │ │ │ │ │ +| 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_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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 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 (std::strchr(unreserved_chars, *str) == nullptr || *str == 0) | │ │ │ │ │ -| return true; | │ │ │ │ │ -| ++str; | │ │ │ │ │ +| if (error_pos) *error_pos = 0; | │ │ │ │ │ +| ec = bdecode_errors::limit_exceeded; | │ │ │ │ │ +| return ret; | │ │ │ │ │ | } | │ │ │ │ │ -| return false; | │ │ │ │ │ +| | │ │ │ │ │ +| // 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_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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 convert_path_to_posix(std::string& path) | │ │ │ │ │ +| void alert_manager::maybe_notify(alert* a) | │ │ │ │ │ | { | │ │ │ │ │ -| std::replace(path.begin(), path.end(), '\\', '/'); | │ │ │ │ │ -| } | │ │ │ │ │ +| 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(); | │ │ │ │ │ | | │ │ │ │ │ -|std::string read_until(char const*& str, char const delim, char const* end) | │ │ │ │ │ -|{ | │ │ │ │ │ -| TORRENT_ASSERT(str <= end); | │ │ │ │ │ +|m_condition.notify_all(); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| std::string ret; | │ │ │ │ │ -| while (str != end && *str != delim) | │ │ │ │ │ +|#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 const& fun) | │ │ │ │ │ +| { | │ │ │ │ │ +| std::unique_lock lock(m_mutex); | │ │ │ │ │ +| m_notify = fun; | │ │ │ │ │ +| if (!m_alerts[m_generation].empty()) | │ │ │ │ │ | { | │ │ │ │ │ -| ret += *str; | │ │ │ │ │ -| ++str; | │ │ │ │ │ +| if (m_notify) m_notify(); | │ │ │ │ │ | } | │ │ │ │ │ -| // skip the delimiter as well | │ │ │ │ │ -| while (str != end && *str == delim) ++str; | │ │ │ │ │ -| return ret; | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| std::string maybe_url_encode(std::string const& url) | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_EXTENSIONS | │ │ │ │ │ +| void alert_manager::add_extension(std::shared_ptr ext) | │ │ │ │ │ | { | │ │ │ │ │ -| 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; | │ │ │ │ │ +| m_ses_extensions.push_back(std::move(ext)); | │ │ │ │ │ +| } | │ │ │ │ │ +|#endif | │ │ │ │ │ | | │ │ │ │ │ -| // first figure out if this url contains unencoded characters | │ │ │ │ │ -| if (!need_encoding(path.c_str(), int(path.size()))) | │ │ │ │ │ -| return url; | │ │ │ │ │ +| void alert_manager::get_all(std::vector& 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_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| | |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)) | │ │ │ │ │ +| { | │ │ │ │ │ +| // files moved out to absolute paths are not moved | │ │ │ │ │ +| if (f.file_absolute_path(file_index)) continue; | │ │ │ │ │ | | │ │ │ │ │ -| 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_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| // if we ended up copying the file, don't do anything during | │ │ │ │ │ +| // roll-back | │ │ │ │ │ +| if (copied_files[file_index]) continue; | │ │ │ │ │ +| | │ │ │ │ │ +| 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)); | │ │ │ │ │ +| | │ │ │ │ │ +| // ignore errors when rolling back | │ │ │ │ │ +| storage_error ignore; | │ │ │ │ │ +| move_file(new_path, old_path, ignore); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| return { status_t::fatal_disk_error, save_path }; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| | │ │ │ │ │ +|std::set subdirs; | │ │ │ │ │ +| for (auto const i : f.file_range()) | │ │ │ │ │ +| { | │ │ │ │ │ +| // 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; | │ │ │ │ │ +| | │ │ │ │ │ +| 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); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| for (std::string const& s : subdirs) | │ │ │ │ │ +| { | │ │ │ │ │ +| error_code err; | │ │ │ │ │ +| std::string subdir = combine_path(save_path, s); | │ │ │ │ │ +| | │ │ │ │ │ +| 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); | │ │ │ │ │ +| | │ │ │ │ │ +| if (err) | │ │ │ │ │ +| { | │ │ │ │ │ +| ec.file(idx); | │ │ │ │ │ +| ec.operation = operation_t::mkdir; | │ │ │ │ │ +| return false; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| hard_link(s, file_path, err); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| // if the file already exists, that's not an error | │ │ │ │ │ +| if (err == boost::system::errc::file_exists) | │ │ │ │ │ +| continue; | │ │ │ │ │ +| | │ │ │ │ │ +|if (err) | │ │ │ │ │ +|{ | │ │ │ │ │ +| 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 | │ │ │ │ │ +| | │ │ │ │ │ +| bool const seed = (rd.have_pieces.size() >= fs.num_pieces() | │ │ │ │ │ +| && rd.have_pieces.all_set()) | │ │ │ │ │ +| || (rd.flags & torrent_flags::seed_mode); | │ │ │ │ │ +| | │ │ │ │ │ +| if (seed) | │ │ │ │ │ +| { | │ │ │ │ │ +| for (file_index_t const file_index : fs.file_range()) | │ │ │ │ │ +| { | │ │ │ │ │ +| if (fs.pad_file_at(file_index)) continue; | │ │ │ │ │ +| | │ │ │ │ │ +| // 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_/_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() | │ │ │ │ │ +|_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ | |_._._/_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 | │ │ │ │ │ @@ -2630,322 +2962,177 @@ │ │ │ │ │ | 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_/_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(a)...); | │ │ │ │ │ -| } | │ │ │ │ │ -|#ifndef BOOST_NO_EXCEPTIONS | │ │ │ │ │ -| catch (system_error const& e) { | │ │ │ │ │ -| alerts().emplace_alert(e.code(), e.what()); | │ │ │ │ │ -| pause(); | │ │ │ │ │ -| } catch (std::exception const& e) { | │ │ │ │ │ -| alerts().emplace_alert(error_code(), e.what()); | │ │ │ │ │ -| pause(); | │ │ │ │ │ -| } catch (...) { | │ │ │ │ │ -| alerts().emplace_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(); | │ │ │ │ │ +|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; | │ │ │ │ │ | | │ │ │ │ │ -| // apply all m_settings to this session | │ │ │ │ │ -| run_all_updates(*this); | │ │ │ │ │ -| reopen_listen_sockets(false); | │ │ │ │ │ +| std::mutex udp_tracker_connection::m_cache_mutex; | │ │ │ │ │ | | │ │ │ │ │ -|#if TORRENT_USE_INVARIANT_CHECKS | │ │ │ │ │ -| check_invariant(); | │ │ │ │ │ -|#endif | │ │ │ │ │ +| udp_tracker_connection::udp_tracker_connection( | │ │ │ │ │ +| io_context& ios | │ │ │ │ │ +| , tracker_manager& man | │ │ │ │ │ +| , tracker_request const& req | │ │ │ │ │ +| , std::weak_ptr 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(); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -|#if TORRENT_ABI_VERSION <= 2 | │ │ │ │ │ -|void session_impl::save_state(entry* eptr, save_state_flags_t const flags) const | │ │ │ │ │ -|{ | │ │ │ │ │ -| TORRENT_ASSERT(is_single_thread()); | │ │ │ │ │ +| void udp_tracker_connection::start() | │ │ │ │ │ +| { | │ │ │ │ │ +|std::string hostname; | │ │ │ │ │ +|std::string protocol; | │ │ │ │ │ +| int port; | │ │ │ │ │ +| error_code ec; | │ │ │ │ │ | | │ │ │ │ │ -| entry& e = *eptr; | │ │ │ │ │ -| // make it a dict | │ │ │ │ │ -| e.dict(); | │ │ │ │ │ +| 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 (flags & session::save_settings) | │ │ │ │ │ +| if (ec) | │ │ │ │ │ | { | │ │ │ │ │ -| entry::dictionary_type& sett = e["settings"].dict(); | │ │ │ │ │ -| save_settings_to_dict(non_default_settings(m_settings), sett); | │ │ │ │ │ +| tracker_connection::fail(ec, operation_t::parse_address); | │ │ │ │ │ +| return; | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -|#ifndef TORRENT_DISABLE_DHT | │ │ │ │ │ -| if (flags & session::save_dht_settings) | │ │ │ │ │ -| { | │ │ │ │ │ -| e["dht"] = dht::save_dht_settings(get_dht_settings()); | │ │ │ │ │ -| } | │ │ │ │ │ +| aux::session_settings const& settings = m_man.settings(); | │ │ │ │ │ | | │ │ │ │ │ -| if (m_dht && (flags & session::save_dht_state)) | │ │ │ │ │ -| { | │ │ │ │ │ -| e["dht state"] = dht::save_dht_state(m_dht->state()); | │ │ │ │ │ -| } | │ │ │ │ │ -|#endif | │ │ │ │ │ +| int const proxy_type = settings.get_int(settings_pack::proxy_type); | │ │ │ │ │ | | │ │ │ │ │ -|#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()) | │ │ │ │ │ +| if (settings.get_bool(settings_pack::proxy_hostnames) | │ │ │ │ │ +| && (proxy_type == settings_pack::socks5 | │ │ │ │ │ +| || proxy_type == settings_pack::socks5_pw)) | │ │ │ │ │ | { | │ │ │ │ │ -| std::shared_ptr 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; | │ │ │ │ │ -| } | │ │ │ │ │ +| m_hostname = hostname; | │ │ │ │ │ +| m_target.port(std::uint16_t(port)); | │ │ │ │ │ +| start_announce(); | │ │ │ │ │ | } | │ │ │ │ │ -| if (m_torrents.empty()) return; | │ │ │ │ │ +| 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_._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 ****** | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| 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 | │ │ │ │ │ +| dht_immutable_item_alert::dht_immutable_item_alert(aux::stack_allocator& | │ │ │ │ │ +| , sha1_hash const& t, entry i) | │ │ │ │ │ +| : target(t), item(std::move(i)) | │ │ │ │ │ +| {} | │ │ │ │ │ | | │ │ │ │ │ -| void session_impl::on_lsd_announce(error_code const& e) | │ │ │ │ │ +| std::string dht_immutable_item_alert::message() const | │ │ │ │ │ | { | │ │ │ │ │ -| 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); | │ │ │ │ │ +|#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 | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| void session_impl::update_count_slow() | │ │ │ │ │ -| { | │ │ │ │ │ -| 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); | │ │ │ │ │ -| } | │ │ │ │ │ +|dht_mutable_item_alert::dht_mutable_item_alert(aux::stack_allocator& | │ │ │ │ │ +|, std::array const& k | │ │ │ │ │ +| , std::array 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) | │ │ │ │ │ +| {} | │ │ │ │ │ | | │ │ │ │ │ -| std::uint16_t session_impl::listen_port(listen_socket_t* sock) const | │ │ │ │ │ +| std::string dht_mutable_item_alert::message() const | │ │ │ │ │ | { | │ │ │ │ │ -| 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; | │ │ │ │ │ -| | │ │ │ │ │ -| if (!(sock->flags & listen_socket_t::accept_incoming)) | │ │ │ │ │ -| return 0; | │ │ │ │ │ -| | │ │ │ │ │ -| return std::uint16_t(sock->tcp_external_port()); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -|#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; | │ │ │ │ │ -| | │ │ │ │ │ -| return std::uint16_t(sock->tcp_external_port()); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -|#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; | │ │ │ │ │ +|#ifdef TORRENT_DISABLE_ALERT_MSG | │ │ │ │ │ +| return {}; | │ │ │ │ │ |#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()); | │ │ │ │ │ +| 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 | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -|std::uint16_t session_impl::ssl_listen_port() const | │ │ │ │ │ +| dht_put_alert::dht_put_alert(aux::stack_allocator&, sha1_hash const& t, int n) | │ │ │ │ │ +| : target(t) | │ │ │ │ │ +| , public_key() | │ │ │ │ │ +| , signature() | │ │ │ │ │ +|_ _ _,_ _s_a_l_t_(_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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 ssl_listen_port(nullptr); | │ │ │ │ │ +| return escape_string_impl(str.data(), int(str.size()), 10); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| std::uint16_t session_impl::ssl_listen_port(listen_socket_t* sock) const | │ │ │ │ │ +| bool need_encoding(char const* str, int const len) | │ │ │ │ │ | { | │ │ │ │ │ -|#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) | │ │ │ │ │ +| for (int i = 0; i < len; ++i) | │ │ │ │ │ | { | │ │ │ │ │ -| if (!(s->flags & listen_socket_t::accept_incoming)) continue; | │ │ │ │ │ -| if (s->ssl == transport::ssl) | │ │ │ │ │ -| return std::uint16_t(s->tcp_external_port()); | │ │ │ │ │ +| if (std::strchr(unreserved_chars, *str) == nullptr || *str == 0) | │ │ │ │ │ +| return true; | │ │ │ │ │ +| ++str; | │ │ │ │ │ | } | │ │ │ │ │ -|#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); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| int session_impl::upload_rate_limit_depr() const | │ │ │ │ │ -| { | │ │ │ │ │ -| return upload_rate_limit(m_global_class); | │ │ │ │ │ +| return false; | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| int session_impl::download_rate_limit_depr() const | │ │ │ │ │ +| void convert_path_to_posix(std::string& path) | │ │ │ │ │ | { | │ │ │ │ │ -| return download_rate_limit(m_global_class); | │ │ │ │ │ +| std::replace(path.begin(), path.end(), '\\', '/'); | │ │ │ │ │ | } | │ │ │ │ │ -|#endif // DEPRECATE | │ │ │ │ │ | | │ │ │ │ │ -| | │ │ │ │ │ -|void session_impl::update_peer_dscp() | │ │ │ │ │ +|std::string read_until(char const*& str, char const delim, char const* end) | │ │ │ │ │ |{ | │ │ │ │ │ -| int const value = m_settings.get_int(settings_pack::peer_dscp); | │ │ │ │ │ -| for (auto const& l : m_listen_sockets) | │ │ │ │ │ +| TORRENT_ASSERT(str <= end); | │ │ │ │ │ +| | │ │ │ │ │ +| std::string ret; | │ │ │ │ │ +| while (str != end && *str != delim) | │ │ │ │ │ | { | │ │ │ │ │ -| if (l->sock) | │ │ │ │ │ -| { | │ │ │ │ │ -| error_code ec; | │ │ │ │ │ -| set_traffic_class(*l->sock, value, ec); | │ │ │ │ │ +| ret += *str; | │ │ │ │ │ +| ++str; | │ │ │ │ │ +| } | │ │ │ │ │ +| // skip the delimiter as well | │ │ │ │ │ +| while (str != end && *str == delim) ++str; | │ │ │ │ │ +| return ret; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -|#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()); | │ │ │ │ │ -| } | │ │ │ │ │ -|#endif | │ │ │ │ │ -| } | │ │ │ │ │ +| 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; | │ │ │ │ │ | | │ │ │ │ │ -| if (l->udp_sock) | │ │ │ │ │ -| { | │ │ │ │ │ -| error_code ec; | │ │ │ │ │ -| set_traffic_class(l->udp_sock->sock, value, ec); | │ │ │ │ │ +| // first figure out if this url contains unencoded characters | │ │ │ │ │ +| if (!need_encoding(path.c_str(), int(path.size()))) | │ │ │ │ │ +| return url; | │ │ │ │ │ | | │ │ │ │ │ -|#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_(_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| 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_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |_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); | │ │ │ │ │ @@ -3208,123 +3395,322 @@ │ │ │ │ │ | , 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_/ |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 c) | │ │ │ │ │ -| : tracker_connection(man, req, ios, std::move(c)) | │ │ │ │ │ -| , m_transaction_id(0) | │ │ │ │ │ -| , m_attempts(0) | │ │ │ │ │ -| , m_state(action_t::error) | │ │ │ │ │ -| , m_abort(false) | │ │ │ │ │ +|_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 | │ │ │ │ │ | { | │ │ │ │ │ -| update_transaction_id(); | │ │ │ │ │ +| (this->*f)(std::forward(a)...); | │ │ │ │ │ +| } | │ │ │ │ │ +|#ifndef BOOST_NO_EXCEPTIONS | │ │ │ │ │ +| catch (system_error const& e) { | │ │ │ │ │ +| alerts().emplace_alert(e.code(), e.what()); | │ │ │ │ │ +| pause(); | │ │ │ │ │ +| } catch (std::exception const& e) { | │ │ │ │ │ +| alerts().emplace_alert(error_code(), e.what()); | │ │ │ │ │ +| pause(); | │ │ │ │ │ +| } catch (...) { | │ │ │ │ │ +| alerts().emplace_alert(error_code(), "unknown error"); | │ │ │ │ │ +| pause(); | │ │ │ │ │ | } | │ │ │ │ │ +|#endif | │ │ │ │ │ | | │ │ │ │ │ -| void udp_tracker_connection::start() | │ │ │ │ │ -| { | │ │ │ │ │ -|std::string hostname; | │ │ │ │ │ -|std::string protocol; | │ │ │ │ │ -| int port; | │ │ │ │ │ +| // 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); } ); | │ │ │ │ │ | | │ │ │ │ │ -| std::tie(protocol, std::ignore, hostname, port, std::ignore) | │ │ │ │ │ -| = parse_url_components(tracker_req().url, ec); | │ │ │ │ │ -| if (port == -1) port = protocol == "http" ? 80 : 443; | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ +| session_log(" done starting session"); | │ │ │ │ │ +|#endif | │ │ │ │ │ | | │ │ │ │ │ -| if (ec) | │ │ │ │ │ +| // 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) | │ │ │ │ │ | { | │ │ │ │ │ -| tracker_connection::fail(ec, operation_t::parse_address); | │ │ │ │ │ -| return; | │ │ │ │ │ +| entry::dictionary_type& sett = e["settings"].dict(); | │ │ │ │ │ +| save_settings_to_dict(non_default_settings(m_settings), sett); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| aux::session_settings const& settings = m_man.settings(); | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_DHT | │ │ │ │ │ +| if (flags & session::save_dht_settings) | │ │ │ │ │ +| { | │ │ │ │ │ +| e["dht"] = dht::save_dht_settings(get_dht_settings()); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| int const proxy_type = settings.get_int(settings_pack::proxy_type); | │ │ │ │ │ +| if (m_dht && (flags & session::save_dht_state)) | │ │ │ │ │ +| { | │ │ │ │ │ +| e["dht state"] = dht::save_dht_state(m_dht->state()); | │ │ │ │ │ +| } | │ │ │ │ │ +|#endif | │ │ │ │ │ | | │ │ │ │ │ -| if (settings.get_bool(settings_pack::proxy_hostnames) | │ │ │ │ │ -| && (proxy_type == settings_pack::socks5 | │ │ │ │ │ -| || proxy_type == settings_pack::socks5_pw)) | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_EXTENSIONS | │ │ │ │ │ +| for (auto const& ext : m_ses_extensions[plugins_all_idx]) | │ │ │ │ │ | { | │ │ │ │ │ -| m_hostname = hostname; | │ │ │ │ │ -| m_target.port(std::uint16_t(port)); | │ │ │ │ │ -| start_announce(); | │ │ │ │ │ +| 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 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; | │ │ │ │ │ +| } | │ │ │ │ │ | } | │ │ │ │ │ -| else | │ │ │ │ │ +| 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()) | │ │ │ │ │ | { | │ │ │ │ │ -| 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_/_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 ****** | │ │ │ │ │ -|} | │ │ │ │ │ +| 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 | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| bdecode_node bdecode(span buffer | │ │ │ │ │ -| , error_code& ec, int* error_pos, int depth_limit, int token_limit) | │ │ │ │ │ +| void session_impl::update_count_slow() | │ │ │ │ │ | { | │ │ │ │ │ -| bdecode_node ret; | │ │ │ │ │ -| ec.clear(); | │ │ │ │ │ +| error_code ec; | │ │ │ │ │ +| for (auto const& tp : m_torrents) | │ │ │ │ │ +| { | │ │ │ │ │ +| tp->on_inactivity_tick(ec); | │ │ │ │ │ +| } | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| if (buffer.size() > bdecode_token::max_offset) | │ │ │ │ │ +|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) | │ │ │ │ │ | { | │ │ │ │ │ -| if (error_pos) *error_pos = 0; | │ │ │ │ │ -| ec = bdecode_errors::limit_exceeded; | │ │ │ │ │ -| return ret; | │ │ │ │ │ +| // 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; | │ │ │ │ │ +| | │ │ │ │ │ +| if (!(sock->flags & listen_socket_t::accept_incoming)) | │ │ │ │ │ +| return 0; | │ │ │ │ │ +| | │ │ │ │ │ +| return std::uint16_t(sock->tcp_external_port()); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| // 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); | │ │ │ │ │ +|#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; | │ │ │ │ │ | | │ │ │ │ │ -|char const* start = buffer.data(); | │ │ │ │ │ -|char const* end = start + buffer.size(); | │ │ │ │ │ -| char const* const orig_start = start; | │ │ │ │ │ +| return std::uint16_t(sock->tcp_external_port()); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| if (start == end) | │ │ │ │ │ -| TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof); | │ │ │ │ │ +|#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 | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| while (start <= end) | │ │ │ │ │ +|std::uint16_t session_impl::ssl_listen_port() const | │ │ │ │ │ +|{ | │ │ │ │ │ +| 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 (start >= end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof); | │ │ │ │ │ +| if (!(sock->flags & listen_socket_t::accept_incoming)) return 0; | │ │ │ │ │ +| return std::uint16_t(sock->tcp_external_port()); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| if (sp >= depth_limit) | │ │ │ │ │ -| TORRENT_FAIL_BDECODE(bdecode_errors::depth_exceeded); | │ │ │ │ │ +| if (m_settings.get_int(settings_pack::proxy_type) != settings_pack::none | │ │ │ │ │ +| && m_settings.get_bool(settings_pack::proxy_peer_connections)) | │ │ │ │ │ +| return 0; | │ │ │ │ │ | | │ │ │ │ │ -| --token_limit; | │ │ │ │ │ -| if (token_limit < 0) | │ │ │ │ │ -| TORRENT_FAIL_BDECODE(bdecode_errors::limit_exceeded); | │ │ │ │ │ +| 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; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| // look for a new token | │ │ │ │ │ -| char const t = *start; | │ │ │ │ │ +|_ _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 const current_frame = sp; | │ │ │ │ │ +| int session_impl::local_download_rate_limit() const | │ │ │ │ │ +| { | │ │ │ │ │ +| return download_rate_limit(m_local_peer_class); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| // 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) | │ │ │ │ │ +| 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 (stack[current_frame - 1].state == 0) | │ │ │ │ │ +| error_code ec; | │ │ │ │ │ +| set_traffic_class(*l->sock, value, ec); | │ │ │ │ │ +| | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ +| if (should_log()) | │ │ │ │ │ | { | │ │ │ │ │ -|_ _ _ _ _ _/_/_ _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_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| 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_/_p_i_e_c_e___p_i_c_k_e_r_._c_p_p_:_1_9_9_6_ _ _|_m_a_k_e_ _t_h_e_ _2_0_4_8_ _l_i_m_i_t_ _c_o_n_f_i_g_u_r_a_b_l_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |********** mmaakkee tthhee 22004488 lliimmiitt ccoonnffiigguurraabbllee ********** | │ │ │ │ │ |****** ....//ssrrcc//ppiieeccee__ppiicckkeerr..ccpppp::11999966 ****** | │ │ │ │ │ |// indicating which path thought the picker we took to arrive at the | │ │ │ │ │ | // returned block picks. | │ │ │ │ │ | picker_flags_t piece_picker::pick_pieces(typed_bitfield const& pieces | │ │ │ │ │ | , std::vector& interesting_blocks, int num_blocks | │ │ │ │ │ @@ -3480,14 +3866,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_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 " | │ │ │ │ │ +| "transaction ID (%x)", print_endpoint(ep).c_str() | │ │ │ │ │ +| , transaction); | │ │ │ │ │ +| } | │ │ │ │ │ +|#endif | │ │ │ │ │ +| return false; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| std::shared_ptr const p = i->second; | │ │ │ │ │ +| // on_receive() may remove the tracker connection from the list | │ │ │ │ │ +| return p->on_receive(ep, buf); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| void tracker_manager::incoming_error(error_code const& | │ │ │ │ │ +| , udp::endpoint const&) | │ │ │ │ │ +| { | │ │ │ │ │ +| TORRENT_ASSERT(is_single_thread()); | │ │ │ │ │ +|} | │ │ │ │ │ +| | │ │ │ │ │ +| bool tracker_manager::incoming_packet(string_view const hostname | │ │ │ │ │ +| , span const buf) | │ │ │ │ │ +| { | │ │ │ │ │ +| TORRENT_ASSERT(is_single_thread()); | │ │ │ │ │ +| // ignore packets smaller than 8 bytes | │ │ │ │ │ +| if (buf.size() < 16) return false; | │ │ │ │ │ +| | │ │ │ │ │ +| // the first word is the action, if it's not [0, 3] | │ │ │ │ │ +| // it's not a valid udp tracker response | │ │ │ │ │ +| span ptr = buf; | │ │ │ │ │ +| std::uint32_t const action = aux::read_uint32(ptr); | │ │ │ │ │ +| if (action > 3) return false; | │ │ │ │ │ +| | │ │ │ │ │ +| std::uint32_t const transaction = aux::read_uint32(ptr); | │ │ │ │ │ +| auto const i = m_udp_conns.find(transaction); | │ │ │ │ │ +| | │ │ │ │ │ +| if (i == m_udp_conns.end()) | │ │ │ │ │ +| { | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ +| // now, this may not have been meant to be a tracker response, | │ │ │ │ │ +| // but chances are pretty good, so it's probably worth logging | │ │ │ │ │ +| m_ses.session_log("incoming UDP tracker packet from %s has invalid " | │ │ │ │ │ +| "transaction ID (%x)", std::string(hostname).c_str(), int(transaction)); | │ │ │ │ │ +|#endif | │ │ │ │ │ +| return false; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| std::shared_ptr const p = i->second; | │ │ │ │ │ +|_ _ _/_/_ _o_n___r_e_c_e_i_v_e_(_)_ _m_a_y_ _r_e_m_o_v_e_ _t_h_e_ _t_r_a_c_k_e_r_ _c_o_n_n_e_c_t_i_o_n_ _f_r_o_m_ _t_h_e_ _l_i_s_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |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) | │ │ │ │ │ | { | │ │ │ │ │ @@ -3536,454 +3976,69 @@ │ │ │ │ │ | 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_/_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) | │ │ │ │ │ -| { | │ │ │ │ │ -| ec.clear(); | │ │ │ │ │ -| return; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| // 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; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| // fall back to making a copy | │ │ │ │ │ -| | │ │ │ │ │ -|#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_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| | |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)) | │ │ │ │ │ -| { | │ │ │ │ │ -| // files moved out to absolute paths are not moved | │ │ │ │ │ -| if (f.file_absolute_path(file_index)) continue; | │ │ │ │ │ -| | │ │ │ │ │ -| // if we ended up copying the file, don't do anything during | │ │ │ │ │ -| // roll-back | │ │ │ │ │ -| if (copied_files[file_index]) continue; | │ │ │ │ │ -| | │ │ │ │ │ -| 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)); | │ │ │ │ │ -| | │ │ │ │ │ -| // ignore errors when rolling back | │ │ │ │ │ -| storage_error ignore; | │ │ │ │ │ -| move_file(new_path, old_path, ignore); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| return { status_t::fatal_disk_error, save_path }; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| | │ │ │ │ │ -|std::set subdirs; | │ │ │ │ │ -| for (auto const i : f.file_range()) | │ │ │ │ │ -| { | │ │ │ │ │ -| // 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; | │ │ │ │ │ -| | │ │ │ │ │ -| 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); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| for (std::string const& s : subdirs) | │ │ │ │ │ -| { | │ │ │ │ │ -| error_code err; | │ │ │ │ │ -| std::string subdir = combine_path(save_path, s); | │ │ │ │ │ -| | │ │ │ │ │ -| 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); | │ │ │ │ │ -| | │ │ │ │ │ -| if (err) | │ │ │ │ │ -| { | │ │ │ │ │ -| ec.file(idx); | │ │ │ │ │ -| ec.operation = operation_t::mkdir; | │ │ │ │ │ -| return false; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| hard_link(s, file_path, err); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| // if the file already exists, that's not an error | │ │ │ │ │ -| if (err == boost::system::errc::file_exists) | │ │ │ │ │ -| continue; | │ │ │ │ │ -| | │ │ │ │ │ -|if (err) | │ │ │ │ │ -|{ | │ │ │ │ │ -| 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 | │ │ │ │ │ -| | │ │ │ │ │ -| bool const seed = (rd.have_pieces.size() >= fs.num_pieces() | │ │ │ │ │ -| && rd.have_pieces.all_set()) | │ │ │ │ │ -| || (rd.flags & torrent_flags::seed_mode); | │ │ │ │ │ -| | │ │ │ │ │ -| if (seed) | │ │ │ │ │ -| { | │ │ │ │ │ -| for (file_index_t const file_index : fs.file_range()) | │ │ │ │ │ -| { | │ │ │ │ │ -| if (fs.pad_file_at(file_index)) continue; | │ │ │ │ │ -| | │ │ │ │ │ -| // 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_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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 | │ │ │ │ │ -| | │ │ │ │ │ -| write_reject_request(r); | │ │ │ │ │ -| if (m_num_invalid_requests < std::numeric_limits::max()) | │ │ │ │ │ -| ++m_num_invalid_requests; | │ │ │ │ │ -| | │ │ │ │ │ -| if (t->alerts().should_post()) | │ │ │ │ │ -| { | │ │ │ │ │ -| // msvc 12 appears to deduce the rvalue reference template | │ │ │ │ │ -| // incorrectly for bool temporaries. So, create a dummy instance | │ │ │ │ │ -| bool const peer_interested = bool(m_peer_interested); | │ │ │ │ │ -| t->alerts().emplace_alert( | │ │ │ │ │ -| t->get_handle(), m_remote, m_peer_id, r | │ │ │ │ │ -| , t->user_have_piece(r.piece), peer_interested, false); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| // every ten invalid request, remind the peer that it's choked | │ │ │ │ │ -| if (!m_peer_interested && m_num_invalid_requests % 10 == 0 && m_choked) | │ │ │ │ │ -| { | │ │ │ │ │ -|if (m_num_invalid_requests > 300 && !m_peer_choked | │ │ │ │ │ -|&& can_disconnect(errors::too_many_requests_when_choked)) | │ │ │ │ │ -| { | │ │ │ │ │ -| disconnect(errors::too_many_requests_when_choked, operation_t::bittorrent, peer_error); | │ │ │ │ │ -| return; | │ │ │ │ │ -| } | │ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ -| peer_log(peer_log_alert::outgoing_message, "CHOKE"); | │ │ │ │ │ -|#endif | │ │ │ │ │ -| write_choke(); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| return; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| // if we have choked the client | │ │ │ │ │ -| // ignore the request | │ │ │ │ │ -| int const blocks_per_piece = | │ │ │ │ │ -| (ti.piece_length() + t->block_size() - 1) / t->block_size(); | │ │ │ │ │ -| | │ │ │ │ │ -| // disconnect peers that downloads more than foo times an allowed | │ │ │ │ │ -| // fast piece | │ │ │ │ │ -| if (m_choked && fast_idx != -1 && m_accept_fast_piece_cnt[fast_idx] >= 3 * blocks_per_piece | │ │ │ │ │ -| && can_disconnect(errors::too_many_requests_when_choked)) | │ │ │ │ │ -| { | │ │ │ │ │ -| disconnect(errors::too_many_requests_when_choked, operation_t::bittorrent, peer_error); | │ │ │ │ │ -| return; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| if (m_choked && fast_idx == -1) | │ │ │ │ │ -|_ _ _{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -| |_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_: |since we throw away the queue entry once we issue the disk job, this may happen. Instead, we should keep the queue entry around, | │ │ │ │ │ -|relevance 2|_3_3_0_9 |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| │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_t_o_ _c_a_n_c_e_l_ _d_i_s_k_ _j_o_b_s_?_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|********** ssiinnccee wwee tthhrrooww aawwaayy tthhee qquueeuuee eennttrryy oonnccee wwee iissssuuee tthhee ddiisskk jjoobb,, tthhiiss mmaayy hhaappppeenn.. IInnsstteeaadd,, wwee sshhoouulldd kkeeeepp tthhee qquueeuuee eennttrryy aarroouunndd,, mmaarrkk iitt aass hhaavviinngg bbeeeenn rreeqquueesstteedd ffrroomm | │ │ │ │ │ -|ddiisskk aanndd oonnccee tthhee ddiisskk jjoobb ccoommeess bbaacckk,, ddiissccaarrdd iitt iiff iitt hhaass bbeeeenn ccaanncceelllleedd.. MMaayybbee eevveenn bbee aabbllee ttoo ccaanncceell ddiisskk jjoobbss?? ********** | │ │ │ │ │ -|****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::33330099 ****** | │ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ -| peer_log(peer_log_alert::incoming_message, "CANCEL" | │ │ │ │ │ -| , "piece: %d s: %x l: %x", static_cast(r.piece), r.start, r.length); | │ │ │ │ │ -|#endif | │ │ │ │ │ -| | │ │ │ │ │ -| auto const i = std::find(m_requests.begin(), m_requests.end(), r); | │ │ │ │ │ -| | │ │ │ │ │ -| if (i != m_requests.end()) | │ │ │ │ │ -| { | │ │ │ │ │ -| m_counters.inc_stats_counter(counters::cancelled_piece_requests); | │ │ │ │ │ -| m_requests.erase(i); | │ │ │ │ │ -| | │ │ │ │ │ -| if (m_requests.empty()) | │ │ │ │ │ -| m_counters.inc_stats_counter(counters::num_peers_up_requests, -1); | │ │ │ │ │ -| | │ │ │ │ │ -| write_reject_request(r); | │ │ │ │ │ -| } | │ │ │ │ │ -| else | │ │ │ │ │ -| { | │ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ -|peer_log(peer_log_alert::info, "INVALID_CANCEL", "got cancel not in the queue"); | │ │ │ │ │ -|#endif | │ │ │ │ │ -| } | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| // ----------------------------- | │ │ │ │ │ -| // --------- DHT PORT ---------- | │ │ │ │ │ -| // ----------------------------- | │ │ │ │ │ +|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; | │ │ │ │ │ +| }; | │ │ │ │ │ | | │ │ │ │ │ -| void peer_connection::incoming_dht_port(int const listen_port) | │ │ │ │ │ +| // internal | │ │ │ │ │ +| bool operator<(peer_entry const& lhs, peer_entry const& rhs) | │ │ │ │ │ | { | │ │ │ │ │ -| TORRENT_ASSERT(is_single_thread()); | │ │ │ │ │ -| INVARIANT_CHECK; | │ │ │ │ │ -| | │ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ -| peer_log(peer_log_alert::incoming_message, "DHT_PORT", "p: %d", listen_port); | │ │ │ │ │ -|#endif | │ │ │ │ │ -|#ifndef TORRENT_DISABLE_DHT | │ │ │ │ │ -| m_ses.add_dht_node({m_remote.address(), std::uint16_t(listen_port)}); | │ │ │ │ │ -|#else | │ │ │ │ │ -| TORRENT_UNUSED(listen_port); | │ │ │ │ │ -|#endif | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| // ----------------------------- | │ │ │ │ │ -| // --------- HAVE ALL ---------- | │ │ │ │ │ -| // ----------------------------- | │ │ │ │ │ -| | │ │ │ │ │ -| void peer_connection::incoming_have_all() | │ │ │ │ │ -|_ _{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|relevance 2|_._._/_s_r_c_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n_._c_p_p_: |use a deadline_timer for timeouts. Don't rely on second_tick()! Hook this up to connect timeout as well. This would improve | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_4_9_7_5_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_p_e_r_f_o_r_m_a_n_c_e_ _b_e_c_a_u_s_e_ _o_f_ _l_e_s_s_ _w_o_r_k_ _i_n_ _s_e_c_o_n_d___t_i_c_k_(_)_,_ _a_n_d_ _m_i_g_h_t_ _l_e_t_ _u_s_e_ _r_e_m_o_v_e_ _t_i_c_k_i_n_g_ _e_n_t_i_r_e_l_y_ _e_v_e_n_t_u_a_l_l_y_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|********** uussee aa ddeeaaddlliinnee__ttiimmeerr ffoorr ttiimmeeoouuttss.. DDoonn''tt rreellyy oonn sseeccoonndd__ttiicckk(())!! HHooookk tthhiiss uupp ttoo ccoonnnneecctt ttiimmeeoouutt aass wweellll.. TThhiiss wwoouulldd iimmpprroovvee ppeerrffoorrmmaannccee bbeeccaauussee ooff lleessss wwoorrkk iinn | │ │ │ │ │ -|sseeccoonndd__ttiicckk(()),, aanndd mmiigghhtt lleett uussee rreemmoovvee ttiicckkiinngg eennttiirreellyy eevveennttuuaallllyy ********** | │ │ │ │ │ -|****** ....//ssrrcc//ppeeeerr__ccoonnnneeccttiioonn..ccpppp::44997755 ****** | │ │ │ │ │ -|if (d > seconds(connect_timeout) | │ │ │ │ │ -| && can_disconnect(errors::timed_out)) | │ │ │ │ │ -| { | │ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ -| peer_log(peer_log_alert::info, "CONNECT_FAILED", "waited %d seconds" | │ │ │ │ │ -| , int(total_seconds(d))); | │ │ │ │ │ -|#endif | │ │ │ │ │ -| connect_failed(errors::timed_out); | │ │ │ │ │ -| return; | │ │ │ │ │ -| } | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| // if the bw_network flag isn't set, it means we are not even trying to | │ │ │ │ │ -| // read from this peer's socket. Most likely because we're applying a | │ │ │ │ │ -| // rate limit. If the peer is "slow" because we are rate limiting it, | │ │ │ │ │ -| // don't enforce timeouts. However, as soon as we *do* read from the | │ │ │ │ │ -| // socket, we expect to receive data, and not have timed out. Then we | │ │ │ │ │ -| // can enforce the timeouts. | │ │ │ │ │ -| bool const reading_socket = bool(m_channel_state[download_channel] & peer_info::bw_network); | │ │ │ │ │ -| | │ │ │ │ │ -|if (reading_socket && d > seconds(timeout()) && !m_connecting && m_reading_bytes == 0 | │ │ │ │ │ -|&& can_disconnect(errors::timed_out_inactivity)) | │ │ │ │ │ -| { | │ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ -| peer_log(peer_log_alert::info, "LAST_ACTIVITY", "%d seconds ago" | │ │ │ │ │ -| , int(total_seconds(d))); | │ │ │ │ │ -|#endif | │ │ │ │ │ -| disconnect(errors::timed_out_inactivity, operation_t::bittorrent); | │ │ │ │ │ -| return; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| // do not stall waiting for a handshake | │ │ │ │ │ -| int timeout = m_settings.get_int (settings_pack::handshake_timeout); | │ │ │ │ │ -|#if TORRENT_USE_I2P | │ │ │ │ │ -| timeout *= is_i2p(m_socket) ? 4 : 1; | │ │ │ │ │ -|#endif | │ │ │ │ │ -| if (reading_socket | │ │ │ │ │ -| && !m_connecting | │ │ │ │ │ -| && in_handshake() | │ │ │ │ │ -| && d > seconds(timeout)) | │ │ │ │ │ -| { | │ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ -| peer_log(peer_log_alert::info, "NO_HANDSHAKE", "waited %d seconds" | │ │ │ │ │ -| , int(total_seconds(d))); | │ │ │ │ │ -|#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_/_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_/_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; | │ │ │ │ │ +| return lhs.addr.address() == rhs.addr.address() | │ │ │ │ │ +| ? lhs.addr.port() < rhs.addr.port() | │ │ │ │ │ +| : lhs.addr.address() < rhs.addr.address(); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| void alert_manager::maybe_notify(alert* a) | │ │ │ │ │ +| // this is a group. It contains a set of group members | │ │ │ │ │ +| struct torrent_entry | │ │ │ │ │ | { | │ │ │ │ │ -| 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(); | │ │ │ │ │ -|} | │ │ │ │ │ +| std::string name; | │ │ │ │ │ +| std::vector peers4; | │ │ │ │ │ +| std::vector peers6; | │ │ │ │ │ +| }; | │ │ │ │ │ | | │ │ │ │ │ -|#ifndef TORRENT_DISABLE_EXTENSIONS | │ │ │ │ │ -| for (auto& e : m_ses_extensions) | │ │ │ │ │ -| e->on_alert(a); | │ │ │ │ │ -|#else | │ │ │ │ │ -| TORRENT_UNUSED(a); | │ │ │ │ │ -|#endif | │ │ │ │ │ -| } | │ │ │ │ │ +|constexpr time_duration announce_interval = minutes(30); | │ │ │ │ │ | | │ │ │ │ │ -| void alert_manager::set_notify_function(std::function const& fun) | │ │ │ │ │ +| struct dht_immutable_item | │ │ │ │ │ | { | │ │ │ │ │ -| std::unique_lock lock(m_mutex); | │ │ │ │ │ -| m_notify = fun; | │ │ │ │ │ -| if (!m_alerts[m_generation].empty()) | │ │ │ │ │ -| { | │ │ │ │ │ -| if (m_notify) m_notify(); | │ │ │ │ │ -| } | │ │ │ │ │ -| } | │ │ │ │ │ +| // the actual value | │ │ │ │ │ +| std::unique_ptr 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; | │ │ │ │ │ +| }; | │ │ │ │ │ | | │ │ │ │ │ -|#ifndef TORRENT_DISABLE_EXTENSIONS | │ │ │ │ │ -| void alert_manager::add_extension(std::shared_ptr ext) | │ │ │ │ │ +| struct dht_mutable_item : dht_immutable_item | │ │ │ │ │ | { | │ │ │ │ │ -| m_ses_extensions.push_back(std::move(ext)); | │ │ │ │ │ -| } | │ │ │ │ │ -|#endif | │ │ │ │ │ +| signature sig{}; | │ │ │ │ │ +| sequence_number seq{}; | │ │ │ │ │ +| public_key key{}; | │ │ │ │ │ +| std::string salt; | │ │ │ │ │ +| }; | │ │ │ │ │ | | │ │ │ │ │ -| void alert_manager::get_all(std::vector& alerts) | │ │ │ │ │ +| void set_value(dht_immutable_item& item, span buf) | │ │ │ │ │ | { | │ │ │ │ │ -|_ _ _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_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_ _ _i_n_t_ _c_o_n_s_t_ _s_i_z_e_ _=_ _i_n_t_(_b_u_f_._s_i_z_e_(_)_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |_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 | │ │ │ │ │ @@ -4171,69 +4226,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; | │ │ │ │ │ -| }; | │ │ │ │ │ +|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); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| // internal | │ │ │ │ │ -| bool operator<(peer_entry const& lhs, peer_entry const& rhs) | │ │ │ │ │ +| void close(error_code& ec) | │ │ │ │ │ | { | │ │ │ │ │ -| return lhs.addr.address() == rhs.addr.address() | │ │ │ │ │ -| ? lhs.addr.port() < rhs.addr.port() | │ │ │ │ │ -| : lhs.addr.address() < rhs.addr.address(); | │ │ │ │ │ +| m_dst_name.clear(); | │ │ │ │ │ +| proxy_base::close(ec); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| // this is a group. It contains a set of group members | │ │ │ │ │ -| struct torrent_entry | │ │ │ │ │ +|#ifndef BOOST_NO_EXCEPTIONS | │ │ │ │ │ +| void close() | │ │ │ │ │ | { | │ │ │ │ │ -| std::string name; | │ │ │ │ │ -| std::vector peers4; | │ │ │ │ │ -| std::vector peers6; | │ │ │ │ │ -| }; | │ │ │ │ │ -| | │ │ │ │ │ -|constexpr time_duration announce_interval = minutes(30); | │ │ │ │ │ +| m_dst_name.clear(); | │ │ │ │ │ +| proxy_base::close(); | │ │ │ │ │ +| } | │ │ │ │ │ +|#endif | │ │ │ │ │ | | │ │ │ │ │ -| struct dht_immutable_item | │ │ │ │ │ +|template | │ │ │ │ │ +|void async_connect(endpoint_type const& endpoint, Handler handler) | │ │ │ │ │ | { | │ │ │ │ │ -| // the actual value | │ │ │ │ │ -| std::unique_ptr 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; | │ │ │ │ │ -| }; | │ │ │ │ │ +| // 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)); | │ │ │ │ │ | | │ │ │ │ │ -| struct dht_mutable_item : dht_immutable_item | │ │ │ │ │ -| { | │ │ │ │ │ -| signature sig{}; | │ │ │ │ │ -| sequence_number seq{}; | │ │ │ │ │ -| public_key key{}; | │ │ │ │ │ -| std::string salt; | │ │ │ │ │ -| }; | │ │ │ │ │ +| m_remote_endpoint = endpoint; | │ │ │ │ │ | | │ │ │ │ │ -| void set_value(dht_immutable_item& item, span buf) | │ │ │ │ │ -| { | │ │ │ │ │ -|_ _ _i_n_t_ _c_o_n_s_t_ _s_i_z_e_ _=_ _i_n_t_(_b_u_f_._s_i_z_e_(_)_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| // 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 | │ │ │ │ │ +| 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_/ |use the resolver interface that has a built-in cache | │ │ │ │ │ |_ _ _ _ _ _ _ _ _ _ _ _|_p_r_o_x_y___b_a_s_e_._h_p_p_:_3_2_7_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |********** uussee tthhee rreessoollvveerr iinntteerrffaaccee tthhaatt hhaass aa bbuuiilltt--iinn ccaacchhee ********** | │ │ │ │ │ |****** ....//iinncclluuddee//lliibbttoorrrreenntt//pprrooxxyy__bbaassee..hhpppp::332277 ****** | │ │ │ │ │ | // The handler must be taken as lvalue reference here since we may not call | │ │ │ │ │ | // it. But if we do, we want the call operator to own the function object. | │ │ │ │ │ | template | │ │ │ │ │ @@ -4335,124 +4390,14 @@ │ │ │ │ │ | } | │ │ │ │ │ | sock.bind(bind_ep, ec); | │ │ │ │ │ | return bind_ep.address(); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ | // returns the device name whose local address is ``addr``. If | │ │ │ │ │ |_ _/_/_ _n_o_ _s_u_c_h_ _d_e_v_i_c_e_ _i_s_ _f_o_u_n_d_,_ _a_n_ _e_m_p_t_y_ _s_t_r_i_n_g_ _i_s_ _r_e_t_u_r_n_e_d_._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| // the number of peers that has this piece | │ │ │ │ │ -| // (availability) | │ │ │ │ │ -| std::uint32_t peer_count : 26; | │ │ │ │ │ -| | │ │ │ │ │ -| // one of the download_queue_t values. This indicates whether this piece | │ │ │ │ │ -| // is currently being downloaded or not, and what state it's in if | │ │ │ │ │ -| // it is. Specifically, as an optimization, pieces that have all blocks | │ │ │ │ │ -| // requested from them are separated out into separate lists to make | │ │ │ │ │ -| // lookups quicker. The main oddity is that whether a downloading piece | │ │ │ │ │ -| // has only been requested from peers that are reverse, that's | │ │ │ │ │ -| // recorded as piece_downloading_reverse, which really means the same | │ │ │ │ │ -| // as piece_downloading, it just saves space to also indicate that it | │ │ │ │ │ -| // has a bit lower priority. The reverse bit is only relevant if the | │ │ │ │ │ -| // state is piece_downloading. | │ │ │ │ │ -| std::uint32_t download_state : 3; | │ │ │ │ │ -| | │ │ │ │ │ -| | │ │ │ │ │ -|// is 0 if the piece is filtered (not to be downloaded) | │ │ │ │ │ -| // 1 is low priority | │ │ │ │ │ -| // 2 is low priority | │ │ │ │ │ -| // 3 is mid priority | │ │ │ │ │ -| // 4 is default priority | │ │ │ │ │ -| // 5 is mid priority | │ │ │ │ │ -| // 6 is high priority | │ │ │ │ │ -| // 7 is high priority | │ │ │ │ │ -| std::uint32_t piece_priority : 3; | │ │ │ │ │ -| | │ │ │ │ │ -| // index in to the piece_info vector | │ │ │ │ │ -| prio_index_t index; | │ │ │ │ │ -| | │ │ │ │ │ -|#ifdef TORRENT_DEBUG_REFCOUNTS | │ │ │ │ │ -| // all the peers that have this piece | │ │ │ │ │ -| std::set have_peers; | │ │ │ │ │ -|#endif | │ │ │ │ │ -| | │ │ │ │ │ -| // index is set to this to indicate that we have the | │ │ │ │ │ -| // piece. There is no entry for the piece in the | │ │ │ │ │ -| // buckets if this is the case. | │ │ │ │ │ -| static constexpr prio_index_t we_have_index{-1}; | │ │ │ │ │ -| | │ │ │ │ │ -| // the priority value that means the piece is filtered | │ │ │ │ │ -| static constexpr std::uint32_t filter_priority = 0; | │ │ │ │ │ -| | │ │ │ │ │ -| // the max number the peer count can hold | │ │ │ │ │ -| static constexpr std::uint32_t max_peer_count = 0xffff; | │ │ │ │ │ -| | │ │ │ │ │ -|_ _ _ _b_o_o_l_ _h_a_v_e_(_)_ _c_o_n_s_t_ _{_ _r_e_t_u_r_n_ _i_n_d_e_x_ _=_=_ _w_e___h_a_v_e___i_n_d_e_x_;_ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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 | │ │ │ │ │ -|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 | │ │ │ │ │ -| 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 | │ │ │ │ │ @@ -4552,69 +4497,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_/_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" | │ │ │ │ │ +|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); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -|#include | │ │ │ │ │ -|#include | │ │ │ │ │ +| // the number of peers that has this piece | │ │ │ │ │ +| // (availability) | │ │ │ │ │ +| std::uint32_t peer_count : 26; | │ │ │ │ │ | | │ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_push.hpp" | │ │ │ │ │ -|#include | │ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_pop.hpp" | │ │ │ │ │ +| // one of the download_queue_t values. This indicates whether this piece | │ │ │ │ │ +| // is currently being downloaded or not, and what state it's in if | │ │ │ │ │ +| // it is. Specifically, as an optimization, pieces that have all blocks | │ │ │ │ │ +| // requested from them are separated out into separate lists to make | │ │ │ │ │ +| // lookups quicker. The main oddity is that whether a downloading piece | │ │ │ │ │ +| // has only been requested from peers that are reverse, that's | │ │ │ │ │ +| // recorded as piece_downloading_reverse, which really means the same | │ │ │ │ │ +| // as piece_downloading, it just saves space to also indicate that it | │ │ │ │ │ +| // has a bit lower priority. The reverse bit is only relevant if the | │ │ │ │ │ +| // state is piece_downloading. | │ │ │ │ │ +| std::uint32_t download_state : 3; | │ │ │ │ │ | | │ │ │ │ │ -|#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 { | │ │ │ │ │ +|// is 0 if the piece is filtered (not to be downloaded) | │ │ │ │ │ +| // 1 is low priority | │ │ │ │ │ +| // 2 is low priority | │ │ │ │ │ +| // 3 is mid priority | │ │ │ │ │ +| // 4 is default priority | │ │ │ │ │ +| // 5 is mid priority | │ │ │ │ │ +| // 6 is high priority | │ │ │ │ │ +| // 7 is high priority | │ │ │ │ │ +| std::uint32_t piece_priority : 3; | │ │ │ │ │ | | │ │ │ │ │ -|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; | │ │ │ │ │ +| // index in to the piece_info vector | │ │ │ │ │ +| prio_index_t index; | │ │ │ │ │ +| | │ │ │ │ │ +|#ifdef TORRENT_DEBUG_REFCOUNTS | │ │ │ │ │ +| // all the peers that have this piece | │ │ │ │ │ +| std::set have_peers; | │ │ │ │ │ |#endif | │ │ │ │ │ -| } | │ │ │ │ │ | | │ │ │ │ │ -| private: | │ │ │ │ │ +| // index is set to this to indicate that we have the | │ │ │ │ │ +| // piece. There is no entry for the piece in the | │ │ │ │ │ +| // buckets if this is the case. | │ │ │ │ │ +| static constexpr prio_index_t we_have_index{-1}; | │ │ │ │ │ | | │ │ │ │ │ -| // destructs/frees the holder object | │ │ │ │ │ -| using destruct_holder_fun = void (*)(void*); | │ │ │ │ │ -| using move_construct_holder_fun = void (*)(void*, void*); | │ │ │ │ │ +| // the priority value that means the piece is filtered | │ │ │ │ │ +| static constexpr std::uint32_t filter_priority = 0; | │ │ │ │ │ | | │ │ │ │ │ -| 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 | │ │ │ │ │ -|_ _ _ _{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| // the max number the peer count can hold | │ │ │ │ │ +| static constexpr std::uint32_t max_peer_count = 0xffff; | │ │ │ │ │ +| | │ │ │ │ │ +|_ _ _ _b_o_o_l_ _h_a_v_e_(_)_ _c_o_n_s_t_ _{_ _r_e_t_u_r_n_ _i_n_d_e_x_ _=_=_ _w_e___h_a_v_e___i_n_d_e_x_;_ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |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 | │ │ │ │ │ @@ -4690,68 +4635,69 @@ │ │ │ │ │ | | │ │ │ │ │ | virtual void remove_torrent(torrent_handle const& h, remove_flags_t options = {}) = 0; | │ │ │ │ │ | virtual void remove_torrent_impl(std::shared_ptr 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_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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(); | │ │ │ │ │ +|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" | │ │ │ │ │ | | │ │ │ │ │ -| // 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()) | │ │ │ │ │ -| { | │ │ │ │ │ -| m_alerts.emplace_alert(mapping | │ │ │ │ │ -| , transport, ec, listen_socket ? listen_socket->local_endpoint.address() : address()); | │ │ │ │ │ -| } | │ │ │ │ │ +|#include | │ │ │ │ │ +|#include | │ │ │ │ │ | | │ │ │ │ │ -| if (!listen_socket) return; | │ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_push.hpp" | │ │ │ │ │ +|#include | │ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_pop.hpp" | │ │ │ │ │ | | │ │ │ │ │ -| if (!ec && !external_ip.is_unspecified()) | │ │ │ │ │ -| { | │ │ │ │ │ -|listen_socket->external_address.cast_vote(external_ip, source_router, address()); | │ │ │ │ │ -|} | │ │ │ │ │ +|#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 | │ │ │ │ │ | | │ │ │ │ │ -| // 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; | │ │ │ │ │ +|namespace libtorrent { | │ │ │ │ │ +|namespace aux { | │ │ │ │ │ | | │ │ │ │ │ -| if (!ec && m_alerts.should_post()) | │ │ │ │ │ +|struct TORRENT_EXTRA_EXPORT chained_buffer : private single_threaded | │ │ │ │ │ +|{ | │ │ │ │ │ +| chained_buffer(): m_bytes(0), m_capacity(0) | │ │ │ │ │ | { | │ │ │ │ │ -| m_alerts.emplace_alert(mapping, port | │ │ │ │ │ -| , transport, proto, listen_socket->local_endpoint.address()); | │ │ │ │ │ +| thread_started(); | │ │ │ │ │ +|#if TORRENT_USE_ASSERTS | │ │ │ │ │ +| m_destructed = false; | │ │ │ │ │ +|#endif | │ │ │ │ │ | } | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1 | │ │ │ │ │ -| session_status session_impl::status() const | │ │ │ │ │ -| { | │ │ │ │ │ -|// INVARIANT_CHECK; | │ │ │ │ │ -| TORRENT_ASSERT(is_single_thread()); | │ │ │ │ │ | | │ │ │ │ │ -| session_status s; | │ │ │ │ │ +| private: | │ │ │ │ │ | | │ │ │ │ │ -| 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()); | │ │ │ │ │ +| // destructs/frees the holder object | │ │ │ │ │ +| using destruct_holder_fun = void (*)(void*); | │ │ │ │ │ +| using move_construct_holder_fun = void (*)(void*, void*); | │ │ │ │ │ | | │ │ │ │ │ -| 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_]_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| 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 | │ │ │ │ │ +|_ _ _ _{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ | | |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()) | │ │ │ │ │ +| { | │ │ │ │ │ +| m_alerts.emplace_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()) | │ │ │ │ │ +| { | │ │ │ │ │ +| m_alerts.emplace_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,18 +4883,14 @@ │ │ │ │ │ | // [n][0] = IPv4 [n][1] = IPv6 | │ │ │ │ │ |address m_addresses[2][2]; | │ │ │ │ │ |}; | │ │ │ │ │ | | │ │ │ │ │ |} | │ │ │ │ │ | | │ │ │ │ │ |_#_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_/_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 ********** | │ │ │ │ │ @@ -5003,14 +4999,227 @@ │ │ │ │ │ | 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_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) | │ │ │ │ │ +|{ | │ │ │ │ │ +| 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(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_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|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___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(); | │ │ │ │ │ +| | │ │ │ │ │ +|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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 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_"_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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(mapping) | │ │ │ │ │ +| << ", port: " << port << ", IP: " << ip | │ │ │ │ │ +| << ", proto: " << static_cast(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 const routes = enum_routes(ios, ec); | │ │ │ │ │ +| if (ec) | │ │ │ │ │ +| { | │ │ │ │ │ +| std::cerr << "failed to enumerate routes: " << ec.message() << '\n'; | │ │ │ │ │ +| TEST_CHECK(false); | │ │ │ │ │ +| return {}; | │ │ │ │ │ +| } | │ │ │ │ │ +| std::vector 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(face.state)) | │ │ │ │ │ +| << ' ' << static_cast(face.flags) | │ │ │ │ │ +|_ _ _ _<_<_ _'_ _'_ _<_<_ _f_a_c_e_._n_a_m_e_ _<_<_ _'_\_n_'_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |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 ********** | │ │ │ │ │ @@ -5039,278 +5248,50 @@ │ │ │ │ │ |_ _ _ _ _ _ _ _ _ _ _ _|_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_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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) | │ │ │ │ │ -|{ | │ │ │ │ │ -| using namespace lt; | │ │ │ │ │ +|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_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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)); | │ │ │ │ │ | | │ │ │ │ │ -| 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); | │ │ │ │ │ +| 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}, | │ │ │ │ │ +| }; | │ │ │ │ │ | | │ │ │ │ │ -| // test that wrapping of the timestamp is properly handled | │ │ │ │ │ -| h.add_sample(0xfffffff3, false); | │ │ │ │ │ -| TEST_EQUAL(h.base(), 0xfffffff3); | │ │ │ │ │ +| bdecode_node parsed[4]; | │ │ │ │ │ +| char error_string[200]; | │ │ │ │ │ | | │ │ │ │ │ -|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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(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) | │ │ │ │ │ +| int ret = verify_message(response, desc, parsed, error_string); | │ │ │ │ │ +| if (ret) | │ │ │ │ │ | { | │ │ │ │ │ -| TEST_CHECK(!t.has_node(i)); | │ │ │ │ │ +| items_num.insert(items_num.begin(), j); | │ │ │ │ │ | } | │ │ │ │ │ | } | │ │ │ │ │ +| | │ │ │ │ │ +|TEST_EQUAL(items_num.size(), 4); | │ │ │ │ │ |} | │ │ │ │ │ | | │ │ │ │ │ -|namespace { | │ │ │ │ │ -|void test_roundtrip(aux::merkle_tree const& t | │ │ │ │ │ -| , int const block_count | │ │ │ │ │ -| , int const blocks_per_piece) | │ │ │ │ │ +|int sum_distance_exp(int s, node_entry const& e, node_id const& ref) | │ │ │ │ │ |{ | │ │ │ │ │ -|aux::vector mask; | │ │ │ │ │ -|std::vector tree; | │ │ │ │ │ -| std::tie(tree, mask) = t.build_sparse_vector(); | │ │ │ │ │ +| return s + distance_exp(e.id, ref); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| 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); | │ │ │ │ │ -|} | │ │ │ │ │ -| | │ │ │ │ │ -|_T_O_R_R_E_N_T___T_E_S_T_(_r_o_u_n_d_t_r_i_p___f_u_l_l___t_r_e_e_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___m_e_r_k_l_e___t_r_e_e_._c_p_p_: |add test for load_piece_layer() | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_9_3_8_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|********** aadddd tteesstt ffoorr llooaadd__ppiieeccee__llaayyeerr(()) ********** | │ │ │ │ │ -|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____mm_ee_rr_kk_ll_ee____tt_rr_ee_ee_.._cc_pp_pp_::_99_33_88_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___m_e_r_k_l_e___t_r_e_e_._c_p_p_: |add test for add_hashes() with an odd number of blocks | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_9_3_9_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|********** aadddd tteesstt ffoorr aadddd__hhaasshheess(()) wwiitthh aann oodddd nnuummbbeerr ooff bblloocckkss ********** | │ │ │ │ │ -|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____mm_ee_rr_kk_ll_ee____tt_rr_ee_ee_.._cc_pp_pp_::_99_33_99_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___m_e_r_k_l_e___t_r_e_e_._c_p_p_: |add test for set_block() (setting the last block) with an odd number of blocks | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_9_4_0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|********** aadddd tteesstt ffoorr sseett__bblloocckk(()) ((sseettttiinngg tthhee llaasstt bblloocckk)) wwiitthh aann oodddd nnuummbbeerr ooff bblloocckkss ********** | │ │ │ │ │ -|****** ....//tteesstt//tteesstt__mmeerrkkllee__ttrreeee..ccpppp::994400 ****** | │ │ │ │ │ -| for (int i = 0; i < 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)); | │ │ │ │ │ -| TEST_CHECK(result); | │ │ │ │ │ -| | │ │ │ │ │ -| auto const& res = *result; | │ │ │ │ │ -| TEST_EQUAL(res.passed.size(), 0); | │ │ │ │ │ -| TEST_EQUAL(res.failed.size(), 0); | │ │ │ │ │ -| | │ │ │ │ │ -| 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_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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 & invalid_certificate) | │ │ │ │ │ -| { | │ │ │ │ │ -| certificate = combine_path("..", combine_path("ssl", "invalid_peer_certificate.pem")); | │ │ │ │ │ -| private_key = combine_path("..", combine_path("ssl", "invalid_peer_private_key.pem")); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| | │ │ │ │ │ -|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; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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); | │ │ │ │ │ -|} | │ │ │ │ │ -| | │ │ │ │ │ -| // 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___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 g_got_peers; | │ │ │ │ │ +|std::vector g_got_peers; | │ │ │ │ │ | | │ │ │ │ │ |void get_peers_cb(std::vector const& peers) | │ │ │ │ │ |{ | │ │ │ │ │ | g_got_peers.insert(g_got_peers.end(), peers.begin(), peers.end()); | │ │ │ │ │ |} | │ │ │ │ │ | | │ │ │ │ │ |std::vector g_got_items; | │ │ │ │ │ @@ -5619,176 +5600,151 @@ │ │ │ │ │ |template | │ │ │ │ │ |void test_unfinished_pieces(Fun f) | │ │ │ │ │ |{ | │ │ │ │ │ | // create a torrent and complete files | │ │ │ │ │ | std::shared_ptr 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 ****** | │ │ │ │ │ -|{ | │ │ │ │ │ -| // 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 | │ │ │ │ │ +|_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(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); | │ │ │ │ │ -|} | │ │ │ │ │ +| 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")); | │ │ │ │ │ | | │ │ │ │ │ -|TORRENT_TEST(flag_paused) | │ │ │ │ │ -|{ | │ │ │ │ │ -| // paused | │ │ │ │ │ -| test_add_and_get_flags(torrent_flags::paused); | │ │ │ │ │ -|} | │ │ │ │ │ +| 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")); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -|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 | │ │ │ │ │ +|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; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -|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 | │ │ │ │ │ +| 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 | │ │ │ │ │ | | │ │ │ │ │ -|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); | │ │ │ │ │ +| // 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); | │ │ │ │ │ |} | │ │ │ │ │ | | │ │ │ │ │ -|// 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 | │ │ │ │ │ +| // fill in the peer-id | │ │ │ │ │ +| std::generate(handshake + 48, handshake + 68, &rand); | │ │ │ │ │ | | │ │ │ │ │ -|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); | │ │ │ │ │ -|} | │ │ │ │ │ +| 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; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -|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); | │ │ │ │ │ -|} | │ │ │ │ │ +| 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 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(flag_disable_pex) | │ │ │ │ │ +|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); | │ │ │ │ │ -|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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 t = ::create_torrent(&file, "temporary", 32 * 1024, 13, false); | │ │ │ │ │ -| file.close(); | │ │ │ │ │ +| using namespace lt; | │ │ │ │ │ | | │ │ │ │ │ -| TEST_CHECK(exists(combine_path("tmp1_transfer", "temporary"))); | │ │ │ │ │ +| 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); | │ │ │ │ │ | | │ │ │ │ │ -| add_torrent_params params; | │ │ │ │ │ -| params.storage_mode = storage_mode; | │ │ │ │ │ -| params.flags &= ~torrent_flags::paused; | │ │ │ │ │ -| params.flags &= ~torrent_flags::auto_managed; | │ │ │ │ │ +| // test that wrapping of the timestamp is properly handled | │ │ │ │ │ +| h.add_sample(0xfffffff3, false); | │ │ │ │ │ +| TEST_EQUAL(h.base(), 0xfffffff3); | │ │ │ │ │ | | │ │ │ │ │ -| 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 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}, | │ │ │ │ │ @@ -5861,748 +5817,371 @@ │ │ │ │ │ | 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___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(mapping) | │ │ │ │ │ -| << ", port: " << port << ", IP: " << ip | │ │ │ │ │ -| << ", proto: " << static_cast(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; | │ │ │ │ │ +|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 | │ │ │ │ │ -| }; | │ │ │ │ │ -| | │ │ │ │ │ -|ip_interface pick_upnp_interface() | │ │ │ │ │ -|{ | │ │ │ │ │ -| lt::io_context ios; | │ │ │ │ │ -| error_code ec; | │ │ │ │ │ -| std::vector const routes = enum_routes(ios, ec); | │ │ │ │ │ -| if (ec) | │ │ │ │ │ -| { | │ │ │ │ │ -| std::cerr << "failed to enumerate routes: " << ec.message() << '\n'; | │ │ │ │ │ -| TEST_CHECK(false); | │ │ │ │ │ -| return {}; | │ │ │ │ │ -| } | │ │ │ │ │ -| std::vector 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(face.state)) | │ │ │ │ │ -| << ' ' << static_cast(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___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) | │ │ │ │ │ +|TORRENT_TEST(flag_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")); | │ │ │ │ │ -| } | │ │ │ │ │ +| // 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(parse_peers4) | │ │ │ │ │ +|TORRENT_TEST(flag_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_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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); | │ │ │ │ │ +| // paused | │ │ │ │ │ +| test_add_and_get_flags(torrent_flags::paused); | │ │ │ │ │ |} | │ │ │ │ │ | | │ │ │ │ │ -|} // anonymous namespace | │ │ │ │ │ -| | │ │ │ │ │ -|TORRENT_TEST(bloom_filter) | │ │ │ │ │ +|TORRENT_TEST(flag_auto_managed) | │ │ │ │ │ |{ | │ │ │ │ │ -| test_set_and_get(); | │ │ │ │ │ -| test_set_bits(); | │ │ │ │ │ -| test_count_zeroes(); | │ │ │ │ │ -| test_to_from_string(); | │ │ │ │ │ -| | │ │ │ │ │ -|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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 | │ │ │ │ │ -| } | │ │ │ │ │ +| // 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); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| 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) | │ │ │ │ │ +|// 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) | │ │ │ │ │ |{ | │ │ │ │ │ -| TORRENT_ASSERT(!u.empty()); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| char const* tracker_error_alert::failure_reason() const | │ │ │ │ │ -| { | │ │ │ │ │ -| return m_alloc.get().ptr(m_msg_idx); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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; | │ │ │ │ │ +| // 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 | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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 | │ │ │ │ │ -| } | │ │ │ │ │ | | │ │ │ │ │ -| 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_TEST(flag_sequential_download) | │ │ │ │ │ |{ | │ │ │ │ │ -| TORRENT_ASSERT(!u.empty()); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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 | │ │ │ │ │ -| return {}; | │ │ │ │ │ -|#else | │ │ │ │ │ -| return tracker_alert::message() + (version == protocol_version::V1 ? " v1" : " v2") + " warning: " + warning_message(); | │ │ │ │ │ +| // 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 | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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 | │ │ │ │ │ -| } | │ │ │ │ │ | | │ │ │ │ │ -| 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) | │ │ │ │ │ +|TORRENT_TEST(flag_sequential_download) | │ │ │ │ │ |{ | │ │ │ │ │ -| TORRENT_ASSERT(!u.empty()); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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 | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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 | │ │ │ │ │ -| } | │ │ │ │ │ +| // 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); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| 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) | │ │ │ │ │ +|// 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) | │ │ │ │ │ |{ | │ │ │ │ │ -| TORRENT_ASSERT(!u.empty()); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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()); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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(); | │ │ │ │ │ -|_#_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(); | │ │ │ │ │ +| // stop-when-ready | │ │ │ │ │ +|test_unset_after_add(torrent_flags::stop_when_ready); | │ │ │ │ │ +|} | │ │ │ │ │ |#endif | │ │ │ │ │ -| } | │ │ │ │ │ | | │ │ │ │ │ -| 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_TEST(flag_disable_dht) | │ │ │ │ │ |{ | │ │ │ │ │ -| TORRENT_ASSERT(!u.empty()); | │ │ │ │ │ -| } | │ │ │ │ │ +| 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); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| 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 | │ │ │ │ │ -| } | │ │ │ │ │ | | │ │ │ │ │ -| 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) | │ │ │ │ │ -| {} | │ │ │ │ │ +|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); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| 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 | │ │ │ │ │ +|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___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(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)); | │ │ │ │ │ +| } | │ │ │ │ │ | } | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| 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) | │ │ │ │ │ +|namespace { | │ │ │ │ │ +|void test_roundtrip(aux::merkle_tree const& t | │ │ │ │ │ +| , int const block_count | │ │ │ │ │ +| , int const blocks_per_piece) | │ │ │ │ │ |{ | │ │ │ │ │ -| TORRENT_ASSERT(!u.empty()); | │ │ │ │ │ -| } | │ │ │ │ │ +|aux::vector mask; | │ │ │ │ │ +|std::vector tree; | │ │ │ │ │ +| std::tie(tree, mask) = t.build_sparse_vector(); | │ │ │ │ │ | | │ │ │ │ │ -| 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(event)] + ")"; | │ │ │ │ │ -|#endif | │ │ │ │ │ -| } | │ │ │ │ │ +| aux::merkle_tree t2(block_count, blocks_per_piece, f[0].data()); | │ │ │ │ │ +| t2.load_sparse_tree(tree, mask, empty_verified); | │ │ │ │ │ | | │ │ │ │ │ -| 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) | │ │ │ │ │ +| TEST_CHECK(t.build_vector() == t2.build_vector()); | │ │ │ │ │ +| for (int i = 0; i < int(t.size()); ++i) | │ │ │ │ │ | { | │ │ │ │ │ -| TORRENT_ASSERT(index >= piece_index_t(0)); | │ │ │ │ │ -| } | │ │ │ │ │ +| TEST_EQUAL(t[i], t2[i]); | │ │ │ │ │ +| TEST_EQUAL(t.has_node(i), t2.has_node(i)); | │ │ │ │ │ | | │ │ │ │ │ -| 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_/_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 (!t.has_node(i)) | │ │ │ │ │ +| TEST_CHECK(t[i].is_all_zeros()); | │ │ │ │ │ +| if (!t2.has_node(i)) | │ │ │ │ │ +| TEST_CHECK(t2[i].is_all_zeros()); | │ │ │ │ │ | | │ │ │ │ │ -| if (m_stalled) | │ │ │ │ │ -| { | │ │ │ │ │ -| if (flags & pkt_ack) | │ │ │ │ │ -| defer_ack(); | │ │ │ │ │ -| return false; | │ │ │ │ │ +| TEST_CHECK(t.compare_node(i, t2[i])); | │ │ │ │ │ +| TEST_CHECK(t2.compare_node(i, t[i])); | │ │ │ │ │ | } | │ │ │ │ │ +|} | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| // 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; | │ │ │ │ │ -| | │ │ │ │ │ -| // 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; | │ │ │ │ │ -| | │ │ │ │ │ -| // first see if we need to resend any packets | │ │ │ │ │ -| | │ │ │ │ │ -|for (int i = (m_acked_seq_nr + 1) & ACK_MASK; i != m_seq_nr; i = (i + 1) & ACK_MASK) | │ │ │ │ │ +|TORRENT_TEST(roundtrip_empty_tree) | │ │ │ │ │ |{ | │ │ │ │ │ -| packet* p = m_outbuf.at(aux::numeric_cast(i)); | │ │ │ │ │ -| if (!p) continue; | │ │ │ │ │ -| if (!p->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; | │ │ │ │ │ -| } | │ │ │ │ │ +| aux::merkle_tree t(num_blocks, 1, f[0].data()); | │ │ │ │ │ +| test_roundtrip(t, num_blocks, 1); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| // 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; | │ │ │ │ │ +|_T_O_R_R_E_N_T___T_E_S_T_(_r_o_u_n_d_t_r_i_p___f_u_l_l___t_r_e_e_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___m_e_r_k_l_e___t_r_e_e_._c_p_p_: |add test for load_piece_layer() | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_9_3_8_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|********** aadddd tteesstt ffoorr llooaadd__ppiieeccee__llaayyeerr(()) ********** | │ │ │ │ │ +|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____mm_ee_rr_kk_ll_ee____tt_rr_ee_ee_.._cc_pp_pp_::_99_33_88_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___m_e_r_k_l_e___t_r_e_e_._c_p_p_: |add test for add_hashes() with an odd number of blocks | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_9_3_9_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|********** aadddd tteesstt ffoorr aadddd__hhaasshheess(()) wwiitthh aann oodddd nnuummbbeerr ooff bblloocckkss ********** | │ │ │ │ │ +|_**_**_**_ _.._.._//_tt_ee_ss_tt_//_tt_ee_ss_tt____mm_ee_rr_kk_ll_ee____tt_rr_ee_ee_.._cc_pp_pp_::_99_33_99_ _**_**_**_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|relevance 0|_._._/_t_e_s_t_/_t_e_s_t___m_e_r_k_l_e___t_r_e_e_._c_p_p_: |add test for set_block() (setting the last block) with an odd number of blocks | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_9_4_0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|********** aadddd tteesstt ffoorr sseett__bblloocckk(()) ((sseettttiinngg tthhee llaasstt bblloocckk)) wwiitthh aann oodddd nnuummbbeerr ooff bblloocckkss ********** | │ │ │ │ │ +|****** ....//tteesstt//tteesstt__mmeerrkkllee__ttrreeee..ccpppp::994400 ****** | │ │ │ │ │ +| for (int i = 0; i < 7; ++i) | │ │ │ │ │ +| TEST_EQUAL(t[i], f[i]); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| // MTU DISCOVERY | │ │ │ │ │ +| // 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)); | │ │ │ │ │ +| TEST_CHECK(result); | │ │ │ │ │ | | │ │ │ │ │ -| // 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_/_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'; | │ │ │ │ │ -| if (include_symlinks && (flags & file_storage::flag_symlink)) attr += 'l'; | │ │ │ │ │ -| } | │ │ │ │ │ +| auto const& res = *result; | │ │ │ │ │ +| TEST_EQUAL(res.passed.size(), 0); | │ │ │ │ │ +| TEST_EQUAL(res.failed.size(), 0); | │ │ │ │ │ | | │ │ │ │ │ -| void add_symlink_path(entry& e, std::string symlink_path) | │ │ │ │ │ -| { | │ │ │ │ │ -| entry& sympath_e = e["symlink path"]; | │ │ │ │ │ +| for (int i = 127; i < 127 + 4; ++i) | │ │ │ │ │ +| TEST_CHECK(t[i] == f[i]); | │ │ │ │ │ | | │ │ │ │ │ -| 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); | │ │ │ │ │ -| } | │ │ │ │ │ +| TEST_CHECK(t.verified_leafs() == none_set(num_blocks)); | │ │ │ │ │ |} | │ │ │ │ │ | | │ │ │ │ │ -| std::vector create_torrent::generate_buf() const | │ │ │ │ │ -| { | │ │ │ │ │ -|std::vector ret; | │ │ │ │ │ -|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(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 && !make_v2) | │ │ │ │ │ -| aux::throw_ex(errors::invalid_hash_entry); | │ │ │ │ │ -| | │ │ │ │ │ -| TORRENT_ASSERT(m_files.piece_length() > 0); | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|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; | │ │ │ │ │ | | │ │ │ │ │ -| entry dict; | │ │ │ │ │ +| // 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. | │ │ │ │ │ | | │ │ │ │ │ -| if (!m_urls.empty()) dict["announce"] = m_urls.front().first; | │ │ │ │ │ +| 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 (!m_nodes.empty()) | │ │ │ │ │ +|rate = t->statistics().transfer_rate(stat::download_payload) / peers_with_requests; | │ │ │ │ │ +|} | │ │ │ │ │ +| else | │ │ │ │ │ | { | │ │ │ │ │ -| 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_/_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(offset); | │ │ │ │ │ -| TORRENT_ASSERT(!compare_file_offset(target, m_files.front())); | │ │ │ │ │ +| // current download rate in bytes per seconds | │ │ │ │ │ +| rate = m_statistics.transfer_rate(stat::download_payload); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| auto file_iter = std::upper_bound( | │ │ │ │ │ -| m_files.begin(), m_files.end(), target, compare_file_offset); | │ │ │ │ │ +| // avoid division by zero | │ │ │ │ │ +| if (rate < 50) rate = 50; | │ │ │ │ │ | | │ │ │ │ │ -| TORRENT_ASSERT(file_iter != m_files.begin()); | │ │ │ │ │ -| --file_iter; | │ │ │ │ │ -| return file_index_t{int(file_iter - m_files.begin())}; | │ │ │ │ │ +| // 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); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| 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(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& root_hash) const | │ │ │ │ │ +| sha1_hash peer_connection::associated_info_hash() const | │ │ │ │ │ | { | │ │ │ │ │ -|for (file_index_t const i : file_range()) | │ │ │ │ │ -|{ | │ │ │ │ │ -| if (root(i) == root_hash) return i; | │ │ │ │ │ +| std::shared_ptr 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); | │ │ │ │ │ | } | │ │ │ │ │ -| return file_index_t{-1}; | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| piece_index_t file_storage::piece_index_at_file(file_index_t f) const | │ │ │ │ │ +| std::vector const& peer_connection::allowed_fast() | │ │ │ │ │ | { | │ │ │ │ │ -| return piece_index_t{aux::numeric_cast(file_offset(f) / piece_length())}; | │ │ │ │ │ -| } | │ │ │ │ │ +| TORRENT_ASSERT(is_single_thread()); | │ │ │ │ │ +| std::shared_ptr t = m_torrent.lock(); | │ │ │ │ │ +| TORRENT_ASSERT(t); | │ │ │ │ │ | | │ │ │ │ │ -|#if TORRENT_ABI_VERSION <= 2 | │ │ │ │ │ -| char const* file_storage::file_name_ptr(file_index_t const index) const | │ │ │ │ │ -| { | │ │ │ │ │ -| return m_files[index].name; | │ │ │ │ │ -| } | │ │ │ │ │ +|return m_allowed_fast; | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| int file_storage::file_name_len(file_index_t const index) const | │ │ │ │ │ +| bool peer_connection::can_request_time_critical() const | │ │ │ │ │ | { | │ │ │ │ │ -| if (m_files[index].name_len == aux::file_entry::name_is_owned) | │ │ │ │ │ -| return -1; | │ │ │ │ │ -| return m_files[index].name_len; | │ │ │ │ │ -| } | │ │ │ │ │ -|#endif | │ │ │ │ │ +| 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 t = m_torrent.lock(); | │ │ │ │ │ +| TORRENT_ASSERT(t); | │ │ │ │ │ +| if (t->upload_mode()) return false; | │ │ │ │ │ | | │ │ │ │ │ -| std::vector 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 ****** | │ │ │ │ │ -|} | │ │ │ │ │ +| // ignore snubbed peers, since they're not likely to return pieces in a | │ │ │ │ │ +| // timely manner anyway | │ │ │ │ │ +| if (m_snubbed) return false; | │ │ │ │ │ +| return true; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| void file_storage::canonicalize_impl(bool const backwards_compatible) | │ │ │ │ │ +| bool peer_connection::make_time_critical(piece_block const& block) | │ │ │ │ │ | { | │ │ │ │ │ -| 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 new_order(end_file()); | │ │ │ │ │ -| for (auto i : file_range()) | │ │ │ │ │ -| new_order[i] = i; | │ │ │ │ │ +| 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 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_/_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; | │ │ │ │ │ | | │ │ │ │ │ -| // 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()); | │ │ │ │ │ -| } | │ │ │ │ │ +| 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); }); | │ │ │ │ │ | | │ │ │ │ │ -|// 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) | │ │ │ │ │ +| for (auto const* p : peers) | │ │ │ │ │ | { | │ │ │ │ │ -| 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(); | │ │ │ │ │ -| }); | │ │ │ │ │ +| int const rate = int(p->uploaded_in_last_round() | │ │ │ │ │ +| * 1000 / total_milliseconds(unchoke_interval)); | │ │ │ │ │ | | │ │ │ │ │ -| aux::vector new_files; | │ │ │ │ │ -| aux::vector new_file_hashes; | │ │ │ │ │ -| aux::vector new_mtime; | │ │ │ │ │ +| // always have at least 1 unchoke slot | │ │ │ │ │ +| if (rate < rate_threshold) break; | │ │ │ │ │ | | │ │ │ │ │ -| // 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); | │ │ │ │ │ +| ++upload_slots; | │ │ │ │ │ | | │ │ │ │ │ -| // 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); | │ │ │ │ │ +|rate_threshold += 2048; | │ │ │ │ │ +|} | │ │ │ │ │ +| ++upload_slots; | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| 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 file_map; | │ │ │ │ │ -| bool file_map_initialized = false; | │ │ │ │ │ -| | │ │ │ │ │ -| // lazily instantiated set of all valid directories a symlink may point to | │ │ │ │ │ -|std::unordered_set dir_map; | │ │ │ │ │ -|bool dir_map_initialized = false; | │ │ │ │ │ +| // 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 | │ │ │ │ │ | | │ │ │ │ │ -| // symbolic links that points to directories | │ │ │ │ │ -| std::unordered_map dir_links; | │ │ │ │ │ +| // we use partial sort here, because we only care about the top | │ │ │ │ │ +| // upload_slots peers. | │ │ │ │ │ | | │ │ │ │ │ -| // we validate symlinks in (potentially) 2 passes over the files. | │ │ │ │ │ -| // remaining symlinks to validate after the first pass | │ │ │ │ │ -| std::vector symlinks_to_validate; | │ │ │ │ │ +| int const slots = std::min(upload_slots, int(peers.size())); | │ │ │ │ │ | | │ │ │ │ │ -| for (auto const i : file_range()) | │ │ │ │ │ +| if (sett.get_int(settings_pack::seed_choking_algorithm) | │ │ │ │ │ +| == settings_pack::round_robin) | │ │ │ │ │ | { | │ │ │ │ │ -| if (!(file_flags(i) & 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& 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]; | │ │ │ │ │ +| int const pieces = sett.get_int(settings_pack::seeding_piece_quota); | │ │ │ │ │ | | │ │ │ │ │ -| if (is_complete(target)) | │ │ │ │ │ -|_ _ _ _ _{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| 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(); | │ │ │ │ │ | | │ │ │ │ │ | merkle_validate_copy(t, m_tree, root(), m_block_verified); | │ │ │ │ │ | | │ │ │ │ │ @@ -6954,101 +6533,317 @@ │ │ │ │ │ | | │ │ │ │ │ | 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 | │ │ │ │ │ -|#include | │ │ │ │ │ +|_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(offset); | │ │ │ │ │ +| TORRENT_ASSERT(!compare_file_offset(target, m_files.front())); | │ │ │ │ │ | | │ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_push.hpp" | │ │ │ │ │ +| auto file_iter = std::upper_bound( | │ │ │ │ │ +| m_files.begin(), m_files.end(), target, compare_file_offset); | │ │ │ │ │ | | │ │ │ │ │ -|#include | │ │ │ │ │ -|#include | │ │ │ │ │ +| TORRENT_ASSERT(file_iter != m_files.begin()); | │ │ │ │ │ +| --file_iter; | │ │ │ │ │ +| return file_index_t{int(file_iter - m_files.begin())}; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_pop.hpp" | │ │ │ │ │ +| file_index_t file_storage::file_index_at_piece(piece_index_t const piece) const | │ │ │ │ │ +| { | │ │ │ │ │ +| return file_index_at_offset(static_cast(piece) * std::int64_t(piece_length())); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -|#include "libtorrent/random.hpp" | │ │ │ │ │ -|#include "libtorrent/aux_/alloca.hpp" | │ │ │ │ │ -|#include "libtorrent/pe_crypto.hpp" | │ │ │ │ │ -|#include "libtorrent/hasher.hpp" | │ │ │ │ │ +| 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}; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -|namespace libtorrent { | │ │ │ │ │ +| piece_index_t file_storage::piece_index_at_file(file_index_t f) const | │ │ │ │ │ +| { | │ │ │ │ │ +| return piece_index_t{aux::numeric_cast(file_offset(f) / piece_length())}; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| namespace mp = boost::multiprecision; | │ │ │ │ │ +|#if TORRENT_ABI_VERSION <= 2 | │ │ │ │ │ +| char const* file_storage::file_name_ptr(file_index_t const index) const | │ │ │ │ │ +| { | │ │ │ │ │ +| return m_files[index].name; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| namespace { | │ │ │ │ │ -|key_t const dh_prime | │ │ │ │ │ -|("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63|36210000000000090563"); │ │ │ │ │ +| 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::array export_key(key_t const& k) | │ │ │ │ │ +| std::vector file_storage::map_block(piece_index_t const piece | │ │ │ │ │ +| , std::int64_t const offset, std::int64_t size) const | │ │ │ │ │ | { | │ │ │ │ │ -| std::array ret; | │ │ │ │ │ -| auto* begin = reinterpret_cast(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" | │ │ │ │ │ +| 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 ****** | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -|namespace libtorrent { | │ │ │ │ │ +| void file_storage::canonicalize_impl(bool const backwards_compatible) | │ │ │ │ │ +| { | │ │ │ │ │ +| TORRENT_ASSERT(piece_length() >= 16 * 1024); | │ │ │ │ │ | | │ │ │ │ │ -| namespace mp = boost::multiprecision; | │ │ │ │ │ +| // 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 new_order(end_file()); | │ │ │ │ │ +| for (auto i : file_range()) | │ │ │ │ │ +| new_order[i] = i; | │ │ │ │ │ | | │ │ │ │ │ -| namespace { | │ │ │ │ │ -| key_t const dh_prime | │ │ │ │ │ -| | │ │ │ │ │ -|("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63|36210000000000090563"); │ │ │ │ │ +| // 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) | │ │ │ │ │ +| { | │ │ │ │ │ +| 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 new_files; | │ │ │ │ │ +| aux::vector new_file_hashes; | │ │ │ │ │ +| aux::vector 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); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| m_files = std::move(new_files); | │ │ │ │ │ +| m_file_hashes = std::move(new_file_hashes); | │ │ │ │ │ +| m_mtime = std::move(new_mtime); | │ │ │ │ │ +| | │ │ │ │ │ +| m_total_size = off; | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| std::array export_key(key_t const& k) | │ │ │ │ │ +| void file_storage::sanitize_symlinks() | │ │ │ │ │ | { | │ │ │ │ │ -| std::array ret; | │ │ │ │ │ -| auto* begin = reinterpret_cast(ret.data()); | │ │ │ │ │ -| std::uint8_t* end = mp::export_bits(k, begin, 8); | │ │ │ │ │ +| // 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 file_map; | │ │ │ │ │ +| bool file_map_initialized = false; | │ │ │ │ │ | | │ │ │ │ │ -|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(len)); | │ │ │ │ │ -|#if defined __GNUC__ && __GNUC__ == 12 | │ │ │ │ │ -|#pragma GCC diagnostic pop | │ │ │ │ │ -|#endif | │ │ │ │ │ -| std::memset(begin, 0, aux::numeric_cast(96 - len)); | │ │ │ │ │ +| // lazily instantiated set of all valid directories a symlink may point to | │ │ │ │ │ +|std::unordered_set dir_map; | │ │ │ │ │ +|bool dir_map_initialized = false; | │ │ │ │ │ +| | │ │ │ │ │ +| // symbolic links that points to directories | │ │ │ │ │ +| std::unordered_map dir_links; | │ │ │ │ │ +| | │ │ │ │ │ +| // we validate symlinks in (potentially) 2 passes over the files. | │ │ │ │ │ +| // remaining symlinks to validate after the first pass | │ │ │ │ │ +| std::vector symlinks_to_validate; | │ │ │ │ │ +| | │ │ │ │ │ +| for (auto const i : file_range()) | │ │ │ │ │ +| { | │ │ │ │ │ +| if (!(file_flags(i) & 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& 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)) | │ │ │ │ │ +|_ _ _ _ _{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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); | │ │ │ │ │ +| | │ │ │ │ │ +| if (m_files.pad_file_at(f)) | │ │ │ │ │ +| return { set_block_hash_result::result::success, 0, 0 }; | │ │ │ │ │ +| | │ │ │ │ │ +| auto& 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(piece) * std::int64_t(m_files.piece_length()) | │ │ │ │ │ +| + offset - m_files.file_offset(f); | │ │ │ │ │ +| int const block_index = aux::numeric_cast(block_offset / default_block_size); | │ │ │ │ │ +| | │ │ │ │ │ +| if (h.is_all_zeros()) | │ │ │ │ │ +| { | │ │ │ │ │ +| TORRENT_ASSERT_FAIL(); | │ │ │ │ │ +| return set_block_hash_result::block_hash_failed(); | │ │ │ │ │ | } | │ │ │ │ │ -| return ret; | │ │ │ │ │ +| | │ │ │ │ │ +|aux::merkle_tree::set_block_result result; | │ │ │ │ │ +|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(piece - file_first_piece) * blocks_per_piece) | │ │ │ │ │ +| , std::min(leafs_size, m_files.file_num_pieces(f) * blocks_per_piece - leafs_index) }; | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| 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); | │ │ │ │ │ +| void hash_picker::hashes_rejected(hash_request const& req) | │ │ │ │ │ +| { | │ │ │ │ │ +| TORRENT_ASSERT(req.base == m_piece_layer && req.index % 512 == 0); | │ │ │ │ │ | | │ │ │ │ │ -| // Set the prime P and the generator, generate local public key | │ │ │ │ │ -| dh_key_exchange::dh_key_exchange() | │ │ │ │ │ +| 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___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; | │ │ │ │ │ +| | │ │ │ │ │ +| 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) | │ │ │ │ │ | { | │ │ │ │ │ -| aux::array random_key; | │ │ │ │ │ -| aux::random_bytes({reinterpret_cast(random_key.data()) | │ │ │ │ │ -| , static_cast(random_key.size())}); | │ │ │ │ │ +| INVARIANT_CHECK; | │ │ │ │ │ | | │ │ │ │ │ -| // create local key (random) | │ │ │ │ │ -| mp::import_bits(m_dh_local_secret, random_key.begin(), random_key.end()); | │ │ │ │ │ +| 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()); | │ │ │ │ │ | | │ │ │ │ │ -| // 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_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| 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 tmp; | │ │ │ │ │ +| std::back_insert_iterator> 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_._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(); | │ │ │ │ │ +| } | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| TORRENT_EXPORT std::unique_ptr 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 | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |_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; | │ │ │ │ │ @@ -7095,14 +6890,343 @@ │ │ │ │ │ | 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_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|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(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(m_chunk_pos + m_body_start)] == 'H' | │ │ │ │ │ +| || (m_parser.chunked_encoding() | │ │ │ │ │ +| && m_recv_buffer.get()[static_cast(m_chunk_pos + m_body_start)] == '\r')); | │ │ │ │ │ +| m_chunk_pos = -1; | │ │ │ │ │ +| } | │ │ │ │ │ +| } | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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) | │ │ │ │ │ +| { | │ │ │ │ │ +| 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; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| | │ │ │ │ │ +| // 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_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|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; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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; | │ │ │ │ │ +| | │ │ │ │ │ +| | │ │ │ │ │ +|m_free_slots.push_back(i->second); | │ │ │ │ │ +| m_piece_map.erase(i); | │ │ │ │ │ +| m_dirty_metadata = true; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| void posix_part_file::move_partfile(std::string const& path, error_code& 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; | │ │ │ │ │ +|_ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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 (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& ec) | │ │ │ │ │ +| { | │ │ │ │ │ +| flush_metadata_impl(ec); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +|void posix_part_file::flush_metadata_impl(error_code& ec) | │ │ │ │ │ +|{ | │ │ │ │ │ +| // 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 header(static_cast(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 < 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) | │ │ │ │ │ +| { | │ │ │ │ │ +| if (m_alerts.should_post()) | │ │ │ │ │ +| m_alerts.emplace_alert(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()) | │ │ │ │ │ +| m_alerts.emplace_alert(m_proxy_addr, operation_t::sock_bind, ec); | │ │ │ │ │ +| ++m_failures; | │ │ │ │ │ +| retry_connection(); | │ │ │ │ │ +| return; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| | │ │ │ │ │ +|ADD_OUTSTANDING_ASYNC("socks5::on_connected"); | │ │ │ │ │ +| m_socks5_sock.async_connect(m_proxy_addr | │ │ │ │ │ +| , std::bind(&socks5::on_connected, self(), _1)); | │ │ │ │ │ +| | │ │ │ │ │ +| 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)); | │ │ │ │ │ +|} | │ │ │ │ │ +| | │ │ │ │ │ +|void socks5::on_connect_timeout(error_code const& e) | │ │ │ │ │ +|{ | │ │ │ │ │ +| COMPLETE_ASYNC("socks5::on_connect_timeout"); | │ │ │ │ │ +| | │ │ │ │ │ +| if (e == boost::asio::error::operation_aborted) return; | │ │ │ │ │ +| | │ │ │ │ │ +| if (m_abort) return; | │ │ │ │ │ +| | │ │ │ │ │ +| if (m_alerts.should_post()) | │ │ │ │ │ +| m_alerts.emplace_alert(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& e) | │ │ │ │ │ +|_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|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 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 && 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 (!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; | │ │ │ │ │ +| } | │ │ │ │ │ +| } | │ │ │ │ │ +| 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 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_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |_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 | │ │ │ │ │ @@ -7148,14 +7272,1123 @@ │ │ │ │ │ | | │ │ │ │ │ |#if (TORRENT_USE_SYSTEMCONFIGURATION || TORRENT_USE_SC_NETWORK_REACHABILITY) && \ | │ │ │ │ │ | !defined TORRENT_BUILD_SIMULATOR | │ │ │ │ │ | | │ │ │ │ │ |// common utilities for Mac and iOS | │ │ │ │ │ |template 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_/_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; | │ │ │ │ │ +| | │ │ │ │ │ +| // 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; | │ │ │ │ │ +| | │ │ │ │ │ +| // first see if we need to resend any packets | │ │ │ │ │ +| | │ │ │ │ │ +|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(i)); | │ │ │ │ │ +| if (!p) continue; | │ │ │ │ │ +| if (!p->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) & 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_/ |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 // for memset | │ │ │ │ │ +| | │ │ │ │ │ +|namespace libtorrent { | │ │ │ │ │ +| | │ │ │ │ │ +|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 | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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 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_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|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 | │ │ │ │ │ +| , std::function handler | │ │ │ │ │ +| , disk_job_flags_t) override | │ │ │ │ │ +| { | │ │ │ │ │ +| TORRENT_ASSERT(r.length <= 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, disk_job_flags_t | │ │ │ │ │ +| , std::function handler) override | │ │ │ │ │ +| { | │ │ │ │ │ +|post(m_ios, [h = std::move(handler), piece] { h(piece, sha1_hash{}, storage_error{}); }); | │ │ │ │ │ +|} | │ │ │ │ │ +| | │ │ │ │ │ +| void async_hash2(storage_index_t, piece_index_t piece, int | │ │ │ │ │ +| , disk_job_flags_t | │ │ │ │ │ +| , std::function 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 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 handler) override | │ │ │ │ │ +| { | │ │ │ │ │ +| post(m_ios, [h = std::move(handler)] { h(); }); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| void async_delete_files(storage_index_t | │ │ │ │ │ +| , remove_flags_t, std::function handler) override | │ │ │ │ │ +| { | │ │ │ │ │ +| post(m_ios, [h = std::move(handler)] { h(storage_error{}); }); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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_*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|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)); | │ │ │ │ │ +| | │ │ │ │ │ +| utp_stream* str = nullptr; | │ │ │ │ │ +|#ifdef TORRENT_SSL_PEERS | │ │ │ │ │ +| if (is_ssl(c)) | │ │ │ │ │ +| str = &boost::get>(c).next_layer(); | │ │ │ │ │ +| else | │ │ │ │ │ +|#endif | │ │ │ │ │ +| str = boost::get(&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 (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_/_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'; | │ │ │ │ │ +| if (include_symlinks && (flags & file_storage::flag_symlink)) attr += 'l'; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| void add_symlink_path(entry& e, std::string symlink_path) | │ │ │ │ │ +| { | │ │ │ │ │ +| entry& 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 create_torrent::generate_buf() const | │ │ │ │ │ +| { | │ │ │ │ │ +|std::vector ret; | │ │ │ │ │ +|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(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 && !make_v2) | │ │ │ │ │ +| aux::throw_ex(errors::invalid_hash_entry); | │ │ │ │ │ +| | │ │ │ │ │ +| TORRENT_ASSERT(m_files.piece_length() > 0); | │ │ │ │ │ +| | │ │ │ │ │ +| entry dict; | │ │ │ │ │ +| | │ │ │ │ │ +| if (!m_urls.empty()) dict["announce"] = m_urls.front().first; | │ │ │ │ │ +| | │ │ │ │ │ +| if (!m_nodes.empty()) | │ │ │ │ │ +| { | │ │ │ │ │ +| entry& nodes = dict["nodes"]; | │ │ │ │ │ +| entry::list_type& nodes_list = nodes.list(); | │ │ │ │ │ +| for (auto const& n : m_nodes) | │ │ │ │ │ +|_ _ _ _{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|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(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::list
    ip_list; | │ │ │ │ │ +|std::transform(m_endpoints.begin(), m_endpoints.end(), std::back_inserter(ip_list) | │ │ │ │ │ +| , [](tcp::endpoint const& ep) { return ep.address(); } ); | │ │ │ │ │ +| | │ │ │ │ │ +| cb->tracker_response(tracker_req(), m_target.address(), ip_list, resp); | │ │ │ │ │ +| | │ │ │ │ │ +| close(); | │ │ │ │ │ +| return true; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| bool udp_tracker_connection::on_scrape_response(span buf) | │ │ │ │ │ +| { | │ │ │ │ │ +| restart_read_timeout(); | │ │ │ │ │ +| auto const action = static_cast(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(buf.size())).c_str()); | │ │ │ │ │ +| return true; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| if (action != action_t::scrape) | │ │ │ │ │ +|_ _ _{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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 | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| bool supports_arm_neon() noexcept | │ │ │ │ │ +| { | │ │ │ │ │ +|#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 | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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 | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +|} // 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(); | │ │ │ │ │ +|_}_ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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 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(j->piece), j->d.io.offset | │ │ │ │ │ +| , j->storage ? j->storage->num_outstanding_jobs() : -1); | │ │ │ │ │ +| } | │ │ │ │ │ +|#endif | │ │ │ │ │ +| | │ │ │ │ │ +| std::shared_ptr storage = j->storage; | │ │ │ │ │ +| | │ │ │ │ │ +| TORRENT_ASSERT(static_cast(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 idx = static_cast(j->action); | │ │ │ │ │ +| ret = (this->*(job_functions[static_cast(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&) | │ │ │ │ │ +| { | │ │ │ │ │ +| 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 mmap_disk_io::async_clear_piece(storage_index_t const storage | │ │ │ │ │ +| , piece_index_t const index, std::function 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); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| void mmap_disk_io::async_clear_piece(storage_index_t const storage | │ │ │ │ │ +| , piece_index_t const index, std::function 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); | │ │ │ │ │ +|} | │ │ │ │ │ +| | │ │ │ │ │ +| 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->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; | │ │ │ │ │ +| | │ │ │ │ │ +|_ _ _ _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_/_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; | │ │ │ │ │ +| | │ │ │ │ │ +| // 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; | │ │ │ │ │ +|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; | │ │ │ │ │ +| | │ │ │ │ │ +| 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; | │ │ │ │ │ +| | │ │ │ │ │ +| 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; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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_/_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 | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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()); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| char const* tracker_error_alert::failure_reason() const | │ │ │ │ │ +| { | │ │ │ │ │ +| return m_alloc.get().ptr(m_msg_idx); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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; | │ │ │ │ │ +|#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; | │ │ │ │ │ +|#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)) | │ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1 | │ │ │ │ │ +| , msg(m) | │ │ │ │ │ +|#endif | │ │ │ │ │ +|, version(v) | │ │ │ │ │ +|{ | │ │ │ │ │ +| TORRENT_ASSERT(!u.empty()); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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 | │ │ │ │ │ +| return {}; | │ │ │ │ │ +|#else | │ │ │ │ │ +| return tracker_alert::message() + (version == protocol_version::V1 ? " v1" : " v2") + " warning: " + warning_message(); | │ │ │ │ │ +|#endif | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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 | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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) | │ │ │ │ │ +|{ | │ │ │ │ │ +| TORRENT_ASSERT(!u.empty()); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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 | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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 | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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()); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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()); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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(); | │ │ │ │ │ +|_#_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 | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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()); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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 | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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; | │ │ │ │ │ +|#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()); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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(event)] + ")"; | │ │ │ │ │ +|#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)); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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_/_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), | │ │ │ │ │ +| SET(active_seeds, 5, &session_impl::trigger_auto_manage), | │ │ │ │ │ +| SET(active_checking, 1, &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, &session_impl::trigger_auto_manage), | │ │ │ │ │ +| DEPRECATED_SET(active_loaded_limit, 0, &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), | │ │ │ │ │ +|SET(max_rejects, 50, nullptr), | │ │ │ │ │ +|SET(recv_socket_buffer_size, 0, &session_impl::update_socket_buffer_size), | │ │ │ │ │ +| SET(send_socket_buffer_size, 0, &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, &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, &session_impl::update_upload_rate), | │ │ │ │ │ +| SET(download_rate_limit, 0, &session_impl::update_download_rate), | │ │ │ │ │ +| DEPRECATED_SET(local_upload_rate_limit, 0, &session_impl::update_local_upload_rate), | │ │ │ │ │ +| DEPRECATED_SET(local_download_rate_limit, 0, &session_impl::update_local_download_rate), | │ │ │ │ │ +| SET(dht_upload_rate_limit, 8000, &session_impl::update_dht_upload_rate_limit), | │ │ │ │ │ +| SET(unchoke_slots_limit, 8, &session_impl::update_unchoke_limit), | │ │ │ │ │ +| DEPRECATED_SET(half_open_limit, 0, nullptr), | │ │ │ │ │ +| SET(connections_limit, 200, &session_impl::update_connections_limit), | │ │ │ │ │ +| SET(connections_slack, 10, nullptr), | │ │ │ │ │ +| SET(utp_target_delay, 100, nullptr), | │ │ │ │ │ +|_ _ _S_E_T_(_u_t_p___g_a_i_n___f_a_c_t_o_r_,_ _3_0_0_0_,_ _n_u_l_l_p_t_r_)_,_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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_:_5_9_0_ _ _|_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//sseettttiinnggss__ppaacckk..ccpppp::559900 ****** | │ │ │ │ │ +|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 < 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 < 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; | │ │ │ │ │ +|for (int i = 0; i < settings_pack::num_string_settings; ++i) | │ │ │ │ │ +|{ | │ │ │ │ │ +| 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 < 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 < 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& sett | │ │ │ │ │ +| , aux::session_impl* ses) | │ │ │ │ │ +| { | │ │ │ │ │ +| using fun_t = void (aux::session_impl::*)(); | │ │ │ │ │ +| std::vector callbacks; | │ │ │ │ │ +| | │ │ │ │ │ +| 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_/_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 {}; | │ │ │ │ │ +| return aux::file_handle(fn, 0, mode); | │ │ │ │ │ +| } | │ │ │ │ │ +| return {}; | │ │ │ │ │ +| } | │ │ │ │ │ +| } | │ │ │ │ │ +| catch (storage_error const& e) | │ │ │ │ │ +| { | │ │ │ │ │ +| ec = e.ec; | │ │ │ │ │ +| return {}; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| void part_file::free_piece(piece_index_t const piece) | │ │ │ │ │ +| { | │ │ │ │ │ +| std::lock_guard l(m_mutex); | │ │ │ │ │ +| | │ │ │ │ │ +| auto const i = m_piece_map.find(piece); | │ │ │ │ │ +| if (i == m_piece_map.end()) return; | │ │ │ │ │ +| | │ │ │ │ │ +| | │ │ │ │ │ +|m_free_slots.push_back(i->second); | │ │ │ │ │ +| m_piece_map.erase(i); | │ │ │ │ │ +| m_dirty_metadata = true; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| void part_file::move_partfile(std::string const& path, error_code& ec) | │ │ │ │ │ +| { | │ │ │ │ │ +| std::lock_guard 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); | │ │ │ │ │ +| } | │ │ │ │ │ +|_ _ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_p_a_r_t___f_i_l_e_._c_p_p_:_4_1_1_ _ _ _ _ _ _|_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//ppaarrtt__ffiillee..ccpppp::441111 ****** | │ │ │ │ │ +|TORRENT_ASSERT(j->second == slot); | │ │ │ │ │ +| m_free_slots.push_back(j->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& ec) | │ │ │ │ │ +| { | │ │ │ │ │ +| std::lock_guard l(m_mutex); | │ │ │ │ │ +| | │ │ │ │ │ +| flush_metadata_impl(ec); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +|void part_file::flush_metadata_impl(error_code& ec) | │ │ │ │ │ +|{ | │ │ │ │ │ +| // 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 header(static_cast(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 < 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_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |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); | │ │ │ │ │ @@ -7211,49 +8444,258 @@ │ │ │ │ │ | { | │ │ │ │ │ | return !atp.have_pieces.empty() | │ │ │ │ │ | || (atp.flags & torrent_flags::seed_mode); | │ │ │ │ │ | } | │ │ │ │ │ |} | │ │ │ │ │ | | │ │ │ │ │ |_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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() | │ │ │ │ │ +|_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(); | │ │ │ │ │ +| } | │ │ │ │ │ +|} | │ │ │ │ │ +| | │ │ │ │ │ +| 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 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{}); } | │ │ │ │ │ +| | │ │ │ │ │ +|add_torrent_params load_torrent_file(std::string const& filename, load_torrent_limits const& cfg) | │ │ │ │ │ +|{ | │ │ │ │ │ +| add_torrent_params ret; | │ │ │ │ │ +| ret.ti = std::make_shared(filename, cfg); | │ │ │ │ │ +| update_atp(ret); | │ │ │ │ │ +| return ret; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| add_torrent_params load_torrent_buffer(span buffer, load_torrent_limits const& cfg) | │ │ │ │ │ | { | │ │ │ │ │ -| if (m_thread && m_thread.use_count() == 1) | │ │ │ │ │ +| add_torrent_params ret; | │ │ │ │ │ +| ret.ti = std::make_shared(buffer, cfg, from_span); | │ │ │ │ │ +| update_atp(ret); | │ │ │ │ │ +| return ret; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| 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_file, cfg); | │ │ │ │ │ +| update_atp(ret); | │ │ │ │ │ +| return ret; | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|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") | │ │ │ │ │ | { | │ │ │ │ │ -|#if defined TORRENT_ASIO_DEBUGGING | │ │ │ │ │ -| wait_for_asio_handlers(); | │ │ │ │ │ -|#endif | │ │ │ │ │ -| m_thread->join(); | │ │ │ │ │ +| 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); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| TORRENT_EXPORT std::unique_ptr default_disk_io_constructor( | │ │ │ │ │ -| io_context& ios, settings_interface const& sett, counters& cnt) | │ │ │ │ │ +| int web_connection_base::timeout() const | │ │ │ │ │ | { | │ │ │ │ │ -|#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); | │ │ │ │ │ +| // 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_/_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 | │ │ │ │ │ +|#include | │ │ │ │ │ +| | │ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_push.hpp" | │ │ │ │ │ +| | │ │ │ │ │ +|#include | │ │ │ │ │ +|#include | │ │ │ │ │ +| | │ │ │ │ │ |#include "libtorrent/aux_/disable_warnings_pop.hpp" | │ │ │ │ │ -|#else | │ │ │ │ │ -| return posix_disk_io_constructor(ios, sett, cnt); | │ │ │ │ │ +| | │ │ │ │ │ +|#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 export_key(key_t const& k) | │ │ │ │ │ +| { | │ │ │ │ │ +| std::array ret; | │ │ │ │ │ +| auto* begin = reinterpret_cast(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; | │ │ │ │ │ +| | │ │ │ │ │ +| namespace { | │ │ │ │ │ +| key_t const dh_prime | │ │ │ │ │ +| | │ │ │ │ │ +|("0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63|36210000000000090563"); │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| std::array export_key(key_t const& k) | │ │ │ │ │ +| { | │ │ │ │ │ +| std::array ret; | │ │ │ │ │ +| auto* begin = reinterpret_cast(ret.data()); | │ │ │ │ │ +| std::uint8_t* end = mp::export_bits(k, begin, 8); | │ │ │ │ │ +| | │ │ │ │ │ +|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(len)); | │ │ │ │ │ +|#if defined __GNUC__ && __GNUC__ == 12 | │ │ │ │ │ +|#pragma GCC diagnostic pop | │ │ │ │ │ +|#endif | │ │ │ │ │ +| std::memset(begin, 0, aux::numeric_cast(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 random_key; | │ │ │ │ │ +| aux::random_bytes({reinterpret_cast(random_key.data()) | │ │ │ │ │ +| , static_cast(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_/_u_t___m_e_t_a_d_a_t_a_._c_p_p_:_2_8_1_ _ _ _ _|_w_e_ _r_e_a_l_l_y_ _n_e_e_d_ _t_o_ _i_n_c_r_e_m_e_n_t_ _t_h_e_ _r_e_f_c_o_u_n_t_e_r_ _o_n_ _t_h_e_ _t_o_r_r_e_n_t_ _w_h_i_l_e_ _t_h_i_s_ _b_u_f_f_e_r_ _i_s_ _s_t_i_l_l_ _i_n_ _t_h_e_ _p_e_e_r_'_s_ _s_e_n_d_ _b_u_f_f_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|********** wwee rreeaallllyy nneeeedd ttoo iinnccrreemmeenntt tthhee rreeffccoouunntteerr oonn tthhee ttoorrrreenntt wwhhiillee tthhiiss bbuuffffeerr iiss ssttiillll iinn tthhee ppeeeerr''ss sseenndd bbuuffffeerr ********** | │ │ │ │ │ +|****** ....//ssrrcc//uutt__mmeettaaddaattaa..ccpppp::228811 ****** | │ │ │ │ │ +|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_pc.send_buffer({msg, len + 6}); | │ │ │ │ │ +|if (metadata_piece_size) | │ │ │ │ │ +|{ | │ │ │ │ │ +| m_pc.append_const_send_buffer( | │ │ │ │ │ +| span(const_cast(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 body) override | │ │ │ │ │ +| { | │ │ │ │ │ +| if (extended_msg != 2) return false; | │ │ │ │ │ +| if (m_message_index == 0) return false; | │ │ │ │ │ +| | │ │ │ │ │ +| if (length > 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); | │ │ │ │ │ +|_ _ _ _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_/_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 | │ │ │ │ │ |#include | │ │ │ │ │ |#include | │ │ │ │ │ |#include | │ │ │ │ │ @@ -7381,295 +8823,519 @@ │ │ │ │ │ | 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(&sock_addr), &sock_addr_len) < 0) | │ │ │ │ │ |_ _ _ _r_e_t_u_r_n_ _-_1_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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); | │ │ │ │ │ +|_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); | │ │ │ │ │ +| } | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| INVARIANT_CHECK; | │ │ │ │ │ +| set_state(torrent_status::checking_resume_data); | │ │ │ │ │ | | │ │ │ │ │ -| TORRENT_ASSERT(is_outgoing()); | │ │ │ │ │ +| aux::vector links; | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS | │ │ │ │ │ +| if (!m_torrent_file->similar_torrents().empty() | │ │ │ │ │ +| || !m_torrent_file->collections().empty()) | │ │ │ │ │ +| { | │ │ │ │ │ +| resolve_links res(m_torrent_file); | │ │ │ │ │ | | │ │ │ │ │ -| TORRENT_ASSERT(!m_torrent.lock()->is_upload_only()); | │ │ │ │ │ +| for (auto const& ih : m_torrent_file->similar_torrents()) | │ │ │ │ │ +| { | │ │ │ │ │ +| std::shared_ptr t = m_ses.find_torrent(info_hash_t(ih)).lock(); | │ │ │ │ │ +| if (!t) continue; | │ │ │ │ │ | | │ │ │ │ │ -| // we only want left-over bandwidth | │ │ │ │ │ +| // Only attempt to reuse files from torrents that are seeding. | │ │ │ │ │ +|if (!t->is_seed()) continue; | │ │ │ │ │ | | │ │ │ │ │ -|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); | │ │ │ │ │ +| res.match(t->get_torrent_file(), t->save_path()); | │ │ │ │ │ +| } | │ │ │ │ │ +| for (auto const& c : m_torrent_file->collections()) | │ │ │ │ │ +| { | │ │ │ │ │ +| std::vector> ts = m_ses.find_collection(c); | │ │ │ │ │ | | │ │ │ │ │ -| if (m_port == -1 && protocol == "http") | │ │ │ │ │ -| m_port = 80; | │ │ │ │ │ +| 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); | │ │ │ │ │ | | │ │ │ │ │ -|#if TORRENT_USE_SSL | │ │ │ │ │ -| if (protocol == "https") | │ │ │ │ │ -| { | │ │ │ │ │ -| m_ssl = true; | │ │ │ │ │ -| if (m_port == -1) m_port = 443; | │ │ │ │ │ +| for (auto const& ih : m_torrent_file->similar_torrents()) | │ │ │ │ │ +| { | │ │ │ │ │ +| std::shared_ptr 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> 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; | │ │ │ │ │ +| | │ │ │ │ │ +| res.match(t->get_torrent_file(), t->save_path()); | │ │ │ │ │ +| } | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +| std::vector const& l = res.get_links(); | │ │ │ │ │ +| if (!l.empty()) | │ │ │ │ │ +| { | │ │ │ │ │ +| 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 | │ │ │ │ │ +| | │ │ │ │ │ +|#if TORRENT_USE_ASSERTS | │ │ │ │ │ +| TORRENT_ASSERT(m_outstanding_check_files == false); | │ │ │ │ │ +| m_outstanding_check_files = true; | │ │ │ │ │ |#endif | │ │ │ │ │ | | │ │ │ │ │ -| if (!m_basic_auth.empty()) | │ │ │ │ │ -| m_basic_auth = base64encode(m_basic_auth); | │ │ │ │ │ +| 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; | │ │ │ │ │ | | │ │ │ │ │ -| m_server_string = m_host; | │ │ │ │ │ -| aux::verify_encoding(m_server_string); | │ │ │ │ │ -| } | │ │ │ │ │ +| if (!m_announce_to_lsd) return; | │ │ │ │ │ | | │ │ │ │ │ -| 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); | │ │ │ │ │ -|_ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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. | │ │ │ │ │ +| // private torrents are never announced on LSD | │ │ │ │ │ +| if (m_torrent_file->is_valid() && m_torrent_file->priv()) return; | │ │ │ │ │ | | │ │ │ │ │ -|*/ | │ │ │ │ │ +|#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 | │ │ │ │ │ | | │ │ │ │ │ -|#include "libtorrent/performance_counters.hpp" | │ │ │ │ │ -|#include "libtorrent/assert.hpp" | │ │ │ │ │ -|#include // for memset | │ │ │ │ │ +| if (is_paused()) return; | │ │ │ │ │ | | │ │ │ │ │ -|namespace libtorrent { | │ │ │ │ │ +| if (!m_ses.has_lsd()) return; | │ │ │ │ │ | | │ │ │ │ │ -|counters::counters() TORRENT_COUNTER_NOEXCEPT | │ │ │ │ │ -|{ | │ │ │ │ │ -|#ifdef ATOMIC_LLONG_LOCK_FREE | │ │ │ │ │ -| for (auto& counter : m_stats_counter) | │ │ │ │ │ -| counter.store(0, std::memory_order_relaxed); | │ │ │ │ │ +|#ifdef TORRENT_SSL_PEERS | │ │ │ │ │ +|int port = is_ssl_torrent() ? m_ses.ssl_listen_port() : m_ses.listen_port(); | │ │ │ │ │ |#else | │ │ │ │ │ -| m_stats_counter.fill(0); | │ │ │ │ │ +| int port = m_ses.listen_port(); | │ │ │ │ │ |#endif | │ │ │ │ │ +| | │ │ │ │ │ +| // 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); | │ │ │ │ │ +| }); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| counters::counters(counters const& c) TORRENT_COUNTER_NOEXCEPT | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_DHT | │ │ │ │ │ +| | │ │ │ │ │ +| void torrent::dht_announce() | │ │ │ │ │ | { | │ │ │ │ │ -|#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 l(c.m_mutex); | │ │ │ │ │ -| m_stats_counter = c.m_stats_counter; | │ │ │ │ │ +| 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(); } | │ │ │ │ │ |#endif | │ │ │ │ │ -| } | │ │ │ │ │ | | │ │ │ │ │ -| counters& counters::operator=(counters const& c) & TORRENT_COUNTER_NOEXCEPT | │ │ │ │ │ +| void torrent::on_peer_name_lookup(error_code const& e | │ │ │ │ │ +| , std::vector
    const& host_list, int const port | │ │ │ │ │ +| , protocol_version const v) try | │ │ │ │ │ | { | │ │ │ │ │ -| 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_/_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 ret; | │ │ │ │ │ -| ret.reserve(prio.size()); | │ │ │ │ │ -| for (auto p : prio) | │ │ │ │ │ -| ret.push_back(int(static_cast(p))); | │ │ │ │ │ -| return ret; | │ │ │ │ │ -| } | │ │ │ │ │ +| TORRENT_ASSERT(is_single_thread()); | │ │ │ │ │ +| | │ │ │ │ │ +| INVARIANT_CHECK; | │ │ │ │ │ +| | │ │ │ │ │ +| COMPLETE_ASYNC("torrent::on_peer_name_lookup"); | │ │ │ │ │ +| | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ +| if (e && should_log()) | │ │ │ │ │ +| debug_log("peer name lookup error: %s", e.message().c_str()); | │ │ │ │ │ |#endif | │ │ │ │ │ | | │ │ │ │ │ -| void torrent_handle::file_priority(file_index_t index, download_priority_t priority) const | │ │ │ │ │ -| { | │ │ │ │ │ -| async_call(&torrent::set_file_priority, index, priority); | │ │ │ │ │ -| } | │ │ │ │ │ +| if (e || m_abort || host_list.empty() || m_ses.is_aborted()) return; | │ │ │ │ │ | | │ │ │ │ │ -| download_priority_t torrent_handle::file_priority(file_index_t index) const | │ │ │ │ │ -| { | │ │ │ │ │ -| return sync_call_ret(dont_download, &torrent::file_priority, index); | │ │ │ │ │ -| } | │ │ │ │ │ +|tcp::endpoint host(host_list.front(), std::uint16_t(port)); | │ │ │ │ │ | | │ │ │ │ │ -|void torrent_handle::prioritize_files(std::vector const& files) const | │ │ │ │ │ +| if (m_ip_filter && m_ip_filter->access(host.address()) & ip_filter::blocked) | │ │ │ │ │ +| { | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ +| if (should_log()) | │ │ │ │ │ +| { | │ │ │ │ │ +| debug_log("blocked ip from tracker: %s", host.address().to_string().c_str()); | │ │ │ │ │ +| } | │ │ │ │ │ +|#endif | │ │ │ │ │ +| if (m_ses.alerts().should_post()) | │ │ │ │ │ +| m_ses.alerts().emplace_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); | │ │ │ │ │ +| } | │ │ │ │ │ +|#endif | │ │ │ │ │ +| } | │ │ │ │ │ +| 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 ****** | │ │ │ │ │ |{ | │ │ │ │ │ -| async_call(&torrent::prioritize_files | │ │ │ │ │ -| , static_cast const&>(files)); | │ │ │ │ │ -| } | │ │ │ │ │ +| std::set 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; | │ │ │ │ │ +| }(); | │ │ │ │ │ | | │ │ │ │ │ -| std::vector torrent_handle::get_file_priorities() const | │ │ │ │ │ -| { | │ │ │ │ │ -| aux::vector ret; | │ │ │ │ │ -| auto retp = &ret; | │ │ │ │ │ -| sync_call(&torrent::file_priorities, retp); | │ │ │ │ │ -| return TORRENT_RVO(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); | │ │ │ │ │ | | │ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1 | │ │ │ │ │ +| if (!torrent_file().info_hashes().has_v1() && blocks.empty() && !found_on_disk) | │ │ │ │ │ +| { | │ │ │ │ │ +|verify_block_hashes(index); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -|// ============ start deprecation =============== | │ │ │ │ │ +| // 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(blocks.size()) * default_block_size); | │ │ │ │ │ | | │ │ │ │ │ -| void torrent_handle::prioritize_files(std::vector const& files) const | │ │ │ │ │ -| { | │ │ │ │ │ -| aux::vector file_prio; | │ │ │ │ │ -| file_prio.reserve(files.size()); | │ │ │ │ │ -| for (auto const p : files) { | │ │ │ │ │ -| file_prio.push_back(download_priority_t(static_cast(p))); | │ │ │ │ │ +|#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); | │ │ │ │ │ | } | │ │ │ │ │ -| async_call(&torrent::prioritize_files, file_prio); | │ │ │ │ │ -| } | │ │ │ │ │ | | │ │ │ │ │ -| std::vector 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_/_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 {}; | │ │ │ │ │ +| // 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(); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -|#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+")); | │ │ │ │ │ +| // 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 | │ │ │ │ │ -| if (ret.file() == nullptr) | │ │ │ │ │ -| ec.assign(errno, generic_category()); | │ │ │ │ │ +| return false; | │ │ │ │ │ +| } | │ │ │ │ │ | } | │ │ │ │ │ -| if (ec) return {}; | │ │ │ │ │ -| return ret; | │ │ │ │ │ +| | │ │ │ │ │ +|aux::socket_type s = [&] { | │ │ │ │ │ +| | │ │ │ │ │ +|#if TORRENT_USE_I2P | │ │ │ │ │ +| if (peerinfo->is_i2p_addr) | │ │ │ │ │ +| { | │ │ │ │ │ +| // 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(ret); | │ │ │ │ │ +| str.set_local_i2p_endpoint(m_ses.local_i2p_endpoint()); | │ │ │ │ │ +| str.set_destination(static_cast(peerinfo)->dest()); | │ │ │ │ │ +| str.set_command(i2p_stream::cmd_connect); | │ │ │ │ │ +| str.set_session_id(m_ses.i2p_session()); | │ │ │ │ │ +| 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; | │ │ │ │ │ +| | │ │ │ │ │ +| 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; | │ │ │ │ │ +| | │ │ │ │ │ +| TORRENT_ASSERT(p >= no_pos); | │ │ │ │ │ +| | │ │ │ │ │ +| state_updated(); | │ │ │ │ │ +| | │ │ │ │ │ +| m_ses.set_queue_position(this, p); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| void posix_part_file::free_piece(piece_index_t const piece) | │ │ │ │ │ +| void torrent::set_max_uploads(int limit, bool const state_update) | │ │ │ │ │ | { | │ │ │ │ │ -| auto const i = m_piece_map.find(piece); | │ │ │ │ │ -| if (i == m_piece_map.end()) return; | │ │ │ │ │ +| 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(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); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -|m_free_slots.push_back(i->second); | │ │ │ │ │ -| m_piece_map.erase(i); | │ │ │ │ │ -| m_dirty_metadata = true; | │ │ │ │ │ +| 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(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); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| void posix_part_file::move_partfile(std::string const& path, error_code& ec) | │ │ │ │ │ +| void torrent::set_max_connections(int limit, bool const state_update) | │ │ │ │ │ | { | │ │ │ │ │ -| flush_metadata_impl(ec); | │ │ │ │ │ -| if (ec) return; | │ │ │ │ │ +| 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(limit); | │ │ │ │ │ +| update_want_peers(); | │ │ │ │ │ | | │ │ │ │ │ -| if (!m_piece_map.empty()) | │ │ │ │ │ +|#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)) | │ │ │ │ │ | { | │ │ │ │ │ -| std::string old_path = combine_path(m_path, m_name); | │ │ │ │ │ -| std::string new_path = combine_path(path, m_name); | │ │ │ │ │ +| disconnect_peers(num_peers() - m_max_connections | │ │ │ │ │ +| , errors::too_many_connections); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| rename(old_path, new_path, ec); | │ │ │ │ │ -| if (ec == boost::system::errc::no_such_file_or_directory) | │ │ │ │ │ -| ec.clear(); | │ │ │ │ │ +| if (state_update) | │ │ │ │ │ +| set_need_save_resume(torrent_handle::if_config_changed); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| if (ec) | │ │ │ │ │ -| { | │ │ │ │ │ -| storage_error se; | │ │ │ │ │ -| aux::copy_file(old_path, new_path, se); | │ │ │ │ │ -| ec = se.ec; | │ │ │ │ │ -| if (ec) return; | │ │ │ │ │ -| remove(old_path, ec); | │ │ │ │ │ +| 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 | │ │ │ │ │ | } | │ │ │ │ │ -| } | │ │ │ │ │ -| 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 (ec) return; | │ │ │ │ │ +| // 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); | │ │ │ │ │ | | │ │ │ │ │ -| f(file_offset, {buf.get(), block_to_copy}); | │ │ │ │ │ +| // put back the peers we ignored into the peer list for the next piece | │ │ │ │ │ +| if (!ignore_peers.empty()) | │ │ │ │ │ +| { | │ │ │ │ │ +| 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); }); | │ │ │ │ │ | } | │ │ │ │ │ -| file_offset += block_to_copy; | │ │ │ │ │ -| piece_offset = 0; | │ │ │ │ │ -| size -= block_to_copy; | │ │ │ │ │ +| | │ │ │ │ │ +| // 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; | │ │ │ │ │ | } | │ │ │ │ │ -| } | │ │ │ │ │ | | │ │ │ │ │ -| void posix_part_file::flush_metadata(error_code& ec) | │ │ │ │ │ -| { | │ │ │ │ │ -| flush_metadata_impl(ec); | │ │ │ │ │ +| // commit all the time critical requests | │ │ │ │ │ +| for (auto p : peers_with_requests) | │ │ │ │ │ +| { | │ │ │ │ │ +| p->send_block_requests(); | │ │ │ │ │ +| } | │ │ │ │ │ | } | │ │ │ │ │ +|#endif // TORRENT_DISABLE_STREAMING | │ │ │ │ │ | | │ │ │ │ │ -|void posix_part_file::flush_metadata_impl(error_code& ec) | │ │ │ │ │ -|{ | │ │ │ │ │ -| // do we need to flush the metadata? | │ │ │ │ │ -| if (m_dirty_metadata == false) return; | │ │ │ │ │ -| | │ │ │ │ │ -| if (m_piece_map.empty()) | │ │ │ │ │ +| std::set torrent::web_seeds(web_seed_entry::type_t const type) const | │ │ │ │ │ +| { | │ │ │ │ │ +| TORRENT_ASSERT(is_single_thread()); | │ │ │ │ │ +| std::set ret; | │ │ │ │ │ +| for (auto const& s : m_web_seeds) | │ │ │ │ │ | { | │ │ │ │ │ -| // 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; | │ │ │ │ │ +| 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_/_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 | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| auto f = open_file(open_mode::read_write, ec); | │ │ │ │ │ -| if (ec) return; | │ │ │ │ │ -| | │ │ │ │ │ -| std::vector header(static_cast(m_header_size)); | │ │ │ │ │ +| void crypto_random_bytes(span 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. | │ │ │ │ │ | | │ │ │ │ │ -| using namespace libtorrent::aux; | │ │ │ │ │ +|// openssl | │ │ │ │ │ +| int r = RAND_bytes(reinterpret_cast(buffer.data()) | │ │ │ │ │ +| , int(buffer.size())); | │ │ │ │ │ +| if (r != 1) aux::throw_ex(errors::no_entropy); | │ │ │ │ │ +|#elif TORRENT_USE_GETRANDOM | │ │ │ │ │ +| ssize_t const r = ::getrandom(buffer.data(), static_cast(buffer.size()), 0); | │ │ │ │ │ +| if (r == ssize_t(buffer.size())) return; | │ │ │ │ │ +| if (r == -1 && errno != ENOSYS) aux::throw_ex(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 | │ │ │ │ │ | | │ │ │ │ │ -| char* ptr = header.data(); | │ │ │ │ │ -| write_uint32(m_max_pieces, ptr); | │ │ │ │ │ -| write_uint32(m_piece_size, ptr); | │ │ │ │ │ +|#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 | │ │ │ │ │ | | │ │ │ │ │ -| 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_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|#endif | │ │ │ │ │ +| } | │ │ │ │ │ +|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |_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 | │ │ │ │ │ | | │ │ │ │ │ @@ -8420,945 +10086,14 @@ │ │ │ │ │ | 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_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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(); | │ │ │ │ │ -| } | │ │ │ │ │ -|} | │ │ │ │ │ -| | │ │ │ │ │ -| 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 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{}); } | │ │ │ │ │ -| | │ │ │ │ │ -|add_torrent_params load_torrent_file(std::string const& filename, load_torrent_limits const& cfg) | │ │ │ │ │ -|{ | │ │ │ │ │ -| add_torrent_params ret; | │ │ │ │ │ -| ret.ti = std::make_shared(filename, cfg); | │ │ │ │ │ -| update_atp(ret); | │ │ │ │ │ -| return ret; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| add_torrent_params load_torrent_buffer(span buffer, load_torrent_limits const& cfg) | │ │ │ │ │ -| { | │ │ │ │ │ -| add_torrent_params ret; | │ │ │ │ │ -| ret.ti = std::make_shared(buffer, cfg, from_span); | │ │ │ │ │ -| update_atp(ret); | │ │ │ │ │ -| return ret; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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_file, cfg); | │ │ │ │ │ -| update_atp(ret); | │ │ │ │ │ -| return ret; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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 | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| bool supports_arm_neon() noexcept | │ │ │ │ │ -| { | │ │ │ │ │ -|#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 | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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 | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -|} // 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(); | │ │ │ │ │ -|_}_ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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; | │ │ │ │ │ -| | │ │ │ │ │ -| 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) | │ │ │ │ │ -| { | │ │ │ │ │ -| INVARIANT_CHECK; | │ │ │ │ │ -| | │ │ │ │ │ -| 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 tmp; | │ │ │ │ │ -| std::back_insert_iterator> 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_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), | │ │ │ │ │ -| SET(active_seeds, 5, &session_impl::trigger_auto_manage), | │ │ │ │ │ -| SET(active_checking, 1, &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, &session_impl::trigger_auto_manage), | │ │ │ │ │ -| DEPRECATED_SET(active_loaded_limit, 0, &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), | │ │ │ │ │ -|SET(max_rejects, 50, nullptr), | │ │ │ │ │ -|SET(recv_socket_buffer_size, 0, &session_impl::update_socket_buffer_size), | │ │ │ │ │ -| SET(send_socket_buffer_size, 0, &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, &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, &session_impl::update_upload_rate), | │ │ │ │ │ -| SET(download_rate_limit, 0, &session_impl::update_download_rate), | │ │ │ │ │ -| DEPRECATED_SET(local_upload_rate_limit, 0, &session_impl::update_local_upload_rate), | │ │ │ │ │ -| DEPRECATED_SET(local_download_rate_limit, 0, &session_impl::update_local_download_rate), | │ │ │ │ │ -| SET(dht_upload_rate_limit, 8000, &session_impl::update_dht_upload_rate_limit), | │ │ │ │ │ -| SET(unchoke_slots_limit, 8, &session_impl::update_unchoke_limit), | │ │ │ │ │ -| DEPRECATED_SET(half_open_limit, 0, nullptr), | │ │ │ │ │ -| SET(connections_limit, 200, &session_impl::update_connections_limit), | │ │ │ │ │ -| SET(connections_slack, 10, nullptr), | │ │ │ │ │ -| SET(utp_target_delay, 100, nullptr), | │ │ │ │ │ -|_ _ _S_E_T_(_u_t_p___g_a_i_n___f_a_c_t_o_r_,_ _3_0_0_0_,_ _n_u_l_l_p_t_r_)_,_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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_:_5_9_0_ _ _|_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//sseettttiinnggss__ppaacckk..ccpppp::559900 ****** | │ │ │ │ │ -|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 < 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 < 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; | │ │ │ │ │ -|for (int i = 0; i < settings_pack::num_string_settings; ++i) | │ │ │ │ │ -|{ | │ │ │ │ │ -| 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 < 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 < 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& sett | │ │ │ │ │ -| , aux::session_impl* ses) | │ │ │ │ │ -| { | │ │ │ │ │ -| using fun_t = void (aux::session_impl::*)(); | │ │ │ │ │ -| std::vector callbacks; | │ │ │ │ │ -| | │ │ │ │ │ -| 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_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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()) | │ │ │ │ │ -| m_alerts.emplace_alert(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()) | │ │ │ │ │ -| m_alerts.emplace_alert(m_proxy_addr, operation_t::sock_bind, ec); | │ │ │ │ │ -| ++m_failures; | │ │ │ │ │ -| retry_connection(); | │ │ │ │ │ -| return; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| | │ │ │ │ │ -|ADD_OUTSTANDING_ASYNC("socks5::on_connected"); | │ │ │ │ │ -| m_socks5_sock.async_connect(m_proxy_addr | │ │ │ │ │ -| , std::bind(&socks5::on_connected, self(), _1)); | │ │ │ │ │ -| | │ │ │ │ │ -| 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)); | │ │ │ │ │ -|} | │ │ │ │ │ -| | │ │ │ │ │ -|void socks5::on_connect_timeout(error_code const& e) | │ │ │ │ │ -|{ | │ │ │ │ │ -| COMPLETE_ASYNC("socks5::on_connect_timeout"); | │ │ │ │ │ -| | │ │ │ │ │ -| if (e == boost::asio::error::operation_aborted) return; | │ │ │ │ │ -| | │ │ │ │ │ -| if (m_abort) return; | │ │ │ │ │ -| | │ │ │ │ │ -| if (m_alerts.should_post()) | │ │ │ │ │ -| m_alerts.emplace_alert(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& e) | │ │ │ │ │ -|_{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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 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 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> 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 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> 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; | │ │ │ │ │ -| | │ │ │ │ │ -| res.match(t->get_torrent_file(), t->save_path()); | │ │ │ │ │ -| } | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| std::vector const& l = res.get_links(); | │ │ │ │ │ -| if (!l.empty()) | │ │ │ │ │ -| { | │ │ │ │ │ -| 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 | │ │ │ │ │ -| | │ │ │ │ │ -|#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; | │ │ │ │ │ -| | │ │ │ │ │ -| // private torrents are never announced on LSD | │ │ │ │ │ -| if (m_torrent_file->is_valid() && m_torrent_file->priv()) return; | │ │ │ │ │ -| | │ │ │ │ │ -|#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 (is_paused()) return; | │ │ │ │ │ -| | │ │ │ │ │ -| 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 | │ │ │ │ │ -| | │ │ │ │ │ -| // 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 | │ │ │ │ │ -| 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 | │ │ │ │ │ -| | │ │ │ │ │ -| void torrent::on_peer_name_lookup(error_code const& e | │ │ │ │ │ -| , std::vector
    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 (e && should_log()) | │ │ │ │ │ -| debug_log("peer name lookup error: %s", e.message().c_str()); | │ │ │ │ │ -|#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) | │ │ │ │ │ -| { | │ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ -| if (should_log()) | │ │ │ │ │ -| { | │ │ │ │ │ -| debug_log("blocked ip from tracker: %s", host.address().to_string().c_str()); | │ │ │ │ │ -| } | │ │ │ │ │ -|#endif | │ │ │ │ │ -| if (m_ses.alerts().should_post()) | │ │ │ │ │ -| m_ses.alerts().emplace_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); | │ │ │ │ │ -| } | │ │ │ │ │ -|#endif | │ │ │ │ │ -| } | │ │ │ │ │ -| 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 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; | │ │ │ │ │ -| }(); | │ │ │ │ │ -| | │ │ │ │ │ -| // 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); | │ │ │ │ │ -| | │ │ │ │ │ -| if (!torrent_file().info_hashes().has_v1() && blocks.empty() && !found_on_disk) | │ │ │ │ │ -| { | │ │ │ │ │ -|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(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); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| // 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(); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| // 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; | │ │ │ │ │ -| } | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -|aux::socket_type s = [&] { | │ │ │ │ │ -| | │ │ │ │ │ -|#if TORRENT_USE_I2P | │ │ │ │ │ -| if (peerinfo->is_i2p_addr) | │ │ │ │ │ -| { | │ │ │ │ │ -| // 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(ret); | │ │ │ │ │ -| str.set_local_i2p_endpoint(m_ses.local_i2p_endpoint()); | │ │ │ │ │ -| str.set_destination(static_cast(peerinfo)->dest()); | │ │ │ │ │ -| str.set_command(i2p_stream::cmd_connect); | │ │ │ │ │ -| str.set_session_id(m_ses.i2p_session()); | │ │ │ │ │ -| 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; | │ │ │ │ │ -| | │ │ │ │ │ -| 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; | │ │ │ │ │ -| | │ │ │ │ │ -| TORRENT_ASSERT(p >= no_pos); | │ │ │ │ │ -| | │ │ │ │ │ -| 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(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); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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(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); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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(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)) | │ │ │ │ │ -| { | │ │ │ │ │ -| disconnect_peers(num_peers() - m_max_connections | │ │ │ │ │ -| , errors::too_many_connections); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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()) | │ │ │ │ │ -| { | │ │ │ │ │ -| 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); }); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| // 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; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| // commit all the time critical requests | │ │ │ │ │ -| for (auto p : peers_with_requests) | │ │ │ │ │ -| { | │ │ │ │ │ -| p->send_block_requests(); | │ │ │ │ │ -| } | │ │ │ │ │ -| } | │ │ │ │ │ -|#endif // TORRENT_DISABLE_STREAMING | │ │ │ │ │ -| | │ │ │ │ │ -| std::set torrent::web_seeds(web_seed_entry::type_t const type) const | │ │ │ │ │ -| { | │ │ │ │ │ -| TORRENT_ASSERT(is_single_thread()); | │ │ │ │ │ -| std::set 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_/_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 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(buffer.data()) | │ │ │ │ │ -| , int(buffer.size())); | │ │ │ │ │ -| if (r != 1) aux::throw_ex(errors::no_entropy); | │ │ │ │ │ -|#elif TORRENT_USE_GETRANDOM | │ │ │ │ │ -| ssize_t const r = ::getrandom(buffer.data(), static_cast(buffer.size()), 0); | │ │ │ │ │ -| if (r == ssize_t(buffer.size())) return; | │ │ │ │ │ -| if (r == -1 && errno != ENOSYS) aux::throw_ex(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 | │ │ │ │ │ -| } | │ │ │ │ │ -|_}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_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; | │ │ │ │ │ -| | │ │ │ │ │ -| // 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; | │ │ │ │ │ -|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; | │ │ │ │ │ -| | │ │ │ │ │ -| 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; | │ │ │ │ │ -| | │ │ │ │ │ -| 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; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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(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::list
    ip_list; | │ │ │ │ │ -|std::transform(m_endpoints.begin(), m_endpoints.end(), std::back_inserter(ip_list) | │ │ │ │ │ -| , [](tcp::endpoint const& ep) { return ep.address(); } ); | │ │ │ │ │ -| | │ │ │ │ │ -| cb->tracker_response(tracker_req(), m_target.address(), ip_list, resp); | │ │ │ │ │ -| | │ │ │ │ │ -| close(); | │ │ │ │ │ -| return true; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| bool udp_tracker_connection::on_scrape_response(span buf) | │ │ │ │ │ -| { | │ │ │ │ │ -| restart_read_timeout(); | │ │ │ │ │ -| auto const action = static_cast(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(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; | │ │ │ │ │ @@ -9619,288 +10354,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_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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 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 && 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 (!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; | │ │ │ │ │ -| } | │ │ │ │ │ -| } | │ │ │ │ │ -| 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; | │ │ │ │ │ +|_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) | │ │ │ │ │ +| {} | │ │ │ │ │ | | │ │ │ │ │ -| // 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 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); | │ │ │ │ │ +| 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; | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| void peer_connection::add_stat(std::int64_t const downloaded, std::int64_t const uploaded) | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ +| std::string torrent_peer::to_string() const | │ │ │ │ │ | { | │ │ │ │ │ -| TORRENT_ASSERT(is_single_thread()); | │ │ │ │ │ -| m_statistics.add_stat(downloaded, uploaded); | │ │ │ │ │ +| 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 | │ │ │ │ │ | | │ │ │ │ │ -| sha1_hash peer_connection::associated_info_hash() const | │ │ │ │ │ +| std::int64_t torrent_peer::total_download() const | │ │ │ │ │ | { | │ │ │ │ │ -| std::shared_ptr 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) | │ │ │ │ │ +| TORRENT_ASSERT(in_use); | │ │ │ │ │ +| if (connection != nullptr) | │ │ │ │ │ | { | │ │ │ │ │ -| t->peer_is_interesting(*this); | │ │ │ │ │ +| TORRENT_ASSERT(prev_amount_download == 0); | │ │ │ │ │ +| return connection->statistics().total_payload_download(); | │ │ │ │ │ | } | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| std::vector const& peer_connection::allowed_fast() | │ │ │ │ │ -| { | │ │ │ │ │ -| TORRENT_ASSERT(is_single_thread()); | │ │ │ │ │ -| std::shared_ptr 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 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 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_/ |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(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(m_chunk_pos + m_body_start)] == 'H' | │ │ │ │ │ -| || (m_parser.chunked_encoding() | │ │ │ │ │ -| && m_recv_buffer.get()[static_cast(m_chunk_pos + m_body_start)] == '\r')); | │ │ │ │ │ -| m_chunk_pos = -1; | │ │ │ │ │ -| } | │ │ │ │ │ -| } | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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) | │ │ │ │ │ -| { | │ │ │ │ │ -| 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; | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| | │ │ │ │ │ -| // 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_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| else | │ │ │ │ │ +| { | │ │ │ │ │ +| return std::int64_t(prev_amount_download) << 10; | │ │ │ │ │ +| } | │ │ │ │ │ +|_ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |_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(error_code(errors::invalid_save_path)); | │ │ │ │ │ |#else | │ │ │ │ │ @@ -9947,583 +10462,280 @@ │ │ │ │ │ | 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; | │ │ │ │ │ |_ _ _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_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 {}; | │ │ │ │ │ -| return aux::file_handle(fn, 0, mode); | │ │ │ │ │ -| } | │ │ │ │ │ -| return {}; | │ │ │ │ │ -| } | │ │ │ │ │ +|_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 ret; | │ │ │ │ │ +| ret.reserve(prio.size()); | │ │ │ │ │ +| for (auto p : prio) | │ │ │ │ │ +| ret.push_back(int(static_cast(p))); | │ │ │ │ │ +| return ret; | │ │ │ │ │ | } | │ │ │ │ │ -| catch (storage_error const& e) | │ │ │ │ │ +|#endif | │ │ │ │ │ +| | │ │ │ │ │ +| void torrent_handle::file_priority(file_index_t index, download_priority_t priority) const | │ │ │ │ │ | { | │ │ │ │ │ -| ec = e.ec; | │ │ │ │ │ -| return {}; | │ │ │ │ │ +| async_call(&torrent::set_file_priority, index, priority); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| void part_file::free_piece(piece_index_t const piece) | │ │ │ │ │ +| download_priority_t torrent_handle::file_priority(file_index_t index) const | │ │ │ │ │ | { | │ │ │ │ │ -| std::lock_guard l(m_mutex); | │ │ │ │ │ -| | │ │ │ │ │ -| auto const i = m_piece_map.find(piece); | │ │ │ │ │ -| if (i == m_piece_map.end()) return; | │ │ │ │ │ -| | │ │ │ │ │ +| return sync_call_ret(dont_download, &torrent::file_priority, index); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -|m_free_slots.push_back(i->second); | │ │ │ │ │ -| m_piece_map.erase(i); | │ │ │ │ │ -| m_dirty_metadata = true; | │ │ │ │ │ +|void torrent_handle::prioritize_files(std::vector const& files) const | │ │ │ │ │ +|{ | │ │ │ │ │ +| async_call(&torrent::prioritize_files | │ │ │ │ │ +| , static_cast const&>(files)); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| void part_file::move_partfile(std::string const& path, error_code& ec) | │ │ │ │ │ +| std::vector torrent_handle::get_file_priorities() const | │ │ │ │ │ | { | │ │ │ │ │ -| std::lock_guard l(m_mutex); | │ │ │ │ │ -| | │ │ │ │ │ -| flush_metadata_impl(ec); | │ │ │ │ │ -| if (ec) return; | │ │ │ │ │ +| aux::vector ret; | │ │ │ │ │ +| auto retp = &ret; | │ │ │ │ │ +| sync_call(&torrent::file_priorities, retp); | │ │ │ │ │ +| return TORRENT_RVO(ret); | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| if (!m_piece_map.empty()) | │ │ │ │ │ -| { | │ │ │ │ │ -| std::string old_path = combine_path(m_path, m_name); | │ │ │ │ │ -| std::string new_path = combine_path(path, m_name); | │ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1 | │ │ │ │ │ | | │ │ │ │ │ -| rename(old_path, new_path, ec); | │ │ │ │ │ -| if (ec == boost::system::errc::no_such_file_or_directory) | │ │ │ │ │ -| ec.clear(); | │ │ │ │ │ +|// ============ start deprecation =============== | │ │ │ │ │ | | │ │ │ │ │ -| if (ec) | │ │ │ │ │ -| { | │ │ │ │ │ -| storage_error se; | │ │ │ │ │ -| aux::copy_file(old_path, new_path, se); | │ │ │ │ │ -| ec = se.ec; | │ │ │ │ │ -| if (ec) return; | │ │ │ │ │ -| remove(old_path, ec); | │ │ │ │ │ -| } | │ │ │ │ │ -|_ _ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|_r_e_l_e_v_a_n_c_e_ _0_|_._._/_s_r_c_/_p_a_r_t___f_i_l_e_._c_p_p_:_4_1_1_ _ _ _ _ _ _|_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//ppaarrtt__ffiillee..ccpppp::441111 ****** | │ │ │ │ │ -|TORRENT_ASSERT(j->second == slot); | │ │ │ │ │ -| m_free_slots.push_back(j->second); | │ │ │ │ │ -| m_piece_map.erase(j); | │ │ │ │ │ -| m_dirty_metadata = true; | │ │ │ │ │ -| } | │ │ │ │ │ -| } | │ │ │ │ │ -| } | │ │ │ │ │ -| file_offset += block_to_copy; | │ │ │ │ │ -| piece_offset = 0; | │ │ │ │ │ -| size -= block_to_copy; | │ │ │ │ │ +| void torrent_handle::prioritize_files(std::vector const& files) const | │ │ │ │ │ +| { | │ │ │ │ │ +| aux::vector file_prio; | │ │ │ │ │ +| file_prio.reserve(files.size()); | │ │ │ │ │ +| for (auto const p : files) { | │ │ │ │ │ +| file_prio.push_back(download_priority_t(static_cast(p))); | │ │ │ │ │ | } | │ │ │ │ │ +| async_call(&torrent::prioritize_files, file_prio); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| void part_file::flush_metadata(error_code& ec) | │ │ │ │ │ +| std::vector torrent_handle::file_priorities() const | │ │ │ │ │ | { | │ │ │ │ │ -| std::lock_guard l(m_mutex); | │ │ │ │ │ -| | │ │ │ │ │ -| flush_metadata_impl(ec); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -|void part_file::flush_metadata_impl(error_code& ec) | │ │ │ │ │ +|_ _ _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_/_k_a_d_e_m_l_i_a_/_n_o_d_e___i_d_._c_p_p_:_6_6|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 | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_t_u_n_e_d_ _t_o_ _t_h_i_s_ _e_x_p_e_c_t_a_t_i_o_n_ _n_o_w_,_ _a_n_d_ _i_t_ _d_o_e_s_n_'_t_ _r_e_a_l_l_y_ _m_a_t_t_e_r_ _(_o_t_h_e_r_ _t_h_a_n_ _c_o_m_p_l_e_x_i_t_y_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|********** iitt''ss aa lliittttllee bbiitt wweeiirrdd ttoo rreettuurrnn 115599 -- lleeaaddiinngg zzeerrooeess.. IItt sshhoouulldd pprroobbaabbllyy bbee 116600 -- lleeaaddiinngg zzeerrooeess,, bbuutt aallll ootthheerr ccooddee iinn hheerree iiss ttuunneedd ttoo tthhiiss eexxppeeccttaattiioonn nnooww,, aanndd iitt | │ │ │ │ │ +|ddooeessnn''tt rreeaallllyy mmaatttteerr ((ootthheerr tthhaann ccoommpplleexxiittyy)) ********** | │ │ │ │ │ +|****** ....//ssrrcc//kkaaddeemmlliiaa//nnooddee__iidd..ccpppp::6666 ****** | │ │ │ │ │ +|// returns the distance between the two nodes | │ │ │ │ │ +|// using the kademlia XOR-metric | │ │ │ │ │ +|node_id distance(node_id const& n1, node_id const& n2) | │ │ │ │ │ |{ | │ │ │ │ │ -| // 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 header(static_cast(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 < 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_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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)); | │ │ │ │ │ -| | │ │ │ │ │ -| utp_stream* str = nullptr; | │ │ │ │ │ -|#ifdef TORRENT_SSL_PEERS | │ │ │ │ │ -| if (is_ssl(c)) | │ │ │ │ │ -| str = &boost::get>(c).next_layer(); | │ │ │ │ │ -| else | │ │ │ │ │ -|#endif | │ │ │ │ │ -| str = boost::get(&c); | │ │ │ │ │ +| return n1 ^ n2; | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| 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; | │ │ │ │ │ -| } | │ │ │ │ │ +|// returns true if: distance(n1, ref) < distance(n2, ref) | │ │ │ │ │ +|bool compare_ref(node_id const& n1, node_id const& n2, node_id const& ref) | │ │ │ │ │ +|{ | │ │ │ │ │ +| node_id const lhs = n1 ^ ref; | │ │ │ │ │ +| node_id const rhs = n2 ^ ref; | │ │ │ │ │ +| return lhs < rhs; | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| if (ph->get_type() == ST_RESET) return false; | │ │ │ │ │ +|// returns n in: 2^n <= distance(n1, n2) < 2^(n+1) | │ │ │ │ │ +|// useful for finding out which bucket a node belongs to | │ │ │ │ │ +|int distance_exp(node_id const& n1, node_id const& n2) | │ │ │ │ │ +|{ | │ │ │ │ │ +|return std::max(159 - distance(n1, n2).count_leading_zeroes(), 0); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| // #error send reset | │ │ │ │ │ +|int min_distance_exp(node_id const& n1, std::vector const& ids) | │ │ │ │ │ +|{ | │ │ │ │ │ +| TORRENT_ASSERT(ids.size() > 0); | │ │ │ │ │ | | │ │ │ │ │ -| return false; | │ │ │ │ │ +| int min = 160; // see distance_exp for the why of this constant | │ │ │ │ │ +| for (auto const& node_id : ids) | │ │ │ │ │ +| { | │ │ │ │ │ +| min = std::min(min, distance_exp(n1, node_id)); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -|_ _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_/_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; | │ │ │ │ │ +| return min; | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| int rate_threshold = sett.get_int(settings_pack::rate_choker_initial_threshold); | │ │ │ │ │ +|node_id generate_id_impl(address const& ip_, std::uint32_t r) | │ │ │ │ │ +|{ | │ │ │ │ │ +| std::uint8_t* ip = nullptr; | │ │ │ │ │ | | │ │ │ │ │ -| std::sort(peers.begin(), peers.end() | │ │ │ │ │ -| , [](peer_connection const* lhs, peer_connection const* rhs) | │ │ │ │ │ -| { return upload_rate_compare(lhs, rhs); }); | │ │ │ │ │ +| static std::uint8_t const v4mask[] = { 0x03, 0x0f, 0x3f, 0xff }; | │ │ │ │ │ +| static std::uint8_t const v6mask[] = { 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; | │ │ │ │ │ +| std::uint8_t const* mask = nullptr; | │ │ │ │ │ +| int num_octets = 0; | │ │ │ │ │ | | │ │ │ │ │ -| for (auto const* p : peers) | │ │ │ │ │ -| { | │ │ │ │ │ -| int const rate = int(p->uploaded_in_last_round() | │ │ │ │ │ -| * 1000 / total_milliseconds(unchoke_interval)); | │ │ │ │ │ +| 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_(_)_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_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); | │ │ │ │ │ | | │ │ │ │ │ -| // always have at least 1 unchoke slot | │ │ │ │ │ -| if (rate < rate_threshold) break; | │ │ │ │ │ +| return ed25519_sign({str, len}, pk, sk); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| ++upload_slots; | │ │ │ │ │ +|item::item(public_key const& pk, span salt) | │ │ │ │ │ +| : m_salt(salt.data(), static_cast(salt.size())) | │ │ │ │ │ +| , m_pk(pk) | │ │ │ │ │ +| , m_mutable(true) | │ │ │ │ │ +|{} | │ │ │ │ │ | | │ │ │ │ │ -|rate_threshold += 2048; | │ │ │ │ │ -|} | │ │ │ │ │ -| ++upload_slots; | │ │ │ │ │ -| } | │ │ │ │ │ +|item::item(entry v) | │ │ │ │ │ +| : m_value(std::move(v)) | │ │ │ │ │ +|{} | │ │ │ │ │ | | │ │ │ │ │ -| // 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 | │ │ │ │ │ +|item::item(bdecode_node const& v) | │ │ │ │ │ +|{ | │ │ │ │ │ +|m_value = v; | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| // we use partial sort here, because we only care about the top | │ │ │ │ │ -| // upload_slots peers. | │ │ │ │ │ +|item::item(entry v, span salt | │ │ │ │ │ +| , sequence_number const seq, public_key const& pk, secret_key const& sk) | │ │ │ │ │ +|{ | │ │ │ │ │ +| assign(std::move(v), salt, seq, pk, sk); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| int const slots = std::min(upload_slots, int(peers.size())); | │ │ │ │ │ +|void item::assign(entry v) | │ │ │ │ │ +|{ | │ │ │ │ │ +| m_mutable = false; | │ │ │ │ │ +| m_value = std::move(v); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| if (sett.get_int(settings_pack::seed_choking_algorithm) | │ │ │ │ │ -| == settings_pack::round_robin) | │ │ │ │ │ -| { | │ │ │ │ │ -| int const pieces = sett.get_int(settings_pack::seeding_piece_quota); | │ │ │ │ │ +|void item::assign(entry v, span salt | │ │ │ │ │ +| , sequence_number const seq, public_key const& pk, secret_key const& sk) | │ │ │ │ │ +|{ | │ │ │ │ │ +| std::array buffer; | │ │ │ │ │ +| int const bsize = bencode(buffer.begin(), v); | │ │ │ │ │ +| TORRENT_ASSERT(bsize <= 1000); | │ │ │ │ │ +| m_sig = sign_mutable_item(span(buffer).first(bsize) | │ │ │ │ │ +| , salt, seq, pk, sk); | │ │ │ │ │ +| m_salt.assign(salt.data(), static_cast(salt.size())); | │ │ │ │ │ +| m_pk = pk; | │ │ │ │ │ +| m_seq = seq; | │ │ │ │ │ +| m_mutable = true; | │ │ │ │ │ +| m_value = std::move(v); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| 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_/_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) | │ │ │ │ │ +|_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_/ |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 | │ │ │ │ │ -| , 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 | │ │ │ │ │ +| void dht_tracker::update_storage_node_ids() | │ │ │ │ │ | { | │ │ │ │ │ -| TORRENT_ASSERT(in_use); | │ │ │ │ │ -|#if TORRENT_USE_I2P | │ │ │ │ │ -| if (is_i2p_addr) return dest().to_string(); | │ │ │ │ │ -|#endif // TORRENT_USE_I2P | │ │ │ │ │ -| return address().to_string(); | │ │ │ │ │ +| std::vector ids; | │ │ │ │ │ +| for (auto& n : m_nodes) | │ │ │ │ │ +| ids.push_back(n.second.dht.nid()); | │ │ │ │ │ +| m_storage.update_node_ids(ids); | │ │ │ │ │ | } | │ │ │ │ │ -|#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_/_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) | │ │ │ │ │ +| node* dht_tracker::get_node(node_id const& id, std::string const& family_name) | │ │ │ │ │ | { | │ │ │ │ │ -| TORRENT_ASSERT(offset >= 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& 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(piece) * std::int64_t(m_files.piece_length()) | │ │ │ │ │ -| + offset - m_files.file_offset(f); | │ │ │ │ │ -| int const block_index = aux::numeric_cast(block_offset / default_block_size); | │ │ │ │ │ -| | │ │ │ │ │ -| if (h.is_all_zeros()) | │ │ │ │ │ +| TORRENT_UNUSED(id); | │ │ │ │ │ +| for (auto& n : m_nodes) | │ │ │ │ │ | { | │ │ │ │ │ -| TORRENT_ASSERT_FAIL(); | │ │ │ │ │ -| return set_block_hash_result::block_hash_failed(); | │ │ │ │ │ +|if (n.second.dht.protocol_family_name() == family_name) | │ │ │ │ │ +|return &n.second.dht; | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -|aux::merkle_tree::set_block_result result; | │ │ │ │ │ -|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(piece - file_first_piece) * blocks_per_piece) | │ │ │ │ │ -| , std::min(leafs_size, m_files.file_num_pieces(f) * blocks_per_piece - leafs_index) }; | │ │ │ │ │ +| return nullptr; | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| void hash_picker::hashes_rejected(hash_request const& req) | │ │ │ │ │ +| void dht_tracker::get_peers(sha1_hash const& ih | │ │ │ │ │ +| , std::function const&)> f) | │ │ │ │ │ | { | │ │ │ │ │ -| 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; | │ │ │ │ │ -|_ _ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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 ****** | │ │ │ │ │ -|}); | │ │ │ │ │ +| for (auto& n : m_nodes) | │ │ │ │ │ +| n.second.dht.get_peers(ih, f, {}, {}); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| bool async_write(storage_index_t | │ │ │ │ │ -| , peer_request const& r | │ │ │ │ │ -| , char const*, std::shared_ptr | │ │ │ │ │ -| , std::function handler | │ │ │ │ │ -| , disk_job_flags_t) override | │ │ │ │ │ +| void dht_tracker::announce(sha1_hash const& ih, int listen_port | │ │ │ │ │ +| , announce_flags_t const flags | │ │ │ │ │ +| , std::function const&)> f) | │ │ │ │ │ | { | │ │ │ │ │ -| TORRENT_ASSERT(r.length <= default_block_size); | │ │ │ │ │ -| TORRENT_UNUSED(r); | │ │ │ │ │ -| | │ │ │ │ │ -| post(m_ios, [h = std::move(handler)] { h(storage_error{}); }); | │ │ │ │ │ -| return false; | │ │ │ │ │ +| for (auto& n : m_nodes) | │ │ │ │ │ +| n.second.dht.announce(ih, listen_port, flags, f); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| void async_hash(storage_index_t | │ │ │ │ │ -| , piece_index_t piece, span, disk_job_flags_t | │ │ │ │ │ -| , std::function handler) override | │ │ │ │ │ +| void dht_tracker::sample_infohashes(udp::endpoint const& ep, sha1_hash const& target | │ │ │ │ │ +| , std::function | │ │ │ │ │ +| , std::vector>)> f) | │ │ │ │ │ | { | │ │ │ │ │ -|post(m_ios, [h = std::move(handler), piece] { h(piece, sha1_hash{}, storage_error{}); }); | │ │ │ │ │ +| 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|_._._/_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 ****** | │ │ │ │ │ +|} | │ │ │ │ │ |} | │ │ │ │ │ | | │ │ │ │ │ -| void async_hash2(storage_index_t, piece_index_t piece, int | │ │ │ │ │ -| , disk_job_flags_t | │ │ │ │ │ -| , std::function 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 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 handler) override | │ │ │ │ │ -| { | │ │ │ │ │ -| post(m_ios, [h = std::move(handler)] { h(); }); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| void async_delete_files(storage_index_t | │ │ │ │ │ -| , remove_flags_t, std::function handler) override | │ │ │ │ │ -| { | │ │ │ │ │ -| post(m_ios, [h = std::move(handler)] { h(storage_error{}); }); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| 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_/_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 l(m_job_mutex); | │ │ │ │ │ +|void put_data::done() | │ │ │ │ │ +|{ | │ │ │ │ │ +| m_done = true; | │ │ │ │ │ | | │ │ │ │ │ -| 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(j->piece), j->d.io.offset | │ │ │ │ │ -| , j->storage ? j->storage->num_outstanding_jobs() : -1); | │ │ │ │ │ -| } | │ │ │ │ │ +|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ +| get_node().observer()->log(dht_logger::traversal, "[%u] %s DONE, response %d, timeout %d" | │ │ │ │ │ +| , id(), name(), num_responses(), num_timeouts()); | │ │ │ │ │ |#endif | │ │ │ │ │ | | │ │ │ │ │ -| std::shared_ptr storage = j->storage; | │ │ │ │ │ +| m_put_callback(m_data, num_responses()); | │ │ │ │ │ +| traversal_algorithm::done(); | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| TORRENT_ASSERT(static_cast(j->action) < int(job_functions.size())); | │ │ │ │ │ +|bool put_data::invoke(observer_ptr o) | │ │ │ │ │ +|{ | │ │ │ │ │ +| if (m_done) return false; | │ │ │ │ │ | | │ │ │ │ │ -| m_stats_counters.inc_stats_counter(counters::num_running_disk_jobs, 1); | │ │ │ │ │ +|auto* po = static_cast(o.get()); | │ │ │ │ │ | | │ │ │ │ │ -| // call disk function | │ │ │ │ │ -|status_t ret = status_t::no_error; | │ │ │ │ │ -|try | │ │ │ │ │ -| { | │ │ │ │ │ -| int const idx = static_cast(j->action); | │ │ │ │ │ -| ret = (this->*(job_functions[static_cast(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&) | │ │ │ │ │ -| { | │ │ │ │ │ -| ret = status_t::fatal_disk_error; | │ │ │ │ │ -| j->error.ec = errors::no_memory; | │ │ │ │ │ -| j->error.operation = operation_t::exception; | │ │ │ │ │ -| } | │ │ │ │ │ -| catch (std::exception const&) | │ │ │ │ │ +| entry e; | │ │ │ │ │ +| e["y"] = "q"; | │ │ │ │ │ +| e["q"] = "put"; | │ │ │ │ │ +| entry& a = e["a"]; | │ │ │ │ │ +| a["v"] = m_data.value(); | │ │ │ │ │ +| a["token"] = po->m_token; | │ │ │ │ │ +| if (m_data.is_mutable()) | │ │ │ │ │ +| { | │ │ │ │ │ +| a["k"] = m_data.pk().bytes; | │ │ │ │ │ +| a["seq"] = m_data.seq().value; | │ │ │ │ │ +| a["sig"] = m_data.sig().bytes; | │ │ │ │ │ +| if (!m_data.salt().empty()) | │ │ │ │ │ | { | │ │ │ │ │ -| ret = status_t::fatal_disk_error; | │ │ │ │ │ -| j->error.ec = boost::asio::error::fault; | │ │ │ │ │ -| j->error.operation = operation_t::exception; | │ │ │ │ │ +| a["salt"] = m_data.salt(); | │ │ │ │ │ | } | │ │ │ │ │ -| | │ │ │ │ │ -| // 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 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); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -| void mmap_disk_io::async_clear_piece(storage_index_t const storage | │ │ │ │ │ -| , piece_index_t const index, std::function 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 | │ │ │ │ │ -| | │ │ │ │ │ +| m_node.stats_counters().inc_stats_counter(counters::dht_put_out); | │ │ │ │ │ | | │ │ │ │ │ -|add_fence_job(j); | │ │ │ │ │ +| return m_node.m_rpc.invoke(e, o->target_ep(), o); | │ │ │ │ │ |} | │ │ │ │ │ | | │ │ │ │ │ -| 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->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; | │ │ │ │ │ -| | │ │ │ │ │ -|_ _ _ _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_/_u_t___m_e_t_a_d_a_t_a_._c_p_p_:_2_8_1_ _ _ _ _|_w_e_ _r_e_a_l_l_y_ _n_e_e_d_ _t_o_ _i_n_c_r_e_m_e_n_t_ _t_h_e_ _r_e_f_c_o_u_n_t_e_r_ _o_n_ _t_h_e_ _t_o_r_r_e_n_t_ _w_h_i_l_e_ _t_h_i_s_ _b_u_f_f_e_r_ _i_s_ _s_t_i_l_l_ _i_n_ _t_h_e_ _p_e_e_r_'_s_ _s_e_n_d_ _b_u_f_f_e_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|********** wwee rreeaallllyy nneeeedd ttoo iinnccrreemmeenntt tthhee rreeffccoouunntteerr oonn tthhee ttoorrrreenntt wwhhiillee tthhiiss bbuuffffeerr iiss ssttiillll iinn tthhee ppeeeerr''ss sseenndd bbuuffffeerr ********** | │ │ │ │ │ -|****** ....//ssrrcc//uutt__mmeettaaddaattaa..ccpppp::228811 ****** | │ │ │ │ │ -|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_pc.send_buffer({msg, len + 6}); | │ │ │ │ │ -|if (metadata_piece_size) | │ │ │ │ │ -|{ | │ │ │ │ │ -| m_pc.append_const_send_buffer( | │ │ │ │ │ -| span(const_cast(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 body) override | │ │ │ │ │ -| { | │ │ │ │ │ -| if (extended_msg != 2) return false; | │ │ │ │ │ -| if (m_message_index == 0) return false; | │ │ │ │ │ -| | │ │ │ │ │ -| if (length > 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); | │ │ │ │ │ -|_ _ _ _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_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_}_ _}_ _/_/_ _n_a_m_e_s_p_a_c_e_ _l_i_b_t_o_r_r_e_n_t_:_:_d_h_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ |_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") | │ │ │ │ │ | { | │ │ │ │ │ @@ -10765,226 +10977,315 @@ │ │ │ │ │ | && 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_/_n_o_d_e___i_d_._c_p_p_:_6_6|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 | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_t_u_n_e_d_ _t_o_ _t_h_i_s_ _e_x_p_e_c_t_a_t_i_o_n_ _n_o_w_,_ _a_n_d_ _i_t_ _d_o_e_s_n_'_t_ _r_e_a_l_l_y_ _m_a_t_t_e_r_ _(_o_t_h_e_r_ _t_h_a_n_ _c_o_m_p_l_e_x_i_t_y_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|********** iitt''ss aa lliittttllee bbiitt wweeiirrdd ttoo rreettuurrnn 115599 -- lleeaaddiinngg zzeerrooeess.. IItt sshhoouulldd pprroobbaabbllyy bbee 116600 -- lleeaaddiinngg zzeerrooeess,, bbuutt aallll ootthheerr ccooddee iinn hheerree iiss ttuunneedd ttoo tthhiiss eexxppeeccttaattiioonn nnooww,, aanndd iitt | │ │ │ │ │ -|ddooeessnn''tt rreeaallllyy mmaatttteerr ((ootthheerr tthhaann ccoommpplleexxiittyy)) ********** | │ │ │ │ │ -|****** ....//ssrrcc//kkaaddeemmlliiaa//nnooddee__iidd..ccpppp::6666 ****** | │ │ │ │ │ -|// returns the distance between the two nodes | │ │ │ │ │ -|// using the kademlia XOR-metric | │ │ │ │ │ -|node_id distance(node_id const& n1, node_id const& n2) | │ │ │ │ │ -|{ | │ │ │ │ │ -| return n1 ^ n2; | │ │ │ │ │ -|} | │ │ │ │ │ +|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); | │ │ │ │ │ +| aux::to_hex(tmp, &m_session_id[0]); | │ │ │ │ │ | | │ │ │ │ │ -|// returns true if: distance(n1, ref) < distance(n2, ref) | │ │ │ │ │ -|bool compare_ref(node_id const& n1, node_id const& n2, node_id const& ref) | │ │ │ │ │ -|{ | │ │ │ │ │ -| node_id const lhs = n1 ^ ref; | │ │ │ │ │ -| node_id const rhs = n2 ^ ref; | │ │ │ │ │ -| return lhs < rhs; | │ │ │ │ │ -|} | │ │ │ │ │ +| m_sam_socket = std::make_shared(m_io_service); | │ │ │ │ │ +| m_sam_socket->set_proxy(m_hostname, m_port); | │ │ │ │ │ +| m_sam_socket->set_command(i2p_stream::cmd_create_session); | │ │ │ │ │ +| m_sam_socket->set_session_id(m_session_id.c_str()); | │ │ │ │ │ +| m_sam_socket->set_session_options(session_options); | │ │ │ │ │ | | │ │ │ │ │ -|// returns n in: 2^n <= distance(n1, n2) < 2^(n+1) | │ │ │ │ │ -|// useful for finding out which bucket a node belongs to | │ │ │ │ │ -|int distance_exp(node_id const& n1, node_id const& n2) | │ │ │ │ │ -|{ | │ │ │ │ │ -|return std::max(159 - distance(n1, n2).count_leading_zeroes(), 0); | │ │ │ │ │ -|} | │ │ │ │ │ +| ADD_OUTSTANDING_ASYNC("i2p_stream::on_sam_connect"); | │ │ │ │ │ +| m_sam_socket->async_connect(tcp::endpoint(), wrap_allocator( | │ │ │ │ │ +| [this,s=m_sam_socket](error_code const& ec, Handler hn) { | │ │ │ │ │ +| on_sam_connect(ec, s, std::move(hn)); | │ │ │ │ │ +| }, std::move(handler))); | │ │ │ │ │ +| } | │ │ │ │ │ +| void close(error_code&); | │ │ │ │ │ | | │ │ │ │ │ -|int min_distance_exp(node_id const& n1, std::vector const& ids) | │ │ │ │ │ -|{ | │ │ │ │ │ -| TORRENT_ASSERT(ids.size() > 0); | │ │ │ │ │ +|char const* session_id() const { return m_session_id.c_str(); } | │ │ │ │ │ +|std::string const& local_endpoint() const { return m_i2p_local_endpoint; } | │ │ │ │ │ | | │ │ │ │ │ -| int min = 160; // see distance_exp for the why of this constant | │ │ │ │ │ -| for (auto const& node_id : ids) | │ │ │ │ │ +| template | │ │ │ │ │ +| void async_name_lookup(char const* name, Handler handler) | │ │ │ │ │ | { | │ │ │ │ │ -| min = std::min(min, distance_exp(n1, node_id)); | │ │ │ │ │ +| if (m_state == sam_idle && m_name_lookup.empty() && is_open()) | │ │ │ │ │ +| do_name_lookup(name, std::move(handler)); | │ │ │ │ │ +| else | │ │ │ │ │ +| m_name_lookup.emplace_back(std::string(name) | │ │ │ │ │ +| , std::move(handler)); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| return min; | │ │ │ │ │ -|} | │ │ │ │ │ +|private: | │ │ │ │ │ | | │ │ │ │ │ -|node_id generate_id_impl(address const& ip_, std::uint32_t r) | │ │ │ │ │ -|{ | │ │ │ │ │ -| std::uint8_t* ip = nullptr; | │ │ │ │ │ +| template | │ │ │ │ │ +| void on_sam_connect(error_code const& ec, std::shared_ptr, Handler h) | │ │ │ │ │ +| { | │ │ │ │ │ +| COMPLETE_ASYNC("i2p_stream::on_sam_connect"); | │ │ │ │ │ +| m_state = sam_idle; | │ │ │ │ │ | | │ │ │ │ │ -| static std::uint8_t const v4mask[] = { 0x03, 0x0f, 0x3f, 0xff }; | │ │ │ │ │ -| static std::uint8_t const v6mask[] = { 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; | │ │ │ │ │ -| std::uint8_t const* mask = nullptr; | │ │ │ │ │ -| int num_octets = 0; | │ │ │ │ │ +| if (ec) | │ │ │ │ │ +| { | │ │ │ │ │ +| h(ec); | │ │ │ │ │ +| return; | │ │ │ │ │ +| } | │ │ │ │ │ | | │ │ │ │ │ -| address_v4::bytes_type b4{}; | │ │ │ │ │ -| address_v6::bytes_type b6{}; | │ │ │ │ │ -| if (ip_.is_v6()) | │ │ │ │ │ +| 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_/ |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 | │ │ │ │ │ | { | │ │ │ │ │ -| 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_/_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 ****** | │ │ │ │ │ -|} | │ │ │ │ │ -|} | │ │ │ │ │ +| public: | │ │ │ │ │ +| hash_picker(file_storage const& files | │ │ │ │ │ +| , aux::vector& trees); | │ │ │ │ │ | | │ │ │ │ │ -|void put_data::done() | │ │ │ │ │ -|{ | │ │ │ │ │ -| m_done = true; | │ │ │ │ │ +| hash_request pick_hashes(typed_bitfield const& pieces); | │ │ │ │ │ | | │ │ │ │ │ -|#ifndef TORRENT_DISABLE_LOGGING | │ │ │ │ │ -| get_node().observer()->log(dht_logger::traversal, "[%u] %s DONE, response %d, timeout %d" | │ │ │ │ │ -| , id(), name(), num_responses(), num_timeouts()); | │ │ │ │ │ -|#endif | │ │ │ │ │ +| add_hashes_result add_hashes(hash_request const& req, span 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); | │ │ │ │ │ | | │ │ │ │ │ -| m_put_callback(m_data, num_responses()); | │ │ │ │ │ -| traversal_algorithm::done(); | │ │ │ │ │ -|} | │ │ │ │ │ +| // 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; | │ │ │ │ │ | | │ │ │ │ │ -|bool put_data::invoke(observer_ptr o) | │ │ │ │ │ -|{ | │ │ │ │ │ -| if (m_done) return false; | │ │ │ │ │ +| int piece_layer() const { return m_piece_layer; } | │ │ │ │ │ | | │ │ │ │ │ -|auto* po = static_cast(o.get()); | │ │ │ │ │ +| 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; | │ │ │ │ │ | | │ │ │ │ │ -| entry e; | │ │ │ │ │ -| e["y"] = "q"; | │ │ │ │ │ -| e["q"] = "put"; | │ │ │ │ │ -| entry& a = e["a"]; | │ │ │ │ │ -| a["v"] = m_data.value(); | │ │ │ │ │ -| a["token"] = po->m_token; | │ │ │ │ │ -| if (m_data.is_mutable()) | │ │ │ │ │ +| 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_/ |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 | │ │ │ │ │ +| void name_lookup(error_code const& e, tcp::resolver::results_type ips | │ │ │ │ │ +| , Handler h) | │ │ │ │ │ | { | │ │ │ │ │ -| a["k"] = m_data.pk().bytes; | │ │ │ │ │ -| a["seq"] = m_data.seq().value; | │ │ │ │ │ -| a["sig"] = m_data.sig().bytes; | │ │ │ │ │ -| if (!m_data.salt().empty()) | │ │ │ │ │ +| COMPLETE_ASYNC("socks5_stream::name_lookup"); | │ │ │ │ │ +| if (handle_error(e, std::move(h))) return; | │ │ │ │ │ +| | │ │ │ │ │ +| auto i = ips.begin(); | │ │ │ │ │ +| if (!m_sock.is_open()) | │ │ │ │ │ | { | │ │ │ │ │ -| a["salt"] = m_data.salt(); | │ │ │ │ │ +| 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))); | │ │ │ │ │ | } | │ │ │ │ │ | | │ │ │ │ │ -| m_node.stats_counters().inc_stats_counter(counters::dht_put_out); | │ │ │ │ │ +| template | │ │ │ │ │ +| 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_/ |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 { | │ │ │ │ │ +| | │ │ │ │ │ +|// 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); | │ │ │ │ │ | | │ │ │ │ │ -| return m_node.m_rpc.invoke(e, o->target_ep(), o); | │ │ │ │ │ |} | │ │ │ │ │ | | │ │ │ │ │ -|_}_ _}_ _/_/_ _n_a_m_e_s_p_a_c_e_ _l_i_b_t_o_r_r_e_n_t_:_:_d_h_t_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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())); | │ │ │ │ │ +|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|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. | │ │ │ │ │ +| std::vector m_owned_collections; | │ │ │ │ │ +| | │ │ │ │ │ +|#if TORRENT_ABI_VERSION <= 2 | │ │ │ │ │ +| // if this is a merkle torrent, this is the merkle | │ │ │ │ │ +| // tree. It has space for merkle_num_nodes(merkle_num_leafs(num_pieces)) | │ │ │ │ │ +| // hashes | │ │ │ │ │ +| aux::vector m_merkle_tree; | │ │ │ │ │ |#endif | │ │ │ │ │ -| } | │ │ │ │ │ | | │ │ │ │ │ -| void dht_tracker::update_storage_node_ids() | │ │ │ │ │ -| { | │ │ │ │ │ -| std::vector ids; | │ │ │ │ │ -| for (auto& n : m_nodes) | │ │ │ │ │ -| ids.push_back(n.second.dht.nid()); | │ │ │ │ │ -| m_storage.update_node_ids(ids); | │ │ │ │ │ -| } | │ │ │ │ │ +| // v2 merkle tree for each file | │ │ │ │ │ +| // the actual hash buffers are always divisible by 32 (sha256_hash::size()) | │ │ │ │ │ +| aux::vector, file_index_t> m_piece_layers; | │ │ │ │ │ | | │ │ │ │ │ -| 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; | │ │ │ │ │ -| } | │ │ │ │ │ +| // this is a copy of the info section from the torrent. | │ │ │ │ │ +| // it use maintained in this flat format in order to | │ │ │ │ │ +| // make it available through the metadata extension | │ │ │ │ │ +|boost::shared_array m_info_section; | │ │ │ │ │ | | │ │ │ │ │ -| return nullptr; | │ │ │ │ │ -| } | │ │ │ │ │ +| // if a comment is found in the torrent file | │ │ │ │ │ +| // this will be set to that comment | │ │ │ │ │ +| std::string m_comment; | │ │ │ │ │ | | │ │ │ │ │ -| void dht_tracker::get_peers(sha1_hash const& ih | │ │ │ │ │ -| , std::function const&)> f) | │ │ │ │ │ -| { | │ │ │ │ │ -| for (auto& n : m_nodes) | │ │ │ │ │ -| n.second.dht.get_peers(ih, f, {}, {}); | │ │ │ │ │ -| } | │ │ │ │ │ +| // an optional string naming the software used | │ │ │ │ │ +| // to create the torrent file | │ │ │ │ │ +| std::string m_created_by; | │ │ │ │ │ | | │ │ │ │ │ -| void dht_tracker::announce(sha1_hash const& ih, int listen_port | │ │ │ │ │ -| , announce_flags_t const flags | │ │ │ │ │ -| , std::function const&)> f) | │ │ │ │ │ -| { | │ │ │ │ │ -| for (auto& n : m_nodes) | │ │ │ │ │ -| n.second.dht.announce(ih, listen_port, flags, f); | │ │ │ │ │ -| } | │ │ │ │ │ +| // the info section parsed. points into m_info_section | │ │ │ │ │ +| // parsed lazily | │ │ │ │ │ +| mutable bdecode_node m_info_dict; | │ │ │ │ │ | | │ │ │ │ │ -| void dht_tracker::sample_infohashes(udp::endpoint const& ep, sha1_hash const& target | │ │ │ │ │ -| , std::function | │ │ │ │ │ -| , std::vector>)> f) | │ │ │ │ │ +| // if a creation date is found in the torrent file | │ │ │ │ │ +| // this will be set to that, otherwise it'll be | │ │ │ │ │ +| // 1970, Jan 1 | │ │ │ │ │ +| std::time_t m_creation_date = 0; | │ │ │ │ │ +| | │ │ │ │ │ +| // the hash(es) that identify this torrent | │ │ │ │ │ +| info_hash_t m_info_hash; | │ │ │ │ │ +| | │ │ │ │ │ +| // this is the offset into the m_info_section buffer to the first byte of | │ │ │ │ │ +| // the first SHA-1 hash | │ │ │ │ │ +| 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_/ |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 | │ │ │ │ │ | { | │ │ │ │ │ -| 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); | │ │ │ │ │ +| // internal | │ │ │ │ │ +| TORRENT_UNEXPORT announce_infohash(); | │ │ │ │ │ | | │ │ │ │ │ -| return ed25519_sign({str, len}, pk, sk); | │ │ │ │ │ -|} | │ │ │ │ │ +| // if this tracker has returned an error or warning message | │ │ │ │ │ +| // that message is stored here | │ │ │ │ │ +| std::string message; | │ │ │ │ │ | | │ │ │ │ │ -|item::item(public_key const& pk, span salt) | │ │ │ │ │ -| : m_salt(salt.data(), static_cast(salt.size())) | │ │ │ │ │ -| , m_pk(pk) | │ │ │ │ │ -| , m_mutable(true) | │ │ │ │ │ -|{} | │ │ │ │ │ +| // if this tracker failed the last time it was contacted | │ │ │ │ │ +| // this error code specifies what error occurred | │ │ │ │ │ +| error_code last_error; | │ │ │ │ │ | | │ │ │ │ │ -|item::item(entry v) | │ │ │ │ │ -| : m_value(std::move(v)) | │ │ │ │ │ -|{} | │ │ │ │ │ +| // the time of next tracker announce | │ │ │ │ │ +| time_point32 next_announce = (time_point32::min)(); | │ │ │ │ │ | | │ │ │ │ │ -|item::item(bdecode_node const& v) | │ │ │ │ │ -|{ | │ │ │ │ │ -|m_value = v; | │ │ │ │ │ -|} | │ │ │ │ │ +| // no announces before this time | │ │ │ │ │ +| time_point32 min_announce = (time_point32::min)(); | │ │ │ │ │ | | │ │ │ │ │ -|item::item(entry v, span salt | │ │ │ │ │ -| , sequence_number const seq, public_key const& pk, secret_key const& sk) | │ │ │ │ │ -|{ | │ │ │ │ │ -| assign(std::move(v), salt, seq, pk, sk); | │ │ │ │ │ -|} | │ │ │ │ │ | | │ │ │ │ │ -|void item::assign(entry v) | │ │ │ │ │ -|{ | │ │ │ │ │ -| m_mutable = false; | │ │ │ │ │ -| m_value = std::move(v); | │ │ │ │ │ -|} | │ │ │ │ │ +|// 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). | │ │ │ │ │ | | │ │ │ │ │ -|void item::assign(entry v, span salt | │ │ │ │ │ -| , sequence_number const seq, public_key const& pk, secret_key const& sk) | │ │ │ │ │ -|{ | │ │ │ │ │ -| std::array buffer; | │ │ │ │ │ -| int const bsize = bencode(buffer.begin(), v); | │ │ │ │ │ -| TORRENT_ASSERT(bsize <= 1000); | │ │ │ │ │ -| m_sig = sign_mutable_item(span(buffer).first(bsize) | │ │ │ │ │ -| , salt, seq, pk, sk); | │ │ │ │ │ -| m_salt.assign(salt.data(), static_cast(salt.size())); | │ │ │ │ │ -| m_pk = pk; | │ │ │ │ │ -| m_seq = seq; | │ │ │ │ │ -| m_mutable = true; | │ │ │ │ │ -| m_value = std::move(v); | │ │ │ │ │ -|} | │ │ │ │ │ +| // 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; | │ │ │ │ │ | | │ │ │ │ │ -|_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_)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| // 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_/ |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 | │ │ │ │ │ | }; | │ │ │ │ │ | | │ │ │ │ │ @@ -11250,68 +11551,14 @@ │ │ │ │ │ | // 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_/ |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. | │ │ │ │ │ -| std::vector m_owned_collections; | │ │ │ │ │ -| | │ │ │ │ │ -|#if TORRENT_ABI_VERSION <= 2 | │ │ │ │ │ -| // if this is a merkle torrent, this is the merkle | │ │ │ │ │ -| // tree. It has space for merkle_num_nodes(merkle_num_leafs(num_pieces)) | │ │ │ │ │ -| // hashes | │ │ │ │ │ -| aux::vector m_merkle_tree; | │ │ │ │ │ -|#endif | │ │ │ │ │ -| | │ │ │ │ │ -| // v2 merkle tree for each file | │ │ │ │ │ -| // the actual hash buffers are always divisible by 32 (sha256_hash::size()) | │ │ │ │ │ -| aux::vector, file_index_t> m_piece_layers; | │ │ │ │ │ -| | │ │ │ │ │ -| // this is a copy of the info section from the torrent. | │ │ │ │ │ -| // it use maintained in this flat format in order to | │ │ │ │ │ -| // make it available through the metadata extension | │ │ │ │ │ -|boost::shared_array m_info_section; | │ │ │ │ │ -| | │ │ │ │ │ -| // if a comment is found in the torrent file | │ │ │ │ │ -| // this will be set to that comment | │ │ │ │ │ -| std::string m_comment; | │ │ │ │ │ -| | │ │ │ │ │ -| // an optional string naming the software used | │ │ │ │ │ -| // to create the torrent file | │ │ │ │ │ -| std::string m_created_by; | │ │ │ │ │ -| | │ │ │ │ │ -| // the info section parsed. points into m_info_section | │ │ │ │ │ -| // parsed lazily | │ │ │ │ │ -| mutable bdecode_node m_info_dict; | │ │ │ │ │ -| | │ │ │ │ │ -| // if a creation date is found in the torrent file | │ │ │ │ │ -| // this will be set to that, otherwise it'll be | │ │ │ │ │ -| // 1970, Jan 1 | │ │ │ │ │ -| std::time_t m_creation_date = 0; | │ │ │ │ │ -| | │ │ │ │ │ -| // the hash(es) that identify this torrent | │ │ │ │ │ -| info_hash_t m_info_hash; | │ │ │ │ │ -| | │ │ │ │ │ -| // this is the offset into the m_info_section buffer to the first byte of | │ │ │ │ │ -| // the first SHA-1 hash | │ │ │ │ │ -| 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_/ |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(); | │ │ │ │ │ | } | │ │ │ │ │ @@ -11359,54 +11606,14 @@ │ │ │ │ │ | 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_/ |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, 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 m_stats_counter; | │ │ │ │ │ -|#endif | │ │ │ │ │ -| }; | │ │ │ │ │ -|} | │ │ │ │ │ -| | │ │ │ │ │ -|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ | |_._._/_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 ****** | │ │ │ │ │ |*/ | │ │ │ │ │ | | │ │ │ │ │ @@ -11454,121 +11661,14 @@ │ │ │ │ │ | 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::iterator update_piece_state( | │ │ │ │ │ -| std::vector::iterator dp); | │ │ │ │ │ -| | │ │ │ │ │ -| private: | │ │ │ │ │ -| | │ │ │ │ │ -|#if TORRENT_USE_ASSERTS || TORRENT_USE_INVARIANT_CHECKS | │ │ │ │ │ -| index_range categories() const | │ │ │ │ │ -| { return {{}, piece_picker::piece_pos::num_download_categories}; } | │ │ │ │ │ -|#endif | │ │ │ │ │ -| | │ │ │ │ │ -| // the following vectors are mutable because they sometimes may | │ │ │ │ │ -| // be updated lazily, triggered by const functions | │ │ │ │ │ -| | │ │ │ │ │ -| // 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 m_piece_map; | │ │ │ │ │ -| | │ │ │ │ │ -| // 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 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 m_recent_extents; | │ │ │ │ │ -| | │ │ │ │ │ -| // 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; | │ │ │ │ │ -| | │ │ │ │ │ -| // the number of pad blocks part of filtered pieces we don't have | │ │ │ │ │ -| std::int64_t m_filtered_pad_bytes = 0; | │ │ │ │ │ -| | │ │ │ │ │ -| // 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; | │ │ │ │ │ -| | │ │ │ │ │ -|_ _ _/_/_ _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 m_block_info; | │ │ │ │ │ -| | │ │ │ │ │ -| // 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 m_free_block_infos; | │ │ │ │ │ -| | │ │ │ │ │ -| std::uint16_t m_blocks_in_last_piece = 0; | │ │ │ │ │ -| int m_piece_size = 0; | │ │ │ │ │ -| std::int64_t m_total_size = 0; | │ │ │ │ │ -| | │ │ │ │ │ -| // 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; | │ │ │ │ │ -| | │ │ │ │ │ -| // 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}; | │ │ │ │ │ -| | │ │ │ │ │ -| // 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}; | │ │ │ │ │ -| | │ │ │ │ │ -| // 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; | │ │ │ │ │ -| | │ │ │ │ │ -| // if this is set to true, it means update_pieces() | │ │ │ │ │ -| // has to be called before accessing m_pieces. | │ │ │ │ │ -| mutable bool m_dirty = false; | │ │ │ │ │ -| public: | │ │ │ │ │ -| | │ │ │ │ │ -| enum { max_pieces = (std::numeric_limits::max)() - 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_/ |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; | │ │ │ │ │ @@ -11616,288 +11716,54 @@ │ │ │ │ │ | // ``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_/ |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 | │ │ │ │ │ -| 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 | │ │ │ │ │ -| 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_/ |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 | │ │ │ │ │ -|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. | │ │ │ │ │ -| | │ │ │ │ │ -|*/ | │ │ │ │ │ -| | │ │ │ │ │ -|#ifndef TORRENT_STRING_VIEW_HPP_INCLUDED | │ │ │ │ │ -|#define TORRENT_STRING_VIEW_HPP_INCLUDED | │ │ │ │ │ -| | │ │ │ │ │ -|#include | │ │ │ │ │ -| | │ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_push.hpp" | │ │ │ │ │ -| | │ │ │ │ │ -| | │ │ │ │ │ -|#if BOOST_VERSION < 106100 | │ │ │ │ │ -|#include | │ │ │ │ │ -|#include // for strchr | │ │ │ │ │ -|namespace libtorrent { | │ │ │ │ │ -| | │ │ │ │ │ -|using string_view = boost::string_ref; | │ │ │ │ │ -|using wstring_view = boost::wstring_ref; | │ │ │ │ │ -| | │ │ │ │ │ -|// internal | │ │ │ │ │ -|inline string_view::size_type find_first_of(string_view const v, char const c | │ │ │ │ │ -| , string_view::size_type pos) | │ │ │ │ │ -|{ | │ │ │ │ │ -| while (pos < v.size()) | │ │ │ │ │ -| { | │ │ │ │ │ -| if (v[pos] == c) return pos; | │ │ │ │ │ -| ++pos; | │ │ │ │ │ -| } | │ │ │ │ │ -| return string_view::npos; | │ │ │ │ │ -|} | │ │ │ │ │ -| | │ │ │ │ │ -|// internal | │ │ │ │ │ -|inline string_view::size_type find_first_of(string_view const v, char const* c | │ │ │ │ │ -| , string_view::size_type pos) | │ │ │ │ │ -|{ | │ │ │ │ │ -| 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_/ |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 | │ │ │ │ │ -|#include "libtorrent/aux_/disable_warnings_pop.hpp" | │ │ │ │ │ +|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 | │ │ │ │ │ | | │ │ │ │ │ -|#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); | │ │ │ │ │ -| | │ │ │ │ │ -|#if TORRENT_ABI_VERSION == 1 | │ │ │ │ │ -| | │ │ │ │ │ -|#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp" | │ │ │ │ │ -| | │ │ │ │ │ -| // 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 | │ │ │ │ │ -| client_fingerprint(peer_id const& p); | │ │ │ │ │ -| | │ │ │ │ │ -|_#_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_/ |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); | │ │ │ │ │ -| aux::to_hex(tmp, &m_session_id[0]); | │ │ │ │ │ -| | │ │ │ │ │ -| m_sam_socket = std::make_shared(m_io_service); | │ │ │ │ │ -| m_sam_socket->set_proxy(m_hostname, m_port); | │ │ │ │ │ -| m_sam_socket->set_command(i2p_stream::cmd_create_session); | │ │ │ │ │ -| m_sam_socket->set_session_id(m_session_id.c_str()); | │ │ │ │ │ -| m_sam_socket->set_session_options(session_options); | │ │ │ │ │ -| | │ │ │ │ │ -| ADD_OUTSTANDING_ASYNC("i2p_stream::on_sam_connect"); | │ │ │ │ │ -| m_sam_socket->async_connect(tcp::endpoint(), wrap_allocator( | │ │ │ │ │ -| [this,s=m_sam_socket](error_code const& ec, Handler hn) { | │ │ │ │ │ -| on_sam_connect(ec, s, std::move(hn)); | │ │ │ │ │ -| }, std::move(handler))); | │ │ │ │ │ -| } | │ │ │ │ │ -| void close(error_code&); | │ │ │ │ │ -| | │ │ │ │ │ -|char const* session_id() const { return m_session_id.c_str(); } | │ │ │ │ │ -|std::string const& local_endpoint() const { return m_i2p_local_endpoint; } | │ │ │ │ │ -| | │ │ │ │ │ -| template | │ │ │ │ │ -| void async_name_lookup(char const* name, Handler handler) | │ │ │ │ │ -| { | │ │ │ │ │ -| if (m_state == sam_idle && m_name_lookup.empty() && is_open()) | │ │ │ │ │ -| do_name_lookup(name, std::move(handler)); | │ │ │ │ │ -| else | │ │ │ │ │ -| m_name_lookup.emplace_back(std::string(name) | │ │ │ │ │ -| , std::move(handler)); | │ │ │ │ │ -| } | │ │ │ │ │ -| | │ │ │ │ │ -|private: | │ │ │ │ │ -| | │ │ │ │ │ -| template | │ │ │ │ │ -| void on_sam_connect(error_code const& ec, std::shared_ptr, Handler h) | │ │ │ │ │ -| { | │ │ │ │ │ -| COMPLETE_ASYNC("i2p_stream::on_sam_connect"); | │ │ │ │ │ -| m_state = sam_idle; | │ │ │ │ │ -| | │ │ │ │ │ -| if (ec) | │ │ │ │ │ -| { | │ │ │ │ │ -| h(ec); | │ │ │ │ │ -| 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_/ |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& trees); | │ │ │ │ │ -| | │ │ │ │ │ -| hash_request pick_hashes(typed_bitfield const& pieces); | │ │ │ │ │ +| counters() TORRENT_COUNTER_NOEXCEPT; | │ │ │ │ │ | | │ │ │ │ │ -| add_hashes_result add_hashes(hash_request const& req, span 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); | │ │ │ │ │ +| counters(counters const&) TORRENT_COUNTER_NOEXCEPT; | │ │ │ │ │ +| counters& operator=(counters const&) & TORRENT_COUNTER_NOEXCEPT; | │ │ │ │ │ | | │ │ │ │ │ -| // 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; | │ │ │ │ │ +| // 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; | │ │ │ │ │ | | │ │ │ │ │ -| int piece_layer() const { return m_piece_layer; } | │ │ │ │ │ +| 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: | │ │ │ │ │ -| // 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; | │ │ │ │ │ -| }; | │ │ │ │ │ +|#ifdef ATOMIC_LLONG_LOCK_FREE | │ │ │ │ │ +|aux::array, 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 m_stats_counter; | │ │ │ │ │ +|#endif | │ │ │ │ │ +| }; | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| 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_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_#_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 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) | │ │ │ │ │ @@ -11999,152 +11865,231 @@ │ │ │ │ │ | // 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_/ |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 { | │ │ │ │ │ +|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. | │ │ │ │ │ | | │ │ │ │ │ -|// 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, | │ │ │ │ │ +|#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 | │ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_pop.hpp" | │ │ │ │ │ |#endif | │ │ │ │ │ -|}; | │ │ │ │ │ | | │ │ │ │ │ -|// return a short human readable name for types of socket | │ │ │ │ │ -|char const* socket_type_name(socket_type_t); | │ │ │ │ │ +|#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); | │ │ │ │ │ | | │ │ │ │ │ |} | │ │ │ │ │ | | │ │ │ │ │ -|_#_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 | │ │ │ │ │ +| // 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); | │ │ │ │ │ +| | │ │ │ │ │ +|#if TORRENT_ABI_VERSION == 1 | │ │ │ │ │ +| | │ │ │ │ │ +|#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp" | │ │ │ │ │ +| | │ │ │ │ │ +| // 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 | │ │ │ │ │ +| client_fingerprint(peer_id const& p); | │ │ │ │ │ +| | │ │ │ │ │ +|_#_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_/ |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 | │ │ │ │ │ +|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. | │ │ │ │ │ +| | │ │ │ │ │ +|*/ | │ │ │ │ │ +| | │ │ │ │ │ +|#ifndef TORRENT_STRING_VIEW_HPP_INCLUDED | │ │ │ │ │ +|#define TORRENT_STRING_VIEW_HPP_INCLUDED | │ │ │ │ │ +| | │ │ │ │ │ +|#include | │ │ │ │ │ +| | │ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_push.hpp" | │ │ │ │ │ +| | │ │ │ │ │ +| | │ │ │ │ │ +|#if BOOST_VERSION < 106100 | │ │ │ │ │ +|#include | │ │ │ │ │ +|#include // for strchr | │ │ │ │ │ +|namespace libtorrent { | │ │ │ │ │ +| | │ │ │ │ │ +|using string_view = boost::string_ref; | │ │ │ │ │ +|using wstring_view = boost::wstring_ref; | │ │ │ │ │ +| | │ │ │ │ │ +|// internal | │ │ │ │ │ +|inline string_view::size_type find_first_of(string_view const v, char const c | │ │ │ │ │ +| , string_view::size_type pos) | │ │ │ │ │ +|{ | │ │ │ │ │ +| while (pos < v.size()) | │ │ │ │ │ | { | │ │ │ │ │ -| // internal | │ │ │ │ │ -| TORRENT_UNEXPORT announce_infohash(); | │ │ │ │ │ +| if (v[pos] == c) return pos; | │ │ │ │ │ +| ++pos; | │ │ │ │ │ +| } | │ │ │ │ │ +| return string_view::npos; | │ │ │ │ │ +|} | │ │ │ │ │ | | │ │ │ │ │ -| // if this tracker has returned an error or warning message | │ │ │ │ │ -| // that message is stored here | │ │ │ │ │ -| std::string message; | │ │ │ │ │ +|// internal | │ │ │ │ │ +|inline string_view::size_type find_first_of(string_view const v, char const* c | │ │ │ │ │ +| , string_view::size_type pos) | │ │ │ │ │ +|{ | │ │ │ │ │ +| 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_/ |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::iterator update_piece_state( | │ │ │ │ │ +| std::vector::iterator dp); | │ │ │ │ │ | | │ │ │ │ │ -| // if this tracker failed the last time it was contacted | │ │ │ │ │ -| // this error code specifies what error occurred | │ │ │ │ │ -| error_code last_error; | │ │ │ │ │ +| private: | │ │ │ │ │ | | │ │ │ │ │ -| // the time of next tracker announce | │ │ │ │ │ -| time_point32 next_announce = (time_point32::min)(); | │ │ │ │ │ +|#if TORRENT_USE_ASSERTS || TORRENT_USE_INVARIANT_CHECKS | │ │ │ │ │ +| index_range categories() const | │ │ │ │ │ +| { return {{}, piece_picker::piece_pos::num_download_categories}; } | │ │ │ │ │ +|#endif | │ │ │ │ │ | | │ │ │ │ │ -| // no announces before this time | │ │ │ │ │ -| time_point32 min_announce = (time_point32::min)(); | │ │ │ │ │ +| // the following vectors are mutable because they sometimes may | │ │ │ │ │ +| // be updated lazily, triggered by const functions | │ │ │ │ │ | | │ │ │ │ │ +| // 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 m_piece_map; | │ │ │ │ │ | | │ │ │ │ │ -|// 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). | │ │ │ │ │ +| // 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 m_pads_in_piece; | │ │ │ │ │ | | │ │ │ │ │ -| // 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; | │ │ │ │ │ +| // 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 m_recent_extents; | │ │ │ │ │ | | │ │ │ │ │ -| // the number of times in a row we have failed to announce to this | │ │ │ │ │ -| // tracker. | │ │ │ │ │ -| std::uint8_t fails : 7; | │ │ │ │ │ +| // the number of bytes of pad file set in this piece picker | │ │ │ │ │ +| std::int64_t m_num_pad_bytes = 0; | │ │ │ │ │ | | │ │ │ │ │ -| // true while we're waiting for a response from the tracker. | │ │ │ │ │ -| bool updating : 1; | │ │ │ │ │ +| // the number of pad blocks that we already have | │ │ │ │ │ +| std::int64_t m_have_pad_bytes = 0; | │ │ │ │ │ | | │ │ │ │ │ -| // 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; | │ │ │ │ │ +| // the number of pad blocks part of filtered pieces we don't have | │ │ │ │ │ +| std::int64_t m_filtered_pad_bytes = 0; | │ │ │ │ │ | | │ │ │ │ │ -| // 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_/ |since this is a public function, it should probably be moved out of this header and into one with other public functions. | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_k_a_d_e_m_l_i_a_/_i_t_e_m_._h_p_p_:_6_1_ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|********** ssiinnccee tthhiiss iiss aa ppuubblliicc ffuunnccttiioonn,, iitt sshhoouulldd pprroobbaabbllyy bbee mmoovveedd oouutt ooff tthhiiss hheeaaddeerr aanndd iinnttoo oonnee wwiitthh ootthheerr ppuubblliicc ffuunnccttiioonnss.. ********** | │ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//kkaaddeemmlliiaa//iitteemm..hhpppp::6611 ****** | │ │ │ │ │ -|#include | │ │ │ │ │ -|#include | │ │ │ │ │ +| // the number of pad blocks we have that are also filtered | │ │ │ │ │ +| std::int64_t m_have_filtered_pad_bytes = 0; | │ │ │ │ │ | | │ │ │ │ │ -|namespace libtorrent { | │ │ │ │ │ -|namespace dht { | │ │ │ │ │ +| // the number of seeds. These are not added to | │ │ │ │ │ +| // the availability counters of the pieces | │ │ │ │ │ +| int m_seeds = 0; | │ │ │ │ │ | | │ │ │ │ │ -|// calculate the target hash for an immutable item. | │ │ │ │ │ -|TORRENT_EXTRA_EXPORT sha1_hash item_target_id(span v); | │ │ │ │ │ +|_ _ _/_/_ _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 m_block_info; | │ │ │ │ │ | | │ │ │ │ │ -|// calculate the target hash for a mutable item. | │ │ │ │ │ -|TORRENT_EXTRA_EXPORT sha1_hash item_target_id(span salt | │ │ │ │ │ -| , public_key const& pk); | │ │ │ │ │ +| // 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 m_free_block_infos; | │ │ │ │ │ | | │ │ │ │ │ -|TORRENT_EXTRA_EXPORT bool verify_mutable_item( | │ │ │ │ │ -| span v | │ │ │ │ │ -| , span salt | │ │ │ │ │ -| , sequence_number seq | │ │ │ │ │ -| , public_key const& pk | │ │ │ │ │ -| , signature const& sig); | │ │ │ │ │ +| std::uint16_t m_blocks_in_last_piece = 0; | │ │ │ │ │ +| int m_piece_size = 0; | │ │ │ │ │ +| std::int64_t m_total_size = 0; | │ │ │ │ │ | | │ │ │ │ │ +| // 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; | │ │ │ │ │ | | │ │ │ │ │ -|// given a byte range ``v`` and an optional byte range ``salt``, a | │ │ │ │ │ -|// sequence number, public key ``pk`` (must be 32 bytes) and a secret key | │ │ │ │ │ -|// ``sk`` (must be 64 bytes), this function produces a signature which | │ │ │ │ │ -|// is written into a 64 byte buffer pointed to by ``sig``. The caller | │ │ │ │ │ -|// is responsible for allocating the destination buffer that's passed in | │ │ │ │ │ -|// as the ``sig`` argument. Typically it would be allocated on the stack. | │ │ │ │ │ -|TORRENT_EXPORT signature sign_mutable_item( | │ │ │ │ │ -| span v | │ │ │ │ │ -| , span salt | │ │ │ │ │ -| , sequence_number seq | │ │ │ │ │ -| , public_key const& pk | │ │ │ │ │ -| , secret_key const& sk); | │ │ │ │ │ +| // the number of pieces we have that also are filtered | │ │ │ │ │ +| int m_num_have_filtered = 0; | │ │ │ │ │ | | │ │ │ │ │ -|class TORRENT_EXTRA_EXPORT item | │ │ │ │ │ -|{ | │ │ │ │ │ -|public: | │ │ │ │ │ -| item() {} | │ │ │ │ │ -| item(public_key const& pk, span salt); | │ │ │ │ │ -| explicit item(entry v); | │ │ │ │ │ -| item(entry v | │ │ │ │ │ -| , span salt | │ │ │ │ │ -| , sequence_number seq | │ │ │ │ │ -| , public_key const& pk | │ │ │ │ │ -| , secret_key const& sk); | │ │ │ │ │ -| explicit item(bdecode_node const& v); | │ │ │ │ │ +| // 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}; | │ │ │ │ │ | | │ │ │ │ │ -| void assign(entry v); | │ │ │ │ │ -| void assign(entry v, span salt | │ │ │ │ │ -| , sequence_number seq | │ │ │ │ │ -|_ _ _,_ _p_u_b_l_i_c___k_e_y_ _c_o_n_s_t_&_ _p_k_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +| // 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}; | │ │ │ │ │ +| | │ │ │ │ │ +| // 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; | │ │ │ │ │ +| | │ │ │ │ │ +| // if this is set to true, it means update_pieces() | │ │ │ │ │ +| // has to be called before accessing m_pieces. | │ │ │ │ │ +| mutable bool m_dirty = false; | │ │ │ │ │ +| public: | │ │ │ │ │ +| | │ │ │ │ │ +| enum { max_pieces = (std::numeric_limits::max)() - 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_/ |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,231 +12122,108 @@ │ │ │ │ │ | return verify_message_impl(msg, desc, ret, error); | │ │ │ │ │ |} | │ │ │ │ │ | | │ │ │ │ │ |} | │ │ │ │ │ |} | │ │ │ │ │ | | │ │ │ │ │ |_#_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 | │ │ │ │ │ -|// 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 | │ │ │ │ │ -|// a magnet link for a torrent that we already have files for. Once we have the | │ │ │ │ │ -|// metadata, we have files on disk but no hashes. We won't know whether the data | │ │ │ │ │ -|// on disk is valid or not, until we've downloaded the hashes to validate them. | │ │ │ │ │ -| | │ │ │ │ │ -|// Idea for future space optimization: | │ │ │ │ │ -|// while downloading, we need to store interior nodes of this tree. However, we | │ │ │ │ │ -|// don't need to store the padding. a SHA-256 is 32 bytes. Instead of storing | │ │ │ │ │ -|// the full (padded) tree of SHA-256 hashes, store the full tree of 32 bit | │ │ │ │ │ -|// signed integers, being indices into the actual storage for the tree. We could | │ │ │ │ │ -|// even grow the storage lazily. Instead of storing the padding hashes, use | │ │ │ │ │ -|// negative indices to refer to fixed SHA-256(0), and SHA-256(SHA-256(0)) and so | │ │ │ │ │ -|// on | │ │ │ │ │ -|struct TORRENT_EXTRA_EXPORT merkle_tree | │ │ │ │ │ -|{ | │ │ │ │ │ -|merkle_tree() = default; | │ │ │ │ │ -|merkle_tree(int num_blocks, int blocks_per_piece, char const* r); | │ │ │ │ │ -| | │ │ │ │ │ -| sha256_hash root() const; | │ │ │ │ │ -| | │ │ │ │ │ -| void load_tree(span t, std::vector const& verified); | │ │ │ │ │ -| void load_sparse_tree(span t, std::vector const& mask | │ │ │ │ │ -| , std::vector const& verified); | │ │ │ │ │ -| void load_verified_bits(std::vector const& verified); | │ │ │ │ │ -| | │ │ │ │ │ -| std::size_t size() const; | │ │ │ │ │ -| int end_index() const { return int(size()); } | │ │ │ │ │ -| | │ │ │ │ │ -| bool has_node(int idx) const; | │ │ │ │ │ -| | │ │ │ │ │ -| bool compare_node(int idx, sha256_hash const& h) const; | │ │ │ │ │ -| | │ │ │ │ │ -| sha256_hash operator[](int idx) const; | │ │ │ │ │ -| | │ │ │ │ │ -| std::vector build_vector() const; | │ │ │ │ │ -| std::pair, aux::vector> build_sparse_vector() const; | │ │ │ │ │ -| | │ │ │ │ │ -| // get bits indicating if each leaf hash is verified | │ │ │ │ │ -| std::vector verified_leafs() const; | │ │ │ │ │ -| | │ │ │ │ │ -| // 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 | │ │ │ │ │ -|_ _b_o_o_l_ _b_l_o_c_k_s___v_e_r_i_f_i_e_d_(_i_n_t_ _b_l_o_c_k___i_d_x_,_ _i_n_t_ _n_u_m___b_l_o_c_k_s_)_ _c_o_n_s_t_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/ |make this a std::unique_ptr | │ │ │ │ │ -|_ _ _ _ _ _ _ _ _ _ _ _|_m_e_r_k_l_e___t_r_e_e_._h_p_p_:_1_7_5_ _ _ _ _ _ _ _ _ _ _ _|_]_>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|********** mmaakkee tthhiiss aa ssttdd::::uunniiqquuee__ppttrr]]>> ********** | │ │ │ │ │ -|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//mmeerrkkllee__ttrreeee..hhpppp::117755 ****** | │ │ │ │ │ -| int blocks_per_piece() const { return 1 << 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; | │ │ │ │ │ -| int num_pieces() const; | │ │ │ │ │ -| int num_leafs() const; | │ │ │ │ │ -| | │ │ │ │ │ -| void optimize_storage(); | │ │ │ │ │ -| void optimize_storage_piece_layer(); | │ │ │ │ │ -| void allocate_full(); | │ │ │ │ │ -| | │ │ │ │ │ -| // a pointer to the root hash for this file. | │ │ │ │ │ -| char const* m_root = nullptr; | │ │ │ │ │ -| | │ │ │ │ │ -| // this is either the full tree, or some sparse representation of it, | │ │ │ │ │ -| // depending on m_mode | │ │ │ │ │ -|aux::vector m_tree; | │ │ │ │ │ -| | │ │ │ │ │ -| // when the full tree is allocated, this has one bit for each block hash. a | │ │ │ │ │ -| // 1 means we have verified the block hash to be correct, otherwise the block | │ │ │ │ │ -| // hash may represent what's on disk, but we haven't been able to verify it | │ │ │ │ │ -| // yet | │ │ │ │ │ -| bitfield m_block_verified; | │ │ │ │ │ -| | │ │ │ │ │ -| // number of blocks in the file this tree represents. The number of leafs in | │ │ │ │ │ -| // the tree is rounded up to an even power of 2. | │ │ │ │ │ -| int m_num_blocks = 0; | │ │ │ │ │ -| | │ │ │ │ │ -| // the number of blocks per piece, specified as how many steps to shift | │ │ │ │ │ -| // right 1 to get the number of blocks in one piece. This is a compact | │ │ │ │ │ -| // representation that's valid because pieces are always powers of 2. | │ │ │ │ │ -| // this is necessary to know which layer in the tree the piece layer is. | │ │ │ │ │ -| std::uint8_t m_blocks_per_piece_log = 0; | │ │ │ │ │ -| | │ │ │ │ │ -| enum class mode_t : std::uint8_t | │ │ │ │ │ -| { | │ │ │ │ │ -| // a default constructed tree is truly empty. It does not even have a | │ │ │ │ │ -| // root hash | │ │ │ │ │ -| uninitialized_tree, | │ │ │ │ │ -| | │ │ │ │ │ -| // 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___/ |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: | │ │ │ │ │ -| | │ │ │ │ │ -| Handler handler; | │ │ │ │ │ -| handler_storage* storage; | │ │ │ │ │ -|#ifndef BOOST_NO_EXCEPTIONS | │ │ │ │ │ -| error_handler_interface* error_handler; | │ │ │ │ │ -|#endif | │ │ │ │ │ -| }; | │ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/ |since this is a public function, it should probably be moved out of this header and into one with other public functions. | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_k_a_d_e_m_l_i_a_/_i_t_e_m_._h_p_p_:_6_1_ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|********** ssiinnccee tthhiiss iiss aa ppuubblliicc ffuunnccttiioonn,, iitt sshhoouulldd pprroobbaabbllyy bbee mmoovveedd oouutt ooff tthhiiss hheeaaddeerr aanndd iinnttoo oonnee wwiitthh ootthheerr ppuubblliicc ffuunnccttiioonnss.. ********** | │ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//kkaaddeemmlliiaa//iitteemm..hhpppp::6611 ****** | │ │ │ │ │ +|#include | │ │ │ │ │ +|#include | │ │ │ │ │ | | │ │ │ │ │ -| template | │ │ │ │ │ -| aux::allocating_handler | │ │ │ │ │ -| make_handler(Handler handler | │ │ │ │ │ -| , handler_storage& storage | │ │ │ │ │ -| , error_handler_interface& err_handler) | │ │ │ │ │ -| { | │ │ │ │ │ -| return aux::allocating_handler( | │ │ │ │ │ -| std::forward(handler), &storage, &err_handler); | │ │ │ │ │ -| } | │ │ │ │ │ +|namespace libtorrent { | │ │ │ │ │ +|namespace dht { | │ │ │ │ │ | | │ │ │ │ │ -|template | │ │ │ │ │ -| struct handler | │ │ │ │ │ -| { | │ │ │ │ │ -| explicit handler(std::shared_ptr p) : ptr_(std::move(p)) {} | │ │ │ │ │ +|// calculate the target hash for an immutable item. | │ │ │ │ │ +|TORRENT_EXTRA_EXPORT sha1_hash item_target_id(span v); | │ │ │ │ │ | | │ │ │ │ │ -| std::shared_ptr ptr_; | │ │ │ │ │ +|// calculate the target hash for a mutable item. | │ │ │ │ │ +|TORRENT_EXTRA_EXPORT sha1_hash item_target_id(span salt | │ │ │ │ │ +| , public_key const& pk); | │ │ │ │ │ | | │ │ │ │ │ -| template | │ │ │ │ │ -| void operator()(A&&... a) | │ │ │ │ │ -| { | │ │ │ │ │ -|#ifdef BOOST_NO_EXCEPTIONS | │ │ │ │ │ -| (ptr_.get()->*Handler)(std::forward(a)...); | │ │ │ │ │ -|#else | │ │ │ │ │ -| try | │ │ │ │ │ -| { | │ │ │ │ │ -| (ptr_.get()->*Handler)(std::forward(a)...); | │ │ │ │ │ -| } | │ │ │ │ │ -| catch (system_error const& e) | │ │ │ │ │ -| { | │ │ │ │ │ -| (ptr_.get()->*ErrorHandler)(e.code()); | │ │ │ │ │ -| } | │ │ │ │ │ -| catch (std::exception const& e) | │ │ │ │ │ -| { | │ │ │ │ │ -| (ptr_.get()->*ExceptHandler)(e); | │ │ │ │ │ -|_ _ _ _}_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ -|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; | │ │ │ │ │ +|TORRENT_EXTRA_EXPORT bool verify_mutable_item( | │ │ │ │ │ +| span v | │ │ │ │ │ +| , span salt | │ │ │ │ │ +| , sequence_number seq | │ │ │ │ │ +| , public_key const& pk | │ │ │ │ │ +| , signature const& sig); | │ │ │ │ │ | | │ │ │ │ │ -| 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; | │ │ │ │ │ +|// given a byte range ``v`` and an optional byte range ``salt``, a | │ │ │ │ │ +|// sequence number, public key ``pk`` (must be 32 bytes) and a secret key | │ │ │ │ │ +|// ``sk`` (must be 64 bytes), this function produces a signature which | │ │ │ │ │ +|// is written into a 64 byte buffer pointed to by ``sig``. The caller | │ │ │ │ │ +|// is responsible for allocating the destination buffer that's passed in | │ │ │ │ │ +|// as the ``sig`` argument. Typically it would be allocated on the stack. | │ │ │ │ │ +|TORRENT_EXPORT signature sign_mutable_item( | │ │ │ │ │ +| span v | │ │ │ │ │ +| , span salt | │ │ │ │ │ +| , sequence_number seq | │ │ │ │ │ +| , public_key const& pk | │ │ │ │ │ +| , secret_key const& sk); | │ │ │ │ │ | | │ │ │ │ │ -| virtual void for_each_listen_socket(std::function f) = 0; | │ │ │ │ │ +|class TORRENT_EXTRA_EXPORT item | │ │ │ │ │ +|{ | │ │ │ │ │ +|public: | │ │ │ │ │ +| item() {} | │ │ │ │ │ +| item(public_key const& pk, span salt); | │ │ │ │ │ +| explicit item(entry v); | │ │ │ │ │ +| item(entry v | │ │ │ │ │ +| , span salt | │ │ │ │ │ +| , sequence_number seq | │ │ │ │ │ +| , public_key const& pk | │ │ │ │ │ +| , secret_key const& sk); | │ │ │ │ │ +| explicit item(bdecode_node const& v); | │ │ │ │ │ | | │ │ │ │ │ -| // 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; | │ │ │ │ │ +| void assign(entry v); | │ │ │ │ │ +| void assign(entry v, span 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___/ |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_DISABLE_MUTABLE_TORRENTS | │ │ │ │ │ -| virtual std::vector> find_collection( | │ │ │ │ │ -| std::string const& collection) const = 0; | │ │ │ │ │ -|#endif | │ │ │ │ │ +|*/ | │ │ │ │ │ | | │ │ │ │ │ -|virtual proxy_settings proxy() const = 0; | │ │ │ │ │ +|#ifndef TORRENT_POOL_HPP | │ │ │ │ │ +|#define TORRENT_POOL_HPP | │ │ │ │ │ | | │ │ │ │ │ -|#if TORRENT_USE_I2P | │ │ │ │ │ -| virtual char const* i2p_session() const = 0; | │ │ │ │ │ -| virtual std::string const& local_i2p_endpoint() const = 0; | │ │ │ │ │ -|#endif | │ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_push.hpp" | │ │ │ │ │ +|#include | │ │ │ │ │ +|#include | │ │ │ │ │ +|#include "libtorrent/aux_/disable_warnings_pop.hpp" | │ │ │ │ │ | | │ │ │ │ │ -| virtual void prioritize_connections(std::weak_ptr t) = 0; | │ │ │ │ │ +|namespace libtorrent { | │ │ │ │ │ +|namespace aux { | │ │ │ │ │ | | │ │ │ │ │ -| virtual void trigger_auto_manage() = 0; | │ │ │ │ │ +|struct allocator_new_delete | │ │ │ │ │ +|{ | │ │ │ │ │ +| using size_type = std::size_t; | │ │ │ │ │ +| using difference_type = std::ptrdiff_t; | │ │ │ │ │ | | │ │ │ │ │ -| virtual void apply_settings_pack(std::shared_ptr pack) = 0; | │ │ │ │ │ -| virtual session_settings const& settings() const = 0; | │ │ │ │ │ +|static char* malloc(size_type const bytes) | │ │ │ │ │ +|{ return new char[bytes]; } | │ │ │ │ │ +| static void free(char* const block) | │ │ │ │ │ +| { delete [] block; } | │ │ │ │ │ +|}; | │ │ │ │ │ | | │ │ │ │ │ -| virtual void queue_tracker_request(tracker_request req | │ │ │ │ │ -| , std::weak_ptr c) = 0; | │ │ │ │ │ +|using pool = boost::pool; | │ │ │ │ │ | | │ │ │ │ │ -| // 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; | │ │ │ │ │ +|template | │ │ │ │ │ +|using object_pool = boost::object_pool; | │ │ │ │ │ | | │ │ │ │ │ -| 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_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|_#_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___/ |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; | │ │ │ │ │ | } | │ │ │ │ │ @@ -12670,14 +12492,231 @@ │ │ │ │ │ | // 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___/ |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 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> 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 t) = 0; | │ │ │ │ │ +| | │ │ │ │ │ +| virtual void trigger_auto_manage() = 0; | │ │ │ │ │ +| | │ │ │ │ │ +| virtual void apply_settings_pack(std::shared_ptr pack) = 0; | │ │ │ │ │ +| virtual session_settings const& settings() const = 0; | │ │ │ │ │ +| | │ │ │ │ │ +| virtual void queue_tracker_request(tracker_request req | │ │ │ │ │ +| , std::weak_ptr 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___/ |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 | │ │ │ │ │ +|// 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 | │ │ │ │ │ +|// a magnet link for a torrent that we already have files for. Once we have the | │ │ │ │ │ +|// metadata, we have files on disk but no hashes. We won't know whether the data | │ │ │ │ │ +|// on disk is valid or not, until we've downloaded the hashes to validate them. | │ │ │ │ │ +| | │ │ │ │ │ +|// Idea for future space optimization: | │ │ │ │ │ +|// while downloading, we need to store interior nodes of this tree. However, we | │ │ │ │ │ +|// don't need to store the padding. a SHA-256 is 32 bytes. Instead of storing | │ │ │ │ │ +|// the full (padded) tree of SHA-256 hashes, store the full tree of 32 bit | │ │ │ │ │ +|// signed integers, being indices into the actual storage for the tree. We could | │ │ │ │ │ +|// even grow the storage lazily. Instead of storing the padding hashes, use | │ │ │ │ │ +|// negative indices to refer to fixed SHA-256(0), and SHA-256(SHA-256(0)) and so | │ │ │ │ │ +|// on | │ │ │ │ │ +|struct TORRENT_EXTRA_EXPORT merkle_tree | │ │ │ │ │ +|{ | │ │ │ │ │ +|merkle_tree() = default; | │ │ │ │ │ +|merkle_tree(int num_blocks, int blocks_per_piece, char const* r); | │ │ │ │ │ +| | │ │ │ │ │ +| sha256_hash root() const; | │ │ │ │ │ +| | │ │ │ │ │ +| void load_tree(span t, std::vector const& verified); | │ │ │ │ │ +| void load_sparse_tree(span t, std::vector const& mask | │ │ │ │ │ +| , std::vector const& verified); | │ │ │ │ │ +| void load_verified_bits(std::vector const& verified); | │ │ │ │ │ +| | │ │ │ │ │ +| std::size_t size() const; | │ │ │ │ │ +| int end_index() const { return int(size()); } | │ │ │ │ │ +| | │ │ │ │ │ +| bool has_node(int idx) const; | │ │ │ │ │ +| | │ │ │ │ │ +| bool compare_node(int idx, sha256_hash const& h) const; | │ │ │ │ │ +| | │ │ │ │ │ +| sha256_hash operator[](int idx) const; | │ │ │ │ │ +| | │ │ │ │ │ +| std::vector build_vector() const; | │ │ │ │ │ +| std::pair, aux::vector> build_sparse_vector() const; | │ │ │ │ │ +| | │ │ │ │ │ +| // get bits indicating if each leaf hash is verified | │ │ │ │ │ +| std::vector verified_leafs() const; | │ │ │ │ │ +| | │ │ │ │ │ +| // 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 | │ │ │ │ │ +|_ _b_o_o_l_ _b_l_o_c_k_s___v_e_r_i_f_i_e_d_(_i_n_t_ _b_l_o_c_k___i_d_x_,_ _i_n_t_ _n_u_m___b_l_o_c_k_s_)_ _c_o_n_s_t_;_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|relevance 0|_._._/_i_n_c_l_u_d_e_/_l_i_b_t_o_r_r_e_n_t_/_a_u_x___/ |make this a std::unique_ptr | │ │ │ │ │ +|_ _ _ _ _ _ _ _ _ _ _ _|_m_e_r_k_l_e___t_r_e_e_._h_p_p_:_1_7_5_ _ _ _ _ _ _ _ _ _ _ _|_]_>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | │ │ │ │ │ +|********** mmaakkee tthhiiss aa ssttdd::::uunniiqquuee__ppttrr]]>> ********** | │ │ │ │ │ +|****** ....//iinncclluuddee//lliibbttoorrrreenntt//aauuxx__//mmeerrkkllee__ttrreeee..hhpppp::117755 ****** | │ │ │ │ │ +| int blocks_per_piece() const { return 1 << 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; | │ │ │ │ │ +| int num_pieces() const; | │ │ │ │ │ +| int num_leafs() const; | │ │ │ │ │ +| | │ │ │ │ │ +| void optimize_storage(); | │ │ │ │ │ +| void optimize_storage_piece_layer(); | │ │ │ │ │ +| void allocate_full(); | │ │ │ │ │ +| | │ │ │ │ │ +| // a pointer to the root hash for this file. | │ │ │ │ │ +| char const* m_root = nullptr; | │ │ │ │ │ +| | │ │ │ │ │ +| // this is either the full tree, or some sparse representation of it, | │ │ │ │ │ +| // depending on m_mode | │ │ │ │ │ +|aux::vector m_tree; | │ │ │ │ │ +| | │ │ │ │ │ +| // when the full tree is allocated, this has one bit for each block hash. a | │ │ │ │ │ +| // 1 means we have verified the block hash to be correct, otherwise the block | │ │ │ │ │ +| // hash may represent what's on disk, but we haven't been able to verify it | │ │ │ │ │ +| // yet | │ │ │ │ │ +| bitfield m_block_verified; | │ │ │ │ │ +| | │ │ │ │ │ +| // number of blocks in the file this tree represents. The number of leafs in | │ │ │ │ │ +| // the tree is rounded up to an even power of 2. | │ │ │ │ │ +| int m_num_blocks = 0; | │ │ │ │ │ +| | │ │ │ │ │ +| // the number of blocks per piece, specified as how many steps to shift | │ │ │ │ │ +| // right 1 to get the number of blocks in one piece. This is a compact | │ │ │ │ │ +| // representation that's valid because pieces are always powers of 2. | │ │ │ │ │ +| // this is necessary to know which layer in the tree the piece layer is. | │ │ │ │ │ +| std::uint8_t m_blocks_per_piece_log = 0; | │ │ │ │ │ +| | │ │ │ │ │ +| enum class mode_t : std::uint8_t | │ │ │ │ │ +| { | │ │ │ │ │ +| // a default constructed tree is truly empty. It does not even have a | │ │ │ │ │ +| // root hash | │ │ │ │ │ +| uninitialized_tree, | │ │ │ │ │ +| | │ │ │ │ │ +| // 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___/ |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: | │ │ │ │ │ +| | │ │ │ │ │ +| Handler handler; | │ │ │ │ │ +| handler_storage* storage; | │ │ │ │ │ +|#ifndef BOOST_NO_EXCEPTIONS | │ │ │ │ │ +| error_handler_interface* error_handler; | │ │ │ │ │ +|#endif | │ │ │ │ │ +| }; | │ │ │ │ │ +| | │ │ │ │ │ +| template | │ │ │ │ │ +| aux::allocating_handler | │ │ │ │ │ +| make_handler(Handler handler | │ │ │ │ │ +| , handler_storage& storage | │ │ │ │ │ +| , error_handler_interface& err_handler) | │ │ │ │ │ +| { | │ │ │ │ │ +| return aux::allocating_handler( | │ │ │ │ │ +| std::forward(handler), &storage, &err_handler); | │ │ │ │ │ +| } | │ │ │ │ │ +| | │ │ │ │ │ +|template | │ │ │ │ │ +| struct handler | │ │ │ │ │ +| { | │ │ │ │ │ +| explicit handler(std::shared_ptr p) : ptr_(std::move(p)) {} | │ │ │ │ │ +| | │ │ │ │ │ +| std::shared_ptr ptr_; | │ │ │ │ │ +| | │ │ │ │ │ +| template | │ │ │ │ │ +| void operator()(A&&... a) | │ │ │ │ │ +| { | │ │ │ │ │ +|#ifdef BOOST_NO_EXCEPTIONS | │ │ │ │ │ +| (ptr_.get()->*Handler)(std::forward(a)...); | │ │ │ │ │ +|#else | │ │ │ │ │ +| try | │ │ │ │ │ +| { | │ │ │ │ │ +| (ptr_.get()->*Handler)(std::forward(a)...); | │ │ │ │ │ +| } | │ │ │ │ │ +| catch (system_error const& e) | │ │ │ │ │ +| { | │ │ │ │ │ +| (ptr_.get()->*ErrorHandler)(e.code()); | │ │ │ │ │ +| } | │ │ │ │ │ +| catch (std::exception const& e) | │ │ │ │ │ +| { | │ │ │ │ │ +| (ptr_.get()->*ExceptHandler)(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. | │ │ │ │ │ @@ -12715,46 +12754,7 @@ │ │ │ │ │ |#endif | │ │ │ │ │ | | │ │ │ │ │ |#ifndef TORRENT_DEPRECATED_ENUM | │ │ │ │ │ |#define TORRENT_DEPRECATED_ENUM | │ │ │ │ │ |#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_/_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 | │ │ │ │ │ -|#include | │ │ │ │ │ -|#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; | │ │ │ │ │ -| | │ │ │ │ │ -|template | │ │ │ │ │ -|using object_pool = boost::object_pool; | │ │ │ │ │ -| | │ │ │ │ │ -|} | │ │ │ │ │ -|} | │ │ │ │ │ -| | │ │ │ │ │ -|_#_e_n_d_i_f_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |