--- /srv/rebuilderd/tmp/rebuilderdLHvBW2/inputs/libtorrent-rasterbar-doc_2.0.13-1_all.deb +++ /srv/rebuilderd/tmp/rebuilderdLHvBW2/out/libtorrent-rasterbar-doc_2.0.13-1_all.deb ├── file list │ @@ -1,3 +1,3 @@ │ -rw-r--r-- 0 0 0 4 2026-06-08 22:48:34.000000 debian-binary │ --rw-r--r-- 0 0 0 3628 2026-06-08 22:48:34.000000 control.tar.xz │ --rw-r--r-- 0 0 0 1681368 2026-06-08 22:48:34.000000 data.tar.xz │ +-rw-r--r-- 0 0 0 3632 2026-06-08 22:48:34.000000 control.tar.xz │ +-rw-r--r-- 0 0 0 1684352 2026-06-08 22:48:34.000000 data.tar.xz ├── control.tar.xz │ ├── control.tar │ │ ├── ./control │ │ │ @@ -1,13 +1,13 @@ │ │ │ Package: libtorrent-rasterbar-doc │ │ │ Source: libtorrent-rasterbar │ │ │ Version: 2.0.13-1 │ │ │ Architecture: all │ │ │ Maintainer: Christian Marillat │ │ │ -Installed-Size: 5819 │ │ │ +Installed-Size: 5987 │ │ │ Section: doc │ │ │ Priority: optional │ │ │ Multi-Arch: foreign │ │ │ Homepage: https://libtorrent.org/ │ │ │ Description: Documentation for libtorrent-rasterbar │ │ │ Bittorrent library by Rasterbar Software (Arvid Norberg). │ │ │ libtorrent-rasterbar is a C++ library that aims to be a good alternative to │ │ ├── ./md5sums │ │ │ ├── ./md5sums │ │ │ │┄ Files differ ├── data.tar.xz │ ├── data.tar │ │ ├── file list │ │ │ @@ -82,34 +82,34 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 22974 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/python_binding.html │ │ │ -rw-r--r-- 0 root (0) root (0) 35575 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Add_Torrent.html │ │ │ -rw-r--r-- 0 root (0) root (0) 256838 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Alerts.html │ │ │ -rw-r--r-- 0 root (0) root (0) 27437 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Bdecoding.html │ │ │ -rw-r--r-- 0 root (0) root (0) 25769 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Bencoding.html │ │ │ -rw-r--r-- 0 root (0) root (0) 88058 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Core.html │ │ │ -rw-r--r-- 0 root (0) root (0) 43859 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Create_Torrents.html │ │ │ --rw-r--r-- 0 root (0) root (0) 50915 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Custom_Storage.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 137008 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Custom_Storage.html │ │ │ -rw-r--r-- 0 root (0) root (0) 24960 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-DHT.html │ │ │ -rw-r--r-- 0 root (0) root (0) 48763 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Error_Codes.html │ │ │ -rw-r--r-- 0 root (0) root (0) 13261 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Filter.html │ │ │ -rw-r--r-- 0 root (0) root (0) 12804 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-PeerClass.html │ │ │ -rw-r--r-- 0 root (0) root (0) 69760 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Plugins.html │ │ │ -rw-r--r-- 0 root (0) root (0) 11011 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Resume_Data.html │ │ │ -rw-r--r-- 0 root (0) root (0) 102810 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Session.html │ │ │ -rw-r--r-- 0 root (0) root (0) 173887 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Settings.html │ │ │ -rw-r--r-- 0 root (0) root (0) 9742 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Stats.html │ │ │ --rw-r--r-- 0 root (0) root (0) 56856 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Storage.html │ │ │ --rw-r--r-- 0 root (0) root (0) 131675 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Handle.html │ │ │ --rw-r--r-- 0 root (0) root (0) 58150 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Info.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 56848 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Storage.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 131667 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Handle.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 58142 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Info.html │ │ │ -rw-r--r-- 0 root (0) root (0) 48237 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Status.html │ │ │ -rw-r--r-- 0 root (0) root (0) 16462 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Trackers.html │ │ │ -rw-r--r-- 0 root (0) root (0) 25530 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Utility.html │ │ │ -rw-r--r-- 0 root (0) root (0) 9129 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-ed25519.html │ │ │ -rw-r--r-- 0 root (0) root (0) 34353 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference.html │ │ │ -rw-r--r-- 0 root (0) root (0) 29242 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/security-audit.html │ │ │ --rw-r--r-- 0 root (0) root (0) 1287619 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/single-page-ref.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 1373688 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/single-page-ref.html │ │ │ -rw-r--r-- 0 root (0) root (0) 10121 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/streaming.html │ │ │ -rw-r--r-- 0 root (0) root (0) 8807 2026-06-08 20:17:44.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/style.css │ │ │ -rw-r--r-- 0 root (0) root (0) 521784 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/todo.html │ │ │ -rw-r--r-- 0 root (0) root (0) 3023 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/troubleshooting.html │ │ │ -rw-r--r-- 0 root (0) root (0) 25162 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/tuning-ref.html │ │ │ -rw-r--r-- 0 root (0) root (0) 132630 2026-06-08 22:48:34.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/tutorial-ref.html │ │ │ -rw-r--r-- 0 root (0) root (0) 16383 2026-06-08 22:48:34.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:

│ │ │ │ │ │ │ │ │
  • add_files()
  • │ │ │
  • set_piece_hashes()
  • │ │ │ │ │ │ │ │ │

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

    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);
    │ │ │ -   entry generate () const;
    │ │ │     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 is_v1_only () 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;
    │ │ │ @@ -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 │ │ │ @@ -180,16 +180,16 @@ │ │ │ entire duration of the create_torrent object.

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

    generate_buf() generate()

    │ │ │
    │ │ │ -entry generate () const;
    │ │ │  std::vector<char> generate_buf () const;
    │ │ │ +entry generate () 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 │ │ │ @@ -272,21 +272,21 @@ │ │ │ 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()

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

    add_url_seed() add_http_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.

    │ │ │ @@ -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_size() piece_length()

    │ │ │ + │ │ │ +[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()

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

    add_collection() add_similar_torrent()

    │ │ │
    │ │ │  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,29 +482,29 @@ │ │ │

    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
    │ │ │ +   , std::function<void(piece_index_t)> const& f);
    │ │ │  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
    │ │ │     , 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);
    │ │ │ +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, 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);
    │ │ │  
    │ │ │

    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);
    │ │ │ ├── html2text {}
    │ │ │ │ @@ -8,26 +8,26 @@
    │ │ │ │            o _g_e_n_e_r_a_t_e___b_u_f_(_)_ _g_e_n_e_r_a_t_e_(_)
    │ │ │ │            o _f_i_l_e_s_(_)
    │ │ │ │            o _s_e_t___c_o_m_m_e_n_t_(_)
    │ │ │ │            o _s_e_t___c_r_e_a_t_o_r_(_)
    │ │ │ │            o _s_e_t___c_r_e_a_t_i_o_n___d_a_t_e_(_)
    │ │ │ │            o _s_e_t___h_a_s_h_(_)
    │ │ │ │            o _s_e_t___h_a_s_h_2_(_)
    │ │ │ │ -          o _a_d_d___h_t_t_p___s_e_e_d_(_)_ _a_d_d___u_r_l___s_e_e_d_(_)
    │ │ │ │ +          o _a_d_d___u_r_l___s_e_e_d_(_)_ _a_d_d___h_t_t_p___s_e_e_d_(_)
    │ │ │ │            o _a_d_d___n_o_d_e_(_)
    │ │ │ │            o _a_d_d___t_r_a_c_k_e_r_(_)
    │ │ │ │            o _s_e_t___r_o_o_t___c_e_r_t_(_)
    │ │ │ │            o _s_e_t___p_r_i_v_(_)_ _p_r_i_v_(_)
    │ │ │ │            o _n_u_m___p_i_e_c_e_s_(_)
    │ │ │ │            o _p_i_e_c_e___r_a_n_g_e_(_)
    │ │ │ │            o _f_i_l_e___r_a_n_g_e_(_)
    │ │ │ │            o _f_i_l_e___p_i_e_c_e___r_a_n_g_e_(_)
    │ │ │ │            o _t_o_t_a_l___s_i_z_e_(_)
    │ │ │ │ -          o _p_i_e_c_e___s_i_z_e_(_)_ _p_i_e_c_e___l_e_n_g_t_h_(_)
    │ │ │ │ -          o _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___l_e_n_g_t_h_(_)_ _p_i_e_c_e___s_i_z_e_(_)
    │ │ │ │ +          o _a_d_d___c_o_l_l_e_c_t_i_o_n_(_)_ _a_d_d___s_i_m_i_l_a_r___t_o_r_r_e_n_t_(_)
    │ │ │ │      * _a_d_d___f_i_l_e_s_(_)
    │ │ │ │      * _s_e_t___p_i_e_c_e___h_a_s_h_e_s_(_)
    │ │ │ │  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,35 +66,35 @@
    │ │ │ │  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);
    │ │ │ │ -   entry ggeenneerraattee () const;
    │ │ │ │     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 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;
    │ │ │ │ @@ -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
    │ │ │ │ @@ -132,16 +132,16 @@
    │ │ │ │  (such as _s_e_t___h_a_s_h_(_)), will have any affect. Instead of using this overload,
    │ │ │ │  consider using _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_) instead.
    │ │ │ │  Warning
    │ │ │ │  The _f_i_l_e___s_t_o_r_a_g_e and _t_o_r_r_e_n_t___i_n_f_o objects must stay alive for the entire
    │ │ │ │  duration of the _c_r_e_a_t_e___t_o_r_r_e_n_t object.
    │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
    │ │ │ │  ********** ggeenneerraattee__bbuuff(()) ggeenneerraattee(()) **********
    │ │ │ │ -entry ggeenneerraattee () const;
    │ │ │ │  std::vector ggeenneerraattee__bbuuff () const;
    │ │ │ │ +entry ggeenneerraattee () const;
    │ │ │ │  This function will generate the .torrent file as a bencode tree, or a bencoded
    │ │ │ │  into a buffer. In order to encode the _e_n_t_r_y into a flat file, use the _b_e_n_c_o_d_e_(_)
    │ │ │ │  function.
    │ │ │ │  The function returning an _e_n_t_r_y may be useful to add custom entries to the
    │ │ │ │  torrent file before bencoding it and saving it to disk.
    │ │ │ │  Whether the resulting torrent object is v1, v2 or hybrid depends on whether any
    │ │ │ │  of the v1_only or v2_only flags were set on the constructor. If neither were
    │ │ │ │ @@ -198,17 +198,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__hhttttpp__sseeeedd(()) aadddd__uurrll__sseeeedd(()) **********
    │ │ │ │ -void aadddd__hhttttpp__sseeeedd (string_view url);
    │ │ │ │ +********** aadddd__uurrll__sseeeedd(()) aadddd__hhttttpp__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]
    │ │ │ │ @@ -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__ssiizzee(()) ppiieeccee__lleennggtthh(()) **********
    │ │ │ │ +********** ppiieeccee__lleennggtthh(()) ppiieeccee__ssiizzee(()) **********
    │ │ │ │  int ppiieeccee__lleennggtthh () const;
    │ │ │ │  int ppiieeccee__ssiizzee (piece_index_t i) const;
    │ │ │ │  piece_length() returns the piece size of all pieces but the last one.
    │ │ │ │  piece_size() returns the size of the specified piece. these functions are just
    │ │ │ │  forwarding to the associated _f_i_l_e___s_t_o_r_a_g_e.
    │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
    │ │ │ │ -********** aadddd__ssiimmiillaarr__ttoorrrreenntt(()) aadddd__ccoolllleeccttiioonn(()) **********
    │ │ │ │ +********** 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.
    │ │ │ │ @@ -348,30 +348,30 @@
    │ │ │ │  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
    │ │ │ │ +   , std::function const& f);
    │ │ │ │  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
    │ │ │ │     , 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);
    │ │ │ │ +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,
    │ │ │ │ -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);
    │ │ │ │  This function will assume that the files added to the torrent file exists at
    │ │ │ │  path p, read those files and hash the content and set the hashes in the
    │ │ │ │  create_torrent object. The optional function f is called in between every hash
    │ │ │ │  that is set. f must have the following signature:
    │ │ │ │  void Fun(piece_index_t);
    │ │ │ │  The overloads taking a _s_e_t_t_i_n_g_s___p_a_c_k may be used to configure the underlying
    │ │ │ │  disk access. Such as settings_pack::aio_threads.
    │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Custom_Storage.html
    │ │ │ @@ -28,69 +28,345 @@
    │ │ │  2.0.13
    │ │ │  
    │ │ │  
    │ │ │  

    home

    │ │ │
    │ │ │

    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 │ │ │ -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 disk I/O can be customized in libtorrent. In previous versions, the │ │ │ +customization was at the level of each torrent. Now, the customization point │ │ │ +is at the session level. All torrents added to a session will use the same │ │ │ +disk I/O subsystem, as determined by the disk_io_constructor (in │ │ │ +session_params).

    │ │ │ +

    This allows the disk subsystem to also customize threading and disk job │ │ │ +management.

    │ │ │ +

    To customize the disk subsystem, implement disk_interface and provide a │ │ │ +factory function to the session constructor (via session_params).

    │ │ │ +

    Example use:

    │ │ │ +
    │ │ │ +struct temp_storage
    │ │ │ +{
    │ │ │ +  explicit temp_storage(lt::file_storage const& fs) : m_files(fs) {}
    │ │ │ +
    │ │ │ +  lt::span<char const> readv(lt::peer_request const r, lt::storage_error& ec) const
    │ │ │ +  {
    │ │ │ +    auto const i = m_file_data.find(r.piece);
    │ │ │ +    if (i == m_file_data.end())
    │ │ │ +    {
    │ │ │ +      ec.operation = lt::operation_t::file_read;
    │ │ │ +      ec.ec = boost::asio::error::eof;
    │ │ │ +      return {};
    │ │ │ +    }
    │ │ │ +    if (int(i->second.size()) <= r.start)
    │ │ │ +    {
    │ │ │ +      ec.operation = lt::operation_t::file_read;
    │ │ │ +      ec.ec = boost::asio::error::eof;
    │ │ │ +      return {};
    │ │ │ +    }
    │ │ │ +    return { i->second.data() + r.start, std::min(r.length, int(i->second.size()) - r.start) };
    │ │ │ +  }
    │ │ │ +  void writev(lt::span<char const> const b, lt::piece_index_t const piece, int const offset)
    │ │ │ +  {
    │ │ │ +    auto& data = m_file_data[piece];
    │ │ │ +    if (data.empty())
    │ │ │ +    {
    │ │ │ +      // allocate the whole piece, otherwise we'll invalidate the pointers
    │ │ │ +      // we have returned back to libtorrent
    │ │ │ +      int const size = piece_size(piece);
    │ │ │ +      data.resize(std::size_t(size));
    │ │ │ +    }
    │ │ │ +    TORRENT_ASSERT(offset + b.size() <= int(data.size()));
    │ │ │ +    std::memcpy(data.data() + offset, b.data(), std::size_t(b.size()));
    │ │ │ +  }
    │ │ │ +  lt::sha1_hash hash(lt::piece_index_t const piece
    │ │ │ +    , lt::span<lt::sha256_hash> const block_hashes, lt::storage_error& ec) const
    │ │ │ +  {
    │ │ │ +    auto const i = m_file_data.find(piece);
    │ │ │ +    if (i == m_file_data.end())
    │ │ │ +    {
    │ │ │ +      ec.operation = lt::operation_t::file_read;
    │ │ │ +      ec.ec = boost::asio::error::eof;
    │ │ │ +      return {};
    │ │ │ +    }
    │ │ │ +    if (!block_hashes.empty())
    │ │ │ +    {
    │ │ │ +      int const piece_size2 = m_files.piece_size2(piece);
    │ │ │ +      int const blocks_in_piece2 = m_files.blocks_in_piece2(piece);
    │ │ │ +      char const* buf = i->second.data();
    │ │ │ +      std::int64_t offset = 0;
    │ │ │ +      for (int k = 0; k < blocks_in_piece2; ++k)
    │ │ │ +      {
    │ │ │ +        lt::hasher256 h2;
    │ │ │ +        std::ptrdiff_t const len2 = std::min(lt::default_block_size, int(piece_size2 - offset));
    │ │ │ +        h2.update({ buf, len2 });
    │ │ │ +        buf += len2;
    │ │ │ +        offset += len2;
    │ │ │ +        block_hashes[k] = h2.final();
    │ │ │ +      }
    │ │ │ +    }
    │ │ │ +    return lt::hasher(i->second).final();
    │ │ │ +  }
    │ │ │ +  lt::sha256_hash hash2(lt::piece_index_t const piece, int const offset, lt::storage_error& ec)
    │ │ │ +  {
    │ │ │ +    auto const i = m_file_data.find(piece);
    │ │ │ +    if (i == m_file_data.end())
    │ │ │ +    {
    │ │ │ +      ec.operation = lt::operation_t::file_read;
    │ │ │ +      ec.ec = boost::asio::error::eof;
    │ │ │ +      return {};
    │ │ │ +    }
    │ │ │ +
    │ │ │ +    int const piece_size = m_files.piece_size2(piece);
    │ │ │ +
    │ │ │ +    std::ptrdiff_t const len = std::min(lt::default_block_size, piece_size - offset);
    │ │ │ +
    │ │ │ +    lt::span<char const> b = {i->second.data() + offset, len};
    │ │ │ +    return lt::hasher256(b).final();
    │ │ │ +  }
    │ │ │ +
    │ │ │ +private:
    │ │ │ +  int piece_size(lt::piece_index_t piece) const
    │ │ │ +  {
    │ │ │ +    int const num_pieces = static_cast<int>((m_files.total_size() + m_files.piece_length() - 1) / m_files.piece_length());
    │ │ │ +    return static_cast<int>(piece) < num_pieces - 1
    │ │ │ +      ? m_files.piece_length() : static_cast<int>(m_files.total_size() - std::int64_t(num_pieces - 1) * m_files.piece_length());
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  lt::file_storage const& m_files;
    │ │ │ +  std::map<lt::piece_index_t, std::vector<char>> m_file_data;
    │ │ │ +};
    │ │ │ +
    │ │ │ +lt::storage_index_t pop(std::vector<lt::storage_index_t>& q)
    │ │ │ +{
    │ │ │ +  TORRENT_ASSERT(!q.empty());
    │ │ │ +  lt::storage_index_t const ret = q.back();
    │ │ │ +  q.pop_back();
    │ │ │ +  return ret;
    │ │ │ +}
    │ │ │ +
    │ │ │ +struct temp_disk_io final : lt::disk_interface
    │ │ │ +  , lt::buffer_allocator_interface
    │ │ │ +{
    │ │ │ +  explicit temp_disk_io(lt::io_context& ioc): m_ioc(ioc) {}
    │ │ │ +
    │ │ │ +  void settings_updated() override {}
    │ │ │ +
    │ │ │ +  lt::storage_holder new_torrent(lt::storage_params const& params
    │ │ │ +    , std::shared_ptr<void> const&) override
    │ │ │ +  {
    │ │ │ +    lt::storage_index_t const idx = m_free_slots.empty()
    │ │ │ +      ? m_torrents.end_index()
    │ │ │ +      : pop(m_free_slots);
    │ │ │ +    auto storage = std::make_unique<temp_storage>(params.files);
    │ │ │ +    if (idx == m_torrents.end_index()) m_torrents.emplace_back(std::move(storage));
    │ │ │ +    else m_torrents[idx] = std::move(storage);
    │ │ │ +    return lt::storage_holder(idx, *this);
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  void remove_torrent(lt::storage_index_t const idx) override
    │ │ │ +  {
    │ │ │ +    m_torrents[idx].reset();
    │ │ │ +    m_free_slots.push_back(idx);
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  void abort(bool) override {}
    │ │ │ +
    │ │ │ +  void async_read(lt::storage_index_t storage, lt::peer_request const& r
    │ │ │ +    , std::function<void(lt::disk_buffer_holder block, lt::storage_error const& se)> handler
    │ │ │ +    , lt::disk_job_flags_t) override
    │ │ │ +  {
    │ │ │ +    // this buffer is owned by the storage. It will remain valid for as
    │ │ │ +    // long as the torrent remains in the session. We don't need any lifetime
    │ │ │ +    // management of it.
    │ │ │ +    lt::storage_error error;
    │ │ │ +    lt::span<char const> b = m_torrents[storage]->readv(r, error);
    │ │ │ +
    │ │ │ +    post(m_ioc, [handler, error, b, this]
    │ │ │ +      { handler(lt::disk_buffer_holder(*this, const_cast<char*>(b.data()), int(b.size())), error); });
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  bool async_write(lt::storage_index_t storage, lt::peer_request const& r
    │ │ │ +    , char const* buf, std::shared_ptr<lt::disk_observer>
    │ │ │ +    , std::function<void(lt::storage_error const&)> handler
    │ │ │ +    , lt::disk_job_flags_t) override
    │ │ │ +  {
    │ │ │ +    lt::span<char const> const b = { buf, r.length };
    │ │ │ +
    │ │ │ +    m_torrents[storage]->writev(b, r.piece, r.start);
    │ │ │ +
    │ │ │ +    post(m_ioc, [=]{ handler(lt::storage_error()); });
    │ │ │ +    return false;
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  void async_hash(lt::storage_index_t storage, lt::piece_index_t const piece
    │ │ │ +    , lt::span<lt::sha256_hash> block_hashes, lt::disk_job_flags_t
    │ │ │ +    , std::function<void(lt::piece_index_t, lt::sha1_hash const&, lt::storage_error const&)> handler) override
    │ │ │ +  {
    │ │ │ +    lt::storage_error error;
    │ │ │ +    lt::sha1_hash const hash = m_torrents[storage]->hash(piece, block_hashes, error);
    │ │ │ +    post(m_ioc, [=]{ handler(piece, hash, error); });
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  void async_hash2(lt::storage_index_t storage, lt::piece_index_t const piece
    │ │ │ +    , int const offset, lt::disk_job_flags_t
    │ │ │ +    , std::function<void(lt::piece_index_t, lt::sha256_hash const&, lt::storage_error const&)> handler) override
    │ │ │ +  {
    │ │ │ +    lt::storage_error error;
    │ │ │ +    lt::sha256_hash const hash = m_torrents[storage]->hash2(piece, offset, error);
    │ │ │ +    post(m_ioc, [=]{ handler(piece, hash, error); });
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  void async_move_storage(lt::storage_index_t, std::string p, lt::move_flags_t
    │ │ │ +    , std::function<void(lt::status_t, std::string const&, lt::storage_error const&)> handler) override
    │ │ │ +  {
    │ │ │ +    post(m_ioc, [=]{
    │ │ │ +      handler(lt::status_t::fatal_disk_error, p
    │ │ │ +        , lt::storage_error(lt::error_code(boost::system::errc::operation_not_supported, lt::system_category())));
    │ │ │ +    });
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  void async_release_files(lt::storage_index_t, std::function<void()>) override {}
    │ │ │ +
    │ │ │ +  void async_delete_files(lt::storage_index_t, lt::remove_flags_t
    │ │ │ +    , std::function<void(lt::storage_error const&)> handler) override
    │ │ │ +  {
    │ │ │ +    post(m_ioc, [=]{ handler(lt::storage_error()); });
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  void async_check_files(lt::storage_index_t
    │ │ │ +    , lt::add_torrent_params const*
    │ │ │ +    , lt::aux::vector<std::string, lt::file_index_t>
    │ │ │ +    , std::function<void(lt::status_t, lt::storage_error const&)> handler) override
    │ │ │ +  {
    │ │ │ +    post(m_ioc, [=]{ handler(lt::status_t::no_error, lt::storage_error()); });
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  void async_rename_file(lt::storage_index_t
    │ │ │ +    , lt::file_index_t const idx
    │ │ │ +    , std::string const name
    │ │ │ +    , std::function<void(std::string const&, lt::file_index_t, lt::storage_error const&)> handler) override
    │ │ │ +  {
    │ │ │ +    post(m_ioc, [=]{ handler(name, idx, lt::storage_error()); });
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  void async_stop_torrent(lt::storage_index_t, std::function<void()> handler) override
    │ │ │ +  {
    │ │ │ +    post(m_ioc, handler);
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  void async_set_file_priority(lt::storage_index_t
    │ │ │ +    , lt::aux::vector<lt::download_priority_t, lt::file_index_t> prio
    │ │ │ +    , std::function<void(lt::storage_error const&
    │ │ │ +      , lt::aux::vector<lt::download_priority_t, lt::file_index_t>)> handler) override
    │ │ │ +  {
    │ │ │ +    post(m_ioc, [=]{
    │ │ │ +      handler(lt::storage_error(lt::error_code(
    │ │ │ +        boost::system::errc::operation_not_supported, lt::system_category())), std::move(prio));
    │ │ │ +    });
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  void async_clear_piece(lt::storage_index_t, lt::piece_index_t index
    │ │ │ +    , std::function<void(lt::piece_index_t)> handler) override
    │ │ │ +  {
    │ │ │ +    post(m_ioc, [=]{ handler(index); });
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  // implements buffer_allocator_interface
    │ │ │ +  void free_disk_buffer(char*) override
    │ │ │ +  {
    │ │ │ +    // never free any buffer. We only return buffers owned by the storage
    │ │ │ +    // object
    │ │ │ +  }
    │ │ │ +
    │ │ │ +  void update_stats_counters(lt::counters&) const override {}
    │ │ │ +
    │ │ │ +  std::vector<lt::open_file_state> get_status(lt::storage_index_t) const override
    │ │ │ +  { return {}; }
    │ │ │ +
    │ │ │ +  void submit_jobs() override {}
    │ │ │ +
    │ │ │ +private:
    │ │ │ +
    │ │ │ +  lt::aux::vector<std::shared_ptr<temp_storage>, lt::storage_index_t> m_torrents;
    │ │ │ +
    │ │ │ +  // slots that are unused in the m_torrents vector
    │ │ │ +  std::vector<lt::storage_index_t> m_free_slots;
    │ │ │ +
    │ │ │ +  // callbacks are posted on this
    │ │ │ +  lt::io_context& m_ioc;
    │ │ │ +};
    │ │ │ +
    │ │ │ +std::unique_ptr<lt::disk_interface> temp_disk_constructor(
    │ │ │ +  lt::io_context& ioc, lt::settings_interface const&, lt::counters&)
    │ │ │ +{
    │ │ │ +  return std::make_unique<temp_disk_io>(ioc);
    │ │ │ +}
    │ │ │ +
    │ │ │ +[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_str (int name, std::string val) = 0;
    │ │ │ +   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 std::string const& get_str (int name) const = 0;
    │ │ │ +   virtual int get_int (int name) const = 0;
    │ │ │ +   virtual bool get_bool (int name) const = 0;
    │ │ │ +};
    │ │ │ +
    │ │ │ +[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.

    │ │ │
    │ │ │  struct open_file_state
    │ │ │  {
    │ │ │ @@ -133,21 +409,21 @@
    │ │ │  the constructor. The callbacks will be run in the network thread.

    │ │ │
    │ │ │  struct disk_interface
    │ │ │  {
    │ │ │     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_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;
    │ │ │ @@ -199,26 +475,26 @@
    │ │ │  

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

    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 │ │ │ @@ -469,17 +745,17 @@ │ │ │ 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_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;
    │ │ │ @@ -524,16 +800,16 @@
    │ │ │  

    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&&) & 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;
    │ │ │ @@ -600,34 +876,16 @@
    │ │ │  
    │ │ │

    bool()

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

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

    │ │ │ -[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_str (int name, std::string val) = 0;
    │ │ │ -   virtual void set_int (int name, int val) = 0;
    │ │ │ -   virtual int get_int (int name) const = 0;
    │ │ │ -   virtual bool get_bool (int name) const = 0;
    │ │ │ -   virtual std::string const& get_str (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 {} │ │ │ │ @@ -1,17 +1,18 @@ │ │ │ │ > │ │ │ │ _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_] │ │ │ │ VVeerrssiioonn:: 2.0.13 │ │ │ │ _h_o_m_e │ │ │ │ Table of contents │ │ │ │ + * _s_e_t_t_i_n_g_s___i_n_t_e_r_f_a_c_e │ │ │ │ * _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_(_) │ │ │ │ @@ -32,28 +33,322 @@ │ │ │ │ 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_(_) │ │ │ │ - * _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 │ │ │ │ -constructed. │ │ │ │ -You have control over proxy and authorization settings and also the user-agent │ │ │ │ -that will be sent to the tracker. The user-agent will also be used to identify │ │ │ │ -the client with other peers. │ │ │ │ -Each configuration option is named with an enum value inside the _s_e_t_t_i_n_g_s___p_a_c_k │ │ │ │ -class. These are the available settings: │ │ │ │ +The disk I/O can be customized in libtorrent. In previous versions, the │ │ │ │ +customization was at the level of each torrent. Now, the customization point is │ │ │ │ +at the _s_e_s_s_i_o_n level. All torrents added to a _s_e_s_s_i_o_n will use the same disk I/ │ │ │ │ +O subsystem, as determined by the disk_io_constructor (in _s_e_s_s_i_o_n___p_a_r_a_m_s). │ │ │ │ +This allows the disk subsystem to also customize threading and disk job │ │ │ │ +management. │ │ │ │ +To customize the disk subsystem, implement _d_i_s_k___i_n_t_e_r_f_a_c_e and provide a factory │ │ │ │ +function to the _s_e_s_s_i_o_n constructor (via _s_e_s_s_i_o_n___p_a_r_a_m_s). │ │ │ │ +Example use: │ │ │ │ +struct temp_storage │ │ │ │ +{ │ │ │ │ + explicit temp_storage(lt::file_storage const& fs) : m_files(fs) {} │ │ │ │ + │ │ │ │ + lt::span readv(lt::peer_request const r, lt::storage_error& ec) │ │ │ │ +const │ │ │ │ + { │ │ │ │ + auto const i = m_file_data.find(r.piece); │ │ │ │ + if (i == m_file_data.end()) │ │ │ │ + { │ │ │ │ + ec.operation = lt::operation_t::file_read; │ │ │ │ + ec.ec = boost::asio::error::eof; │ │ │ │ + return {}; │ │ │ │ + } │ │ │ │ + if (int(i->second.size()) <= r.start) │ │ │ │ + { │ │ │ │ + ec.operation = lt::operation_t::file_read; │ │ │ │ + ec.ec = boost::asio::error::eof; │ │ │ │ + return {}; │ │ │ │ + } │ │ │ │ + return { i->second.data() + r.start, std::min(r.length, int(i->second.size │ │ │ │ +()) - r.start) }; │ │ │ │ + } │ │ │ │ + void writev(lt::span const b, lt::piece_index_t const piece, int │ │ │ │ +const offset) │ │ │ │ + { │ │ │ │ + auto& data = m_file_data[piece]; │ │ │ │ + if (data.empty()) │ │ │ │ + { │ │ │ │ + // allocate the whole piece, otherwise we'll invalidate the pointers │ │ │ │ + // we have returned back to libtorrent │ │ │ │ + int const size = piece_size(piece); │ │ │ │ + data.resize(std::size_t(size)); │ │ │ │ + } │ │ │ │ + TORRENT_ASSERT(offset + b.size() <= int(data.size())); │ │ │ │ + std::memcpy(data.data() + offset, b.data(), std::size_t(b.size())); │ │ │ │ + } │ │ │ │ + lt::sha1_hash hash(lt::piece_index_t const piece │ │ │ │ + , lt::span const block_hashes, lt::storage_error& ec) │ │ │ │ +const │ │ │ │ + { │ │ │ │ + auto const i = m_file_data.find(piece); │ │ │ │ + if (i == m_file_data.end()) │ │ │ │ + { │ │ │ │ + ec.operation = lt::operation_t::file_read; │ │ │ │ + ec.ec = boost::asio::error::eof; │ │ │ │ + return {}; │ │ │ │ + } │ │ │ │ + if (!block_hashes.empty()) │ │ │ │ + { │ │ │ │ + int const piece_size2 = m_files.piece_size2(piece); │ │ │ │ + int const blocks_in_piece2 = m_files.blocks_in_piece2(piece); │ │ │ │ + char const* buf = i->second.data(); │ │ │ │ + std::int64_t offset = 0; │ │ │ │ + for (int k = 0; k < blocks_in_piece2; ++k) │ │ │ │ + { │ │ │ │ + lt::hasher256 h2; │ │ │ │ + std::ptrdiff_t const len2 = std::min(lt::default_block_size, int │ │ │ │ +(piece_size2 - offset)); │ │ │ │ + h2.update({ buf, len2 }); │ │ │ │ + buf += len2; │ │ │ │ + offset += len2; │ │ │ │ + block_hashes[k] = h2.final(); │ │ │ │ + } │ │ │ │ + } │ │ │ │ + return lt::hasher(i->second).final(); │ │ │ │ + } │ │ │ │ + lt::sha256_hash hash2(lt::piece_index_t const piece, int const offset, lt:: │ │ │ │ +storage_error& ec) │ │ │ │ + { │ │ │ │ + auto const i = m_file_data.find(piece); │ │ │ │ + if (i == m_file_data.end()) │ │ │ │ + { │ │ │ │ + ec.operation = lt::operation_t::file_read; │ │ │ │ + ec.ec = boost::asio::error::eof; │ │ │ │ + return {}; │ │ │ │ + } │ │ │ │ + │ │ │ │ + int const piece_size = m_files.piece_size2(piece); │ │ │ │ + │ │ │ │ + std::ptrdiff_t const len = std::min(lt::default_block_size, piece_size - │ │ │ │ +offset); │ │ │ │ + │ │ │ │ + lt::span b = {i->second.data() + offset, len}; │ │ │ │ + return lt::hasher256(b).final(); │ │ │ │ + } │ │ │ │ + │ │ │ │ +private: │ │ │ │ + int piece_size(lt::piece_index_t piece) const │ │ │ │ + { │ │ │ │ + int const num_pieces = static_cast((m_files.total_size() + │ │ │ │ +m_files.piece_length() - 1) / m_files.piece_length()); │ │ │ │ + return static_cast(piece) < num_pieces - 1 │ │ │ │ + ? m_files.piece_length() : static_cast(m_files.total_size() - std:: │ │ │ │ +int64_t(num_pieces - 1) * m_files.piece_length()); │ │ │ │ + } │ │ │ │ + │ │ │ │ + lt::file_storage const& m_files; │ │ │ │ + std::map> m_file_data; │ │ │ │ +}; │ │ │ │ + │ │ │ │ +lt::storage_index_t pop(std::vector& q) │ │ │ │ +{ │ │ │ │ + TORRENT_ASSERT(!q.empty()); │ │ │ │ + lt::storage_index_t const ret = q.back(); │ │ │ │ + q.pop_back(); │ │ │ │ + return ret; │ │ │ │ +} │ │ │ │ + │ │ │ │ +struct temp_disk_io final : lt::disk_interface │ │ │ │ + , lt::buffer_allocator_interface │ │ │ │ +{ │ │ │ │ + explicit temp_disk_io(lt::io_context& ioc): m_ioc(ioc) {} │ │ │ │ + │ │ │ │ + void settings_updated() override {} │ │ │ │ + │ │ │ │ + lt::storage_holder new_torrent(lt::storage_params const& params │ │ │ │ + , std::shared_ptr const&) override │ │ │ │ + { │ │ │ │ + lt::storage_index_t const idx = m_free_slots.empty() │ │ │ │ + ? m_torrents.end_index() │ │ │ │ + : pop(m_free_slots); │ │ │ │ + auto storage = std::make_unique(params.files); │ │ │ │ + if (idx == m_torrents.end_index()) m_torrents.emplace_back(std::move │ │ │ │ +(storage)); │ │ │ │ + else m_torrents[idx] = std::move(storage); │ │ │ │ + return lt::storage_holder(idx, *this); │ │ │ │ + } │ │ │ │ + │ │ │ │ + void remove_torrent(lt::storage_index_t const idx) override │ │ │ │ + { │ │ │ │ + m_torrents[idx].reset(); │ │ │ │ + m_free_slots.push_back(idx); │ │ │ │ + } │ │ │ │ + │ │ │ │ + void abort(bool) override {} │ │ │ │ + │ │ │ │ + void async_read(lt::storage_index_t storage, lt::peer_request const& r │ │ │ │ + , std::function handler │ │ │ │ + , lt::disk_job_flags_t) override │ │ │ │ + { │ │ │ │ + // this buffer is owned by the storage. It will remain valid for as │ │ │ │ + // long as the torrent remains in the session. We don't need any lifetime │ │ │ │ + // management of it. │ │ │ │ + lt::storage_error error; │ │ │ │ + lt::span b = m_torrents[storage]->readv(r, error); │ │ │ │ + │ │ │ │ + post(m_ioc, [handler, error, b, this] │ │ │ │ + { handler(lt::disk_buffer_holder(*this, const_cast(b.data()), int │ │ │ │ +(b.size())), error); }); │ │ │ │ + } │ │ │ │ + │ │ │ │ + bool async_write(lt::storage_index_t storage, lt::peer_request const& r │ │ │ │ + , char const* buf, std::shared_ptr │ │ │ │ + , std::function handler │ │ │ │ + , lt::disk_job_flags_t) override │ │ │ │ + { │ │ │ │ + lt::span const b = { buf, r.length }; │ │ │ │ + │ │ │ │ + m_torrents[storage]->writev(b, r.piece, r.start); │ │ │ │ + │ │ │ │ + post(m_ioc, [=]{ handler(lt::storage_error()); }); │ │ │ │ + return false; │ │ │ │ + } │ │ │ │ + │ │ │ │ + void async_hash(lt::storage_index_t storage, lt::piece_index_t const piece │ │ │ │ + , lt::span block_hashes, lt::disk_job_flags_t │ │ │ │ + , std::function handler) override │ │ │ │ + { │ │ │ │ + lt::storage_error error; │ │ │ │ + lt::sha1_hash const hash = m_torrents[storage]->hash(piece, block_hashes, │ │ │ │ +error); │ │ │ │ + post(m_ioc, [=]{ handler(piece, hash, error); }); │ │ │ │ + } │ │ │ │ + │ │ │ │ + void async_hash2(lt::storage_index_t storage, lt::piece_index_t const piece │ │ │ │ + , int const offset, lt::disk_job_flags_t │ │ │ │ + , std::function handler) override │ │ │ │ + { │ │ │ │ + lt::storage_error error; │ │ │ │ + lt::sha256_hash const hash = m_torrents[storage]->hash2(piece, offset, │ │ │ │ +error); │ │ │ │ + post(m_ioc, [=]{ handler(piece, hash, error); }); │ │ │ │ + } │ │ │ │ + │ │ │ │ + void async_move_storage(lt::storage_index_t, std::string p, lt::move_flags_t │ │ │ │ + , std::function handler) override │ │ │ │ + { │ │ │ │ + post(m_ioc, [=]{ │ │ │ │ + handler(lt::status_t::fatal_disk_error, p │ │ │ │ + , lt::storage_error(lt::error_code(boost::system::errc:: │ │ │ │ +operation_not_supported, lt::system_category()))); │ │ │ │ + }); │ │ │ │ + } │ │ │ │ + │ │ │ │ + void async_release_files(lt::storage_index_t, std::function) override │ │ │ │ +{} │ │ │ │ + │ │ │ │ + void async_delete_files(lt::storage_index_t, lt::remove_flags_t │ │ │ │ + , std::function handler) override │ │ │ │ + { │ │ │ │ + post(m_ioc, [=]{ handler(lt::storage_error()); }); │ │ │ │ + } │ │ │ │ + │ │ │ │ + void async_check_files(lt::storage_index_t │ │ │ │ + , lt::add_torrent_params const* │ │ │ │ + , lt::aux::vector │ │ │ │ + , std::function handler) │ │ │ │ +override │ │ │ │ + { │ │ │ │ + post(m_ioc, [=]{ handler(lt::status_t::no_error, lt::storage_error()); }); │ │ │ │ + } │ │ │ │ + │ │ │ │ + void async_rename_file(lt::storage_index_t │ │ │ │ + , lt::file_index_t const idx │ │ │ │ + , std::string const name │ │ │ │ + , std::function handler) override │ │ │ │ + { │ │ │ │ + post(m_ioc, [=]{ handler(name, idx, lt::storage_error()); }); │ │ │ │ + } │ │ │ │ + │ │ │ │ + void async_stop_torrent(lt::storage_index_t, std::function handler) │ │ │ │ +override │ │ │ │ + { │ │ │ │ + post(m_ioc, handler); │ │ │ │ + } │ │ │ │ + │ │ │ │ + void async_set_file_priority(lt::storage_index_t │ │ │ │ + , lt::aux::vector prio │ │ │ │ + , std::function)> handler) │ │ │ │ +override │ │ │ │ + { │ │ │ │ + post(m_ioc, [=]{ │ │ │ │ + handler(lt::storage_error(lt::error_code( │ │ │ │ + boost::system::errc::operation_not_supported, lt::system_category())), │ │ │ │ +std::move(prio)); │ │ │ │ + }); │ │ │ │ + } │ │ │ │ + │ │ │ │ + void async_clear_piece(lt::storage_index_t, lt::piece_index_t index │ │ │ │ + , std::function handler) override │ │ │ │ + { │ │ │ │ + post(m_ioc, [=]{ handler(index); }); │ │ │ │ + } │ │ │ │ + │ │ │ │ + // implements buffer_allocator_interface │ │ │ │ + void free_disk_buffer(char*) override │ │ │ │ + { │ │ │ │ + // never free any buffer. We only return buffers owned by the storage │ │ │ │ + // object │ │ │ │ + } │ │ │ │ + │ │ │ │ + void update_stats_counters(lt::counters&) const override {} │ │ │ │ + │ │ │ │ + std::vector get_status(lt::storage_index_t) const │ │ │ │ +override │ │ │ │ + { return {}; } │ │ │ │ + │ │ │ │ + void submit_jobs() override {} │ │ │ │ + │ │ │ │ +private: │ │ │ │ + │ │ │ │ + lt::aux::vector, lt::storage_index_t> │ │ │ │ +m_torrents; │ │ │ │ + │ │ │ │ + // slots that are unused in the m_torrents vector │ │ │ │ + std::vector m_free_slots; │ │ │ │ + │ │ │ │ + // callbacks are posted on this │ │ │ │ + lt::io_context& m_ioc; │ │ │ │ +}; │ │ │ │ + │ │ │ │ +std::unique_ptr temp_disk_constructor( │ │ │ │ + lt::io_context& ioc, lt::settings_interface const&, lt::counters&) │ │ │ │ +{ │ │ │ │ + return std::make_unique(ioc); │ │ │ │ +} │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ +************ sseettttiinnggss__iinntteerrffaaccee ************ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_t_t_i_n_g_s___p_a_c_k_._h_p_p" │ │ │ │ +the common interface to _s_e_t_t_i_n_g_s___p_a_c_k and the internal representation of │ │ │ │ +settings. │ │ │ │ +struct settings_interface │ │ │ │ +{ │ │ │ │ + virtual void sseett__ssttrr (int name, std::string val) = 0; │ │ │ │ + virtual void sseett__iinntt (int name, int val) = 0; │ │ │ │ + virtual bool hhaass__vvaall (int name) const = 0; │ │ │ │ + virtual void sseett__bbooooll (int name, bool val) = 0; │ │ │ │ + virtual std::string const& ggeett__ssttrr (int name) const = 0; │ │ │ │ + virtual int ggeett__iinntt (int name) const = 0; │ │ │ │ + virtual bool ggeett__bbooooll (int name) const = 0; │ │ │ │ +}; │ │ │ │ [_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 │ │ │ │ { │ │ │ │ @@ -90,21 +385,21 @@ │ │ │ │ thread via the io_context object passed into the constructor. The callbacks │ │ │ │ will be run in the network thread. │ │ │ │ struct disk_interface │ │ │ │ { │ │ │ │ virtual storage_holder nneeww__ttoorrrreenntt (storage_params const& p │ │ │ │ , std::shared_ptr 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__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 │ │ │ │ @@ -159,22 +454,22 @@ │ │ │ │ [_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(()) ********** │ │ │ │ -virtual void aassyynncc__rreeaadd (storage_index_t storage, peer_request const& r │ │ │ │ - , std::function handler │ │ │ │ - , disk_job_flags_t flags = {}) = 0; │ │ │ │ +********** 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 │ │ │ │ @@ -361,17 +656,17 @@ │ │ │ │ a unique, owning, reference to the storage of a torrent in a disk io subsystem │ │ │ │ (class that implements _d_i_s_k___i_n_t_e_r_f_a_c_e). This is held by the internal libtorrent │ │ │ │ torrent object to tie the storage object allocated for a torrent to the │ │ │ │ lifetime of the internal torrent object. When a torrent is removed from the │ │ │ │ _s_e_s_s_i_o_n, this holder is destructed and will inform the disk object. │ │ │ │ struct storage_holder │ │ │ │ { │ │ │ │ - ssttoorraaggee__hhoollddeerr () = default; │ │ │ │ ssttoorraaggee__hhoollddeerr (storage_index_t idx, disk_interface& disk_io); │ │ │ │ ~~ssttoorraaggee__hhoollddeerr (); │ │ │ │ + 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; │ │ │ │ @@ -403,16 +698,16 @@ │ │ │ │ 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&&) & 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; │ │ │ │ @@ -454,29 +749,14 @@ │ │ │ │ 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] │ │ │ │ -************ 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__ssttrr (int name, std::string val) = 0; │ │ │ │ - virtual void sseett__iinntt (int name, int val) = 0; │ │ │ │ - virtual int ggeett__iinntt (int name) const = 0; │ │ │ │ - virtual bool ggeett__bbooooll (int name) const = 0; │ │ │ │ - virtual std::string const& ggeett__ssttrr (int name) const = 0; │ │ │ │ -}; │ │ │ │ -[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ************ 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 @@ │ │ │
  • get_mutable_item()
  • │ │ │
  • put_mutable_item()
  • │ │ │
  • get_infohashes_sample()
  • │ │ │
  • tick()
  • │ │ │
  • counters()
  • │ │ │ │ │ │ │ │ │ -
  • sign_mutable_item()
  • │ │ │ -
  • dht_default_storage_constructor()
  • │ │ │ +
  • dht_default_storage_constructor()
  • │ │ │ +
  • sign_mutable_item()
  • │ │ │
  • announce_flags_t
  • │ │ │ │ │ │
    │ │ │ [report issue]
    │ │ │

    dht_state

    │ │ │

    Declared in "libtorrent/kademlia/dht_state.hpp"

    │ │ │

    This structure helps to store and load the state │ │ │ @@ -308,16 +308,27 @@ │ │ │ [report issue]

    │ │ │
    │ │ │

    counters()

    │ │ │
    │ │ │  virtual dht_storage_counters counters () const = 0;
    │ │ │  
    │ │ │

    return stats counters for the store

    │ │ │ -[report issue]
    │ │ │ +[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
    │ │ │     , span<char const> salt
    │ │ │ @@ -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 _p_u_t___i_m_m_u_t_a_b_l_e___i_t_e_m_(_) │ │ │ │ o _g_e_t___m_u_t_a_b_l_e___i_t_e_m___s_e_q_(_) │ │ │ │ o _g_e_t___m_u_t_a_b_l_e___i_t_e_m_(_) │ │ │ │ o _p_u_t___m_u_t_a_b_l_e___i_t_e_m_(_) │ │ │ │ o _g_e_t___i_n_f_o_h_a_s_h_e_s___s_a_m_p_l_e_(_) │ │ │ │ o _t_i_c_k_(_) │ │ │ │ o _c_o_u_n_t_e_r_s_(_) │ │ │ │ - * _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__ssttaattee ************ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_k_a_d_e_m_l_i_a_/_d_h_t___s_t_a_t_e_._h_p_p" │ │ │ │ This structure helps to store and load the state of the dht_tracker. At this │ │ │ │ moment the library is only a dual stack implementation of the DHT. See _B_E_P_ _3_2 │ │ │ │ struct dht_state │ │ │ │ @@ -210,36 +210,36 @@ │ │ │ │ For implementers: Use this functions for expire peers or items or any other │ │ │ │ storage cleanup. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** ccoouunntteerrss(()) ********** │ │ │ │ virtual dht_storage_counters ccoouunntteerrss () const = 0; │ │ │ │ return stats _c_o_u_n_t_e_r_s for the store │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ +************ ddhhtt__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;
    │ │ │ -   void file (file_index_t f);
    │ │ │     file_index_t file () const;
    │ │ │ +   void file (file_index_t f);
    │ │ │  
    │ │ │     error_code ec;
    │ │ │     operation_t operation;
    │ │ │  };
    │ │ │  
    │ │ │ [report issue]
    │ │ │

    bool()

    │ │ │ @@ -79,96 +79,505 @@ │ │ │ │ │ │

    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;
    │ │ │ +void file (file_index_t f);
    │ │ │  
    │ │ │

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

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

    gzip_category()

    │ │ │ -

    Declared in "libtorrent/gzip.hpp"

    │ │ │ +
    │ │ │ +

    pcp_category()

    │ │ │ +

    Declared in "libtorrent/natpmp.hpp"

    │ │ │
    │ │ │ -boost::system::error_category& gzip_category ();
    │ │ │ +boost::system::error_category& pcp_category ();
    │ │ │  
    │ │ │ -

    get the error_category for zip 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]
    │ │ │ -
    │ │ │ -

    i2p_category()

    │ │ │ -

    Declared in "libtorrent/i2p_stream.hpp"

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

    returns the error category for I2P 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]
    │ │ │ -
    │ │ │ -

    pcp_category()

    │ │ │ -

    Declared in "libtorrent/natpmp.hpp"

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

    gzip_category()

    │ │ │ +

    Declared in "libtorrent/gzip.hpp"

    │ │ │
    │ │ │ -boost::system::error_category& pcp_category ();
    │ │ │ +boost::system::error_category& gzip_category ();
    │ │ │ +
    │ │ │ +

    get the error_category for zip errors

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

    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]
    │ │ │ +
    │ │ │ +

    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 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/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 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]
    │ │ │ +
    │ │ │ +

    enum error_code_enum

    │ │ │

    Declared in "libtorrent/error_code.hpp"

    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -991,423 +1400,14 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    service_unavailable503 
    │ │ │ -[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 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 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 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 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/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
    │ │ │
    │ │ │ │ │ │
    │ │ │ │ │ │
    │ │ │
    │ │ │ │ │ │ -
    │ │ │ -

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

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

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

    │ │ │
    │ │ │ -virtual void sent_interested ();
    │ │ │  virtual void sent_not_interested ();
    │ │ │ -virtual void sent_piece (peer_request const&);
    │ │ │ -virtual void sent_have (piece_index_t);
    │ │ │  virtual void sent_unchoke ();
    │ │ │ +virtual void sent_interested ();
    │ │ │ +virtual void sent_have (piece_index_t);
    │ │ │ +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 */);
    │ │ │ @@ -704,16 +774,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]
    │ │ │

    encrypt()

    │ │ │
    │ │ │ @@ -739,86 +809,16 @@
    │ │ │  (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;
    │ │ │ -   peer_id const& pid () const;
    │ │ │ -   bool has_piece (piece_index_t i) const;
    │ │ │ -   bool is_interesting () const;
    │ │ │ -   bool is_choked () const;
    │ │ │ -   bool has_peer_choked () const;
    │ │ │ -   bool is_peer_interested () const;
    │ │ │ -   void choke_this_peer ();
    │ │ │ -   void maybe_unchoke_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_connecting () const;
    │ │ │ -   bool is_outgoing () const;
    │ │ │ -   void disconnect (error_code const& ec, operation_t op
    │ │ │ -      , disconnect_severity_t = peer_connection_interface::normal);
    │ │ │ -   bool is_disconnecting () 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 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 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;
    │ │ │ -};
    │ │ │ -
    │ │ │ [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 │ │ │ ├── html2text {} │ │ │ │ @@ -2,14 +2,16 @@ │ │ │ │ _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_] │ │ │ │ VVeerrssiioonn:: 2.0.13 │ │ │ │ _h_o_m_e │ │ │ │ Table of contents │ │ │ │ * _a_ _w_o_r_d_ _o_f_ _c_a_u_t_i_o_n │ │ │ │ * _p_l_u_g_i_n_-_i_n_t_e_r_f_a_c_e │ │ │ │ * _c_u_s_t_o_m_ _a_l_e_r_t_s │ │ │ │ + * _p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e │ │ │ │ + * _b_t___p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e │ │ │ │ * _p_l_u_g_i_n │ │ │ │ o _i_m_p_l_e_m_e_n_t_e_d___f_e_a_t_u_r_e_s_(_) │ │ │ │ o _n_e_w___t_o_r_r_e_n_t_(_) │ │ │ │ o _a_d_d_e_d_(_) │ │ │ │ o _a_b_o_r_t_(_) │ │ │ │ o _o_n___d_h_t___r_e_q_u_e_s_t_(_) │ │ │ │ o _o_n___a_l_e_r_t_(_) │ │ │ │ @@ -17,43 +19,41 @@ │ │ │ │ o _o_n___t_i_c_k_(_) │ │ │ │ o _g_e_t___u_n_c_h_o_k_e___p_r_i_o_r_i_t_y_(_) │ │ │ │ o _l_o_a_d___s_t_a_t_e_(_) │ │ │ │ * _t_o_r_r_e_n_t___p_l_u_g_i_n │ │ │ │ o _n_e_w___c_o_n_n_e_c_t_i_o_n_(_) │ │ │ │ o _o_n___p_i_e_c_e___f_a_i_l_e_d_(_)_ _o_n___p_i_e_c_e___p_a_s_s_(_) │ │ │ │ o _t_i_c_k_(_) │ │ │ │ - o _o_n___p_a_u_s_e_(_)_ _o_n___r_e_s_u_m_e_(_) │ │ │ │ + o _o_n___r_e_s_u_m_e_(_)_ _o_n___p_a_u_s_e_(_) │ │ │ │ o _o_n___f_i_l_e_s___c_h_e_c_k_e_d_(_) │ │ │ │ o _o_n___s_t_a_t_e_(_) │ │ │ │ o _o_n___a_d_d___p_e_e_r_(_) │ │ │ │ * _p_e_e_r___p_l_u_g_i_n │ │ │ │ o _t_y_p_e_(_) │ │ │ │ o _a_d_d___h_a_n_d_s_h_a_k_e_(_) │ │ │ │ o _o_n___d_i_s_c_o_n_n_e_c_t_(_) │ │ │ │ o _o_n___c_o_n_n_e_c_t_e_d_(_) │ │ │ │ o _o_n___h_a_n_d_s_h_a_k_e_(_) │ │ │ │ o _o_n___e_x_t_e_n_s_i_o_n___h_a_n_d_s_h_a_k_e_(_) │ │ │ │ - o _o_n___b_i_t_f_i_e_l_d_(_)_ _o_n___h_a_v_e___a_l_l_(_)_ _o_n___h_a_v_e_(_)_ _o_n___h_a_v_e___n_o_n_e_(_)_ _o_n___u_n_c_h_o_k_e_(_) │ │ │ │ - _o_n___a_l_l_o_w_e_d___f_a_s_t_(_)_ _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___i_n_t_e_r_e_s_t_e_d │ │ │ │ - _(_)_ _o_n___c_h_o_k_e_(_)_ _o_n___r_e_q_u_e_s_t_(_) │ │ │ │ + o _o_n___h_a_v_e___a_l_l_(_)_ _o_n___c_h_o_k_e_(_)_ _o_n___d_o_n_t___h_a_v_e_(_)_ _o_n___h_a_v_e_(_)_ _o_n___u_n_c_h_o_k_e_(_) │ │ │ │ + _o_n___h_a_v_e___n_o_n_e_(_)_ _o_n___r_e_q_u_e_s_t_(_)_ _o_n___a_l_l_o_w_e_d___f_a_s_t_(_)_ _o_n___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___i_n_t_e_r_e_s_t_e_d_(_) │ │ │ │ o _o_n___p_i_e_c_e_(_) │ │ │ │ - o _s_e_n_t___p_i_e_c_e_(_)_ _s_e_n_t___n_o_t___i_n_t_e_r_e_s_t_e_d_(_)_ _s_e_n_t___u_n_c_h_o_k_e_(_)_ _s_e_n_t___h_a_v_e_(_) │ │ │ │ + o _s_e_n_t___u_n_c_h_o_k_e_(_)_ _s_e_n_t___n_o_t___i_n_t_e_r_e_s_t_e_d_(_)_ _s_e_n_t___h_a_v_e_(_)_ _s_e_n_t___p_i_e_c_e_(_) │ │ │ │ _s_e_n_t___i_n_t_e_r_e_s_t_e_d_(_) │ │ │ │ o _s_e_n_t___p_a_y_l_o_a_d_(_) │ │ │ │ o _c_a_n___d_i_s_c_o_n_n_e_c_t_(_) │ │ │ │ o _o_n___e_x_t_e_n_d_e_d_(_) │ │ │ │ o _o_n___u_n_k_n_o_w_n___m_e_s_s_a_g_e_(_) │ │ │ │ o _o_n___p_i_e_c_e___f_a_i_l_e_d_(_)_ _o_n___p_i_e_c_e___p_a_s_s_(_) │ │ │ │ o _t_i_c_k_(_) │ │ │ │ o _w_r_i_t_e___r_e_q_u_e_s_t_(_) │ │ │ │ * _c_r_y_p_t_o___p_l_u_g_i_n │ │ │ │ o _e_n_c_r_y_p_t_(_) │ │ │ │ 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___s_m_a_r_t___b_a_n___p_l_u_g_i_n_(_) │ │ │ │ * _c_r_e_a_t_e___u_t___m_e_t_a_d_a_t_a___p_l_u_g_i_n_(_) │ │ │ │ libtorrent has a _p_l_u_g_i_n interface for implementing extensions to the protocol. │ │ │ │ These can be general extensions for transferring metadata or peer exchange │ │ │ │ extensions, or it could be used to provide a way to customize the protocol to │ │ │ │ fit a particular (closed) network. │ │ │ │ @@ -132,14 +132,79 @@ │ │ │ │ The static category is required for checking whether or not the category for a │ │ │ │ specific _a_l_e_r_t is enabled or not, without instantiating the _a_l_e_r_t. The category │ │ │ │ virtual function is the run-time equivalence. │ │ │ │ The what() virtual function may simply be a string literal of the class name of │ │ │ │ your _a_l_e_r_t. │ │ │ │ For more information, see the _a_l_e_r_t_ _s_e_c_t_i_o_n. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ +************ ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee ************ │ │ │ │ +Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e_._h_p_p" │ │ │ │ +the _p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e class provides a handle to the internal peer │ │ │ │ +connection object, to be used by plugins. This is a low level interface that │ │ │ │ +may not be stable across libtorrent versions │ │ │ │ +struct peer_connection_handle │ │ │ │ +{ │ │ │ │ + explicit ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee (std::weak_ptr impl); │ │ │ │ + connection_type ttyyppee () const; │ │ │ │ + peer_plugin const* ffiinndd__pplluuggiinn (string_view type) const; │ │ │ │ + void aadddd__eexxtteennssiioonn (std::shared_ptr); │ │ │ │ + bool iiss__sseeeedd () const; │ │ │ │ + bool uuppllooaadd__oonnllyy () const; │ │ │ │ + peer_id const& ppiidd () const; │ │ │ │ + bool hhaass__ppiieeccee (piece_index_t i) const; │ │ │ │ + bool iiss__iinntteerreessttiinngg () const; │ │ │ │ + bool iiss__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 const& rreemmoottee () const; │ │ │ │ + _t_c_p_:_:_e_n_d_p_o_i_n_t llooccaall__eennddppooiinntt () const; │ │ │ │ + bool iiss__oouuttggooiinngg () const; │ │ │ │ + void ddiissccoonnnneecctt (error_code const& ec, operation_t op │ │ │ │ + , disconnect_severity_t = peer_connection_interface::normal); │ │ │ │ + bool iiss__ddiissccoonnnneeccttiinngg () const; │ │ │ │ + bool iiss__ccoonnnneeccttiinngg () const; │ │ │ │ + bool iiggnnoorree__uunncchhookkee__sslloottss () const; │ │ │ │ + bool oonn__llooccaall__nneettwwoorrkk () const; │ │ │ │ + bool ffaaiilleedd () const; │ │ │ │ + bool sshhoouulldd__lloogg (peer_log_alert::direction_t direction) const; │ │ │ │ + void ppeeeerr__lloogg (peer_log_alert::direction_t direction │ │ │ │ + , char const* event, char const* fmt = "", ...) const TORRENT_FORMAT │ │ │ │ +(4,5); │ │ │ │ + bool ccaann__ddiissccoonnnneecctt (error_code const& ec) const; │ │ │ │ + bool hhaass__mmeettaaddaattaa () const; │ │ │ │ + bool iinn__hhaannddsshhaakkee () const; │ │ │ │ + void sseenndd__bbuuffffeerr (char const* begin, int size); │ │ │ │ + std::time_t llaasstt__sseeeenn__ccoommpplleettee () const; │ │ │ │ + time_point ttiimmee__ooff__llaasstt__uunncchhookkee () const; │ │ │ │ + bool ooppeerraattoorr!!== (peer_connection_handle const& o) const; │ │ │ │ + bool ooppeerraattoorr<< (peer_connection_handle const& o) const; │ │ │ │ + bool ooppeerraattoorr==== (peer_connection_handle const& o) const; │ │ │ │ + std::shared_ptr 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 ssuuppppoorrttss__eennccrryyppttiioonn () const; │ │ │ │ + void sswwiittcchh__sseenndd__ccrryyppttoo (std::shared_ptr crypto); │ │ │ │ + void sswwiittcchh__rreeccvv__ccrryyppttoo (std::shared_ptr crypto); │ │ │ │ + std::shared_ptr nnaattiivvee__hhaannddllee () const; │ │ │ │ +}; │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ************ pplluuggiinn ************ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_e_x_t_e_n_s_i_o_n_s_._h_p_p" │ │ │ │ this is the base class for a _s_e_s_s_i_o_n _p_l_u_g_i_n. One primary feature is that it is │ │ │ │ notified of all torrents that are added to the _s_e_s_s_i_o_n, and can add its own │ │ │ │ torrent_plugins. │ │ │ │ struct plugin │ │ │ │ { │ │ │ │ @@ -260,16 +325,16 @@ │ │ │ │ struct torrent_plugin │ │ │ │ { │ │ │ │ virtual std::shared_ptr nneeww__ccoonnnneeccttiioonn (peer_connection_handle │ │ │ │ const&); │ │ │ │ virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t); │ │ │ │ virtual void oonn__ppiieeccee__ppaassss (piece_index_t); │ │ │ │ virtual void ttiicckk (); │ │ │ │ - virtual bool oonn__rreessuummee (); │ │ │ │ virtual bool oonn__ppaauussee (); │ │ │ │ + virtual bool oonn__rreessuummee (); │ │ │ │ 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; │ │ │ │ @@ -299,17 +364,17 @@ │ │ │ │ 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__ppaauussee(()) oonn__rreessuummee(()) ********** │ │ │ │ -virtual bool oonn__rreessuummee (); │ │ │ │ +********** oonn__rreessuummee(()) oonn__ppaauussee(()) ********** │ │ │ │ virtual bool oonn__ppaauussee (); │ │ │ │ +virtual bool oonn__rreessuummee (); │ │ │ │ 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 │ │ │ │ @@ -355,43 +420,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__hhaavvee (piece_index_t); │ │ │ │ - virtual bool oonn__nnoott__iinntteerreesstteedd (); │ │ │ │ - virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t); │ │ │ │ + virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//); │ │ │ │ + virtual bool oonn__rreeqquueesstt (peer_request const&); │ │ │ │ virtual bool oonn__iinntteerreesstteedd (); │ │ │ │ + virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t); │ │ │ │ + virtual bool oonn__hhaavvee__aallll (); │ │ │ │ + virtual bool oonn__hhaavvee (piece_index_t); │ │ │ │ virtual bool oonn__ddoonntt__hhaavvee (piece_index_t); │ │ │ │ virtual bool oonn__hhaavvee__nnoonnee (); │ │ │ │ - virtual bool oonn__hhaavvee__aallll (); │ │ │ │ - virtual bool oonn__rreeqquueesstt (peer_request const&); │ │ │ │ - virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//); │ │ │ │ virtual bool oonn__cchhookkee (); │ │ │ │ virtual bool oonn__uunncchhookkee (); │ │ │ │ + virtual bool oonn__nnoott__iinntteerreesstteedd (); │ │ │ │ virtual bool oonn__ppiieeccee (peer_request const& //**ppiieeccee**// │ │ │ │ , span //**bbuuff**//); │ │ │ │ - virtual bool oonn__ssuuggggeesstt (piece_index_t); │ │ │ │ virtual bool oonn__rreejjeecctt (peer_request const&); │ │ │ │ virtual bool oonn__ccaanncceell (peer_request const&); │ │ │ │ - virtual void sseenntt__rreeqquueesstt (peer_request const&); │ │ │ │ + virtual bool oonn__ssuuggggeesstt (piece_index_t); │ │ │ │ + virtual void sseenntt__aallllooww__ffaasstt (piece_index_t); │ │ │ │ virtual void sseenntt__ccaanncceell (peer_request const&); │ │ │ │ + virtual void sseenntt__rreeqquueesstt (peer_request const&); │ │ │ │ + virtual void sseenntt__hhaavvee__nnoonnee (); │ │ │ │ virtual void sseenntt__cchhookkee (); │ │ │ │ - virtual void sseenntt__rreejjeecctt__rreeqquueesstt (peer_request const&); │ │ │ │ - virtual void sseenntt__aallllooww__ffaasstt (piece_index_t); │ │ │ │ virtual void sseenntt__hhaavvee__aallll (); │ │ │ │ virtual void sseenntt__ssuuggggeesstt (piece_index_t); │ │ │ │ - virtual void sseenntt__hhaavvee__nnoonnee (); │ │ │ │ - virtual void sseenntt__iinntteerreesstteedd (); │ │ │ │ + virtual void sseenntt__rreejjeecctt__rreeqquueesstt (peer_request const&); │ │ │ │ virtual void sseenntt__nnoott__iinntteerreesstteedd (); │ │ │ │ - virtual void sseenntt__ppiieeccee (peer_request const&); │ │ │ │ - virtual void sseenntt__hhaavvee (piece_index_t); │ │ │ │ virtual void sseenntt__uunncchhookkee (); │ │ │ │ + virtual void sseenntt__iinntteerreesstteedd (); │ │ │ │ + virtual void sseenntt__hhaavvee (piece_index_t); │ │ │ │ + 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__ffaaiilleedd (piece_index_t); │ │ │ │ @@ -427,48 +492,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__bbiittffiieelldd(()) oonn__hhaavvee__aallll(()) oonn__hhaavvee(()) oonn__hhaavvee__nnoonnee(()) oonn__uunncchhookkee(()) │ │ │ │ -oonn__aalllloowweedd__ffaasstt(()) oonn__nnoott__iinntteerreesstteedd(()) oonn__ddoonntt__hhaavvee(()) oonn__iinntteerreesstteedd(()) oonn__cchhookkee(()) │ │ │ │ -oonn__rreeqquueesstt(()) ********** │ │ │ │ -virtual bool oonn__hhaavvee (piece_index_t); │ │ │ │ -virtual bool oonn__nnoott__iinntteerreesstteedd (); │ │ │ │ -virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t); │ │ │ │ +********** oonn__hhaavvee__aallll(()) oonn__cchhookkee(()) oonn__ddoonntt__hhaavvee(()) oonn__hhaavvee(()) oonn__uunncchhookkee(()) │ │ │ │ +oonn__hhaavvee__nnoonnee(()) oonn__rreeqquueesstt(()) oonn__aalllloowweedd__ffaasstt(()) oonn__bbiittffiieelldd(()) oonn__nnoott__iinntteerreesstteedd(()) │ │ │ │ +oonn__iinntteerreesstteedd(()) ********** │ │ │ │ +virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//); │ │ │ │ +virtual bool oonn__rreeqquueesstt (peer_request const&); │ │ │ │ virtual bool oonn__iinntteerreesstteedd (); │ │ │ │ +virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t); │ │ │ │ +virtual bool oonn__hhaavvee__aallll (); │ │ │ │ +virtual bool oonn__hhaavvee (piece_index_t); │ │ │ │ virtual bool oonn__ddoonntt__hhaavvee (piece_index_t); │ │ │ │ virtual bool oonn__hhaavvee__nnoonnee (); │ │ │ │ -virtual bool oonn__hhaavvee__aallll (); │ │ │ │ -virtual bool oonn__rreeqquueesstt (peer_request const&); │ │ │ │ -virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//); │ │ │ │ virtual bool oonn__cchhookkee (); │ │ │ │ virtual bool oonn__uunncchhookkee (); │ │ │ │ +virtual bool oonn__nnoott__iinntteerreesstteedd (); │ │ │ │ returning true from any of the message handlers indicates that the _p_l_u_g_i_n has │ │ │ │ handled the message. it will break the _p_l_u_g_i_n chain traversing and not let │ │ │ │ anyone else handle the message, including the default handler. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** 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__ppiieeccee(()) sseenntt__nnoott__iinntteerreesstteedd(()) sseenntt__uunncchhookkee(()) sseenntt__hhaavvee(()) │ │ │ │ +********** sseenntt__uunncchhookkee(()) sseenntt__nnoott__iinntteerreesstteedd(()) sseenntt__hhaavvee(()) sseenntt__ppiieeccee(()) │ │ │ │ sseenntt__iinntteerreesstteedd(()) ********** │ │ │ │ -virtual void sseenntt__iinntteerreesstteedd (); │ │ │ │ virtual void sseenntt__nnoott__iinntteerreesstteedd (); │ │ │ │ -virtual void sseenntt__ppiieeccee (peer_request const&); │ │ │ │ -virtual void sseenntt__hhaavvee (piece_index_t); │ │ │ │ virtual void sseenntt__uunncchhookkee (); │ │ │ │ +virtual void sseenntt__iinntteerreesstteedd (); │ │ │ │ +virtual void sseenntt__hhaavvee (piece_index_t); │ │ │ │ +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] │ │ │ │ @@ -511,16 +576,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] │ │ │ │ ********** eennccrryypptt(()) ********** │ │ │ │ eennccrryypptt (span> //**sseenndd__vveecc**//) = 0; │ │ │ │ @@ -541,79 +606,14 @@ │ │ │ │ consume is set to the number of bytes which should be trimmed from the head of │ │ │ │ the buffers, default is 0 │ │ │ │ produce is set to the number of bytes of payload which are now ready to be sent │ │ │ │ to the upper layer. default is the number of bytes passed in receive_vec │ │ │ │ packet_size is set to the minimum number of bytes which must be read to advance │ │ │ │ the next step of decryption. default is 0 │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -************ ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee ************ │ │ │ │ -Declared in "_l_i_b_t_o_r_r_e_n_t_/_p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e_._h_p_p" │ │ │ │ -the _p_e_e_r___c_o_n_n_e_c_t_i_o_n___h_a_n_d_l_e class provides a handle to the internal peer │ │ │ │ -connection object, to be used by plugins. This is a low level interface that │ │ │ │ -may not be stable across libtorrent versions │ │ │ │ -struct peer_connection_handle │ │ │ │ -{ │ │ │ │ - explicit ppeeeerr__ccoonnnneeccttiioonn__hhaannddllee (std::weak_ptr impl); │ │ │ │ - connection_type ttyyppee () const; │ │ │ │ - void aadddd__eexxtteennssiioonn (std::shared_ptr); │ │ │ │ - peer_plugin const* ffiinndd__pplluuggiinn (string_view type) const; │ │ │ │ - bool iiss__sseeeedd () const; │ │ │ │ - bool uuppllooaadd__oonnllyy () const; │ │ │ │ - peer_id const& ppiidd () const; │ │ │ │ - bool hhaass__ppiieeccee (piece_index_t i) const; │ │ │ │ - bool iiss__iinntteerreessttiinngg () const; │ │ │ │ - bool iiss__cchhookkeedd () const; │ │ │ │ - bool hhaass__ppeeeerr__cchhookkeedd () const; │ │ │ │ - bool iiss__ppeeeerr__iinntteerreesstteedd () const; │ │ │ │ - void cchhookkee__tthhiiss__ppeeeerr (); │ │ │ │ - void mmaayybbee__uunncchhookkee__tthhiiss__ppeeeerr (); │ │ │ │ - void ggeett__ppeeeerr__iinnffoo (peer_info& p) const; │ │ │ │ - torrent_handle aassssoocciiaatteedd__ttoorrrreenntt () const; │ │ │ │ - _t_c_p_:_:_e_n_d_p_o_i_n_t const& rreemmoottee () const; │ │ │ │ - _t_c_p_:_:_e_n_d_p_o_i_n_t llooccaall__eennddppooiinntt () const; │ │ │ │ - bool iiss__ccoonnnneeccttiinngg () const; │ │ │ │ - bool iiss__oouuttggooiinngg () const; │ │ │ │ - void ddiissccoonnnneecctt (error_code const& ec, operation_t op │ │ │ │ - , disconnect_severity_t = peer_connection_interface::normal); │ │ │ │ - bool iiss__ddiissccoonnnneeccttiinngg () 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 ccaann__ddiissccoonnnneecctt (error_code const& ec) const; │ │ │ │ - bool hhaass__mmeettaaddaattaa () const; │ │ │ │ - bool iinn__hhaannddsshhaakkee () const; │ │ │ │ - void sseenndd__bbuuffffeerr (char const* begin, int size); │ │ │ │ - std::time_t llaasstt__sseeeenn__ccoommpplleettee () const; │ │ │ │ - time_point ttiimmee__ooff__llaasstt__uunncchhookkee () const; │ │ │ │ - bool ooppeerraattoorr<< (peer_connection_handle const& o) const; │ │ │ │ - bool ooppeerraattoorr!!== (peer_connection_handle const& o) const; │ │ │ │ - bool ooppeerraattoorr==== (peer_connection_handle const& o) const; │ │ │ │ - std::shared_ptr 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 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 │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Resume_Data.html │ │ │ @@ -30,28 +30,28 @@ │ │ │ │ │ │

    home

    │ │ │
    │ │ │

    Table of contents

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

    read_resume_data()

    │ │ │

    Declared in "libtorrent/read_resume_data.hpp"

    │ │ │
    │ │ │ -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
    │ │ │ -   , load_torrent_limits const& cfg = {});
    │ │ │  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
    │ │ │ +   , error_code& ec, int piece_limit = 0x200000);
    │ │ │  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().

    │ │ │ @@ -91,24 +91,24 @@ │ │ │

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

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

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

    write_torrent_file_buf() write_torrent_file()

    │ │ │

    Declared in "libtorrent/write_resume_data.hpp"

    │ │ │
    │ │ │  entry write_torrent_file (add_torrent_params const& atp, write_torrent_flags_t flags);
    │ │ │ -entry write_torrent_file (add_torrent_params const& atp);
    │ │ │  std::vector<char> write_torrent_file_buf (add_torrent_params const& atp
    │ │ │     , write_torrent_flags_t flags);
    │ │ │ +entry write_torrent_file (add_torrent_params const& atp);
    │ │ │  
    │ │ │

    writes only the fields to create a .torrent file. This function may fail │ │ │ with a std::system_error exception if:

    │ │ │
      │ │ │
    • The add_torrent_params object passed to this function does not contain the │ │ │ info dictionary (the ti field)
    • │ │ │
    • The piece layers are not complete for all files that need them
    • │ │ │ ├── html2text {} │ │ │ │ @@ -1,25 +1,25 @@ │ │ │ │ > │ │ │ │ _[_l_i_b_t_o_r_r_e_n_t_ _l_o_g_o_] │ │ │ │ VVeerrssiioonn:: 2.0.13 │ │ │ │ _h_o_m_e │ │ │ │ Table of contents │ │ │ │ * _r_e_a_d___r_e_s_u_m_e___d_a_t_a_(_) │ │ │ │ * _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a___b_u_f_(_)_ _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_(_) │ │ │ │ - * _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_)_ _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e___b_u_f_(_) │ │ │ │ + * _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e___b_u_f_(_)_ _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_) │ │ │ │ * _w_r_i_t_e___t_o_r_r_e_n_t___f_l_a_g_s___t │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ************ rreeaadd__rreessuummee__ddaattaa(()) ************ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_r_e_a_d___r_e_s_u_m_e___d_a_t_a_._h_p_p" │ │ │ │ -add_torrent_params rreeaadd__rreessuummee__ddaattaa (bdecode_node const& rd │ │ │ │ - , error_code& ec, int piece_limit = 0x200000); │ │ │ │ -add_torrent_params rreeaadd__rreessuummee__ddaattaa (span buffer │ │ │ │ - , load_torrent_limits const& cfg = {}); │ │ │ │ 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 │ │ │ │ + , error_code& ec, int piece_limit = 0x200000); │ │ │ │ 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, │ │ │ │ @@ -52,21 +52,21 @@ │ │ │ │ ************ wwrriittee__rreessuummee__ddaattaa__bbuuff(()) wwrriittee__rreessuummee__ddaattaa(()) ************ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_._h_p_p" │ │ │ │ std::vector wwrriittee__rreessuummee__ddaattaa__bbuuff (add_torrent_params const& atp); │ │ │ │ entry wwrriittee__rreessuummee__ddaattaa (add_torrent_params const& atp); │ │ │ │ this function turns the resume data in an add_torrent_params object into a │ │ │ │ bencoded structure │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -************ wwrriittee__ttoorrrreenntt__ffiillee(()) wwrriittee__ttoorrrreenntt__ffiillee__bbuuff(()) ************ │ │ │ │ +************ wwrriittee__ttoorrrreenntt__ffiillee__bbuuff(()) wwrriittee__ttoorrrreenntt__ffiillee(()) ************ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_._h_p_p" │ │ │ │ entry wwrriittee__ttoorrrreenntt__ffiillee (add_torrent_params const& atp, write_torrent_flags_t │ │ │ │ flags); │ │ │ │ -entry wwrriittee__ttoorrrreenntt__ffiillee (add_torrent_params const& atp); │ │ │ │ std::vector wwrriittee__ttoorrrreenntt__ffiillee__bbuuff (add_torrent_params const& atp │ │ │ │ , write_torrent_flags_t flags); │ │ │ │ +entry wwrriittee__ttoorrrreenntt__ffiillee (add_torrent_params const& atp); │ │ │ │ writes only the fields to create a .torrent file. This function may fail with a │ │ │ │ std::system_error exception if: │ │ │ │ * The _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object passed to this function does not contain │ │ │ │ the info dictionary (the ti field) │ │ │ │ * The piece layers are not complete for all files that need them │ │ │ │ The write_torrent_file_buf() overload returns the torrent file in bencoded │ │ │ │ buffer form. This overload may be faster at the expense of lost flexibility to │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Session.html │ │ │ @@ -34,109 +34,109 @@ │ │ │ │ │ │
    │ │ │ [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.

    │ │ │
    │ │ │  struct session_params
    │ │ │  {
    │ │ │ +   session_params ();
    │ │ │     session_params (settings_pack const& sp);
    │ │ │     session_params (settings_pack&& sp);
    │ │ │ -   session_params ();
    │ │ │ -   session_params (settings_pack const& sp
    │ │ │ -      , std::vector<std::shared_ptr<plugin>> exts);
    │ │ │     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;
    │ │ │  };
    │ │ │  
    │ │ │ [report issue]
    │ │ │

    session_params()

    │ │ │
    │ │ │ +session_params ();
    │ │ │  session_params (settings_pack const& sp);
    │ │ │  session_params (settings_pack&& sp);
    │ │ │ -session_params ();
    │ │ │  
    │ │ │

    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 const& sp
    │ │ │ -      , std::vector<std::shared_ptr<plugin>> exts);
    │ │ │  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
    │ │ │
    │ │ │ @@ -178,33 +178,33 @@ │ │ │ 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.

    │ │ │
    │ │ │  struct session_proxy
    │ │ │  {
    │ │ │ +   ~session_proxy ();
    │ │ │ +   session_proxy (session_proxy const&);
    │ │ │ +   session_proxy ();
    │ │ │     session_proxy (session_proxy&&) noexcept;
    │ │ │     session_proxy& operator= (session_proxy const&) &;
    │ │ │ -   session_proxy (session_proxy const&);
    │ │ │     session_proxy& operator= (session_proxy&&) & noexcept;
    │ │ │ -   session_proxy ();
    │ │ │ -   ~session_proxy ();
    │ │ │  };
    │ │ │  
    │ │ │ + │ │ │ │ │ │ - │ │ │ -[report issue]
    │ │ │ -

    ~session_proxy() session_proxy() operator=()

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

    operator=() ~session_proxy() session_proxy()

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

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

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

    session

    │ │ │ @@ -218,52 +218,52 @@ │ │ │ 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().

    │ │ │
    │ │ │  struct session : session_handle
    │ │ │  {
    │ │ │ -   session (session_params const& params, session_flags_t flags);
    │ │ │     explicit session (session_params&& params);
    │ │ │ +   session (session_params const& params, session_flags_t flags);
    │ │ │ +   explicit session (session_params const& params);
    │ │ │     session ();
    │ │ │     session (session_params&& params, session_flags_t flags);
    │ │ │ -   explicit session (session_params const& params);
    │ │ │ -   session (session_params const& params, io_context& ios, session_flags_t);
    │ │ │     session (session_params&& params, io_context& ios);
    │ │ │     session (session_params const& 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]
    │ │ │

    session()

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

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

    │ │ │
    │ │ │ -session (session_params const& params, io_context& ios, session_flags_t);
    │ │ │  session (session_params&& params, io_context& ios);
    │ │ │  session (session_params const& 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);
    │ │ │  
    │ │ │

    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.

    │ │ │
    │ │ │ @@ -310,15 +310,15 @@ │ │ │ [report issue]
    │ │ │
    │ │ │
    │ │ │

    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 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
    │ │ │  {
    │ │ │     bool is_valid () const;
    │ │ │     session_params session_state (save_state_flags_t flags = save_state_flags_t::all()) const;
    │ │ │ @@ -326,28 +326,28 @@
    │ │ │        std::function<bool(torrent_status const&)> const& pred
    │ │ │        , status_flags_t flags = {}) const;
    │ │ │     void refresh_torrent_status (std::vector<torrent_status>* ret
    │ │ │        , 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);
    │ │ │ -   torrent_handle find_torrent (sha256_hash const& info_hash) const;
    │ │ │ -   torrent_handle find_torrent (sha1_hash const& info_hash) const;
    │ │ │ +   void set_dht_state (dht::dht_state const& st);
    │ │ │     std::vector<torrent_handle> get_torrents () const;
    │ │ │ -   torrent_handle add_torrent (add_torrent_params const& params, error_code& ec);
    │ │ │ +   torrent_handle find_torrent (sha1_hash const& info_hash) const;
    │ │ │ +   torrent_handle find_torrent (sha256_hash const& info_hash) const;
    │ │ │ +   torrent_handle add_torrent (add_torrent_params&& params, error_code& ec);
    │ │ │ +   void async_add_torrent (add_torrent_params&& params);
    │ │ │     void async_add_torrent (add_torrent_params const& params);
    │ │ │     torrent_handle add_torrent (add_torrent_params const& params);
    │ │ │     torrent_handle add_torrent (add_torrent_params&& params);
    │ │ │ -   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, error_code& ec);
    │ │ │     void resume ();
    │ │ │ -   void pause ();
    │ │ │     bool is_paused () const;
    │ │ │ +   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);
    │ │ │ @@ -359,37 +359,37 @@
    │ │ │     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::function<std::shared_ptr<torrent_plugin>(
    │ │ │        torrent_handle const&, client_data_t)> ext);
    │ │ │     void add_extension (std::shared_ptr<plugin> ext);
    │ │ │ -   void set_ip_filter (ip_filter f);
    │ │ │     ip_filter get_ip_filter () const;
    │ │ │ +   void set_ip_filter (ip_filter f);
    │ │ │     void set_port_filter (port_filter const& f);
    │ │ │     unsigned short ssl_listen_port () const;
    │ │ │ -   unsigned short listen_port () const;
    │ │ │     bool is_listening () const;
    │ │ │ +   unsigned short listen_port () 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;
    │ │ │ +   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);
    │ │ │ -   void set_peer_class (peer_class_t cid, peer_class_info const& pci);
    │ │ │     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);
    │ │ │     void pop_alerts (std::vector<alert*>* alerts);
    │ │ │ +   void set_alert_notify (std::function<void()> const& fun);
    │ │ │     alert* wait_for_alert (time_duration max_wait);
    │ │ │ -   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);
    │ │ │ +   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;
    │ │ │  
    │ │ │     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;
    │ │ │ @@ -421,18 +421,18 @@
    │ │ │  

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

    get_torrent_status() refresh_torrent_status()

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

    refresh_torrent_status() get_torrent_status()

    │ │ │
    │ │ │  std::vector<torrent_status> get_torrent_status (
    │ │ │        std::function<bool(torrent_status const&)> const& pred
    │ │ │        , status_flags_t flags = {}) const;
    │ │ │  void refresh_torrent_status (std::vector<torrent_status>* ret
    │ │ │        , status_flags_t flags = {}) const;
    │ │ │  
    │ │ │ @@ -502,48 +502,48 @@ │ │ │ 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);
    │ │ │ +void set_dht_state (dht::dht_state const& 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]
    │ │ │ -
    │ │ │ -

    get_torrents() find_torrent()

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

    find_torrent() get_torrents()

    │ │ │
    │ │ │ -torrent_handle find_torrent (sha256_hash const& info_hash) const;
    │ │ │ -torrent_handle find_torrent (sha1_hash const& info_hash) const;
    │ │ │  std::vector<torrent_handle> get_torrents () const;
    │ │ │ +torrent_handle find_torrent (sha1_hash const& info_hash) const;
    │ │ │ +torrent_handle find_torrent (sha256_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, error_code& ec);
    │ │ │ +torrent_handle add_torrent (add_torrent_params&& params, error_code& ec);
    │ │ │ +void async_add_torrent (add_torrent_params&& params);
    │ │ │  void async_add_torrent (add_torrent_params const& params);
    │ │ │  torrent_handle add_torrent (add_torrent_params const& params);
    │ │ │  torrent_handle add_torrent (add_torrent_params&& params);
    │ │ │ -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, error_code& ec);
    │ │ │  
    │ │ │

    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 │ │ │ @@ -569,22 +569,22 @@ │ │ │ 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() is_paused() pause()

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

    resume() pause() is_paused()

    │ │ │
    │ │ │  void resume ();
    │ │ │ -void pause ();
    │ │ │  bool is_paused () const;
    │ │ │ +void pause ();
    │ │ │  
    │ │ │

    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.

    │ │ │ @@ -692,18 +692,18 @@ │ │ │ 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_get_peers() dht_announce()

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

    │ │ │ @@ -789,21 +789,21 @@ │ │ │ that sends bad data with very high accuracy. Should │ │ │ eliminate most problems on poisoned torrents. │ │ │ │ │ │
    │ │ │  #include <libtorrent/extensions/smart_ban.hpp>
    │ │ │  ses.add_extension(&lt::create_smart_ban_plugin);
    │ │ │  
    │ │ │ - │ │ │ -[report issue]
    │ │ │ -
    │ │ │ -

    set_ip_filter() get_ip_filter()

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

    get_ip_filter() set_ip_filter()

    │ │ │
    │ │ │ -void set_ip_filter (ip_filter f);
    │ │ │  ip_filter get_ip_filter () const;
    │ │ │ +void set_ip_filter (ip_filter f);
    │ │ │  
    │ │ │

    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 │ │ │ @@ -814,23 +814,23 @@ │ │ │

    │ │ │  void set_port_filter (port_filter const& f);
    │ │ │  
    │ │ │

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

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

    ssl_listen_port() is_listening() listen_port()

    │ │ │
    │ │ │  unsigned short ssl_listen_port () const;
    │ │ │ -unsigned short listen_port () const;
    │ │ │  bool is_listening () const;
    │ │ │ +unsigned short listen_port () 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.

    │ │ │ @@ -864,21 +864,21 @@ │ │ │ 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()

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

    get_peer_class_type_filter() set_peer_class_type_filter()

    │ │ │
    │ │ │ -void set_peer_class_type_filter (peer_class_type_filter const& f);
    │ │ │  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:

    │ │ │
      │ │ │ @@ -922,16 +922,16 @@ │ │ │ destructs.

      │ │ │

      For more information on peer classes, see peer classes.

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

    set_peer_class() get_peer_class()

    │ │ │
    │ │ │ -void set_peer_class (peer_class_t cid, peer_class_info const& pci);
    │ │ │  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 │ │ │ @@ -983,22 +983,22 @@ │ │ │ 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]
    │ │ │ -
    │ │ │ -

    set_alert_notify() wait_for_alert() pop_alerts()

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

    wait_for_alert() set_alert_notify() pop_alerts()

    │ │ │
    │ │ │ -void set_alert_notify (std::function<void()> const& fun);
    │ │ │  void pop_alerts (std::vector<alert*>* alerts);
    │ │ │ +void set_alert_notify (std::function<void()> const& fun);
    │ │ │  alert* wait_for_alert (time_duration max_wait);
    │ │ │  
    │ │ │

    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.

    │ │ │ @@ -1052,16 +1052,16 @@ │ │ │ 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()

    │ │ │
    │ │ │ -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);
    │ │ │ +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]
    │ │ │ @@ -1127,26 +1127,26 @@ │ │ │ [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]
    │ │ │ +[report issue]
    │ │ │
    │ │ │ -
    │ │ │ -

    write_session_params() read_session_params() write_session_params_buf()

    │ │ │ +
    │ │ │ +

    write_session_params_buf() write_session_params() read_session_params()

    │ │ │

    Declared in "libtorrent/session_params.hpp"

    │ │ │
    │ │ │ -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());
    │ │ │ +session_params read_session_params (span<char const> buf
    │ │ │ +   , 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());
    │ │ │  std::vector<char> write_session_params_buf (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 │ │ │ ├── html2text {} │ │ │ │ @@ -3,95 +3,95 @@ │ │ │ │ VVeerrssiioonn:: 2.0.13 │ │ │ │ _h_o_m_e │ │ │ │ Table of contents │ │ │ │ * _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___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_=_(_) │ │ │ │ + o _o_p_e_r_a_t_o_r_=_(_)_ _~_s_e_s_s_i_o_n___p_r_o_x_y_(_)_ _s_e_s_s_i_o_n___p_r_o_x_y_(_) │ │ │ │ * _s_e_s_s_i_o_n │ │ │ │ o _s_e_s_s_i_o_n_(_) │ │ │ │ o _s_e_s_s_i_o_n_(_) │ │ │ │ o _~_s_e_s_s_i_o_n_(_) │ │ │ │ o _a_b_o_r_t_(_) │ │ │ │ * _s_e_s_s_i_o_n___h_a_n_d_l_e │ │ │ │ o _i_s___v_a_l_i_d_(_) │ │ │ │ o _s_e_s_s_i_o_n___s_t_a_t_e_(_) │ │ │ │ - o _g_e_t___t_o_r_r_e_n_t___s_t_a_t_u_s_(_)_ _r_e_f_r_e_s_h___t_o_r_r_e_n_t___s_t_a_t_u_s_(_) │ │ │ │ + o _r_e_f_r_e_s_h___t_o_r_r_e_n_t___s_t_a_t_u_s_(_)_ _g_e_t___t_o_r_r_e_n_t___s_t_a_t_u_s_(_) │ │ │ │ o _p_o_s_t___t_o_r_r_e_n_t___u_p_d_a_t_e_s_(_) │ │ │ │ o _p_o_s_t___s_e_s_s_i_o_n___s_t_a_t_s_(_) │ │ │ │ o _p_o_s_t___d_h_t___s_t_a_t_s_(_) │ │ │ │ o _s_e_t___d_h_t___s_t_a_t_e_(_) │ │ │ │ - o _g_e_t___t_o_r_r_e_n_t_s_(_)_ _f_i_n_d___t_o_r_r_e_n_t_(_) │ │ │ │ + o _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_(_)_ _i_s___p_a_u_s_e_d_(_)_ _p_a_u_s_e_(_) │ │ │ │ + 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___g_e_t___p_e_e_r_s_(_)_ _d_h_t___a_n_n_o_u_n_c_e_(_) │ │ │ │ + o _d_h_t___a_n_n_o_u_n_c_e_(_)_ _d_h_t___g_e_t___p_e_e_r_s_(_) │ │ │ │ o _d_h_t___l_i_v_e___n_o_d_e_s_(_) │ │ │ │ o _d_h_t___s_a_m_p_l_e___i_n_f_o_h_a_s_h_e_s_(_) │ │ │ │ o _d_h_t___d_i_r_e_c_t___r_e_q_u_e_s_t_(_) │ │ │ │ o _a_d_d___e_x_t_e_n_s_i_o_n_(_) │ │ │ │ - o _s_e_t___i_p___f_i_l_t_e_r_(_)_ _g_e_t___i_p___f_i_l_t_e_r_(_) │ │ │ │ + o _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 _l_i_s_t_e_n___p_o_r_t_(_)_ _i_s___l_i_s_t_e_n_i_n_g_(_)_ _s_s_l___l_i_s_t_e_n___p_o_r_t_(_) │ │ │ │ + o _s_s_l___l_i_s_t_e_n___p_o_r_t_(_)_ _i_s___l_i_s_t_e_n_i_n_g_(_)_ _l_i_s_t_e_n___p_o_r_t_(_) │ │ │ │ o _g_e_t___p_e_e_r___c_l_a_s_s___f_i_l_t_e_r_(_)_ _s_e_t___p_e_e_r___c_l_a_s_s___f_i_l_t_e_r_(_) │ │ │ │ - o _s_e_t___p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r_(_)_ _g_e_t___p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r_(_) │ │ │ │ + o _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 _s_e_t___p_e_e_r___c_l_a_s_s_(_)_ _g_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 _g_e_t___s_e_t_t_i_n_g_s_(_)_ _a_p_p_l_y___s_e_t_t_i_n_g_s_(_) │ │ │ │ - o _s_e_t___a_l_e_r_t___n_o_t_i_f_y_(_)_ _w_a_i_t___f_o_r___a_l_e_r_t_(_)_ _p_o_p___a_l_e_r_t_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_(_) │ │ │ │ - * _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s_(_)_ _r_e_a_d___s_e_s_s_i_o_n___p_a_r_a_m_s_(_)_ _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s___b_u_f_(_) │ │ │ │ + * _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s___b_u_f_(_)_ _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s_(_)_ _r_e_a_d___s_e_s_s_i_o_n___p_a_r_a_m_s_(_) │ │ │ │ [_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 (); │ │ │ │ - sseessssiioonn__ppaarraammss (settings_pack const& sp │ │ │ │ - , std::vector> exts); │ │ │ │ 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 (); │ │ │ │ sseessssiioonn__ppaarraammss (settings_pack const& sp); │ │ │ │ sseessssiioonn__ppaarraammss (settings_pack&& 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 const& sp │ │ │ │ - , std::vector> exts); │ │ │ │ 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 │ │ │ │ @@ -122,29 +122,29 @@ │ │ │ │ _s_e_s_s_i_o_n destruction is explicitly initiated, this holder is used to synchronize │ │ │ │ the completion of the shutdown. The lifetime of this object may outlive │ │ │ │ _s_e_s_s_i_o_n, causing the _s_e_s_s_i_o_n destructor to not block. The _s_e_s_s_i_o_n___p_r_o_x_y │ │ │ │ destructor will block however, until the underlying _s_e_s_s_i_o_n is done shutting │ │ │ │ down. │ │ │ │ struct session_proxy │ │ │ │ { │ │ │ │ + ~~sseessssiioonn__pprrooxxyy (); │ │ │ │ + sseessssiioonn__pprrooxxyy (session_proxy const&); │ │ │ │ + sseessssiioonn__pprrooxxyy (); │ │ │ │ sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept; │ │ │ │ session_proxy& ooppeerraattoorr== (session_proxy const&) &; │ │ │ │ - sseessssiioonn__pprrooxxyy (session_proxy const&); │ │ │ │ session_proxy& ooppeerraattoorr== (session_proxy&&) & noexcept; │ │ │ │ - sseessssiioonn__pprrooxxyy (); │ │ │ │ - ~~sseessssiioonn__pprrooxxyy (); │ │ │ │ }; │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** ~~sseessssiioonn__pprrooxxyy(()) sseessssiioonn__pprrooxxyy(()) ooppeerraattoorr==(()) ********** │ │ │ │ +********** ooppeerraattoorr==(()) ~~sseessssiioonn__pprrooxxyy(()) sseessssiioonn__pprrooxxyy(()) ********** │ │ │ │ +~~sseessssiioonn__pprrooxxyy (); │ │ │ │ +sseessssiioonn__pprrooxxyy (session_proxy const&); │ │ │ │ +sseessssiioonn__pprrooxxyy (); │ │ │ │ sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept; │ │ │ │ session_proxy& ooppeerraattoorr== (session_proxy const&) &; │ │ │ │ -sseessssiioonn__pprrooxxyy (session_proxy const&); │ │ │ │ session_proxy& ooppeerraattoorr== (session_proxy&&) & noexcept; │ │ │ │ -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 │ │ │ │ @@ -152,47 +152,47 @@ │ │ │ │ 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); │ │ │ │ explicit sseessssiioonn (session_params&& params); │ │ │ │ + sseessssiioonn (session_params const& params, session_flags_t flags); │ │ │ │ + explicit sseessssiioonn (session_params const& params); │ │ │ │ sseessssiioonn (); │ │ │ │ sseessssiioonn (session_params&& params, session_flags_t flags); │ │ │ │ - explicit sseessssiioonn (session_params const& params); │ │ │ │ - sseessssiioonn (session_params const& params, io_context& ios, session_flags_t); │ │ │ │ sseessssiioonn (session_params&& params, io_context& ios); │ │ │ │ sseessssiioonn (session_params const& params, io_context& ios); │ │ │ │ sseessssiioonn (session_params&& params, io_context& ios, session_flags_t); │ │ │ │ + sseessssiioonn (session_params const& params, io_context& ios, session_flags_t); │ │ │ │ ~~sseessssiioonn (); │ │ │ │ session_proxy aabboorrtt (); │ │ │ │ }; │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** sseessssiioonn(()) ********** │ │ │ │ -sseessssiioonn (session_params const& params, session_flags_t flags); │ │ │ │ explicit sseessssiioonn (session_params&& params); │ │ │ │ +sseessssiioonn (session_params const& params, session_flags_t flags); │ │ │ │ +explicit sseessssiioonn (session_params const& params); │ │ │ │ sseessssiioonn (); │ │ │ │ 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, session_flags_t); │ │ │ │ sseessssiioonn (session_params&& params, io_context& ios); │ │ │ │ sseessssiioonn (session_params const& params, io_context& ios); │ │ │ │ sseessssiioonn (session_params&& params, io_context& ios, session_flags_t); │ │ │ │ +sseessssiioonn (session_params const& params, io_context& ios, session_flags_t); │ │ │ │ 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 │ │ │ │ @@ -240,29 +240,29 @@ │ │ │ │ std::function const& pred │ │ │ │ , status_flags_t flags = {}) const; │ │ │ │ void rreeffrreesshh__ttoorrrreenntt__ssttaattuuss (std::vector* ret │ │ │ │ , status_flags_t flags = {}) const; │ │ │ │ void ppoosstt__ttoorrrreenntt__uuppddaatteess (status_flags_t flags = status_flags_t::all()); │ │ │ │ void ppoosstt__sseessssiioonn__ssttaattss (); │ │ │ │ void ppoosstt__ddhhtt__ssttaattss (); │ │ │ │ - void sseett__ddhhtt__ssttaattee (dht::dht_state const& st); │ │ │ │ void sseett__ddhhtt__ssttaattee (dht::dht_state&& st); │ │ │ │ - torrent_handle ffiinndd__ttoorrrreenntt (sha256_hash const& info_hash) const; │ │ │ │ - torrent_handle ffiinndd__ttoorrrreenntt (sha1_hash const& info_hash) const; │ │ │ │ + void sseett__ddhhtt__ssttaattee (dht::dht_state const& st); │ │ │ │ std::vector ggeett__ttoorrrreennttss () const; │ │ │ │ - torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params, error_code& │ │ │ │ -ec); │ │ │ │ + torrent_handle ffiinndd__ttoorrrreenntt (sha1_hash const& info_hash) const; │ │ │ │ + torrent_handle ffiinndd__ttoorrrreenntt (sha256_hash const& info_hash) const; │ │ │ │ + torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params, error_code& ec); │ │ │ │ + void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params&& params); │ │ │ │ void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params); │ │ │ │ - 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, error_code& │ │ │ │ +ec); │ │ │ │ void rreessuummee (); │ │ │ │ - void ppaauussee (); │ │ │ │ bool iiss__ppaauusseedd () const; │ │ │ │ + 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); │ │ │ │ @@ -277,38 +277,38 @@ │ │ │ │ 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::function( │ │ │ │ torrent_handle const&, client_data_t)> ext); │ │ │ │ void aadddd__eexxtteennssiioonn (std::shared_ptr ext); │ │ │ │ - void sseett__iipp__ffiilltteerr (ip_filter f); │ │ │ │ ip_filter ggeett__iipp__ffiilltteerr () const; │ │ │ │ + void sseett__iipp__ffiilltteerr (ip_filter f); │ │ │ │ void sseett__ppoorrtt__ffiilltteerr (port_filter const& f); │ │ │ │ unsigned short ssssll__lliisstteenn__ppoorrtt () const; │ │ │ │ - unsigned short lliisstteenn__ppoorrtt () const; │ │ │ │ bool iiss__lliisstteenniinngg () const; │ │ │ │ + unsigned short lliisstteenn__ppoorrtt () 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; │ │ │ │ + void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f); │ │ │ │ peer_class_t ccrreeaattee__ppeeeerr__ccllaassss (char const* name); │ │ │ │ void ddeelleettee__ppeeeerr__ccllaassss (peer_class_t cid); │ │ │ │ - void sseett__ppeeeerr__ccllaassss (peer_class_t cid, peer_class_info const& pci); │ │ │ │ peer_class_info ggeett__ppeeeerr__ccllaassss (peer_class_t cid) const; │ │ │ │ + void 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); │ │ │ │ void ppoopp__aalleerrttss (std::vector* alerts); │ │ │ │ + void sseett__aalleerrtt__nnoottiiffyy (std::function const& fun); │ │ │ │ alert* wwaaiitt__ffoorr__aalleerrtt (time_duration max_wait); │ │ │ │ + void ddeelleettee__ppoorrtt__mmaappppiinngg (port_mapping_t handle); │ │ │ │ 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; │ │ │ │ @@ -334,15 +334,15 @@ │ │ │ │ all()) const; │ │ │ │ returns the current _s_e_s_s_i_o_n state. This can be passed to _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s_(_) │ │ │ │ to save the state to disk and restored using _r_e_a_d___s_e_s_s_i_o_n___p_a_r_a_m_s_(_) when │ │ │ │ constructing a new _s_e_s_s_i_o_n. The kind of state that's included is all settings, │ │ │ │ the DHT routing table, possibly plugin-specific state. the flags parameter can │ │ │ │ be used to only save certain parts of the _s_e_s_s_i_o_n state │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** ggeett__ttoorrrreenntt__ssttaattuuss(()) rreeffrreesshh__ttoorrrreenntt__ssttaattuuss(()) ********** │ │ │ │ +********** rreeffrreesshh__ttoorrrreenntt__ssttaattuuss(()) ggeett__ttoorrrreenntt__ssttaattuuss(()) ********** │ │ │ │ std::vector ggeett__ttoorrrreenntt__ssttaattuuss ( │ │ │ │ std::function const& pred │ │ │ │ , status_flags_t flags = {}) const; │ │ │ │ void rreeffrreesshh__ttoorrrreenntt__ssttaattuuss (std::vector* ret │ │ │ │ , status_flags_t flags = {}) const; │ │ │ │ Note │ │ │ │ these calls are potentially expensive and won't scale well with lots of │ │ │ │ @@ -392,38 +392,38 @@ │ │ │ │ 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); │ │ │ │ +void sseett__ddhhtt__ssttaattee (dht::dht_state const& st); │ │ │ │ set the DHT state for the _s_e_s_s_i_o_n. This will be taken into account the next │ │ │ │ time the DHT is started, as if it had been passed in via the _s_e_s_s_i_o_n___p_a_r_a_m_s on │ │ │ │ startup. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** ggeett__ttoorrrreennttss(()) ffiinndd__ttoorrrreenntt(()) ********** │ │ │ │ -torrent_handle ffiinndd__ttoorrrreenntt (sha256_hash const& info_hash) const; │ │ │ │ -torrent_handle ffiinndd__ttoorrrreenntt (sha1_hash const& info_hash) const; │ │ │ │ +********** ffiinndd__ttoorrrreenntt(()) ggeett__ttoorrrreennttss(()) ********** │ │ │ │ std::vector ggeett__ttoorrrreennttss () const; │ │ │ │ +torrent_handle ffiinndd__ttoorrrreenntt (sha1_hash const& info_hash) const; │ │ │ │ +torrent_handle ffiinndd__ttoorrrreenntt (sha256_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, error_code& ec); │ │ │ │ +torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params, error_code& ec); │ │ │ │ +void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params&& params); │ │ │ │ void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ torrent_handle aadddd__ttoorrrreenntt (add_torrent_params&& params); │ │ │ │ -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, error_code& ec); │ │ │ │ You add torrents through the _a_d_d___t_o_r_r_e_n_t_(_) function where you give an object │ │ │ │ with all the parameters. The _a_d_d___t_o_r_r_e_n_t_(_) overloads will block until the │ │ │ │ torrent has been added (or failed to be added) and returns an error code and a │ │ │ │ _t_o_r_r_e_n_t___h_a_n_d_l_e. In order to add torrents more efficiently, consider using │ │ │ │ _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_) which returns immediately, without waiting for the torrent │ │ │ │ to add. Notification of the torrent being added is sent as _a_d_d___t_o_r_r_e_n_t___a_l_e_r_t. │ │ │ │ The save_path field in _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s must be set to a valid path where the │ │ │ │ @@ -444,18 +444,18 @@ │ │ │ │ torrent_flags::paused and torrent_flags::auto_managed. In order to add a magnet │ │ │ │ link that will just download the metadata, but no payload, set the │ │ │ │ torrent_flags::upload_mode flag. │ │ │ │ Special consideration has to be taken when adding hybrid torrents (i.e. │ │ │ │ torrents that are BitTorrent v2 torrents that are backwards compatible with │ │ │ │ v1). For more details, see _B_i_t_T_o_r_r_e_n_t_ _v_2_ _t_o_r_r_e_n_t_s. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** rreessuummee(()) iiss__ppaauusseedd(()) ppaauussee(()) ********** │ │ │ │ +********** rreessuummee(()) ppaauussee(()) iiss__ppaauusseedd(()) ********** │ │ │ │ void rreessuummee (); │ │ │ │ -void ppaauussee (); │ │ │ │ bool iiss__ppaauusseedd () const; │ │ │ │ +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(()) ********** │ │ │ │ @@ -531,15 +531,15 @@ │ │ │ │ and make the function entirely self-contained. The only reason data blob's │ │ │ │ value is computed via a function instead of just passing in the new value is to │ │ │ │ avoid race conditions. If you want to uuppddaattee the value in the DHT, you must │ │ │ │ first retrieve it, then modify it, then write it back. The way the DHT works, │ │ │ │ it is natural to always do a lookup before storing and calling the callback in │ │ │ │ between is convenient. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** ddhhtt__ggeett__ppeeeerrss(()) ddhhtt__aannnnoouunnccee(()) ********** │ │ │ │ +********** ddhhtt__aannnnoouunnccee(()) ddhhtt__ggeett__ppeeeerrss(()) ********** │ │ │ │ void ddhhtt__ggeett__ppeeeerrss (sha1_hash const& info_hash); │ │ │ │ void ddhhtt__aannnnoouunnccee (sha1_hash const& info_hash, int port = 0, dht:: │ │ │ │ announce_flags_t flags = {}); │ │ │ │ dht_get_peers() will issue a DHT get_peer request to the DHT for the specified │ │ │ │ info-hash. The response (the peers) will be posted back in a │ │ │ │ _d_h_t___g_e_t___p_e_e_r_s___r_e_p_l_y___a_l_e_r_t. │ │ │ │ dht_announce() will issue a DHT announce request to the DHT to the specified │ │ │ │ @@ -599,17 +599,17 @@ │ │ │ │ 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); │ │ │ │ +********** ggeett__iipp__ffiilltteerr(()) sseett__iipp__ffiilltteerr(()) ********** │ │ │ │ ip_filter ggeett__iipp__ffiilltteerr () const; │ │ │ │ +void sseett__iipp__ffiilltteerr (ip_filter f); │ │ │ │ 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. │ │ │ │ @@ -617,18 +617,18 @@ │ │ │ │ ********** 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(()) ********** │ │ │ │ +********** ssssll__lliisstteenn__ppoorrtt(()) iiss__lliisstteenniinngg(()) lliisstteenn__ppoorrtt(()) ********** │ │ │ │ unsigned short ssssll__lliisstteenn__ppoorrtt () const; │ │ │ │ -unsigned short lliisstteenn__ppoorrtt () const; │ │ │ │ bool iiss__lliisstteenniinngg () const; │ │ │ │ +unsigned short lliisstteenn__ppoorrtt () const; │ │ │ │ is_listening() will tell you whether or not the _s_e_s_s_i_o_n has successfully opened │ │ │ │ a listening port. If it hasn't, this function will return false, and then you │ │ │ │ can set a new _s_e_t_t_i_n_g_s___p_a_c_k_:_:_l_i_s_t_e_n___i_n_t_e_r_f_a_c_e_s to try another interface and │ │ │ │ port to bind to. │ │ │ │ listen_port() returns the port we ended up listening on. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** ggeett__ppeeeerr__ccllaassss__ffiilltteerr(()) sseett__ppeeeerr__ccllaassss__ffiilltteerr(()) ********** │ │ │ │ @@ -654,17 +654,17 @@ │ │ │ │ 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(()) ********** │ │ │ │ -void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f); │ │ │ │ +********** ggeett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr(()) sseett__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 │ │ │ │ @@ -693,16 +693,16 @@ │ │ │ │ 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] │ │ │ │ ********** sseett__ppeeeerr__ccllaassss(()) ggeett__ppeeeerr__ccllaassss(()) ********** │ │ │ │ -void sseett__ppeeeerr__ccllaassss (peer_class_t cid, peer_class_info const& pci); │ │ │ │ peer_class_info ggeett__ppeeeerr__ccllaassss (peer_class_t cid) const; │ │ │ │ +void 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 │ │ │ │ @@ -740,17 +740,17 @@ │ │ │ │ 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] │ │ │ │ -********** sseett__aalleerrtt__nnoottiiffyy(()) wwaaiitt__ffoorr__aalleerrtt(()) ppoopp__aalleerrttss(()) ********** │ │ │ │ -void sseett__aalleerrtt__nnoottiiffyy (std::function const& fun); │ │ │ │ +********** wwaaiitt__ffoorr__aalleerrtt(()) sseett__aalleerrtt__nnoottiiffyy(()) ppoopp__aalleerrttss(()) ********** │ │ │ │ void ppoopp__aalleerrttss (std::vector* alerts); │ │ │ │ +void sseett__aalleerrtt__nnoottiiffyy (std::function const& fun); │ │ │ │ alert* wwaaiitt__ffoorr__aalleerrtt (time_duration max_wait); │ │ │ │ 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 │ │ │ │ @@ -792,17 +792,17 @@ │ │ │ │ block. It should not perform any expensive work. It really should just notify │ │ │ │ the main application thread. │ │ │ │ The type of an _a_l_e_r_t is returned by the polymorphic function alert::type() but │ │ │ │ can also be queries from a concrete type via T::alert_type, as a static │ │ │ │ constant. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** aadddd__ppoorrtt__mmaappppiinngg(()) ddeelleettee__ppoorrtt__mmaappppiinngg(()) ********** │ │ │ │ +void ddeelleettee__ppoorrtt__mmaappppiinngg (port_mapping_t handle); │ │ │ │ std::vector aadddd__ppoorrtt__mmaappppiinngg (portmap_protocol t, int │ │ │ │ external_port, int local_port); │ │ │ │ -void ddeelleettee__ppoorrtt__mmaappppiinngg (port_mapping_t handle); │ │ │ │ add_port_mapping adds one or more port forwards on UPnP and/or NAT-PMP, │ │ │ │ whichever is enabled. A mapping is created for each listen socket in the │ │ │ │ _s_e_s_s_i_o_n. The return values are all handles referring to the port mappings that │ │ │ │ were just created. Pass them to _d_e_l_e_t_e___p_o_r_t___m_a_p_p_i_n_g_(_) to remove them. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** rreeooppeenn__nneettwwoorrkk__ssoocckkeettss(()) ********** │ │ │ │ void rreeooppeenn__nneettwwoorrkk__ssoocckkeettss (reopen_network_flags_t options = │ │ │ │ @@ -848,21 +848,21 @@ │ │ │ │ protocols used by _a_d_d___p_o_r_t___m_a_p_p_i_n_g_(_) │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ reopen_map_ports │ │ │ │ This option indicates if the ports are mapped using natpmp and upnp. If │ │ │ │ mapping was already made, they are deleted and added again. This only │ │ │ │ works if natpmp and/or upnp are configured to be enable. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -************ wwrriittee__sseessssiioonn__ppaarraammss(()) rreeaadd__sseessssiioonn__ppaarraammss(()) wwrriittee__sseessssiioonn__ppaarraammss__bbuuff(()) │ │ │ │ +************ wwrriittee__sseessssiioonn__ppaarraammss__bbuuff(()) wwrriittee__sseessssiioonn__ppaarraammss(()) rreeaadd__sseessssiioonn__ppaarraammss(()) │ │ │ │ ************ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n___p_a_r_a_m_s_._h_p_p" │ │ │ │ -session_params rreeaadd__sseessssiioonn__ppaarraammss (span buf │ │ │ │ - , save_state_flags_t flags = save_state_flags_t::all()); │ │ │ │ entry wwrriittee__sseessssiioonn__ppaarraammss (session_params const& sp │ │ │ │ , save_state_flags_t flags = save_state_flags_t::all()); │ │ │ │ +session_params rreeaadd__sseessssiioonn__ppaarraammss (span buf │ │ │ │ + , save_state_flags_t flags = save_state_flags_t::all()); │ │ │ │ session_params rreeaadd__sseessssiioonn__ppaarraammss (bdecode_node const& e │ │ │ │ , save_state_flags_t flags = save_state_flags_t::all()); │ │ │ │ std::vector wwrriittee__sseessssiioonn__ppaarraammss__bbuuff (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 │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Settings.html │ │ │ @@ -29,35 +29,35 @@ │ │ │ │ │ │ │ │ │

    home

    │ │ │
    │ │ │

    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 │ │ │ to the session when passed to session::apply_settings(). It's empty when │ │ │ @@ -4752,24 +4752,24 @@ │ │ │ seconds.

    │ │ │
    │ │ │  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_str (int name, std::string val) override;
    │ │ │     void set_int (int name, flags::bitfield_flag<Type, Tag> const val);
    │ │ │ +   void set_int (int name, int val) override;
    │ │ │     bool has_val (int name) const override;
    │ │ │     void clear ();
    │ │ │     void clear (int name);
    │ │ │ -   std::string const& get_str (int name) const override;
    │ │ │     int get_int (int name) const override;
    │ │ │     bool get_bool (int name) const override;
    │ │ │ +   std::string const& get_str (int name) const override;
    │ │ │  
    │ │ │     enum type_bases
    │ │ │     {
    │ │ │        string_type_base,
    │ │ │        int_type_base,
    │ │ │        bool_type_base,
    │ │ │        type_mask,
    │ │ │ @@ -4838,23 +4838,23 @@
    │ │ │        socks5,
    │ │ │        socks5_pw,
    │ │ │        http,
    │ │ │        http_pw,
    │ │ │     };
    │ │ │  };
    │ │ │  
    │ │ │ + │ │ │ │ │ │ - │ │ │ -[report issue]
    │ │ │ -

    set_bool() set_int() set_str()

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

    set_str() set_bool() set_int()

    │ │ │
    │ │ │ -void set_int (int name, int val) override;
    │ │ │  void set_bool (int name, bool val) override;
    │ │ │  void set_str (int name, std::string val) override;
    │ │ │  void set_int (int name, flags::bitfield_flag<Type, Tag> const val);
    │ │ │ +void set_int (int name, int 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()

    │ │ │ @@ -4874,23 +4874,23 @@ │ │ │ [report issue]
    │ │ │
    │ │ │

    clear()

    │ │ │
    │ │ │  void clear (int name);
    │ │ │  
    │ │ │

    clear a specific setting from the pack

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

    get_str() get_int() get_bool()

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

    get_int() get_str() get_bool()

    │ │ │
    │ │ │ -std::string const& get_str (int name) const override;
    │ │ │  int get_int (int name) const override;
    │ │ │  bool get_bool (int name) const override;
    │ │ │ +std::string const& get_str (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]
    │ │ │ @@ -5249,16 +5249,64 @@ │ │ │ http_pw │ │ │ 5 │ │ │ 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]
    │ │ │ + │ │ │ +[report issue]
    │ │ │
    │ │ │ +
    │ │ │ +

    name_for_setting() setting_by_name()

    │ │ │ +

    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]
    │ │ │ +
    │ │ │ +

    high_performance_seed() min_memory_usage()

    │ │ │ +

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

    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);
    │ │ │  
    │ │ │ @@ -5307,62 +5355,14 @@ │ │ │ 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]
    │ │ │ -
    │ │ │ -

    min_memory_usage() high_performance_seed()

    │ │ │ -

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

    name_for_setting() setting_by_name()

    │ │ │ -

    Declared in "libtorrent/settings_pack.hpp"

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

    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

    │ │ │
    │ │ │ │ │ │
    │ │ │ │ │ │
    │ │ │
    │ │ │ ..in │ │ │ +00049160: 7420 706f 7274 203d 2069 735f 7373 6c5f t port = is_ssl_ │ │ │ +00049170: 746f 7272 656e 7428 2920 3f20 6d5f 7365 torrent() ? m_se │ │ │ +00049180: 732e 7373 6c5f 6c69 7374 656e 5f70 6f72 s.ssl_listen_por │ │ │ +00049190: 7428 2920 3a20 6d5f 7365 732e 6c69 7374 t() : m_ses.list │ │ │ +000491a0: 656e 5f70 6f72 7428 293b 0a23 656c 7365 en_port();.#else │ │ │ +000491b0: 0a09 0969 6e74 2070 6f72 7420 3d20 6d5f ...int port = m_ │ │ │ +000491c0: 7365 732e 6c69 7374 656e 5f70 6f72 7428 ses.listen_port( │ │ │ +000491d0: 293b 0a23 656e 6469 660a 0a09 092f 2f20 );.#endif....// │ │ │ +000491e0: 616e 6e6f 756e 6365 2077 6974 6820 7468 announce with th │ │ │ +000491f0: 6520 6c6f 6361 6c20 6469 7363 6f76 6572 e local discover │ │ │ +00049200: 7920 7365 7276 6963 650a 0909 6d5f 746f y service...m_to │ │ │ +00049210: 7272 656e 745f 6669 6c65 2d26 6774 3b69 rrent_file->i │ │ │ +00049220: 6e66 6f5f 6861 7368 6573 2829 2e66 6f72 nfo_hashes().for │ │ │ +00049230: 5f65 6163 6828 5b26 616d 703b 5d28 7368 _each([&](sh │ │ │ +00049240: 6131 5f68 6173 6820 636f 6e73 7426 616d a1_hash const&am │ │ │ +00049250: 703b 2069 682c 2070 726f 746f 636f 6c5f p; ih, protocol_ │ │ │ +00049260: 7665 7273 696f 6e29 0a09 097b 0a09 0909 version)...{.... │ │ │ +00049270: 6d5f 7365 732e 616e 6e6f 756e 6365 5f6c m_ses.announce_l │ │ │ +00049280: 7364 2869 682c 2070 6f72 7429 3b0a 0909 sd(ih, port);... │ │ │ +00049290: 7d29 3b0a 097d 0a0a 2369 666e 6465 6620 });..}..#ifndef │ │ │ +000492a0: 544f 5252 454e 545f 4449 5341 424c 455f TORRENT_DISABLE_ │ │ │ +000492b0: 4448 540a 0a09 766f 6964 2074 6f72 7265 DHT...void torre │ │ │ +000492c0: 6e74 3a3a 6468 745f 616e 6e6f 756e 6365 nt::dht_announce │ │ │ +000492d0: 2829 0a09 7b0a 0909 544f 5252 454e 545f ()..{...TORRENT_ │ │ │ +000492e0: 4153 5345 5254 2869 735f 7369 6e67 6c65 ASSERT(is_single │ │ │ +000492f0: 5f74 6872 6561 6428 2929 3b0a 0909 6966 _thread());...if │ │ │ +00049300: 2028 216d 5f73 6573 2e64 6874 2829 290a (!m_ses.dht()). │ │ │ +00049310: 0909 7b0a 2369 666e 6465 6620 544f 5252 ..{.#ifndef TORR │ │ │ +00049320: 454e 545f 4449 5341 424c 455f 4c4f 4747 ENT_DISABLE_LOGG │ │ │ +00049330: 494e 470a 0909 0964 6562 7567 5f6c 6f67 ING....debug_log │ │ │ +00049340: 2822 4448 543a 206e 6f20 6468 7420 696e ("DHT: no dht in │ │ │ +00049350: 6974 6961 6c69 7a65 6422 293b 0a23 656e itialized");.#en │ │ │ +00049360: 6469 660a 0909 0972 6574 7572 6e3b 0a09 dif....return;.. │ │ │ +00049370: 097d 0a09 0969 6620 2821 7368 6f75 6c64 .}...if (!should │ │ │ +00049380: 5f61 6e6e 6f75 6e63 655f 6468 7428 2929 _announce_dht()) │ │ │ +00049390: 0a09 097b 0a23 6966 6e64 6566 2054 4f52 ...{.#ifndef TOR │ │ │ +000493a0: 5245 4e54 5f44 4953 4142 4c45 5f4c 4f47 RENT_DISABLE_LOG │ │ │ +000493b0: 4749 4e47 0a09 0909 6966 2028 7368 6f75 GING....if (shou │ │ │ +000493c0: 6c64 5f6c 6f67 2829 290a 0909 097b 0a23 ld_log())....{.# │ │ │ +000493d0: 6966 2054 4f52 5245 4e54 5f55 5345 5f49 if TORRENT_USE_I │ │ │ +000493e0: 3250 0a3c 2f70 7265 3e3c 2f74 643e 3c2f 2P. │ │ │ +00049410: 3c74 643e 7265 6c65 7661 6e63 6526 6e62 relevance&nb │ │ │ +00049420: 7370 3b30 3c2f 7464 3e3c 7464 3e3c 6120 sp;0.. │ │ │ +00049450: 2f73 7263 2f74 6f72 7265 6e74 2e63 7070 /src/torrent.cpp │ │ │ +00049460: 3a33 3937 383c 2f61 3e3c 2f74 643e 3c74 :3978add one peer p │ │ │ +00049480: 6572 2049 5020 7468 6520 686f 7374 6e61 er IP the hostna │ │ │ +00049490: 6d65 2072 6573 6f6c 7665 7320 746f 3c2f me resolves to

    add │ │ │ +000494f0: 6f6e 6520 7065 6572 2070 6572 2049 5020 one peer per IP │ │ │ +00049500: 7468 6520 686f 7374 6e61 6d65 2072 6573 the hostname res │ │ │ +00049510: 6f6c 7665 7320 746f 3c2f 6832 3e3c 6834 olves to

    ../src/torrent. │ │ │ +00049530: 6370 703a 3339 3738 3c2f 6834 3e3c 7072 cpp:3978

    .catch (. │ │ │ +00049580: 2e2e 2920 7b20 6861 6e64 6c65 5f65 7863 ..) { handle_exc │ │ │ +00049590: 6570 7469 6f6e 2829 3b20 7d0a 2365 6e64 eption(); }.#end │ │ │ +000495a0: 6966 0a0a 0976 6f69 6420 746f 7272 656e if...void torren │ │ │ +000495b0: 743a 3a6f 6e5f 7065 6572 5f6e 616d 655f t::on_peer_name_ │ │ │ +000495c0: 6c6f 6f6b 7570 2865 7272 6f72 5f63 6f64 lookup(error_cod │ │ │ +000495d0: 6520 636f 6e73 7426 616d 703b 2065 0a09 e const& e.. │ │ │ +000495e0: 092c 2073 7464 3a3a 7665 6374 6f72 266c ., std::vector&l │ │ │ +000495f0: 743b 6164 6472 6573 7326 6774 3b20 636f t;address> co │ │ │ +00049600: 6e73 7426 616d 703b 2068 6f73 745f 6c69 nst& host_li │ │ │ +00049610: 7374 2c20 696e 7420 636f 6e73 7420 706f st, int const po │ │ │ +00049620: 7274 0a09 092c 2070 726f 746f 636f 6c5f rt..., protocol_ │ │ │ +00049630: 7665 7273 696f 6e20 636f 6e73 7420 7629 version const v) │ │ │ +00049640: 2074 7279 0a09 7b0a 0909 544f 5252 454e try..{...TORREN │ │ │ +00049650: 545f 4153 5345 5254 2869 735f 7369 6e67 T_ASSERT(is_sing │ │ │ +00049660: 6c65 5f74 6872 6561 6428 2929 3b0a 0a09 le_thread());... │ │ │ +00049670: 0949 4e56 4152 4941 4e54 5f43 4845 434b .INVARIANT_CHECK │ │ │ +00049680: 3b0a 0a09 0943 4f4d 504c 4554 455f 4153 ;....COMPLETE_AS │ │ │ +00049690: 594e 4328 2274 6f72 7265 6e74 3a3a 6f6e YNC("torrent::on │ │ │ +000496a0: 5f70 6565 725f 6e61 6d65 5f6c 6f6f 6b75 _peer_name_looku │ │ │ +000496b0: 7022 293b 0a0a 2369 666e 6465 6620 544f p");..#ifndef TO │ │ │ +000496c0: 5252 454e 545f 4449 5341 424c 455f 4c4f RRENT_DISABLE_LO │ │ │ +000496d0: 4747 494e 470a 0909 6966 2028 6520 2661 GGING...if (e &a │ │ │ +000496e0: 6d70 3b26 616d 703b 2073 686f 756c 645f mp;& should_ │ │ │ +000496f0: 6c6f 6728 2929 0a09 0909 6465 6275 675f log())....debug_ │ │ │ +00049700: 6c6f 6728 2270 6565 7220 6e61 6d65 206c log("peer name l │ │ │ +00049710: 6f6f 6b75 7020 6572 726f 723a 2025 7322 ookup error: %s" │ │ │ +00049720: 2c20 652e 6d65 7373 6167 6528 292e 635f , e.message().c_ │ │ │ +00049730: 7374 7228 2929 3b0a 2365 6e64 6966 0a0a str());.#endif.. │ │ │ +00049740: 0909 6966 2028 6520 7c7c 206d 5f61 626f ..if (e || m_abo │ │ │ +00049750: 7274 207c 7c20 686f 7374 5f6c 6973 742e rt || host_list. │ │ │ +00049760: 656d 7074 7928 2920 7c7c 206d 5f73 6573 empty() || m_ses │ │ │ +00049770: 2e69 735f 6162 6f72 7465 6428 2929 2072 .is_aborted()) r │ │ │ +00049780: 6574 7572 6e3b 0a0a 3c64 6976 2073 7479 eturn;..
    ..tcp::end │ │ │ +000497c0: 706f 696e 7420 686f 7374 2868 6f73 745f point host(host_ │ │ │ +000497d0: 6c69 7374 2e66 726f 6e74 2829 2c20 7374 list.front(), st │ │ │ +000497e0: 643a 3a75 696e 7431 365f 7428 706f 7274 d::uint16_t(port │ │ │ +000497f0: 2929 3b0a 3c2f 6469 763e 0a09 0969 6620 ));.
    ...if │ │ │ +00049800: 286d 5f69 705f 6669 6c74 6572 2026 616d (m_ip_filter &am │ │ │ +00049810: 703b 2661 6d70 3b20 6d5f 6970 5f66 696c p;& m_ip_fil │ │ │ +00049820: 7465 722d 2667 743b 6163 6365 7373 2868 ter->access(h │ │ │ +00049830: 6f73 742e 6164 6472 6573 7328 2929 2026 ost.address()) & │ │ │ +00049840: 616d 703b 2069 705f 6669 6c74 6572 3a3a amp; ip_filter:: │ │ │ +00049850: 626c 6f63 6b65 6429 0a09 097b 0a23 6966 blocked)...{.#if │ │ │ +00049860: 6e64 6566 2054 4f52 5245 4e54 5f44 4953 ndef TORRENT_DIS │ │ │ +00049870: 4142 4c45 5f4c 4f47 4749 4e47 0a09 0909 ABLE_LOGGING.... │ │ │ +00049880: 6966 2028 7368 6f75 6c64 5f6c 6f67 2829 if (should_log() │ │ │ +00049890: 290a 0909 097b 0a09 0909 0964 6562 7567 )....{.....debug │ │ │ +000498a0: 5f6c 6f67 2822 626c 6f63 6b65 6420 6970 _log("blocked ip │ │ │ +000498b0: 2066 726f 6d20 7472 6163 6b65 723a 2025 from tracker: % │ │ │ +000498c0: 7322 2c20 686f 7374 2e61 6464 7265 7373 s", host.address │ │ │ +000498d0: 2829 2e74 6f5f 7374 7269 6e67 2829 2e63 ().to_string().c │ │ │ +000498e0: 5f73 7472 2829 293b 0a09 0909 7d0a 2365 _str());....}.#e │ │ │ +000498f0: 6e64 6966 0a09 0909 6966 2028 6d5f 7365 ndif....if (m_se │ │ │ +00049900: 732e 616c 6572 7473 2829 2e73 686f 756c s.alerts().shoul │ │ │ +00049910: 645f 706f 7374 266c 743b 7065 6572 5f62 d_post<peer_b │ │ │ +00049920: 6c6f 636b 6564 5f61 6c65 7274 2667 743b locked_alert> │ │ │ +00049930: 2829 290a 0909 0909 6d5f 7365 732e 616c ()).....m_ses.al │ │ │ +00049940: 6572 7473 2829 2e65 6d70 6c61 6365 5f61 erts().emplace_a │ │ │ +00049950: 6c65 7274 266c 743b 7065 6572 5f62 6c6f lert<peer_blo │ │ │ +00049960: 636b 6564 5f61 6c65 7274 2667 743b 2867 cked_alert>(g │ │ │ +00049970: 6574 5f68 616e 646c 6528 290a 0909 0909 et_handle()..... │ │ │ +00049980: 092c 2068 6f73 742c 2070 6565 725f 626c ., host, peer_bl │ │ │ +00049990: 6f63 6b65 645f 616c 6572 743a 3a69 705f ocked_alert::ip_ │ │ │ +000499a0: 6669 6c74 6572 293b 0a09 0909 7265 7475 filter);....retu │ │ │ +000499b0: 726e 3b0a 0909 7d0a 0a09 0969 6620 2861 rn;...}....if (a │ │ │ +000499c0: 6464 5f70 6565 7228 686f 7374 2c20 7065 dd_peer(host, pe │ │ │ +000499d0: 6572 5f69 6e66 6f3a 3a74 7261 636b 6572 er_info::tracker │ │ │ +000499e0: 2c20 7620 3d3d 2070 726f 746f 636f 6c5f , v == protocol_ │ │ │ +000499f0: 7665 7273 696f 6e3a 3a56 3220 3f20 7065 version::V2 ? pe │ │ │ +00049a00: 785f 6c74 5f76 3220 3a20 7065 785f 666c x_lt_v2 : pex_fl │ │ │ +00049a10: 6167 735f 7428 3029 2929 0a09 097b 0a09 ags_t(0)))...{.. │ │ │ +00049a20: 0909 7374 6174 655f 7570 6461 7465 6428 ..state_updated( │ │ │ +00049a30: 293b 0a0a 2369 666e 6465 6620 544f 5252 );..#ifndef TORR │ │ │ +00049a40: 454e 545f 4449 5341 424c 455f 4c4f 4747 ENT_DISABLE_LOGG │ │ │ +00049a50: 494e 470a 0909 0969 6620 2873 686f 756c ING....if (shoul │ │ │ +00049a60: 645f 6c6f 6728 2929 0a09 0909 7b0a 0909 d_log())....{... │ │ │ +00049a70: 0909 6465 6275 675f 6c6f 6728 226e 616d ..debug_log("nam │ │ │ +00049a80: 652d 6c6f 6f6b 7570 2061 6464 5f70 6565 e-lookup add_pee │ │ │ +00049a90: 7228 2920 5b20 2573 205d 2063 6f6e 6e65 r() [ %s ] conne │ │ │ +00049aa0: 6374 2d63 616e 6469 6461 7465 733a 2025 ct-candidates: % │ │ │ +00049ab0: 6422 0a09 0909 0909 2c20 686f 7374 2e61 d"......, host.a │ │ │ +00049ac0: 6464 7265 7373 2829 2e74 6f5f 7374 7269 ddress().to_stri │ │ │ +00049ad0: 6e67 2829 2e63 5f73 7472 2829 0a09 0909 ng().c_str().... │ │ │ +00049ae0: 0909 2c20 6d5f 7065 6572 5f6c 6973 7420 .., m_peer_list │ │ │ +00049af0: 3f20 6d5f 7065 6572 5f6c 6973 742d 2667 ? m_peer_list-&g │ │ │ +00049b00: 743b 6e75 6d5f 636f 6e6e 6563 745f 6361 t;num_connect_ca │ │ │ +00049b10: 6e64 6964 6174 6573 2829 203a 202d 3129 ndidates() : -1) │ │ │ +00049b20: 3b0a 0909 097d 0a23 656e 6469 660a 0909 ;....}.#endif... │ │ │ +00049b30: 7d0a 0909 7570 6461 7465 5f77 616e 745f }...update_want_ │ │ │ +00049b40: 7065 6572 7328 293b 0a09 7d0a 3c2f 7072 peers();..}.
    rel │ │ │ +00049b80: 6576 616e 6365 266e 6273 703b 303c 2f74 evance 0
    ../src/to │ │ │ +00049bc0: 7272 656e 742e 6370 703a 3437 3030 3c2f rrent.cpp:4700only │ │ │ +00049be0: 646f 2074 6869 7320 6966 2074 6865 2070 do this if the p │ │ │ +00049bf0: 6965 6365 2073 697a 6520 3e20 3120 626c iece size > 1 bl │ │ │ +00049c00: 6f63 6b73 2054 6869 7320 6973 2061 2076 ocks This is a v │ │ │ +00049c10: 3220 746f 7272 656e 7420 736f 2077 6520 2 torrent so we │ │ │ +00049c20: 6361 6e20 7265 7175 6573 7420 6765 7420 can request get │ │ │ +00049c30: 626c 6f63 6b20 6c65 7665 6c20 6861 7368 block level hash │ │ │ +00049c40: 6573 2e3c 2f74 643e 3c2f 7472 3e3c 7472 es.

    only do this if │ │ │ +00049ca0: 2074 6865 2070 6965 6365 2073 697a 6520 the piece size │ │ │ +00049cb0: 3e20 3120 626c 6f63 6b73 0a54 6869 7320 > 1 blocks.This │ │ │ +00049cc0: 6973 2061 2076 3220 746f 7272 656e 7420 is a v2 torrent │ │ │ +00049cd0: 736f 2077 6520 6361 6e20 7265 7175 6573 so we can reques │ │ │ +00049ce0: 7420 6765 7420 626c 6f63 6b0a 6c65 7665 t get block.leve │ │ │ +00049cf0: 6c20 6861 7368 6573 2e3c 2f68 323e 3c68 l hashes.

    ../src/torrent │ │ │ +00049d10: 2e63 7070 3a34 3730 303c 2f68 343e 3c70 .cpp:4700

    ..{....s │ │ │ +00049d60: 7464 3a3a 7365 7426 6c74 3b74 6f72 7265 td::set<torre │ │ │ +00049d70: 6e74 5f70 6565 722a 2667 743b 2072 6574 nt_peer*> ret │ │ │ +00049d80: 3b0a 0909 0969 6620 2821 626c 6f63 6b73 ;....if (!blocks │ │ │ +00049d90: 2e65 6d70 7479 2829 2026 616d 703b 2661 .empty() &&a │ │ │ +00049da0: 6d70 3b20 2164 6f77 6e6c 6f61 6465 7273 mp; !downloaders │ │ │ +00049db0: 2e65 6d70 7479 2829 290a 0909 097b 0a09 .empty())....{.. │ │ │ +00049dc0: 0909 0966 6f72 2028 6175 746f 2063 6f6e ...for (auto con │ │ │ +00049dd0: 7374 2062 203a 2062 6c6f 636b 7329 2072 st b : blocks) r │ │ │ +00049de0: 6574 2e69 6e73 6572 7428 646f 776e 6c6f et.insert(downlo │ │ │ +00049df0: 6164 6572 735b 7374 643a 3a73 697a 655f aders[std::size_ │ │ │ +00049e00: 7428 6229 5d29 3b0a 0909 097d 0a09 0909 t(b)]);....}.... │ │ │ +00049e10: 656c 7365 0a09 0909 7b0a 0909 0909 7374 else....{.....st │ │ │ +00049e20: 643a 3a63 6f70 7928 646f 776e 6c6f 6164 d::copy(download │ │ │ +00049e30: 6572 732e 6265 6769 6e28 292c 2064 6f77 ers.begin(), dow │ │ │ +00049e40: 6e6c 6f61 6465 7273 2e65 6e64 2829 2c20 nloaders.end(), │ │ │ +00049e50: 7374 643a 3a69 6e73 6572 7465 7228 7265 std::inserter(re │ │ │ +00049e60: 742c 2072 6574 2e62 6567 696e 2829 2929 t, ret.begin())) │ │ │ +00049e70: 3b0a 0909 097d 0a09 0909 7265 7475 726e ;....}....return │ │ │ +00049e80: 2072 6574 3b0a 0909 7d28 293b 0a0a 0909 ret;...}();.... │ │ │ +00049e90: 2f2f 2069 6620 7468 6973 2070 6965 6365 // if this piece │ │ │ +00049ea0: 2077 6173 6e27 7420 646f 776e 6c6f 6164 wasn't download │ │ │ +00049eb0: 6564 2066 726f 6d20 7065 6572 732c 2077 ed from peers, w │ │ │ +00049ec0: 6520 6a75 7374 2066 6f75 6e64 2069 7420 e just found it │ │ │ +00049ed0: 6f6e 2064 6973 6b2e 0a09 092f 2f20 496e on disk....// In │ │ │ +00049ee0: 2074 6861 7420 6361 7365 2c20 7765 2073 that case, we s │ │ │ +00049ef0: 686f 756c 6420 6a75 7374 2063 6f6e 7369 hould just consi │ │ │ +00049f00: 6465 7220 6974 2061 7320 226e 6f74 2d68 der it as "not-h │ │ │ +00049f10: 6176 6522 2061 6e64 2074 6865 7265 2773 ave" and there's │ │ │ +00049f20: 206e 6f0a 0909 2f2f 206e 6565 6420 746f no...// need to │ │ │ +00049f30: 2074 7279 2074 6f20 6765 7420 6869 6768 try to get high │ │ │ +00049f40: 6572 2066 6964 656c 6974 7920 6861 7368 er fidelity hash │ │ │ +00049f50: 6573 2028 7965 7429 0a09 0962 6f6f 6c20 es (yet)...bool │ │ │ +00049f60: 636f 6e73 7420 666f 756e 645f 6f6e 5f64 const found_on_d │ │ │ +00049f70: 6973 6b20 3d20 7065 6572 732e 7369 7a65 isk = peers.size │ │ │ +00049f80: 2829 203d 3d20 3120 2661 6d70 3b26 616d () == 1 &&am │ │ │ +00049f90: 703b 2070 6565 7273 2e63 6f75 6e74 286e p; peers.count(n │ │ │ +00049fa0: 756c 6c70 7472 293b 0a0a 0909 6966 2028 ullptr);....if ( │ │ │ +00049fb0: 746f 7272 656e 745f 6669 6c65 2829 2e69 torrent_file().i │ │ │ +00049fc0: 6e66 6f5f 6861 7368 6573 2829 2e68 6173 nfo_hashes().has │ │ │ +00049fd0: 5f76 3228 2920 2661 6d70 3b26 616d 703b _v2() && │ │ │ +00049fe0: 2062 6c6f 636b 732e 656d 7074 7928 2920 blocks.empty() │ │ │ +00049ff0: 2661 6d70 3b26 616d 703b 2021 666f 756e && !foun │ │ │ +0004a000: 645f 6f6e 5f64 6973 6b29 0a09 097b 0a3c d_on_disk)...{.< │ │ │ +0004a010: 6469 7620 7374 796c 653d 2262 6163 6b67 div style="backg │ │ │ +0004a020: 726f 756e 643a 2023 6666 6666 3030 2220 round: #ffff00" │ │ │ +0004a030: 7769 6474 683d 2231 3030 2522 3e09 0909 width="100%">... │ │ │ +0004a040: 7665 7269 6679 5f62 6c6f 636b 5f68 6173 verify_block_has │ │ │ +0004a050: 6865 7328 696e 6465 7829 3b0a 3c2f 6469 hes(index);...}....// the │ │ │ +0004a070: 6265 6c6f 7720 636f 6465 2069 7320 7065 below code is pe │ │ │ +0004a080: 6e61 6c69 7a69 6e67 2070 6565 7273 2074 nalizing peers t │ │ │ +0004a090: 6861 7420 7365 6e74 2075 7365 2062 6164 hat sent use bad │ │ │ +0004a0a0: 2064 6174 612e 0a09 092f 2f20 696e 6372 data....// incr │ │ │ +0004a0b0: 6561 7365 2074 6865 2074 6f74 616c 2061 ease the total a │ │ │ +0004a0c0: 6d6f 756e 7420 6f66 2066 6169 6c65 6420 mount of failed │ │ │ +0004a0d0: 6279 7465 730a 0909 6966 2028 2166 6f75 bytes...if (!fou │ │ │ +0004a0e0: 6e64 5f6f 6e5f 6469 736b 290a 0909 7b0a nd_on_disk)...{. │ │ │ +0004a0f0: 0909 0969 6620 2862 6c6f 636b 732e 656d ...if (blocks.em │ │ │ +0004a100: 7074 7928 2929 0a09 0909 0961 6464 5f66 pty()).....add_f │ │ │ +0004a110: 6169 6c65 645f 6279 7465 7328 6d5f 746f ailed_bytes(m_to │ │ │ +0004a120: 7272 656e 745f 6669 6c65 2d26 6774 3b70 rrent_file->p │ │ │ +0004a130: 6965 6365 5f73 697a 6528 696e 6465 7829 iece_size(index) │ │ │ +0004a140: 293b 0a09 0909 656c 7365 0a09 0909 0961 );....else.....a │ │ │ +0004a150: 6464 5f66 6169 6c65 645f 6279 7465 7328 dd_failed_bytes( │ │ │ +0004a160: 7374 6174 6963 5f63 6173 7426 6c74 3b69 static_cast<i │ │ │ +0004a170: 6e74 2667 743b 2862 6c6f 636b 732e 7369 nt>(blocks.si │ │ │ +0004a180: 7a65 2829 2920 2a20 6465 6661 756c 745f ze()) * default_ │ │ │ +0004a190: 626c 6f63 6b5f 7369 7a65 293b 0a0a 2369 block_size);..#i │ │ │ +0004a1a0: 666e 6465 6620 544f 5252 454e 545f 4449 fndef TORRENT_DI │ │ │ +0004a1b0: 5341 424c 455f 4558 5445 4e53 494f 4e53 SABLE_EXTENSIONS │ │ │ +0004a1c0: 0a09 0909 666f 7220 2861 7574 6f26 616d ....for (auto&am │ │ │ +0004a1d0: 703b 2065 7874 203a 206d 5f65 7874 656e p; ext : m_exten │ │ │ +0004a1e0: 7369 6f6e 7329 0a09 0909 7b0a 0909 0909 sions)....{..... │ │ │ +0004a1f0: 6578 742d 2667 743b 6f6e 5f70 6965 6365 ext->on_piece │ │ │ +0004a200: 5f66 6169 6c65 6428 696e 6465 7829 3b0a _failed(index);. │ │ │ +0004a210: 0909 097d 0a23 656e 6469 660a 0a09 0909 ...}.#endif..... │ │ │ +0004a220: 2f2f 2064 6964 2077 6520 7265 6365 6976 // did we receiv │ │ │ +0004a230: 6520 7468 6973 2070 6965 6365 2066 726f e this piece fro │ │ │ +0004a240: 6d20 6120 7369 6e67 6c65 2070 6565 723f m a single peer? │ │ │ +0004a250: 0a09 0909 2f2f 2069 6620 7765 206b 6e6f ....// if we kno │ │ │ +0004a260: 7720 6578 6163 746c 7920 7768 6963 6820 w exactly which │ │ │ +0004a270: 626c 6f63 6b73 2066 6169 6c65 6420 7468 blocks failed th │ │ │ +0004a280: 6520 6861 7368 2c20 7765 2063 616e 2061 e hash, we can a │ │ │ +0004a290: 6c73 6f20 6265 2063 6572 7461 696e 0a09 lso be certain.. │ │ │ +0004a2a0: 0909 2f2f 2074 6861 7420 616c 6c20 7065 ..// that all pe │ │ │ +0004a2b0: 6572 7320 696e 2074 6865 206c 6973 7420 ers in the list │ │ │ +0004a2c0: 7365 6e74 2075 7320 6261 6420 6461 7461 sent us bad data │ │ │ +0004a2d0: 0a09 0909 626f 6f6c 2063 6f6e 7374 206b ....bool const k │ │ │ +0004a2e0: 6e6f 776e 5f62 6164 5f70 6565 7220 3d20 nown_bad_peer = │ │ │ +0004a2f0: 2821 666f 756e 645f 6f6e 5f64 6973 6b20 (!found_on_disk │ │ │ +0004a300: 2661 6d70 3b26 616d 703b 2070 6565 7273 && peers │ │ │ +0004a310: 2e73 697a 6528 2920 3d3d 2031 2920 7c7c .size() == 1) || │ │ │ +0004a320: 2021 626c 6f63 6b73 2e65 6d70 7479 2829 !blocks.empty() │ │ │ +0004a330: 3b0a 0a09 0909 7065 6e61 6c69 7a65 5f70 ;.....penalize_p │ │ │ +0004a340: 6565 7273 2870 6565 7273 2c20 696e 6465 eers(peers, inde │ │ │ +0004a350: 782c 206b 6e6f 776e 5f62 6164 5f70 6565 x, known_bad_pee │ │ │ +0004a360: 7229 3b0a 0909 7d0a 0a09 092f 2f20 4966 r);...}....// If │ │ │ +0004a370: 206d 5f73 746f 7261 6765 2069 736e 2774 m_storage isn't │ │ │ +0004a380: 2073 6574 2068 6572 652c 2069 7420 6d65 set here, it me │ │ │ +0004a390: 616e 7320 7765 2772 6520 7368 7574 7469 ans we're shutti │ │ │ +0004a3a0: 6e67 2064 6f77 6e0a 0909 6966 2028 6d5f ng down...if (m_ │ │ │ +0004a3b0: 7374 6f72 6167 6529 0a09 097b 0a09 0909 storage)...{.... │ │ │ +0004a3c0: 2f2f 2069 7420 646f 6573 6e27 7420 6d61 // it doesn't ma │ │ │ +0004a3d0: 6b65 206d 7563 6820 7365 6e73 6520 746f ke much sense to │ │ │ +0004a3e0: 2066 6169 6c20 746f 2068 6173 6820 6120 fail to hash a │ │ │ +0004a3f0: 7069 6563 650a 3c2f 7072 653e 3c2f 7464 piece.relevance │ │ │ +0004a430: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ +0004a440: 3c61 2068 7265 663d 226a 6176 6173 6372 ../src/torrent. │ │ │ +0004a470: 6370 703a 3736 3430 3c2f 613e 3c2f 7464 cpp:7640come up wit │ │ │ +0004a490: 6820 6120 6265 7474 6572 2077 6179 206f h a better way o │ │ │ +0004a4a0: 6620 646f 696e 6720 7468 6973 2c20 696e f doing this, in │ │ │ +0004a4b0: 7374 6561 6420 6f66 2061 6e20 696d 6d65 stead of an imme │ │ │ +0004a4c0: 6469 6174 656c 7920 696e 766f 6b65 6420 diately invoked │ │ │ +0004a4d0: 6c61 6d62 6461 2065 7870 7265 7373 696f lambda expressio │ │ │ +0004a4e0: 6e2e 3c2f 7464 3e3c 2f74 723e 3c74 7220 n.

    │ │ │ +0004a530: 636f 6d65 2075 7020 7769 7468 2061 2062 come up with a b │ │ │ +0004a540: 6574 7465 7220 7761 7920 6f66 2064 6f69 etter way of doi │ │ │ +0004a550: 6e67 2074 6869 732c 2069 6e73 7465 6164 ng this, instead │ │ │ +0004a560: 206f 6620 616e 0a69 6d6d 6564 6961 7465 of an.immediate │ │ │ +0004a570: 6c79 2069 6e76 6f6b 6564 206c 616d 6264 ly invoked lambd │ │ │ +0004a580: 6120 6578 7072 6573 7369 6f6e 2e3c 2f68 a expression.

    ../src/tor │ │ │ +0004a5a0: 7265 6e74 2e63 7070 3a37 3634 303c 2f68 rent.cpp:7640
    ....
    │ │ │ +0004a5f0: 097c 7c20 7065 6572 696e 666f 2d26 6774  .|| peerinfo->
    │ │ │ +0004a600: 3b63 6f6e 6669 726d 6564 5f73 7570 706f  ;confirmed_suppo
    │ │ │ +0004a610: 7274 735f 7574 7029 290a 0909 097b 0a09  rts_utp))....{..
    │ │ │ +0004a620: 0909 0973 6d20 3d20 6d5f 7365 732e 7574  ...sm = m_ses.ut
    │ │ │ +0004a630: 705f 736f 636b 6574 5f6d 616e 6167 6572  p_socket_manager
    │ │ │ +0004a640: 2829 3b0a 0909 097d 0a0a 0909 092f 2f20  ();....}.....// 
    │ │ │ +0004a650: 646f 6e27 7420 6d61 6b65 2061 2054 4350  don't make a TCP
    │ │ │ +0004a660: 2063 6f6e 6e65 6374 696f 6e20 6966 2069   connection if i
    │ │ │ +0004a670: 7427 7320 6469 7361 626c 6564 0a09 0909  t's disabled....
    │ │ │ +0004a680: 6966 2028 736d 203d 3d20 6e75 6c6c 7074  if (sm == nullpt
    │ │ │ +0004a690: 7220 2661 6d70 3b26 616d 703b 2021 7365  r && !se
    │ │ │ +0004a6a0: 7474 696e 6773 2829 2e67 6574 5f62 6f6f  ttings().get_boo
    │ │ │ +0004a6b0: 6c28 7365 7474 696e 6773 5f70 6163 6b3a  l(settings_pack:
    │ │ │ +0004a6c0: 3a65 6e61 626c 655f 6f75 7467 6f69 6e67  :enable_outgoing
    │ │ │ +0004a6d0: 5f74 6370 2929 0a09 0909 7b0a 2369 666e  _tcp))....{.#ifn
    │ │ │ +0004a6e0: 6465 6620 544f 5252 454e 545f 4449 5341  def TORRENT_DISA
    │ │ │ +0004a6f0: 424c 455f 4c4f 4747 494e 470a 0909 0909  BLE_LOGGING.....
    │ │ │ +0004a700: 6966 2028 7368 6f75 6c64 5f6c 6f67 2829  if (should_log()
    │ │ │ +0004a710: 290a 0909 0909 7b0a 0909 0909 0964 6562  ).....{......deb
    │ │ │ +0004a720: 7567 5f6c 6f67 2822 6469 7363 6172 6469  ug_log("discardi
    │ │ │ +0004a730: 6e67 2070 6565 7220 5c22 2573 5c22 3a20  ng peer \"%s\": 
    │ │ │ +0004a740: 5443 5020 636f 6e6e 6563 7469 6f6e 7320  TCP connections 
    │ │ │ +0004a750: 6469 7361 626c 6564 2022 0a09 0909 0909  disabled "......
    │ │ │ +0004a760: 0922 5b20 7375 7070 6f72 7473 2d75 7470  ."[ supports-utp
    │ │ │ +0004a770: 3a20 2564 205d 222c 2070 6565 7269 6e66  : %d ]", peerinf
    │ │ │ +0004a780: 6f2d 2667 743b 746f 5f73 7472 696e 6728  o->to_string(
    │ │ │ +0004a790: 292e 635f 7374 7228 290a 0909 0909 0909  ).c_str().......
    │ │ │ +0004a7a0: 2c20 7065 6572 696e 666f 2d26 6774 3b73  , peerinfo->s
    │ │ │ +0004a7b0: 7570 706f 7274 735f 7574 7029 3b0a 0909  upports_utp);...
    │ │ │ +0004a7c0: 0909 7d0a 2365 6e64 6966 0a09 0909 0972  ..}.#endif.....r
    │ │ │ +0004a7d0: 6574 7572 6e20 6661 6c73 653b 0a09 0909  eturn false;....
    │ │ │ +0004a7e0: 7d0a 0909 7d0a 0a3c 6469 7620 7374 796c  }...}..
    ..aux::sock │ │ │ +0004a820: 6574 5f74 7970 6520 7320 3d20 5b26 616d et_type s = [&am │ │ │ +0004a830: 703b 5d20 7b0a 3c2f 6469 763e 0a23 6966 p;] {.
    .#if │ │ │ +0004a840: 2054 4f52 5245 4e54 5f55 5345 5f49 3250 TORRENT_USE_I2P │ │ │ +0004a850: 0a09 0969 6620 2870 6565 7269 6e66 6f2d ...if (peerinfo- │ │ │ +0004a860: 2667 743b 6973 5f69 3270 5f61 6464 7229 >is_i2p_addr) │ │ │ +0004a870: 0a09 097b 0a09 0909 2f2f 2049 7427 7320 ...{....// It's │ │ │ +0004a880: 6e6f 7420 656e 7469 7265 6c79 206f 6276 not entirely obv │ │ │ +0004a890: 696f 7573 2077 6879 2074 6869 7320 7065 ious why this pe │ │ │ +0004a8a0: 6572 2063 6f6e 6e65 6374 696f 6e20 6973 er connection is │ │ │ +0004a8b0: 206e 6f74 206d 6172 6b65 6420 6173 0a09 not marked as.. │ │ │ +0004a8c0: 0909 2f2f 206f 6e65 2e20 5468 6520 6d61 ..// one. The ma │ │ │ +0004a8d0: 696e 2066 6561 7475 7265 206f 6620 6120 in feature of a │ │ │ +0004a8e0: 7065 6572 2063 6f6e 6e65 6374 696f 6e20 peer connection │ │ │ +0004a8f0: 6973 2074 6861 7420 7768 6574 6865 7220 is that whether │ │ │ +0004a900: 6f72 206e 6f74 2077 650a 0909 092f 2f20 or not we....// │ │ │ +0004a910: 7072 6f78 7920 6974 2069 7320 636f 6e66 proxy it is conf │ │ │ +0004a920: 6967 7572 6162 6c65 2e20 5768 656e 2077 igurable. When w │ │ │ +0004a930: 6520 7573 6520 6932 702c 2077 6520 7761 e use i2p, we wa │ │ │ +0004a940: 6e74 2074 6f20 616c 7761 7973 2070 726f nt to always pro │ │ │ +0004a950: 780a 0909 092f 2f20 6576 6572 7974 6869 x....// everythi │ │ │ +0004a960: 6e67 2076 6961 2069 3270 2e0a 0a09 0909 ng via i2p...... │ │ │ +0004a970: 6175 783a 3a70 726f 7879 5f73 6574 7469 aux::proxy_setti │ │ │ +0004a980: 6e67 7320 7072 6f78 793b 0a09 0909 7072 ngs proxy;....pr │ │ │ +0004a990: 6f78 792e 686f 7374 6e61 6d65 203d 2073 oxy.hostname = s │ │ │ +0004a9a0: 6574 7469 6e67 7328 292e 6765 745f 7374 ettings().get_st │ │ │ +0004a9b0: 7228 7365 7474 696e 6773 5f70 6163 6b3a r(settings_pack: │ │ │ +0004a9c0: 3a69 3270 5f68 6f73 746e 616d 6529 3b0a :i2p_hostname);. │ │ │ +0004a9d0: 0909 0970 726f 7879 2e70 6f72 7420 3d20 ...proxy.port = │ │ │ +0004a9e0: 7374 643a 3a75 696e 7431 365f 7428 7365 std::uint16_t(se │ │ │ +0004a9f0: 7474 696e 6773 2829 2e67 6574 5f69 6e74 ttings().get_int │ │ │ +0004aa00: 2873 6574 7469 6e67 735f 7061 636b 3a3a (settings_pack:: │ │ │ +0004aa10: 6932 705f 706f 7274 2929 3b0a 0909 0970 i2p_port));....p │ │ │ +0004aa20: 726f 7879 2e74 7970 6520 3d20 7365 7474 roxy.type = sett │ │ │ +0004aa30: 696e 6773 5f70 6163 6b3a 3a69 3270 5f70 ings_pack::i2p_p │ │ │ +0004aa40: 726f 7879 3b0a 0a09 0909 6175 783a 3a73 roxy;.....aux::s │ │ │ +0004aa50: 6f63 6b65 745f 7479 7065 2072 6574 203d ocket_type ret = │ │ │ +0004aa60: 2069 6e73 7461 6e74 6961 7465 5f63 6f6e instantiate_con │ │ │ +0004aa70: 6e65 6374 696f 6e28 6d5f 7365 732e 6765 nection(m_ses.ge │ │ │ +0004aa80: 745f 636f 6e74 6578 7428 290a 0909 0909 t_context()..... │ │ │ +0004aa90: 2c20 7072 6f78 792c 206e 756c 6c70 7472 , proxy, nullptr │ │ │ +0004aaa0: 2c20 6e75 6c6c 7074 722c 2066 616c 7365 , nullptr, false │ │ │ +0004aab0: 2c20 6661 6c73 6529 3b0a 0909 0969 3270 , false);....i2p │ │ │ +0004aac0: 5f73 7472 6561 6d26 616d 703b 2073 7472 _stream& str │ │ │ +0004aad0: 203d 2062 6f6f 7374 3a3a 6765 7426 6c74 = boost::get< │ │ │ +0004aae0: 3b69 3270 5f73 7472 6561 6d26 6774 3b28 ;i2p_stream>( │ │ │ +0004aaf0: 7265 7429 3b0a 0909 0973 7472 2e73 6574 ret);....str.set │ │ │ +0004ab00: 5f6c 6f63 616c 5f69 3270 5f65 6e64 706f _local_i2p_endpo │ │ │ +0004ab10: 696e 7428 6d5f 7365 732e 6c6f 6361 6c5f int(m_ses.local_ │ │ │ +0004ab20: 6932 705f 656e 6470 6f69 6e74 2829 293b i2p_endpoint()); │ │ │ +0004ab30: 0a09 0909 7374 722e 7365 745f 6465 7374 ....str.set_dest │ │ │ +0004ab40: 696e 6174 696f 6e28 7374 6174 6963 5f63 ination(static_c │ │ │ +0004ab50: 6173 7426 6c74 3b69 3270 5f70 6565 722a ast<i2p_peer* │ │ │ +0004ab60: 2667 743b 2870 6565 7269 6e66 6f29 2d26 >(peerinfo)-& │ │ │ +0004ab70: 6774 3b64 6573 7428 2929 3b0a 0909 0973 gt;dest());....s │ │ │ +0004ab80: 7472 2e73 6574 5f63 6f6d 6d61 6e64 2869 tr.set_command(i │ │ │ +0004ab90: 3270 5f73 7472 6561 6d3a 3a63 6d64 5f63 2p_stream::cmd_c │ │ │ +0004aba0: 6f6e 6e65 6374 293b 0a09 0909 7374 722e onnect);....str. │ │ │ +0004abb0: 7365 745f 7365 7373 696f 6e5f 6964 286d set_session_id(m │ │ │ +0004abc0: 5f73 6573 2e69 3270 5f73 6573 7369 6f6e _ses.i2p_session │ │ │ +0004abd0: 2829 293b 0a09 0909 7265 7475 726e 2072 ());....return r │ │ │ +0004abe0: 6574 3b0a 0909 7d0a 0909 656c 7365 0a23 et;...}...else.# │ │ │ +0004abf0: 656e 6469 660a 0909 7b0a 0909 0976 6f69 endif...{....voi │ │ │ +0004ac00: 642a 2075 7365 7264 6174 6120 3d20 6e75 d* userdata = nu │ │ │ +0004ac10: 6c6c 7074 723b 0a23 6966 6465 6620 544f llptr;.#ifdef TO │ │ │ +0004ac20: 5252 454e 545f 5353 4c5f 5045 4552 530a RRENT_SSL_PEERS. │ │ │ +0004ac30: 0909 0969 6620 2869 735f 7373 6c5f 746f ...if (is_ssl_to │ │ │ +0004ac40: 7272 656e 7428 2929 0a09 0909 7b0a 3c2f rrent())....{.r │ │ │ +0004ac80: 656c 6576 616e 6365 266e 6273 703b 303c elevance 0< │ │ │ +0004ac90: 2f74 643e 3c74 643e 3c61 2068 7265 663d /td>../src/ │ │ │ +0004acc0: 746f 7272 656e 742e 6370 703a 3932 3531 torrent.cpp:9251 │ │ │ +0004acd0: 3c2f 613e 3c2f 7464 3e3c 7464 3e70 6572 per │ │ │ +0004ace0: 6861 7073 2030 2073 686f 756c 6420 6163 haps 0 should ac │ │ │ +0004acf0: 7475 616c 6c79 206d 6561 6e20 303c 2f74 tually mean 0

    perha │ │ │ +0004ad50: 7073 2030 2073 686f 756c 6420 6163 7475 ps 0 should actu │ │ │ +0004ad60: 616c 6c79 206d 6561 6e20 303c 2f68 323e ally mean 0

    │ │ │ +0004ad70: 3c68 343e 2e2e 2f73 7263 2f74 6f72 7265

    ../src/torre │ │ │ +0004ad80: 6e74 2e63 7070 3a39 3235 313c 2f68 343e nt.cpp:9251

    │ │ │ +0004ad90: 3c70 7265 2073 7479 6c65 3d22 6261 636b
    ..// f
    │ │ │ +0004add0: 696e 6973 6865 6420 746f 7272 656e 7473  inished torrents
    │ │ │ +0004ade0: 206d 6179 206e 6f74 2063 6861 6e67 6520   may not change 
    │ │ │ +0004adf0: 7468 6569 7220 7175 6575 6520 706f 7369  their queue posi
    │ │ │ +0004ae00: 7469 6f6e 732c 2061 7320 6974 2773 2073  tions, as it's s
    │ │ │ +0004ae10: 6574 2074 6f0a 0909 2f2f 202d 310a 0909  et to...// -1...
    │ │ │ +0004ae20: 6966 2028 286d 5f61 626f 7274 207c 7c20  if ((m_abort || 
    │ │ │ +0004ae30: 6973 5f66 696e 6973 6865 6428 2929 2026  is_finished()) &
    │ │ │ +0004ae40: 616d 703b 2661 6d70 3b20 7020 213d 206e  amp;& p != n
    │ │ │ +0004ae50: 6f5f 706f 7329 2072 6574 7572 6e3b 0a0a  o_pos) return;..
    │ │ │ +0004ae60: 0909 544f 5252 454e 545f 4153 5345 5254  ..TORRENT_ASSERT
    │ │ │ +0004ae70: 2828 7020 3d3d 206e 6f5f 706f 7329 203d  ((p == no_pos) =
    │ │ │ +0004ae80: 3d20 6973 5f66 696e 6973 6865 6428 290a  = is_finished().
    │ │ │ +0004ae90: 0909 097c 7c20 2821 6d5f 6175 746f 5f6d  ...|| (!m_auto_m
    │ │ │ +0004aea0: 616e 6167 6564 2026 616d 703b 2661 6d70  anaged &&
    │ │ │ +0004aeb0: 3b20 7020 3d3d 206e 6f5f 706f 7329 0a09  ; p == no_pos)..
    │ │ │ +0004aec0: 0909 7c7c 2028 6d5f 6162 6f72 7420 2661  ..|| (m_abort &a
    │ │ │ +0004aed0: 6d70 3b26 616d 703b 2070 203d 3d20 6e6f  mp;& p == no
    │ │ │ +0004aee0: 5f70 6f73 290a 0909 097c 7c20 2821 6d5f  _pos)....|| (!m_
    │ │ │ +0004aef0: 6164 6465 6420 2661 6d70 3b26 616d 703b  added &&
    │ │ │ +0004af00: 2070 203d 3d20 6e6f 5f70 6f73 2929 3b0a   p == no_pos));.
    │ │ │ +0004af10: 0909 6966 2028 7020 3d3d 206d 5f73 6571  ..if (p == m_seq
    │ │ │ +0004af20: 7565 6e63 655f 6e75 6d62 6572 2920 7265  uence_number) re
    │ │ │ +0004af30: 7475 726e 3b0a 0a09 0954 4f52 5245 4e54  turn;....TORRENT
    │ │ │ +0004af40: 5f41 5353 4552 5428 7020 2667 743b 3d20  _ASSERT(p >= 
    │ │ │ +0004af50: 6e6f 5f70 6f73 293b 0a0a 0909 7374 6174  no_pos);....stat
    │ │ │ +0004af60: 655f 7570 6461 7465 6428 293b 0a0a 0909  e_updated();....
    │ │ │ +0004af70: 6d5f 7365 732e 7365 745f 7175 6575 655f  m_ses.set_queue_
    │ │ │ +0004af80: 706f 7369 7469 6f6e 2874 6869 732c 2070  position(this, p
    │ │ │ +0004af90: 293b 0a09 7d0a 0a09 766f 6964 2074 6f72  );..}...void tor
    │ │ │ +0004afa0: 7265 6e74 3a3a 7365 745f 6d61 785f 7570  rent::set_max_up
    │ │ │ +0004afb0: 6c6f 6164 7328 696e 7420 6c69 6d69 742c  loads(int limit,
    │ │ │ +0004afc0: 2062 6f6f 6c20 636f 6e73 7420 7374 6174   bool const stat
    │ │ │ +0004afd0: 655f 7570 6461 7465 290a 097b 0a09 0954  e_update)..{...T
    │ │ │ +0004afe0: 4f52 5245 4e54 5f41 5353 4552 5428 6973  ORRENT_ASSERT(is
    │ │ │ +0004aff0: 5f73 696e 676c 655f 7468 7265 6164 2829  _single_thread()
    │ │ │ +0004b000: 293b 0a3c 6469 7620 7374 796c 653d 2262  );.
    ..if (limit < │ │ │ +0004b040: 3b3d 2030 2920 6c69 6d69 7420 3d20 2831 ;= 0) limit = (1 │ │ │ +0004b050: 2026 6c74 3b26 6c74 3b20 3234 2920 2d20 << 24) - │ │ │ +0004b060: 313b 0a3c 2f64 6976 3e09 0969 6620 2869 1;.
    ..if (i │ │ │ +0004b070: 6e74 286d 5f6d 6178 5f75 706c 6f61 6473 nt(m_max_uploads │ │ │ +0004b080: 2920 3d3d 206c 696d 6974 2920 7265 7475 ) == limit) retu │ │ │ +0004b090: 726e 3b0a 0909 6966 2028 7374 6174 655f rn;...if (state_ │ │ │ +0004b0a0: 7570 6461 7465 2920 7374 6174 655f 7570 update) state_up │ │ │ +0004b0b0: 6461 7465 6428 293b 0a09 096d 5f6d 6178 dated();...m_max │ │ │ +0004b0c0: 5f75 706c 6f61 6473 203d 2061 7578 3a3a _uploads = aux:: │ │ │ +0004b0d0: 6e75 6d65 7269 635f 6361 7374 266c 743b numeric_cast< │ │ │ +0004b0e0: 7374 643a 3a75 696e 7433 325f 7426 6774 std::uint32_t> │ │ │ +0004b0f0: 3b28 6c69 6d69 7429 3b0a 2369 666e 6465 ;(limit);.#ifnde │ │ │ +0004b100: 6620 544f 5252 454e 545f 4449 5341 424c f TORRENT_DISABL │ │ │ +0004b110: 455f 4c4f 4747 494e 470a 0909 6966 2028 E_LOGGING...if ( │ │ │ +0004b120: 7368 6f75 6c64 5f6c 6f67 2829 2026 616d should_log() &am │ │ │ +0004b130: 703b 2661 6d70 3b20 7374 6174 655f 7570 p;& state_up │ │ │ +0004b140: 6461 7465 290a 0909 0964 6562 7567 5f6c date)....debug_l │ │ │ +0004b150: 6f67 2822 2a2a 2a20 7365 742d 6d61 782d og("*** set-max- │ │ │ +0004b160: 7570 6c6f 6164 733a 2025 6422 2c20 6d5f uploads: %d", m_ │ │ │ +0004b170: 6d61 785f 7570 6c6f 6164 7329 3b0a 2365 max_uploads);.#e │ │ │ +0004b180: 6e64 6966 0a0a 0909 6966 2028 7374 6174 ndif....if (stat │ │ │ +0004b190: 655f 7570 6461 7465 290a 0909 0973 6574 e_update)....set │ │ │ +0004b1a0: 5f6e 6565 645f 7361 7665 5f72 6573 756d _need_save_resum │ │ │ +0004b1b0: 6528 746f 7272 656e 745f 6861 6e64 6c65 e(torrent_handle │ │ │ +0004b1c0: 3a3a 6966 5f63 6f6e 6669 675f 6368 616e ::if_config_chan │ │ │ +0004b1d0: 6765 6429 3b0a 097d 0a0a 0976 6f69 6420 ged);..}...void │ │ │ +0004b1e0: 746f 7272 656e 743a 3a73 6574 5f6d 6178 torrent::set_max │ │ │ +0004b1f0: 5f63 6f6e 6e65 6374 696f 6e73 2869 6e74 _connections(int │ │ │ +0004b200: 206c 696d 6974 2c20 626f 6f6c 2063 6f6e limit, bool con │ │ │ +0004b210: 7374 2073 7461 7465 5f75 7064 6174 6529 st state_update) │ │ │ +0004b220: 0a09 7b0a 0909 544f 5252 454e 545f 4153 ..{...TORRENT_AS │ │ │ +0004b230: 5345 5254 2869 735f 7369 6e67 6c65 5f74 SERT(is_single_t │ │ │ +0004b240: 6872 6561 6428 2929 3b0a 3c2f 7072 653e hread());.
    │ │ │ +0004b250: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ +0004b280: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ +0004b290: 3c74 643e 3c61 2068 7265 663d 226a 6176 ../src/torr │ │ │ +0004b2c0: 656e 742e 6370 703a 3932 3638 3c2f 613e ent.cpp:9268 │ │ │ +0004b2d0: 3c2f 7464 3e3c 7464 3e70 6572 6861 7073 perhaps │ │ │ +0004b2e0: 2030 2073 686f 756c 6420 6163 7475 616c 0 should actual │ │ │ +0004b2f0: 6c79 206d 6561 6e20 303c 2f74 643e 3c2f ly mean 0

    perhaps 0 │ │ │ +0004b350: 2073 686f 756c 6420 6163 7475 616c 6c79 should actually │ │ │ +0004b360: 206d 6561 6e20 303c 2f68 323e 3c68 343e mean 0

    │ │ │ +0004b370: 2e2e 2f73 7263 2f74 6f72 7265 6e74 2e63 ../src/torrent.c │ │ │ +0004b380: 7070 3a39 3236 383c 2f68 343e 3c70 7265 pp:9268

    ..void tor
    │ │ │ +0004b3d0: 7265 6e74 3a3a 7365 745f 6d61 785f 7570  rent::set_max_up
    │ │ │ +0004b3e0: 6c6f 6164 7328 696e 7420 6c69 6d69 742c  loads(int limit,
    │ │ │ +0004b3f0: 2062 6f6f 6c20 636f 6e73 7420 7374 6174   bool const stat
    │ │ │ +0004b400: 655f 7570 6461 7465 290a 097b 0a09 0954  e_update)..{...T
    │ │ │ +0004b410: 4f52 5245 4e54 5f41 5353 4552 5428 6973  ORRENT_ASSERT(is
    │ │ │ +0004b420: 5f73 696e 676c 655f 7468 7265 6164 2829  _single_thread()
    │ │ │ +0004b430: 293b 0a09 0969 6620 286c 696d 6974 2026  );...if (limit &
    │ │ │ +0004b440: 6c74 3b3d 2030 2920 6c69 6d69 7420 3d20  lt;= 0) limit = 
    │ │ │ +0004b450: 2831 2026 6c74 3b26 6c74 3b20 3234 2920  (1 << 24) 
    │ │ │ +0004b460: 2d20 313b 0a09 0969 6620 2869 6e74 286d  - 1;...if (int(m
    │ │ │ +0004b470: 5f6d 6178 5f75 706c 6f61 6473 2920 3d3d  _max_uploads) ==
    │ │ │ +0004b480: 206c 696d 6974 2920 7265 7475 726e 3b0a   limit) return;.
    │ │ │ +0004b490: 0909 6966 2028 7374 6174 655f 7570 6461  ..if (state_upda
    │ │ │ +0004b4a0: 7465 2920 7374 6174 655f 7570 6461 7465  te) state_update
    │ │ │ +0004b4b0: 6428 293b 0a09 096d 5f6d 6178 5f75 706c  d();...m_max_upl
    │ │ │ +0004b4c0: 6f61 6473 203d 2061 7578 3a3a 6e75 6d65  oads = aux::nume
    │ │ │ +0004b4d0: 7269 635f 6361 7374 266c 743b 7374 643a  ric_cast<std:
    │ │ │ +0004b4e0: 3a75 696e 7433 325f 7426 6774 3b28 6c69  :uint32_t>(li
    │ │ │ +0004b4f0: 6d69 7429 3b0a 2369 666e 6465 6620 544f  mit);.#ifndef TO
    │ │ │ +0004b500: 5252 454e 545f 4449 5341 424c 455f 4c4f  RRENT_DISABLE_LO
    │ │ │ +0004b510: 4747 494e 470a 0909 6966 2028 7368 6f75  GGING...if (shou
    │ │ │ +0004b520: 6c64 5f6c 6f67 2829 2026 616d 703b 2661  ld_log() &&a
    │ │ │ +0004b530: 6d70 3b20 7374 6174 655f 7570 6461 7465  mp; state_update
    │ │ │ +0004b540: 290a 0909 0964 6562 7567 5f6c 6f67 2822  )....debug_log("
    │ │ │ +0004b550: 2a2a 2a20 7365 742d 6d61 782d 7570 6c6f  *** set-max-uplo
    │ │ │ +0004b560: 6164 733a 2025 6422 2c20 6d5f 6d61 785f  ads: %d", m_max_
    │ │ │ +0004b570: 7570 6c6f 6164 7329 3b0a 2365 6e64 6966  uploads);.#endif
    │ │ │ +0004b580: 0a0a 0909 6966 2028 7374 6174 655f 7570  ....if (state_up
    │ │ │ +0004b590: 6461 7465 290a 0909 0973 6574 5f6e 6565  date)....set_nee
    │ │ │ +0004b5a0: 645f 7361 7665 5f72 6573 756d 6528 746f  d_save_resume(to
    │ │ │ +0004b5b0: 7272 656e 745f 6861 6e64 6c65 3a3a 6966  rrent_handle::if
    │ │ │ +0004b5c0: 5f63 6f6e 6669 675f 6368 616e 6765 6429  _config_changed)
    │ │ │ +0004b5d0: 3b0a 097d 0a0a 0976 6f69 6420 746f 7272  ;..}...void torr
    │ │ │ +0004b5e0: 656e 743a 3a73 6574 5f6d 6178 5f63 6f6e  ent::set_max_con
    │ │ │ +0004b5f0: 6e65 6374 696f 6e73 2869 6e74 206c 696d  nections(int lim
    │ │ │ +0004b600: 6974 2c20 626f 6f6c 2063 6f6e 7374 2073  it, bool const s
    │ │ │ +0004b610: 7461 7465 5f75 7064 6174 6529 0a09 7b0a  tate_update)..{.
    │ │ │ +0004b620: 0909 544f 5252 454e 545f 4153 5345 5254  ..TORRENT_ASSERT
    │ │ │ +0004b630: 2869 735f 7369 6e67 6c65 5f74 6872 6561  (is_single_threa
    │ │ │ +0004b640: 6428 2929 3b0a 3c64 6976 2073 7479 6c65  d());.
    ..if (limit │ │ │ +0004b680: 266c 743b 3d20 3029 206c 696d 6974 203d <= 0) limit = │ │ │ +0004b690: 2028 3120 266c 743b 266c 743b 2032 3429 (1 << 24) │ │ │ +0004b6a0: 202d 2031 3b0a 3c2f 6469 763e 0909 6966 - 1;.
    ..if │ │ │ +0004b6b0: 2028 696e 7428 6d5f 6d61 785f 636f 6e6e (int(m_max_conn │ │ │ +0004b6c0: 6563 7469 6f6e 7329 203d 3d20 6c69 6d69 ections) == limi │ │ │ +0004b6d0: 7429 2072 6574 7572 6e3b 0a09 0969 6620 t) return;...if │ │ │ +0004b6e0: 2873 7461 7465 5f75 7064 6174 6529 2073 (state_update) s │ │ │ +0004b6f0: 7461 7465 5f75 7064 6174 6564 2829 3b0a tate_updated();. │ │ │ +0004b700: 0909 6d5f 6d61 785f 636f 6e6e 6563 7469 ..m_max_connecti │ │ │ +0004b710: 6f6e 7320 3d20 6175 783a 3a6e 756d 6572 ons = aux::numer │ │ │ +0004b720: 6963 5f63 6173 7426 6c74 3b73 7464 3a3a ic_cast<std:: │ │ │ +0004b730: 7569 6e74 3332 5f74 2667 743b 286c 696d uint32_t>(lim │ │ │ +0004b740: 6974 293b 0a09 0975 7064 6174 655f 7761 it);...update_wa │ │ │ +0004b750: 6e74 5f70 6565 7273 2829 3b0a 0a23 6966 nt_peers();..#if │ │ │ +0004b760: 6e64 6566 2054 4f52 5245 4e54 5f44 4953 ndef TORRENT_DIS │ │ │ +0004b770: 4142 4c45 5f4c 4f47 4749 4e47 0a09 0969 ABLE_LOGGING...i │ │ │ +0004b780: 6620 2873 686f 756c 645f 6c6f 6728 2920 f (should_log() │ │ │ +0004b790: 2661 6d70 3b26 616d 703b 2073 7461 7465 && state │ │ │ +0004b7a0: 5f75 7064 6174 6529 0a09 0909 6465 6275 _update)....debu │ │ │ +0004b7b0: 675f 6c6f 6728 222a 2a2a 2073 6574 2d6d g_log("*** set-m │ │ │ +0004b7c0: 6178 2d63 6f6e 6e65 6374 696f 6e73 3a20 ax-connections: │ │ │ +0004b7d0: 2564 222c 206d 5f6d 6178 5f63 6f6e 6e65 %d", m_max_conne │ │ │ +0004b7e0: 6374 696f 6e73 293b 0a23 656e 6469 660a ctions);.#endif. │ │ │ +0004b7f0: 0a09 0969 6620 286e 756d 5f70 6565 7273 ...if (num_peers │ │ │ +0004b800: 2829 2026 6774 3b20 696e 7428 6d5f 6d61 () > int(m_ma │ │ │ +0004b810: 785f 636f 6e6e 6563 7469 6f6e 7329 290a x_connections)). │ │ │ +0004b820: 0909 7b0a 0909 0964 6973 636f 6e6e 6563 ..{....disconnec │ │ │ +0004b830: 745f 7065 6572 7328 6e75 6d5f 7065 6572 t_peers(num_peer │ │ │ +0004b840: 7328 2920 2d20 6d5f 6d61 785f 636f 6e6e s() - m_max_conn │ │ │ +0004b850: 6563 7469 6f6e 730a 0909 0909 2c20 6572 ections....., er │ │ │ +0004b860: 726f 7273 3a3a 746f 6f5f 6d61 6e79 5f63 rors::too_many_c │ │ │ +0004b870: 6f6e 6e65 6374 696f 6e73 293b 0a09 097d onnections);...} │ │ │ +0004b880: 0a0a 0909 6966 2028 7374 6174 655f 7570 ....if (state_up │ │ │ +0004b890: 6461 7465 290a 0909 0973 6574 5f6e 6565 date)....set_nee │ │ │ +0004b8a0: 645f 7361 7665 5f72 6573 756d 6528 746f d_save_resume(to │ │ │ +0004b8b0: 7272 656e 745f 6861 6e64 6c65 3a3a 6966 rrent_handle::if │ │ │ +0004b8c0: 5f63 6f6e 6669 675f 6368 616e 6765 6429 _config_changed) │ │ │ +0004b8d0: 3b0a 097d 0a0a 0976 6f69 6420 746f 7272 ;..}...void torr │ │ │ +0004b8e0: 656e 743a 3a73 6574 5f75 706c 6f61 645f ent::set_upload_ │ │ │ +0004b8f0: 6c69 6d69 7428 696e 7420 636f 6e73 7420 limit(int const │ │ │ +0004b900: 6c69 6d69 7429 0a09 7b0a 0909 7365 745f limit)..{...set_ │ │ │ +0004b910: 6c69 6d69 745f 696d 706c 286c 696d 6974 limit_impl(limit │ │ │ +0004b920: 2c20 7065 6572 5f63 6f6e 6e65 6374 696f , peer_connectio │ │ │ +0004b930: 6e3a 3a75 706c 6f61 645f 6368 616e 6e65 n::upload_channe │ │ │ +0004b940: 6c29 3b0a 2369 666e 6465 6620 544f 5252 l);.#ifndef TORR │ │ │ +0004b950: 454e 545f 4449 5341 424c 455f 4c4f 4747 ENT_DISABLE_LOGG │ │ │ +0004b960: 494e 470a 0909 6465 6275 675f 6c6f 6728 ING...debug_log( │ │ │ +0004b970: 222a 2a2a 2073 6574 2d75 706c 6f61 642d "*** set-upload- │ │ │ +0004b980: 6c69 6d69 743a 2025 6422 2c20 6c69 6d69 limit: %d", limi │ │ │ +0004b990: 7429 3b0a 2365 6e64 6966 0a09 7d0a 0a09 t);.#endif..}... │ │ │ +0004b9a0: 766f 6964 2074 6f72 7265 6e74 3a3a 7365 void torrent::se │ │ │ +0004b9b0: 745f 646f 776e 6c6f 6164 5f6c 696d 6974 t_download_limit │ │ │ +0004b9c0: 2869 6e74 2063 6f6e 7374 206c 696d 6974 (int const limit │ │ │ +0004b9d0: 290a 097b 0a3c 2f70 7265 3e3c 2f74 643e )..{.
    │ │ │ +0004b9e0: 3c2f 7472 3e3c 7472 2073 7479 6c65 3d22 relevance& │ │ │ +0004ba10: 6e62 7370 3b30 3c2f 7464 3e3c 7464 3e3c nbsp;0< │ │ │ +0004ba20: 6120 6872 6566 3d22 6a61 7661 7363 7269 a href="javascri │ │ │ +0004ba30: 7074 3a65 7870 616e 6428 3138 3129 223e pt:expand(181)"> │ │ │ +0004ba40: 2e2e 2f73 7263 2f74 6f72 7265 6e74 2e63 ../src/torrent.c │ │ │ +0004ba50: 7070 3a31 3132 3238 3c2f 613e 3c2f 7464 pp:11228instead of │ │ │ +0004ba70: 7265 736f 7274 696e 6720 7468 6520 7768 resorting the wh │ │ │ +0004ba80: 6f6c 6520 6c69 7374 2c20 696e 7365 7274 ole list, insert │ │ │ +0004ba90: 2074 6865 2070 6565 7273 2064 6972 6563 the peers direc │ │ │ +0004baa0: 746c 7920 696e 746f 2074 6865 2072 6967 tly into the rig │ │ │ +0004bab0: 6874 2070 6c61 6365 3c2f 7464 3e3c 2f74 ht place

    instead of │ │ │ +0004bb10: 2072 6573 6f72 7469 6e67 2074 6865 2077 resorting the w │ │ │ +0004bb20: 686f 6c65 206c 6973 742c 2069 6e73 6572 hole list, inser │ │ │ +0004bb30: 7420 7468 6520 7065 6572 730a 6469 7265 t the peers.dire │ │ │ +0004bb40: 6374 6c79 2069 6e74 6f20 7468 6520 7269 ctly into the ri │ │ │ +0004bb50: 6768 7420 706c 6163 653c 2f68 323e 3c68 ght place

    ../src/torrent │ │ │ +0004bb70: 2e63 7070 3a31 3132 3238 3c2f 6834 3e3c .cpp:11228

    < │ │ │ +0004bb80: 7072 6520 7374 796c 653d 2262 6163 6b67 pre style="backg │ │ │ +0004bb90: 726f 756e 643a 2023 6636 6636 6636 3b20 round: #f6f6f6; │ │ │ +0004bba0: 626f 7264 6572 3a20 736f 6c69 6420 3170 border: solid 1p │ │ │ +0004bbb0: 7820 2364 6464 3b22 3e09 0909 0973 7464 x #ddd;">....std │ │ │ +0004bbc0: 3a3a 7072 696e 7466 2822 7469 6d65 6420 ::printf("timed │ │ │ +0004bbd0: 6f75 7420 5b61 7665 7261 6765 2d70 6965 out [average-pie │ │ │ +0004bbe0: 6365 2d74 696d 653a 2025 6420 6d73 205d ce-time: %d ms ] │ │ │ +0004bbf0: 5c6e 220a 0909 0909 092c 206d 5f61 7665 \n"......, m_ave │ │ │ +0004bc00: 7261 6765 5f70 6965 6365 5f74 696d 6529 rage_piece_time) │ │ │ +0004bc10: 3b0a 2365 6e64 6966 0a09 0909 7d0a 0a09 ;.#endif....}... │ │ │ +0004bc20: 0909 2f2f 2070 6963 6b20 616c 6c20 626c ..// pick all bl │ │ │ +0004bc30: 6f63 6b73 2066 6f72 2074 6869 7320 7069 ocks for this pi │ │ │ +0004bc40: 6563 652e 2074 6865 2070 6565 7273 206c ece. the peers l │ │ │ +0004bc50: 6973 7420 6973 206b 6570 7420 7570 2074 ist is kept up t │ │ │ +0004bc60: 6f20 6461 7465 0a09 0909 2f2f 2061 6e64 o date....// and │ │ │ +0004bc70: 2073 6f72 7465 642e 2077 6865 6e20 7765 sorted. when we │ │ │ +0004bc80: 2069 7373 7565 2061 2072 6571 7565 7374 issue a request │ │ │ +0004bc90: 2074 6f20 6120 7065 6572 2c20 6974 7320 to a peer, its │ │ │ +0004bca0: 646f 776e 6c6f 6164 2071 7565 7565 0a09 download queue.. │ │ │ +0004bcb0: 0909 2f2f 2074 696d 6520 7769 6c6c 2069 ..// time will i │ │ │ +0004bcc0: 6e63 7265 6173 6520 616e 6420 6974 206d ncrease and it m │ │ │ +0004bcd0: 6179 206e 6565 6420 746f 2062 6520 6275 ay need to be bu │ │ │ +0004bce0: 6d70 6564 2069 6e20 7468 6520 7065 6572 mped in the peer │ │ │ +0004bcf0: 7320 6c69 7374 2c0a 0909 092f 2f20 7369 s list,....// si │ │ │ +0004bd00: 6e63 6520 6974 2773 206f 7264 6572 6564 nce it's ordered │ │ │ +0004bd10: 2062 7920 646f 776e 6c6f 6164 2071 7565 by download que │ │ │ +0004bd20: 7565 2074 696d 650a 0909 0970 6963 6b5f ue time....pick_ │ │ │ +0004bd30: 7469 6d65 5f63 7269 7469 6361 6c5f 626c time_critical_bl │ │ │ +0004bd40: 6f63 6b28 7065 6572 732c 2069 676e 6f72 ock(peers, ignor │ │ │ +0004bd50: 655f 7065 6572 730a 0909 0909 2c20 7065 e_peers....., pe │ │ │ +0004bd60: 6572 735f 7769 7468 5f72 6571 7565 7374 ers_with_request │ │ │ +0004bd70: 730a 0909 0909 2c20 7069 2c20 2661 6d70 s....., pi, & │ │ │ +0004bd80: 3b69 2c20 6d5f 7069 636b 6572 2e67 6574 ;i, m_picker.get │ │ │ +0004bd90: 2829 0a09 0909 092c 2062 6c6f 636b 735f ()....., blocks_ │ │ │ +0004bda0: 696e 5f70 6965 6365 2c20 7469 6d65 645f in_piece, timed_ │ │ │ +0004bdb0: 6f75 7429 3b0a 0a09 0909 2f2f 2070 7574 out);.....// put │ │ │ +0004bdc0: 2062 6163 6b20 7468 6520 7065 6572 7320 back the peers │ │ │ +0004bdd0: 7765 2069 676e 6f72 6564 2069 6e74 6f20 we ignored into │ │ │ +0004bde0: 7468 6520 7065 6572 206c 6973 7420 666f the peer list fo │ │ │ +0004bdf0: 7220 7468 6520 6e65 7874 2070 6965 6365 r the next piece │ │ │ +0004be00: 0a09 0909 6966 2028 2169 676e 6f72 655f ....if (!ignore_ │ │ │ +0004be10: 7065 6572 732e 656d 7074 7928 2929 0a09 peers.empty()).. │ │ │ +0004be20: 0909 7b0a 0909 0909 7065 6572 732e 696e ..{.....peers.in │ │ │ +0004be30: 7365 7274 2870 6565 7273 2e62 6567 696e sert(peers.begin │ │ │ +0004be40: 2829 2c20 6967 6e6f 7265 5f70 6565 7273 (), ignore_peers │ │ │ +0004be50: 2e62 6567 696e 2829 2c20 6967 6e6f 7265 .begin(), ignore │ │ │ +0004be60: 5f70 6565 7273 2e65 6e64 2829 293b 0a09 _peers.end());.. │ │ │ +0004be70: 0909 0969 676e 6f72 655f 7065 6572 732e ...ignore_peers. │ │ │ +0004be80: 636c 6561 7228 293b 0a0a 3c64 6976 2073 clear();..
    ....std: │ │ │ +0004bec0: 3a73 6f72 7428 7065 6572 732e 6265 6769 :sort(peers.begi │ │ │ +0004bed0: 6e28 292c 2070 6565 7273 2e65 6e64 2829 n(), peers.end() │ │ │ +0004bee0: 0a3c 2f64 6976 3e09 0909 0909 2c20 5b5d .
    ....., [] │ │ │ +0004bef0: 2028 7065 6572 5f63 6f6e 6e65 6374 696f (peer_connectio │ │ │ +0004bf00: 6e20 636f 6e73 742a 206c 6873 2c20 7065 n const* lhs, pe │ │ │ +0004bf10: 6572 5f63 6f6e 6e65 6374 696f 6e20 636f er_connection co │ │ │ +0004bf20: 6e73 742a 2072 6873 290a 0909 0909 097b nst* rhs)......{ │ │ │ +0004bf30: 2072 6574 7572 6e20 6c68 732d 2667 743b return lhs-> │ │ │ +0004bf40: 646f 776e 6c6f 6164 5f71 7565 7565 5f74 download_queue_t │ │ │ +0004bf50: 696d 6528 3136 2a31 3032 3429 2026 6c74 ime(16*1024) < │ │ │ +0004bf60: 3b20 7268 732d 2667 743b 646f 776e 6c6f ; rhs->downlo │ │ │ +0004bf70: 6164 5f71 7565 7565 5f74 696d 6528 3136 ad_queue_time(16 │ │ │ +0004bf80: 2a31 3032 3429 3b20 7d29 3b0a 0909 097d *1024); });....} │ │ │ +0004bf90: 0a0a 0909 092f 2f20 6966 2074 6869 7320 .....// if this │ │ │ +0004bfa0: 7065 6572 2773 2064 6f77 6e6c 6f61 6420 peer's download │ │ │ +0004bfb0: 7469 6d65 2065 7863 6565 6473 2032 2073 time exceeds 2 s │ │ │ +0004bfc0: 6563 6f6e 6473 2c20 7765 2772 6520 646f econds, we're do │ │ │ +0004bfd0: 6e65 2e0a 0909 092f 2f20 5765 2064 6f6e ne.....// We don │ │ │ +0004bfe0: 2774 2077 616e 7420 746f 2062 7569 6c64 't want to build │ │ │ +0004bff0: 2075 6e72 6561 736f 6e61 626c 7920 6c6f unreasonably lo │ │ │ +0004c000: 6e67 2072 6571 7565 7374 2071 7565 7565 ng request queue │ │ │ +0004c010: 730a 0909 0969 6620 2821 7065 6572 732e s....if (!peers. │ │ │ +0004c020: 656d 7074 7928 2920 2661 6d70 3b26 616d empty() &&am │ │ │ +0004c030: 703b 2070 6565 7273 5b30 5d2d 2667 743b p; peers[0]-> │ │ │ +0004c040: 646f 776e 6c6f 6164 5f71 7565 7565 5f74 download_queue_t │ │ │ +0004c050: 696d 6528 2920 2667 743b 206d 696c 6c69 ime() > milli │ │ │ +0004c060: 7365 636f 6e64 7328 3230 3030 2929 0a09 seconds(2000)).. │ │ │ +0004c070: 0909 0962 7265 616b 3b0a 0909 7d0a 0a09 ...break;...}... │ │ │ +0004c080: 092f 2f20 636f 6d6d 6974 2061 6c6c 2074 .// commit all t │ │ │ +0004c090: 6865 2074 696d 6520 6372 6974 6963 616c he time critical │ │ │ +0004c0a0: 2072 6571 7565 7374 730a 0909 666f 7220 requests...for │ │ │ +0004c0b0: 2861 7574 6f20 7020 3a20 7065 6572 735f (auto p : peers_ │ │ │ +0004c0c0: 7769 7468 5f72 6571 7565 7374 7329 0a09 with_requests).. │ │ │ +0004c0d0: 097b 0a09 0909 702d 2667 743b 7365 6e64 .{....p->send │ │ │ +0004c0e0: 5f62 6c6f 636b 5f72 6571 7565 7374 7328 _block_requests( │ │ │ +0004c0f0: 293b 0a09 097d 0a09 7d0a 2365 6e64 6966 );...}..}.#endif │ │ │ +0004c100: 202f 2f20 544f 5252 454e 545f 4449 5341 // TORRENT_DISA │ │ │ +0004c110: 424c 455f 5354 5245 414d 494e 470a 0a09 BLE_STREAMING... │ │ │ +0004c120: 7374 643a 3a73 6574 266c 743b 7374 643a std::set<std: │ │ │ +0004c130: 3a73 7472 696e 6726 6774 3b20 746f 7272 :string> torr │ │ │ +0004c140: 656e 743a 3a77 6562 5f73 6565 6473 2877 ent::web_seeds(w │ │ │ +0004c150: 6562 5f73 6565 645f 656e 7472 793a 3a74 eb_seed_entry::t │ │ │ +0004c160: 7970 655f 7420 636f 6e73 7420 7479 7065 ype_t const type │ │ │ +0004c170: 2920 636f 6e73 740a 097b 0a09 0954 4f52 ) const..{...TOR │ │ │ +0004c180: 5245 4e54 5f41 5353 4552 5428 6973 5f73 RENT_ASSERT(is_s │ │ │ +0004c190: 696e 676c 655f 7468 7265 6164 2829 293b ingle_thread()); │ │ │ +0004c1a0: 0a09 0973 7464 3a3a 7365 7426 6c74 3b73 ...std::set<s │ │ │ +0004c1b0: 7464 3a3a 7374 7269 6e67 2667 743b 2072 td::string> r │ │ │ +0004c1c0: 6574 3b0a 0909 666f 7220 2861 7574 6f20 et;...for (auto │ │ │ +0004c1d0: 636f 6e73 7426 616d 703b 2073 203a 206d const& s : m │ │ │ +0004c1e0: 5f77 6562 5f73 6565 6473 290a 0909 7b0a _web_seeds)...{. │ │ │ +0004c1f0: 0909 0969 6620 2873 2e70 6565 725f 696e ...if (s.peer_in │ │ │ +0004c200: 666f 2e62 616e 6e65 6429 2063 6f6e 7469 fo.banned) conti │ │ │ +0004c210: 6e75 653b 0a09 0909 6966 2028 732e 7265 nue;....if (s.re │ │ │ +0004c220: 6d6f 7665 6429 2063 6f6e 7469 6e75 653b moved) continue; │ │ │ +0004c230: 0a09 0909 6966 2028 732e 7479 7065 2021 ....if (s.type ! │ │ │ +0004c240: 3d20 7479 7065 2920 636f 6e74 696e 7565 = type) continue │ │ │ +0004c250: 3b0a 0909 0972 6574 2e69 6e73 6572 7428 ;....ret.insert( │ │ │ +0004c260: 732e 7572 6c29 3b0a 0909 7d0a 0909 7265 s.url);...}...re │ │ │ +0004c270: 7475 726e 2072 6574 3b0a 3c2f 7072 653e turn ret;. │ │ │ +0004c280: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ +0004c2b0: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ +0004c2c0: 3c74 643e 3c61 2068 7265 663d 226a 6176 ../src/web_ │ │ │ +0004c2f0: 636f 6e6e 6563 7469 6f6e 5f62 6173 652e connection_base. │ │ │ +0004c300: 6370 703a 3732 3c2f 613e 3c2f 7464 3e3c cpp:72< │ │ │ +0004c310: 7464 3e69 6e74 726f 6475 6365 2061 2077 td>introduce a w │ │ │ +0004c320: 6562 2d73 6565 6420 6465 6661 756c 7420 eb-seed default │ │ │ +0004c330: 636c 6173 7320 7768 6963 6820 6861 7320 class which has │ │ │ +0004c340: 6120 6c6f 7720 646f 776e 6c6f 6164 2070 a low download p │ │ │ +0004c350: 7269 6f72 6974 793c 2f74 643e 3c2f 7472 riority

    introduce a │ │ │ +0004c3b0: 2077 6562 2d73 6565 6420 6465 6661 756c web-seed defaul │ │ │ +0004c3c0: 7420 636c 6173 7320 7768 6963 6820 6861 t class which ha │ │ │ +0004c3d0: 7320 6120 6c6f 7720 646f 776e 6c6f 6164 s a low download │ │ │ +0004c3e0: 2070 7269 6f72 6974 793c 2f68 323e 3c68 priority

    ../src/web_con │ │ │ +0004c400: 6e65 6374 696f 6e5f 6261 7365 2e63 7070 nection_base.cpp │ │ │ +0004c410: 3a37 323c 2f68 343e 3c70 7265 2073 7479 :72
    ..: peer_conne
    │ │ │ +0004c460: 6374 696f 6e28 7061 636b 290a 0909 2c20  ction(pack)..., 
    │ │ │ +0004c470: 6d5f 6669 7273 745f 7265 7175 6573 7428  m_first_request(
    │ │ │ +0004c480: 7472 7565 290a 0909 2c20 6d5f 7373 6c28  true)..., m_ssl(
    │ │ │ +0004c490: 6661 6c73 6529 0a09 092c 206d 5f65 7874  false)..., m_ext
    │ │ │ +0004c4a0: 6572 6e61 6c5f 6175 7468 2877 6562 2e61  ernal_auth(web.a
    │ │ │ +0004c4b0: 7574 6829 0a09 092c 206d 5f65 7874 7261  uth)..., m_extra
    │ │ │ +0004c4c0: 5f68 6561 6465 7273 2877 6562 2e65 7874  _headers(web.ext
    │ │ │ +0004c4d0: 7261 5f68 6561 6465 7273 290a 0909 2c20  ra_headers)..., 
    │ │ │ +0004c4e0: 6d5f 7061 7273 6572 2868 7474 705f 7061  m_parser(http_pa
    │ │ │ +0004c4f0: 7273 6572 3a3a 646f 6e74 5f70 6172 7365  rser::dont_parse
    │ │ │ +0004c500: 5f63 6875 6e6b 7329 0a09 092c 206d 5f62  _chunks)..., m_b
    │ │ │ +0004c510: 6f64 795f 7374 6172 7428 3029 0a09 7b0a  ody_start(0)..{.
    │ │ │ +0004c520: 0909 544f 5252 454e 545f 4153 5345 5254  ..TORRENT_ASSERT
    │ │ │ +0004c530: 2826 616d 703b 7765 622e 7065 6572 5f69  (&web.peer_i
    │ │ │ +0004c540: 6e66 6f20 3d3d 2070 6163 6b2e 7065 6572  nfo == pack.peer
    │ │ │ +0004c550: 696e 666f 293b 0a09 092f 2f20 7768 656e  info);...// when
    │ │ │ +0004c560: 2067 6f69 6e67 2074 6872 6f75 6768 2061   going through a
    │ │ │ +0004c570: 2070 726f 7879 2c20 7765 2064 6f6e 2774   proxy, we don't
    │ │ │ +0004c580: 206e 6563 6573 7361 7269 6c79 2068 6176   necessarily hav
    │ │ │ +0004c590: 6520 616e 2065 6e64 706f 696e 7420 6865  e an endpoint he
    │ │ │ +0004c5a0: 7265 2c0a 0909 2f2f 2073 696e 6365 2074  re,...// since t
    │ │ │ +0004c5b0: 6865 2070 726f 7879 206d 6967 6874 2062  he proxy might b
    │ │ │ +0004c5c0: 6520 7265 736f 6c76 696e 6720 7468 6520  e resolving the 
    │ │ │ +0004c5d0: 686f 7374 6e61 6d65 2c20 6e6f 7420 7573  hostname, not us
    │ │ │ +0004c5e0: 0a09 0954 4f52 5245 4e54 5f41 5353 4552  ...TORRENT_ASSER
    │ │ │ +0004c5f0: 5428 7765 622e 656e 6470 6f69 6e74 732e  T(web.endpoints.
    │ │ │ +0004c600: 656d 7074 7928 2920 7c7c 2077 6562 2e65  empty() || web.e
    │ │ │ +0004c610: 6e64 706f 696e 7473 2e66 726f 6e74 2829  ndpoints.front()
    │ │ │ +0004c620: 203d 3d20 7061 636b 2e65 6e64 7029 3b0a   == pack.endp);.
    │ │ │ +0004c630: 0a09 0949 4e56 4152 4941 4e54 5f43 4845  ...INVARIANT_CHE
    │ │ │ +0004c640: 434b 3b0a 0a09 0954 4f52 5245 4e54 5f41  CK;....TORRENT_A
    │ │ │ +0004c650: 5353 4552 5428 6973 5f6f 7574 676f 696e  SSERT(is_outgoin
    │ │ │ +0004c660: 6728 2929 3b0a 0a09 0954 4f52 5245 4e54  g());....TORRENT
    │ │ │ +0004c670: 5f41 5353 4552 5428 216d 5f74 6f72 7265  _ASSERT(!m_torre
    │ │ │ +0004c680: 6e74 2e6c 6f63 6b28 292d 2667 743b 6973  nt.lock()->is
    │ │ │ +0004c690: 5f75 706c 6f61 645f 6f6e 6c79 2829 293b  _upload_only());
    │ │ │ +0004c6a0: 0a0a 0909 2f2f 2077 6520 6f6e 6c79 2077  ....// we only w
    │ │ │ +0004c6b0: 616e 7420 6c65 6674 2d6f 7665 7220 6261  ant left-over ba
    │ │ │ +0004c6c0: 6e64 7769 6474 680a 3c64 6976 2073 7479  ndwidth.
    .
    ..s │ │ │ +0004c700: 7464 3a3a 7374 7269 6e67 2070 726f 746f td::string proto │ │ │ +0004c710: 636f 6c3b 0a09 0965 7272 6f72 5f63 6f64 col;...error_cod │ │ │ +0004c720: 6520 6563 3b0a 0909 7374 643a 3a74 6965 e ec;...std::tie │ │ │ +0004c730: 2870 726f 746f 636f 6c2c 206d 5f62 6173 (protocol, m_bas │ │ │ +0004c740: 6963 5f61 7574 682c 206d 5f68 6f73 742c ic_auth, m_host, │ │ │ +0004c750: 206d 5f70 6f72 742c 206d 5f70 6174 6829 m_port, m_path) │ │ │ +0004c760: 0a09 0909 3d20 7061 7273 655f 7572 6c5f ....= parse_url_ │ │ │ +0004c770: 636f 6d70 6f6e 656e 7473 2877 6562 2e75 components(web.u │ │ │ +0004c780: 726c 2c20 6563 293b 0a09 0954 4f52 5245 rl, ec);...TORRE │ │ │ +0004c790: 4e54 5f41 5353 4552 5428 2165 6329 3b0a NT_ASSERT(!ec);. │ │ │ +0004c7a0: 0a09 0969 6620 286d 5f70 6f72 7420 3d3d ...if (m_port == │ │ │ +0004c7b0: 202d 3120 2661 6d70 3b26 616d 703b 2070 -1 && p │ │ │ +0004c7c0: 726f 746f 636f 6c20 3d3d 2022 6874 7470 rotocol == "http │ │ │ +0004c7d0: 2229 0a09 0909 6d5f 706f 7274 203d 2038 ")....m_port = 8 │ │ │ +0004c7e0: 303b 0a0a 2369 6620 544f 5252 454e 545f 0;..#if TORRENT_ │ │ │ +0004c7f0: 5553 455f 5353 4c0a 0909 6966 2028 7072 USE_SSL...if (pr │ │ │ +0004c800: 6f74 6f63 6f6c 203d 3d20 2268 7474 7073 otocol == "https │ │ │ +0004c810: 2229 0a09 097b 0a09 0909 6d5f 7373 6c20 ")...{....m_ssl │ │ │ +0004c820: 3d20 7472 7565 3b0a 0909 0969 6620 286d = true;....if (m │ │ │ +0004c830: 5f70 6f72 7420 3d3d 202d 3129 206d 5f70 _port == -1) m_p │ │ │ +0004c840: 6f72 7420 3d20 3434 333b 0a09 097d 0a23 ort = 443;...}.# │ │ │ +0004c850: 656e 6469 660a 0a09 0969 6620 2821 6d5f endif....if (!m_ │ │ │ +0004c860: 6261 7369 635f 6175 7468 2e65 6d70 7479 basic_auth.empty │ │ │ +0004c870: 2829 290a 0909 096d 5f62 6173 6963 5f61 ())....m_basic_a │ │ │ +0004c880: 7574 6820 3d20 6261 7365 3634 656e 636f uth = base64enco │ │ │ +0004c890: 6465 286d 5f62 6173 6963 5f61 7574 6829 de(m_basic_auth) │ │ │ +0004c8a0: 3b0a 0a09 096d 5f73 6572 7665 725f 7374 ;....m_server_st │ │ │ +0004c8b0: 7269 6e67 203d 206d 5f68 6f73 743b 0a09 ring = m_host;.. │ │ │ +0004c8c0: 0961 7578 3a3a 7665 7269 6679 5f65 6e63 .aux::verify_enc │ │ │ +0004c8d0: 6f64 696e 6728 6d5f 7365 7276 6572 5f73 oding(m_server_s │ │ │ +0004c8e0: 7472 696e 6729 3b0a 097d 0a0a 0969 6e74 tring);..}...int │ │ │ +0004c8f0: 2077 6562 5f63 6f6e 6e65 6374 696f 6e5f web_connection_ │ │ │ +0004c900: 6261 7365 3a3a 7469 6d65 6f75 7428 2920 base::timeout() │ │ │ +0004c910: 636f 6e73 740a 097b 0a09 092f 2f20 7369 const..{...// si │ │ │ +0004c920: 6e63 6520 7468 6973 2069 7320 6120 7765 nce this is a we │ │ │ +0004c930: 6220 7365 6564 2c20 6368 616e 6765 2074 b seed, change t │ │ │ +0004c940: 6865 2074 696d 656f 7574 0a09 092f 2f20 he timeout...// │ │ │ +0004c950: 6163 636f 7264 696e 6720 746f 2074 6865 according to the │ │ │ +0004c960: 2073 6574 7469 6e67 732e 0a09 0972 6574 settings....ret │ │ │ +0004c970: 7572 6e20 6d5f 7365 7474 696e 6773 2e67 urn m_settings.g │ │ │ +0004c980: 6574 5f69 6e74 2873 6574 7469 6e67 735f et_int(settings_ │ │ │ +0004c990: 7061 636b 3a3a 7572 6c73 6565 645f 7469 pack::urlseed_ti │ │ │ +0004c9a0: 6d65 6f75 7429 3b0a 097d 0a3c 2f70 7265 meout);..}.
    rele │ │ │ +0004c9e0: 7661 6e63 6526 6e62 7370 3b30 3c2f 7464 vance 0../src/sto │ │ │ +0004ca20: 7261 6765 5f75 7469 6c73 2e63 7070 3a32 rage_utils.cpp:2 │ │ │ +0004ca30: 3331 3c2f 613e 3c2f 7464 3e3c 7464 3e69 31i │ │ │ +0004ca40: 6465 616c 6c79 2c20 6966 2077 6520 656e deally, if we en │ │ │ +0004ca50: 6420 7570 2063 6f70 7969 6e67 2066 696c d up copying fil │ │ │ +0004ca60: 6573 2062 6563 6175 7365 206f 6620 6120 es because of a │ │ │ +0004ca70: 6d6f 7665 2061 6372 6f73 7320 766f 6c75 move across volu │ │ │ +0004ca80: 6d65 732c 2074 6865 2073 6f75 7263 6520 mes, the source │ │ │ +0004ca90: 7368 6f75 6c64 206e 6f74 2062 6520 6465 should not be de │ │ │ +0004caa0: 6c65 7465 6420 756e 7469 6c20 7468 6579 leted until they │ │ │ +0004cab0: 2776 6520 616c 6c20 6265 656e 2063 6f70 've all been cop │ │ │ +0004cac0: 6965 642e 2054 6861 7420 776f 756c 6420 ied. That would │ │ │ +0004cad0: 6c65 7420 7573 2072 6f6c 6c62 6163 6b20 let us rollback │ │ │ +0004cae0: 7769 7468 2068 6967 6865 7220 636f 6e66 with higher conf │ │ │ +0004caf0: 6964 656e 6365 2e3c 2f74 643e 3c2f 7472 idence.

    ideally, if │ │ │ +0004cb50: 2077 6520 656e 6420 7570 2063 6f70 7969 we end up copyi │ │ │ +0004cb60: 6e67 2066 696c 6573 2062 6563 6175 7365 ng files because │ │ │ +0004cb70: 206f 6620 6120 6d6f 7665 2061 6372 6f73 of a move acros │ │ │ +0004cb80: 730a 766f 6c75 6d65 732c 2074 6865 2073 s.volumes, the s │ │ │ +0004cb90: 6f75 7263 6520 7368 6f75 6c64 206e 6f74 ource should not │ │ │ +0004cba0: 2062 6520 6465 6c65 7465 6420 756e 7469 be deleted unti │ │ │ +0004cbb0: 6c20 7468 6579 2776 6520 616c 6c20 6265 l they've all be │ │ │ +0004cbc0: 656e 0a63 6f70 6965 642e 2054 6861 7420 en.copied. That │ │ │ +0004cbd0: 776f 756c 6420 6c65 7420 7573 2072 6f6c would let us rol │ │ │ +0004cbe0: 6c62 6163 6b20 7769 7468 2068 6967 6865 lback with highe │ │ │ +0004cbf0: 7220 636f 6e66 6964 656e 6365 2e3c 2f68 r confidence.

    ../src/sto │ │ │ +0004cc10: 7261 6765 5f75 7469 6c73 2e63 7070 3a32 rage_utils.cpp:2 │ │ │ +0004cc20: 3331 3c2f 6834 3e3c 7072 6520 7374 796c 31

    ..// later...au
    │ │ │ +0004cc70: 783a 3a76 6563 746f 7226 6c74 3b62 6f6f  x::vector<boo
    │ │ │ +0004cc80: 6c2c 2066 696c 655f 696e 6465 785f 7426  l, file_index_t&
    │ │ │ +0004cc90: 6774 3b20 636f 7069 6564 5f66 696c 6573  gt; copied_files
    │ │ │ +0004cca0: 2873 7464 3a3a 7369 7a65 5f74 2866 2e6e  (std::size_t(f.n
    │ │ │ +0004ccb0: 756d 5f66 696c 6573 2829 292c 2066 616c  um_files()), fal
    │ │ │ +0004ccc0: 7365 293b 0a0a 0909 2f2f 2074 7261 636b  se);....// track
    │ │ │ +0004ccd0: 2068 6f77 2066 6172 2077 6520 676f 7420   how far we got 
    │ │ │ +0004cce0: 696e 2063 6173 6520 6f66 2061 6e20 6572  in case of an er
    │ │ │ +0004ccf0: 726f 720a 0909 6669 6c65 5f69 6e64 6578  ror...file_index
    │ │ │ +0004cd00: 5f74 2066 696c 655f 696e 6465 787b 7d3b  _t file_index{};
    │ │ │ +0004cd10: 0a09 0966 6f72 2028 6175 746f 2063 6f6e  ...for (auto con
    │ │ │ +0004cd20: 7374 2069 203a 2066 2e66 696c 655f 7261  st i : f.file_ra
    │ │ │ +0004cd30: 6e67 6528 2929 0a09 097b 0a09 0909 2f2f  nge())...{....//
    │ │ │ +0004cd40: 2066 696c 6573 206d 6f76 6564 206f 7574   files moved out
    │ │ │ +0004cd50: 2074 6f20 6162 736f 6c75 7465 2070 6174   to absolute pat
    │ │ │ +0004cd60: 6873 2061 7265 206e 6f74 206d 6f76 6564  hs are not moved
    │ │ │ +0004cd70: 0a09 0909 6966 2028 662e 6669 6c65 5f61  ....if (f.file_a
    │ │ │ +0004cd80: 6273 6f6c 7574 655f 7061 7468 2869 2929  bsolute_path(i))
    │ │ │ +0004cd90: 2063 6f6e 7469 6e75 653b 0a0a 0909 0973   continue;.....s
    │ │ │ +0004cda0: 7464 3a3a 7374 7269 6e67 2063 6f6e 7374  td::string const
    │ │ │ +0004cdb0: 206f 6c64 5f70 6174 6820 3d20 636f 6d62   old_path = comb
    │ │ │ +0004cdc0: 696e 655f 7061 7468 2873 6176 655f 7061  ine_path(save_pa
    │ │ │ +0004cdd0: 7468 2c20 662e 6669 6c65 5f70 6174 6828  th, f.file_path(
    │ │ │ +0004cde0: 6929 293b 0a09 0909 7374 643a 3a73 7472  i));....std::str
    │ │ │ +0004cdf0: 696e 6720 636f 6e73 7420 6e65 775f 7061  ing const new_pa
    │ │ │ +0004ce00: 7468 203d 2063 6f6d 6269 6e65 5f70 6174  th = combine_pat
    │ │ │ +0004ce10: 6828 6e65 775f 7361 7665 5f70 6174 682c  h(new_save_path,
    │ │ │ +0004ce20: 2066 2e66 696c 655f 7061 7468 2869 2929   f.file_path(i))
    │ │ │ +0004ce30: 3b0a 0a09 0909 6572 726f 725f 636f 6465  ;.....error_code
    │ │ │ +0004ce40: 2069 676e 6f72 653b 0a09 0909 6966 2028   ignore;....if (
    │ │ │ +0004ce50: 666c 6167 7320 3d3d 206d 6f76 655f 666c  flags == move_fl
    │ │ │ +0004ce60: 6167 735f 743a 3a64 6f6e 745f 7265 706c  ags_t::dont_repl
    │ │ │ +0004ce70: 6163 6520 2661 6d70 3b26 616d 703b 2065  ace && e
    │ │ │ +0004ce80: 7869 7374 7328 6e65 775f 7061 7468 2c20  xists(new_path, 
    │ │ │ +0004ce90: 6967 6e6f 7265 2929 0a09 0909 7b0a 0909  ignore))....{...
    │ │ │ +0004cea0: 0909 6966 2028 7265 7420 3d3d 2073 7461  ..if (ret == sta
    │ │ │ +0004ceb0: 7475 735f 743a 3a6e 6f5f 6572 726f 7229  tus_t::no_error)
    │ │ │ +0004cec0: 2072 6574 203d 2073 7461 7475 735f 743a   ret = status_t:
    │ │ │ +0004ced0: 3a6e 6565 645f 6675 6c6c 5f63 6865 636b  :need_full_check
    │ │ │ +0004cee0: 3b0a 0909 0909 636f 6e74 696e 7565 3b0a  ;.....continue;.
    │ │ │ +0004cef0: 0909 097d 0a0a 3c64 6976 2073 7479 6c65  ...}..
    ...move_file │ │ │ +0004cf30: 286f 6c64 5f70 6174 682c 206e 6577 5f70 (old_path, new_p │ │ │ +0004cf40: 6174 682c 2065 6329 3b0a 3c2f 6469 763e ath, ec);.
    │ │ │ +0004cf50: 0a09 0909 2f2f 2069 6620 7468 6520 736f ....// if the so │ │ │ +0004cf60: 7572 6365 2066 696c 6520 646f 6573 6e27 urce file doesn' │ │ │ +0004cf70: 7420 6578 6973 742e 2054 6861 7427 7320 t exist. That's │ │ │ +0004cf80: 6e6f 7420 6120 7072 6f62 6c65 6d0a 0909 not a problem... │ │ │ +0004cf90: 092f 2f20 7765 206a 7573 7420 6967 6e6f .// we just igno │ │ │ +0004cfa0: 7265 2074 6861 7420 6669 6c65 0a09 0909 re that file.... │ │ │ +0004cfb0: 6966 2028 6563 2e65 6320 3d3d 2062 6f6f if (ec.ec == boo │ │ │ +0004cfc0: 7374 3a3a 7379 7374 656d 3a3a 6572 7263 st::system::errc │ │ │ +0004cfd0: 3a3a 6e6f 5f73 7563 685f 6669 6c65 5f6f ::no_such_file_o │ │ │ +0004cfe0: 725f 6469 7265 6374 6f72 7929 0a09 0909 r_directory).... │ │ │ +0004cff0: 0965 632e 6563 2e63 6c65 6172 2829 3b0a .ec.ec.clear();. │ │ │ +0004d000: 0909 0965 6c73 6520 6966 2028 6563 0a09 ...else if (ec.. │ │ │ +0004d010: 0909 0926 616d 703b 2661 6d70 3b20 6563 ...&& ec │ │ │ +0004d020: 2e65 6320 213d 2062 6f6f 7374 3a3a 7379 .ec != boost::sy │ │ │ +0004d030: 7374 656d 3a3a 6572 7263 3a3a 696e 7661 stem::errc::inva │ │ │ +0004d040: 6c69 645f 6172 6775 6d65 6e74 0a09 0909 lid_argument.... │ │ │ +0004d050: 0926 616d 703b 2661 6d70 3b20 6563 2e65 .&& ec.e │ │ │ +0004d060: 6320 213d 2062 6f6f 7374 3a3a 7379 7374 c != boost::syst │ │ │ +0004d070: 656d 3a3a 6572 7263 3a3a 7065 726d 6973 em::errc::permis │ │ │ +0004d080: 7369 6f6e 5f64 656e 6965 6429 0a09 0909 sion_denied).... │ │ │ +0004d090: 7b0a 0909 0909 2f2f 206d 6f76 696e 6720 {.....// moving │ │ │ +0004d0a0: 7468 6520 6669 6c65 2066 6169 6c65 640a the file failed. │ │ │ +0004d0b0: 0909 0909 2f2f 206f 6e20 4f53 582c 2074 ....// on OSX, t │ │ │ +0004d0c0: 6865 2065 7272 6f72 2077 6865 6e20 7472 he error when tr │ │ │ +0004d0d0: 7969 6e67 2074 6f20 7265 6e61 6d65 2061 ying to rename a │ │ │ +0004d0e0: 2066 696c 6520 6163 726f 7373 2064 6966 file across dif │ │ │ +0004d0f0: 6665 7265 6e74 0a09 0909 092f 2f20 766f ferent.....// vo │ │ │ +0004d100: 6c75 6d65 7320 6973 2045 5844 4556 2c20 lumes is EXDEV, │ │ │ +0004d110: 7768 6963 6820 7769 6c6c 206d 616b 6520 which will make │ │ │ +0004d120: 6974 2066 616c 6c20 6261 636b 2074 6f20 it fall back to │ │ │ +0004d130: 636f 7079 696e 672e 0a09 0909 0965 632e copying......ec. │ │ │ +0004d140: 6563 2e63 6c65 6172 2829 3b0a 0909 0909 ec.clear();..... │ │ │ +0004d150: 636f 7079 5f66 696c 6528 6f6c 645f 7061 copy_file(old_pa │ │ │ +0004d160: 7468 2c20 6e65 775f 7061 7468 2c20 6563 th, new_path, ec │ │ │ +0004d170: 293b 0a09 0909 0969 6620 2821 6563 2920 );.....if (!ec) │ │ │ +0004d180: 636f 7069 6564 5f66 696c 6573 5b69 5d20 copied_files[i] │ │ │ +0004d190: 3d20 7472 7565 3b0a 0909 097d 0a0a 0909 = true;....}.... │ │ │ +0004d1a0: 0969 6620 2865 6329 0a09 0909 7b0a 0909 .if (ec)....{... │ │ │ +0004d1b0: 0909 6563 2e66 696c 6528 6929 3b0a 0909 ..ec.file(i);... │ │ │ +0004d1c0: 0909 6669 6c65 5f69 6e64 6578 203d 2069 ..file_index = i │ │ │ +0004d1d0: 3b0a 0909 0909 6272 6561 6b3b 0a09 0909 ;.....break;.... │ │ │ +0004d1e0: 7d0a 0909 7d0a 0a09 0969 6620 2821 6563 }...}....if (!ec │ │ │ +0004d1f0: 2026 616d 703b 2661 6d70 3b20 6d6f 7665 && move │ │ │ +0004d200: 5f70 6172 7466 696c 6529 0a09 097b 0a09 _partfile)...{.. │ │ │ +0004d210: 0909 6572 726f 725f 636f 6465 2065 3b0a ..error_code e;. │ │ │ +0004d220: 0909 096d 6f76 655f 7061 7274 6669 6c65 ...move_partfile │ │ │ +0004d230: 286e 6577 5f73 6176 655f 7061 7468 2c20 (new_save_path, │ │ │ +0004d240: 6529 3b0a 0909 0969 6620 2865 290a 3c2f e);....if (e).r │ │ │ +0004d280: 656c 6576 616e 6365 266e 6273 703b 303c elevance 0< │ │ │ +0004d290: 2f74 643e 3c74 643e 3c61 2068 7265 663d /td>../src/ │ │ │ +0004d2c0: 7374 6f72 6167 655f 7574 696c 732e 6370 storage_utils.cp │ │ │ +0004d2d0: 703a 3533 393c 2f61 3e3c 2f74 643e 3c74 p:539it would seem │ │ │ +0004d2f0: 7265 6173 6f6e 6162 6c65 2074 6f2c 2069 reasonable to, i │ │ │ +0004d300: 6e73 7465 6164 2c20 7365 7420 7468 6520 nstead, set the │ │ │ +0004d310: 6861 7665 5f70 6965 6365 7320 6269 7473 have_pieces bits │ │ │ +0004d320: 2066 6f72 2074 6865 2070 6965 6365 7320 for the pieces │ │ │ +0004d330: 7265 7072 6573 656e 7469 6e67 2074 6865 representing the │ │ │ +0004d340: 7365 2066 696c 6573 2c20 616e 6420 7265 se files, and re │ │ │ +0004d350: 7375 6d65 2077 6974 6820 7468 6520 6e6f sume with the no │ │ │ +0004d360: 726d 616c 206c 6f67 6963 3c2f 7464 3e3c rmal logic< │ │ │ +0004d370: 2f74 723e 3c74 7220 6964 3d22 3138 3422 /tr>

    it would │ │ │ +0004d3c0: 2073 6565 6d20 7265 6173 6f6e 6162 6c65 seem reasonable │ │ │ +0004d3d0: 2074 6f2c 2069 6e73 7465 6164 2c20 7365 to, instead, se │ │ │ +0004d3e0: 7420 7468 6520 6861 7665 5f70 6965 6365 t the have_piece │ │ │ +0004d3f0: 7320 6269 7473 0a66 6f72 2074 6865 2070 s bits.for the p │ │ │ +0004d400: 6965 6365 7320 7265 7072 6573 656e 7469 ieces representi │ │ │ +0004d410: 6e67 2074 6865 7365 2066 696c 6573 2c20 ng these files, │ │ │ +0004d420: 616e 6420 7265 7375 6d65 2077 6974 6820 and resume with │ │ │ +0004d430: 7468 6520 6e6f 726d 616c 0a6c 6f67 6963 the normal.logic │ │ │ +0004d440: 3c2f 6832 3e3c 6834 3e2e 2e2f 7372 632f

    ../src/ │ │ │ +0004d450: 7374 6f72 6167 655f 7574 696c 732e 6370 storage_utils.cp │ │ │ +0004d460: 703a 3533 393c 2f68 343e 3c70 7265 2073 p:539

    .....continu
    │ │ │ +0004d4b0: 653b 0a0a 0909 0909 7374 643a 3a69 6e74  e;......std::int
    │ │ │ +0004d4c0: 3634 5f74 2063 6f6e 7374 2073 697a 6520  64_t const size 
    │ │ │ +0004d4d0: 3d20 6765 745f 6669 6c65 7369 7a65 2873  = get_filesize(s
    │ │ │ +0004d4e0: 7461 742c 2066 696c 655f 696e 6465 782c  tat, file_index,
    │ │ │ +0004d4f0: 2066 730a 0909 0909 092c 2073 6176 655f   fs......, save_
    │ │ │ +0004d500: 7061 7468 2c20 6563 293b 0a09 0909 0969  path, ec);.....i
    │ │ │ +0004d510: 6620 2873 697a 6520 266c 743b 2030 2920  f (size < 0) 
    │ │ │ +0004d520: 7265 7475 726e 2066 616c 7365 3b0a 0a09  return false;...
    │ │ │ +0004d530: 0909 0969 6620 2873 697a 6520 266c 743b  ...if (size <
    │ │ │ +0004d540: 2066 732e 6669 6c65 5f73 697a 6528 6669   fs.file_size(fi
    │ │ │ +0004d550: 6c65 5f69 6e64 6578 2929 0a09 0909 097b  le_index)).....{
    │ │ │ +0004d560: 0a09 0909 0909 6563 2e65 6320 3d20 6572  ......ec.ec = er
    │ │ │ +0004d570: 726f 7273 3a3a 6d69 736d 6174 6368 696e  rors::mismatchin
    │ │ │ +0004d580: 675f 6669 6c65 5f73 697a 653b 0a09 0909  g_file_size;....
    │ │ │ +0004d590: 0909 6563 2e66 696c 6528 6669 6c65 5f69  ..ec.file(file_i
    │ │ │ +0004d5a0: 6e64 6578 293b 0a09 0909 0909 6563 2e6f  ndex);......ec.o
    │ │ │ +0004d5b0: 7065 7261 7469 6f6e 203d 206f 7065 7261  peration = opera
    │ │ │ +0004d5c0: 7469 6f6e 5f74 3a3a 6368 6563 6b5f 7265  tion_t::check_re
    │ │ │ +0004d5d0: 7375 6d65 3b0a 0909 0909 0972 6574 7572  sume;......retur
    │ │ │ +0004d5e0: 6e20 6661 6c73 653b 0a09 0909 097d 0a09  n false;.....}..
    │ │ │ +0004d5f0: 0909 7d0a 0909 0972 6574 7572 6e20 7472  ..}....return tr
    │ │ │ +0004d600: 7565 3b0a 0909 7d0a 0a23 6966 6e64 6566  ue;...}..#ifndef
    │ │ │ +0004d610: 2054 4f52 5245 4e54 5f44 4953 4142 4c45   TORRENT_DISABLE
    │ │ │ +0004d620: 5f4d 5554 4142 4c45 5f54 4f52 5245 4e54  _MUTABLE_TORRENT
    │ │ │ +0004d630: 530a 0909 2f2f 2061 6c77 6179 7320 7472  S...// always tr
    │ │ │ +0004d640: 6967 6765 7220 6120 6675 6c6c 2072 6563  igger a full rec
    │ │ │ +0004d650: 6865 636b 2077 6865 6e20 7765 2070 756c  heck when we pul
    │ │ │ +0004d660: 6c20 696e 2066 696c 6573 2066 726f 6d20  l in files from 
    │ │ │ +0004d670: 6f74 6865 720a 0909 2f2f 2074 6f72 7265  other...// torre
    │ │ │ +0004d680: 6e74 732c 2076 6961 2068 6172 6420 6c69  nts, via hard li
    │ │ │ +0004d690: 6e6b 730a 3c64 6976 2073 7479 6c65 3d22  nks.
    ..if (added_fi │ │ │ +0004d6d0: 6c65 7329 2072 6574 7572 6e20 6661 6c73 les) return fals │ │ │ +0004d6e0: 653b 0a3c 2f64 6976 3e23 656e 6469 660a e;.
    #endif. │ │ │ +0004d6f0: 0a09 092f 2f20 7061 7273 6520 6861 7665 ...// parse have │ │ │ +0004d700: 2062 6974 6d61 736b 2e20 5665 7269 6679 bitmask. Verify │ │ │ +0004d710: 2074 6861 7420 6669 6c65 7320 746f 7563 that files touc │ │ │ +0004d720: 6865 6420 6279 2063 6f6d 706c 6574 6564 hed by completed │ │ │ +0004d730: 2070 6965 6365 730a 0909 2f2f 2061 6374 pieces...// act │ │ │ +0004d740: 7561 6c6c 7920 6578 6973 742e 2041 2063 ually exist. A c │ │ │ +0004d750: 6f6d 706c 6574 6564 2070 6965 6365 206d ompleted piece m │ │ │ +0004d760: 6179 2073 7061 6e20 6d75 6c74 6970 6c65 ay span multiple │ │ │ +0004d770: 2066 696c 6573 2e0a 0909 666f 7220 2866 files....for (f │ │ │ +0004d780: 696c 655f 696e 6465 785f 7420 636f 6e73 ile_index_t cons │ │ │ +0004d790: 7420 6669 6c65 5f69 6e64 6578 203a 2066 t file_index : f │ │ │ +0004d7a0: 732e 6669 6c65 5f72 616e 6765 2829 290a s.file_range()). │ │ │ +0004d7b0: 0909 7b0a 0909 092f 2f20 6669 6c65 7320 ..{....// files │ │ │ +0004d7c0: 7769 7468 2070 7269 6f72 6974 7920 7a65 with priority ze │ │ │ +0004d7d0: 726f 206d 6179 206e 6f74 2068 6176 6520 ro may not have │ │ │ +0004d7e0: 6265 656e 2073 6176 6564 2074 6f20 6469 been saved to di │ │ │ +0004d7f0: 736b 2061 7420 7468 6569 720a 0909 092f sk at their..../ │ │ │ +0004d800: 2f20 6578 7065 6374 6564 206c 6f63 6174 / expected locat │ │ │ +0004d810: 696f 6e2c 2062 7574 2069 7320 6c69 6b65 ion, but is like │ │ │ +0004d820: 6c79 2074 6f20 6265 2069 6e20 6120 7061 ly to be in a pa │ │ │ +0004d830: 7274 6669 6c65 2e20 4a75 7374 2065 7865 rtfile. Just exe │ │ │ +0004d840: 6d70 7420 6974 0a09 0909 2f2f 2066 726f mpt it....// fro │ │ │ +0004d850: 6d20 6368 6563 6b69 6e67 0a09 0909 6966 m checking....if │ │ │ +0004d860: 2028 6669 6c65 5f69 6e64 6578 2026 6c74 (file_index < │ │ │ +0004d870: 3b20 6669 6c65 5f70 7269 6f72 6974 792e ; file_priority. │ │ │ +0004d880: 656e 645f 696e 6465 7828 290a 0909 0909 end_index()..... │ │ │ +0004d890: 2661 6d70 3b26 616d 703b 2066 696c 655f && file_ │ │ │ +0004d8a0: 7072 696f 7269 7479 5b66 696c 655f 696e priority[file_in │ │ │ +0004d8b0: 6465 785d 203d 3d20 646f 6e74 5f64 6f77 dex] == dont_dow │ │ │ +0004d8c0: 6e6c 6f61 6429 0a09 0909 0963 6f6e 7469 nload).....conti │ │ │ +0004d8d0: 6e75 653b 0a0a 0909 0969 6620 2866 732e nue;.....if (fs. │ │ │ +0004d8e0: 7061 645f 6669 6c65 5f61 7428 6669 6c65 pad_file_at(file │ │ │ +0004d8f0: 5f69 6e64 6578 2929 2063 6f6e 7469 6e75 _index)) continu │ │ │ +0004d900: 653b 0a09 0909 6966 2028 6673 2e66 696c e;....if (fs.fil │ │ │ +0004d910: 655f 7369 7a65 2866 696c 655f 696e 6465 e_size(file_inde │ │ │ +0004d920: 7829 203d 3d20 3029 2063 6f6e 7469 6e75 x) == 0) continu │ │ │ +0004d930: 653b 0a0a 0909 0970 6965 6365 5f69 6e64 e;.....piece_ind │ │ │ +0004d940: 6578 5f74 2073 7461 7274 5f70 6965 6365 ex_t start_piece │ │ │ +0004d950: 3b0a 0909 0970 6965 6365 5f69 6e64 6578 ;....piece_index │ │ │ +0004d960: 5f74 2066 696c 655f 656e 645f 7069 6563 _t file_end_piec │ │ │ +0004d970: 653b 0a09 0909 7374 643a 3a74 6965 2873 e;....std::tie(s │ │ │ +0004d980: 7461 7274 5f70 6965 6365 2c20 6669 6c65 tart_piece, file │ │ │ +0004d990: 5f65 6e64 5f70 6965 6365 290a 0909 0909 _end_piece)..... │ │ │ +0004d9a0: 3d20 6175 783a 3a66 696c 655f 7069 6563 = aux::file_piec │ │ │ +0004d9b0: 655f 7261 6e67 655f 696e 636c 7573 6976 e_range_inclusiv │ │ │ +0004d9c0: 6528 6673 2c20 6669 6c65 5f69 6e64 6578 e(fs, file_index │ │ │ +0004d9d0: 293b 0a0a 0909 0970 6965 6365 5f69 6e64 );.....piece_ind │ │ │ +0004d9e0: 6578 5f74 2063 6f6e 7374 2065 6e64 5f70 ex_t const end_p │ │ │ +0004d9f0: 6965 6365 203d 2073 7464 3a3a 6d69 6e28 iece = std::min( │ │ │ +0004da00: 6669 6c65 5f65 6e64 5f70 6965 6365 0a09 file_end_piece.. │ │ │ +0004da10: 0909 092c 2072 642e 6861 7665 5f70 6965 ..., rd.have_pie │ │ │ +0004da20: 6365 732e 656e 645f 696e 6465 7828 2929 ces.end_index()) │ │ │ +0004da30: 3b0a 0a09 0909 626f 6f6c 2068 6173 5f63 ;.....bool has_c │ │ │ +0004da40: 6f6d 706c 6574 6564 5f72 6573 756d 655f ompleted_resume_ │ │ │ +0004da50: 7069 6563 6520 3d20 6661 6c73 653b 0a09 piece = false;.. │ │ │ +0004da60: 0909 666f 7220 2870 6965 6365 5f69 6e64 ..for (piece_ind │ │ │ +0004da70: 6578 5f74 2070 6965 6365 203d 2073 7461 ex_t piece = sta │ │ │ +0004da80: 7274 5f70 6965 6365 3b20 7069 6563 6520 rt_piece; piece │ │ │ +0004da90: 266c 743b 2065 6e64 5f70 6965 6365 3b20 < end_piece; │ │ │ +0004daa0: 2b2b 7069 6563 6529 0a09 0909 7b0a 0909 ++piece)....{... │ │ │ +0004dab0: 0909 6966 2028 2172 642e 6861 7665 5f70 ..if (!rd.have_p │ │ │ +0004dac0: 6965 6365 732e 6765 745f 6269 7428 7069 ieces.get_bit(pi │ │ │ +0004dad0: 6563 6529 2920 636f 6e74 696e 7565 3b0a ece)) continue;. │ │ │ +0004dae0: 0909 0909 6861 735f 636f 6d70 6c65 7465 ....has_complete │ │ │ +0004daf0: 645f 7265 7375 6d65 5f70 6965 6365 203d d_resume_piece = │ │ │ +0004db00: 2074 7275 653b 0a09 0909 0962 7265 616b true;.....break │ │ │ +0004db10: 3b0a 3c2f 7072 653e 3c2f 7464 3e3c 2f74 ;.
    < │ │ │ +0004db40: 7464 3e72 656c 6576 616e 6365 266e 6273 td>relevance&nbs │ │ │ +0004db50: 703b 303c 2f74 643e 3c74 643e 3c61 2068 p;0../ │ │ │ +0004db80: 7372 632f 656e 756d 5f6e 6574 2e63 7070 src/enum_net.cpp │ │ │ +0004db90: 3a31 3434 3c2f 613e 3c2f 7464 3e3c 7464 :144in C++17, use _ │ │ │ +0004dbb0: 5f68 6173 5f69 6e63 6c75 6465 2066 6f72 _has_include for │ │ │ +0004dbc0: 2074 6869 732e 204f 7468 6572 206f 7065 this. Other ope │ │ │ +0004dbd0: 7261 7469 6e67 2073 7973 7465 6d73 2061 rating systems a │ │ │ +0004dbe0: 7265 206c 696b 656c 7920 746f 2072 6571 re likely to req │ │ │ +0004dbf0: 7569 7265 2074 6869 7320 6173 2077 656c uire this as wel │ │ │ +0004dc00: 6c3c 2f74 643e 3c2f 7472 3e3c 7472 2069 l

    i │ │ │ +0004dc50: 6e20 432b 2b31 372c 2075 7365 205f 5f68 n C++17, use __h │ │ │ +0004dc60: 6173 5f69 6e63 6c75 6465 2066 6f72 2074 as_include for t │ │ │ +0004dc70: 6869 732e 204f 7468 6572 206f 7065 7261 his. Other opera │ │ │ +0004dc80: 7469 6e67 2073 7973 7465 6d73 2061 7265 ting systems are │ │ │ +0004dc90: 0a6c 696b 656c 7920 746f 2072 6571 7569 .likely to requi │ │ │ +0004dca0: 7265 2074 6869 7320 6173 2077 656c 6c3c re this as well< │ │ │ +0004dcb0: 2f68 323e 3c68 343e 2e2e 2f73 7263 2f65 /h2>

    ../src/e │ │ │ +0004dcc0: 6e75 6d5f 6e65 742e 6370 703a 3134 343c num_net.cpp:144< │ │ │ +0004dcd0: 2f68 343e 3c70 7265 2073 7479 6c65 3d22 /h4>
    #i
    │ │ │ +0004dd10: 6e63 6c75 6465 2026 6c74 3b61 7270 612f  nclude <arpa/
    │ │ │ +0004dd20: 696e 6574 2e68 2667 743b 0a23 696e 636c  inet.h>.#incl
    │ │ │ +0004dd30: 7564 6520 266c 743b 6373 7472 696e 6726  ude <cstring&
    │ │ │ +0004dd40: 6774 3b0a 2369 6e63 6c75 6465 2026 6c74  gt;.#include <
    │ │ │ +0004dd50: 3b63 7374 646c 6962 2667 743b 0a23 696e  ;cstdlib>.#in
    │ │ │ +0004dd60: 636c 7564 6520 266c 743b 756e 6973 7464  clude <unistd
    │ │ │ +0004dd70: 2e68 2667 743b 0a23 696e 636c 7564 6520  .h>.#include 
    │ │ │ +0004dd80: 266c 743b 7379 732f 7479 7065 732e 6826  <sys/types.h&
    │ │ │ +0004dd90: 6774 3b0a 0a23 6966 2064 6566 696e 6564  gt;..#if defined
    │ │ │ +0004dda0: 2054 4f52 5245 4e54 5f41 4e44 524f 4944   TORRENT_ANDROID
    │ │ │ +0004ddb0: 2026 616d 703b 2661 6d70 3b20 2164 6566   && !def
    │ │ │ +0004ddc0: 696e 6564 2049 4641 5f46 5f44 4144 4641  ined IFA_F_DADFA
    │ │ │ +0004ddd0: 494c 4544 0a23 6465 6669 6e65 2049 4641  ILED.#define IFA
    │ │ │ +0004dde0: 5f46 5f44 4144 4641 494c 4544 2038 0a23  _F_DADFAILED 8.#
    │ │ │ +0004ddf0: 656e 6469 660a 0a23 656e 6469 660a 0a23  endif..#endif..#
    │ │ │ +0004de00: 6966 2054 4f52 5245 4e54 5f55 5345 5f49  if TORRENT_USE_I
    │ │ │ +0004de10: 4641 4444 5253 0a23 696e 636c 7564 6520  FADDRS.#include 
    │ │ │ +0004de20: 266c 743b 6966 6164 6472 732e 6826 6774  <ifaddrs.h>
    │ │ │ +0004de30: 3b0a 2369 6e63 6c75 6465 2026 6c74 3b6e  ;.#include <n
    │ │ │ +0004de40: 6574 2f69 662e 6826 6774 3b0a 2369 6e63  et/if.h>.#inc
    │ │ │ +0004de50: 6c75 6465 2026 6c74 3b73 7973 2f69 6f63  lude <sys/ioc
    │ │ │ +0004de60: 746c 2e68 2667 743b 0a23 656e 6469 660a  tl.h>.#endif.
    │ │ │ +0004de70: 0a23 6966 2054 4f52 5245 4e54 5f55 5345  .#if TORRENT_USE
    │ │ │ +0004de80: 5f49 4641 4444 5253 207c 7c20 544f 5252  _IFADDRS || TORR
    │ │ │ +0004de90: 454e 545f 5553 455f 4946 434f 4e46 207c  ENT_USE_IFCONF |
    │ │ │ +0004dea0: 7c20 544f 5252 454e 545f 5553 455f 4e45  | TORRENT_USE_NE
    │ │ │ +0004deb0: 544c 494e 4b20 7c7c 2054 4f52 5245 4e54  TLINK || TORRENT
    │ │ │ +0004dec0: 5f55 5345 5f53 5953 4354 4c0a 2369 6664  _USE_SYSCTL.#ifd
    │ │ │ +0004ded0: 6566 2054 4f52 5245 4e54 5f42 454f 530a  ef TORRENT_BEOS.
    │ │ │ +0004dee0: 3c64 6976 2073 7479 6c65 3d22 6261 636b  
    #i │ │ │ +0004df10: 6e63 6c75 6465 2026 6c74 3b73 7973 2f73 nclude <sys/s │ │ │ +0004df20: 6f63 6b69 6f2e 6826 6774 3b0a 3c2f 6469 ockio.h>.#endif.// capt │ │ │ +0004df40: 7572 6520 7468 6973 2068 6572 6520 7768 ure this here wh │ │ │ +0004df50: 6572 6520 7761 726e 696e 6773 2061 7265 ere warnings are │ │ │ +0004df60: 2064 6973 6162 6c65 6420 2874 6865 206d disabled (the m │ │ │ +0004df70: 6163 726f 2067 656e 6572 6174 6573 2077 acro generates w │ │ │ +0004df80: 6172 6e69 6e67 7329 0a63 6f6e 7374 2075 arnings).const u │ │ │ +0004df90: 6e73 6967 6e65 6420 6c6f 6e67 2073 696f nsigned long sio │ │ │ +0004dfa0: 6367 6966 6d74 7520 3d20 5349 4f43 4749 cgifmtu = SIOCGI │ │ │ +0004dfb0: 464d 5455 3b0a 2365 6e64 6966 0a0a 2369 FMTU;.#endif..#i │ │ │ +0004dfc0: 6e63 6c75 6465 2022 6c69 6274 6f72 7265 nclude "libtorre │ │ │ +0004dfd0: 6e74 2f61 7578 5f2f 6469 7361 626c 655f nt/aux_/disable_ │ │ │ +0004dfe0: 7761 726e 696e 6773 5f70 6f70 2e68 7070 warnings_pop.hpp │ │ │ +0004dff0: 220a 0a23 6966 2064 6566 696e 6564 2854 "..#if defined(T │ │ │ +0004e000: 4f52 5245 4e54 5f4f 5332 2920 2661 6d70 ORRENT_OS2) & │ │ │ +0004e010: 3b26 616d 703b 2021 6465 6669 6e65 6428 ;& !defined( │ │ │ +0004e020: 4946 5f4e 414d 4553 495a 4529 0a23 6465 IF_NAMESIZE).#de │ │ │ +0004e030: 6669 6e65 2049 465f 4e41 4d45 5349 5a45 fine IF_NAMESIZE │ │ │ +0004e040: 2049 464e 414d 5349 5a0a 2365 6e64 6966 IFNAMSIZ.#endif │ │ │ +0004e050: 0a0a 6e61 6d65 7370 6163 6520 6c69 6274 ..namespace libt │ │ │ +0004e060: 6f72 7265 6e74 207b 0a0a 6e61 6d65 7370 orrent {..namesp │ │ │ +0004e070: 6163 6520 7b0a 0a23 6966 2021 6465 6669 ace {..#if !defi │ │ │ +0004e080: 6e65 6420 544f 5252 454e 545f 5749 4e44 ned TORRENT_WIND │ │ │ +0004e090: 4f57 5320 2661 6d70 3b26 616d 703b 2021 OWS && ! │ │ │ +0004e0a0: 6465 6669 6e65 6420 544f 5252 454e 545f defined TORRENT_ │ │ │ +0004e0b0: 4255 494c 445f 5349 4d55 4c41 544f 520a BUILD_SIMULATOR. │ │ │ +0004e0c0: 0973 7472 7563 7420 736f 636b 6574 5f63 .struct socket_c │ │ │ +0004e0d0: 6c6f 7365 720a 097b 0a09 0973 6f63 6b65 loser..{...socke │ │ │ +0004e0e0: 745f 636c 6f73 6572 2869 6e74 2073 2920 t_closer(int s) │ │ │ +0004e0f0: 3a20 6d5f 736f 636b 6574 2873 2920 7b7d : m_socket(s) {} │ │ │ +0004e100: 0a09 0973 6f63 6b65 745f 636c 6f73 6572 ...socket_closer │ │ │ +0004e110: 2873 6f63 6b65 745f 636c 6f73 6572 2063 (socket_closer c │ │ │ +0004e120: 6f6e 7374 2661 6d70 3b29 203d 2064 656c onst&) = del │ │ │ +0004e130: 6574 653b 0a09 0973 6f63 6b65 745f 636c ete;...socket_cl │ │ │ +0004e140: 6f73 6572 2873 6f63 6b65 745f 636c 6f73 oser(socket_clos │ │ │ +0004e150: 6572 2026 616d 703b 2661 6d70 3b29 203d er &&) = │ │ │ +0004e160: 2064 656c 6574 653b 0a09 0973 6f63 6b65 delete;...socke │ │ │ +0004e170: 745f 636c 6f73 6572 2661 6d70 3b20 6f70 t_closer& op │ │ │ +0004e180: 6572 6174 6f72 3d28 736f 636b 6574 5f63 erator=(socket_c │ │ │ +0004e190: 6c6f 7365 7220 636f 6e73 7426 616d 703b loser const& │ │ │ +0004e1a0: 2920 3d20 6465 6c65 7465 3b0a 0909 736f ) = delete;...so │ │ │ +0004e1b0: 636b 6574 5f63 6c6f 7365 7226 616d 703b cket_closer& │ │ │ +0004e1c0: 206f 7065 7261 746f 723d 2873 6f63 6b65 operator=(socke │ │ │ +0004e1d0: 745f 636c 6f73 6572 2026 616d 703b 2661 t_closer &&a │ │ │ +0004e1e0: 6d70 3b29 203d 2064 656c 6574 653b 0a09 mp;) = delete;.. │ │ │ +0004e1f0: 097e 736f 636b 6574 5f63 6c6f 7365 7228 .~socket_closer( │ │ │ +0004e200: 2920 7b20 3a3a 636c 6f73 6528 6d5f 736f ) { ::close(m_so │ │ │ +0004e210: 636b 6574 293b 207d 0a09 7072 6976 6174 cket); }..privat │ │ │ +0004e220: 653a 0a09 0969 6e74 206d 5f73 6f63 6b65 e:...int m_socke │ │ │ +0004e230: 743b 0a09 7d3b 0a23 656e 6469 660a 0a23 t;..};.#endif..# │ │ │ +0004e240: 6966 2021 6465 6669 6e65 6420 544f 5252 if !defined TORR │ │ │ +0004e250: 454e 545f 4255 494c 445f 5349 4d55 4c41 ENT_BUILD_SIMULA │ │ │ +0004e260: 544f 520a 3c2f 7072 653e 3c2f 7464 3e3c TOR.
    < │ │ │ +0004e270: 2f74 723e 3c74 7220 7374 796c 653d 2262 /tr>relevance&n │ │ │ +0004e2a0: 6273 703b 303c 2f74 643e 3c74 643e 3c61 bsp;0. │ │ │ +0004e2d0: 2e2f 7372 632f 656e 756d 5f6e 6574 2e63 ./src/enum_net.c │ │ │ +0004e2e0: 7070 3a32 3638 3c2f 613e 3c2f 7464 3e3c pp:268< │ │ │ +0004e2f0: 7464 3e69 6620 7765 2067 6574 2068 6572 td>if we get her │ │ │ +0004e300: 652c 2074 6865 2063 616c 6c65 7220 7374 e, the caller st │ │ │ +0004e310: 696c 6c20 6173 7375 6d65 7320 7468 6520 ill assumes the │ │ │ +0004e320: 6572 726f 7220 636f 6465 2069 7320 7265 error code is re │ │ │ +0004e330: 706f 7274 6564 2076 6961 2065 7272 6e6f ported via errno │ │ │ +0004e340: 3c2f 7464 3e3c 2f74 723e 3c74 7220 6964

    if │ │ │ +0004e390: 2077 6520 6765 7420 6865 7265 2c20 7468 we get here, th │ │ │ +0004e3a0: 6520 6361 6c6c 6572 2073 7469 6c6c 2061 e caller still a │ │ │ +0004e3b0: 7373 756d 6573 2074 6865 2065 7272 6f72 ssumes the error │ │ │ +0004e3c0: 2063 6f64 650a 6973 2072 6570 6f72 7465 code.is reporte │ │ │ +0004e3d0: 6420 7669 6120 6572 726e 6f3c 2f68 323e d via errno

    │ │ │ +0004e3e0: 3c68 343e 2e2e 2f73 7263 2f65 6e75 6d5f

    ../src/enum_ │ │ │ +0004e3f0: 6e65 742e 6370 703a 3236 383c 2f68 343e net.cpp:268

    │ │ │ +0004e400: 3c70 7265 2073 7479 6c65 3d22 6261 636b
    ..;..}
    │ │ │ +0004e440: 0a23 656e 6469 660a 0a23 6966 2054 4f52  .#endif..#if TOR
    │ │ │ +0004e450: 5245 4e54 5f55 5345 5f4e 4554 4c49 4e4b  RENT_USE_NETLINK
    │ │ │ +0004e460: 0a0a 0969 6e74 2072 6561 645f 6e6c 5f73  ...int read_nl_s
    │ │ │ +0004e470: 6f63 6b28 696e 7420 736f 636b 2c20 7374  ock(int sock, st
    │ │ │ +0004e480: 643a 3a75 696e 7433 325f 7420 636f 6e73  d::uint32_t cons
    │ │ │ +0004e490: 7420 7365 712c 2073 7464 3a3a 7569 6e74  t seq, std::uint
    │ │ │ +0004e4a0: 3332 5f74 2063 6f6e 7374 2070 6964 0a09  32_t const pid..
    │ │ │ +0004e4b0: 092c 2073 7464 3a3a 6675 6e63 7469 6f6e  ., std::function
    │ │ │ +0004e4c0: 266c 743b 766f 6964 286e 6c6d 7367 6864  <void(nlmsghd
    │ │ │ +0004e4d0: 7220 636f 6e73 742a 2926 6774 3b20 6f6e  r const*)> on
    │ │ │ +0004e4e0: 5f6d 7367 290a 097b 0a09 0973 7464 3a3a  _msg)..{...std::
    │ │ │ +0004e4f0: 6172 7261 7926 6c74 3b63 6861 722c 2034  array<char, 4
    │ │ │ +0004e500: 3039 3626 6774 3b20 6275 663b 0a09 0966  096> buf;...f
    │ │ │ +0004e510: 6f72 2028 3b3b 290a 0909 7b0a 0909 0969  or (;;)...{....i
    │ │ │ +0004e520: 6e74 2063 6f6e 7374 2072 6561 645f 6c65  nt const read_le
    │ │ │ +0004e530: 6e20 3d20 696e 7428 7265 6376 2873 6f63  n = int(recv(soc
    │ │ │ +0004e540: 6b2c 2062 7566 2e64 6174 6128 292c 2062  k, buf.data(), b
    │ │ │ +0004e550: 7566 2e73 697a 6528 292c 2030 2929 3b0a  uf.size(), 0));.
    │ │ │ +0004e560: 0909 0969 6620 2872 6561 645f 6c65 6e20  ...if (read_len 
    │ │ │ +0004e570: 266c 743b 2030 2920 7265 7475 726e 202d  < 0) return -
    │ │ │ +0004e580: 313b 0a0a 0909 0961 7574 6f20 636f 6e73  1;.....auto cons
    │ │ │ +0004e590: 742a 206e 6c5f 6864 7220 3d20 7265 696e  t* nl_hdr = rein
    │ │ │ +0004e5a0: 7465 7270 7265 745f 6361 7374 266c 743b  terpret_cast<
    │ │ │ +0004e5b0: 6e6c 6d73 6768 6472 2063 6f6e 7374 2a26  nlmsghdr const*&
    │ │ │ +0004e5c0: 6774 3b28 6275 662e 6461 7461 2829 293b  gt;(buf.data());
    │ │ │ +0004e5d0: 0a09 0909 696e 7420 6c65 6e20 3d20 7265  ....int len = re
    │ │ │ +0004e5e0: 6164 5f6c 656e 3b0a 0a09 0909 666f 7220  ad_len;.....for 
    │ │ │ +0004e5f0: 283b 206c 656e 2026 6774 3b20 3020 2661  (; len > 0 &a
    │ │ │ +0004e600: 6d70 3b26 616d 703b 2061 7578 3a3a 6e6c  mp;& aux::nl
    │ │ │ +0004e610: 6d73 675f 6f6b 286e 6c5f 6864 722c 206c  msg_ok(nl_hdr, l
    │ │ │ +0004e620: 656e 293b 206e 6c5f 6864 7220 3d20 6175  en); nl_hdr = au
    │ │ │ +0004e630: 783a 3a6e 6c6d 7367 5f6e 6578 7428 6e6c  x::nlmsg_next(nl
    │ │ │ +0004e640: 5f68 6472 2c20 6c65 6e29 290a 0909 097b  _hdr, len))....{
    │ │ │ +0004e650: 0a3c 6469 7620 7374 796c 653d 2262 6163  .
    . │ │ │ +0004e680: 0909 0969 6620 2828 6175 783a 3a6e 6c6d ...if ((aux::nlm │ │ │ +0004e690: 7367 5f6f 6b28 6e6c 5f68 6472 2c20 7265 sg_ok(nl_hdr, re │ │ │ +0004e6a0: 6164 5f6c 656e 2920 3d3d 2030 2920 7c7c ad_len) == 0) || │ │ │ +0004e6b0: 2028 6e6c 5f68 6472 2d26 6774 3b6e 6c6d (nl_hdr->nlm │ │ │ +0004e6c0: 7367 5f74 7970 6520 3d3d 204e 4c4d 5347 sg_type == NLMSG │ │ │ +0004e6d0: 5f45 5252 4f52 2929 0a3c 2f64 6976 3e09 _ERROR)).
    . │ │ │ +0004e6e0: 0909 0909 7265 7475 726e 202d 313b 0a09 ....return -1;.. │ │ │ +0004e6f0: 0909 092f 2f20 7468 6973 2066 756e 6374 ...// this funct │ │ │ +0004e700: 696f 6e20 646f 6573 6e27 7420 6861 6e64 ion doesn't hand │ │ │ +0004e710: 6c65 206d 756c 7469 706c 6520 7265 7175 le multiple requ │ │ │ +0004e720: 6573 7473 2061 7420 7468 6520 7361 6d65 ests at the same │ │ │ +0004e730: 2074 696d 650a 0909 0909 2f2f 2073 6f20 time.....// so │ │ │ +0004e740: 7265 706f 7274 2061 6e20 6572 726f 7220 report an error │ │ │ +0004e750: 6966 2074 6865 206d 6573 7361 6765 2064 if the message d │ │ │ +0004e760: 6f65 7320 6e6f 7420 6861 7665 2074 6865 oes not have the │ │ │ +0004e770: 2065 7870 6563 7465 6420 7365 7120 616e expected seq an │ │ │ +0004e780: 6420 7069 640a 3c2f 7072 653e 3c2f 7464 d pid.
    relevance │ │ │ +0004e7c0: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ +0004e7d0: 3c61 2068 7265 663d 226a 6176 6173 6372 ../src/enum_net │ │ │ +0004e800: 2e63 7070 3a32 3734 3c2f 613e 3c2f 7464 .cpp:274if we get h │ │ │ +0004e820: 6572 652c 2074 6865 2063 616c 6c65 7220 ere, the caller │ │ │ +0004e830: 7374 696c 6c20 6173 7375 6d65 7320 7468 still assumes th │ │ │ +0004e840: 6520 6572 726f 7220 636f 6465 2069 7320 e error code is │ │ │ +0004e850: 7265 706f 7274 6564 2076 6961 2065 7272 reported via err │ │ │ +0004e860: 6e6f 3c2f 7464 3e3c 2f74 723e 3c74 7220 no

    │ │ │ +0004e8b0: 6966 2077 6520 6765 7420 6865 7265 2c20 if we get here, │ │ │ +0004e8c0: 7468 6520 6361 6c6c 6572 2073 7469 6c6c the caller still │ │ │ +0004e8d0: 2061 7373 756d 6573 2074 6865 2065 7272 assumes the err │ │ │ +0004e8e0: 6f72 2063 6f64 650a 6973 2072 6570 6f72 or code.is repor │ │ │ +0004e8f0: 7465 6420 7669 6120 6572 726e 6f3c 2f68 ted via errno

    ../src/enu │ │ │ +0004e910: 6d5f 6e65 742e 6370 703a 3237 343c 2f68 m_net.cpp:274
    #if 
    │ │ │ +0004e960: 544f 5252 454e 545f 5553 455f 4e45 544c  TORRENT_USE_NETL
    │ │ │ +0004e970: 494e 4b0a 0a09 696e 7420 7265 6164 5f6e  INK...int read_n
    │ │ │ +0004e980: 6c5f 736f 636b 2869 6e74 2073 6f63 6b2c  l_sock(int sock,
    │ │ │ +0004e990: 2073 7464 3a3a 7569 6e74 3332 5f74 2063   std::uint32_t c
    │ │ │ +0004e9a0: 6f6e 7374 2073 6571 2c20 7374 643a 3a75  onst seq, std::u
    │ │ │ +0004e9b0: 696e 7433 325f 7420 636f 6e73 7420 7069  int32_t const pi
    │ │ │ +0004e9c0: 640a 0909 2c20 7374 643a 3a66 756e 6374  d..., std::funct
    │ │ │ +0004e9d0: 696f 6e26 6c74 3b76 6f69 6428 6e6c 6d73  ion<void(nlms
    │ │ │ +0004e9e0: 6768 6472 2063 6f6e 7374 2a29 2667 743b  ghdr const*)>
    │ │ │ +0004e9f0: 206f 6e5f 6d73 6729 0a09 7b0a 0909 7374   on_msg)..{...st
    │ │ │ +0004ea00: 643a 3a61 7272 6179 266c 743b 6368 6172  d::array<char
    │ │ │ +0004ea10: 2c20 3430 3936 2667 743b 2062 7566 3b0a  , 4096> buf;.
    │ │ │ +0004ea20: 0909 666f 7220 283b 3b29 0a09 097b 0a09  ..for (;;)...{..
    │ │ │ +0004ea30: 0909 696e 7420 636f 6e73 7420 7265 6164  ..int const read
    │ │ │ +0004ea40: 5f6c 656e 203d 2069 6e74 2872 6563 7628  _len = int(recv(
    │ │ │ +0004ea50: 736f 636b 2c20 6275 662e 6461 7461 2829  sock, buf.data()
    │ │ │ +0004ea60: 2c20 6275 662e 7369 7a65 2829 2c20 3029  , buf.size(), 0)
    │ │ │ +0004ea70: 293b 0a09 0909 6966 2028 7265 6164 5f6c  );....if (read_l
    │ │ │ +0004ea80: 656e 2026 6c74 3b20 3029 2072 6574 7572  en < 0) retur
    │ │ │ +0004ea90: 6e20 2d31 3b0a 0a09 0909 6175 746f 2063  n -1;.....auto c
    │ │ │ +0004eaa0: 6f6e 7374 2a20 6e6c 5f68 6472 203d 2072  onst* nl_hdr = r
    │ │ │ +0004eab0: 6569 6e74 6572 7072 6574 5f63 6173 7426  einterpret_cast&
    │ │ │ +0004eac0: 6c74 3b6e 6c6d 7367 6864 7220 636f 6e73  lt;nlmsghdr cons
    │ │ │ +0004ead0: 742a 2667 743b 2862 7566 2e64 6174 6128  t*>(buf.data(
    │ │ │ +0004eae0: 2929 3b0a 0909 0969 6e74 206c 656e 203d  ));....int len =
    │ │ │ +0004eaf0: 2072 6561 645f 6c65 6e3b 0a0a 0909 0966   read_len;.....f
    │ │ │ +0004eb00: 6f72 2028 3b20 6c65 6e20 2667 743b 2030  or (; len > 0
    │ │ │ +0004eb10: 2026 616d 703b 2661 6d70 3b20 6175 783a   && aux:
    │ │ │ +0004eb20: 3a6e 6c6d 7367 5f6f 6b28 6e6c 5f68 6472  :nlmsg_ok(nl_hdr
    │ │ │ +0004eb30: 2c20 6c65 6e29 3b20 6e6c 5f68 6472 203d  , len); nl_hdr =
    │ │ │ +0004eb40: 2061 7578 3a3a 6e6c 6d73 675f 6e65 7874   aux::nlmsg_next
    │ │ │ +0004eb50: 286e 6c5f 6864 722c 206c 656e 2929 0a09  (nl_hdr, len))..
    │ │ │ +0004eb60: 0909 7b0a 0909 0909 6966 2028 2861 7578  ..{.....if ((aux
    │ │ │ +0004eb70: 3a3a 6e6c 6d73 675f 6f6b 286e 6c5f 6864  ::nlmsg_ok(nl_hd
    │ │ │ +0004eb80: 722c 2072 6561 645f 6c65 6e29 203d 3d20  r, read_len) == 
    │ │ │ +0004eb90: 3029 207c 7c20 286e 6c5f 6864 722d 2667  0) || (nl_hdr-&g
    │ │ │ +0004eba0: 743b 6e6c 6d73 675f 7479 7065 203d 3d20  t;nlmsg_type == 
    │ │ │ +0004ebb0: 4e4c 4d53 475f 4552 524f 5229 290a 0909  NLMSG_ERROR))...
    │ │ │ +0004ebc0: 0909 0972 6574 7572 6e20 2d31 3b0a 0909  ...return -1;...
    │ │ │ +0004ebd0: 0909 2f2f 2074 6869 7320 6675 6e63 7469  ..// this functi
    │ │ │ +0004ebe0: 6f6e 2064 6f65 736e 2774 2068 616e 646c  on doesn't handl
    │ │ │ +0004ebf0: 6520 6d75 6c74 6970 6c65 2072 6571 7565  e multiple reque
    │ │ │ +0004ec00: 7374 7320 6174 2074 6865 2073 616d 6520  sts at the same 
    │ │ │ +0004ec10: 7469 6d65 0a09 0909 092f 2f20 736f 2072  time.....// so r
    │ │ │ +0004ec20: 6570 6f72 7420 616e 2065 7272 6f72 2069  eport an error i
    │ │ │ +0004ec30: 6620 7468 6520 6d65 7373 6167 6520 646f  f the message do
    │ │ │ +0004ec40: 6573 206e 6f74 2068 6176 6520 7468 6520  es not have the 
    │ │ │ +0004ec50: 6578 7065 6374 6564 2073 6571 2061 6e64  expected seq and
    │ │ │ +0004ec60: 2070 6964 0a3c 6469 7620 7374 796c 653d   pid.
    ....if (nl_hd │ │ │ +0004eca0: 722d 2667 743b 6e6c 6d73 675f 7365 7120 r->nlmsg_seq │ │ │ +0004ecb0: 213d 2073 6571 207c 7c20 6e6c 5f68 6472 != seq || nl_hdr │ │ │ +0004ecc0: 2d26 6774 3b6e 6c6d 7367 5f70 6964 2021 ->nlmsg_pid ! │ │ │ +0004ecd0: 3d20 7069 6429 0a3c 2f64 6976 3e09 0909 = pid).
    ... │ │ │ +0004ece0: 0909 7265 7475 726e 202d 313b 0a0a 0909 ..return -1;.... │ │ │ +0004ecf0: 0909 6966 2028 6e6c 5f68 6472 2d26 6774 ..if (nl_hdr-> │ │ │ +0004ed00: 3b6e 6c6d 7367 5f74 7970 6520 3d3d 204e ;nlmsg_type == N │ │ │ +0004ed10: 4c4d 5347 5f44 4f4e 4529 2072 6574 7572 LMSG_DONE) retur │ │ │ +0004ed20: 6e20 303b 0a0a 0909 0909 6f6e 5f6d 7367 n 0;......on_msg │ │ │ +0004ed30: 286e 6c5f 6864 7229 3b0a 0a09 0909 0969 (nl_hdr);......i │ │ │ +0004ed40: 6620 2828 6e6c 5f68 6472 2d26 6774 3b6e f ((nl_hdr->n │ │ │ +0004ed50: 6c6d 7367 5f66 6c61 6773 2026 616d 703b lmsg_flags & │ │ │ +0004ed60: 204e 4c4d 5f46 5f4d 554c 5449 2920 3d3d NLM_F_MULTI) == │ │ │ +0004ed70: 2030 2920 7265 7475 726e 2030 3b0a 0909 0) return 0;... │ │ │ +0004ed80: 097d 0a09 097d 0a2f 2f09 0972 6574 7572 .}...}.//..retur │ │ │ +0004ed90: 6e20 303b 0a09 7d0a 0a09 696e 7420 6e6c n 0;..}...int nl │ │ │ +0004eda0: 5f64 756d 705f 7265 7175 6573 7428 696e _dump_request(in │ │ │ +0004edb0: 7420 636f 6e73 7420 736f 636b 2c20 7374 t const sock, st │ │ │ +0004edc0: 643a 3a75 696e 7433 325f 7420 636f 6e73 d::uint32_t cons │ │ │ +0004edd0: 7420 7365 710a 0909 2c20 6e6c 6d73 6768 t seq..., nlmsgh │ │ │ +0004ede0: 6472 2a20 636f 6e73 7420 7265 7175 6573 dr* const reques │ │ │ +0004edf0: 745f 6d73 672c 2073 7464 3a3a 6675 6e63 t_msg, std::func │ │ │ +0004ee00: 7469 6f6e 266c 743b 766f 6964 286e 6c6d tion<void(nlm │ │ │ +0004ee10: 7367 6864 7220 636f 6e73 742a 2926 6774 sghdr const*)> │ │ │ +0004ee20: 3b20 6f6e 5f6d 7367 290a 097b 0a09 0972 ; on_msg)..{...r │ │ │ +0004ee30: 6571 7565 7374 5f6d 7367 2d26 6774 3b6e equest_msg->n │ │ │ +0004ee40: 6c6d 7367 5f66 6c61 6773 203d 204e 4c4d lmsg_flags = NLM │ │ │ +0004ee50: 5f46 5f44 554d 5020 7c20 4e4c 4d5f 465f _F_DUMP | NLM_F_ │ │ │ +0004ee60: 5245 5155 4553 543b 0a09 0972 6571 7565 REQUEST;...reque │ │ │ +0004ee70: 7374 5f6d 7367 2d26 6774 3b6e 6c6d 7367 st_msg->nlmsg │ │ │ +0004ee80: 5f73 6571 203d 2073 6571 3b0a 0909 2f2f _seq = seq;...// │ │ │ +0004ee90: 2069 6e20 7468 656f 7279 206e 6c6d 7367 in theory nlmsg │ │ │ +0004eea0: 5f70 6964 2073 686f 756c 6420 6265 2073 _pid should be s │ │ │ +0004eeb0: 6574 2074 6f20 7468 6520 6e65 746c 696e et to the netlin │ │ │ +0004eec0: 6b20 706f 7274 2049 4420 284e 4f54 2074 k port ID (NOT t │ │ │ +0004eed0: 6865 2070 726f 6365 7373 2049 4429 0a09 he process ID).. │ │ │ +0004eee0: 092f 2f20 6f66 2074 6865 2073 656e 6465 .// of the sende │ │ │ +0004eef0: 722c 2062 7574 2074 6865 206b 6572 6e65 r, but the kerne │ │ │ +0004ef00: 6c20 6967 6e6f 7265 7320 7468 6973 2066 l ignores this f │ │ │ +0004ef10: 6965 6c64 2073 6f20 6974 2069 7320 7479 ield so it is ty │ │ │ +0004ef20: 7069 6361 6c6c 7920 7365 7420 746f 0a09 pically set to.. │ │ │ +0004ef30: 092f 2f20 7a65 726f 0a09 0972 6571 7565 .// zero...reque │ │ │ +0004ef40: 7374 5f6d 7367 2d26 6774 3b6e 6c6d 7367 st_msg->nlmsg │ │ │ +0004ef50: 5f70 6964 203d 2030 3b0a 0a09 0969 6620 _pid = 0;....if │ │ │ +0004ef60: 283a 3a73 656e 6428 736f 636b 2c20 7265 (::send(sock, re │ │ │ +0004ef70: 7175 6573 745f 6d73 672c 2072 6571 7565 quest_msg, reque │ │ │ +0004ef80: 7374 5f6d 7367 2d26 6774 3b6e 6c6d 7367 st_msg->nlmsg │ │ │ +0004ef90: 5f6c 656e 2c20 3029 2026 6c74 3b20 3029 _len, 0) < 0) │ │ │ +0004efa0: 0a09 0909 7265 7475 726e 202d 313b 0a0a ....return -1;.. │ │ │ +0004efb0: 0909 2f2f 2067 6574 2074 6865 2073 6f63 ..// get the soc │ │ │ +0004efc0: 6b65 7427 7320 706f 7274 2049 4420 736f ket's port ID so │ │ │ +0004efd0: 2074 6861 7420 7765 2063 616e 2076 6572 that we can ver │ │ │ +0004efe0: 6966 7920 6974 2069 6e20 7468 6520 7265 ify it in the re │ │ │ +0004eff0: 7370 6f6e 7365 0a09 0973 6f63 6b61 6464 sponse...sockadd │ │ │ +0004f000: 725f 6e6c 2073 6f63 6b5f 6164 6472 3b0a r_nl sock_addr;. │ │ │ +0004f010: 0909 736f 636b 6c65 6e5f 7420 736f 636b ..socklen_t sock │ │ │ +0004f020: 5f61 6464 725f 6c65 6e20 3d20 7369 7a65 _addr_len = size │ │ │ +0004f030: 6f66 2873 6f63 6b5f 6164 6472 293b 0a09 of(sock_addr);.. │ │ │ +0004f040: 0969 6620 283a 3a67 6574 736f 636b 6e61 .if (::getsockna │ │ │ +0004f050: 6d65 2873 6f63 6b2c 2072 6569 6e74 6572 me(sock, reinter │ │ │ +0004f060: 7072 6574 5f63 6173 7426 6c74 3b73 6f63 pret_cast<soc │ │ │ +0004f070: 6b61 6464 722a 2667 743b 2826 616d 703b kaddr*>(& │ │ │ +0004f080: 736f 636b 5f61 6464 7229 2c20 2661 6d70 sock_addr), & │ │ │ +0004f090: 3b73 6f63 6b5f 6164 6472 5f6c 656e 2920 ;sock_addr_len) │ │ │ +0004f0a0: 266c 743b 2030 290a 0909 0972 6574 7572 < 0)....retur │ │ │ +0004f0b0: 6e20 2d31 3b0a 3c2f 7072 653e 3c2f 7464 n -1;.
    relevance │ │ │ +0004f0f0: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ +0004f100: 3c61 2068 7265 663d 226a 6176 6173 6372 ../src/posix_pa │ │ │ +0004f130: 7274 5f66 696c 652e 6370 703a 3333 393c rt_file.cpp:339< │ │ │ +0004f140: 2f61 3e3c 2f74 643e 3c74 643e 7768 6174 /a>what │ │ │ +0004f150: 2064 6f20 7765 2064 6f20 6966 2073 6f6d do we do if som │ │ │ +0004f160: 656f 6e65 2069 7320 6375 7272 656e 746c eone is currentl │ │ │ +0004f170: 7920 7265 6164 696e 6720 6672 6f6d 2074 y reading from t │ │ │ +0004f180: 6865 2064 6973 6b20 6672 6f6d 2074 6869 he disk from thi │ │ │ +0004f190: 7320 7069 6563 653f 2064 6f65 7320 6974 s piece? does it │ │ │ +0004f1a0: 206d 6174 7465 723f 2053 696e 6365 2077 matter? Since w │ │ │ +0004f1b0: 6520 776f 6e27 7420 6163 7469 7665 6c79 e won't actively │ │ │ +0004f1c0: 2065 7261 7365 2074 6865 2064 6174 6120 erase the data │ │ │ +0004f1d0: 6672 6f6d 2064 6973 6b2c 2062 7574 2069 from disk, but i │ │ │ +0004f1e0: 7420 6d61 7920 6265 206f 7665 7277 7269 t may be overwri │ │ │ +0004f1f0: 7474 656e 2073 6f6f 6e2c 2069 7427 7320 tten soon, it's │ │ │ +0004f200: 7072 6f62 6162 6c79 206e 6f74 2074 6861 probably not tha │ │ │ +0004f210: 7420 6269 6720 6f66 2061 2064 6561 6c3c t big of a deal< │ │ │ +0004f220: 2f74 643e 3c2f 7472 3e3c 7472 2069 643d /td>

    wha │ │ │ +0004f270: 7420 646f 2077 6520 646f 2069 6620 736f t do we do if so │ │ │ +0004f280: 6d65 6f6e 6520 6973 2063 7572 7265 6e74 meone is current │ │ │ +0004f290: 6c79 2072 6561 6469 6e67 2066 726f 6d20 ly reading from │ │ │ +0004f2a0: 7468 6520 6469 736b 0a66 726f 6d20 7468 the disk.from th │ │ │ +0004f2b0: 6973 2070 6965 6365 3f20 646f 6573 2069 is piece? does i │ │ │ +0004f2c0: 7420 6d61 7474 6572 3f20 5369 6e63 6520 t matter? Since │ │ │ +0004f2d0: 7765 2077 6f6e 2774 2061 6374 6976 656c we won't activel │ │ │ +0004f2e0: 7920 6572 6173 6520 7468 650a 6461 7461 y erase the.data │ │ │ +0004f2f0: 2066 726f 6d20 6469 736b 2c20 6275 7420 from disk, but │ │ │ +0004f300: 6974 206d 6179 2062 6520 6f76 6572 7772 it may be overwr │ │ │ +0004f310: 6974 7465 6e20 736f 6f6e 2c20 6974 2773 itten soon, it's │ │ │ +0004f320: 2070 726f 6261 626c 7920 6e6f 7420 7468 probably not th │ │ │ +0004f330: 6174 0a62 6967 206f 6620 6120 6465 616c at.big of a deal │ │ │ +0004f340: 3c2f 6832 3e3c 6834 3e2e 2e2f 7372 632f

    ../src/ │ │ │ +0004f350: 706f 7369 785f 7061 7274 5f66 696c 652e posix_part_file. │ │ │ +0004f360: 6370 703a 3333 393c 2f68 343e 3c70 7265 cpp:339

    ....if (ec
    │ │ │ +0004f3b0: 2920 7265 7475 726e 207b 7d3b 0a0a 2369  ) return {};..#i
    │ │ │ +0004f3c0: 6664 6566 2054 4f52 5245 4e54 5f57 494e  fdef TORRENT_WIN
    │ │ │ +0004f3d0: 444f 5753 0a09 0909 7265 7420 3d20 6669  DOWS....ret = fi
    │ │ │ +0004f3e0: 6c65 5f70 6f69 6e74 6572 283a 3a5f 7766  le_pointer(::_wf
    │ │ │ +0004f3f0: 6f70 656e 2863 6f6e 7665 7274 5f74 6f5f  open(convert_to_
    │ │ │ +0004f400: 6e61 7469 7665 5f70 6174 685f 7374 7269  native_path_stri
    │ │ │ +0004f410: 6e67 2866 6e29 2e63 5f73 7472 2829 2c20  ng(fn).c_str(), 
    │ │ │ +0004f420: 4c22 7762 2b22 2929 3b0a 2365 6c73 650a  L"wb+"));.#else.
    │ │ │ +0004f430: 0909 0972 6574 203d 2066 696c 655f 706f  ...ret = file_po
    │ │ │ +0004f440: 696e 7465 7228 3a3a 666f 7065 6e28 666e  inter(::fopen(fn
    │ │ │ +0004f450: 2e63 5f73 7472 2829 2c20 2277 622b 2229  .c_str(), "wb+")
    │ │ │ +0004f460: 293b 0a23 656e 6469 660a 0909 0969 6620  );.#endif....if 
    │ │ │ +0004f470: 2872 6574 2e66 696c 6528 2920 3d3d 206e  (ret.file() == n
    │ │ │ +0004f480: 756c 6c70 7472 290a 0909 0909 6563 2e61  ullptr).....ec.a
    │ │ │ +0004f490: 7373 6967 6e28 6572 726e 6f2c 2067 656e  ssign(errno, gen
    │ │ │ +0004f4a0: 6572 6963 5f63 6174 6567 6f72 7928 2929  eric_category())
    │ │ │ +0004f4b0: 3b0a 0909 7d0a 0909 6966 2028 6563 2920  ;...}...if (ec) 
    │ │ │ +0004f4c0: 7265 7475 726e 207b 7d3b 0a09 0972 6574  return {};...ret
    │ │ │ +0004f4d0: 7572 6e20 7265 743b 0a09 7d0a 0a09 766f  urn ret;..}...vo
    │ │ │ +0004f4e0: 6964 2070 6f73 6978 5f70 6172 745f 6669  id posix_part_fi
    │ │ │ +0004f4f0: 6c65 3a3a 6672 6565 5f70 6965 6365 2870  le::free_piece(p
    │ │ │ +0004f500: 6965 6365 5f69 6e64 6578 5f74 2063 6f6e  iece_index_t con
    │ │ │ +0004f510: 7374 2070 6965 6365 290a 097b 0a09 0961  st piece)..{...a
    │ │ │ +0004f520: 7574 6f20 636f 6e73 7420 6920 3d20 6d5f  uto const i = m_
    │ │ │ +0004f530: 7069 6563 655f 6d61 702e 6669 6e64 2870  piece_map.find(p
    │ │ │ +0004f540: 6965 6365 293b 0a09 0969 6620 2869 203d  iece);...if (i =
    │ │ │ +0004f550: 3d20 6d5f 7069 6563 655f 6d61 702e 656e  = m_piece_map.en
    │ │ │ +0004f560: 6428 2929 2072 6574 7572 6e3b 0a0a 3c64  d()) return;.....m_free_slot
    │ │ │ +0004f5b0: 732e 7075 7368 5f62 6163 6b28 692d 2667  s.push_back(i-&g
    │ │ │ +0004f5c0: 743b 7365 636f 6e64 293b 0a09 096d 5f70  t;second);...m_p
    │ │ │ +0004f5d0: 6965 6365 5f6d 6170 2e65 7261 7365 2869  iece_map.erase(i
    │ │ │ +0004f5e0: 293b 0a09 096d 5f64 6972 7479 5f6d 6574  );...m_dirty_met
    │ │ │ +0004f5f0: 6164 6174 6120 3d20 7472 7565 3b0a 097d  adata = true;..}
    │ │ │ +0004f600: 0a0a 0976 6f69 6420 706f 7369 785f 7061  ...void posix_pa
    │ │ │ +0004f610: 7274 5f66 696c 653a 3a6d 6f76 655f 7061  rt_file::move_pa
    │ │ │ +0004f620: 7274 6669 6c65 2873 7464 3a3a 7374 7269  rtfile(std::stri
    │ │ │ +0004f630: 6e67 2063 6f6e 7374 2661 6d70 3b20 7061  ng const& pa
    │ │ │ +0004f640: 7468 2c20 6572 726f 725f 636f 6465 2661  th, error_code&a
    │ │ │ +0004f650: 6d70 3b20 6563 290a 097b 0a09 0966 6c75  mp; ec)..{...flu
    │ │ │ +0004f660: 7368 5f6d 6574 6164 6174 615f 696d 706c  sh_metadata_impl
    │ │ │ +0004f670: 2865 6329 3b0a 0909 6966 2028 6563 2920  (ec);...if (ec) 
    │ │ │ +0004f680: 7265 7475 726e 3b0a 0a09 0969 6620 2821  return;....if (!
    │ │ │ +0004f690: 6d5f 7069 6563 655f 6d61 702e 656d 7074  m_piece_map.empt
    │ │ │ +0004f6a0: 7928 2929 0a09 097b 0a09 0909 7374 643a  y())...{....std:
    │ │ │ +0004f6b0: 3a73 7472 696e 6720 6f6c 645f 7061 7468  :string old_path
    │ │ │ +0004f6c0: 203d 2063 6f6d 6269 6e65 5f70 6174 6828   = combine_path(
    │ │ │ +0004f6d0: 6d5f 7061 7468 2c20 6d5f 6e61 6d65 293b  m_path, m_name);
    │ │ │ +0004f6e0: 0a09 0909 7374 643a 3a73 7472 696e 6720  ....std::string 
    │ │ │ +0004f6f0: 6e65 775f 7061 7468 203d 2063 6f6d 6269  new_path = combi
    │ │ │ +0004f700: 6e65 5f70 6174 6828 7061 7468 2c20 6d5f  ne_path(path, m_
    │ │ │ +0004f710: 6e61 6d65 293b 0a0a 0909 0972 656e 616d  name);.....renam
    │ │ │ +0004f720: 6528 6f6c 645f 7061 7468 2c20 6e65 775f  e(old_path, new_
    │ │ │ +0004f730: 7061 7468 2c20 6563 293b 0a09 0909 6966  path, ec);....if
    │ │ │ +0004f740: 2028 6563 203d 3d20 626f 6f73 743a 3a73   (ec == boost::s
    │ │ │ +0004f750: 7973 7465 6d3a 3a65 7272 633a 3a6e 6f5f  ystem::errc::no_
    │ │ │ +0004f760: 7375 6368 5f66 696c 655f 6f72 5f64 6972  such_file_or_dir
    │ │ │ +0004f770: 6563 746f 7279 290a 0909 0909 6563 2e63  ectory).....ec.c
    │ │ │ +0004f780: 6c65 6172 2829 3b0a 0a09 0909 6966 2028  lear();.....if (
    │ │ │ +0004f790: 6563 290a 0909 097b 0a09 0909 0973 746f  ec)....{.....sto
    │ │ │ +0004f7a0: 7261 6765 5f65 7272 6f72 2073 653b 0a09  rage_error se;..
    │ │ │ +0004f7b0: 0909 0961 7578 3a3a 636f 7079 5f66 696c  ...aux::copy_fil
    │ │ │ +0004f7c0: 6528 6f6c 645f 7061 7468 2c20 6e65 775f  e(old_path, new_
    │ │ │ +0004f7d0: 7061 7468 2c20 7365 293b 0a09 0909 0965  path, se);.....e
    │ │ │ +0004f7e0: 6320 3d20 7365 2e65 633b 0a09 0909 0969  c = se.ec;.....i
    │ │ │ +0004f7f0: 6620 2865 6329 2072 6574 7572 6e3b 0a09  f (ec) return;..
    │ │ │ +0004f800: 0909 0972 656d 6f76 6528 6f6c 645f 7061  ...remove(old_pa
    │ │ │ +0004f810: 7468 2c20 6563 293b 0a09 0909 7d0a 0909  th, ec);....}...
    │ │ │ +0004f820: 7d0a 0909 6d5f 7061 7468 203d 2070 6174  }...m_path = pat
    │ │ │ +0004f830: 683b 0a09 7d0a 3c2f 7072 653e 3c2f 7464  h;..}.
    relevance │ │ │ +0004f870: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ +0004f880: 3c61 2068 7265 663d 226a 6176 6173 6372
    ../src/posix_pa │ │ │ +0004f8b0: 7274 5f66 696c 652e 6370 703a 3432 393c rt_file.cpp:429< │ │ │ +0004f8c0: 2f61 3e3c 2f74 643e 3c74 643e 696e 7374 /a>inst │ │ │ +0004f8d0: 6561 6420 6f66 2072 6562 7569 6c64 696e ead of rebuildin │ │ │ +0004f8e0: 6720 7468 6520 7768 6f6c 6520 6669 6c65 g the whole file │ │ │ +0004f8f0: 2068 6561 6465 7220 616e 6420 666c 7573 header and flus │ │ │ +0004f900: 6869 6e67 2069 742c 2075 7064 6174 6520 hing it, update │ │ │ +0004f910: 7468 6520 736c 6f74 2065 6e74 7269 6573 the slot entries │ │ │ +0004f920: 2061 7320 7765 2067 6f3c 2f74 643e 3c2f as we go

    instead o │ │ │ +0004f980: 6620 7265 6275 696c 6469 6e67 2074 6865 f rebuilding the │ │ │ +0004f990: 2077 686f 6c65 2066 696c 6520 6865 6164 whole file head │ │ │ +0004f9a0: 6572 0a61 6e64 2066 6c75 7368 696e 6720 er.and flushing │ │ │ +0004f9b0: 6974 2c20 7570 6461 7465 2074 6865 2073 it, update the s │ │ │ +0004f9c0: 6c6f 7420 656e 7472 6965 7320 6173 2077 lot entries as w │ │ │ +0004f9d0: 6520 676f 3c2f 6832 3e3c 6834 3e2e 2e2f e go

    ../ │ │ │ +0004f9e0: 7372 632f 706f 7369 785f 7061 7274 5f66 src/posix_part_f │ │ │ +0004f9f0: 696c 652e 6370 703a 3432 393c 2f68 343e ile.cpp:429

    │ │ │ +0004fa00: 3c70 7265 2073 7479 6c65 3d22 6261 636b
    ....{.
    │ │ │ +0004fa40: 0909 0909 0969 6620 2873 7464 3a3a 6665  .....if (std::fe
    │ │ │ +0004fa50: 7272 6f72 2866 696c 652e 6669 6c65 2829  rror(file.file()
    │ │ │ +0004fa60: 2929 2065 632e 6173 7369 676e 2865 7272  )) ec.assign(err
    │ │ │ +0004fa70: 6e6f 2c20 6765 6e65 7269 635f 6361 7465  no, generic_cate
    │ │ │ +0004fa80: 676f 7279 2829 293b 0a09 0909 0909 656c  gory());......el
    │ │ │ +0004fa90: 7365 2065 632e 6173 7369 676e 2865 7272  se ec.assign(err
    │ │ │ +0004faa0: 6f72 733a 3a66 696c 655f 746f 6f5f 7368  ors::file_too_sh
    │ │ │ +0004fab0: 6f72 742c 206c 6962 746f 7272 656e 745f  ort, libtorrent_
    │ │ │ +0004fac0: 6361 7465 676f 7279 2829 293b 0a09 0909  category());....
    │ │ │ +0004fad0: 097d 0a0a 0909 0909 6966 2028 6563 2920  .}......if (ec) 
    │ │ │ +0004fae0: 7265 7475 726e 3b0a 0a09 0909 0966 2866  return;......f(f
    │ │ │ +0004faf0: 696c 655f 6f66 6673 6574 2c20 7b62 7566  ile_offset, {buf
    │ │ │ +0004fb00: 2e67 6574 2829 2c20 626c 6f63 6b5f 746f  .get(), block_to
    │ │ │ +0004fb10: 5f63 6f70 797d 293b 0a09 0909 7d0a 0909  _copy});....}...
    │ │ │ +0004fb20: 0966 696c 655f 6f66 6673 6574 202b 3d20  .file_offset += 
    │ │ │ +0004fb30: 626c 6f63 6b5f 746f 5f63 6f70 793b 0a09  block_to_copy;..
    │ │ │ +0004fb40: 0909 7069 6563 655f 6f66 6673 6574 203d  ..piece_offset =
    │ │ │ +0004fb50: 2030 3b0a 0909 0973 697a 6520 2d3d 2062   0;....size -= b
    │ │ │ +0004fb60: 6c6f 636b 5f74 6f5f 636f 7079 3b0a 0909  lock_to_copy;...
    │ │ │ +0004fb70: 7d0a 097d 0a0a 0976 6f69 6420 706f 7369  }..}...void posi
    │ │ │ +0004fb80: 785f 7061 7274 5f66 696c 653a 3a66 6c75  x_part_file::flu
    │ │ │ +0004fb90: 7368 5f6d 6574 6164 6174 6128 6572 726f  sh_metadata(erro
    │ │ │ +0004fba0: 725f 636f 6465 2661 6d70 3b20 6563 290a  r_code& ec).
    │ │ │ +0004fbb0: 097b 0a09 0966 6c75 7368 5f6d 6574 6164  .{...flush_metad
    │ │ │ +0004fbc0: 6174 615f 696d 706c 2865 6329 3b0a 097d  ata_impl(ec);..}
    │ │ │ +0004fbd0: 0a0a 3c64 6976 2073 7479 6c65 3d22 6261  ..
    │ │ │ +0004fc00: 0976 6f69 6420 706f 7369 785f 7061 7274 .void posix_part │ │ │ +0004fc10: 5f66 696c 653a 3a66 6c75 7368 5f6d 6574 _file::flush_met │ │ │ +0004fc20: 6164 6174 615f 696d 706c 2865 7272 6f72 adata_impl(error │ │ │ +0004fc30: 5f63 6f64 6526 616d 703b 2065 6329 0a3c _code& ec).< │ │ │ +0004fc40: 2f64 6976 3e09 7b0a 0909 2f2f 2064 6f20 /div>.{...// do │ │ │ +0004fc50: 7765 206e 6565 6420 746f 2066 6c75 7368 we need to flush │ │ │ +0004fc60: 2074 6865 206d 6574 6164 6174 613f 0a09 the metadata?.. │ │ │ +0004fc70: 0969 6620 286d 5f64 6972 7479 5f6d 6574 .if (m_dirty_met │ │ │ +0004fc80: 6164 6174 6120 3d3d 2066 616c 7365 2920 adata == false) │ │ │ +0004fc90: 7265 7475 726e 3b0a 0a09 0969 6620 286d return;....if (m │ │ │ +0004fca0: 5f70 6965 6365 5f6d 6170 2e65 6d70 7479 _piece_map.empty │ │ │ +0004fcb0: 2829 290a 0909 7b0a 0909 092f 2f20 6966 ())...{....// if │ │ │ +0004fcc0: 2077 6520 646f 6e27 7420 6861 7665 2061 we don't have a │ │ │ +0004fcd0: 6e79 2070 6965 6365 7320 6c65 6674 2069 ny pieces left i │ │ │ +0004fce0: 6e20 7468 650a 0909 092f 2f20 7061 7274 n the....// part │ │ │ +0004fcf0: 2066 696c 652c 2072 656d 6f76 6520 6974 file, remove it │ │ │ +0004fd00: 0a09 0909 7374 643a 3a73 7472 696e 6720 ....std::string │ │ │ +0004fd10: 636f 6e73 7420 7020 3d20 636f 6d62 696e const p = combin │ │ │ +0004fd20: 655f 7061 7468 286d 5f70 6174 682c 206d e_path(m_path, m │ │ │ +0004fd30: 5f6e 616d 6529 3b0a 0909 0972 656d 6f76 _name);....remov │ │ │ +0004fd40: 6528 702c 2065 6329 3b0a 0a09 0909 6966 e(p, ec);.....if │ │ │ +0004fd50: 2028 6563 203d 3d20 626f 6f73 743a 3a73 (ec == boost::s │ │ │ +0004fd60: 7973 7465 6d3a 3a65 7272 633a 3a6e 6f5f ystem::errc::no_ │ │ │ +0004fd70: 7375 6368 5f66 696c 655f 6f72 5f64 6972 such_file_or_dir │ │ │ +0004fd80: 6563 746f 7279 290a 0909 0909 6563 2e63 ectory).....ec.c │ │ │ +0004fd90: 6c65 6172 2829 3b0a 0909 0972 6574 7572 lear();....retur │ │ │ +0004fda0: 6e3b 0a09 097d 0a0a 0909 6175 746f 2066 n;...}....auto f │ │ │ +0004fdb0: 203d 206f 7065 6e5f 6669 6c65 286f 7065 = open_file(ope │ │ │ +0004fdc0: 6e5f 6d6f 6465 3a3a 7265 6164 5f77 7269 n_mode::read_wri │ │ │ +0004fdd0: 7465 2c20 6563 293b 0a09 0969 6620 2865 te, ec);...if (e │ │ │ +0004fde0: 6329 2072 6574 7572 6e3b 0a0a 0909 7374 c) return;....st │ │ │ +0004fdf0: 643a 3a76 6563 746f 7226 6c74 3b63 6861 d::vector<cha │ │ │ +0004fe00: 7226 6774 3b20 6865 6164 6572 2873 7461 r> header(sta │ │ │ +0004fe10: 7469 635f 6361 7374 266c 743b 7374 643a tic_cast<std: │ │ │ +0004fe20: 3a73 697a 655f 7426 6774 3b28 6d5f 6865 :size_t>(m_he │ │ │ +0004fe30: 6164 6572 5f73 697a 6529 293b 0a0a 0909 ader_size));.... │ │ │ +0004fe40: 7573 696e 6720 6e61 6d65 7370 6163 6520 using namespace │ │ │ +0004fe50: 6c69 6274 6f72 7265 6e74 3a3a 6175 783b libtorrent::aux; │ │ │ +0004fe60: 0a0a 0909 6368 6172 2a20 7074 7220 3d20 ....char* ptr = │ │ │ +0004fe70: 6865 6164 6572 2e64 6174 6128 293b 0a09 header.data();.. │ │ │ +0004fe80: 0977 7269 7465 5f75 696e 7433 3228 6d5f .write_uint32(m_ │ │ │ +0004fe90: 6d61 785f 7069 6563 6573 2c20 7074 7229 max_pieces, ptr) │ │ │ +0004fea0: 3b0a 0909 7772 6974 655f 7569 6e74 3332 ;...write_uint32 │ │ │ +0004feb0: 286d 5f70 6965 6365 5f73 697a 652c 2070 (m_piece_size, p │ │ │ +0004fec0: 7472 293b 0a0a 0909 666f 7220 2870 6965 tr);....for (pie │ │ │ +0004fed0: 6365 5f69 6e64 6578 5f74 2070 6965 6365 ce_index_t piece │ │ │ +0004fee0: 2830 293b 2070 6965 6365 2026 6c74 3b20 (0); piece < │ │ │ +0004fef0: 7069 6563 655f 696e 6465 785f 7428 6d5f piece_index_t(m_ │ │ │ +0004ff00: 6d61 785f 7069 6563 6573 293b 202b 2b70 max_pieces); ++p │ │ │ +0004ff10: 6965 6365 290a 0909 7b0a 0909 0961 7574 iece)...{....aut │ │ │ +0004ff20: 6f20 636f 6e73 7420 6920 3d20 6d5f 7069 o const i = m_pi │ │ │ +0004ff30: 6563 655f 6d61 702e 6669 6e64 2870 6965 ece_map.find(pie │ │ │ +0004ff40: 6365 293b 0a3c 2f70 7265 3e3c 2f74 643e ce);.
    │ │ │ +0004ff50: 3c2f 7472 3e3c 7472 2073 7479 6c65 3d22 relevance& │ │ │ +0004ff80: 6e62 7370 3b30 3c2f 7464 3e3c 7464 3e3c nbsp;0< │ │ │ +0004ff90: 6120 6872 6566 3d22 6a61 7661 7363 7269 a href="javascri │ │ │ +0004ffa0: 7074 3a65 7870 616e 6428 3139 3029 223e pt:expand(190)"> │ │ │ +0004ffb0: 2e2e 2f73 7263 2f74 6f72 7265 6e74 5f70 ../src/torrent_p │ │ │ +0004ffc0: 6565 722e 6370 703a 3139 323c 2f61 3e3c eer.cpp:192
    < │ │ │ +0004ffd0: 2f74 643e 3c74 643e 686f 7720 646f 2077 /td>how do w │ │ │ +0004ffe0: 6520 6465 616c 2077 6974 6820 6f75 7220 e deal with our │ │ │ +0004fff0: 6578 7465 726e 616c 2061 6464 7265 7373 external address │ │ │ +00050000: 2063 6861 6e67 696e 673f 3c2f 7464 3e3c changing?< │ │ │ +00050010: 2f74 723e 3c74 7220 6964 3d22 3139 3022 /tr>

    how do w │ │ │ +00050060: 6520 6465 616c 2077 6974 6820 6f75 7220 e deal with our │ │ │ +00050070: 6578 7465 726e 616c 2061 6464 7265 7373 external address │ │ │ +00050080: 2063 6861 6e67 696e 673f 3c2f 6832 3e3c changing?

    < │ │ │ +00050090: 6834 3e2e 2e2f 7372 632f 746f 7272 656e h4>../src/torren │ │ │ +000500a0: 745f 7065 6572 2e63 7070 3a31 3932 3c2f t_peer.cpp:192
    ../
    │ │ │ +000500f0: 2f20 636f 6e6e 6563 7469 6f6e 732e 2049  / connections. I
    │ │ │ +00050100: 6620 6974 2066 6169 6c73 2c20 7765 276c  f it fails, we'l
    │ │ │ +00050110: 6c0a 0909 2f2f 2072 6574 7279 2077 6974  l...// retry wit
    │ │ │ +00050120: 6820 656e 6372 7970 7469 6f6e 0a09 092c  h encryption...,
    │ │ │ +00050130: 2070 655f 7375 7070 6f72 7428 6661 6c73   pe_support(fals
    │ │ │ +00050140: 6529 0a23 656e 6469 660a 0909 2c20 6973  e).#endif..., is
    │ │ │ +00050150: 5f76 365f 6164 6472 2866 616c 7365 290a  _v6_addr(false).
    │ │ │ +00050160: 2369 6620 544f 5252 454e 545f 5553 455f  #if TORRENT_USE_
    │ │ │ +00050170: 4932 500a 0909 2c20 6973 5f69 3270 5f61  I2P..., is_i2p_a
    │ │ │ +00050180: 6464 7228 6661 6c73 6529 0a23 656e 6469  ddr(false).#endi
    │ │ │ +00050190: 660a 0909 2c20 6f6e 5f70 6172 6f6c 6528  f..., on_parole(
    │ │ │ +000501a0: 6661 6c73 6529 0a09 092c 2062 616e 6e65  false)..., banne
    │ │ │ +000501b0: 6428 6661 6c73 6529 0a09 092c 2073 7570  d(false)..., sup
    │ │ │ +000501c0: 706f 7274 735f 7574 7028 7472 7565 2920  ports_utp(true) 
    │ │ │ +000501d0: 2f2f 2061 7373 756d 6520 7065 6572 7320  // assume peers 
    │ │ │ +000501e0: 7375 7070 6f72 7420 7574 700a 0909 2c20  support utp..., 
    │ │ │ +000501f0: 636f 6e66 6972 6d65 645f 7375 7070 6f72  confirmed_suppor
    │ │ │ +00050200: 7473 5f75 7470 2866 616c 7365 290a 0909  ts_utp(false)...
    │ │ │ +00050210: 2c20 7375 7070 6f72 7473 5f68 6f6c 6570  , supports_holep
    │ │ │ +00050220: 756e 6368 2866 616c 7365 290a 0909 2c20  unch(false)..., 
    │ │ │ +00050230: 7765 625f 7365 6564 2866 616c 7365 290a  web_seed(false).
    │ │ │ +00050240: 0909 2c20 7072 6f74 6f63 6f6c 5f76 3228  .., protocol_v2(
    │ │ │ +00050250: 6661 6c73 6529 0a09 7b7d 0a0a 0973 7464  false)..{}...std
    │ │ │ +00050260: 3a3a 7569 6e74 3332 5f74 2074 6f72 7265  ::uint32_t torre
    │ │ │ +00050270: 6e74 5f70 6565 723a 3a72 616e 6b28 6578  nt_peer::rank(ex
    │ │ │ +00050280: 7465 726e 616c 5f69 7020 636f 6e73 7426  ternal_ip const&
    │ │ │ +00050290: 616d 703b 2065 7874 6572 6e61 6c2c 2069  amp; external, i
    │ │ │ +000502a0: 6e74 2065 7874 6572 6e61 6c5f 706f 7274  nt external_port
    │ │ │ +000502b0: 2920 636f 6e73 740a 097b 0a09 0954 4f52  ) const..{...TOR
    │ │ │ +000502c0: 5245 4e54 5f41 5353 4552 5428 696e 5f75  RENT_ASSERT(in_u
    │ │ │ +000502d0: 7365 293b 0a3c 6469 7620 7374 796c 653d  se);.
    ..if (peer_ra │ │ │ +00050310: 6e6b 203d 3d20 3029 0a3c 2f64 6976 3e09 nk == 0).
    . │ │ │ +00050320: 0909 7065 6572 5f72 616e 6b20 3d20 7065 ..peer_rank = pe │ │ │ +00050330: 6572 5f70 7269 6f72 6974 7928 0a09 0909 er_priority(.... │ │ │ +00050340: 0974 6370 3a3a 656e 6470 6f69 6e74 2865 .tcp::endpoint(e │ │ │ +00050350: 7874 6572 6e61 6c2e 6578 7465 726e 616c xternal.external │ │ │ +00050360: 5f61 6464 7265 7373 2874 6869 732d 2667 _address(this-&g │ │ │ +00050370: 743b 6164 6472 6573 7328 2929 2c20 7374 t;address()), st │ │ │ +00050380: 643a 3a75 696e 7431 365f 7428 6578 7465 d::uint16_t(exte │ │ │ +00050390: 726e 616c 5f70 6f72 7429 290a 0909 0909 rnal_port))..... │ │ │ +000503a0: 2c20 7463 703a 3a65 6e64 706f 696e 7428 , tcp::endpoint( │ │ │ +000503b0: 7468 6973 2d26 6774 3b61 6464 7265 7373 this->address │ │ │ +000503c0: 2829 2c20 7468 6973 2d26 6774 3b70 6f72 (), this->por │ │ │ +000503d0: 7429 293b 0a09 0972 6574 7572 6e20 7065 t));...return pe │ │ │ +000503e0: 6572 5f72 616e 6b3b 0a09 7d0a 0a23 6966 er_rank;..}..#if │ │ │ +000503f0: 6e64 6566 2054 4f52 5245 4e54 5f44 4953 ndef TORRENT_DIS │ │ │ +00050400: 4142 4c45 5f4c 4f47 4749 4e47 0a09 7374 ABLE_LOGGING..st │ │ │ +00050410: 643a 3a73 7472 696e 6720 746f 7272 656e d::string torren │ │ │ +00050420: 745f 7065 6572 3a3a 746f 5f73 7472 696e t_peer::to_strin │ │ │ +00050430: 6728 2920 636f 6e73 740a 097b 0a09 0954 g() const..{...T │ │ │ +00050440: 4f52 5245 4e54 5f41 5353 4552 5428 696e ORRENT_ASSERT(in │ │ │ +00050450: 5f75 7365 293b 0a23 6966 2054 4f52 5245 _use);.#if TORRE │ │ │ +00050460: 4e54 5f55 5345 5f49 3250 0a09 0969 6620 NT_USE_I2P...if │ │ │ +00050470: 2869 735f 6932 705f 6164 6472 2920 7265 (is_i2p_addr) re │ │ │ +00050480: 7475 726e 2064 6573 7428 292e 746f 5f73 turn dest().to_s │ │ │ +00050490: 7472 696e 6728 293b 0a23 656e 6469 6620 tring();.#endif │ │ │ +000504a0: 2f2f 2054 4f52 5245 4e54 5f55 5345 5f49 // TORRENT_USE_I │ │ │ +000504b0: 3250 0a09 0972 6574 7572 6e20 6164 6472 2P...return addr │ │ │ +000504c0: 6573 7328 292e 746f 5f73 7472 696e 6728 ess().to_string( │ │ │ +000504d0: 293b 0a09 7d0a 2365 6e64 6966 0a0a 0973 );..}.#endif...s │ │ │ +000504e0: 7464 3a3a 696e 7436 345f 7420 746f 7272 td::int64_t torr │ │ │ +000504f0: 656e 745f 7065 6572 3a3a 746f 7461 6c5f ent_peer::total_ │ │ │ +00050500: 646f 776e 6c6f 6164 2829 2063 6f6e 7374 download() const │ │ │ +00050510: 0a09 7b0a 0909 544f 5252 454e 545f 4153 ..{...TORRENT_AS │ │ │ +00050520: 5345 5254 2869 6e5f 7573 6529 3b0a 0909 SERT(in_use);... │ │ │ +00050530: 6966 2028 636f 6e6e 6563 7469 6f6e 2021 if (connection ! │ │ │ +00050540: 3d20 6e75 6c6c 7074 7229 0a09 097b 0a09 = nullptr)...{.. │ │ │ +00050550: 0909 544f 5252 454e 545f 4153 5345 5254 ..TORRENT_ASSERT │ │ │ +00050560: 2870 7265 765f 616d 6f75 6e74 5f64 6f77 (prev_amount_dow │ │ │ +00050570: 6e6c 6f61 6420 3d3d 2030 293b 0a09 0909 nload == 0);.... │ │ │ +00050580: 7265 7475 726e 2063 6f6e 6e65 6374 696f return connectio │ │ │ +00050590: 6e2d 2667 743b 7374 6174 6973 7469 6373 n->statistics │ │ │ +000505a0: 2829 2e74 6f74 616c 5f70 6179 6c6f 6164 ().total_payload │ │ │ +000505b0: 5f64 6f77 6e6c 6f61 6428 293b 0a09 097d _download();...} │ │ │ +000505c0: 0a09 0965 6c73 650a 0909 7b0a 0909 0972 ...else...{....r │ │ │ +000505d0: 6574 7572 6e20 7374 643a 3a69 6e74 3634 eturn std::int64 │ │ │ +000505e0: 5f74 2870 7265 765f 616d 6f75 6e74 5f64 _t(prev_amount_d │ │ │ +000505f0: 6f77 6e6c 6f61 6429 2026 6c74 3b26 6c74 ownload) << │ │ │ +00050600: 3b20 3130 3b0a 0909 7d0a 097d 0a3c 2f70 ; 10;...}..}.

    re │ │ │ +00050640: 6c65 7661 6e63 6526 6e62 7370 3b30 3c2f levance 0../src/h │ │ │ +00050680: 6173 685f 7069 636b 6572 2e63 7070 3a33 ash_picker.cpp:3 │ │ │ +00050690: 3334 3c2f 613e 3c2f 7464 3e3c 7464 3e75 34u │ │ │ +000506a0: 7365 2073 7472 7563 7475 7265 6420 6269 se structured bi │ │ │ +000506b0: 6e64 696e 6773 2069 6e20 432b 2b31 373c ndings in C++17< │ │ │ +000506c0: 2f74 643e 3c2f 7472 3e3c 7472 2069 643d /td>

    use │ │ │ +00050710: 2073 7472 7563 7475 7265 6420 6269 6e64 structured bind │ │ │ +00050720: 696e 6773 2069 6e20 432b 2b31 373c 2f68 ings in C++17

    ../src/has │ │ │ +00050740: 685f 7069 636b 6572 2e63 7070 3a33 3334 h_picker.cpp:334 │ │ │ +00050750: 3c2f 6834 3e3c 7072 6520 7374 796c 653d

    .
    │ │ │ +00050790: 092c 2069 6e74 2063 6f6e 7374 206f 6666  ., int const off
    │ │ │ +000507a0: 7365 742c 2073 6861 3235 365f 6861 7368  set, sha256_hash
    │ │ │ +000507b0: 2063 6f6e 7374 2661 6d70 3b20 6829 0a09   const& h)..
    │ │ │ +000507c0: 7b0a 0909 544f 5252 454e 545f 4153 5345  {...TORRENT_ASSE
    │ │ │ +000507d0: 5254 286f 6666 7365 7420 2667 743b 3d20  RT(offset >= 
    │ │ │ +000507e0: 3029 3b0a 0909 6175 746f 2063 6f6e 7374  0);...auto const
    │ │ │ +000507f0: 2066 203d 206d 5f66 696c 6573 2e66 696c   f = m_files.fil
    │ │ │ +00050800: 655f 696e 6465 785f 6174 5f70 6965 6365  e_index_at_piece
    │ │ │ +00050810: 2870 6965 6365 293b 0a0a 0909 6966 2028  (piece);....if (
    │ │ │ +00050820: 6d5f 6669 6c65 732e 7061 645f 6669 6c65  m_files.pad_file
    │ │ │ +00050830: 5f61 7428 6629 290a 0909 0972 6574 7572  _at(f))....retur
    │ │ │ +00050840: 6e20 7b20 7365 745f 626c 6f63 6b5f 6861  n { set_block_ha
    │ │ │ +00050850: 7368 5f72 6573 756c 743a 3a72 6573 756c  sh_result::resul
    │ │ │ +00050860: 743a 3a73 7563 6365 7373 2c20 302c 2030  t::success, 0, 0
    │ │ │ +00050870: 207d 3b0a 0a09 0961 7574 6f26 616d 703b   };....auto&
    │ │ │ +00050880: 206d 6572 6b6c 655f 7472 6565 203d 206d   merkle_tree = m
    │ │ │ +00050890: 5f6d 6572 6b6c 655f 7472 6565 735b 665d  _merkle_trees[f]
    │ │ │ +000508a0: 3b0a 0909 7069 6563 655f 696e 6465 785f  ;...piece_index_
    │ │ │ +000508b0: 7420 636f 6e73 7420 6669 6c65 5f66 6972  t const file_fir
    │ │ │ +000508c0: 7374 5f70 6965 6365 203d 206d 5f66 696c  st_piece = m_fil
    │ │ │ +000508d0: 6573 2e70 6965 6365 5f69 6e64 6578 5f61  es.piece_index_a
    │ │ │ +000508e0: 745f 6669 6c65 2866 293b 0a09 0973 7464  t_file(f);...std
    │ │ │ +000508f0: 3a3a 696e 7436 345f 7420 636f 6e73 7420  ::int64_t const 
    │ │ │ +00050900: 626c 6f63 6b5f 6f66 6673 6574 203d 2073  block_offset = s
    │ │ │ +00050910: 7461 7469 635f 6361 7374 266c 743b 696e  tatic_cast<in
    │ │ │ +00050920: 7426 6774 3b28 7069 6563 6529 202a 2073  t>(piece) * s
    │ │ │ +00050930: 7464 3a3a 696e 7436 345f 7428 6d5f 6669  td::int64_t(m_fi
    │ │ │ +00050940: 6c65 732e 7069 6563 655f 6c65 6e67 7468  les.piece_length
    │ │ │ +00050950: 2829 290a 0909 092b 206f 6666 7365 7420  ())....+ offset 
    │ │ │ +00050960: 2d20 6d5f 6669 6c65 732e 6669 6c65 5f6f  - m_files.file_o
    │ │ │ +00050970: 6666 7365 7428 6629 3b0a 0909 696e 7420  ffset(f);...int 
    │ │ │ +00050980: 636f 6e73 7420 626c 6f63 6b5f 696e 6465  const block_inde
    │ │ │ +00050990: 7820 3d20 6175 783a 3a6e 756d 6572 6963  x = aux::numeric
    │ │ │ +000509a0: 5f63 6173 7426 6c74 3b69 6e74 2667 743b  _cast<int>
    │ │ │ +000509b0: 2862 6c6f 636b 5f6f 6666 7365 7420 2f20  (block_offset / 
    │ │ │ +000509c0: 6465 6661 756c 745f 626c 6f63 6b5f 7369  default_block_si
    │ │ │ +000509d0: 7a65 293b 0a0a 0909 6966 2028 682e 6973  ze);....if (h.is
    │ │ │ +000509e0: 5f61 6c6c 5f7a 6572 6f73 2829 290a 0909  _all_zeros())...
    │ │ │ +000509f0: 7b0a 0909 0954 4f52 5245 4e54 5f41 5353  {....TORRENT_ASS
    │ │ │ +00050a00: 4552 545f 4641 494c 2829 3b0a 0909 0972  ERT_FAIL();....r
    │ │ │ +00050a10: 6574 7572 6e20 7365 745f 626c 6f63 6b5f  eturn set_block_
    │ │ │ +00050a20: 6861 7368 5f72 6573 756c 743a 3a62 6c6f  hash_result::blo
    │ │ │ +00050a30: 636b 5f68 6173 685f 6661 696c 6564 2829  ck_hash_failed()
    │ │ │ +00050a40: 3b0a 0909 7d0a 0a3c 6469 7620 7374 796c  ;...}..
    ..aux::merk │ │ │ +00050a80: 6c65 5f74 7265 653a 3a73 6574 5f62 6c6f le_tree::set_blo │ │ │ +00050a90: 636b 5f72 6573 756c 7420 7265 7375 6c74 ck_result result │ │ │ +00050aa0: 3b0a 3c2f 6469 763e 0909 696e 7420 6c65 ;.
    ..int le │ │ │ +00050ab0: 6166 735f 696e 6465 783b 0a09 0969 6e74 afs_index;...int │ │ │ +00050ac0: 206c 6561 6673 5f73 697a 653b 0a09 0973 leafs_size;...s │ │ │ +00050ad0: 7464 3a3a 7469 6528 7265 7375 6c74 2c20 td::tie(result, │ │ │ +00050ae0: 6c65 6166 735f 696e 6465 782c 206c 6561 leafs_index, lea │ │ │ +00050af0: 6673 5f73 697a 6529 203d 206d 6572 6b6c fs_size) = merkl │ │ │ +00050b00: 655f 7472 6565 2e73 6574 5f62 6c6f 636b e_tree.set_block │ │ │ +00050b10: 2862 6c6f 636b 5f69 6e64 6578 2c20 6829 (block_index, h) │ │ │ +00050b20: 3b0a 0a09 0969 6620 2872 6573 756c 7420 ;....if (result │ │ │ +00050b30: 3d3d 2061 7578 3a3a 6d65 726b 6c65 5f74 == aux::merkle_t │ │ │ +00050b40: 7265 653a 3a73 6574 5f62 6c6f 636b 5f72 ree::set_block_r │ │ │ +00050b50: 6573 756c 743a 3a75 6e6b 6e6f 776e 290a esult::unknown). │ │ │ +00050b60: 0909 0972 6574 7572 6e20 7365 745f 626c ...return set_bl │ │ │ +00050b70: 6f63 6b5f 6861 7368 5f72 6573 756c 743a ock_hash_result: │ │ │ +00050b80: 3a75 6e6b 6e6f 776e 2829 3b0a 0909 6966 :unknown();...if │ │ │ +00050b90: 2028 7265 7375 6c74 203d 3d20 6175 783a (result == aux: │ │ │ +00050ba0: 3a6d 6572 6b6c 655f 7472 6565 3a3a 7365 :merkle_tree::se │ │ │ +00050bb0: 745f 626c 6f63 6b5f 7265 7375 6c74 3a3a t_block_result:: │ │ │ +00050bc0: 626c 6f63 6b5f 6861 7368 5f66 6169 6c65 block_hash_faile │ │ │ +00050bd0: 6429 0a09 0909 7265 7475 726e 2073 6574 d)....return set │ │ │ +00050be0: 5f62 6c6f 636b 5f68 6173 685f 7265 7375 _block_hash_resu │ │ │ +00050bf0: 6c74 3a3a 626c 6f63 6b5f 6861 7368 5f66 lt::block_hash_f │ │ │ +00050c00: 6169 6c65 6428 293b 0a0a 0909 6175 746f ailed();....auto │ │ │ +00050c10: 2063 6f6e 7374 2073 7461 7475 7320 3d20 const status = │ │ │ +00050c20: 2872 6573 756c 7420 3d3d 2061 7578 3a3a (result == aux:: │ │ │ +00050c30: 6d65 726b 6c65 5f74 7265 653a 3a73 6574 merkle_tree::set │ │ │ +00050c40: 5f62 6c6f 636b 5f72 6573 756c 743a 3a68 _block_result::h │ │ │ +00050c50: 6173 685f 6661 696c 6564 290a 0909 093f ash_failed)....? │ │ │ +00050c60: 2073 6574 5f62 6c6f 636b 5f68 6173 685f set_block_hash_ │ │ │ +00050c70: 7265 7375 6c74 3a3a 7265 7375 6c74 3a3a result::result:: │ │ │ +00050c80: 7069 6563 655f 6861 7368 5f66 6169 6c65 piece_hash_faile │ │ │ +00050c90: 640a 0909 093a 2073 6574 5f62 6c6f 636b d....: set_block │ │ │ +00050ca0: 5f68 6173 685f 7265 7375 6c74 3a3a 7265 _hash_result::re │ │ │ +00050cb0: 7375 6c74 3a3a 7375 6363 6573 733b 0a0a sult::success;.. │ │ │ +00050cc0: 0909 696e 7420 636f 6e73 7420 626c 6f63 ..int const bloc │ │ │ +00050cd0: 6b73 5f70 6572 5f70 6965 6365 203d 206d ks_per_piece = m │ │ │ +00050ce0: 5f66 696c 6573 2e70 6965 6365 5f6c 656e _files.piece_len │ │ │ +00050cf0: 6774 6828 2920 2f20 6465 6661 756c 745f gth() / default_ │ │ │ +00050d00: 626c 6f63 6b5f 7369 7a65 3b0a 0a09 0972 block_size;....r │ │ │ +00050d10: 6574 7572 6e20 7b20 7374 6174 7573 0a09 eturn { status.. │ │ │ +00050d20: 0909 2c20 696e 7428 6c65 6166 735f 696e .., int(leafs_in │ │ │ +00050d30: 6465 7820 2d20 7374 6174 6963 5f63 6173 dex - static_cas │ │ │ +00050d40: 7426 6c74 3b69 6e74 2667 743b 2870 6965 t<int>(pie │ │ │ +00050d50: 6365 202d 2066 696c 655f 6669 7273 745f ce - file_first_ │ │ │ +00050d60: 7069 6563 6529 202a 2062 6c6f 636b 735f piece) * blocks_ │ │ │ +00050d70: 7065 725f 7069 6563 6529 0a09 0909 2c20 per_piece)...., │ │ │ +00050d80: 7374 643a 3a6d 696e 286c 6561 6673 5f73 std::min(leafs_s │ │ │ +00050d90: 697a 652c 206d 5f66 696c 6573 2e66 696c ize, m_files.fil │ │ │ +00050da0: 655f 6e75 6d5f 7069 6563 6573 2866 2920 e_num_pieces(f) │ │ │ +00050db0: 2a20 626c 6f63 6b73 5f70 6572 5f70 6965 * blocks_per_pie │ │ │ +00050dc0: 6365 202d 206c 6561 6673 5f69 6e64 6578 ce - leafs_index │ │ │ +00050dd0: 2920 7d3b 0a09 7d0a 0a09 766f 6964 2068 ) };..}...void h │ │ │ +00050de0: 6173 685f 7069 636b 6572 3a3a 6861 7368 ash_picker::hash │ │ │ +00050df0: 6573 5f72 656a 6563 7465 6428 6861 7368 es_rejected(hash │ │ │ +00050e00: 5f72 6571 7565 7374 2063 6f6e 7374 2661 _request const&a │ │ │ +00050e10: 6d70 3b20 7265 7129 0a09 7b0a 0909 544f mp; req)..{...TO │ │ │ +00050e20: 5252 454e 545f 4153 5345 5254 2872 6571 RRENT_ASSERT(req │ │ │ +00050e30: 2e62 6173 6520 3d3d 206d 5f70 6965 6365 .base == m_piece │ │ │ +00050e40: 5f6c 6179 6572 2026 616d 703b 2661 6d70 _layer && │ │ │ +00050e50: 3b20 7265 712e 696e 6465 7820 2520 3531 ; req.index % 51 │ │ │ +00050e60: 3220 3d3d 2030 293b 0a0a 0909 666f 7220 2 == 0);....for │ │ │ +00050e70: 2869 6e74 2069 203d 2072 6571 2e69 6e64 (int i = req.ind │ │ │ +00050e80: 6578 3b20 6920 266c 743b 2072 6571 2e69 ex; i < req.i │ │ │ +00050e90: 6e64 6578 202b 2072 6571 2e63 6f75 6e74 ndex + req.count │ │ │ +00050ea0: 3b20 6920 2b3d 2035 3132 290a 0909 7b0a ; i += 512)...{. │ │ │ +00050eb0: 0909 096d 5f70 6965 6365 5f68 6173 685f ...m_piece_hash_ │ │ │ +00050ec0: 7265 7175 6573 7465 645b 7265 712e 6669 requested[req.fi │ │ │ +00050ed0: 6c65 5d5b 6920 2f20 3531 325d 2e6c 6173 le][i / 512].las │ │ │ +00050ee0: 745f 7265 7175 6573 7420 3d20 6d69 6e5f t_request = min_ │ │ │ +00050ef0: 7469 6d65 2829 3b0a 0909 092d 2d6d 5f70 time();....--m_p │ │ │ +00050f00: 6965 6365 5f68 6173 685f 7265 7175 6573 iece_hash_reques │ │ │ +00050f10: 7465 645b 7265 712e 6669 6c65 5d5b 6920 ted[req.file][i │ │ │ +00050f20: 2f20 3531 325d 2e6e 756d 5f72 6571 7565 / 512].num_reque │ │ │ +00050f30: 7374 733b 0a09 097d 0a0a 3c2f 7072 653e sts;...}..
    │ │ │ +00050f40: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ +00050f70: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ +00050f80: 3c74 643e 3c61 2068 7265 663d 226a 6176 ../src/magn │ │ │ +00050fb0: 6574 5f75 7269 2e63 7070 3a34 3531 3c2f et_uri.cpp:451what' │ │ │ +00050fd0: 7320 7468 6520 7269 6768 7420 6e75 6d62 s the right numb │ │ │ +00050fe0: 6572 2068 6572 653f 3c2f 7464 3e3c 2f74 er here?

    what's the │ │ │ +00051040: 2072 6967 6874 206e 756d 6265 7220 6865 right number he │ │ │ +00051050: 7265 3f3c 2f68 323e 3c68 343e 2e2e 2f73 re?

    ../s │ │ │ +00051060: 7263 2f6d 6167 6e65 745f 7572 692e 6370 rc/magnet_uri.cp │ │ │ +00051070: 703a 3435 313c 2f68 343e 3c70 7265 2073 p:451

    ...}....else
    │ │ │ +000510c0: 2069 6620 2873 7472 696e 675f 6571 7561   if (string_equa
    │ │ │ +000510d0: 6c5f 6e6f 5f63 6173 6528 6e61 6d65 2c20  l_no_case(name, 
    │ │ │ +000510e0: 2273 6f22 5f73 7629 2920 2f2f 2073 656c  "so"_sv)) // sel
    │ │ │ +000510f0: 6563 742d 6f6e 6c79 2028 6669 6c65 7329  ect-only (files)
    │ │ │ +00051100: 0a09 0909 7b0a 0909 0909 2f2f 2061 6363  ....{.....// acc
    │ │ │ +00051110: 6570 7420 6f6e 6c79 2064 6967 6974 732c  ept only digits,
    │ │ │ +00051120: 2027 2d27 2061 6e64 2027 2c27 0a09 0909   '-' and ','....
    │ │ │ +00051130: 0969 6620 2873 7464 3a3a 616e 795f 6f66  .if (std::any_of
    │ │ │ +00051140: 2876 616c 7565 2e62 6567 696e 2829 2c20  (value.begin(), 
    │ │ │ +00051150: 7661 6c75 652e 656e 6428 292c 205b 5d28  value.end(), [](
    │ │ │ +00051160: 6368 6172 2063 290a 0909 0909 097b 2072  char c)......{ r
    │ │ │ +00051170: 6574 7572 6e20 2169 735f 6469 6769 7428  eturn !is_digit(
    │ │ │ +00051180: 6329 2026 616d 703b 2661 6d70 3b20 6320  c) && c 
    │ │ │ +00051190: 213d 2027 2d27 2026 616d 703b 2661 6d70  != '-' &&
    │ │ │ +000511a0: 3b20 6320 213d 2027 2c27 3b20 7d29 290a  ; c != ','; })).
    │ │ │ +000511b0: 0909 0909 0963 6f6e 7469 6e75 653b 0a0a  .....continue;..
    │ │ │ +000511c0: 0909 0909 2f2f 206d 616b 6520 7375 7265  ....// make sure
    │ │ │ +000511d0: 2061 6c6c 2066 696c 6520 7072 696f 7269   all file priori
    │ │ │ +000511e0: 7469 6573 2061 7265 2073 6574 2074 6f20  ties are set to 
    │ │ │ +000511f0: 302c 2065 7863 6570 7420 7468 6520 6f6e  0, except the on
    │ │ │ +00051200: 6573 0a09 0909 092f 2f20 7765 2073 7065  es.....// we spe
    │ │ │ +00051210: 6369 6679 2069 6e20 7468 6520 6669 6c65  cify in the file
    │ │ │ +00051220: 5f70 7269 6f72 6974 6965 730a 0909 0909  _priorities.....
    │ │ │ +00051230: 702e 666c 6167 7320 7c3d 2074 6f72 7265  p.flags |= torre
    │ │ │ +00051240: 6e74 5f66 6c61 6773 3a3a 6465 6661 756c  nt_flags::defaul
    │ │ │ +00051250: 745f 646f 6e74 5f64 6f77 6e6c 6f61 643b  t_dont_download;
    │ │ │ +00051260: 0a0a 0909 0909 646f 0a09 0909 097b 0a09  ......do.....{..
    │ │ │ +00051270: 0909 0909 7374 7269 6e67 5f76 6965 7720  ....string_view 
    │ │ │ +00051280: 746f 6b65 6e3b 0a09 0909 0909 7374 643a  token;......std:
    │ │ │ +00051290: 3a74 6965 2874 6f6b 656e 2c20 7661 6c75  :tie(token, valu
    │ │ │ +000512a0: 6529 203d 2073 706c 6974 5f73 7472 696e  e) = split_strin
    │ │ │ +000512b0: 6728 7661 6c75 652c 2027 2c27 293b 0a0a  g(value, ',');..
    │ │ │ +000512c0: 0909 0909 0969 6620 2874 6f6b 656e 2e65  .....if (token.e
    │ │ │ +000512d0: 6d70 7479 2829 2920 636f 6e74 696e 7565  mpty()) continue
    │ │ │ +000512e0: 3b0a 0a09 0909 0909 696e 7420 6964 7831  ;.......int idx1
    │ │ │ +000512f0: 2c20 6964 7832 3b0a 3c64 6976 2073 7479  , idx2;.
    .....const │ │ │ +00051330: 6578 7072 2069 6e74 206d 6178 5f69 6e64 expr int max_ind │ │ │ +00051340: 6578 203d 2031 3030 3030 3b20 2f2f 2063 ex = 10000; // c │ │ │ +00051350: 616e 2774 2072 6973 6b20 6f75 7420 6f66 an't risk out of │ │ │ +00051360: 206d 656d 6f72 790a 3c2f 6469 763e 0a09 memory.
    .. │ │ │ +00051370: 0909 0909 6175 746f 2063 6f6e 7374 2064 ....auto const d │ │ │ +00051380: 6976 6964 6572 203d 2074 6f6b 656e 2e66 ivider = token.f │ │ │ +00051390: 696e 645f 6669 7273 745f 6f66 2827 2d27 ind_first_of('-' │ │ │ +000513a0: 293b 0a09 0909 0909 6966 2028 6469 7669 );......if (divi │ │ │ +000513b0: 6465 7220 213d 2073 7464 3a3a 7374 7269 der != std::stri │ │ │ +000513c0: 6e67 3a3a 6e70 6f73 2920 2f2f 2069 7427 ng::npos) // it' │ │ │ +000513d0: 7320 6120 7261 6e67 650a 0909 0909 097b s a range......{ │ │ │ +000513e0: 0a09 0909 0909 0969 6620 2864 6976 6964 .......if (divid │ │ │ +000513f0: 6572 203d 3d20 3029 202f 2f20 6e6f 2073 er == 0) // no s │ │ │ +00051400: 7461 7274 2069 6e64 6578 0a09 0909 0909 tart index...... │ │ │ +00051410: 0909 636f 6e74 696e 7565 3b0a 0909 0909 ..continue;..... │ │ │ +00051420: 0909 6966 2028 6469 7669 6465 7220 3d3d ..if (divider == │ │ │ +00051430: 2074 6f6b 656e 2e73 697a 6528 2920 2d20 token.size() - │ │ │ +00051440: 3129 202f 2f20 6e6f 2065 6e64 2069 6e64 1) // no end ind │ │ │ +00051450: 6578 0a09 0909 0909 0909 636f 6e74 696e ex........contin │ │ │ +00051460: 7565 3b0a 0a09 0909 0909 0969 6478 3120 ue;........idx1 │ │ │ +00051470: 3d20 7374 643a 3a61 746f 6928 746f 6b65 = std::atoi(toke │ │ │ +00051480: 6e2e 7375 6273 7472 2830 2c20 6469 7669 n.substr(0, divi │ │ │ +00051490: 6465 7229 2e74 6f5f 7374 7269 6e67 2829 der).to_string() │ │ │ +000514a0: 2e63 5f73 7472 2829 293b 0a09 0909 0909 .c_str());...... │ │ │ +000514b0: 0969 6620 2869 6478 3120 266c 743b 2030 .if (idx1 < 0 │ │ │ +000514c0: 207c 7c20 6964 7831 2026 6774 3b20 6d61 || idx1 > ma │ │ │ +000514d0: 785f 696e 6465 7829 202f 2f20 696e 7661 x_index) // inva │ │ │ +000514e0: 6c69 6420 696e 6465 780a 0909 0909 0909 lid index....... │ │ │ +000514f0: 0963 6f6e 7469 6e75 653b 0a09 0909 0909 .continue;...... │ │ │ +00051500: 0969 6478 3220 3d20 7374 643a 3a61 746f .idx2 = std::ato │ │ │ +00051510: 6928 746f 6b65 6e2e 7375 6273 7472 2864 i(token.substr(d │ │ │ +00051520: 6976 6964 6572 202b 2031 292e 746f 5f73 ivider + 1).to_s │ │ │ +00051530: 7472 696e 6728 292e 635f 7374 7228 2929 tring().c_str()) │ │ │ +00051540: 3b0a 0909 0909 0909 6966 2028 6964 7832 ;.......if (idx2 │ │ │ +00051550: 2026 6c74 3b20 3020 7c7c 2069 6478 3220 < 0 || idx2 │ │ │ +00051560: 2667 743b 206d 6178 5f69 6e64 6578 2920 > max_index) │ │ │ +00051570: 2f2f 2069 6e76 616c 6964 2069 6e64 6578 // invalid index │ │ │ +00051580: 0a09 0909 0909 0909 636f 6e74 696e 7565 ........continue │ │ │ +00051590: 3b0a 0a09 0909 0909 0969 6620 2869 6478 ;........if (idx │ │ │ +000515a0: 3120 2667 743b 2069 6478 3229 202f 2f20 1 > idx2) // │ │ │ +000515b0: 7772 6f6e 6720 7261 6e67 6520 6c69 6d69 wrong range limi │ │ │ +000515c0: 7473 0a09 0909 0909 0909 636f 6e74 696e ts........contin │ │ │ +000515d0: 7565 3b0a 0909 0909 097d 0a09 0909 0909 ue;......}...... │ │ │ +000515e0: 656c 7365 202f 2f20 6974 2773 2061 6e20 else // it's an │ │ │ +000515f0: 696e 6465 780a 0909 0909 097b 0a09 0909 index......{.... │ │ │ +00051600: 0909 0969 6478 3120 3d20 7374 643a 3a61 ...idx1 = std::a │ │ │ +00051610: 746f 6928 746f 6b65 6e2e 746f 5f73 7472 toi(token.to_str │ │ │ +00051620: 696e 6728 292e 635f 7374 7228 2929 3b0a ing().c_str());. │ │ │ +00051630: 0909 0909 0909 6966 2028 6964 7831 2026 ......if (idx1 & │ │ │ +00051640: 6c74 3b20 3020 7c7c 2069 6478 3120 2667 lt; 0 || idx1 &g │ │ │ +00051650: 743b 206d 6178 5f69 6e64 6578 2920 2f2f t; max_index) // │ │ │ +00051660: 2069 6e76 616c 6964 2069 6e64 6578 0a09 invalid index.. │ │ │ +00051670: 0909 0909 0909 636f 6e74 696e 7565 3b0a ......continue;. │ │ │ +00051680: 0909 0909 0909 6964 7832 203d 2069 6478 ......idx2 = idx │ │ │ +00051690: 313b 0a09 0909 0909 7d0a 0a09 0909 0909 1;......}....... │ │ │ +000516a0: 6966 2028 696e 7428 702e 6669 6c65 5f70 if (int(p.file_p │ │ │ +000516b0: 7269 6f72 6974 6965 732e 7369 7a65 2829 riorities.size() │ │ │ +000516c0: 2920 266c 743b 3d20 6964 7832 290a 0909 ) <= idx2)... │ │ │ +000516d0: 0909 0909 702e 6669 6c65 5f70 7269 6f72 ....p.file_prior │ │ │ +000516e0: 6974 6965 732e 7265 7369 7a65 2873 7461 ities.resize(sta │ │ │ +000516f0: 7469 635f 6361 7374 266c 743b 7374 643a tic_cast<std: │ │ │ +00051700: 3a73 697a 655f 7426 6774 3b28 6964 7832 :size_t>(idx2 │ │ │ +00051710: 2920 2b20 312c 2064 6f6e 745f 646f 776e ) + 1, dont_down │ │ │ +00051720: 6c6f 6164 293b 0a0a 3c2f 7072 653e 3c2f load);..
    relevan │ │ │ +00051760: 6365 266e 6273 703b 303c 2f74 643e 3c74 ce 0
    ../src/random │ │ │ +000517a0: 2e63 7070 3a31 3431 3c2f 613e 3c2f 7464 .cpp:141improve cal │ │ │ +000517c0: 6c69 6e67 2052 414e 445f 6279 7465 7320 ling RAND_bytes │ │ │ +000517d0: 6d75 6c74 6970 6c65 2074 696d 6573 2c20 multiple times, │ │ │ +000517e0: 7573 696e 6720 6661 6c6c 6261 636b 2066 using fallback f │ │ │ +000517f0: 6f72 206e 6f77 3c2f 7464 3e3c 2f74 723e or now │ │ │ +00051800: 3c74 7220 6964 3d22 3139 3322 2073 7479 │ │ │ +00051830: 3c74 6420 636f 6c73 7061 6e3d 2233 223e │ │ │ +00051840: 3c68 323e 696d 7072 6f76 6520 6361 6c6c

    improve call │ │ │ +00051850: 696e 6720 5241 4e44 5f62 7974 6573 206d ing RAND_bytes m │ │ │ +00051860: 756c 7469 706c 6520 7469 6d65 732c 2075 ultiple times, u │ │ │ +00051870: 7369 6e67 2066 616c 6c62 6163 6b20 666f sing fallback fo │ │ │ +00051880: 7220 6e6f 773c 2f68 323e 3c68 343e 2e2e r now

    .. │ │ │ +00051890: 2f73 7263 2f72 616e 646f 6d2e 6370 703a /src/random.cpp: │ │ │ +000518a0: 3134 313c 2f68 343e 3c70 7265 2073 7479 141

    #else....std::
    │ │ │ +000518f0: 6765 6e65 7261 7465 2862 7566 6665 722e  generate(buffer.
    │ │ │ +00051900: 6265 6769 6e28 292c 2062 7566 6665 722e  begin(), buffer.
    │ │ │ +00051910: 656e 6428 292c 205b 5d20 7b20 7265 7475  end(), [] { retu
    │ │ │ +00051920: 726e 2063 6861 7228 7261 6e64 6f6d 2830  rn char(random(0
    │ │ │ +00051930: 7866 6629 293b 207d 293b 0a23 656e 6469  xff)); });.#endi
    │ │ │ +00051940: 660a 0909 7d0a 0a09 0976 6f69 6420 6372  f...}....void cr
    │ │ │ +00051950: 7970 746f 5f72 616e 646f 6d5f 6279 7465  ypto_random_byte
    │ │ │ +00051960: 7328 7370 616e 266c 743b 6368 6172 2667  s(span<char&g
    │ │ │ +00051970: 743b 2062 7566 6665 7229 0a09 097b 0a23  t; buffer)...{.#
    │ │ │ +00051980: 6966 6465 6620 544f 5252 454e 545f 4255  ifdef TORRENT_BU
    │ │ │ +00051990: 494c 445f 5349 4d55 4c41 544f 520a 0909  ILD_SIMULATOR...
    │ │ │ +000519a0: 092f 2f20 496e 2074 6865 2073 696d 756c  .// In the simul
    │ │ │ +000519b0: 6174 6f72 2077 6520 7761 6e74 2064 6574  ator we want det
    │ │ │ +000519c0: 6572 6d69 6e69 7374 6963 2072 616e 646f  erministic rando
    │ │ │ +000519d0: 6d20 6e75 6d62 6572 730a 0909 0973 7464  m numbers....std
    │ │ │ +000519e0: 3a3a 6765 6e65 7261 7465 2862 7566 6665  ::generate(buffe
    │ │ │ +000519f0: 722e 6265 6769 6e28 292c 2062 7566 6665  r.begin(), buffe
    │ │ │ +00051a00: 722e 656e 6428 292c 205b 5d20 7b20 7265  r.end(), [] { re
    │ │ │ +00051a10: 7475 726e 2063 6861 7228 7261 6e64 6f6d  turn char(random
    │ │ │ +00051a20: 2830 7866 6629 293b 207d 293b 0a23 656c  (0xff)); });.#el
    │ │ │ +00051a30: 6966 2054 4f52 5245 4e54 5f55 5345 5f43  if TORRENT_USE_C
    │ │ │ +00051a40: 4e47 0a09 0909 6175 783a 3a63 6e67 5f67  NG....aux::cng_g
    │ │ │ +00051a50: 656e 5f72 616e 646f 6d28 6275 6666 6572  en_random(buffer
    │ │ │ +00051a60: 293b 0a23 656c 6966 2054 4f52 5245 4e54  );.#elif TORRENT
    │ │ │ +00051a70: 5f55 5345 5f43 5259 5054 4f41 5049 0a09  _USE_CRYPTOAPI..
    │ │ │ +00051a80: 0909 2f2f 2077 696e 646f 7773 0a09 0909  ..// windows....
    │ │ │ +00051a90: 6175 783a 3a63 7279 7074 5f67 656e 5f72  aux::crypt_gen_r
    │ │ │ +00051aa0: 616e 646f 6d28 6275 6666 6572 293b 0a23  andom(buffer);.#
    │ │ │ +00051ab0: 656c 6966 2064 6566 696e 6564 2054 4f52  elif defined TOR
    │ │ │ +00051ac0: 5245 4e54 5f55 5345 5f4c 4942 4352 5950  RENT_USE_LIBCRYP
    │ │ │ +00051ad0: 544f 2026 616d 703b 2661 6d70 3b20 2164  TO && !d
    │ │ │ +00051ae0: 6566 696e 6564 2054 4f52 5245 4e54 5f55  efined TORRENT_U
    │ │ │ +00051af0: 5345 5f57 4f4c 4653 534c 0a2f 2f20 776f  SE_WOLFSSL.// wo
    │ │ │ +00051b00: 6c66 5353 4c20 7573 6573 2077 635f 524e  lfSSL uses wc_RN
    │ │ │ +00051b10: 475f 4765 6e65 7261 7465 426c 6f63 6b20  G_GenerateBlock 
    │ │ │ +00051b20: 6173 2074 6865 2069 6e74 6572 6e61 6c20  as the internal 
    │ │ │ +00051b30: 6675 6e63 7469 6f6e 2066 6f72 2074 6865  function for the
    │ │ │ +00051b40: 0a2f 2f20 6f70 656e 7373 6c20 636f 6d70  .// openssl comp
    │ │ │ +00051b50: 6174 6962 696c 6974 7920 6c61 7965 722e  atibility layer.
    │ │ │ +00051b60: 2054 6869 7320 6675 6e63 7469 6f6e 2041   This function A
    │ │ │ +00051b70: 5049 2064 6f65 7320 6e6f 7420 7375 7070  PI does not supp
    │ │ │ +00051b80: 6f72 740a 2f2f 2061 6e20 6172 6269 7472  ort.// an arbitr
    │ │ │ +00051b90: 6172 7920 6275 6666 6572 2073 697a 6520  ary buffer size 
    │ │ │ +00051ba0: 286f 7065 6e73 736c 2064 6f65 7329 2c20  (openssl does), 
    │ │ │ +00051bb0: 6974 2069 7320 6c69 6d69 7465 6420 6279  it is limited by
    │ │ │ +00051bc0: 2074 6865 0a2f 2f20 636f 6e73 7461 6e74   the.// constant
    │ │ │ +00051bd0: 2052 4e47 5f4d 4158 5f42 4c4f 434b 5f4c   RNG_MAX_BLOCK_L
    │ │ │ +00051be0: 454e 2e0a 3c64 6976 2073 7479 6c65 3d22  EN..
    .
    ...// o │ │ │ +00051c20: 7065 6e73 736c 0a09 0909 696e 7420 7220 penssl....int r │ │ │ +00051c30: 3d20 5241 4e44 5f62 7974 6573 2872 6569 = RAND_bytes(rei │ │ │ +00051c40: 6e74 6572 7072 6574 5f63 6173 7426 6c74 nterpret_cast< │ │ │ +00051c50: 3b75 6e73 6967 6e65 6420 6368 6172 2a26 ;unsigned char*& │ │ │ +00051c60: 6774 3b28 6275 6666 6572 2e64 6174 6128 gt;(buffer.data( │ │ │ +00051c70: 2929 0a09 0909 092c 2069 6e74 2862 7566 ))....., int(buf │ │ │ +00051c80: 6665 722e 7369 7a65 2829 2929 3b0a 0909 fer.size()));... │ │ │ +00051c90: 0969 6620 2872 2021 3d20 3129 2061 7578 .if (r != 1) aux │ │ │ +00051ca0: 3a3a 7468 726f 775f 6578 266c 743b 7379 ::throw_ex<sy │ │ │ +00051cb0: 7374 656d 5f65 7272 6f72 2667 743b 2865 stem_error>(e │ │ │ +00051cc0: 7272 6f72 733a 3a6e 6f5f 656e 7472 6f70 rrors::no_entrop │ │ │ +00051cd0: 7929 3b0a 2365 6c69 6620 544f 5252 454e y);.#elif TORREN │ │ │ +00051ce0: 545f 5553 455f 4745 5452 414e 444f 4d0a T_USE_GETRANDOM. │ │ │ +00051cf0: 0909 0973 7369 7a65 5f74 2063 6f6e 7374 ...ssize_t const │ │ │ +00051d00: 2072 203d 203a 3a67 6574 7261 6e64 6f6d r = ::getrandom │ │ │ +00051d10: 2862 7566 6665 722e 6461 7461 2829 2c20 (buffer.data(), │ │ │ +00051d20: 7374 6174 6963 5f63 6173 7426 6c74 3b73 static_cast<s │ │ │ +00051d30: 7464 3a3a 7369 7a65 5f74 2667 743b 2862 td::size_t>(b │ │ │ +00051d40: 7566 6665 722e 7369 7a65 2829 292c 2030 uffer.size()), 0 │ │ │ +00051d50: 293b 0a09 0909 6966 2028 7220 3d3d 2073 );....if (r == s │ │ │ +00051d60: 7369 7a65 5f74 2862 7566 6665 722e 7369 size_t(buffer.si │ │ │ +00051d70: 7a65 2829 2929 2072 6574 7572 6e3b 0a09 ze())) return;.. │ │ │ +00051d80: 0909 6966 2028 7220 3d3d 202d 3120 2661 ..if (r == -1 &a │ │ │ +00051d90: 6d70 3b26 616d 703b 2065 7272 6e6f 2021 mp;& errno ! │ │ │ +00051da0: 3d20 454e 4f53 5953 2920 6175 783a 3a74 = ENOSYS) aux::t │ │ │ +00051db0: 6872 6f77 5f65 7826 6c74 3b73 7973 7465 hrow_ex<syste │ │ │ +00051dc0: 6d5f 6572 726f 7226 6774 3b28 6572 726f m_error>(erro │ │ │ +00051dd0: 725f 636f 6465 2865 7272 6e6f 2c20 6765 r_code(errno, ge │ │ │ +00051de0: 6e65 7269 635f 6361 7465 676f 7279 2829 neric_category() │ │ │ +00051df0: 2929 3b0a 0909 0973 7461 7469 6320 6465 ));....static de │ │ │ +00051e00: 765f 7261 6e64 6f6d 2064 6576 3b0a 0909 v_random dev;... │ │ │ +00051e10: 0964 6576 2e72 6561 6428 6275 6666 6572 .dev.read(buffer │ │ │ +00051e20: 293b 0a23 656c 6966 2054 4f52 5245 4e54 );.#elif TORRENT │ │ │ +00051e30: 5f55 5345 5f44 4556 5f52 414e 444f 4d0a _USE_DEV_RANDOM. │ │ │ +00051e40: 0909 0973 7461 7469 6320 6465 765f 7261 ...static dev_ra │ │ │ +00051e50: 6e64 6f6d 2064 6576 3b0a 0909 0964 6576 ndom dev;....dev │ │ │ +00051e60: 2e72 6561 6428 6275 6666 6572 293b 0a23 .read(buffer);.# │ │ │ +00051e70: 656c 7365 0a0a 2369 6620 544f 5252 454e else..#if TORREN │ │ │ +00051e80: 545f 4252 4f4b 454e 5f52 414e 444f 4d5f T_BROKEN_RANDOM_ │ │ │ +00051e90: 4445 5649 4345 0a09 0909 2f2f 2065 7665 DEVICE....// eve │ │ │ +00051ea0: 6e20 7073 6575 646f 2072 616e 646f 6d20 n pseudo random │ │ │ +00051eb0: 6e75 6d62 6572 7320 7265 6c79 206f 6e20 numbers rely on │ │ │ +00051ec0: 6265 696e 6720 6162 6c65 2074 6f20 7365 being able to se │ │ │ +00051ed0: 6564 2074 6865 2072 616e 646f 6d0a 0909 ed the random... │ │ │ +00051ee0: 092f 2f20 6765 6e65 7261 746f 720a 2365 .// generator.#e │ │ │ +00051ef0: 7272 6f72 2022 6e6f 2065 6e74 726f 7079 rror "no entropy │ │ │ +00051f00: 2073 6f75 7263 6520 6176 6169 6c61 626c source availabl │ │ │ +00051f10: 6522 0a23 656c 7365 0a23 6966 6465 6620 e".#else.#ifdef │ │ │ +00051f20: 544f 5252 454e 545f 495f 5741 4e54 5f49 TORRENT_I_WANT_I │ │ │ +00051f30: 4e53 4543 5552 455f 5241 4e44 4f4d 5f4e NSECURE_RANDOM_N │ │ │ +00051f40: 554d 4245 5253 0a09 0909 7374 643a 3a67 UMBERS....std::g │ │ │ +00051f50: 656e 6572 6174 6528 6275 6666 6572 2e62 enerate(buffer.b │ │ │ +00051f60: 6567 696e 2829 2c20 6275 6666 6572 2e65 egin(), buffer.e │ │ │ +00051f70: 6e64 2829 2c20 5b5d 207b 2072 6574 7572 nd(), [] { retur │ │ │ +00051f80: 6e20 6368 6172 2872 616e 646f 6d28 3078 n char(random(0x │ │ │ +00051f90: 6666 2929 3b20 7d29 3b0a 2365 6c73 650a ff)); });.#else. │ │ │ +00051fa0: 2365 7272 6f72 2022 6e6f 2073 6563 7572 #error "no secur │ │ │ +00051fb0: 6520 656e 7472 6f70 7920 736f 7572 6365 e entropy source │ │ │ +00051fc0: 2061 7661 696c 6162 6c65 2e20 4966 2079 available. If y │ │ │ +00051fd0: 6f75 2072 6561 6c6c 7920 7761 6e74 2069 ou really want i │ │ │ +00051fe0: 6e73 6563 7572 6520 7261 6e64 6f6d 206e nsecure random n │ │ │ +00051ff0: 756d 6265 7273 2c20 6465 6669 6e65 2054 umbers, define T │ │ │ +00052000: 4f52 5245 4e54 5f49 5f57 414e 545f 494e ORRENT_I_WANT_IN │ │ │ +00052010: 5345 4355 5245 5f52 414e 444f 4d5f 4e55 SECURE_RANDOM_NU │ │ │ +00052020: 4d42 4552 5322 0a23 656e 6469 660a 2365 MBERS".#endif.#e │ │ │ +00052030: 6e64 6966 0a0a 2365 6e64 6966 0a09 097d ndif..#endif...} │ │ │ +00052040: 0a7d 0a3c 2f70 7265 3e3c 2f74 643e 3c2f .}.
    │ │ │ +00052070: 3c74 643e 7265 6c65 7661 6e63 6526 6e62 relevance&nb │ │ │ +00052080: 7370 3b30 3c2f 7464 3e3c 7464 3e3c 6120 sp;0.. │ │ │ +000520b0: 2f73 7263 2f68 7474 705f 7365 6564 5f63 /src/http_seed_c │ │ │ +000520c0: 6f6e 6e65 6374 696f 6e2e 6370 703a 3433 onnection.cpp:43 │ │ │ +000520d0: 373c 2f61 3e3c 2f74 643e 3c74 643e 7465 7te │ │ │ +000520e0: 6368 6e69 6361 6c6c 792c 2074 6869 7320 chnically, this │ │ │ +000520f0: 6973 6e27 7420 7375 7070 6f73 6564 2074 isn't supposed t │ │ │ +00052100: 6f20 6861 7070 656e 2c20 6275 7420 6974 o happen, but it │ │ │ +00052110: 2073 6565 6d73 2074 6f20 736f 6d65 7469 seems to someti │ │ │ +00052120: 6d65 732e 2053 6f6d 6520 6f66 2074 6865 mes. Some of the │ │ │ +00052130: 2061 6363 6f75 6e74 696e 6720 6973 2070 accounting is p │ │ │ +00052140: 726f 6261 626c 7920 7772 6f6e 6720 696e robably wrong in │ │ │ +00052150: 2063 6572 7461 696e 2063 6173 6573 3c2f certain cases

    tech │ │ │ +000521b0: 6e69 6361 6c6c 792c 2074 6869 7320 6973 nically, this is │ │ │ +000521c0: 6e27 7420 7375 7070 6f73 6564 2074 6f20 n't supposed to │ │ │ +000521d0: 6861 7070 656e 2c20 6275 7420 6974 2073 happen, but it s │ │ │ +000521e0: 6565 6d73 2074 6f0a 736f 6d65 7469 6d65 eems to.sometime │ │ │ +000521f0: 732e 2053 6f6d 6520 6f66 2074 6865 2061 s. Some of the a │ │ │ +00052200: 6363 6f75 6e74 696e 6720 6973 2070 726f ccounting is pro │ │ │ +00052210: 6261 626c 7920 7772 6f6e 6720 696e 2063 bably wrong in c │ │ │ +00052220: 6572 7461 696e 0a63 6173 6573 3c2f 6832 ertain.cases

    ../src/http │ │ │ +00052240: 5f73 6565 645f 636f 6e6e 6563 7469 6f6e _seed_connection │ │ │ +00052250: 2e63 7070 3a34 3337 3c2f 6834 3e3c 7072 .cpp:437

    .....// c │ │ │ +000522a0: 7574 206f 7574 2074 6865 2063 6875 6e6b ut out the chunk │ │ │ +000522b0: 2068 6561 6465 7220 6672 6f6d 2074 6865 header from the │ │ │ +000522c0: 2072 6563 6569 7665 2062 7566 6665 720a receive buffer. │ │ │ +000522d0: 0909 0909 0954 4f52 5245 4e54 5f41 5353 .....TORRENT_ASS │ │ │ +000522e0: 4552 5428 6d5f 6368 756e 6b5f 706f 7320 ERT(m_chunk_pos │ │ │ +000522f0: 2b20 6d5f 626f 6479 5f73 7461 7274 2026 + m_body_start & │ │ │ +00052300: 6c74 3b20 494e 545f 4d41 5829 3b0a 0909 lt; INT_MAX);... │ │ │ +00052310: 0909 096d 5f72 6563 765f 6275 6666 6572 ...m_recv_buffer │ │ │ +00052320: 2e63 7574 2868 6561 6465 725f 7369 7a65 .cut(header_size │ │ │ +00052330: 2c20 742d 2667 743b 626c 6f63 6b5f 7369 , t->block_si │ │ │ +00052340: 7a65 2829 202b 2031 3032 342c 2061 7578 ze() + 1024, aux │ │ │ +00052350: 3a3a 6e75 6d65 7269 635f 6361 7374 266c ::numeric_cast&l │ │ │ +00052360: 743b 696e 7426 6774 3b28 6d5f 6368 756e t;int>(m_chun │ │ │ +00052370: 6b5f 706f 7320 2b20 6d5f 626f 6479 5f73 k_pos + m_body_s │ │ │ +00052380: 7461 7274 2929 3b0a 0909 0909 0972 6563 tart));......rec │ │ │ +00052390: 765f 6275 6666 6572 203d 206d 5f72 6563 v_buffer = m_rec │ │ │ +000523a0: 765f 6275 6666 6572 2e67 6574 2829 3b0a v_buffer.get();. │ │ │ +000523b0: 0909 0909 0972 6563 765f 6275 6666 6572 .....recv_buffer │ │ │ +000523c0: 203d 2072 6563 765f 6275 6666 6572 2e73 = recv_buffer.s │ │ │ +000523d0: 7562 7370 616e 286d 5f62 6f64 795f 7374 ubspan(m_body_st │ │ │ +000523e0: 6172 7429 3b0a 0909 0909 096d 5f63 6875 art);......m_chu │ │ │ +000523f0: 6e6b 5f70 6f73 202b 3d20 6368 756e 6b5f nk_pos += chunk_ │ │ │ +00052400: 7369 7a65 3b0a 0909 0909 0969 6620 2863 size;......if (c │ │ │ +00052410: 6875 6e6b 5f73 697a 6520 3d3d 2030 290a hunk_size == 0). │ │ │ +00052420: 0909 0909 097b 0a09 0909 0909 0954 4f52 .....{.......TOR │ │ │ +00052430: 5245 4e54 5f41 5353 4552 5428 6d5f 7265 RENT_ASSERT(m_re │ │ │ +00052440: 6376 5f62 7566 6665 722e 6765 7428 292e cv_buffer.get(). │ │ │ +00052450: 7369 7a65 2829 2026 6c74 3b20 6d5f 6368 size() < m_ch │ │ │ +00052460: 756e 6b5f 706f 7320 2b20 6d5f 626f 6479 unk_pos + m_body │ │ │ +00052470: 5f73 7461 7274 202b 2031 0a09 0909 0909 _start + 1...... │ │ │ +00052480: 0909 7c7c 206d 5f72 6563 765f 6275 6666 ..|| m_recv_buff │ │ │ +00052490: 6572 2e67 6574 2829 5b73 7461 7469 635f er.get()[static_ │ │ │ +000524a0: 6361 7374 266c 743b 7374 643a 3a70 7472 cast<std::ptr │ │ │ +000524b0: 6469 6666 5f74 2667 743b 286d 5f63 6875 diff_t>(m_chu │ │ │ +000524c0: 6e6b 5f70 6f73 202b 206d 5f62 6f64 795f nk_pos + m_body_ │ │ │ +000524d0: 7374 6172 7429 5d20 3d3d 2027 4827 0a09 start)] == 'H'.. │ │ │ +000524e0: 0909 0909 0909 7c7c 2028 6d5f 7061 7273 ......|| (m_pars │ │ │ +000524f0: 6572 2e63 6875 6e6b 6564 5f65 6e63 6f64 er.chunked_encod │ │ │ +00052500: 696e 6728 290a 0909 0909 0909 0909 2661 ing().........&a │ │ │ +00052510: 6d70 3b26 616d 703b 206d 5f72 6563 765f mp;& m_recv_ │ │ │ +00052520: 6275 6666 6572 2e67 6574 2829 5b73 7461 buffer.get()[sta │ │ │ +00052530: 7469 635f 6361 7374 266c 743b 7374 643a tic_cast<std: │ │ │ +00052540: 3a70 7472 6469 6666 5f74 2667 743b 286d :ptrdiff_t>(m │ │ │ +00052550: 5f63 6875 6e6b 5f70 6f73 202b 206d 5f62 _chunk_pos + m_b │ │ │ +00052560: 6f64 795f 7374 6172 7429 5d20 3d3d 2027 ody_start)] == ' │ │ │ +00052570: 5c72 2729 293b 0a09 0909 0909 096d 5f63 \r'));.......m_c │ │ │ +00052580: 6875 6e6b 5f70 6f73 203d 202d 313b 0a09 hunk_pos = -1;.. │ │ │ +00052590: 0909 0909 7d0a 0909 0909 7d0a 0909 097d ....}.....}....} │ │ │ +000525a0: 0a0a 0909 0969 6e74 2070 6179 6c6f 6164 .....int payload │ │ │ +000525b0: 203d 2069 6e74 2862 7974 6573 5f74 7261 = int(bytes_tra │ │ │ +000525c0: 6e73 6665 7272 6564 293b 0a09 0909 6966 nsferred);....if │ │ │ +000525d0: 2028 7061 796c 6f61 6420 2667 743b 206d (payload > m │ │ │ +000525e0: 5f72 6573 706f 6e73 655f 6c65 6674 2920 _response_left) │ │ │ +000525f0: 7061 796c 6f61 6420 3d20 696e 7428 6d5f payload = int(m_ │ │ │ +00052600: 7265 7370 6f6e 7365 5f6c 6566 7429 3b0a response_left);. │ │ │ +00052610: 0909 0969 6620 2870 6179 6c6f 6164 2026 ...if (payload & │ │ │ +00052620: 6774 3b20 6672 6f6e 745f 7265 7175 6573 gt; front_reques │ │ │ +00052630: 742e 6c65 6e67 7468 2920 7061 796c 6f61 t.length) payloa │ │ │ +00052640: 6420 3d20 6672 6f6e 745f 7265 7175 6573 d = front_reques │ │ │ +00052650: 742e 6c65 6e67 7468 3b0a 3c64 6976 2073 t.length;.
    ...if (p │ │ │ +00052690: 6179 6c6f 6164 2026 6774 3b20 6f75 7473 ayload > outs │ │ │ +000526a0: 7461 6e64 696e 675f 6279 7465 7328 2929 tanding_bytes()) │ │ │ +000526b0: 2070 6179 6c6f 6164 203d 206f 7574 7374 payload = outst │ │ │ +000526c0: 616e 6469 6e67 5f62 7974 6573 2829 3b0a anding_bytes();. │ │ │ +000526d0: 3c2f 6469 763e 0909 0972 6563 6569 7665
    ...receive │ │ │ +000526e0: 645f 6279 7465 7328 7061 796c 6f61 642c d_bytes(payload, │ │ │ +000526f0: 2030 293b 0a09 0909 696e 636f 6d69 6e67 0);....incoming │ │ │ +00052700: 5f70 6965 6365 5f66 7261 676d 656e 7428 _piece_fragment( │ │ │ +00052710: 7061 796c 6f61 6429 3b0a 0909 096d 5f72 payload);....m_r │ │ │ +00052720: 6573 706f 6e73 655f 6c65 6674 202d 3d20 esponse_left -= │ │ │ +00052730: 7061 796c 6f61 643b 0a0a 0909 0969 6620 payload;.....if │ │ │ +00052740: 286d 5f70 6172 7365 722e 7374 6174 7573 (m_parser.status │ │ │ +00052750: 5f63 6f64 6528 2920 3d3d 2035 3033 290a _code() == 503). │ │ │ +00052760: 0909 097b 0a09 0909 0969 6620 2821 6d5f ...{.....if (!m_ │ │ │ +00052770: 7061 7273 6572 2e66 696e 6973 6865 6428 parser.finished( │ │ │ +00052780: 2929 2072 6574 7572 6e3b 0a0a 0909 0909 )) return;...... │ │ │ +00052790: 696e 7420 7265 7472 795f 7469 6d65 203d int retry_time = │ │ │ +000527a0: 2073 7464 3a3a 6174 6f69 2873 7464 3a3a std::atoi(std:: │ │ │ +000527b0: 7374 7269 6e67 2872 6563 765f 6275 6666 string(recv_buff │ │ │ +000527c0: 6572 2e62 6567 696e 2829 2c20 7265 6376 er.begin(), recv │ │ │ +000527d0: 5f62 7566 6665 722e 656e 6428 2929 2e63 _buffer.end()).c │ │ │ +000527e0: 5f73 7472 2829 293b 0a09 0909 0969 6620 _str());.....if │ │ │ +000527f0: 2872 6574 7279 5f74 696d 6520 266c 743b (retry_time < │ │ │ +00052800: 3d20 3029 2072 6574 7279 5f74 696d 6520 = 0) retry_time │ │ │ +00052810: 3d20 3630 3b0a 2369 666e 6465 6620 544f = 60;.#ifndef TO │ │ │ +00052820: 5252 454e 545f 4449 5341 424c 455f 4c4f RRENT_DISABLE_LO │ │ │ +00052830: 4747 494e 470a 0909 0909 7065 6572 5f6c GGING.....peer_l │ │ │ +00052840: 6f67 2870 6565 725f 6c6f 675f 616c 6572 og(peer_log_aler │ │ │ +00052850: 743a 3a69 6e66 6f2c 2022 434f 4e4e 4543 t::info, "CONNEC │ │ │ +00052860: 5422 2c20 2272 6574 7279 696e 6720 696e T", "retrying in │ │ │ +00052870: 2025 6420 7365 636f 6e64 7322 2c20 7265 %d seconds", re │ │ │ +00052880: 7472 795f 7469 6d65 293b 0a23 656e 6469 try_time);.#endi │ │ │ +00052890: 660a 0a09 0909 0972 6563 6569 7665 645f f......received_ │ │ │ +000528a0: 6279 7465 7328 302c 2069 6e74 2862 7974 bytes(0, int(byt │ │ │ +000528b0: 6573 5f74 7261 6e73 6665 7272 6564 2929 es_transferred)) │ │ │ +000528c0: 3b0a 0909 0909 2f2f 2074 656d 706f 7261 ;.....// tempora │ │ │ +000528d0: 7269 6c79 2075 6e61 7661 696c 6162 6c65 rily unavailable │ │ │ +000528e0: 2c20 7265 7472 7920 6c61 7465 720a 0909 , retry later... │ │ │ +000528f0: 0909 742d 2667 743b 7265 7472 795f 7765 ..t->retry_we │ │ │ +00052900: 625f 7365 6564 2874 6869 732c 2073 6563 b_seed(this, sec │ │ │ +00052910: 6f6e 6473 3332 2872 6574 7279 5f74 696d onds32(retry_tim │ │ │ +00052920: 6529 293b 0a09 0909 0964 6973 636f 6e6e e));.....disconn │ │ │ +00052930: 6563 7428 6572 726f 725f 636f 6465 286d ect(error_code(m │ │ │ +00052940: 5f70 6172 7365 722e 7374 6174 7573 5f63 _parser.status_c │ │ │ +00052950: 6f64 6528 292c 2068 7474 705f 6361 7465 ode(), http_cate │ │ │ +00052960: 676f 7279 2829 292c 206f 7065 7261 7469 gory()), operati │ │ │ +00052970: 6f6e 5f74 3a3a 6269 7474 6f72 7265 6e74 on_t::bittorrent │ │ │ +00052980: 2c20 6661 696c 7572 6529 3b0a 0909 0909 , failure);..... │ │ │ +00052990: 7265 7475 726e 3b0a 0909 097d 0a0a 0a09 return;....}.... │ │ │ +000529a0: 0909 2f2f 2077 6520 6f6e 6c79 2072 6563 ..// we only rec │ │ │ +000529b0: 6569 7665 6420 7468 6520 6865 6164 6572 eived the header │ │ │ +000529c0: 2c20 6e6f 2064 6174 610a 0909 0969 6620 , no data....if │ │ │ +000529d0: 2872 6563 765f 6275 6666 6572 2e65 6d70 (recv_buffer.emp │ │ │ +000529e0: 7479 2829 2920 6272 6561 6b3b 0a0a 0909 ty()) break;.... │ │ │ +000529f0: 0969 6620 2872 6563 765f 6275 6666 6572 .if (recv_buffer │ │ │ +00052a00: 2e73 697a 6528 2920 266c 743b 2066 726f .size() < fro │ │ │ +00052a10: 6e74 5f72 6571 7565 7374 2e6c 656e 6774 nt_request.lengt │ │ │ +00052a20: 6829 2062 7265 616b 3b0a 0a09 0909 2f2f h) break;.....// │ │ │ +00052a30: 2069 6620 7468 6520 7265 7370 6f6e 7365 if the response │ │ │ +00052a40: 2069 7320 6368 756e 6b65 642c 2077 6520 is chunked, we │ │ │ +00052a50: 6e65 6564 2074 6f20 7265 6365 6976 6520 need to receive │ │ │ +00052a60: 7468 6520 6c61 7374 0a09 0909 2f2f 2074 the last....// t │ │ │ +00052a70: 6572 6d69 6e61 7469 6e67 2063 6875 6e6b erminating chunk │ │ │ +00052a80: 2061 6e64 2074 6865 2074 6169 6c20 6865 and the tail he │ │ │ +00052a90: 6164 6572 7320 6265 666f 7265 2077 6520 aders before we │ │ │ +00052aa0: 6361 6e20 7072 6f63 6565 640a 0909 0969 can proceed....i │ │ │ +00052ab0: 6620 286d 5f70 6172 7365 722e 6368 756e f (m_parser.chun │ │ │ +00052ac0: 6b65 645f 656e 636f 6469 6e67 2829 2026 ked_encoding() & │ │ │ +00052ad0: 616d 703b 2661 6d70 3b20 6d5f 6368 756e amp;& m_chun │ │ │ +00052ae0: 6b5f 706f 7320 2667 743b 3d20 3029 2062 k_pos >= 0) b │ │ │ +00052af0: 7265 616b 3b0a 3c2f 7072 653e 3c2f 7464 reak;.
    relevance │ │ │ +00052b30: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ +00052b40: 3c61 2068 7265 663d 226a 6176 6173 6372 ../src/torrent_ │ │ │ +00052b70: 6861 6e64 6c65 2e63 7070 3a36 3034 3c2f handle.cpp:604suppo │ │ │ +00052b90: 7274 206d 6f76 696e 6720 6669 6c65 7320 rt moving files │ │ │ +00052ba0: 696e 746f 2074 6869 7320 6361 6c6c 3c2f into this call

    supp │ │ │ +00052c00: 6f72 7420 6d6f 7669 6e67 2066 696c 6573 ort moving files │ │ │ +00052c10: 2069 6e74 6f20 7468 6973 2063 616c 6c3c into this call< │ │ │ +00052c20: 2f68 323e 3c68 343e 2e2e 2f73 7263 2f74 /h2>

    ../src/t │ │ │ +00052c30: 6f72 7265 6e74 5f68 616e 646c 652e 6370 orrent_handle.cp │ │ │ +00052c40: 703a 3630 343c 2f68 343e 3c70 7265 2073 p:604

    ..auto retp 
    │ │ │ +00052c90: 3d20 2661 6d70 3b70 7269 6f3b 0a09 0973  = &prio;...s
    │ │ │ +00052ca0: 796e 635f 6361 6c6c 2826 616d 703b 746f  ync_call(&to
    │ │ │ +00052cb0: 7272 656e 743a 3a70 6965 6365 5f70 7269  rrent::piece_pri
    │ │ │ +00052cc0: 6f72 6974 6965 732c 2072 6574 7029 3b0a  orities, retp);.
    │ │ │ +00052cd0: 0909 7374 643a 3a76 6563 746f 7226 6c74  ..std::vector<
    │ │ │ +00052ce0: 3b69 6e74 2667 743b 2072 6574 3b0a 0909  ;int> ret;...
    │ │ │ +00052cf0: 7265 742e 7265 7365 7276 6528 7072 696f  ret.reserve(prio
    │ │ │ +00052d00: 2e73 697a 6528 2929 3b0a 0909 666f 7220  .size());...for 
    │ │ │ +00052d10: 2861 7574 6f20 7020 3a20 7072 696f 290a  (auto p : prio).
    │ │ │ +00052d20: 0909 0972 6574 2e70 7573 685f 6261 636b  ...ret.push_back
    │ │ │ +00052d30: 2869 6e74 2873 7461 7469 635f 6361 7374  (int(static_cast
    │ │ │ +00052d40: 266c 743b 7374 643a 3a75 696e 7438 5f74  <std::uint8_t
    │ │ │ +00052d50: 2667 743b 2870 2929 293b 0a09 0972 6574  >(p)));...ret
    │ │ │ +00052d60: 7572 6e20 7265 743b 0a09 7d0a 2365 6e64  urn ret;..}.#end
    │ │ │ +00052d70: 6966 0a0a 0976 6f69 6420 746f 7272 656e  if...void torren
    │ │ │ +00052d80: 745f 6861 6e64 6c65 3a3a 6669 6c65 5f70  t_handle::file_p
    │ │ │ +00052d90: 7269 6f72 6974 7928 6669 6c65 5f69 6e64  riority(file_ind
    │ │ │ +00052da0: 6578 5f74 2069 6e64 6578 2c20 646f 776e  ex_t index, down
    │ │ │ +00052db0: 6c6f 6164 5f70 7269 6f72 6974 795f 7420  load_priority_t 
    │ │ │ +00052dc0: 7072 696f 7269 7479 2920 636f 6e73 740a  priority) const.
    │ │ │ +00052dd0: 097b 0a09 0961 7379 6e63 5f63 616c 6c28  .{...async_call(
    │ │ │ +00052de0: 2661 6d70 3b74 6f72 7265 6e74 3a3a 7365  &torrent::se
    │ │ │ +00052df0: 745f 6669 6c65 5f70 7269 6f72 6974 792c  t_file_priority,
    │ │ │ +00052e00: 2069 6e64 6578 2c20 7072 696f 7269 7479   index, priority
    │ │ │ +00052e10: 293b 0a09 7d0a 0a09 646f 776e 6c6f 6164  );..}...download
    │ │ │ +00052e20: 5f70 7269 6f72 6974 795f 7420 746f 7272  _priority_t torr
    │ │ │ +00052e30: 656e 745f 6861 6e64 6c65 3a3a 6669 6c65  ent_handle::file
    │ │ │ +00052e40: 5f70 7269 6f72 6974 7928 6669 6c65 5f69  _priority(file_i
    │ │ │ +00052e50: 6e64 6578 5f74 2069 6e64 6578 2920 636f  ndex_t index) co
    │ │ │ +00052e60: 6e73 740a 097b 0a09 0972 6574 7572 6e20  nst..{...return 
    │ │ │ +00052e70: 7379 6e63 5f63 616c 6c5f 7265 7426 6c74  sync_call_ret<
    │ │ │ +00052e80: 3b64 6f77 6e6c 6f61 645f 7072 696f 7269  ;download_priori
    │ │ │ +00052e90: 7479 5f74 2667 743b 2864 6f6e 745f 646f  ty_t>(dont_do
    │ │ │ +00052ea0: 776e 6c6f 6164 2c20 2661 6d70 3b74 6f72  wnload, &tor
    │ │ │ +00052eb0: 7265 6e74 3a3a 6669 6c65 5f70 7269 6f72  rent::file_prior
    │ │ │ +00052ec0: 6974 792c 2069 6e64 6578 293b 0a09 7d0a  ity, index);..}.
    │ │ │ +00052ed0: 0a3c 6469 7620 7374 796c 653d 2262 6163  .
    . │ │ │ +00052f00: 766f 6964 2074 6f72 7265 6e74 5f68 616e void torrent_han │ │ │ +00052f10: 646c 653a 3a70 7269 6f72 6974 697a 655f dle::prioritize_ │ │ │ +00052f20: 6669 6c65 7328 7374 643a 3a76 6563 746f files(std::vecto │ │ │ +00052f30: 7226 6c74 3b64 6f77 6e6c 6f61 645f 7072 r<download_pr │ │ │ +00052f40: 696f 7269 7479 5f74 2667 743b 2063 6f6e iority_t> con │ │ │ +00052f50: 7374 2661 6d70 3b20 6669 6c65 7329 2063 st& files) c │ │ │ +00052f60: 6f6e 7374 0a3c 2f64 6976 3e09 7b0a 0909 onst.
    .{... │ │ │ +00052f70: 6173 796e 635f 6361 6c6c 2826 616d 703b async_call(& │ │ │ +00052f80: 746f 7272 656e 743a 3a70 7269 6f72 6974 torrent::priorit │ │ │ +00052f90: 697a 655f 6669 6c65 730a 0909 092c 2073 ize_files...., s │ │ │ +00052fa0: 7461 7469 635f 6361 7374 266c 743b 6175 tatic_cast<au │ │ │ +00052fb0: 783a 3a76 6563 746f 7226 6c74 3b64 6f77 x::vector<dow │ │ │ +00052fc0: 6e6c 6f61 645f 7072 696f 7269 7479 5f74 nload_priority_t │ │ │ +00052fd0: 2c20 6669 6c65 5f69 6e64 6578 5f74 2667 , file_index_t&g │ │ │ +00052fe0: 743b 2063 6f6e 7374 2661 6d70 3b26 6774 t; const&> │ │ │ +00052ff0: 3b28 6669 6c65 7329 293b 0a09 7d0a 0a09 ;(files));..}... │ │ │ +00053000: 7374 643a 3a76 6563 746f 7226 6c74 3b64 std::vector<d │ │ │ +00053010: 6f77 6e6c 6f61 645f 7072 696f 7269 7479 ownload_priority │ │ │ +00053020: 5f74 2667 743b 2074 6f72 7265 6e74 5f68 _t> torrent_h │ │ │ +00053030: 616e 646c 653a 3a67 6574 5f66 696c 655f andle::get_file_ │ │ │ +00053040: 7072 696f 7269 7469 6573 2829 2063 6f6e priorities() con │ │ │ +00053050: 7374 0a09 7b0a 0909 6175 783a 3a76 6563 st..{...aux::vec │ │ │ +00053060: 746f 7226 6c74 3b64 6f77 6e6c 6f61 645f tor<download_ │ │ │ +00053070: 7072 696f 7269 7479 5f74 2c20 6669 6c65 priority_t, file │ │ │ +00053080: 5f69 6e64 6578 5f74 2667 743b 2072 6574 _index_t> ret │ │ │ +00053090: 3b0a 0909 6175 746f 2072 6574 7020 3d20 ;...auto retp = │ │ │ +000530a0: 2661 6d70 3b72 6574 3b0a 0909 7379 6e63 &ret;...sync │ │ │ +000530b0: 5f63 616c 6c28 2661 6d70 3b74 6f72 7265 _call(&torre │ │ │ +000530c0: 6e74 3a3a 6669 6c65 5f70 7269 6f72 6974 nt::file_priorit │ │ │ +000530d0: 6965 732c 2072 6574 7029 3b0a 0909 7265 ies, retp);...re │ │ │ +000530e0: 7475 726e 2054 4f52 5245 4e54 5f52 564f turn TORRENT_RVO │ │ │ +000530f0: 2872 6574 293b 0a09 7d0a 0a23 6966 2054 (ret);..}..#if T │ │ │ +00053100: 4f52 5245 4e54 5f41 4249 5f56 4552 5349 ORRENT_ABI_VERSI │ │ │ +00053110: 4f4e 203d 3d20 310a 0a2f 2f20 3d3d 3d3d ON == 1..// ==== │ │ │ +00053120: 3d3d 3d3d 3d3d 3d3d 2073 7461 7274 2064 ======== start d │ │ │ +00053130: 6570 7265 6361 7469 6f6e 203d 3d3d 3d3d eprecation ===== │ │ │ +00053140: 3d3d 3d3d 3d3d 3d3d 3d3d 0a0a 0976 6f69 ==========...voi │ │ │ +00053150: 6420 746f 7272 656e 745f 6861 6e64 6c65 d torrent_handle │ │ │ +00053160: 3a3a 7072 696f 7269 7469 7a65 5f66 696c ::prioritize_fil │ │ │ +00053170: 6573 2873 7464 3a3a 7665 6374 6f72 266c es(std::vector&l │ │ │ +00053180: 743b 696e 7426 6774 3b20 636f 6e73 7426 t;int> const& │ │ │ +00053190: 616d 703b 2066 696c 6573 2920 636f 6e73 amp; files) cons │ │ │ +000531a0: 740a 097b 0a09 0961 7578 3a3a 7665 6374 t..{...aux::vect │ │ │ +000531b0: 6f72 266c 743b 646f 776e 6c6f 6164 5f70 or<download_p │ │ │ +000531c0: 7269 6f72 6974 795f 742c 2066 696c 655f riority_t, file_ │ │ │ +000531d0: 696e 6465 785f 7426 6774 3b20 6669 6c65 index_t> file │ │ │ +000531e0: 5f70 7269 6f3b 0a09 0966 696c 655f 7072 _prio;...file_pr │ │ │ +000531f0: 696f 2e72 6573 6572 7665 2866 696c 6573 io.reserve(files │ │ │ +00053200: 2e73 697a 6528 2929 3b0a 0909 666f 7220 .size());...for │ │ │ +00053210: 2861 7574 6f20 636f 6e73 7420 7020 3a20 (auto const p : │ │ │ +00053220: 6669 6c65 7329 207b 0a09 0909 6669 6c65 files) {....file │ │ │ +00053230: 5f70 7269 6f2e 7075 7368 5f62 6163 6b28 _prio.push_back( │ │ │ +00053240: 646f 776e 6c6f 6164 5f70 7269 6f72 6974 download_priorit │ │ │ +00053250: 795f 7428 7374 6174 6963 5f63 6173 7426 y_t(static_cast& │ │ │ +00053260: 6c74 3b73 7464 3a3a 7569 6e74 385f 7426 lt;std::uint8_t& │ │ │ +00053270: 6774 3b28 7029 2929 3b0a 0909 7d0a 0909 gt;(p)));...}... │ │ │ +00053280: 6173 796e 635f 6361 6c6c 2826 616d 703b async_call(& │ │ │ +00053290: 746f 7272 656e 743a 3a70 7269 6f72 6974 torrent::priorit │ │ │ +000532a0: 697a 655f 6669 6c65 732c 2066 696c 655f ize_files, file_ │ │ │ +000532b0: 7072 696f 293b 0a09 7d0a 0a09 7374 643a prio);..}...std: │ │ │ +000532c0: 3a76 6563 746f 7226 6c74 3b69 6e74 2667 :vector<int&g │ │ │ +000532d0: 743b 2074 6f72 7265 6e74 5f68 616e 646c t; torrent_handl │ │ │ +000532e0: 653a 3a66 696c 655f 7072 696f 7269 7469 e::file_prioriti │ │ │ +000532f0: 6573 2829 2063 6f6e 7374 0a09 7b0a 0909 es() const..{... │ │ │ +00053300: 6175 783a 3a76 6563 746f 7226 6c74 3b64 aux::vector<d │ │ │ +00053310: 6f77 6e6c 6f61 645f 7072 696f 7269 7479 ownload_priority │ │ │ +00053320: 5f74 2c20 6669 6c65 5f69 6e64 6578 5f74 _t, file_index_t │ │ │ +00053330: 2667 743b 2070 7269 6f3b 0a3c 2f70 7265 > prio;.
    rele │ │ │ +00053370: 7661 6e63 6526 6e62 7370 3b30 3c2f 7464 vance 0
    ../src/par │ │ │ +000533b0: 745f 6669 6c65 2e63 7070 3a33 3032 3c2f t_file.cpp:302what │ │ │ +000533d0: 646f 2077 6520 646f 2069 6620 736f 6d65 do we do if some │ │ │ +000533e0: 6f6e 6520 6973 2063 7572 7265 6e74 6c79 one is currently │ │ │ +000533f0: 2072 6561 6469 6e67 2066 726f 6d20 7468 reading from th │ │ │ +00053400: 6520 6469 736b 2066 726f 6d20 7468 6973 e disk from this │ │ │ +00053410: 2070 6965 6365 3f20 646f 6573 2069 7420 piece? does it │ │ │ +00053420: 6d61 7474 6572 3f20 5369 6e63 6520 7765 matter? Since we │ │ │ +00053430: 2077 6f6e 2774 2061 6374 6976 656c 7920 won't actively │ │ │ +00053440: 6572 6173 6520 7468 6520 6461 7461 2066 erase the data f │ │ │ +00053450: 726f 6d20 6469 736b 2c20 6275 7420 6974 rom disk, but it │ │ │ +00053460: 206d 6179 2062 6520 6f76 6572 7772 6974 may be overwrit │ │ │ +00053470: 7465 6e20 736f 6f6e 2c20 6974 2773 2070 ten soon, it's p │ │ │ +00053480: 726f 6261 626c 7920 6e6f 7420 7468 6174 robably not that │ │ │ +00053490: 2062 6967 206f 6620 6120 6465 616c 3c2f big of a deal

    what │ │ │ +000534f0: 2064 6f20 7765 2064 6f20 6966 2073 6f6d do we do if som │ │ │ +00053500: 656f 6e65 2069 7320 6375 7272 656e 746c eone is currentl │ │ │ +00053510: 7920 7265 6164 696e 6720 6672 6f6d 2074 y reading from t │ │ │ +00053520: 6865 2064 6973 6b0a 6672 6f6d 2074 6869 he disk.from thi │ │ │ +00053530: 7320 7069 6563 653f 2064 6f65 7320 6974 s piece? does it │ │ │ +00053540: 206d 6174 7465 723f 2053 696e 6365 2077 matter? Since w │ │ │ +00053550: 6520 776f 6e27 7420 6163 7469 7665 6c79 e won't actively │ │ │ +00053560: 2065 7261 7365 2074 6865 0a64 6174 6120 erase the.data │ │ │ +00053570: 6672 6f6d 2064 6973 6b2c 2062 7574 2069 from disk, but i │ │ │ +00053580: 7420 6d61 7920 6265 206f 7665 7277 7269 t may be overwri │ │ │ +00053590: 7474 656e 2073 6f6f 6e2c 2069 7427 7320 tten soon, it's │ │ │ +000535a0: 7072 6f62 6162 6c79 206e 6f74 2074 6861 probably not tha │ │ │ +000535b0: 740a 6269 6720 6f66 2061 2064 6561 6c3c t.big of a deal< │ │ │ +000535c0: 2f68 323e 3c68 343e 2e2e 2f73 7263 2f70 /h2>

    ../src/p │ │ │ +000535d0: 6172 745f 6669 6c65 2e63 7070 3a33 3032 art_file.cpp:302 │ │ │ +000535e0: 3c2f 6834 3e3c 7072 6520 7374 796c 653d

    .
    │ │ │ +00053620: 0909 0963 7265 6174 655f 6469 7265 6374  ...create_direct
    │ │ │ +00053630: 6f72 6965 7328 6d5f 7061 7468 2c20 6563  ories(m_path, ec
    │ │ │ +00053640: 293b 0a09 0909 0969 6620 2865 6329 2072  );.....if (ec) r
    │ │ │ +00053650: 6574 7572 6e20 7b7d 3b0a 0909 0909 7265  eturn {};.....re
    │ │ │ +00053660: 7475 726e 2061 7578 3a3a 6669 6c65 5f68  turn aux::file_h
    │ │ │ +00053670: 616e 646c 6528 666e 2c20 302c 206d 6f64  andle(fn, 0, mod
    │ │ │ +00053680: 6529 3b0a 0909 097d 0a09 0909 7265 7475  e);....}....retu
    │ │ │ +00053690: 726e 207b 7d3b 0a09 097d 0a09 7d0a 0963  rn {};...}..}..c
    │ │ │ +000536a0: 6174 6368 2028 7374 6f72 6167 655f 6572  atch (storage_er
    │ │ │ +000536b0: 726f 7220 636f 6e73 7426 616d 703b 2065  ror const& e
    │ │ │ +000536c0: 290a 097b 0a09 0965 6320 3d20 652e 6563  )..{...ec = e.ec
    │ │ │ +000536d0: 3b0a 0909 7265 7475 726e 207b 7d3b 0a09  ;...return {};..
    │ │ │ +000536e0: 7d0a 0a09 766f 6964 2070 6172 745f 6669  }...void part_fi
    │ │ │ +000536f0: 6c65 3a3a 6672 6565 5f70 6965 6365 2870  le::free_piece(p
    │ │ │ +00053700: 6965 6365 5f69 6e64 6578 5f74 2063 6f6e  iece_index_t con
    │ │ │ +00053710: 7374 2070 6965 6365 290a 097b 0a09 0973  st piece)..{...s
    │ │ │ +00053720: 7464 3a3a 6c6f 636b 5f67 7561 7264 266c  td::lock_guard&l
    │ │ │ +00053730: 743b 7374 643a 3a6d 7574 6578 2667 743b  t;std::mutex>
    │ │ │ +00053740: 206c 286d 5f6d 7574 6578 293b 0a0a 0909   l(m_mutex);....
    │ │ │ +00053750: 6175 746f 2063 6f6e 7374 2069 203d 206d  auto const i = m
    │ │ │ +00053760: 5f70 6965 6365 5f6d 6170 2e66 696e 6428  _piece_map.find(
    │ │ │ +00053770: 7069 6563 6529 3b0a 0909 6966 2028 6920  piece);...if (i 
    │ │ │ +00053780: 3d3d 206d 5f70 6965 6365 5f6d 6170 2e65  == m_piece_map.e
    │ │ │ +00053790: 6e64 2829 2920 7265 7475 726e 3b0a 0a3c  nd()) return;..<
    │ │ │ +000537a0: 6469 7620 7374 796c 653d 2262 6163 6b67  div style="backg
    │ │ │ +000537b0: 726f 756e 643a 2023 6666 6666 3030 2220  round: #ffff00" 
    │ │ │ +000537c0: 7769 6474 683d 2231 3030 2522 3e0a 3c2f  width="100%">...m_free_slo
    │ │ │ +000537e0: 7473 2e70 7573 685f 6261 636b 2869 2d26  ts.push_back(i-&
    │ │ │ +000537f0: 6774 3b73 6563 6f6e 6429 3b0a 0909 6d5f  gt;second);...m_
    │ │ │ +00053800: 7069 6563 655f 6d61 702e 6572 6173 6528  piece_map.erase(
    │ │ │ +00053810: 6929 3b0a 0909 6d5f 6469 7274 795f 6d65  i);...m_dirty_me
    │ │ │ +00053820: 7461 6461 7461 203d 2074 7275 653b 0a09  tadata = true;..
    │ │ │ +00053830: 7d0a 0a09 766f 6964 2070 6172 745f 6669  }...void part_fi
    │ │ │ +00053840: 6c65 3a3a 6d6f 7665 5f70 6172 7466 696c  le::move_partfil
    │ │ │ +00053850: 6528 7374 643a 3a73 7472 696e 6720 636f  e(std::string co
    │ │ │ +00053860: 6e73 7426 616d 703b 2070 6174 682c 2065  nst& path, e
    │ │ │ +00053870: 7272 6f72 5f63 6f64 6526 616d 703b 2065  rror_code& e
    │ │ │ +00053880: 6329 0a09 7b0a 0909 7374 643a 3a6c 6f63  c)..{...std::loc
    │ │ │ +00053890: 6b5f 6775 6172 6426 6c74 3b73 7464 3a3a  k_guard<std::
    │ │ │ +000538a0: 6d75 7465 7826 6774 3b20 6c28 6d5f 6d75  mutex> l(m_mu
    │ │ │ +000538b0: 7465 7829 3b0a 0a09 0966 6c75 7368 5f6d  tex);....flush_m
    │ │ │ +000538c0: 6574 6164 6174 615f 696d 706c 2865 6329  etadata_impl(ec)
    │ │ │ +000538d0: 3b0a 0909 6966 2028 6563 2920 7265 7475  ;...if (ec) retu
    │ │ │ +000538e0: 726e 3b0a 0a09 0969 6620 2821 6d5f 7069  rn;....if (!m_pi
    │ │ │ +000538f0: 6563 655f 6d61 702e 656d 7074 7928 2929  ece_map.empty())
    │ │ │ +00053900: 0a09 097b 0a09 0909 7374 643a 3a73 7472  ...{....std::str
    │ │ │ +00053910: 696e 6720 6f6c 645f 7061 7468 203d 2063  ing old_path = c
    │ │ │ +00053920: 6f6d 6269 6e65 5f70 6174 6828 6d5f 7061  ombine_path(m_pa
    │ │ │ +00053930: 7468 2c20 6d5f 6e61 6d65 293b 0a09 0909  th, m_name);....
    │ │ │ +00053940: 7374 643a 3a73 7472 696e 6720 6e65 775f  std::string new_
    │ │ │ +00053950: 7061 7468 203d 2063 6f6d 6269 6e65 5f70  path = combine_p
    │ │ │ +00053960: 6174 6828 7061 7468 2c20 6d5f 6e61 6d65  ath(path, m_name
    │ │ │ +00053970: 293b 0a0a 0909 0972 656e 616d 6528 6f6c  );.....rename(ol
    │ │ │ +00053980: 645f 7061 7468 2c20 6e65 775f 7061 7468  d_path, new_path
    │ │ │ +00053990: 2c20 6563 293b 0a09 0909 6966 2028 6563  , ec);....if (ec
    │ │ │ +000539a0: 203d 3d20 626f 6f73 743a 3a73 7973 7465   == boost::syste
    │ │ │ +000539b0: 6d3a 3a65 7272 633a 3a6e 6f5f 7375 6368  m::errc::no_such
    │ │ │ +000539c0: 5f66 696c 655f 6f72 5f64 6972 6563 746f  _file_or_directo
    │ │ │ +000539d0: 7279 290a 0909 0909 6563 2e63 6c65 6172  ry).....ec.clear
    │ │ │ +000539e0: 2829 3b0a 0a09 0909 6966 2028 6563 290a  ();.....if (ec).
    │ │ │ +000539f0: 0909 097b 0a09 0909 0973 746f 7261 6765  ...{.....storage
    │ │ │ +00053a00: 5f65 7272 6f72 2073 653b 0a09 0909 0961  _error se;.....a
    │ │ │ +00053a10: 7578 3a3a 636f 7079 5f66 696c 6528 6f6c  ux::copy_file(ol
    │ │ │ +00053a20: 645f 7061 7468 2c20 6e65 775f 7061 7468  d_path, new_path
    │ │ │ +00053a30: 2c20 7365 293b 0a09 0909 0965 6320 3d20  , se);.....ec = 
    │ │ │ +00053a40: 7365 2e65 633b 0a09 0909 0969 6620 2865  se.ec;.....if (e
    │ │ │ +00053a50: 6329 2072 6574 7572 6e3b 0a09 0909 0972  c) return;.....r
    │ │ │ +00053a60: 656d 6f76 6528 6f6c 645f 7061 7468 2c20  emove(old_path, 
    │ │ │ +00053a70: 6563 293b 0a09 0909 7d0a 0909 7d0a 3c2f  ec);....}...}.r
    │ │ │ +00053ab0: 656c 6576 616e 6365 266e 6273 703b 303c  elevance 0<
    │ │ │ +00053ac0: 2f74 643e 3c74 643e 3c61 2068 7265 663d  /td>../src/
    │ │ │ +00053af0: 7061 7274 5f66 696c 652e 6370 703a 3431  part_file.cpp:41
    │ │ │ +00053b00: 323c 2f61 3e3c 2f74 643e 3c74 643e 696e  2in
    │ │ │ +00053b10: 7374 6561 6420 6f66 2072 6562 7569 6c64  stead of rebuild
    │ │ │ +00053b20: 696e 6720 7468 6520 7768 6f6c 6520 6669  ing the whole fi
    │ │ │ +00053b30: 6c65 2068 6561 6465 7220 616e 6420 666c  le header and fl
    │ │ │ +00053b40: 7573 6869 6e67 2069 742c 2075 7064 6174  ushing it, updat
    │ │ │ +00053b50: 6520 7468 6520 736c 6f74 2065 6e74 7269  e the slot entri
    │ │ │ +00053b60: 6573 2061 7320 7765 2067 6f3c 2f74 643e  es as we go
    │ │ │ +00053b70: 3c2f 7472 3e3c 7472 2069 643d 2231 3937  

    instead │ │ │ +00053bc0: 206f 6620 7265 6275 696c 6469 6e67 2074 of rebuilding t │ │ │ +00053bd0: 6865 2077 686f 6c65 2066 696c 6520 6865 he whole file he │ │ │ +00053be0: 6164 6572 0a61 6e64 2066 6c75 7368 696e ader.and flushin │ │ │ +00053bf0: 6720 6974 2c20 7570 6461 7465 2074 6865 g it, update the │ │ │ +00053c00: 2073 6c6f 7420 656e 7472 6965 7320 6173 slot entries as │ │ │ +00053c10: 2077 6520 676f 3c2f 6832 3e3c 6834 3e2e we go

    . │ │ │ +00053c20: 2e2f 7372 632f 7061 7274 5f66 696c 652e ./src/part_file. │ │ │ +00053c30: 6370 703a 3431 323c 2f68 343e 3c70 7265 cpp:412

    ......TORR
    │ │ │ +00053c80: 454e 545f 4153 5345 5254 286a 2d26 6774  ENT_ASSERT(j->
    │ │ │ +00053c90: 3b73 6563 6f6e 6420 3d3d 2073 6c6f 7429  ;second == slot)
    │ │ │ +00053ca0: 3b0a 0909 0909 0909 6d5f 6672 6565 5f73  ;.......m_free_s
    │ │ │ +00053cb0: 6c6f 7473 2e70 7573 685f 6261 636b 286a  lots.push_back(j
    │ │ │ +00053cc0: 2d26 6774 3b73 6563 6f6e 6429 3b0a 0909  ->second);...
    │ │ │ +00053cd0: 0909 0909 6d5f 7069 6563 655f 6d61 702e  ....m_piece_map.
    │ │ │ +00053ce0: 6572 6173 6528 6a29 3b0a 0909 0909 0909  erase(j);.......
    │ │ │ +00053cf0: 6d5f 6469 7274 795f 6d65 7461 6461 7461  m_dirty_metadata
    │ │ │ +00053d00: 203d 2074 7275 653b 0a09 0909 0909 7d0a   = true;......}.
    │ │ │ +00053d10: 0909 0909 7d0a 0909 097d 0a09 0909 6669  ....}....}....fi
    │ │ │ +00053d20: 6c65 5f6f 6666 7365 7420 2b3d 2062 6c6f  le_offset += blo
    │ │ │ +00053d30: 636b 5f74 6f5f 636f 7079 3b0a 0909 0970  ck_to_copy;....p
    │ │ │ +00053d40: 6965 6365 5f6f 6666 7365 7420 3d20 303b  iece_offset = 0;
    │ │ │ +00053d50: 0a09 0909 7369 7a65 202d 3d20 626c 6f63  ....size -= bloc
    │ │ │ +00053d60: 6b5f 746f 5f63 6f70 793b 0a09 097d 0a09  k_to_copy;...}..
    │ │ │ +00053d70: 7d0a 0a09 766f 6964 2070 6172 745f 6669  }...void part_fi
    │ │ │ +00053d80: 6c65 3a3a 666c 7573 685f 6d65 7461 6461  le::flush_metada
    │ │ │ +00053d90: 7461 2865 7272 6f72 5f63 6f64 6526 616d  ta(error_code&am
    │ │ │ +00053da0: 703b 2065 6329 0a09 7b0a 0909 7374 643a  p; ec)..{...std:
    │ │ │ +00053db0: 3a6c 6f63 6b5f 6775 6172 6426 6c74 3b73  :lock_guard<s
    │ │ │ +00053dc0: 7464 3a3a 6d75 7465 7826 6774 3b20 6c28  td::mutex> l(
    │ │ │ +00053dd0: 6d5f 6d75 7465 7829 3b0a 0a09 0966 6c75  m_mutex);....flu
    │ │ │ +00053de0: 7368 5f6d 6574 6164 6174 615f 696d 706c  sh_metadata_impl
    │ │ │ +00053df0: 2865 6329 3b0a 097d 0a0a 3c64 6976 2073  (ec);..}..
    .void pa │ │ │ +00053e30: 7274 5f66 696c 653a 3a66 6c75 7368 5f6d rt_file::flush_m │ │ │ +00053e40: 6574 6164 6174 615f 696d 706c 2865 7272 etadata_impl(err │ │ │ +00053e50: 6f72 5f63 6f64 6526 616d 703b 2065 6329 or_code& ec) │ │ │ +00053e60: 0a3c 2f64 6976 3e09 7b0a 0909 2f2f 2064 .
    .{...// d │ │ │ +00053e70: 6f20 7765 206e 6565 6420 746f 2066 6c75 o we need to flu │ │ │ +00053e80: 7368 2074 6865 206d 6574 6164 6174 613f sh the metadata? │ │ │ +00053e90: 0a09 0969 6620 286d 5f64 6972 7479 5f6d ...if (m_dirty_m │ │ │ +00053ea0: 6574 6164 6174 6120 3d3d 2066 616c 7365 etadata == false │ │ │ +00053eb0: 2920 7265 7475 726e 3b0a 0a09 0969 6620 ) return;....if │ │ │ +00053ec0: 286d 5f70 6965 6365 5f6d 6170 2e65 6d70 (m_piece_map.emp │ │ │ +00053ed0: 7479 2829 290a 0909 7b0a 0909 092f 2f20 ty())...{....// │ │ │ +00053ee0: 6966 2077 6520 646f 6e27 7420 6861 7665 if we don't have │ │ │ +00053ef0: 2061 6e79 2070 6965 6365 7320 6c65 6674 any pieces left │ │ │ +00053f00: 2069 6e20 7468 650a 0909 092f 2f20 7061 in the....// pa │ │ │ +00053f10: 7274 2066 696c 652c 2072 656d 6f76 6520 rt file, remove │ │ │ +00053f20: 6974 0a09 0909 7374 643a 3a73 7472 696e it....std::strin │ │ │ +00053f30: 6720 636f 6e73 7420 7020 3d20 636f 6d62 g const p = comb │ │ │ +00053f40: 696e 655f 7061 7468 286d 5f70 6174 682c ine_path(m_path, │ │ │ +00053f50: 206d 5f6e 616d 6529 3b0a 0909 0972 656d m_name);....rem │ │ │ +00053f60: 6f76 6528 702c 2065 6329 3b0a 0a09 0909 ove(p, ec);..... │ │ │ +00053f70: 6966 2028 6563 203d 3d20 626f 6f73 743a if (ec == boost: │ │ │ +00053f80: 3a73 7973 7465 6d3a 3a65 7272 633a 3a6e :system::errc::n │ │ │ +00053f90: 6f5f 7375 6368 5f66 696c 655f 6f72 5f64 o_such_file_or_d │ │ │ +00053fa0: 6972 6563 746f 7279 290a 0909 0909 6563 irectory).....ec │ │ │ +00053fb0: 2e63 6c65 6172 2829 3b0a 0909 0972 6574 .clear();....ret │ │ │ +00053fc0: 7572 6e3b 0a09 097d 0a0a 0909 6175 746f urn;...}....auto │ │ │ +00053fd0: 2066 203d 206f 7065 6e5f 6669 6c65 2861 f = open_file(a │ │ │ +00053fe0: 7578 3a3a 6f70 656e 5f6d 6f64 653a 3a77 ux::open_mode::w │ │ │ +00053ff0: 7269 7465 207c 2061 7578 3a3a 6f70 656e rite | aux::open │ │ │ +00054000: 5f6d 6f64 653a 3a68 6964 6465 6e2c 2065 _mode::hidden, e │ │ │ +00054010: 6329 3b0a 0909 6966 2028 6563 2920 7265 c);...if (ec) re │ │ │ +00054020: 7475 726e 3b0a 0a09 0973 7464 3a3a 7665 turn;....std::ve │ │ │ +00054030: 6374 6f72 266c 743b 6368 6172 2667 743b ctor<char> │ │ │ +00054040: 2068 6561 6465 7228 7374 6174 6963 5f63 header(static_c │ │ │ +00054050: 6173 7426 6c74 3b73 7464 3a3a 7369 7a65 ast<std::size │ │ │ +00054060: 5f74 2667 743b 286d 5f68 6561 6465 725f _t>(m_header_ │ │ │ +00054070: 7369 7a65 2929 3b0a 0a09 0975 7369 6e67 size));....using │ │ │ +00054080: 206e 616d 6573 7061 6365 206c 6962 746f namespace libto │ │ │ +00054090: 7272 656e 743a 3a61 7578 3b0a 0a09 0963 rrent::aux;....c │ │ │ +000540a0: 6861 722a 2070 7472 203d 2068 6561 6465 har* ptr = heade │ │ │ +000540b0: 722e 6461 7461 2829 3b0a 0909 7772 6974 r.data();...writ │ │ │ +000540c0: 655f 7569 6e74 3332 286d 5f6d 6178 5f70 e_uint32(m_max_p │ │ │ +000540d0: 6965 6365 732c 2070 7472 293b 0a09 0977 ieces, ptr);...w │ │ │ +000540e0: 7269 7465 5f75 696e 7433 3228 6d5f 7069 rite_uint32(m_pi │ │ │ +000540f0: 6563 655f 7369 7a65 2c20 7074 7229 3b0a ece_size, ptr);. │ │ │ +00054100: 0a09 0966 6f72 2028 7069 6563 655f 696e ...for (piece_in │ │ │ +00054110: 6465 785f 7420 7069 6563 6528 3029 3b20 dex_t piece(0); │ │ │ +00054120: 7069 6563 6520 266c 743b 2070 6965 6365 piece < piece │ │ │ +00054130: 5f69 6e64 6578 5f74 286d 5f6d 6178 5f70 _index_t(m_max_p │ │ │ +00054140: 6965 6365 7329 3b20 2b2b 7069 6563 6529 ieces); ++piece) │ │ │ +00054150: 0a09 097b 0a09 0909 6175 746f 2063 6f6e ...{....auto con │ │ │ +00054160: 7374 2069 203d 206d 5f70 6965 6365 5f6d st i = m_piece_m │ │ │ +00054170: 6170 2e66 696e 6428 7069 6563 6529 3b0a ap.find(piece);. │ │ │ +00054180: 3c2f 7072 653e 3c2f 7464 3e3c 2f74 723e
    │ │ │ +00054190: 3c74 7220 7374 796c 653d 2262 6163 6b67 relevance  │ │ │ +000541c0: 303c 2f74 643e 3c74 643e 3c61 2068 7265 0../sr │ │ │ +000541f0: 632f 6164 645f 746f 7272 656e 745f 7061 c/add_torrent_pa │ │ │ +00054200: 7261 6d73 2e63 7070 3a37 383c 2f61 3e3c rams.cpp:78< │ │ │ +00054210: 2f74 643e 3c74 643e 7072 6520 432b 2b31 /td>pre C++1 │ │ │ +00054220: 372c 2047 4343 2061 6e64 206d 7376 6320 7, GCC and msvc │ │ │ +00054230: 646f 6573 206e 6f74 206d 616b 6520 7374 does not make st │ │ │ +00054240: 643a 3a73 7472 696e 6720 6e6f 7468 726f d::string nothro │ │ │ +00054250: 7720 6d6f 7665 2061 7373 6967 6e61 626c w move assignabl │ │ │ +00054260: 652c 2077 6869 6368 206d 6561 6e73 206e e, which means n │ │ │ +00054270: 6f20 7479 7065 2063 6f6e 7461 696e 696e o type containin │ │ │ +00054280: 6720 6120 7374 7269 6e67 2077 696c 6c20 g a string will │ │ │ +00054290: 6265 206e 6f74 6872 6f77 206d 6f76 6520 be nothrow move │ │ │ +000542a0: 6173 7369 676e 6162 6c65 2062 7920 6465 assignable by de │ │ │ +000542b0: 6661 756c 7420 6569 7468 6572 2073 7461 fault either sta │ │ │ +000542c0: 7469 635f 6173 7365 7274 2873 7464 3a3a tic_assert(std:: │ │ │ +000542d0: 6973 5f6e 6f74 6872 6f77 5f6d 6f76 655f is_nothrow_move_ │ │ │ +000542e0: 6173 7369 676e 6162 6c65 3c61 6464 5f74 assignable:: │ │ │ +00054300: 7661 6c75 6520 2c20 2273 686f 756c 6420 value , "should │ │ │ +00054310: 6265 206e 6f74 6872 6f77 206d 6f76 6520 be nothrow move │ │ │ +00054320: 6173 7369 676e 6162 6c65 2229 3b3c 2f74 assignable");

    pre C │ │ │ +00054380: 2b2b 3137 2c20 4743 4320 616e 6420 6d73 ++17, GCC and ms │ │ │ +00054390: 7663 2064 6f65 7320 6e6f 7420 6d61 6b65 vc does not make │ │ │ +000543a0: 2073 7464 3a3a 7374 7269 6e67 206e 6f74 std::string not │ │ │ +000543b0: 6872 6f77 206d 6f76 650a 6173 7369 676e hrow move.assign │ │ │ +000543c0: 6162 6c65 2c20 7768 6963 6820 6d65 616e able, which mean │ │ │ +000543d0: 7320 6e6f 2074 7970 6520 636f 6e74 6169 s no type contai │ │ │ +000543e0: 6e69 6e67 2061 2073 7472 696e 6720 7769 ning a string wi │ │ │ +000543f0: 6c6c 2062 6520 6e6f 7468 726f 7720 6d6f ll be nothrow mo │ │ │ +00054400: 7665 0a61 7373 6967 6e61 626c 6520 6279 ve.assignable by │ │ │ +00054410: 2064 6566 6175 6c74 2065 6974 6865 720a default either. │ │ │ +00054420: 7374 6174 6963 5f61 7373 6572 7428 7374 static_assert(st │ │ │ +00054430: 643a 3a69 735f 6e6f 7468 726f 775f 6d6f d::is_nothrow_mo │ │ │ +00054440: 7665 5f61 7373 6967 6e61 626c 653c 6164 ve_assignable::value., "shou │ │ │ +00054470: 6c64 2062 6520 6e6f 7468 726f 7720 6d6f ld be nothrow mo │ │ │ +00054480: 7665 2061 7373 6967 6e61 626c 6522 293b ve assignable"); │ │ │ +00054490: 3c2f 6832 3e3c 6834 3e2e 2e2f 7372 632f

    ../src/ │ │ │ +000544a0: 6164 645f 746f 7272 656e 745f 7061 7261 add_torrent_para │ │ │ +000544b0: 6d73 2e63 7070 3a37 383c 2f68 343e 3c70 ms.cpp:78

    ...DECL_ │ │ │ +00054500: 464c 4147 2873 6571 7565 6e74 6961 6c5f FLAG(sequential_ │ │ │ +00054510: 646f 776e 6c6f 6164 293b 0a09 0909 4445 download);....DE │ │ │ +00054520: 434c 5f46 4c41 4728 7069 6e6e 6564 293b CL_FLAG(pinned); │ │ │ +00054530: 0a09 0909 4445 434c 5f46 4c41 4728 7374 ....DECL_FLAG(st │ │ │ +00054540: 6f70 5f77 6865 6e5f 7265 6164 7929 3b0a op_when_ready);. │ │ │ +00054550: 0909 0944 4543 4c5f 464c 4147 286f 7665 ...DECL_FLAG(ove │ │ │ +00054560: 7272 6964 655f 7472 6163 6b65 7273 293b rride_trackers); │ │ │ +00054570: 0a09 0909 4445 434c 5f46 4c41 4728 6f76 ....DECL_FLAG(ov │ │ │ +00054580: 6572 7269 6465 5f77 6562 5f73 6565 6473 erride_web_seeds │ │ │ +00054590: 293b 0a09 0909 4445 434c 5f46 4c41 4728 );....DECL_FLAG( │ │ │ +000545a0: 6e65 6564 5f73 6176 655f 7265 7375 6d65 need_save_resume │ │ │ +000545b0: 293b 0a09 0909 4445 434c 5f46 4c41 4728 );....DECL_FLAG( │ │ │ +000545c0: 6f76 6572 7269 6465 5f72 6573 756d 655f override_resume_ │ │ │ +000545d0: 6461 7461 293b 0a09 0909 4445 434c 5f46 data);....DECL_F │ │ │ +000545e0: 4c41 4728 6d65 7267 655f 7265 7375 6d65 LAG(merge_resume │ │ │ +000545f0: 5f74 7261 636b 6572 7329 3b0a 0909 0944 _trackers);....D │ │ │ +00054600: 4543 4c5f 464c 4147 2875 7365 5f72 6573 ECL_FLAG(use_res │ │ │ +00054610: 756d 655f 7361 7665 5f70 6174 6829 3b0a ume_save_path);. │ │ │ +00054620: 0909 0944 4543 4c5f 464c 4147 286d 6572 ...DECL_FLAG(mer │ │ │ +00054630: 6765 5f72 6573 756d 655f 6874 7470 5f73 ge_resume_http_s │ │ │ +00054640: 6565 6473 293b 0a09 0909 4445 434c 5f46 eeds);....DECL_F │ │ │ +00054650: 4c41 4728 6465 6661 756c 745f 666c 6167 LAG(default_flag │ │ │ +00054660: 7329 3b0a 2375 6e64 6566 2044 4543 4c5f s);.#undef DECL_ │ │ │ +00054670: 464c 4147 0a23 656e 6469 6620 2f2f 2054 FLAG.#endif // T │ │ │ +00054680: 4f52 5245 4e54 5f41 4249 5f56 4552 5349 ORRENT_ABI_VERSI │ │ │ +00054690: 4f4e 0a0a 0973 7461 7469 635f 6173 7365 ON...static_asse │ │ │ +000546a0: 7274 2873 7464 3a3a 6973 5f6e 6f74 6872 rt(std::is_nothr │ │ │ +000546b0: 6f77 5f6d 6f76 655f 636f 6e73 7472 7563 ow_move_construc │ │ │ +000546c0: 7469 626c 6526 6c74 3b61 6464 5f74 6f72 tible<add_tor │ │ │ +000546d0: 7265 6e74 5f70 6172 616d 7326 6774 3b3a rent_params>: │ │ │ +000546e0: 3a76 616c 7565 0a09 092c 2022 7368 6f75 :value..., "shou │ │ │ +000546f0: 6c64 2062 6520 6e6f 7468 726f 7720 6d6f ld be nothrow mo │ │ │ +00054700: 7665 2063 6f6e 7374 7275 6374 6962 6c65 ve constructible │ │ │ +00054710: 2229 3b0a 0a09 7374 6174 6963 5f61 7373 ");...static_ass │ │ │ +00054720: 6572 7428 7374 643a 3a69 735f 6e6f 7468 ert(std::is_noth │ │ │ +00054730: 726f 775f 6d6f 7665 5f63 6f6e 7374 7275 row_move_constru │ │ │ +00054740: 6374 6962 6c65 266c 743b 7374 643a 3a73 ctible<std::s │ │ │ +00054750: 7472 696e 6726 6774 3b3a 3a76 616c 7565 tring>::value │ │ │ +00054760: 0a09 092c 2022 7368 6f75 6c64 2062 6520 ..., "should be │ │ │ +00054770: 6e6f 7468 726f 7720 6d6f 7665 2063 6f6e nothrow move con │ │ │ +00054780: 7374 7275 6374 6962 6c65 2229 3b0a 0a3c structible");..< │ │ │ +00054790: 6469 7620 7374 796c 653d 2262 6163 6b67 div style="backg │ │ │ +000547a0: 726f 756e 643a 2023 6666 6666 3030 2220 round: #ffff00" │ │ │ +000547b0: 7769 6474 683d 2231 3030 2522 3e0a 3c2f width="100%">.

    < │ │ │ +000547d0: 2f74 723e 3c74 7220 7374 796c 653d 2262 /tr>relevance&n │ │ │ +00054800: 6273 703b 303c 2f74 643e 3c74 643e 3c61 bsp;0. │ │ │ +00054830: 2e2f 7372 632f 6164 645f 746f 7272 656e ./src/add_torren │ │ │ +00054840: 745f 7061 7261 6d73 2e63 7070 3a38 343c t_params.cpp:84< │ │ │ +00054850: 2f61 3e3c 2f74 643e 3c74 643e 6974 2077 /a>it w │ │ │ +00054860: 6f75 6c64 2062 6520 6e69 6365 2069 6620 ould be nice if │ │ │ +00054870: 7468 6973 2077 6173 206e 6f74 6872 6f77 this was nothrow │ │ │ +00054880: 2064 6566 6175 6c74 2063 6f6e 7374 7275 default constru │ │ │ +00054890: 6374 6962 6c65 2073 7461 7469 635f 6173 ctible static_as │ │ │ +000548a0: 7365 7274 2873 7464 3a3a 6973 5f6e 6f74 sert(std::is_not │ │ │ +000548b0: 6872 6f77 5f64 6566 6175 6c74 5f63 6f6e hrow_default_con │ │ │ +000548c0: 7374 7275 6374 6962 6c65 3c61 6464 5f74 structible:: │ │ │ +000548e0: 7661 6c75 6520 2c20 2273 686f 756c 6420 value , "should │ │ │ +000548f0: 6265 206e 6f74 6872 6f77 2064 6566 6175 be nothrow defau │ │ │ +00054900: 6c74 2063 6f6e 7374 7275 6374 6962 6c65 lt constructible │ │ │ +00054910: 2229 3b3c 2f74 643e 3c2f 7472 3e3c 7472 ");

    it would be nic │ │ │ +00054970: 6520 6966 2074 6869 7320 7761 7320 6e6f e if this was no │ │ │ +00054980: 7468 726f 7720 6465 6661 756c 7420 636f throw default co │ │ │ +00054990: 6e73 7472 7563 7469 626c 650a 7374 6174 nstructible.stat │ │ │ +000549a0: 6963 5f61 7373 6572 7428 7374 643a 3a69 ic_assert(std::i │ │ │ +000549b0: 735f 6e6f 7468 726f 775f 6465 6661 756c s_nothrow_defaul │ │ │ +000549c0: 745f 636f 6e73 7472 7563 7469 626c 653c t_constructible< │ │ │ +000549d0: 6164 645f 746f 7272 656e 745f 7061 7261 add_torrent_para │ │ │ +000549e0: 6d73 3e3a 3a76 616c 7565 0a2c 2022 7368 ms>::value., "sh │ │ │ +000549f0: 6f75 6c64 2062 6520 6e6f 7468 726f 7720 ould be nothrow │ │ │ +00054a00: 6465 6661 756c 7420 636f 6e73 7472 7563 default construc │ │ │ +00054a10: 7469 626c 6522 293b 3c2f 6832 3e3c 6834 tible");

    ../src/add_torr │ │ │ +00054a30: 656e 745f 7061 7261 6d73 2e63 7070 3a38 ent_params.cpp:8 │ │ │ +00054a40: 343c 2f68 343e 3c70 7265 2073 7479 6c65 4

    │ │ │ +00054a80: 0909 0944 4543 4c5f 464c 4147 2870 696e  ...DECL_FLAG(pin
    │ │ │ +00054a90: 6e65 6429 3b0a 0909 0944 4543 4c5f 464c  ned);....DECL_FL
    │ │ │ +00054aa0: 4147 2873 746f 705f 7768 656e 5f72 6561  AG(stop_when_rea
    │ │ │ +00054ab0: 6479 293b 0a09 0909 4445 434c 5f46 4c41  dy);....DECL_FLA
    │ │ │ +00054ac0: 4728 6f76 6572 7269 6465 5f74 7261 636b  G(override_track
    │ │ │ +00054ad0: 6572 7329 3b0a 0909 0944 4543 4c5f 464c  ers);....DECL_FL
    │ │ │ +00054ae0: 4147 286f 7665 7272 6964 655f 7765 625f  AG(override_web_
    │ │ │ +00054af0: 7365 6564 7329 3b0a 0909 0944 4543 4c5f  seeds);....DECL_
    │ │ │ +00054b00: 464c 4147 286e 6565 645f 7361 7665 5f72  FLAG(need_save_r
    │ │ │ +00054b10: 6573 756d 6529 3b0a 0909 0944 4543 4c5f  esume);....DECL_
    │ │ │ +00054b20: 464c 4147 286f 7665 7272 6964 655f 7265  FLAG(override_re
    │ │ │ +00054b30: 7375 6d65 5f64 6174 6129 3b0a 0909 0944  sume_data);....D
    │ │ │ +00054b40: 4543 4c5f 464c 4147 286d 6572 6765 5f72  ECL_FLAG(merge_r
    │ │ │ +00054b50: 6573 756d 655f 7472 6163 6b65 7273 293b  esume_trackers);
    │ │ │ +00054b60: 0a09 0909 4445 434c 5f46 4c41 4728 7573  ....DECL_FLAG(us
    │ │ │ +00054b70: 655f 7265 7375 6d65 5f73 6176 655f 7061  e_resume_save_pa
    │ │ │ +00054b80: 7468 293b 0a09 0909 4445 434c 5f46 4c41  th);....DECL_FLA
    │ │ │ +00054b90: 4728 6d65 7267 655f 7265 7375 6d65 5f68  G(merge_resume_h
    │ │ │ +00054ba0: 7474 705f 7365 6564 7329 3b0a 0909 0944  ttp_seeds);....D
    │ │ │ +00054bb0: 4543 4c5f 464c 4147 2864 6566 6175 6c74  ECL_FLAG(default
    │ │ │ +00054bc0: 5f66 6c61 6773 293b 0a23 756e 6465 6620  _flags);.#undef 
    │ │ │ +00054bd0: 4445 434c 5f46 4c41 470a 2365 6e64 6966  DECL_FLAG.#endif
    │ │ │ +00054be0: 202f 2f20 544f 5252 454e 545f 4142 495f   // TORRENT_ABI_
    │ │ │ +00054bf0: 5645 5253 494f 4e0a 0a09 7374 6174 6963  VERSION...static
    │ │ │ +00054c00: 5f61 7373 6572 7428 7374 643a 3a69 735f  _assert(std::is_
    │ │ │ +00054c10: 6e6f 7468 726f 775f 6d6f 7665 5f63 6f6e  nothrow_move_con
    │ │ │ +00054c20: 7374 7275 6374 6962 6c65 266c 743b 6164  structible<ad
    │ │ │ +00054c30: 645f 746f 7272 656e 745f 7061 7261 6d73  d_torrent_params
    │ │ │ +00054c40: 2667 743b 3a3a 7661 6c75 650a 0909 2c20  >::value..., 
    │ │ │ +00054c50: 2273 686f 756c 6420 6265 206e 6f74 6872  "should be nothr
    │ │ │ +00054c60: 6f77 206d 6f76 6520 636f 6e73 7472 7563  ow move construc
    │ │ │ +00054c70: 7469 626c 6522 293b 0a0a 0973 7461 7469  tible");...stati
    │ │ │ +00054c80: 635f 6173 7365 7274 2873 7464 3a3a 6973  c_assert(std::is
    │ │ │ +00054c90: 5f6e 6f74 6872 6f77 5f6d 6f76 655f 636f  _nothrow_move_co
    │ │ │ +00054ca0: 6e73 7472 7563 7469 626c 6526 6c74 3b73  nstructible<s
    │ │ │ +00054cb0: 7464 3a3a 7374 7269 6e67 2667 743b 3a3a  td::string>::
    │ │ │ +00054cc0: 7661 6c75 650a 0909 2c20 2273 686f 756c  value..., "shoul
    │ │ │ +00054cd0: 6420 6265 206e 6f74 6872 6f77 206d 6f76  d be nothrow mov
    │ │ │ +00054ce0: 6520 636f 6e73 7472 7563 7469 626c 6522  e constructible"
    │ │ │ +00054cf0: 293b 0a0a 0a3c 6469 7620 7374 796c 653d  );...
    .
    namesp │ │ │ +00054d30: 6163 6520 6175 7820 7b0a 0a09 2f2f 2072 ace aux {...// r │ │ │ +00054d40: 6574 7572 6e73 2077 6865 7468 6572 2074 eturns whether t │ │ │ +00054d50: 6869 7320 6164 645f 746f 7272 656e 745f his add_torrent_ │ │ │ +00054d60: 7061 7261 6d73 206f 626a 6563 7420 6861 params object ha │ │ │ +00054d70: 7320 2272 6573 756d 652d 6461 7461 222c s "resume-data", │ │ │ +00054d80: 2069 2e65 2e0a 092f 2f20 696e 666f 726d i.e...// inform │ │ │ +00054d90: 6174 696f 6e20 6162 6f75 7420 7768 6963 ation about whic │ │ │ +00054da0: 6820 7069 6563 6573 2077 6520 6861 7665 h pieces we have │ │ │ +00054db0: 2e0a 0962 6f6f 6c20 636f 6e74 6169 6e73 ...bool contains │ │ │ +00054dc0: 5f72 6573 756d 655f 6461 7461 2861 6464 _resume_data(add │ │ │ +00054dd0: 5f74 6f72 7265 6e74 5f70 6172 616d 7320 _torrent_params │ │ │ +00054de0: 636f 6e73 7426 616d 703b 2061 7470 290a const& atp). │ │ │ +00054df0: 097b 0a09 0972 6574 7572 6e20 2161 7470 .{...return !atp │ │ │ +00054e00: 2e68 6176 655f 7069 6563 6573 2e65 6d70 .have_pieces.emp │ │ │ +00054e10: 7479 2829 0a09 0909 7c7c 2028 6174 702e ty()....|| (atp. │ │ │ +00054e20: 666c 6167 7320 2661 6d70 3b20 746f 7272 flags & torr │ │ │ +00054e30: 656e 745f 666c 6167 733a 3a73 6565 645f ent_flags::seed_ │ │ │ +00054e40: 6d6f 6465 293b 0a09 7d0a 7d0a 0a7d 0a3c mode);..}.}..}.< │ │ │ +00054e50: 2f70 7265 3e3c 2f74 643e 3c2f 7472 3e3c /pre>< │ │ │ +00054e60: 7472 2073 7479 6c65 3d22 6261 636b 6772 tr style="backgr │ │ │ +00054e70: 6f75 6e64 3a20 2363 6363 223e 3c74 643e ound: #ccc"> │ │ │ +00054e80: 7265 6c65 7661 6e63 6526 6e62 7370 3b30 relevance 0 │ │ │ +00054e90: 3c2f 7464 3e3c 7464 3e3c 6120 6872 6566
    ../src │ │ │ +00054ec0: 2f63 686f 6b65 722e 6370 703a 3235 383c /choker.cpp:258< │ │ │ +00054ed0: 2f61 3e3c 2f74 643e 3c74 643e 6d61 6b65 /a>make │ │ │ +00054ee0: 2063 6f6e 6669 6775 7261 626c 653c 2f74 configurable

    make │ │ │ +00054f40: 636f 6e66 6967 7572 6162 6c65 3c2f 6832 configurable

    ../src/chok │ │ │ +00054f60: 6572 2e63 7070 3a32 3538 3c2f 6834 3e3c er.cpp:258

    < │ │ │ +00054f70: 7072 6520 7374 796c 653d 2262 6163 6b67 pre style="backg │ │ │ +00054f80: 726f 756e 643a 2023 6636 6636 6636 3b20 round: #f6f6f6; │ │ │ +00054f90: 626f 7264 6572 3a20 736f 6c69 6420 3170 border: solid 1p │ │ │ +00054fa0: 7820 2364 6464 3b22 3e09 0909 2f2f 2066 x #ddd;">...// f │ │ │ +00054fb0: 6972 7374 2072 6573 6574 2074 6865 206e irst reset the n │ │ │ +00054fc0: 756d 6265 7220 6f66 2075 6e63 686f 6b65 umber of unchoke │ │ │ +00054fd0: 2073 6c6f 7473 2c20 6265 6361 7573 6520 slots, because │ │ │ +00054fe0: 7765 276c 6c20 6361 6c63 756c 6174 650a we'll calculate. │ │ │ +00054ff0: 0909 092f 2f20 6974 2070 7572 656c 7920 ...// it purely │ │ │ +00055000: 6261 7365 6420 6f6e 2074 6865 2063 7572 based on the cur │ │ │ +00055010: 7265 6e74 2073 7461 7465 206f 6620 6f75 rent state of ou │ │ │ +00055020: 7220 7065 6572 732e 0a09 0909 7570 6c6f r peers.....uplo │ │ │ +00055030: 6164 5f73 6c6f 7473 203d 2030 3b0a 0a09 ad_slots = 0;... │ │ │ +00055040: 0909 696e 7420 7261 7465 5f74 6872 6573 ..int rate_thres │ │ │ +00055050: 686f 6c64 203d 2073 6574 742e 6765 745f hold = sett.get_ │ │ │ +00055060: 696e 7428 7365 7474 696e 6773 5f70 6163 int(settings_pac │ │ │ +00055070: 6b3a 3a72 6174 655f 6368 6f6b 6572 5f69 k::rate_choker_i │ │ │ +00055080: 6e69 7469 616c 5f74 6872 6573 686f 6c64 nitial_threshold │ │ │ +00055090: 293b 0a0a 0909 0973 7464 3a3a 736f 7274 );.....std::sort │ │ │ +000550a0: 2870 6565 7273 2e62 6567 696e 2829 2c20 (peers.begin(), │ │ │ +000550b0: 7065 6572 732e 656e 6428 290a 0909 0909 peers.end()..... │ │ │ +000550c0: 2c20 5b5d 2870 6565 725f 636f 6e6e 6563 , [](peer_connec │ │ │ +000550d0: 7469 6f6e 2063 6f6e 7374 2a20 6c68 732c tion const* lhs, │ │ │ +000550e0: 2070 6565 725f 636f 6e6e 6563 7469 6f6e peer_connection │ │ │ +000550f0: 2063 6f6e 7374 2a20 7268 7329 0a09 0909 const* rhs).... │ │ │ +00055100: 097b 2072 6574 7572 6e20 7570 6c6f 6164 .{ return upload │ │ │ +00055110: 5f72 6174 655f 636f 6d70 6172 6528 6c68 _rate_compare(lh │ │ │ +00055120: 732c 2072 6873 293b 207d 293b 0a0a 0909 s, rhs); });.... │ │ │ +00055130: 0966 6f72 2028 6175 746f 2063 6f6e 7374 .for (auto const │ │ │ +00055140: 2a20 7020 3a20 7065 6572 7329 0a09 0909 * p : peers).... │ │ │ +00055150: 7b0a 0909 0909 696e 7420 636f 6e73 7420 {.....int const │ │ │ +00055160: 7261 7465 203d 2069 6e74 2870 2d26 6774 rate = int(p-> │ │ │ +00055170: 3b75 706c 6f61 6465 645f 696e 5f6c 6173 ;uploaded_in_las │ │ │ +00055180: 745f 726f 756e 6428 290a 0909 0909 092a t_round()......* │ │ │ +00055190: 2031 3030 3020 2f20 746f 7461 6c5f 6d69 1000 / total_mi │ │ │ +000551a0: 6c6c 6973 6563 6f6e 6473 2875 6e63 686f lliseconds(uncho │ │ │ +000551b0: 6b65 5f69 6e74 6572 7661 6c29 293b 0a0a ke_interval));.. │ │ │ +000551c0: 0909 0909 2f2f 2061 6c77 6179 7320 6861 ....// always ha │ │ │ +000551d0: 7665 2061 7420 6c65 6173 7420 3120 756e ve at least 1 un │ │ │ +000551e0: 6368 6f6b 6520 736c 6f74 0a09 0909 0969 choke slot.....i │ │ │ +000551f0: 6620 2872 6174 6520 266c 743b 2072 6174 f (rate < rat │ │ │ +00055200: 655f 7468 7265 7368 6f6c 6429 2062 7265 e_threshold) bre │ │ │ +00055210: 616b 3b0a 0a09 0909 092b 2b75 706c 6f61 ak;......++uploa │ │ │ +00055220: 645f 736c 6f74 733b 0a0a 3c64 6976 2073 d_slots;..
    ....rate │ │ │ +00055260: 5f74 6872 6573 686f 6c64 202b 3d20 3230 _threshold += 20 │ │ │ +00055270: 3438 3b0a 3c2f 6469 763e 0909 097d 0a09 48;.
    ...}.. │ │ │ +00055280: 0909 2b2b 7570 6c6f 6164 5f73 6c6f 7473 ..++upload_slots │ │ │ +00055290: 3b0a 0909 7d0a 0a09 092f 2f20 736f 7274 ;...}....// sort │ │ │ +000552a0: 7320 7468 6520 7065 6572 7320 7468 6174 s the peers that │ │ │ +000552b0: 2061 7265 2065 6c69 6769 626c 6520 666f are eligible fo │ │ │ +000552c0: 7220 756e 6368 6f6b 6520 6279 2064 6f77 r unchoke by dow │ │ │ +000552d0: 6e6c 6f61 6420 7261 7465 2061 6e64 0a09 nload rate and.. │ │ │ +000552e0: 092f 2f20 7365 636f 6e64 6172 7920 6279 .// secondary by │ │ │ +000552f0: 2074 6f74 616c 2075 706c 6f61 642e 2054 total upload. T │ │ │ +00055300: 6865 2072 6561 736f 6e20 666f 7220 7468 he reason for th │ │ │ +00055310: 6973 2069 732c 2069 6620 616c 6c20 746f is is, if all to │ │ │ +00055320: 7272 656e 7473 2061 7265 0a09 092f 2f20 rrents are...// │ │ │ +00055330: 6265 696e 6720 7365 6564 6564 2c20 7468 being seeded, th │ │ │ +00055340: 6520 646f 776e 6c6f 6164 2072 6174 6520 e download rate │ │ │ +00055350: 7769 6c6c 2062 6520 302c 2061 6e64 2074 will be 0, and t │ │ │ +00055360: 6865 2070 6565 7273 2077 6520 6861 7665 he peers we have │ │ │ +00055370: 2073 656e 740a 0909 2f2f 2074 6865 206c sent...// the l │ │ │ +00055380: 6561 7374 2074 6f20 7368 6f75 6c64 2062 east to should b │ │ │ +00055390: 6520 756e 6368 6f6b 6564 0a0a 0909 2f2f e unchoked....// │ │ │ +000553a0: 2077 6520 7573 6520 7061 7274 6961 6c20 we use partial │ │ │ +000553b0: 736f 7274 2068 6572 652c 2062 6563 6175 sort here, becau │ │ │ +000553c0: 7365 2077 6520 6f6e 6c79 2063 6172 6520 se we only care │ │ │ +000553d0: 6162 6f75 7420 7468 6520 746f 700a 0909 about the top... │ │ │ +000553e0: 2f2f 2075 706c 6f61 645f 736c 6f74 7320 // upload_slots │ │ │ +000553f0: 7065 6572 732e 0a0a 0909 696e 7420 636f peers.....int co │ │ │ +00055400: 6e73 7420 736c 6f74 7320 3d20 7374 643a nst slots = std: │ │ │ +00055410: 3a6d 696e 2875 706c 6f61 645f 736c 6f74 :min(upload_slot │ │ │ +00055420: 732c 2069 6e74 2870 6565 7273 2e73 697a s, int(peers.siz │ │ │ +00055430: 6528 2929 293b 0a0a 0909 6966 2028 7365 e()));....if (se │ │ │ +00055440: 7474 2e67 6574 5f69 6e74 2873 6574 7469 tt.get_int(setti │ │ │ +00055450: 6e67 735f 7061 636b 3a3a 7365 6564 5f63 ngs_pack::seed_c │ │ │ +00055460: 686f 6b69 6e67 5f61 6c67 6f72 6974 686d hoking_algorithm │ │ │ +00055470: 290a 0909 093d 3d20 7365 7474 696e 6773 )....== settings │ │ │ +00055480: 5f70 6163 6b3a 3a72 6f75 6e64 5f72 6f62 _pack::round_rob │ │ │ +00055490: 696e 290a 0909 7b0a 0909 0969 6e74 2063 in)...{....int c │ │ │ +000554a0: 6f6e 7374 2070 6965 6365 7320 3d20 7365 onst pieces = se │ │ │ +000554b0: 7474 2e67 6574 5f69 6e74 2873 6574 7469 tt.get_int(setti │ │ │ +000554c0: 6e67 735f 7061 636b 3a3a 7365 6564 696e ngs_pack::seedin │ │ │ +000554d0: 675f 7069 6563 655f 7175 6f74 6129 3b0a g_piece_quota);. │ │ │ +000554e0: 0a09 0909 7374 643a 3a6e 7468 5f65 6c65 ....std::nth_ele │ │ │ +000554f0: 6d65 6e74 2870 6565 7273 2e62 6567 696e ment(peers.begin │ │ │ +00055500: 2829 2c20 7065 6572 732e 6265 6769 6e28 (), peers.begin( │ │ │ +00055510: 290a 0909 0909 2b20 736c 6f74 732c 2070 ).....+ slots, p │ │ │ +00055520: 6565 7273 2e65 6e64 2829 0a09 0909 092c eers.end()....., │ │ │ +00055530: 205b 7069 6563 6573 5d28 7065 6572 5f63 [pieces](peer_c │ │ │ +00055540: 6f6e 6e65 6374 696f 6e20 636f 6e73 742a onnection const* │ │ │ +00055550: 206c 6873 2c20 7065 6572 5f63 6f6e 6e65 lhs, peer_conne │ │ │ +00055560: 6374 696f 6e20 636f 6e73 742a 2072 6873 ction const* rhs │ │ │ +00055570: 290a 0909 0909 7b20 7265 7475 726e 2075 ).....{ return u │ │ │ +00055580: 6e63 686f 6b65 5f63 6f6d 7061 7265 5f72 nchoke_compare_r │ │ │ +00055590: 7228 6c68 732c 2072 6873 2c20 7069 6563 r(lhs, rhs, piec │ │ │ +000555a0: 6573 293b 207d 293b 0a09 097d 0a09 0965 es); });...}...e │ │ │ +000555b0: 6c73 6520 6966 2028 7365 7474 2e67 6574 lse if (sett.get │ │ │ +000555c0: 5f69 6e74 2873 6574 7469 6e67 735f 7061 _int(settings_pa │ │ │ +000555d0: 636b 3a3a 7365 6564 5f63 686f 6b69 6e67 ck::seed_choking │ │ │ +000555e0: 5f61 6c67 6f72 6974 686d 290a 0909 093d _algorithm)....= │ │ │ +000555f0: 3d20 7365 7474 696e 6773 5f70 6163 6b3a = settings_pack: │ │ │ +00055600: 3a66 6173 7465 7374 5f75 706c 6f61 6429 :fastest_upload) │ │ │ +00055610: 0a09 097b 0a09 0909 7374 643a 3a6e 7468 ...{....std::nth │ │ │ +00055620: 5f65 6c65 6d65 6e74 2870 6565 7273 2e62 _element(peers.b │ │ │ +00055630: 6567 696e 2829 2c20 7065 6572 732e 6265 egin(), peers.be │ │ │ +00055640: 6769 6e28 290a 0909 0909 2b20 736c 6f74 gin().....+ slot │ │ │ +00055650: 732c 2070 6565 7273 2e65 6e64 2829 0a09 s, peers.end().. │ │ │ +00055660: 0909 092c 205b 5d28 7065 6572 5f63 6f6e ..., [](peer_con │ │ │ +00055670: 6e65 6374 696f 6e20 636f 6e73 742a 206c nection const* l │ │ │ +00055680: 6873 2c20 7065 6572 5f63 6f6e 6e65 6374 hs, peer_connect │ │ │ +00055690: 696f 6e20 636f 6e73 742a 2072 6873 290a ion const* rhs). │ │ │ +000556a0: 3c2f 7072 653e 3c2f 7464 3e3c 2f74 723e
    │ │ │ +000556b0: 3c74 7220 7374 796c 653d 2262 6163 6b67 relevance  │ │ │ +000556e0: 303c 2f74 643e 3c74 643e 3c61 2068 7265 0../sr │ │ │ +00055710: 632f 6d65 726b 6c65 5f74 7265 652e 6370 c/merkle_tree.cp │ │ │ +00055720: 703a 3131 303c 2f61 3e3c 2f74 643e 3c74 p:110in C++20, use │ │ │ +00055740: 7374 643a 3a69 6465 6e74 6974 793c 2f74 std::identity

    in C+ │ │ │ +000557a0: 2b32 302c 2075 7365 2073 7464 3a3a 6964 +20, use std::id │ │ │ +000557b0: 656e 7469 7479 3c2f 6832 3e3c 6834 3e2e entity

    . │ │ │ +000557c0: 2e2f 7372 632f 6d65 726b 6c65 5f74 7265 ./src/merkle_tre │ │ │ +000557d0: 652e 6370 703a 3131 303c 2f68 343e 3c70 e.cpp:110

    ..alloca │ │ │ +00055820: 7465 5f66 756c 6c28 293b 0a0a 0909 6d65 te_full();....me │ │ │ +00055830: 726b 6c65 5f76 616c 6964 6174 655f 636f rkle_validate_co │ │ │ +00055840: 7079 2874 2c20 6d5f 7472 6565 2c20 726f py(t, m_tree, ro │ │ │ +00055850: 6f74 2829 2c20 6d5f 626c 6f63 6b5f 7665 ot(), m_block_ve │ │ │ +00055860: 7269 6669 6564 293b 0a0a 0909 6c6f 6164 rified);....load │ │ │ +00055870: 5f76 6572 6966 6965 645f 6269 7473 2876 _verified_bits(v │ │ │ +00055880: 6572 6966 6965 6429 3b0a 0a09 096f 7074 erified);....opt │ │ │ +00055890: 696d 697a 655f 7374 6f72 6167 6528 293b imize_storage(); │ │ │ +000558a0: 0a09 096f 7074 696d 697a 655f 7374 6f72 ...optimize_stor │ │ │ +000558b0: 6167 655f 7069 6563 655f 6c61 7965 7228 age_piece_layer( │ │ │ +000558c0: 293b 0a09 7d0a 0a09 766f 6964 206d 6572 );..}...void mer │ │ │ +000558d0: 6b6c 655f 7472 6565 3a3a 636c 6561 7228 kle_tree::clear( │ │ │ +000558e0: 290a 097b 0a09 096d 5f74 7265 652e 636c )..{...m_tree.cl │ │ │ +000558f0: 6561 7228 293b 0a09 096d 5f74 7265 652e ear();...m_tree. │ │ │ +00055900: 7368 7269 6e6b 5f74 6f5f 6669 7428 293b shrink_to_fit(); │ │ │ +00055910: 0a09 096d 5f62 6c6f 636b 5f76 6572 6966 ...m_block_verif │ │ │ +00055920: 6965 642e 636c 6561 7228 293b 0a09 096d ied.clear();...m │ │ │ +00055930: 5f6d 6f64 6520 3d20 6d6f 6465 5f74 3a3a _mode = mode_t:: │ │ │ +00055940: 656d 7074 795f 7472 6565 3b0a 097d 0a0a empty_tree;..}.. │ │ │ +00055950: 6e61 6d65 7370 6163 6520 7b0a 0a3c 6469 namespace {...stru │ │ │ +00055990: 6374 2069 6465 6e74 6974 790a 3c2f 6469 ct identity..{...bool oper │ │ │ +000559b0: 6174 6f72 2829 2862 6f6f 6c20 6229 2063 ator()(bool b) c │ │ │ +000559c0: 6f6e 7374 207b 2072 6574 7572 6e20 623b onst { return b; │ │ │ +000559d0: 207d 0a09 7d3b 0a7d 0a0a 0976 6f69 6420 }..};.}...void │ │ │ +000559e0: 6d65 726b 6c65 5f74 7265 653a 3a6c 6f61 merkle_tree::loa │ │ │ +000559f0: 645f 7370 6172 7365 5f74 7265 6528 7370 d_sparse_tree(sp │ │ │ +00055a00: 616e 266c 743b 7368 6132 3536 5f68 6173 an<sha256_has │ │ │ +00055a10: 6820 636f 6e73 7426 6774 3b20 740a 0909 h const> t... │ │ │ +00055a20: 2c20 7374 643a 3a76 6563 746f 7226 6c74 , std::vector< │ │ │ +00055a30: 3b62 6f6f 6c26 6774 3b20 636f 6e73 7426 ;bool> const& │ │ │ +00055a40: 616d 703b 206d 6173 6b0a 0909 2c20 7374 amp; mask..., st │ │ │ +00055a50: 643a 3a76 6563 746f 7226 6c74 3b62 6f6f d::vector<boo │ │ │ +00055a60: 6c26 6774 3b20 636f 6e73 7426 616d 703b l> const& │ │ │ +00055a70: 2076 6572 6966 6965 6429 0a09 7b0a 0909 verified)..{... │ │ │ +00055a80: 494e 5641 5249 414e 545f 4348 4543 4b3b INVARIANT_CHECK; │ │ │ +00055a90: 0a0a 0909 2f2f 2054 6865 2073 697a 6520 ....// The size │ │ │ +00055aa0: 6f66 2074 6865 206d 6173 6b20 7368 6f75 of the mask shou │ │ │ +00055ab0: 6c64 206e 6f74 2065 7863 6565 6420 7468 ld not exceed th │ │ │ +00055ac0: 6520 7369 7a65 206f 6620 7468 6520 7472 e size of the tr │ │ │ +00055ad0: 6565 2c20 6275 7420 6120 6d61 736b 206c ee, but a mask l │ │ │ +00055ae0: 6172 6765 7220 7468 616e 0a09 092f 2f20 arger than...// │ │ │ +00055af0: 7468 6520 7472 6565 2063 616e 2062 6520 the tree can be │ │ │ +00055b00: 656e 636f 756e 7465 7265 6420 696e 2074 encountered in t │ │ │ +00055b10: 6865 2022 7265 7375 6d65 2064 6174 6122 he "resume data" │ │ │ +00055b20: 2066 6f72 2073 6f6d 6520 7265 6173 6f6e for some reason │ │ │ +00055b30: 2c20 7065 7268 6170 7320 7468 6572 6520 , perhaps there │ │ │ +00055b40: 6973 0a09 092f 2f20 6120 6275 6720 696e is...// a bug in │ │ │ +00055b50: 2074 6865 2022 7265 7375 6d65 2064 6174 the "resume dat │ │ │ +00055b60: 6122 2067 656e 6572 6174 696f 6e20 616c a" generation al │ │ │ +00055b70: 676f 7269 7468 6d2e 0a09 092f 2f20 536f gorithm....// So │ │ │ +00055b80: 2077 6520 6a75 7374 2070 726f 6365 7373 we just process │ │ │ +00055b90: 206d 6173 6b20 6974 656d 7320 636f 756e mask items coun │ │ │ +00055ba0: 7420 7570 2074 6f20 7472 6565 2073 697a t up to tree siz │ │ │ +00055bb0: 652e 0a09 0969 6e74 2063 6f6e 7374 206d e....int const m │ │ │ +00055bc0: 6173 6b5f 7369 7a65 203d 2069 6e74 2873 ask_size = int(s │ │ │ +00055bd0: 7464 3a3a 6d69 6e28 6d61 736b 2e73 697a td::min(mask.siz │ │ │ +00055be0: 6528 292c 2073 697a 6528 2929 293b 0a0a e(), size()));.. │ │ │ +00055bf0: 0909 696e 7420 636f 6e73 7420 6669 7273 ..int const firs │ │ │ +00055c00: 745f 626c 6f63 6b20 3d20 626c 6f63 6b5f t_block = block_ │ │ │ +00055c10: 6c61 7965 725f 7374 6172 7428 293b 0a09 layer_start();.. │ │ │ +00055c20: 0969 6e74 2063 6f6e 7374 2065 6e64 5f62 .int const end_b │ │ │ +00055c30: 6c6f 636b 203d 2066 6972 7374 5f62 6c6f lock = first_blo │ │ │ +00055c40: 636b 202b 206d 5f6e 756d 5f62 6c6f 636b ck + m_num_block │ │ │ +00055c50: 733b 0a0a 0909 544f 5252 454e 545f 4153 s;....TORRENT_AS │ │ │ +00055c60: 5345 5254 2866 6972 7374 5f62 6c6f 636b SERT(first_block │ │ │ +00055c70: 2026 6c74 3b20 696e 7428 7369 7a65 2829 < int(size() │ │ │ +00055c80: 2929 3b0a 0909 544f 5252 454e 545f 4153 ));...TORRENT_AS │ │ │ +00055c90: 5345 5254 2865 6e64 5f62 6c6f 636b 2026 SERT(end_block & │ │ │ +00055ca0: 6c74 3b3d 2069 6e74 2873 697a 6528 2929 lt;= int(size()) │ │ │ +00055cb0: 293b 0a0a 0909 2f2f 2069 6620 7468 6520 );....// if the │ │ │ +00055cc0: 6d61 736b 2063 6f76 6572 7320 616c 6c20 mask covers all │ │ │ +00055cd0: 626c 6f63 6b73 2c20 676f 2073 7472 6169 blocks, go strai │ │ │ +00055ce0: 6768 7420 746f 2062 6c6f 636b 5f6c 6179 ght to block_lay │ │ │ +00055cf0: 6572 0a09 092f 2f20 6d6f 6465 2c20 616e er...// mode, an │ │ │ +00055d00: 6420 7661 6c69 6461 7465 0a09 0969 6620 d validate...if │ │ │ +00055d10: 2828 6669 7273 745f 626c 6f63 6b20 266c ((first_block &l │ │ │ +00055d20: 743b 206d 6173 6b5f 7369 7a65 2920 2661 t; mask_size) &a │ │ │ +00055d30: 6d70 3b26 616d 703b 2028 656e 645f 626c mp;& (end_bl │ │ │ +00055d40: 6f63 6b20 266c 743b 3d20 6d61 736b 5f73 ock <= mask_s │ │ │ +00055d50: 697a 6529 0a09 0909 2661 6d70 3b26 616d ize)....&&am │ │ │ +00055d60: 703b 2073 7464 3a3a 616c 6c5f 6f66 286d p; std::all_of(m │ │ │ +00055d70: 6173 6b2e 6265 6769 6e28 2920 2b20 6669 ask.begin() + fi │ │ │ +00055d80: 7273 745f 626c 6f63 6b2c 206d 6173 6b2e rst_block, mask. │ │ │ +00055d90: 6265 6769 6e28 2920 2b20 656e 645f 626c begin() + end_bl │ │ │ +00055da0: 6f63 6b2c 2069 6465 6e74 6974 7928 2929 ock, identity()) │ │ │ +00055db0: 290a 0909 7b0a 0909 092f 2f20 7468 6520 )...{....// the │ │ │ +00055dc0: 696e 6465 7820 696e 2074 2074 6861 7420 index in t that │ │ │ +00055dd0: 706f 696e 7473 2074 6f20 6669 7273 745f points to first_ │ │ │ +00055de0: 626c 6f63 6b0a 0909 0961 7574 6f20 636f block....auto co │ │ │ +00055df0: 6e73 7420 626c 6f63 6b5f 696e 6465 7820 nst block_index │ │ │ +00055e00: 3d20 7374 643a 3a63 6f75 6e74 5f69 6628 = std::count_if( │ │ │ +00055e10: 6d61 736b 2e62 6567 696e 2829 2c20 6d61 mask.begin(), ma │ │ │ +00055e20: 736b 2e62 6567 696e 2829 202b 2066 6972 sk.begin() + fir │ │ │ +00055e30: 7374 5f62 6c6f 636b 2c20 6964 656e 7469 st_block, identi │ │ │ +00055e40: 7479 2829 293b 0a3c 2f70 7265 3e3c 2f74 ty());.

    relevanc │ │ │ +00055e80: 6526 6e62 7370 3b30 3c2f 7464 3e3c 7464 e 0../src/merkle_ │ │ │ +00055ec0: 7472 6565 2e63 7070 3a33 3234 3c2f 613e tree.cpp:324 │ │ │ +00055ed0: 3c2f 7464 3e3c 7464 3e74 6869 7320 6361 this ca │ │ │ +00055ee0: 6e20 6265 206f 7074 696d 697a 6564 2062 n be optimized b │ │ │ +00055ef0: 7920 7573 696e 6720 6d5f 7472 6565 2061 y using m_tree a │ │ │ +00055f00: 7320 7374 6f72 6167 6520 746f 2066 696c s storage to fil │ │ │ +00055f10: 6c20 7468 6973 2074 7265 6520 696e 746f l this tree into │ │ │ +00055f20: 2c20 616e 6420 7468 656e 2063 6c65 6172 , and then clear │ │ │ +00055f30: 2069 7420 6966 2074 6865 2068 6173 6865 it if the hashe │ │ │ +00055f40: 7320 6661 696c 3c2f 7464 3e3c 2f74 723e s fail │ │ │ +00055f50: 3c74 7220 6964 3d22 3230 3222 2073 7479 │ │ │ +00055f80: 3c74 6420 636f 6c73 7061 6e3d 2233 223e │ │ │ +00055f90: 3c68 323e 7468 6973 2063 616e 2062 6520

    this can be │ │ │ +00055fa0: 6f70 7469 6d69 7a65 6420 6279 2075 7369 optimized by usi │ │ │ +00055fb0: 6e67 206d 5f74 7265 6520 6173 2073 746f ng m_tree as sto │ │ │ +00055fc0: 7261 6765 2074 6f20 6669 6c6c 2074 6869 rage to fill thi │ │ │ +00055fd0: 730a 7472 6565 2069 6e74 6f2c 2061 6e64 s.tree into, and │ │ │ +00055fe0: 2074 6865 6e20 636c 6561 7220 6974 2069 then clear it i │ │ │ +00055ff0: 6620 7468 6520 6861 7368 6573 2066 6169 f the hashes fai │ │ │ +00056000: 6c3c 2f68 323e 3c68 343e 2e2e 2f73 7263 l

    ../src │ │ │ +00056010: 2f6d 6572 6b6c 655f 7472 6565 2e63 7070 /merkle_tree.cpp │ │ │ +00056020: 3a33 3234 3c2f 6834 3e3c 7072 6520 7374 :324

    .{...INVARIAN
    │ │ │ +00056070: 545f 4348 4543 4b3b 0a0a 0909 2f2f 2061  T_CHECK;....// a
    │ │ │ +00056080: 7320 7765 2073 6574 2074 6865 2068 6173  s we set the has
    │ │ │ +00056090: 6865 7320 6f66 2069 6e74 6572 696f 7220  hes of interior 
    │ │ │ +000560a0: 6e6f 6465 732c 2077 6520 6d61 7920 6265  nodes, we may be
    │ │ │ +000560b0: 2061 626c 6520 746f 2076 616c 6964 6174   able to validat
    │ │ │ +000560c0: 650a 0909 2f2f 2062 6c6f 636b 2068 6173  e...// block has
    │ │ │ +000560d0: 6865 7320 7468 6174 2077 6520 6861 6420  hes that we had 
    │ │ │ +000560e0: 7369 6e63 6520 6561 726c 6965 722e 2041  since earlier. A
    │ │ │ +000560f0: 6e79 2062 6c6f 636b 7320 7468 6174 2063  ny blocks that c
    │ │ │ +00056100: 616e 2062 650a 0909 2f2f 2076 616c 6964  an be...// valid
    │ │ │ +00056110: 6174 6564 2c20 616e 6420 6661 696c 6564  ated, and failed
    │ │ │ +00056120: 2c20 6172 6520 6164 6465 6420 746f 2074  , are added to t
    │ │ │ +00056130: 6869 7320 6c69 7374 0a09 0961 6464 5f68  his list...add_h
    │ │ │ +00056140: 6173 6865 735f 7265 7375 6c74 5f74 2072  ashes_result_t r
    │ │ │ +00056150: 6574 3b0a 0a09 092f 2f20 7765 2061 6c72  et;....// we alr
    │ │ │ +00056160: 6561 6479 2068 6176 6520 616c 6c20 6861  eady have all ha
    │ │ │ +00056170: 7368 6573 0a09 0969 6620 286d 5f6d 6f64  shes...if (m_mod
    │ │ │ +00056180: 6520 3d3d 206d 6f64 655f 743a 3a62 6c6f  e == mode_t::blo
    │ │ │ +00056190: 636b 5f6c 6179 6572 290a 0909 7b0a 0909  ck_layer)...{...
    │ │ │ +000561a0: 092f 2f20 7369 6e63 6520 7765 2772 6520  .// since we're 
    │ │ │ +000561b0: 616c 7265 6164 7920 6f6e 2074 6865 2062  already on the b
    │ │ │ +000561c0: 6c6f 636b 206c 6179 6572 206d 6f64 652c  lock layer mode,
    │ │ │ +000561d0: 2077 6520 6861 7665 2074 6865 2077 686f   we have the who
    │ │ │ +000561e0: 6c65 0a09 0909 2f2f 2074 7265 652c 2061  le....// tree, a
    │ │ │ +000561f0: 6e64 2077 6527 7665 2061 6c72 6561 6479  nd we've already
    │ │ │ +00056200: 2072 6570 6f72 7465 6420 616e 7920 7069   reported any pi
    │ │ │ +00056210: 6563 6573 2061 7320 7061 7373 696e 6720  eces as passing 
    │ │ │ +00056220: 7468 6174 206d 6179 0a09 0909 2f2f 2068  that may....// h
    │ │ │ +00056230: 6176 6520 6578 6973 7465 6420 696e 2074  ave existed in t
    │ │ │ +00056240: 6865 2074 7265 6520 7768 656e 2077 6520  he tree when we 
    │ │ │ +00056250: 636f 6d70 6c65 7465 6420 6974 2e20 4174  completed it. At
    │ │ │ +00056260: 2074 6869 7320 706f 696e 7420 6e6f 0a09   this point no..
    │ │ │ +00056270: 0909 2f2f 206d 6f72 6520 7069 6563 6573  ..// more pieces
    │ │ │ +00056280: 2073 686f 756c 6420 6265 2072 6570 6f72   should be repor
    │ │ │ +00056290: 7465 6420 6173 2070 6173 7365 640a 0909  ted as passed...
    │ │ │ +000562a0: 0972 6574 7572 6e20 7265 743b 0a09 097d  .return ret;...}
    │ │ │ +000562b0: 0a0a 0909 616c 6c6f 6361 7465 5f66 756c  ....allocate_ful
    │ │ │ +000562c0: 6c28 293b 0a0a 3c64 6976 2073 7479 6c65  l();..
    ..int const │ │ │ +00056300: 6c65 6166 5f63 6f75 6e74 203d 206d 6572 leaf_count = mer │ │ │ +00056310: 6b6c 655f 6e75 6d5f 6c65 6166 7328 696e kle_num_leafs(in │ │ │ +00056320: 7428 6861 7368 6573 2e73 697a 6528 2929 t(hashes.size()) │ │ │ +00056330: 293b 0a3c 2f64 6976 3e09 0961 7578 3a3a );.
    ..aux:: │ │ │ +00056340: 7665 6374 6f72 266c 743b 7368 6132 3536 vector<sha256 │ │ │ +00056350: 5f68 6173 6826 6774 3b20 7472 6565 286d _hash> tree(m │ │ │ +00056360: 6572 6b6c 655f 6e75 6d5f 6e6f 6465 7328 erkle_num_nodes( │ │ │ +00056370: 6c65 6166 5f63 6f75 6e74 2929 3b0a 0909 leaf_count));... │ │ │ +00056380: 7374 643a 3a63 6f70 7928 6861 7368 6573 std::copy(hashes │ │ │ +00056390: 2e62 6567 696e 2829 2c20 6861 7368 6573 .begin(), hashes │ │ │ +000563a0: 2e65 6e64 2829 2c20 7472 6565 2e65 6e64 .end(), tree.end │ │ │ +000563b0: 2829 202d 206c 6561 665f 636f 756e 7429 () - leaf_count) │ │ │ +000563c0: 3b0a 0a09 092f 2f20 7468 6520 656e 6420 ;....// the end │ │ │ +000563d0: 6f66 2061 2066 696c 6520 6973 2061 2073 of a file is a s │ │ │ +000563e0: 7065 6369 616c 2063 6173 652c 2077 6520 pecial case, we │ │ │ +000563f0: 6d61 7920 6e65 6564 2074 6f20 7061 6420 may need to pad │ │ │ +00056400: 7468 6520 6c65 6166 206c 6179 6572 0a09 the leaf layer.. │ │ │ +00056410: 0969 6620 286c 6561 665f 636f 756e 7420 .if (leaf_count │ │ │ +00056420: 2667 743b 2068 6173 6865 732e 7369 7a65 > hashes.size │ │ │ +00056430: 2829 290a 0909 7b0a 0909 0969 6e74 2063 ())...{....int c │ │ │ +00056440: 6f6e 7374 206c 6561 665f 6c61 7965 725f onst leaf_layer_ │ │ │ +00056450: 7369 7a65 203d 206e 756d 5f6c 6561 6673 size = num_leafs │ │ │ +00056460: 2829 3b0a 0909 092f 2f20 6173 7375 6d69 ();....// assumi │ │ │ +00056470: 6e67 2075 6e63 6c65 5f68 6173 6865 7320 ng uncle_hashes │ │ │ +00056480: 6c65 6164 2061 6c6c 2074 6865 2077 6179 lead all the way │ │ │ +00056490: 2074 6f20 7468 6520 726f 6f74 2c20 7468 to the root, th │ │ │ +000564a0: 6579 2074 656c 6c20 7573 0a09 0909 2f2f ey tell us....// │ │ │ +000564b0: 2068 6f77 206d 616e 7920 6c61 7965 7273 how many layers │ │ │ +000564c0: 2064 6f77 6e20 7765 2061 7265 0a09 0909 down we are.... │ │ │ +000564d0: 696e 7420 636f 6e73 7420 696e 7365 7274 int const insert │ │ │ +000564e0: 5f6c 6179 6572 5f73 697a 6520 3d20 6c65 _layer_size = le │ │ │ +000564f0: 6166 5f63 6f75 6e74 2026 6c74 3b26 6c74 af_count << │ │ │ +00056500: 3b20 756e 636c 655f 6861 7368 6573 2e73 ; uncle_hashes.s │ │ │ +00056510: 697a 6528 293b 0a09 0909 6966 2028 6c65 ize();....if (le │ │ │ +00056520: 6166 5f6c 6179 6572 5f73 697a 6520 213d af_layer_size != │ │ │ +00056530: 2069 6e73 6572 745f 6c61 7965 725f 7369 insert_layer_si │ │ │ +00056540: 7a65 290a 0909 097b 0a09 0909 0973 6861 ze)....{.....sha │ │ │ +00056550: 3235 365f 6861 7368 2063 6f6e 7374 2070 256_hash const p │ │ │ +00056560: 6164 5f68 6173 6820 3d20 6d65 726b 6c65 ad_hash = merkle │ │ │ +00056570: 5f70 6164 286c 6561 665f 6c61 7965 725f _pad(leaf_layer_ │ │ │ +00056580: 7369 7a65 2c20 696e 7365 7274 5f6c 6179 size, insert_lay │ │ │ +00056590: 6572 5f73 697a 6529 3b0a 0909 0909 666f er_size);.....fo │ │ │ +000565a0: 7220 2869 6e74 2069 203d 2069 6e74 2868 r (int i = int(h │ │ │ +000565b0: 6173 6865 732e 7369 7a65 2829 293b 2069 ashes.size()); i │ │ │ +000565c0: 2026 6c74 3b20 6c65 6166 5f63 6f75 6e74 < leaf_count │ │ │ +000565d0: 3b20 2b2b 6929 0a09 0909 0909 7472 6565 ; ++i)......tree │ │ │ +000565e0: 5b74 7265 652e 656e 645f 696e 6465 7828 [tree.end_index( │ │ │ +000565f0: 2920 2d20 6c65 6166 5f63 6f75 6e74 202b ) - leaf_count + │ │ │ +00056600: 2069 5d20 3d20 7061 645f 6861 7368 3b0a i] = pad_hash;. │ │ │ +00056610: 0909 097d 0a09 097d 0a0a 0909 6d65 726b ...}...}....merk │ │ │ +00056620: 6c65 5f66 696c 6c5f 7472 6565 2874 7265 le_fill_tree(tre │ │ │ +00056630: 652c 206c 6561 665f 636f 756e 7429 3b0a e, leaf_count);. │ │ │ +00056640: 0a09 0969 6e74 2063 6f6e 7374 2062 6173 ...int const bas │ │ │ +00056650: 655f 6e75 6d5f 6c61 7965 7273 203d 206d e_num_layers = m │ │ │ +00056660: 6572 6b6c 655f 6e75 6d5f 6c61 7965 7273 erkle_num_layers │ │ │ +00056670: 286c 6561 665f 636f 756e 7429 3b0a 0a09 (leaf_count);... │ │ │ +00056680: 092f 2f20 7468 6973 2069 7320 7468 6520 .// this is the │ │ │ +00056690: 696e 6465 7820 6f66 2074 6865 206e 6f64 index of the nod │ │ │ +000566a0: 6520 7768 6572 6520 7765 276c 6c20 696e e where we'll in │ │ │ +000566b0: 7365 7274 2074 6865 2072 6f6f 7420 6f66 sert the root of │ │ │ +000566c0: 2074 6865 0a09 092f 2f20 7375 6274 7265 the...// subtre │ │ │ +000566d0: 6520 2874 7265 6529 2e20 4974 2773 2061 e (tree). It's a │ │ │ +000566e0: 6c73 6f20 7468 6520 6861 7368 2074 6865 lso the hash the │ │ │ +000566f0: 2075 6e63 6c65 5f68 6173 6865 7320 6172 uncle_hashes ar │ │ │ +00056700: 6520 6865 7265 2074 6f20 7072 6f76 650a e here to prove. │ │ │ +00056710: 0909 2f2f 2069 7320 7661 6c69 642e 0a09 ..// is valid... │ │ │ +00056720: 0969 6e74 2063 6f6e 7374 2069 6e73 6572 .int const inser │ │ │ +00056730: 745f 726f 6f74 5f69 6478 203d 2064 6573 t_root_idx = des │ │ │ +00056740: 745f 7374 6172 745f 6964 7820 2667 743b t_start_idx > │ │ │ +00056750: 2667 743b 2062 6173 655f 6e75 6d5f 6c61 > base_num_la │ │ │ +00056760: 7965 7273 3b0a 0a09 092f 2f20 7374 6172 yers;....// star │ │ │ +00056770: 7420 7769 7468 2076 616c 6964 6174 696e t with validatin │ │ │ +00056780: 6720 7468 6520 7072 6f6f 6673 2c20 616e g the proofs, an │ │ │ +00056790: 6420 696e 7365 7274 696e 6720 7468 656d d inserting them │ │ │ +000567a0: 2061 7320 7765 2067 6f2e 0a09 0969 6620 as we go....if │ │ │ +000567b0: 2821 6d65 726b 6c65 5f76 616c 6964 6174 (!merkle_validat │ │ │ +000567c0: 655f 616e 645f 696e 7365 7274 5f70 726f e_and_insert_pro │ │ │ +000567d0: 6f66 7328 6d5f 7472 6565 2c20 696e 7365 ofs(m_tree, inse │ │ │ +000567e0: 7274 5f72 6f6f 745f 6964 782c 2074 7265 rt_root_idx, tre │ │ │ +000567f0: 655b 305d 2c20 756e 636c 655f 6861 7368 e[0], uncle_hash │ │ │ +00056800: 6573 2929 0a09 0909 7265 7475 726e 207b es))....return { │ │ │ +00056810: 7d3b 0a3c 2f70 7265 3e3c 2f74 643e 3c2f };.
    │ │ │ +00056840: 3c74 643e 7265 6c65 7661 6e63 6526 6e62 relevance&nb │ │ │ +00056850: 7370 3b30 3c2f 7464 3e3c 7464 3e3c 6120 sp;0.. │ │ │ +00056880: 2f73 7263 2f6d 6572 6b6c 655f 7472 6565 /src/merkle_tree │ │ │ +00056890: 2e63 7070 3a33 3732 3c2f 613e 3c2f 7464 .cpp:372a piece out │ │ │ +000568b0: 7369 6465 206f 6620 7468 6973 2072 616e side of this ran │ │ │ +000568c0: 6765 206d 6179 2061 6c73 6f20 6661 696c ge may also fail │ │ │ +000568d0: 2c20 6966 206f 6e65 206f 6620 7468 6520 , if one of the │ │ │ +000568e0: 756e 636c 6520 6861 7368 6573 2069 7320 uncle hashes is │ │ │ +000568f0: 6174 2074 6865 206c 6179 6572 2072 6967 at the layer rig │ │ │ +00056900: 6874 2061 626f 7665 2074 6865 2062 6c6f ht above the blo │ │ │ +00056910: 636b 2068 6173 6865 733c 2f74 643e 3c2f ck hashes

    a piece o │ │ │ +00056970: 7574 7369 6465 206f 6620 7468 6973 2072 utside of this r │ │ │ +00056980: 616e 6765 206d 6179 2061 6c73 6f20 6661 ange may also fa │ │ │ +00056990: 696c 2c20 6966 206f 6e65 206f 6620 7468 il, if one of th │ │ │ +000569a0: 6520 756e 636c 650a 6861 7368 6573 2069 e uncle.hashes i │ │ │ +000569b0: 7320 6174 2074 6865 206c 6179 6572 2072 s at the layer r │ │ │ +000569c0: 6967 6874 2061 626f 7665 2074 6865 2062 ight above the b │ │ │ +000569d0: 6c6f 636b 2068 6173 6865 733c 2f68 323e lock hashes

    │ │ │ +000569e0: 3c68 343e 2e2e 2f73 7263 2f6d 6572 6b6c

    ../src/merkl │ │ │ +000569f0: 655f 7472 6565 2e63 7070 3a33 3732 3c2f e_tree.cpp:372
    ..i
    │ │ │ +00056a40: 6e74 2063 6f6e 7374 2069 6e73 6572 745f  nt const insert_
    │ │ │ +00056a50: 726f 6f74 5f69 6478 203d 2064 6573 745f  root_idx = dest_
    │ │ │ +00056a60: 7374 6172 745f 6964 7820 2667 743b 2667  start_idx >&g
    │ │ │ +00056a70: 743b 2062 6173 655f 6e75 6d5f 6c61 7965  t; base_num_laye
    │ │ │ +00056a80: 7273 3b0a 0a09 092f 2f20 7374 6172 7420  rs;....// start 
    │ │ │ +00056a90: 7769 7468 2076 616c 6964 6174 696e 6720  with validating 
    │ │ │ +00056aa0: 7468 6520 7072 6f6f 6673 2c20 616e 6420  the proofs, and 
    │ │ │ +00056ab0: 696e 7365 7274 696e 6720 7468 656d 2061  inserting them a
    │ │ │ +00056ac0: 7320 7765 2067 6f2e 0a09 0969 6620 2821  s we go....if (!
    │ │ │ +00056ad0: 6d65 726b 6c65 5f76 616c 6964 6174 655f  merkle_validate_
    │ │ │ +00056ae0: 616e 645f 696e 7365 7274 5f70 726f 6f66  and_insert_proof
    │ │ │ +00056af0: 7328 6d5f 7472 6565 2c20 696e 7365 7274  s(m_tree, insert
    │ │ │ +00056b00: 5f72 6f6f 745f 6964 782c 2074 7265 655b  _root_idx, tree[
    │ │ │ +00056b10: 305d 2c20 756e 636c 655f 6861 7368 6573  0], uncle_hashes
    │ │ │ +00056b20: 2929 0a09 0909 7265 7475 726e 207b 7d3b  ))....return {};
    │ │ │ +00056b30: 0a0a 0909 2f2f 2066 6972 7374 2066 696c  ....// first fil
    │ │ │ +00056b40: 6c20 696e 2074 6865 2073 7562 7472 6565  l in the subtree
    │ │ │ +00056b50: 206f 6620 6b6e 6f77 6e20 6861 7368 6573   of known hashes
    │ │ │ +00056b60: 2066 726f 6d20 7468 6520 6261 7365 206c   from the base l
    │ │ │ +00056b70: 6179 6572 0a09 0961 7574 6f20 636f 6e73  ayer...auto cons
    │ │ │ +00056b80: 7420 6e75 6d5f 6c65 6166 7320 3d20 6d65  t num_leafs = me
    │ │ │ +00056b90: 726b 6c65 5f6e 756d 5f6c 6561 6673 286d  rkle_num_leafs(m
    │ │ │ +00056ba0: 5f6e 756d 5f62 6c6f 636b 7329 3b0a 0909  _num_blocks);...
    │ │ │ +00056bb0: 6175 746f 2063 6f6e 7374 2066 6972 7374  auto const first
    │ │ │ +00056bc0: 5f6c 6561 6620 3d20 6d65 726b 6c65 5f66  _leaf = merkle_f
    │ │ │ +00056bd0: 6972 7374 5f6c 6561 6628 6e75 6d5f 6c65  irst_leaf(num_le
    │ │ │ +00056be0: 6166 7329 3b0a 0a09 092f 2f20 7468 6973  afs);....// this
    │ │ │ +00056bf0: 2069 7320 7468 6520 7374 6172 7420 6f66   is the start of
    │ │ │ +00056c00: 2074 6865 206c 6561 6620 6c61 7965 7220   the leaf layer 
    │ │ │ +00056c10: 6f66 2022 7472 6565 222e 2057 6527 6c6c  of "tree". We'll
    │ │ │ +00056c20: 2075 7365 2074 6869 730a 0909 2f2f 2076   use this...// v
    │ │ │ +00056c30: 6172 6961 626c 6520 746f 2073 7465 7020  ariable to step 
    │ │ │ +00056c40: 7570 7761 7264 7320 746f 7761 7264 7320  upwards towards 
    │ │ │ +00056c50: 7468 6520 726f 6f74 0a09 0969 6e74 2073  the root...int s
    │ │ │ +00056c60: 6f75 7263 655f 6375 7273 6f72 203d 2069  ource_cursor = i
    │ │ │ +00056c70: 6e74 2874 7265 652e 7369 7a65 2829 2920  nt(tree.size()) 
    │ │ │ +00056c80: 2d20 6c65 6166 5f63 6f75 6e74 3b0a 0909  - leaf_count;...
    │ │ │ +00056c90: 2f2f 2074 6865 2072 756e 6e69 6e67 2069  // the running i
    │ │ │ +00056ca0: 6e64 6578 2069 6e20 7468 6520 6c6f 6f70  ndex in the loop
    │ │ │ +00056cb0: 0a09 0969 6e74 2064 6573 745f 6375 7273  ...int dest_curs
    │ │ │ +00056cc0: 6f72 203d 2064 6573 745f 7374 6172 745f  or = dest_start_
    │ │ │ +00056cd0: 6964 783b 0a0a 0909 2f2f 2074 6865 206e  idx;....// the n
    │ │ │ +00056ce0: 756d 6265 7220 6f66 2074 7265 6520 6c65  umber of tree le
    │ │ │ +00056cf0: 7665 6c73 2069 6e20 6120 7069 6563 6520  vels in a piece 
    │ │ │ +00056d00: 6861 7368 2e20 3020 6d65 616e 7320 7468  hash. 0 means th
    │ │ │ +00056d10: 6520 626c 6f63 6b20 6c61 7965 7220 6973  e block layer is
    │ │ │ +00056d20: 0a09 092f 2f20 7468 6520 7361 6d65 2061  ...// the same a
    │ │ │ +00056d30: 7320 7468 6520 7069 6563 6520 6c61 7965  s the piece laye
    │ │ │ +00056d40: 720a 0909 696e 7420 636f 6e73 7420 6261  r...int const ba
    │ │ │ +00056d50: 7365 203d 2070 6965 6365 5f6c 6576 656c  se = piece_level
    │ │ │ +00056d60: 7328 293b 0a0a 3c64 6976 2073 7479 6c65  s();..
    ..for (int l │ │ │ +00056da0: 6179 6572 5f73 697a 6520 3d20 6c65 6166 ayer_size = leaf │ │ │ +00056db0: 5f63 6f75 6e74 3b20 6c61 7965 725f 7369 _count; layer_si │ │ │ +00056dc0: 7a65 2021 3d20 303b 206c 6179 6572 5f73 ze != 0; layer_s │ │ │ +00056dd0: 697a 6520 2f3d 2032 290a 3c2f 6469 763e ize /= 2).
    │ │ │ +00056de0: 0909 7b0a 0909 0966 6f72 2028 696e 7420 ..{....for (int │ │ │ +00056df0: 6920 3d20 303b 2069 2026 6c74 3b20 6c61 i = 0; i < la │ │ │ +00056e00: 7965 725f 7369 7a65 3b20 2b2b 6929 0a09 yer_size; ++i).. │ │ │ +00056e10: 0909 7b0a 0909 0909 696e 7420 636f 6e73 ..{.....int cons │ │ │ +00056e20: 7420 6473 745f 6964 7820 3d20 6465 7374 t dst_idx = dest │ │ │ +00056e30: 5f63 7572 736f 7220 2b20 693b 0a09 0909 _cursor + i;.... │ │ │ +00056e40: 0969 6e74 2063 6f6e 7374 2073 7263 5f69 .int const src_i │ │ │ +00056e50: 6478 203d 2073 6f75 7263 655f 6375 7273 dx = source_curs │ │ │ +00056e60: 6f72 202b 2069 3b0a 0909 0909 6966 2028 or + i;.....if ( │ │ │ +00056e70: 6861 735f 6e6f 6465 2864 7374 5f69 6478 has_node(dst_idx │ │ │ +00056e80: 2929 0a09 0909 097b 0a09 0909 0909 6966 )).....{......if │ │ │ +00056e90: 2028 6d5f 7472 6565 5b64 7374 5f69 6478 (m_tree[dst_idx │ │ │ +00056ea0: 5d20 213d 2074 7265 655b 7372 635f 6964 ] != tree[src_id │ │ │ +00056eb0: 785d 290a 0909 0909 097b 0a09 0909 0909 x])......{...... │ │ │ +00056ec0: 092f 2f20 7468 6973 206d 7573 7420 6265 .// this must be │ │ │ +00056ed0: 2061 2062 6c6f 636b 2068 6173 6820 6265 a block hash be │ │ │ +00056ee0: 6361 7573 6520 696e 6e65 7220 6e6f 6465 cause inner node │ │ │ +00056ef0: 7320 6172 6520 6e6f 7420 6669 6c6c 6564 s are not filled │ │ │ +00056f00: 2069 6e20 756e 7469 6c0a 0909 0909 0909 in until....... │ │ │ +00056f10: 2f2f 2074 6865 7920 6361 6e20 6265 2076 // they can be v │ │ │ +00056f20: 6572 6966 6965 642e 2054 6869 7320 6173 erified. This as │ │ │ +00056f30: 7365 7274 2065 6e73 7572 6573 2077 6527 sert ensures we' │ │ │ +00056f40: 7265 2061 7420 7468 650a 0909 0909 0909 re at the....... │ │ │ +00056f50: 2f2f 206c 6561 6620 6c61 7965 7220 6f66 // leaf layer of │ │ │ +00056f60: 2074 6865 2066 696c 6520 7472 6565 0a09 the file tree.. │ │ │ +00056f70: 0909 0909 0954 4f52 5245 4e54 5f41 5353 .....TORRENT_ASS │ │ │ +00056f80: 4552 5428 6473 745f 6964 7820 2667 743b ERT(dst_idx > │ │ │ +00056f90: 3d20 6669 7273 745f 6c65 6166 293b 0a0a = first_leaf);.. │ │ │ +00056fa0: 0909 0909 0909 696e 7420 636f 6e73 7420 ......int const │ │ │ +00056fb0: 706f 7320 3d20 6473 745f 6964 7820 2d20 pos = dst_idx - │ │ │ +00056fc0: 6669 7273 745f 6c65 6166 3b0a 0909 0909 first_leaf;..... │ │ │ +00056fd0: 0909 6175 746f 2063 6f6e 7374 2070 6965 ..auto const pie │ │ │ +00056fe0: 6365 203d 2070 6965 6365 5f69 6e64 6578 ce = piece_index │ │ │ +00056ff0: 5f74 7b70 6f73 2026 6774 3b26 6774 3b20 _t{pos >> │ │ │ +00057000: 6d5f 626c 6f63 6b73 5f70 6572 5f70 6965 m_blocks_per_pie │ │ │ +00057010: 6365 5f6c 6f67 7d20 2b20 6669 6c65 5f70 ce_log} + file_p │ │ │ +00057020: 6965 6365 5f6f 6666 7365 743b 0a09 0909 iece_offset;.... │ │ │ +00057030: 0909 0969 6e74 2063 6f6e 7374 2062 6c6f ...int const blo │ │ │ +00057040: 636b 203d 2070 6f73 2026 616d 703b 2028 ck = pos & ( │ │ │ +00057050: 2831 2026 6c74 3b26 6c74 3b20 6d5f 626c (1 << m_bl │ │ │ +00057060: 6f63 6b73 5f70 6572 5f70 6965 6365 5f6c ocks_per_piece_l │ │ │ +00057070: 6f67 2920 2d20 3129 3b0a 0a09 0909 0909 og) - 1);....... │ │ │ +00057080: 0954 4f52 5245 4e54 5f41 5353 4552 5428 .TORRENT_ASSERT( │ │ │ +00057090: 706f 7320 266c 743b 206d 5f6e 756d 5f62 pos < m_num_b │ │ │ +000570a0: 6c6f 636b 7329 3b0a 0909 0909 0909 6966 locks);.......if │ │ │ +000570b0: 2028 2172 6574 2e66 6169 6c65 642e 656d (!ret.failed.em │ │ │ +000570c0: 7074 7928 2920 2661 6d70 3b26 616d 703b pty() && │ │ │ +000570d0: 2072 6574 2e66 6169 6c65 642e 6261 636b ret.failed.back │ │ │ +000570e0: 2829 2e66 6972 7374 203d 3d20 7069 6563 ().first == piec │ │ │ +000570f0: 6529 0a09 0909 0909 0909 7265 742e 6661 e)........ret.fa │ │ │ +00057100: 696c 6564 2e62 6163 6b28 292e 7365 636f iled.back().seco │ │ │ +00057110: 6e64 2e70 7573 685f 6261 636b 2862 6c6f nd.push_back(blo │ │ │ +00057120: 636b 293b 0a09 0909 0909 0965 6c73 650a ck);.......else. │ │ │ +00057130: 0909 0909 0909 0972 6574 2e66 6169 6c65 .......ret.faile │ │ │ +00057140: 642e 656d 706c 6163 655f 6261 636b 2870 d.emplace_back(p │ │ │ +00057150: 6965 6365 2c20 7374 643a 3a76 6563 746f iece, std::vecto │ │ │ +00057160: 7226 6c74 3b69 6e74 2667 743b 7b62 6c6f r<int>{blo │ │ │ +00057170: 636b 7d29 3b0a 0a09 0909 0909 092f 2f20 ck});........// │ │ │ +00057180: 6e6f 7720 7468 6174 2074 6869 7320 6861 now that this ha │ │ │ +00057190: 7368 2068 6173 2062 6565 6e20 7265 706f sh has been repo │ │ │ +000571a0: 7274 6564 2061 7320 6661 696c 696e 672c rted as failing, │ │ │ +000571b0: 2077 650a 0909 0909 0909 2f2f 2063 616e we.......// can │ │ │ +000571c0: 2063 6c65 6172 2069 742e 2054 6869 7320 clear it. This │ │ │ +000571d0: 7769 6c6c 2070 7265 7665 6e74 2069 7420 will prevent it │ │ │ +000571e0: 6672 6f6d 2062 6569 6e67 0a09 0909 0909 from being...... │ │ │ +000571f0: 092f 2f20 7265 706f 7274 6564 2061 7320 .// reported as │ │ │ +00057200: 6661 696c 696e 6720 6167 6169 6e2e 0a09 failing again... │ │ │ +00057210: 0909 0909 096d 5f74 7265 655b 6473 745f .....m_tree[dst_ │ │ │ +00057220: 6964 785d 2e63 6c65 6172 2829 3b0a 0909 idx].clear();... │ │ │ +00057230: 0909 097d 0a09 0909 0909 656c 7365 2069 ...}......else i │ │ │ +00057240: 6620 2864 7374 5f69 6478 2026 6774 3b3d f (dst_idx >= │ │ │ +00057250: 2066 6972 7374 5f6c 6561 6629 0a3c 2f70 first_leaf).

    re │ │ │ +00057290: 6c65 7661 6e63 6526 6e62 7370 3b30 3c2f levance 0../src/m │ │ │ +000572d0: 6572 6b6c 655f 7472 6565 2e63 7070 3a34 erkle_tree.cpp:4 │ │ │ +000572e0: 3532 3c2f 613e 3c2f 7464 3e3c 7464 3e69 52i │ │ │ +000572f0: 6e73 7465 6164 206f 6620 6f76 6572 7772 nstead of overwr │ │ │ +00057300: 6974 696e 6720 7468 6520 726f 6f74 2061 iting the root a │ │ │ +00057310: 6e64 2063 6f6d 7061 7269 6e67 2069 7420 nd comparing it │ │ │ +00057320: 6167 6169 6e73 7420 6861 7368 6573 5b5d against hashes[] │ │ │ +00057330: 2c20 7772 6974 6520 6120 6675 6e63 7469 , write a functi │ │ │ +00057340: 6f6e 7320 7468 6174 202a 7661 6c69 6461 ons that *valida │ │ │ +00057350: 7465 732a 2061 2074 7265 6520 6279 206a tes* a tree by j │ │ │ +00057360: 7573 7420 6669 6c6c 696e 6720 6974 2075 ust filling it u │ │ │ +00057370: 7020 746f 2074 6865 206c 6576 656c 2062 p to the level b │ │ │ +00057380: 656c 6f77 2074 6865 2072 6f6f 7420 616e elow the root an │ │ │ +00057390: 6420 7468 656e 2076 616c 6964 6174 6573 d then validates │ │ │ +000573a0: 2069 742e 3c2f 7464 3e3c 2f74 723e 3c74 it.instead of ove │ │ │ +00057400: 7277 7269 7469 6e67 2074 6865 2072 6f6f rwriting the roo │ │ │ +00057410: 7420 616e 6420 636f 6d70 6172 696e 6720 t and comparing │ │ │ +00057420: 6974 0a61 6761 696e 7374 2068 6173 6865 it.against hashe │ │ │ +00057430: 735b 5d2c 2077 7269 7465 2061 2066 756e s[], write a fun │ │ │ +00057440: 6374 696f 6e73 2074 6861 7420 2a76 616c ctions that *val │ │ │ +00057450: 6964 6174 6573 2a20 6120 7472 6565 0a62 idates* a tree.b │ │ │ +00057460: 7920 6a75 7374 2066 696c 6c69 6e67 2069 y just filling i │ │ │ +00057470: 7420 7570 2074 6f20 7468 6520 6c65 7665 t up to the leve │ │ │ +00057480: 6c20 6265 6c6f 7720 7468 6520 726f 6f74 l below the root │ │ │ +00057490: 2061 6e64 2074 6865 6e0a 7661 6c69 6461 and then.valida │ │ │ +000574a0: 7465 7320 6974 2e3c 2f68 323e 3c68 343e tes it.

    │ │ │ +000574b0: 2e2e 2f73 7263 2f6d 6572 6b6c 655f 7472 ../src/merkle_tr │ │ │ +000574c0: 6565 2e63 7070 3a34 3532 3c2f 6834 3e3c ee.cpp:452

    < │ │ │ +000574d0: 7072 6520 7374 796c 653d 2262 6163 6b67 pre style="backg │ │ │ +000574e0: 726f 756e 643a 2023 6636 6636 6636 3b20 round: #f6f6f6; │ │ │ +000574f0: 626f 7264 6572 3a20 736f 6c69 6420 3170 border: solid 1p │ │ │ +00057500: 7820 2364 6464 3b22 3e09 0909 2661 6d70 x #ddd;">...& │ │ │ +00057510: 3b26 616d 703b 2064 6573 745f 7374 6172 ;& dest_star │ │ │ +00057520: 745f 6964 7820 266c 743b 2066 6972 7374 t_idx < first │ │ │ +00057530: 5f70 6965 6365 5f69 6478 202b 206e 756d _piece_idx + num │ │ │ +00057540: 5f70 6965 6365 7328 2929 0a09 097b 0a09 _pieces())...{.. │ │ │ +00057550: 0909 696e 7420 636f 6e73 7420 626c 6f63 ..int const bloc │ │ │ +00057560: 6b73 5f69 6e5f 7069 6563 6520 3d20 3120 ks_in_piece = 1 │ │ │ +00057570: 266c 743b 266c 743b 2062 6173 653b 0a0a << base;.. │ │ │ +00057580: 0909 092f 2f20 6974 206d 6179 206e 6f77 ...// it may now │ │ │ +00057590: 2062 6520 706f 7373 6962 6c65 2074 6f20 be possible to │ │ │ +000575a0: 7665 7269 6679 2074 6865 2068 6173 6865 verify the hashe │ │ │ +000575b0: 7320 6f66 2070 7265 7669 6f75 736c 7920 s of previously │ │ │ +000575c0: 7265 6365 6976 6564 2062 6c6f 636b 730a received blocks. │ │ │ +000575d0: 0909 092f 2f20 7472 7920 746f 2076 6572 ...// try to ver │ │ │ +000575e0: 6966 7920 6173 206d 616e 7920 6368 696c ify as many chil │ │ │ +000575f0: 6420 6e6f 6465 7320 6f66 2074 6865 2072 d nodes of the r │ │ │ +00057600: 6563 6569 7665 6420 6861 7368 6573 2061 eceived hashes a │ │ │ +00057610: 7320 706f 7373 6962 6c65 0a09 0909 666f s possible....fo │ │ │ +00057620: 7220 2869 6e74 2069 203d 2030 3b20 6920 r (int i = 0; i │ │ │ +00057630: 266c 743b 2069 6e74 2868 6173 6865 732e < int(hashes. │ │ │ +00057640: 7369 7a65 2829 293b 202b 2b69 290a 0909 size()); ++i)... │ │ │ +00057650: 097b 0a09 0909 0969 6e74 2063 6f6e 7374 .{.....int const │ │ │ +00057660: 2070 6965 6365 203d 2064 6573 745f 7374 piece = dest_st │ │ │ +00057670: 6172 745f 6964 7820 2b20 693b 0a09 0909 art_idx + i;.... │ │ │ +00057680: 0969 6620 2870 6965 6365 202d 2066 6972 .if (piece - fir │ │ │ +00057690: 7374 5f70 6965 6365 5f69 6478 2026 6774 st_piece_idx > │ │ │ +000576a0: 3b3d 206e 756d 5f70 6965 6365 7328 2929 ;= num_pieces()) │ │ │ +000576b0: 0a09 0909 0909 6272 6561 6b3b 0a09 0909 ......break;.... │ │ │ +000576c0: 092f 2f20 7468 6520 6669 7273 7420 626c .// the first bl │ │ │ +000576d0: 6f63 6b20 696e 2074 6869 7320 7069 6563 ock in this piec │ │ │ +000576e0: 650a 0909 0909 696e 7420 636f 6e73 7420 e.....int const │ │ │ +000576f0: 626c 6f63 6b5f 6964 7820 3d20 6d65 726b block_idx = merk │ │ │ +00057700: 6c65 5f67 6574 5f66 6972 7374 5f63 6869 le_get_first_chi │ │ │ +00057710: 6c64 2870 6965 6365 2c20 6261 7365 293b ld(piece, base); │ │ │ +00057720: 0a0a 0909 0909 696e 7420 636f 6e73 7420 ......int const │ │ │ +00057730: 626c 6f63 6b5f 656e 645f 6964 7820 3d20 block_end_idx = │ │ │ +00057740: 7374 643a 3a6d 696e 2862 6c6f 636b 5f69 std::min(block_i │ │ │ +00057750: 6478 202b 2062 6c6f 636b 735f 696e 5f70 dx + blocks_in_p │ │ │ +00057760: 6965 6365 2c20 6669 7273 745f 6c65 6166 iece, first_leaf │ │ │ +00057770: 202b 206d 5f6e 756d 5f62 6c6f 636b 7329 + m_num_blocks) │ │ │ +00057780: 3b0a 0909 0909 6966 2028 7374 643a 3a61 ;.....if (std::a │ │ │ +00057790: 6e79 5f6f 6628 6d5f 7472 6565 2e62 6567 ny_of(m_tree.beg │ │ │ +000577a0: 696e 2829 202b 2062 6c6f 636b 5f69 6478 in() + block_idx │ │ │ +000577b0: 0a09 0909 0909 2c20 6d5f 7472 6565 2e62 ......, m_tree.b │ │ │ +000577c0: 6567 696e 2829 202b 2062 6c6f 636b 5f65 egin() + block_e │ │ │ +000577d0: 6e64 5f69 6478 0a09 0909 0909 2c20 5b5d nd_idx......, [] │ │ │ +000577e0: 2873 6861 3235 365f 6861 7368 2063 6f6e (sha256_hash con │ │ │ +000577f0: 7374 2661 6d70 3b20 6829 207b 2072 6574 st& h) { ret │ │ │ +00057800: 7572 6e20 682e 6973 5f61 6c6c 5f7a 6572 urn h.is_all_zer │ │ │ +00057810: 6f73 2829 3b20 7d29 290a 0909 0909 0963 os(); }))......c │ │ │ +00057820: 6f6e 7469 6e75 653b 0a0a 3c64 6976 2073 ontinue;..
    ....merk │ │ │ +00057860: 6c65 5f66 696c 6c5f 7472 6565 286d 5f74 le_fill_tree(m_t │ │ │ +00057870: 7265 652c 2062 6c6f 636b 735f 696e 5f70 ree, blocks_in_p │ │ │ +00057880: 6965 6365 2c20 626c 6f63 6b5f 6964 7829 iece, block_idx) │ │ │ +00057890: 3b0a 3c2f 6469 763e 0909 0909 6966 2028 ;.
    ....if ( │ │ │ +000578a0: 6d5f 7472 6565 5b70 6965 6365 5d20 213d m_tree[piece] != │ │ │ +000578b0: 2068 6173 6865 735b 695d 290a 0909 0909 hashes[i])..... │ │ │ +000578c0: 7b0a 0909 0909 096d 6572 6b6c 655f 636c {......merkle_cl │ │ │ +000578d0: 6561 725f 7472 6565 286d 5f74 7265 652c ear_tree(m_tree, │ │ │ +000578e0: 2062 6c6f 636b 735f 696e 5f70 6965 6365 blocks_in_piece │ │ │ +000578f0: 2c20 626c 6f63 6b5f 6964 7829 3b0a 0909 , block_idx);... │ │ │ +00057900: 0909 092f 2f20 7772 6974 6520 6261 636b ...// write back │ │ │ +00057910: 2074 6865 2063 6f72 7265 6374 2068 6173 the correct has │ │ │ +00057920: 680a 0909 0909 096d 5f74 7265 655b 7069 h......m_tree[pi │ │ │ +00057930: 6563 655d 203d 2068 6173 6865 735b 695d ece] = hashes[i] │ │ │ +00057940: 3b0a 0909 0909 0954 4f52 5245 4e54 5f41 ;......TORRENT_A │ │ │ +00057950: 5353 4552 5428 626c 6f63 6b73 5f69 6e5f SSERT(blocks_in_ │ │ │ +00057960: 7069 6563 6520 3d3d 2062 6c6f 636b 735f piece == blocks_ │ │ │ +00057970: 7065 725f 7069 6563 6528 2929 3b0a 0a09 per_piece());... │ │ │ +00057980: 0909 0909 2f2f 2061 6e20 656d 7074 7920 ....// an empty │ │ │ +00057990: 626c 6f63 6b73 2076 6563 746f 7220 696e blocks vector in │ │ │ +000579a0: 6469 6361 7465 7320 7468 6174 2077 6520 dicates that we │ │ │ +000579b0: 646f 6e27 7420 6861 7665 2074 6865 0a09 don't have the.. │ │ │ +000579c0: 0909 0909 2f2f 2062 6c6f 636b 2068 6173 ....// block has │ │ │ +000579d0: 6865 732c 2061 6e64 2077 6520 6361 6e27 hes, and we can' │ │ │ +000579e0: 7420 6b6e 6f77 2077 6869 6368 2062 6c6f t know which blo │ │ │ +000579f0: 636b 2066 6169 6c65 640a 0909 0909 092f ck failed....../ │ │ │ +00057a00: 2f20 7468 6973 2077 696c 6c20 6361 7573 / this will caus │ │ │ +00057a10: 6520 7468 6520 626c 6f63 6b20 6861 7368 e the block hash │ │ │ +00057a20: 6573 2074 6f20 6265 2072 6571 7565 7374 es to be request │ │ │ +00057a30: 6564 0a09 0909 0909 7265 742e 6661 696c ed......ret.fail │ │ │ +00057a40: 6564 2e65 6d70 6c61 6365 5f62 6163 6b28 ed.emplace_back( │ │ │ +00057a50: 7069 6563 655f 696e 6465 785f 747b 7069 piece_index_t{pi │ │ │ +00057a60: 6563 6520 2d20 6669 7273 745f 7069 6563 ece - first_piec │ │ │ +00057a70: 655f 6964 787d 202b 2066 696c 655f 7069 e_idx} + file_pi │ │ │ +00057a80: 6563 655f 6f66 6673 6574 0a09 0909 0909 ece_offset...... │ │ │ +00057a90: 092c 2073 7464 3a3a 7665 6374 6f72 266c ., std::vector&l │ │ │ +00057aa0: 743b 696e 7426 6774 3b28 2929 3b0a 0909 t;int>());... │ │ │ +00057ab0: 0909 7d0a 0909 0909 656c 7365 0a09 0909 ..}.....else.... │ │ │ +00057ac0: 097b 0a09 0909 0909 7265 742e 7061 7373 .{......ret.pass │ │ │ +00057ad0: 6564 2e70 7573 685f 6261 636b 2870 6965 ed.push_back(pie │ │ │ +00057ae0: 6365 5f69 6e64 6578 5f74 7b70 6965 6365 ce_index_t{piece │ │ │ +00057af0: 202d 2066 6972 7374 5f70 6965 6365 5f69 - first_piece_i │ │ │ +00057b00: 6478 7d20 2b20 6669 6c65 5f70 6965 6365 dx} + file_piece │ │ │ +00057b10: 5f6f 6666 7365 7429 3b0a 0909 0909 092f _offset);....../ │ │ │ +00057b20: 2f20 7265 636f 7264 2074 6861 7420 7468 / record that th │ │ │ +00057b30: 6573 6520 626c 6f63 6b20 6861 7368 6573 ese block hashes │ │ │ +00057b40: 2061 7265 2063 6f72 7265 6374 210a 0909 are correct!... │ │ │ +00057b50: 0909 0969 6e74 2063 6f6e 7374 206c 6561 ...int const lea │ │ │ +00057b60: 6673 5f73 7461 7274 203d 2062 6c6f 636b fs_start = block │ │ │ +00057b70: 5f69 6478 202d 2062 6c6f 636b 5f6c 6179 _idx - block_lay │ │ │ +00057b80: 6572 5f73 7461 7274 2829 3b0a 0909 0909 er_start();..... │ │ │ +00057b90: 0969 6e74 2063 6f6e 7374 206c 6561 6673 .int const leafs │ │ │ +00057ba0: 5f65 6e64 203d 2073 7464 3a3a 6d69 6e28 _end = std::min( │ │ │ +00057bb0: 6d5f 6e75 6d5f 626c 6f63 6b73 2c20 6c65 m_num_blocks, le │ │ │ +00057bc0: 6166 735f 7374 6172 7420 2b20 626c 6f63 afs_start + bloc │ │ │ +00057bd0: 6b73 5f69 6e5f 7069 6563 6529 3b0a 3c2f ks_in_piece);.r │ │ │ +00057c10: 656c 6576 616e 6365 266e 6273 703b 303c elevance 0< │ │ │ +00057c20: 2f74 643e 3c74 643e 3c61 2068 7265 663d /td>../src/ │ │ │ +00057c50: 6d65 726b 6c65 5f74 7265 652e 6370 703a merkle_tree.cpp: │ │ │ +00057c60: 3437 363c 2f61 3e3c 2f74 643e 3c74 643e 476 │ │ │ +00057c70: 7468 6973 2063 6f75 6c64 2062 6520 646f this could be do │ │ │ +00057c80: 6e65 206d 6f72 6520 6566 6669 6369 656e ne more efficien │ │ │ +00057c90: 746c 7920 6966 2062 6974 6669 656c 6420 tly if bitfield │ │ │ +00057ca0: 6861 6420 6120 6675 6e63 7469 6f6e 2074 had a function t │ │ │ +00057cb0: 6f20 7365 7420 6120 7261 6e67 6520 6f66 o set a range of │ │ │ +00057cc0: 2062 6974 733c 2f74 643e 3c2f 7472 3e3c bits< │ │ │ +00057cd0: 7472 2069 643d 2232 3035 2220 7374 796c tr id="205" styl │ │ │ +00057ce0: 653d 2264 6973 706c 6179 3a20 6e6f 6e65 e="display: none │ │ │ +00057cf0: 3b22 2063 6f6c 7370 616e 3d22 3322 3e3c ;" colspan="3">< │ │ │ +00057d00: 7464 2063 6f6c 7370 616e 3d22 3322 3e3c td colspan="3">< │ │ │ +00057d10: 6832 3e74 6869 7320 636f 756c 6420 6265 h2>this could be │ │ │ +00057d20: 2064 6f6e 6520 6d6f 7265 2065 6666 6963 done more effic │ │ │ +00057d30: 6965 6e74 6c79 2069 6620 6269 7466 6965 iently if bitfie │ │ │ +00057d40: 6c64 2068 6164 2061 2066 756e 6374 696f ld had a functio │ │ │ +00057d50: 6e0a 746f 2073 6574 2061 2072 616e 6765 n.to set a range │ │ │ +00057d60: 206f 6620 6269 7473 3c2f 6832 3e3c 6834 of bits

    ../src/merkle_t │ │ │ +00057d80: 7265 652e 6370 703a 3437 363c 2f68 343e ree.cpp:476

    │ │ │ +00057d90: 3c70 7265 2073 7479 6c65 3d22 6261 636b
    ....me
    │ │ │ +00057dd0: 726b 6c65 5f66 696c 6c5f 7472 6565 286d  rkle_fill_tree(m
    │ │ │ +00057de0: 5f74 7265 652c 2062 6c6f 636b 735f 696e  _tree, blocks_in
    │ │ │ +00057df0: 5f70 6965 6365 2c20 626c 6f63 6b5f 6964  _piece, block_id
    │ │ │ +00057e00: 7829 3b0a 0909 0909 6966 2028 6d5f 7472  x);.....if (m_tr
    │ │ │ +00057e10: 6565 5b70 6965 6365 5d20 213d 2068 6173  ee[piece] != has
    │ │ │ +00057e20: 6865 735b 695d 290a 0909 0909 7b0a 0909  hes[i]).....{...
    │ │ │ +00057e30: 0909 096d 6572 6b6c 655f 636c 6561 725f  ...merkle_clear_
    │ │ │ +00057e40: 7472 6565 286d 5f74 7265 652c 2062 6c6f  tree(m_tree, blo
    │ │ │ +00057e50: 636b 735f 696e 5f70 6965 6365 2c20 626c  cks_in_piece, bl
    │ │ │ +00057e60: 6f63 6b5f 6964 7829 3b0a 0909 0909 092f  ock_idx);....../
    │ │ │ +00057e70: 2f20 7772 6974 6520 6261 636b 2074 6865  / write back the
    │ │ │ +00057e80: 2063 6f72 7265 6374 2068 6173 680a 0909   correct hash...
    │ │ │ +00057e90: 0909 096d 5f74 7265 655b 7069 6563 655d  ...m_tree[piece]
    │ │ │ +00057ea0: 203d 2068 6173 6865 735b 695d 3b0a 0909   = hashes[i];...
    │ │ │ +00057eb0: 0909 0954 4f52 5245 4e54 5f41 5353 4552  ...TORRENT_ASSER
    │ │ │ +00057ec0: 5428 626c 6f63 6b73 5f69 6e5f 7069 6563  T(blocks_in_piec
    │ │ │ +00057ed0: 6520 3d3d 2062 6c6f 636b 735f 7065 725f  e == blocks_per_
    │ │ │ +00057ee0: 7069 6563 6528 2929 3b0a 0a09 0909 0909  piece());.......
    │ │ │ +00057ef0: 2f2f 2061 6e20 656d 7074 7920 626c 6f63  // an empty bloc
    │ │ │ +00057f00: 6b73 2076 6563 746f 7220 696e 6469 6361  ks vector indica
    │ │ │ +00057f10: 7465 7320 7468 6174 2077 6520 646f 6e27  tes that we don'
    │ │ │ +00057f20: 7420 6861 7665 2074 6865 0a09 0909 0909  t have the......
    │ │ │ +00057f30: 2f2f 2062 6c6f 636b 2068 6173 6865 732c  // block hashes,
    │ │ │ +00057f40: 2061 6e64 2077 6520 6361 6e27 7420 6b6e   and we can't kn
    │ │ │ +00057f50: 6f77 2077 6869 6368 2062 6c6f 636b 2066  ow which block f
    │ │ │ +00057f60: 6169 6c65 640a 0909 0909 092f 2f20 7468  ailed......// th
    │ │ │ +00057f70: 6973 2077 696c 6c20 6361 7573 6520 7468  is will cause th
    │ │ │ +00057f80: 6520 626c 6f63 6b20 6861 7368 6573 2074  e block hashes t
    │ │ │ +00057f90: 6f20 6265 2072 6571 7565 7374 6564 0a09  o be requested..
    │ │ │ +00057fa0: 0909 0909 7265 742e 6661 696c 6564 2e65  ....ret.failed.e
    │ │ │ +00057fb0: 6d70 6c61 6365 5f62 6163 6b28 7069 6563  mplace_back(piec
    │ │ │ +00057fc0: 655f 696e 6465 785f 747b 7069 6563 6520  e_index_t{piece 
    │ │ │ +00057fd0: 2d20 6669 7273 745f 7069 6563 655f 6964  - first_piece_id
    │ │ │ +00057fe0: 787d 202b 2066 696c 655f 7069 6563 655f  x} + file_piece_
    │ │ │ +00057ff0: 6f66 6673 6574 0a09 0909 0909 092c 2073  offset......., s
    │ │ │ +00058000: 7464 3a3a 7665 6374 6f72 266c 743b 696e  td::vector<in
    │ │ │ +00058010: 7426 6774 3b28 2929 3b0a 0909 0909 7d0a  t>());.....}.
    │ │ │ +00058020: 0909 0909 656c 7365 0a09 0909 097b 0a09  ....else.....{..
    │ │ │ +00058030: 0909 0909 7265 742e 7061 7373 6564 2e70  ....ret.passed.p
    │ │ │ +00058040: 7573 685f 6261 636b 2870 6965 6365 5f69  ush_back(piece_i
    │ │ │ +00058050: 6e64 6578 5f74 7b70 6965 6365 202d 2066  ndex_t{piece - f
    │ │ │ +00058060: 6972 7374 5f70 6965 6365 5f69 6478 7d20  irst_piece_idx} 
    │ │ │ +00058070: 2b20 6669 6c65 5f70 6965 6365 5f6f 6666  + file_piece_off
    │ │ │ +00058080: 7365 7429 3b0a 0909 0909 092f 2f20 7265  set);......// re
    │ │ │ +00058090: 636f 7264 2074 6861 7420 7468 6573 6520  cord that these 
    │ │ │ +000580a0: 626c 6f63 6b20 6861 7368 6573 2061 7265  block hashes are
    │ │ │ +000580b0: 2063 6f72 7265 6374 210a 0909 0909 0969   correct!......i
    │ │ │ +000580c0: 6e74 2063 6f6e 7374 206c 6561 6673 5f73  nt const leafs_s
    │ │ │ +000580d0: 7461 7274 203d 2062 6c6f 636b 5f69 6478  tart = block_idx
    │ │ │ +000580e0: 202d 2062 6c6f 636b 5f6c 6179 6572 5f73   - block_layer_s
    │ │ │ +000580f0: 7461 7274 2829 3b0a 0909 0909 0969 6e74  tart();......int
    │ │ │ +00058100: 2063 6f6e 7374 206c 6561 6673 5f65 6e64   const leafs_end
    │ │ │ +00058110: 203d 2073 7464 3a3a 6d69 6e28 6d5f 6e75   = std::min(m_nu
    │ │ │ +00058120: 6d5f 626c 6f63 6b73 2c20 6c65 6166 735f  m_blocks, leafs_
    │ │ │ +00058130: 7374 6172 7420 2b20 626c 6f63 6b73 5f69  start + blocks_i
    │ │ │ +00058140: 6e5f 7069 6563 6529 3b0a 3c64 6976 2073  n_piece);.
    .....for │ │ │ +00058180: 2028 696e 7420 6b20 3d20 6c65 6166 735f (int k = leafs_ │ │ │ +00058190: 7374 6172 743b 206b 2026 6c74 3b20 6c65 start; k < le │ │ │ +000581a0: 6166 735f 656e 643b 202b 2b6b 290a 3c2f afs_end; ++k).......m_bloc │ │ │ +000581c0: 6b5f 7665 7269 6669 6564 2e73 6574 5f62 k_verified.set_b │ │ │ +000581d0: 6974 286b 293b 0a09 0909 097d 0a09 0909 it(k);.....}.... │ │ │ +000581e0: 0954 4f52 5245 4e54 5f41 5353 4552 5428 .TORRENT_ASSERT( │ │ │ +000581f0: 2870 6965 6365 202d 2066 6972 7374 5f70 (piece - first_p │ │ │ +00058200: 6965 6365 5f69 6478 2920 2667 743b 3d20 iece_idx) >= │ │ │ +00058210: 3029 3b0a 0909 097d 0a09 097d 0a0a 0909 0);....}...}.... │ │ │ +00058220: 6f70 7469 6d69 7a65 5f73 746f 7261 6765 optimize_storage │ │ │ +00058230: 2829 3b0a 0a09 0972 6574 7572 6e20 7265 ();....return re │ │ │ +00058240: 743b 0a09 7d0a 0a09 7374 643a 3a74 7570 t;..}...std::tup │ │ │ +00058250: 6c65 266c 743b 6d65 726b 6c65 5f74 7265 le<merkle_tre │ │ │ +00058260: 653a 3a73 6574 5f62 6c6f 636b 5f72 6573 e::set_block_res │ │ │ +00058270: 756c 742c 2069 6e74 2c20 696e 7426 6774 ult, int, int> │ │ │ +00058280: 3b20 6d65 726b 6c65 5f74 7265 653a 3a73 ; merkle_tree::s │ │ │ +00058290: 6574 5f62 6c6f 636b 2869 6e74 2063 6f6e et_block(int con │ │ │ +000582a0: 7374 2062 6c6f 636b 5f69 6e64 6578 0a09 st block_index.. │ │ │ +000582b0: 092c 2073 6861 3235 365f 6861 7368 2063 ., sha256_hash c │ │ │ +000582c0: 6f6e 7374 2661 6d70 3b20 6829 0a09 7b0a onst& h)..{. │ │ │ +000582d0: 2369 6664 6566 2054 4f52 5245 4e54 5f45 #ifdef TORRENT_E │ │ │ +000582e0: 5850 454e 5349 5645 5f49 4e56 4152 4941 XPENSIVE_INVARIA │ │ │ +000582f0: 4e54 5f43 4845 434b 530a 0909 494e 5641 NT_CHECKS...INVA │ │ │ +00058300: 5249 414e 545f 4348 4543 4b3b 0a23 656e RIANT_CHECK;.#en │ │ │ +00058310: 6469 660a 0909 544f 5252 454e 545f 4153 dif...TORRENT_AS │ │ │ +00058320: 5345 5254 2862 6c6f 636b 5f69 6e64 6578 SERT(block_index │ │ │ +00058330: 2026 6c74 3b20 6d5f 6e75 6d5f 626c 6f63 < m_num_bloc │ │ │ +00058340: 6b73 293b 0a0a 0909 6175 746f 2063 6f6e ks);....auto con │ │ │ +00058350: 7374 206e 756d 5f6c 6561 6673 203d 206d st num_leafs = m │ │ │ +00058360: 6572 6b6c 655f 6e75 6d5f 6c65 6166 7328 erkle_num_leafs( │ │ │ +00058370: 6d5f 6e75 6d5f 626c 6f63 6b73 293b 0a09 m_num_blocks);.. │ │ │ +00058380: 0961 7574 6f20 636f 6e73 7420 6669 7273 .auto const firs │ │ │ +00058390: 745f 6c65 6166 203d 206d 6572 6b6c 655f t_leaf = merkle_ │ │ │ +000583a0: 6669 7273 745f 6c65 6166 286e 756d 5f6c first_leaf(num_l │ │ │ +000583b0: 6561 6673 293b 0a09 0961 7574 6f20 636f eafs);...auto co │ │ │ +000583c0: 6e73 7420 626c 6f63 6b5f 7472 6565 5f69 nst block_tree_i │ │ │ +000583d0: 6e64 6578 203d 2066 6972 7374 5f6c 6561 ndex = first_lea │ │ │ +000583e0: 6620 2b20 626c 6f63 6b5f 696e 6465 783b f + block_index; │ │ │ +000583f0: 0a0a 0909 6966 2028 626c 6f63 6b73 5f76 ....if (blocks_v │ │ │ +00058400: 6572 6966 6965 6428 626c 6f63 6b5f 696e erified(block_in │ │ │ +00058410: 6465 782c 2031 2929 0a09 097b 0a09 0909 dex, 1))...{.... │ │ │ +00058420: 2f2f 2069 6620 7468 6973 2062 6c6f 636b // if this block │ │ │ +00058430: 7327 7320 6861 7368 2069 7320 616c 7265 s's hash is alre │ │ │ +00058440: 6164 7920 6b6e 6f77 6e2c 2063 6865 636b ady known, check │ │ │ +00058450: 2074 6865 2070 6173 7365 642d 696e 2068 the passed-in h │ │ │ +00058460: 6173 6820 6167 6169 6e73 7420 6974 0a09 ash against it.. │ │ │ +00058470: 0909 6966 2028 636f 6d70 6172 655f 6e6f ..if (compare_no │ │ │ +00058480: 6465 2862 6c6f 636b 5f74 7265 655f 696e de(block_tree_in │ │ │ +00058490: 6465 782c 2068 2929 0a09 0909 0972 6574 dex, h)).....ret │ │ │ +000584a0: 7572 6e20 7374 643a 3a6d 616b 655f 7475 urn std::make_tu │ │ │ +000584b0: 706c 6528 7365 745f 626c 6f63 6b5f 7265 ple(set_block_re │ │ │ +000584c0: 7375 6c74 3a3a 6f6b 2c20 626c 6f63 6b5f sult::ok, block_ │ │ │ +000584d0: 696e 6465 782c 2031 293b 0a09 0909 656c index, 1);....el │ │ │ +000584e0: 7365 0a09 0909 0972 6574 7572 6e20 7374 se.....return st │ │ │ +000584f0: 643a 3a6d 616b 655f 7475 706c 6528 7365 d::make_tuple(se │ │ │ +00058500: 745f 626c 6f63 6b5f 7265 7375 6c74 3a3a t_block_result:: │ │ │ +00058510: 626c 6f63 6b5f 6861 7368 5f66 6169 6c65 block_hash_faile │ │ │ +00058520: 642c 2062 6c6f 636b 5f69 6e64 6578 2c20 d, block_index, │ │ │ +00058530: 3129 3b0a 3c2f 7072 653e 3c2f 7464 3e3c 1);.
    < │ │ │ +00058540: 2f74 723e 3c74 7220 7374 796c 653d 2262 /tr>relevance&n │ │ │ +00058570: 6273 703b 303c 2f74 643e 3c74 643e 3c61 bsp;0. │ │ │ +000585a0: 2e2f 7372 632f 6d65 726b 6c65 5f74 7265 ./src/merkle_tre │ │ │ +000585b0: 652e 6370 703a 3531 393c 2f61 3e3c 2f74 e.cpp:519
    use struct │ │ │ +000585d0: 7572 6564 2062 696e 6469 6e67 2069 6e20 ured binding in │ │ │ +000585e0: 432b 2b31 373c 2f74 643e 3c2f 7472 3e3c C++17< │ │ │ +000585f0: 7472 2069 643d 2232 3036 2220 7374 796c tr id="206" styl │ │ │ +00058600: 653d 2264 6973 706c 6179 3a20 6e6f 6e65 e="display: none │ │ │ +00058610: 3b22 2063 6f6c 7370 616e 3d22 3322 3e3c ;" colspan="3">< │ │ │ +00058620: 7464 2063 6f6c 7370 616e 3d22 3322 3e3c td colspan="3">< │ │ │ +00058630: 6832 3e75 7365 2073 7472 7563 7475 7265 h2>use structure │ │ │ +00058640: 6420 6269 6e64 696e 6720 696e 2043 2b2b d binding in C++ │ │ │ +00058650: 3137 3c2f 6832 3e3c 6834 3e2e 2e2f 7372 17

    ../sr │ │ │ +00058660: 632f 6d65 726b 6c65 5f74 7265 652e 6370 c/merkle_tree.cp │ │ │ +00058670: 703a 3531 393c 2f68 343e 3c70 7265 2073 p:519

    ..auto const
    │ │ │ +000586c0: 2066 6972 7374 5f6c 6561 6620 3d20 6d65   first_leaf = me
    │ │ │ +000586d0: 726b 6c65 5f66 6972 7374 5f6c 6561 6628  rkle_first_leaf(
    │ │ │ +000586e0: 6e75 6d5f 6c65 6166 7329 3b0a 0909 6175  num_leafs);...au
    │ │ │ +000586f0: 746f 2063 6f6e 7374 2062 6c6f 636b 5f74  to const block_t
    │ │ │ +00058700: 7265 655f 696e 6465 7820 3d20 6669 7273  ree_index = firs
    │ │ │ +00058710: 745f 6c65 6166 202b 2062 6c6f 636b 5f69  t_leaf + block_i
    │ │ │ +00058720: 6e64 6578 3b0a 0a09 0969 6620 2862 6c6f  ndex;....if (blo
    │ │ │ +00058730: 636b 735f 7665 7269 6669 6564 2862 6c6f  cks_verified(blo
    │ │ │ +00058740: 636b 5f69 6e64 6578 2c20 3129 290a 0909  ck_index, 1))...
    │ │ │ +00058750: 7b0a 0909 092f 2f20 6966 2074 6869 7320  {....// if this 
    │ │ │ +00058760: 626c 6f63 6b73 2773 2068 6173 6820 6973  blocks's hash is
    │ │ │ +00058770: 2061 6c72 6561 6479 206b 6e6f 776e 2c20   already known, 
    │ │ │ +00058780: 6368 6563 6b20 7468 6520 7061 7373 6564  check the passed
    │ │ │ +00058790: 2d69 6e20 6861 7368 2061 6761 696e 7374  -in hash against
    │ │ │ +000587a0: 2069 740a 0909 0969 6620 2863 6f6d 7061   it....if (compa
    │ │ │ +000587b0: 7265 5f6e 6f64 6528 626c 6f63 6b5f 7472  re_node(block_tr
    │ │ │ +000587c0: 6565 5f69 6e64 6578 2c20 6829 290a 0909  ee_index, h))...
    │ │ │ +000587d0: 0909 7265 7475 726e 2073 7464 3a3a 6d61  ..return std::ma
    │ │ │ +000587e0: 6b65 5f74 7570 6c65 2873 6574 5f62 6c6f  ke_tuple(set_blo
    │ │ │ +000587f0: 636b 5f72 6573 756c 743a 3a6f 6b2c 2062  ck_result::ok, b
    │ │ │ +00058800: 6c6f 636b 5f69 6e64 6578 2c20 3129 3b0a  lock_index, 1);.
    │ │ │ +00058810: 0909 0965 6c73 650a 0909 0909 7265 7475  ...else.....retu
    │ │ │ +00058820: 726e 2073 7464 3a3a 6d61 6b65 5f74 7570  rn std::make_tup
    │ │ │ +00058830: 6c65 2873 6574 5f62 6c6f 636b 5f72 6573  le(set_block_res
    │ │ │ +00058840: 756c 743a 3a62 6c6f 636b 5f68 6173 685f  ult::block_hash_
    │ │ │ +00058850: 6661 696c 6564 2c20 626c 6f63 6b5f 696e  failed, block_in
    │ │ │ +00058860: 6465 782c 2031 293b 0a09 097d 0a0a 0909  dex, 1);...}....
    │ │ │ +00058870: 616c 6c6f 6361 7465 5f66 756c 6c28 293b  allocate_full();
    │ │ │ +00058880: 0a0a 0909 6d5f 7472 6565 5b62 6c6f 636b  ....m_tree[block
    │ │ │ +00058890: 5f74 7265 655f 696e 6465 785d 203d 2068  _tree_index] = h
    │ │ │ +000588a0: 3b0a 0a09 092f 2f20 746f 2061 766f 6964  ;....// to avoid
    │ │ │ +000588b0: 2077 6173 7469 6e67 2061 206c 6f74 206f   wasting a lot o
    │ │ │ +000588c0: 6620 7469 6d65 2068 6173 6869 6e67 206e  f time hashing n
    │ │ │ +000588d0: 6f64 6573 206f 6e6c 7920 746f 2064 6973  odes only to dis
    │ │ │ +000588e0: 636f 7665 7220 7468 6579 0a09 092f 2f20  cover they...// 
    │ │ │ +000588f0: 6361 6e6e 6f74 2062 6520 7665 7269 6669  cannot be verifi
    │ │ │ +00058900: 6564 2c20 6368 6563 6b20 6669 7273 7420  ed, check first 
    │ │ │ +00058910: 746f 2073 6565 2069 6620 7468 6520 726f  to see if the ro
    │ │ │ +00058920: 6f74 206f 6620 7468 6520 6c61 7267 6573  ot of the larges
    │ │ │ +00058930: 740a 0909 2f2f 2063 6f6d 7075 7461 626c  t...// computabl
    │ │ │ +00058940: 6520 7375 6274 7265 6520 6973 206b 6e6f  e subtree is kno
    │ │ │ +00058950: 776e 0a0a 3c64 6976 2073 7479 6c65 3d22  wn..
    ..int leafs_st │ │ │ +00058990: 6172 743b 0a3c 2f64 6976 3e09 0969 6e74 art;.
    ..int │ │ │ +000589a0: 206c 6561 6673 5f73 697a 653b 0a09 0969 leafs_size;...i │ │ │ +000589b0: 6e74 2072 6f6f 745f 696e 6465 783b 0a09 nt root_index;.. │ │ │ +000589c0: 0973 7464 3a3a 7469 6528 6c65 6166 735f .std::tie(leafs_ │ │ │ +000589d0: 7374 6172 742c 206c 6561 6673 5f73 697a start, leafs_siz │ │ │ +000589e0: 652c 2072 6f6f 745f 696e 6465 7829 203d e, root_index) = │ │ │ +000589f0: 0a09 0909 6d65 726b 6c65 5f66 696e 645f ....merkle_find_ │ │ │ +00058a00: 6b6e 6f77 6e5f 7375 6274 7265 6528 6d5f known_subtree(m_ │ │ │ +00058a10: 7472 6565 2c20 626c 6f63 6b5f 696e 6465 tree, block_inde │ │ │ +00058a20: 782c 206d 5f6e 756d 5f62 6c6f 636b 7329 x, m_num_blocks) │ │ │ +00058a30: 3b0a 0a09 092f 2f20 6966 2074 6865 2072 ;....// if the r │ │ │ +00058a40: 6f6f 7420 6e6f 6465 2069 7320 756e 6b6e oot node is unkn │ │ │ +00058a50: 6f77 6e20 7468 6520 6861 7368 6573 2063 own the hashes c │ │ │ +00058a60: 616e 6e6f 7420 6265 2076 6572 6966 6965 annot be verifie │ │ │ +00058a70: 6420 7965 740a 0909 6966 2028 6d5f 7472 d yet...if (m_tr │ │ │ +00058a80: 6565 5b72 6f6f 745f 696e 6465 785d 2e69 ee[root_index].i │ │ │ +00058a90: 735f 616c 6c5f 7a65 726f 7328 2929 0a09 s_all_zeros()).. │ │ │ +00058aa0: 0909 7265 7475 726e 2073 7464 3a3a 6d61 ..return std::ma │ │ │ +00058ab0: 6b65 5f74 7570 6c65 2873 6574 5f62 6c6f ke_tuple(set_blo │ │ │ +00058ac0: 636b 5f72 6573 756c 743a 3a75 6e6b 6e6f ck_result::unkno │ │ │ +00058ad0: 776e 2c20 6c65 6166 735f 7374 6172 742c wn, leafs_start, │ │ │ +00058ae0: 206c 6561 6673 5f73 697a 6529 3b0a 0a09 leafs_size);... │ │ │ +00058af0: 092f 2f20 7361 7665 2074 6865 2072 6f6f .// save the roo │ │ │ +00058b00: 7420 6861 7368 2062 6563 6175 7365 206d t hash because m │ │ │ +00058b10: 6572 6b6c 655f 6669 6c6c 5f74 7265 6520 erkle_fill_tree │ │ │ +00058b20: 7769 6c6c 206f 7665 7277 7269 7465 2069 will overwrite i │ │ │ +00058b30: 740a 0909 7368 6132 3536 5f68 6173 6820 t...sha256_hash │ │ │ +00058b40: 636f 6e73 7420 726f 6f74 203d 206d 5f74 const root = m_t │ │ │ +00058b50: 7265 655b 726f 6f74 5f69 6e64 6578 5d3b ree[root_index]; │ │ │ +00058b60: 0a09 096d 6572 6b6c 655f 6669 6c6c 5f74 ...merkle_fill_t │ │ │ +00058b70: 7265 6528 6d5f 7472 6565 2c20 6c65 6166 ree(m_tree, leaf │ │ │ +00058b80: 735f 7369 7a65 2c20 6669 7273 745f 6c65 s_size, first_le │ │ │ +00058b90: 6166 202b 206c 6561 6673 5f73 7461 7274 af + leafs_start │ │ │ +00058ba0: 293b 0a0a 0909 6966 2028 726f 6f74 2021 );....if (root ! │ │ │ +00058bb0: 3d20 6d5f 7472 6565 5b72 6f6f 745f 696e = m_tree[root_in │ │ │ +00058bc0: 6465 785d 290a 0909 7b0a 0909 092f 2f20 dex])...{....// │ │ │ +00058bd0: 6861 7368 2066 6169 6c75 7265 2c20 636c hash failure, cl │ │ │ +00058be0: 6561 7220 616c 6c20 7468 6520 696e 7465 ear all the inte │ │ │ +00058bf0: 726e 616c 206e 6f64 6573 0a09 0909 2f2f rnal nodes....// │ │ │ +00058c00: 2074 6865 2077 686f 6c65 2070 6965 6365 the whole piece │ │ │ +00058c10: 2066 6169 6c65 6420 7468 6520 6861 7368 failed the hash │ │ │ +00058c20: 2063 6865 636b 2e20 436c 6561 7220 616c check. Clear al │ │ │ +00058c30: 6c20 626c 6f63 6b20 6861 7368 6573 0a09 l block hashes.. │ │ │ +00058c40: 0909 2f2f 2069 6e20 7468 6973 2070 6965 ..// in this pie │ │ │ +00058c50: 6365 2061 6e64 2072 6570 6f72 7420 6120 ce and report a │ │ │ +00058c60: 6861 7368 2066 6169 6c75 7265 0a09 0909 hash failure.... │ │ │ +00058c70: 6d65 726b 6c65 5f63 6c65 6172 5f74 7265 merkle_clear_tre │ │ │ +00058c80: 6528 6d5f 7472 6565 2c20 6c65 6166 735f e(m_tree, leafs_ │ │ │ +00058c90: 7369 7a65 2c20 6669 7273 745f 6c65 6166 size, first_leaf │ │ │ +00058ca0: 202b 206c 6561 6673 5f73 7461 7274 293b + leafs_start); │ │ │ +00058cb0: 0a09 0909 6d5f 7472 6565 5b72 6f6f 745f ....m_tree[root_ │ │ │ +00058cc0: 696e 6465 785d 203d 2072 6f6f 743b 0a09 index] = root;.. │ │ │ +00058cd0: 0909 7265 7475 726e 2073 7464 3a3a 6d61 ..return std::ma │ │ │ +00058ce0: 6b65 5f74 7570 6c65 2873 6574 5f62 6c6f ke_tuple(set_blo │ │ │ +00058cf0: 636b 5f72 6573 756c 743a 3a68 6173 685f ck_result::hash_ │ │ │ +00058d00: 6661 696c 6564 2c20 6c65 6166 735f 7374 failed, leafs_st │ │ │ +00058d10: 6172 742c 206c 6561 6673 5f73 697a 6529 art, leafs_size) │ │ │ +00058d20: 3b0a 0909 7d0a 0a3c 2f70 7265 3e3c 2f74 ;...}..
    relevanc │ │ │ +00058d60: 6526 6e62 7370 3b30 3c2f 7464 3e3c 7464 e 0../src/merkle_ │ │ │ +00058da0: 7472 6565 2e63 7070 3a35 3434 3c2f 613e tree.cpp:544 │ │ │ +00058db0: 3c2f 7464 3e3c 7464 3e74 6869 7320 636f this co │ │ │ +00058dc0: 756c 6420 6265 2064 6f6e 6520 6d6f 7265 uld be done more │ │ │ +00058dd0: 2065 6666 6963 6965 6e74 6c79 2069 6620 efficiently if │ │ │ +00058de0: 6269 7466 6965 6c64 2068 6164 2061 2066 bitfield had a f │ │ │ +00058df0: 756e 6374 696f 6e20 746f 2073 6574 2061 unction to set a │ │ │ +00058e00: 2072 616e 6765 206f 6620 6269 7473 3c2f range of bits

    this │ │ │ +00058e60: 2063 6f75 6c64 2062 6520 646f 6e65 206d could be done m │ │ │ +00058e70: 6f72 6520 6566 6669 6369 656e 746c 7920 ore efficiently │ │ │ +00058e80: 6966 2062 6974 6669 656c 6420 6861 6420 if bitfield had │ │ │ +00058e90: 6120 6675 6e63 7469 6f6e 0a74 6f20 7365 a function.to se │ │ │ +00058ea0: 7420 6120 7261 6e67 6520 6f66 2062 6974 t a range of bit │ │ │ +00058eb0: 733c 2f68 323e 3c68 343e 2e2e 2f73 7263 s

    ../src │ │ │ +00058ec0: 2f6d 6572 6b6c 655f 7472 6565 2e63 7070 /merkle_tree.cpp │ │ │ +00058ed0: 3a35 3434 3c2f 6834 3e3c 7072 6520 7374 :544

    ...merkle_fin
    │ │ │ +00058f20: 645f 6b6e 6f77 6e5f 7375 6274 7265 6528  d_known_subtree(
    │ │ │ +00058f30: 6d5f 7472 6565 2c20 626c 6f63 6b5f 696e  m_tree, block_in
    │ │ │ +00058f40: 6465 782c 206d 5f6e 756d 5f62 6c6f 636b  dex, m_num_block
    │ │ │ +00058f50: 7329 3b0a 0a09 092f 2f20 6966 2074 6865  s);....// if the
    │ │ │ +00058f60: 2072 6f6f 7420 6e6f 6465 2069 7320 756e   root node is un
    │ │ │ +00058f70: 6b6e 6f77 6e20 7468 6520 6861 7368 6573  known the hashes
    │ │ │ +00058f80: 2063 616e 6e6f 7420 6265 2076 6572 6966   cannot be verif
    │ │ │ +00058f90: 6965 6420 7965 740a 0909 6966 2028 6d5f  ied yet...if (m_
    │ │ │ +00058fa0: 7472 6565 5b72 6f6f 745f 696e 6465 785d  tree[root_index]
    │ │ │ +00058fb0: 2e69 735f 616c 6c5f 7a65 726f 7328 2929  .is_all_zeros())
    │ │ │ +00058fc0: 0a09 0909 7265 7475 726e 2073 7464 3a3a  ....return std::
    │ │ │ +00058fd0: 6d61 6b65 5f74 7570 6c65 2873 6574 5f62  make_tuple(set_b
    │ │ │ +00058fe0: 6c6f 636b 5f72 6573 756c 743a 3a75 6e6b  lock_result::unk
    │ │ │ +00058ff0: 6e6f 776e 2c20 6c65 6166 735f 7374 6172  nown, leafs_star
    │ │ │ +00059000: 742c 206c 6561 6673 5f73 697a 6529 3b0a  t, leafs_size);.
    │ │ │ +00059010: 0a09 092f 2f20 7361 7665 2074 6865 2072  ...// save the r
    │ │ │ +00059020: 6f6f 7420 6861 7368 2062 6563 6175 7365  oot hash because
    │ │ │ +00059030: 206d 6572 6b6c 655f 6669 6c6c 5f74 7265   merkle_fill_tre
    │ │ │ +00059040: 6520 7769 6c6c 206f 7665 7277 7269 7465  e will overwrite
    │ │ │ +00059050: 2069 740a 0909 7368 6132 3536 5f68 6173   it...sha256_has
    │ │ │ +00059060: 6820 636f 6e73 7420 726f 6f74 203d 206d  h const root = m
    │ │ │ +00059070: 5f74 7265 655b 726f 6f74 5f69 6e64 6578  _tree[root_index
    │ │ │ +00059080: 5d3b 0a09 096d 6572 6b6c 655f 6669 6c6c  ];...merkle_fill
    │ │ │ +00059090: 5f74 7265 6528 6d5f 7472 6565 2c20 6c65  _tree(m_tree, le
    │ │ │ +000590a0: 6166 735f 7369 7a65 2c20 6669 7273 745f  afs_size, first_
    │ │ │ +000590b0: 6c65 6166 202b 206c 6561 6673 5f73 7461  leaf + leafs_sta
    │ │ │ +000590c0: 7274 293b 0a0a 0909 6966 2028 726f 6f74  rt);....if (root
    │ │ │ +000590d0: 2021 3d20 6d5f 7472 6565 5b72 6f6f 745f   != m_tree[root_
    │ │ │ +000590e0: 696e 6465 785d 290a 0909 7b0a 0909 092f  index])...{..../
    │ │ │ +000590f0: 2f20 6861 7368 2066 6169 6c75 7265 2c20  / hash failure, 
    │ │ │ +00059100: 636c 6561 7220 616c 6c20 7468 6520 696e  clear all the in
    │ │ │ +00059110: 7465 726e 616c 206e 6f64 6573 0a09 0909  ternal nodes....
    │ │ │ +00059120: 2f2f 2074 6865 2077 686f 6c65 2070 6965  // the whole pie
    │ │ │ +00059130: 6365 2066 6169 6c65 6420 7468 6520 6861  ce failed the ha
    │ │ │ +00059140: 7368 2063 6865 636b 2e20 436c 6561 7220  sh check. Clear 
    │ │ │ +00059150: 616c 6c20 626c 6f63 6b20 6861 7368 6573  all block hashes
    │ │ │ +00059160: 0a09 0909 2f2f 2069 6e20 7468 6973 2070  ....// in this p
    │ │ │ +00059170: 6965 6365 2061 6e64 2072 6570 6f72 7420  iece and report 
    │ │ │ +00059180: 6120 6861 7368 2066 6169 6c75 7265 0a09  a hash failure..
    │ │ │ +00059190: 0909 6d65 726b 6c65 5f63 6c65 6172 5f74  ..merkle_clear_t
    │ │ │ +000591a0: 7265 6528 6d5f 7472 6565 2c20 6c65 6166  ree(m_tree, leaf
    │ │ │ +000591b0: 735f 7369 7a65 2c20 6669 7273 745f 6c65  s_size, first_le
    │ │ │ +000591c0: 6166 202b 206c 6561 6673 5f73 7461 7274  af + leafs_start
    │ │ │ +000591d0: 293b 0a09 0909 6d5f 7472 6565 5b72 6f6f  );....m_tree[roo
    │ │ │ +000591e0: 745f 696e 6465 785d 203d 2072 6f6f 743b  t_index] = root;
    │ │ │ +000591f0: 0a09 0909 7265 7475 726e 2073 7464 3a3a  ....return std::
    │ │ │ +00059200: 6d61 6b65 5f74 7570 6c65 2873 6574 5f62  make_tuple(set_b
    │ │ │ +00059210: 6c6f 636b 5f72 6573 756c 743a 3a68 6173  lock_result::has
    │ │ │ +00059220: 685f 6661 696c 6564 2c20 6c65 6166 735f  h_failed, leafs_
    │ │ │ +00059230: 7374 6172 742c 206c 6561 6673 5f73 697a  start, leafs_siz
    │ │ │ +00059240: 6529 3b0a 0909 7d0a 0a3c 6469 7620 7374  e);...}..
    ..int con │ │ │ +00059280: 7374 206c 6561 6673 5f65 6e64 203d 2073 st leafs_end = s │ │ │ +00059290: 7464 3a3a 6d69 6e28 6d5f 6e75 6d5f 626c td::min(m_num_bl │ │ │ +000592a0: 6f63 6b73 2c20 6c65 6166 735f 7374 6172 ocks, leafs_star │ │ │ +000592b0: 7420 2b20 6c65 6166 735f 7369 7a65 293b t + leafs_size); │ │ │ +000592c0: 0a3c 2f64 6976 3e09 0966 6f72 2028 696e .
    ..for (in │ │ │ +000592d0: 7420 6920 3d20 6c65 6166 735f 7374 6172 t i = leafs_star │ │ │ +000592e0: 743b 2069 2026 6c74 3b20 6c65 6166 735f t; i < leafs_ │ │ │ +000592f0: 656e 643b 202b 2b69 290a 0909 096d 5f62 end; ++i)....m_b │ │ │ +00059300: 6c6f 636b 5f76 6572 6966 6965 642e 7365 lock_verified.se │ │ │ +00059310: 745f 6269 7428 6929 3b0a 0a09 092f 2f20 t_bit(i);....// │ │ │ +00059320: 6174 7465 6d70 7469 6e67 2074 6f20 6f70 attempting to op │ │ │ +00059330: 7469 6d69 7a65 2073 746f 7261 6765 2069 timize storage i │ │ │ +00059340: 7320 7175 6974 6520 636f 7374 6c79 2c20 s quite costly, │ │ │ +00059350: 6f6e 6c79 2064 6f20 6974 2069 6620 7765 only do it if we │ │ │ +00059360: 2068 6176 650a 0909 2f2f 2061 2072 6561 have...// a rea │ │ │ +00059370: 736f 6e20 746f 2062 656c 6965 7665 2069 son to believe i │ │ │ +00059380: 7420 6d69 6768 7420 6861 7665 2061 6e20 t might have an │ │ │ +00059390: 6566 6665 6374 0a09 0969 6620 2862 6c6f effect...if (blo │ │ │ +000593a0: 636b 5f69 6e64 6578 203d 3d20 6d5f 6e75 ck_index == m_nu │ │ │ +000593b0: 6d5f 626c 6f63 6b73 202d 2031 207c 7c20 m_blocks - 1 || │ │ │ +000593c0: 216d 5f74 7265 655b 626c 6f63 6b5f 7472 !m_tree[block_tr │ │ │ +000593d0: 6565 5f69 6e64 6578 202b 2031 5d2e 6973 ee_index + 1].is │ │ │ +000593e0: 5f61 6c6c 5f7a 6572 6f73 2829 290a 0909 _all_zeros())... │ │ │ +000593f0: 096f 7074 696d 697a 655f 7374 6f72 6167 .optimize_storag │ │ │ +00059400: 6528 293b 0a0a 0909 7265 7475 726e 2073 e();....return s │ │ │ +00059410: 7464 3a3a 6d61 6b65 5f74 7570 6c65 2873 td::make_tuple(s │ │ │ +00059420: 6574 5f62 6c6f 636b 5f72 6573 756c 743a et_block_result: │ │ │ +00059430: 3a6f 6b2c 206c 6561 6673 5f73 7461 7274 :ok, leafs_start │ │ │ +00059440: 2c20 6c65 6166 735f 7369 7a65 293b 0a09 , leafs_size);.. │ │ │ +00059450: 7d0a 0a09 7374 643a 3a73 697a 655f 7420 }...std::size_t │ │ │ +00059460: 6d65 726b 6c65 5f74 7265 653a 3a73 697a merkle_tree::siz │ │ │ +00059470: 6528 2920 636f 6e73 740a 097b 0a09 0972 e() const..{...r │ │ │ +00059480: 6574 7572 6e20 7374 6174 6963 5f63 6173 eturn static_cas │ │ │ +00059490: 7426 6c74 3b73 7464 3a3a 7369 7a65 5f74 t<std::size_t │ │ │ +000594a0: 2667 743b 286d 6572 6b6c 655f 6e75 6d5f >(merkle_num_ │ │ │ +000594b0: 6e6f 6465 7328 6d65 726b 6c65 5f6e 756d nodes(merkle_num │ │ │ +000594c0: 5f6c 6561 6673 286d 5f6e 756d 5f62 6c6f _leafs(m_num_blo │ │ │ +000594d0: 636b 7329 2929 3b0a 097d 0a0a 0969 6e74 cks)));..}...int │ │ │ +000594e0: 206d 6572 6b6c 655f 7472 6565 3a3a 6e75 merkle_tree::nu │ │ │ +000594f0: 6d5f 7069 6563 6573 2829 2063 6f6e 7374 m_pieces() const │ │ │ +00059500: 0a09 7b0a 0909 696e 7420 636f 6e73 7420 ..{...int const │ │ │ +00059510: 7073 203d 2062 6c6f 636b 735f 7065 725f ps = blocks_per_ │ │ │ +00059520: 7069 6563 6528 293b 0a09 0954 4f52 5245 piece();...TORRE │ │ │ +00059530: 4e54 5f41 5353 4552 5428 7073 2026 6774 NT_ASSERT(ps > │ │ │ +00059540: 3b20 3029 3b0a 0909 7265 7475 726e 2028 ; 0);...return ( │ │ │ +00059550: 6d5f 6e75 6d5f 626c 6f63 6b73 202b 2070 m_num_blocks + p │ │ │ +00059560: 7320 2d20 3129 2026 6774 3b26 6774 3b20 s - 1) >> │ │ │ +00059570: 6d5f 626c 6f63 6b73 5f70 6572 5f70 6965 m_blocks_per_pie │ │ │ +00059580: 6365 5f6c 6f67 3b0a 097d 0a0a 0969 6e74 ce_log;..}...int │ │ │ +00059590: 206d 6572 6b6c 655f 7472 6565 3a3a 626c merkle_tree::bl │ │ │ +000595a0: 6f63 6b5f 6c61 7965 725f 7374 6172 7428 ock_layer_start( │ │ │ +000595b0: 2920 636f 6e73 740a 097b 0a09 0969 6e74 ) const..{...int │ │ │ +000595c0: 2063 6f6e 7374 206e 756d 5f6c 6561 6673 const num_leafs │ │ │ +000595d0: 203d 206d 6572 6b6c 655f 6e75 6d5f 6c65 = merkle_num_le │ │ │ +000595e0: 6166 7328 6d5f 6e75 6d5f 626c 6f63 6b73 afs(m_num_blocks │ │ │ +000595f0: 293b 0a09 0954 4f52 5245 4e54 5f41 5353 );...TORRENT_ASS │ │ │ +00059600: 4552 5428 6e75 6d5f 6c65 6166 7320 2667 ERT(num_leafs &g │ │ │ +00059610: 743b 2030 293b 0a09 0972 6574 7572 6e20 t; 0);...return │ │ │ +00059620: 6d65 726b 6c65 5f66 6972 7374 5f6c 6561 merkle_first_lea │ │ │ +00059630: 6628 6e75 6d5f 6c65 6166 7329 3b0a 097d f(num_leafs);..} │ │ │ +00059640: 0a0a 3c2f 7072 653e 3c2f 7464 3e3c 2f74 ..
    < │ │ │ +00059670: 7464 3e72 656c 6576 616e 6365 266e 6273 td>relevance&nbs │ │ │ +00059680: 703b 303c 2f74 643e 3c74 643e 3c61 2068 p;0../ │ │ │ +000596b0: 7372 632f 746f 7272 656e 745f 696e 666f src/torrent_info │ │ │ +000596c0: 2e63 7070 3a39 3031 3c2f 613e 3c2f 7464 .cpp:901this should │ │ │ +000596e0: 2062 6520 636f 6e73 6964 6572 6564 2061 be considered a │ │ │ +000596f0: 2066 6169 6c75 7265 2c20 616e 6420 7468 failure, and th │ │ │ +00059700: 6520 2e74 6f72 7265 6e74 2066 696c 6520 e .torrent file │ │ │ +00059710: 7265 6a65 6374 6564 3c2f 7464 3e3c 2f74 rejected

    this shoul │ │ │ +00059770: 6420 6265 2063 6f6e 7369 6465 7265 6420 d be considered │ │ │ +00059780: 6120 6661 696c 7572 652c 2061 6e64 2074 a failure, and t │ │ │ +00059790: 6865 202e 746f 7272 656e 7420 6669 6c65 he .torrent file │ │ │ +000597a0: 0a72 656a 6563 7465 643c 2f68 323e 3c68 .rejected

    ../src/torrent │ │ │ +000597c0: 5f69 6e66 6f2e 6370 703a 3930 313c 2f68 _info.cpp:901
    ...s
    │ │ │ +00059810: 7464 3a3a 7374 7269 6e67 2065 7874 203d  td::string ext =
    │ │ │ +00059820: 2065 7874 656e 7369 6f6e 2866 696c 656e   extension(filen
    │ │ │ +00059830: 616d 6529 3b0a 0909 0969 6e74 2063 6e74  ame);....int cnt
    │ │ │ +00059840: 203d 2030 3b0a 0909 0966 6f72 2028 3b3b   = 0;....for (;;
    │ │ │ +00059850: 290a 0909 097b 0a09 0909 092b 2b63 6e74  )....{.....++cnt
    │ │ │ +00059860: 3b0a 0909 0909 6368 6172 206e 6577 5f65  ;.....char new_e
    │ │ │ +00059870: 7874 5b35 305d 3b0a 0909 0909 7374 643a  xt[50];.....std:
    │ │ │ +00059880: 3a73 6e70 7269 6e74 6628 6e65 775f 6578  :snprintf(new_ex
    │ │ │ +00059890: 742c 2073 697a 656f 6628 6e65 775f 6578  t, sizeof(new_ex
    │ │ │ +000598a0: 7429 2c20 222e 2564 2573 222c 2063 6e74  t), ".%d%s", cnt
    │ │ │ +000598b0: 2c20 6578 742e 635f 7374 7228 2929 3b0a  , ext.c_str());.
    │ │ │ +000598c0: 0909 0909 6669 6c65 6e61 6d65 203d 2062  ....filename = b
    │ │ │ +000598d0: 6173 6520 2b20 6e65 775f 6578 743b 0a0a  ase + new_ext;..
    │ │ │ +000598e0: 0909 0909 626f 6f73 743a 3a63 7263 5f6f  ....boost::crc_o
    │ │ │ +000598f0: 7074 696d 616c 266c 743b 3332 2c20 3078  ptimal<32, 0x
    │ │ │ +00059900: 3145 4443 3646 3431 2c20 3078 4646 4646  1EDC6F41, 0xFFFF
    │ │ │ +00059910: 4646 4646 2c20 3078 4646 4646 4646 4646  FFFF, 0xFFFFFFFF
    │ │ │ +00059920: 2c20 7472 7565 2c20 7472 7565 2667 743b  , true, true>
    │ │ │ +00059930: 2063 7263 3b0a 0909 0909 7072 6f63 6573   crc;.....proces
    │ │ │ +00059940: 735f 7374 7269 6e67 5f6c 6f77 6572 6361  s_string_lowerca
    │ │ │ +00059950: 7365 2863 7263 2c20 6669 6c65 6e61 6d65  se(crc, filename
    │ │ │ +00059960: 293b 0a09 0909 0973 7464 3a3a 7569 6e74  );.....std::uint
    │ │ │ +00059970: 3332 5f74 2063 6f6e 7374 206e 6577 5f68  32_t const new_h
    │ │ │ +00059980: 6173 6820 3d20 6372 632e 6368 6563 6b73  ash = crc.checks
    │ │ │ +00059990: 756d 2829 3b0a 0909 0909 6966 2028 6669  um();.....if (fi
    │ │ │ +000599a0: 6c65 732e 6669 6e64 286e 6577 5f68 6173  les.find(new_has
    │ │ │ +000599b0: 6829 203d 3d20 6669 6c65 732e 656e 6428  h) == files.end(
    │ │ │ +000599c0: 2929 0a09 0909 097b 0a09 0909 0909 6669  )).....{......fi
    │ │ │ +000599d0: 6c65 732e 696e 7365 7274 287b 6e65 775f  les.insert({new_
    │ │ │ +000599e0: 6861 7368 2c20 7b69 2c20 307d 7d29 3b0a  hash, {i, 0}});.
    │ │ │ +000599f0: 0909 0909 0962 7265 616b 3b0a 0909 0909  .....break;.....
    │ │ │ +00059a00: 7d0a 0909 0909 2b2b 6e75 6d5f 636f 6c6c  }.....++num_coll
    │ │ │ +00059a10: 6973 696f 6e73 3b0a 0909 0909 6966 2028  isions;.....if (
    │ │ │ +00059a20: 6e75 6d5f 636f 6c6c 6973 696f 6e73 2026  num_collisions &
    │ │ │ +00059a30: 6774 3b20 3130 3029 0a09 0909 097b 0a3c  gt; 100).....{.<
    │ │ │ +00059a40: 6469 7620 7374 796c 653d 2262 6163 6b67  div style="backg
    │ │ │ +00059a50: 726f 756e 643a 2023 6666 6666 3030 2220  round: #ffff00" 
    │ │ │ +00059a60: 7769 6474 683d 2231 3030 2522 3e09 0909  width="100%">...
    │ │ │ +00059a70: 097d 0a3c 2f64 6976 3e09 0909 7d0a 0a09  .}.
    ...}... │ │ │ +00059a80: 0909 636f 7079 5f6f 6e5f 7772 6974 6528 ..copy_on_write( │ │ │ +00059a90: 293b 0a09 0909 6d5f 6669 6c65 732e 7265 );....m_files.re │ │ │ +00059aa0: 6e61 6d65 5f66 696c 6528 692c 2066 696c name_file(i, fil │ │ │ +00059ab0: 656e 616d 6529 3b0a 0909 7d0a 097d 0a0a ename);...}..}.. │ │ │ +00059ac0: 0976 6f69 6420 746f 7272 656e 745f 696e .void torrent_in │ │ │ +00059ad0: 666f 3a3a 7265 6d61 705f 6669 6c65 7328 fo::remap_files( │ │ │ +00059ae0: 6669 6c65 5f73 746f 7261 6765 2063 6f6e file_storage con │ │ │ +00059af0: 7374 2661 6d70 3b20 6629 0a09 7b0a 0909 st& f)..{... │ │ │ +00059b00: 494e 5641 5249 414e 545f 4348 4543 4b3b INVARIANT_CHECK; │ │ │ +00059b10: 0a0a 0909 544f 5252 454e 545f 4153 5345 ....TORRENT_ASSE │ │ │ +00059b20: 5254 2869 735f 6c6f 6164 6564 2829 293b RT(is_loaded()); │ │ │ +00059b30: 0a09 092f 2f20 7468 6520 6e65 7720 7370 ...// the new sp │ │ │ +00059b40: 6563 6966 6965 6420 6669 6c65 2073 746f ecified file sto │ │ │ +00059b50: 7261 6765 206d 7573 7420 6861 7665 2074 rage must have t │ │ │ +00059b60: 6865 2065 7861 6374 0a09 092f 2f20 7361 he exact...// sa │ │ │ +00059b70: 6d65 2073 697a 6520 6173 2074 6865 2063 me size as the c │ │ │ +00059b80: 7572 7265 6e74 2066 696c 6520 7374 6f72 urrent file stor │ │ │ +00059b90: 6167 650a 0909 544f 5252 454e 545f 4153 age...TORRENT_AS │ │ │ +00059ba0: 5345 5254 286d 5f66 696c 6573 2e74 6f74 SERT(m_files.tot │ │ │ +00059bb0: 616c 5f73 697a 6528 2920 3d3d 2066 2e74 al_size() == f.t │ │ │ +00059bc0: 6f74 616c 5f73 697a 6528 2929 3b0a 0a09 otal_size());... │ │ │ +00059bd0: 0969 6620 286d 5f66 696c 6573 2e74 6f74 .if (m_files.tot │ │ │ +00059be0: 616c 5f73 697a 6528 2920 213d 2066 2e74 al_size() != f.t │ │ │ +00059bf0: 6f74 616c 5f73 697a 6528 2929 2072 6574 otal_size()) ret │ │ │ +00059c00: 7572 6e3b 0a09 0963 6f70 795f 6f6e 5f77 urn;...copy_on_w │ │ │ +00059c10: 7269 7465 2829 3b0a 0909 6d5f 6669 6c65 rite();...m_file │ │ │ +00059c20: 7320 3d20 663b 0a09 096d 5f66 696c 6573 s = f;...m_files │ │ │ +00059c30: 2e73 6574 5f6e 756d 5f70 6965 6365 7328 .set_num_pieces( │ │ │ +00059c40: 6d5f 6f72 6967 5f66 696c 6573 2d26 6774 m_orig_files-> │ │ │ +00059c50: 3b6e 756d 5f70 6965 6365 7328 2929 3b0a ;num_pieces());. │ │ │ +00059c60: 0909 6d5f 6669 6c65 732e 7365 745f 7069 ..m_files.set_pi │ │ │ +00059c70: 6563 655f 6c65 6e67 7468 286d 5f6f 7269 ece_length(m_ori │ │ │ +00059c80: 675f 6669 6c65 732d 2667 743b 7069 6563 g_files->piec │ │ │ +00059c90: 655f 6c65 6e67 7468 2829 293b 0a09 7d0a e_length());..}. │ │ │ +00059ca0: 0a23 6966 2054 4f52 5245 4e54 5f41 4249 .#if TORRENT_ABI │ │ │ +00059cb0: 5f56 4552 5349 4f4e 203d 3d20 310a 092f _VERSION == 1../ │ │ │ +00059cc0: 2f20 7374 616e 6461 7264 2063 6f6e 7374 / standard const │ │ │ +00059cd0: 7275 6374 6f72 2074 6861 7420 7061 7273 ructor that pars │ │ │ +00059ce0: 6573 2061 2074 6f72 7265 6e74 2066 696c es a torrent fil │ │ │ +00059cf0: 650a 0974 6f72 7265 6e74 5f69 6e66 6f3a e..torrent_info: │ │ │ +00059d00: 3a74 6f72 7265 6e74 5f69 6e66 6f28 656e :torrent_info(en │ │ │ +00059d10: 7472 7920 636f 6e73 7426 616d 703b 2074 try const& t │ │ │ +00059d20: 6f72 7265 6e74 5f66 696c 6529 0a09 7b0a orrent_file)..{. │ │ │ +00059d30: 0909 7374 643a 3a76 6563 746f 7226 6c74 ..std::vector< │ │ │ +00059d40: 3b63 6861 7226 6774 3b20 746d 703b 0a09 ;char> tmp;.. │ │ │ +00059d50: 0973 7464 3a3a 6261 636b 5f69 6e73 6572 .std::back_inser │ │ │ +00059d60: 745f 6974 6572 6174 6f72 266c 743b 7374 t_iterator<st │ │ │ +00059d70: 643a 3a76 6563 746f 7226 6c74 3b63 6861 d::vector<cha │ │ │ +00059d80: 7226 6774 3b26 6774 3b20 6f75 7428 746d r>> out(tm │ │ │ +00059d90: 7029 3b0a 0909 6265 6e63 6f64 6528 6f75 p);...bencode(ou │ │ │ +00059da0: 742c 2074 6f72 7265 6e74 5f66 696c 6529 t, torrent_file) │ │ │ +00059db0: 3b0a 3c2f 7072 653e 3c2f 7464 3e3c 2f74 ;.< │ │ │ +00059de0: 7464 3e72 656c 6576 616e 6365 266e 6273 td>relevance&nbs │ │ │ +00059df0: 703b 303c 2f74 643e 3c74 643e 3c61 2068 p;0../ │ │ │ +00059e20: 7372 632f 6370 7569 642e 6370 703a 3133 src/cpuid.cpp:13 │ │ │ +00059e30: 313c 2f61 3e3c 2f74 643e 3c74 643e 656e 1en │ │ │ +00059e40: 6162 6c65 2077 6865 6e20 6161 7263 6836 able when aarch6 │ │ │ +00059e50: 3420 6973 2072 6561 6c6c 7920 7465 7374 4 is really test │ │ │ +00059e60: 6564 3c2f 7464 3e3c 2f74 723e 3c74 7220 ed

    │ │ │ +00059eb0: 656e 6162 6c65 2077 6865 6e20 6161 7263 enable when aarc │ │ │ +00059ec0: 6836 3420 6973 2072 6561 6c6c 7920 7465 h64 is really te │ │ │ +00059ed0: 7374 6564 3c2f 6832 3e3c 6834 3e2e 2e2f sted

    ../ │ │ │ +00059ee0: 7372 632f 6370 7569 642e 6370 703a 3133 src/cpuid.cpp:13 │ │ │ +00059ef0: 313c 2f68 343e 3c70 7265 2073 7479 6c65 1

    │ │ │ +00059f30: 0962 6f6f 6c20 7375 7070 6f72 7473 5f6d  .bool supports_m
    │ │ │ +00059f40: 6d78 2829 206e 6f65 7863 6570 740a 097b  mx() noexcept..{
    │ │ │ +00059f50: 0a23 6966 2054 4f52 5245 4e54 5f48 4153  .#if TORRENT_HAS
    │ │ │ +00059f60: 5f53 5345 0a09 0973 7464 3a3a 7569 6e74  _SSE...std::uint
    │ │ │ +00059f70: 3332 5f74 2063 7075 695b 345d 203d 207b  32_t cpui[4] = {
    │ │ │ +00059f80: 307d 3b0a 0909 6370 7569 6428 6370 7569  0};...cpuid(cpui
    │ │ │ +00059f90: 2c20 3129 3b0a 0909 7265 7475 726e 2028  , 1);...return (
    │ │ │ +00059fa0: 6370 7569 5b32 5d20 2661 6d70 3b20 2831  cpui[2] & (1
    │ │ │ +00059fb0: 2026 6c74 3b26 6c74 3b20 3233 2929 2021   << 23)) !
    │ │ │ +00059fc0: 3d20 303b 0a23 656c 7365 0a09 0972 6574  = 0;.#else...ret
    │ │ │ +00059fd0: 7572 6e20 6661 6c73 653b 0a23 656e 6469  urn false;.#endi
    │ │ │ +00059fe0: 660a 097d 0a0a 0962 6f6f 6c20 7375 7070  f..}...bool supp
    │ │ │ +00059ff0: 6f72 7473 5f61 726d 5f6e 656f 6e28 2920  orts_arm_neon() 
    │ │ │ +0005a000: 6e6f 6578 6365 7074 0a09 7b0a 2369 6620  noexcept..{.#if 
    │ │ │ +0005a010: 544f 5252 454e 545f 4841 535f 4152 4d5f  TORRENT_HAS_ARM_
    │ │ │ +0005a020: 4e45 4f4e 2026 616d 703b 2661 6d70 3b20  NEON && 
    │ │ │ +0005a030: 544f 5252 454e 545f 4841 535f 4155 5856  TORRENT_HAS_AUXV
    │ │ │ +0005a040: 0a23 6966 2064 6566 696e 6564 205f 5f61  .#if defined __a
    │ │ │ +0005a050: 726d 5f5f 0a09 092f 2f72 6574 7572 6e20  rm__...//return 
    │ │ │ +0005a060: 2867 6574 6175 7876 616c 2841 545f 4857  (getauxval(AT_HW
    │ │ │ +0005a070: 4341 5029 2026 616d 703b 2048 5743 4150  CAP) & HWCAP
    │ │ │ +0005a080: 5f4e 454f 4e29 3b0a 0909 7265 7475 726e  _NEON);...return
    │ │ │ +0005a090: 2028 6865 6c70 6572 5f67 6574 6175 7876   (helper_getauxv
    │ │ │ +0005a0a0: 616c 2831 3629 2026 616d 703b 2028 3120  al(16) & (1 
    │ │ │ +0005a0b0: 266c 743b 266c 743b 2031 3229 293b 0a23  << 12));.#
    │ │ │ +0005a0c0: 656c 6966 2064 6566 696e 6564 205f 5f61  elif defined __a
    │ │ │ +0005a0d0: 6172 6368 3634 5f5f 0a09 092f 2f72 6574  arch64__...//ret
    │ │ │ +0005a0e0: 7572 6e20 2867 6574 6175 7876 616c 2841  urn (getauxval(A
    │ │ │ +0005a0f0: 545f 4857 4341 5029 2026 616d 703b 2048  T_HWCAP) & H
    │ │ │ +0005a100: 5743 4150 5f41 5349 4d44 293b 0a09 092f  WCAP_ASIMD);.../
    │ │ │ +0005a110: 2f72 6574 7572 6e20 2867 6574 6175 7876  /return (getauxv
    │ │ │ +0005a120: 616c 2831 3629 2026 616d 703b 2028 3120  al(16) & (1 
    │ │ │ +0005a130: 266c 743b 266c 743b 2031 2929 3b0a 3c64  << 1));...re
    │ │ │ +0005a170: 7475 726e 2066 616c 7365 3b0a 3c2f 6469  turn false;.#endif.#else..
    │ │ │ +0005a190: 0972 6574 7572 6e20 6661 6c73 653b 0a23  .return false;.#
    │ │ │ +0005a1a0: 656e 6469 660a 097d 0a0a 0962 6f6f 6c20  endif..}...bool 
    │ │ │ +0005a1b0: 7375 7070 6f72 7473 5f61 726d 5f63 7263  supports_arm_crc
    │ │ │ +0005a1c0: 3332 6328 2920 6e6f 6578 6365 7074 0a09  32c() noexcept..
    │ │ │ +0005a1d0: 7b0a 2369 6620 544f 5252 454e 545f 4841  {.#if TORRENT_HA
    │ │ │ +0005a1e0: 535f 4152 4d5f 4352 4333 3220 2661 6d70  S_ARM_CRC32 &
    │ │ │ +0005a1f0: 3b26 616d 703b 2054 4f52 5245 4e54 5f48  ;& TORRENT_H
    │ │ │ +0005a200: 4153 5f41 5558 560a 2369 6620 6465 6669  AS_AUXV.#if defi
    │ │ │ +0005a210: 6e65 6420 544f 5252 454e 545f 464f 5243  ned TORRENT_FORC
    │ │ │ +0005a220: 455f 4152 4d5f 4352 4333 320a 0909 7265  E_ARM_CRC32...re
    │ │ │ +0005a230: 7475 726e 2074 7275 653b 0a23 656c 6966  turn true;.#elif
    │ │ │ +0005a240: 2064 6566 696e 6564 205f 5f61 726d 5f5f   defined __arm__
    │ │ │ +0005a250: 0a09 092f 2f72 6574 7572 6e20 2867 6574  ...//return (get
    │ │ │ +0005a260: 6175 7876 616c 2841 545f 4857 4341 5032  auxval(AT_HWCAP2
    │ │ │ +0005a270: 2920 2661 6d70 3b20 4857 4341 5032 5f43  ) & HWCAP2_C
    │ │ │ +0005a280: 5243 3332 293b 0a09 0972 6574 7572 6e20  RC32);...return 
    │ │ │ +0005a290: 2868 656c 7065 725f 6765 7461 7578 7661  (helper_getauxva
    │ │ │ +0005a2a0: 6c28 3236 2920 2661 6d70 3b20 2831 2026  l(26) & (1 &
    │ │ │ +0005a2b0: 6c74 3b26 6c74 3b20 3429 293b 0a23 656c  lt;< 4));.#el
    │ │ │ +0005a2c0: 6966 2064 6566 696e 6564 205f 5f61 6172  if defined __aar
    │ │ │ +0005a2d0: 6368 3634 5f5f 0a09 092f 2f72 6574 7572  ch64__...//retur
    │ │ │ +0005a2e0: 6e20 2867 6574 6175 7876 616c 2841 545f  n (getauxval(AT_
    │ │ │ +0005a2f0: 4857 4341 5029 2026 616d 703b 2048 5743  HWCAP) & HWC
    │ │ │ +0005a300: 4150 5f43 5243 3332 293b 0a09 0972 6574  AP_CRC32);...ret
    │ │ │ +0005a310: 7572 6e20 2868 656c 7065 725f 6765 7461  urn (helper_geta
    │ │ │ +0005a320: 7578 7661 6c28 3136 2920 2661 6d70 3b20  uxval(16) & 
    │ │ │ +0005a330: 2831 2026 6c74 3b26 6c74 3b20 3729 293b  (1 << 7));
    │ │ │ +0005a340: 0a23 656e 6469 660a 2365 6c73 650a 0909  .#endif.#else...
    │ │ │ +0005a350: 7265 7475 726e 2066 616c 7365 3b0a 2365  return false;.#e
    │ │ │ +0005a360: 6e64 6966 0a09 7d0a 0a7d 202f 2f20 616e  ndif..}..} // an
    │ │ │ +0005a370: 6f6e 796d 6f75 7320 6e61 6d65 7370 6163  onymous namespac
    │ │ │ +0005a380: 650a 0a09 626f 6f6c 2063 6f6e 7374 2073  e...bool const s
    │ │ │ +0005a390: 7365 3432 5f73 7570 706f 7274 203d 2073  se42_support = s
    │ │ │ +0005a3a0: 7570 706f 7274 735f 7373 6534 3228 293b  upports_sse42();
    │ │ │ +0005a3b0: 0a09 626f 6f6c 2063 6f6e 7374 206d 6d78  ..bool const mmx
    │ │ │ +0005a3c0: 5f73 7570 706f 7274 203d 2073 7570 706f  _support = suppo
    │ │ │ +0005a3d0: 7274 735f 6d6d 7828 293b 0a09 626f 6f6c  rts_mmx();..bool
    │ │ │ +0005a3e0: 2063 6f6e 7374 2061 726d 5f6e 656f 6e5f   const arm_neon_
    │ │ │ +0005a3f0: 7375 7070 6f72 7420 3d20 7375 7070 6f72  support = suppor
    │ │ │ +0005a400: 7473 5f61 726d 5f6e 656f 6e28 293b 0a09  ts_arm_neon();..
    │ │ │ +0005a410: 626f 6f6c 2063 6f6e 7374 2061 726d 5f63  bool const arm_c
    │ │ │ +0005a420: 7263 3332 635f 7375 7070 6f72 7420 3d20  rc32c_support = 
    │ │ │ +0005a430: 7375 7070 6f72 7473 5f61 726d 5f63 7263  supports_arm_crc
    │ │ │ +0005a440: 3332 6328 293b 0a7d 207d 0a3c 2f70 7265  32c();.} }.
    rele │ │ │ +0005a480: 7661 6e63 6526 6e62 7370 3b30 3c2f 7464 vance 0../src/ses │ │ │ +0005a4c0: 7369 6f6e 2e63 7070 3a35 3430 3c2f 613e sion.cpp:540 │ │ │ +0005a4d0: 3c2f 7464 3e3c 7464 3e49 6e20 432b 2b31 In C++1 │ │ │ +0005a4e0: 372e 2075 7365 2069 6620 636f 6e73 7465 7. use if conste │ │ │ +0005a4f0: 7870 7220 696e 7374 6561 643c 2f74 643e xpr instead │ │ │ +0005a500: 3c2f 7472 3e3c 7472 2069 643d 2232 3130

    In C++1 │ │ │ +0005a550: 372e 2075 7365 2069 6620 636f 6e73 7465 7. use if conste │ │ │ +0005a560: 7870 7220 696e 7374 6561 643c 2f68 323e xpr instead

    │ │ │ +0005a570: 3c68 343e 2e2e 2f73 7263 2f73 6573 7369

    ../src/sessi │ │ │ +0005a580: 6f6e 2e63 7070 3a35 3430 3c2f 6834 3e3c on.cpp:540

    < │ │ │ +0005a590: 7072 6520 7374 796c 653d 2262 6163 6b67 pre style="backg │ │ │ +0005a5a0: 726f 756e 643a 2023 6636 6636 6636 3b20 round: #f6f6f6; │ │ │ +0005a5b0: 626f 7264 6572 3a20 736f 6c69 6420 3170 border: solid 1p │ │ │ +0005a5c0: 7820 2364 6464 3b22 3e09 7b7d 0a09 7365 x #ddd;">.{}..se │ │ │ +0005a5d0: 7373 696f 6e5f 7072 6f78 793a 3a73 6573 ssion_proxy::ses │ │ │ +0005a5e0: 7369 6f6e 5f70 726f 7879 2873 6573 7369 sion_proxy(sessi │ │ │ +0005a5f0: 6f6e 5f70 726f 7879 2063 6f6e 7374 2661 on_proxy const&a │ │ │ +0005a600: 6d70 3b29 203d 2064 6566 6175 6c74 3b0a mp;) = default;. │ │ │ +0005a610: 0973 6573 7369 6f6e 5f70 726f 7879 2661 .session_proxy&a │ │ │ +0005a620: 6d70 3b20 7365 7373 696f 6e5f 7072 6f78 mp; session_prox │ │ │ +0005a630: 793a 3a6f 7065 7261 746f 723d 2873 6573 y::operator=(ses │ │ │ +0005a640: 7369 6f6e 5f70 726f 7879 2063 6f6e 7374 sion_proxy const │ │ │ +0005a650: 2661 6d70 3b29 2026 616d 703b 203d 2064 &) & = d │ │ │ +0005a660: 6566 6175 6c74 3b0a 0973 6573 7369 6f6e efault;..session │ │ │ +0005a670: 5f70 726f 7879 3a3a 7365 7373 696f 6e5f _proxy::session_ │ │ │ +0005a680: 7072 6f78 7928 7365 7373 696f 6e5f 7072 proxy(session_pr │ │ │ +0005a690: 6f78 7926 616d 703b 2661 6d70 3b29 206e oxy&&) n │ │ │ +0005a6a0: 6f65 7863 6570 7420 3d20 6465 6661 756c oexcept = defaul │ │ │ +0005a6b0: 743b 0a09 7365 7373 696f 6e5f 7072 6f78 t;..session_prox │ │ │ +0005a6c0: 7926 616d 703b 2073 6573 7369 6f6e 5f70 y& session_p │ │ │ +0005a6d0: 726f 7879 3a3a 6f70 6572 6174 6f72 3d28 roxy::operator=( │ │ │ +0005a6e0: 7365 7373 696f 6e5f 7072 6f78 7926 616d session_proxy&am │ │ │ +0005a6f0: 703b 2661 6d70 3b29 2026 616d 703b 206e p;&) & n │ │ │ +0005a700: 6f65 7863 6570 7420 3d20 6465 6661 756c oexcept = defaul │ │ │ +0005a710: 743b 0a09 7365 7373 696f 6e5f 7072 6f78 t;..session_prox │ │ │ +0005a720: 793a 3a7e 7365 7373 696f 6e5f 7072 6f78 y::~session_prox │ │ │ +0005a730: 7928 290a 097b 0a09 0969 6620 286d 5f74 y()..{...if (m_t │ │ │ +0005a740: 6872 6561 6420 2661 6d70 3b26 616d 703b hread && │ │ │ +0005a750: 206d 5f74 6872 6561 642e 7573 655f 636f m_thread.use_co │ │ │ +0005a760: 756e 7428 2920 3d3d 2031 290a 0909 7b0a unt() == 1)...{. │ │ │ +0005a770: 2369 6620 6465 6669 6e65 6420 544f 5252 #if defined TORR │ │ │ +0005a780: 454e 545f 4153 494f 5f44 4542 5547 4749 ENT_ASIO_DEBUGGI │ │ │ +0005a790: 4e47 0a09 0909 7761 6974 5f66 6f72 5f61 NG....wait_for_a │ │ │ +0005a7a0: 7369 6f5f 6861 6e64 6c65 7273 2829 3b0a sio_handlers();. │ │ │ +0005a7b0: 2365 6e64 6966 0a09 0909 6d5f 7468 7265 #endif....m_thre │ │ │ +0005a7c0: 6164 2d26 6774 3b6a 6f69 6e28 293b 0a09 ad->join();.. │ │ │ +0005a7d0: 097d 0a09 7d0a 0a09 544f 5252 454e 545f .}..}...TORRENT_ │ │ │ +0005a7e0: 4558 504f 5254 2073 7464 3a3a 756e 6971 EXPORT std::uniq │ │ │ +0005a7f0: 7565 5f70 7472 266c 743b 6469 736b 5f69 ue_ptr<disk_i │ │ │ +0005a800: 6e74 6572 6661 6365 2667 743b 2064 6566 nterface> def │ │ │ +0005a810: 6175 6c74 5f64 6973 6b5f 696f 5f63 6f6e ault_disk_io_con │ │ │ +0005a820: 7374 7275 6374 6f72 280a 0909 696f 5f63 structor(...io_c │ │ │ +0005a830: 6f6e 7465 7874 2661 6d70 3b20 696f 732c ontext& ios, │ │ │ +0005a840: 2073 6574 7469 6e67 735f 696e 7465 7266 settings_interf │ │ │ +0005a850: 6163 6520 636f 6e73 7426 616d 703b 2073 ace const& s │ │ │ +0005a860: 6574 742c 2063 6f75 6e74 6572 7326 616d ett, counters&am │ │ │ +0005a870: 703b 2063 6e74 290a 097b 0a23 6966 2054 p; cnt)..{.#if T │ │ │ +0005a880: 4f52 5245 4e54 5f48 4156 455f 4d4d 4150 ORRENT_HAVE_MMAP │ │ │ +0005a890: 207c 7c20 544f 5252 454e 545f 4841 5645 || TORRENT_HAVE │ │ │ +0005a8a0: 5f4d 4150 5f56 4945 575f 4f46 5f46 494c _MAP_VIEW_OF_FIL │ │ │ +0005a8b0: 450a 3c64 6976 2073 7479 6c65 3d22 6261 E.
    │ │ │ +0005a8e0: 2369 6e63 6c75 6465 2022 6c69 6274 6f72 #include "libtor │ │ │ +0005a8f0: 7265 6e74 2f61 7578 5f2f 6469 7361 626c rent/aux_/disabl │ │ │ +0005a900: 655f 6465 7072 6563 6174 696f 6e5f 7761 e_deprecation_wa │ │ │ +0005a910: 726e 696e 6773 5f70 7573 682e 6870 7022 rnings_push.hpp" │ │ │ +0005a920: 0a3c 2f64 6976 3e09 0969 6620 2873 697a .
    ..if (siz │ │ │ +0005a930: 656f 6628 766f 6964 2a29 203d 3d20 3829 eof(void*) == 8) │ │ │ +0005a940: 0a09 0909 7265 7475 726e 206d 6d61 705f ....return mmap_ │ │ │ +0005a950: 6469 736b 5f69 6f5f 636f 6e73 7472 7563 disk_io_construc │ │ │ +0005a960: 746f 7228 696f 732c 2073 6574 742c 2063 tor(ios, sett, c │ │ │ +0005a970: 6e74 293b 0a09 0965 6c73 650a 0909 0972 nt);...else....r │ │ │ +0005a980: 6574 7572 6e20 706f 7369 785f 6469 736b eturn posix_disk │ │ │ +0005a990: 5f69 6f5f 636f 6e73 7472 7563 746f 7228 _io_constructor( │ │ │ +0005a9a0: 696f 732c 2073 6574 742c 2063 6e74 293b ios, sett, cnt); │ │ │ +0005a9b0: 0a23 696e 636c 7564 6520 226c 6962 746f .#include "libto │ │ │ +0005a9c0: 7272 656e 742f 6175 785f 2f64 6973 6162 rrent/aux_/disab │ │ │ +0005a9d0: 6c65 5f77 6172 6e69 6e67 735f 706f 702e le_warnings_pop. │ │ │ +0005a9e0: 6870 7022 0a23 656c 7365 0a09 0972 6574 hpp".#else...ret │ │ │ +0005a9f0: 7572 6e20 706f 7369 785f 6469 736b 5f69 urn posix_disk_i │ │ │ +0005aa00: 6f5f 636f 6e73 7472 7563 746f 7228 696f o_constructor(io │ │ │ +0005aa10: 732c 2073 6574 742c 2063 6e74 293b 0a23 s, sett, cnt);.# │ │ │ +0005aa20: 656e 6469 660a 097d 0a0a 7d0a 3c2f 7072 endif..}..}.rel │ │ │ +0005aa60: 6576 616e 6365 266e 6273 703b 303c 2f74 evance 0../src/ut │ │ │ +0005aaa0: 705f 736f 636b 6574 5f6d 616e 6167 6572 p_socket_manager │ │ │ +0005aab0: 2e63 7070 3a32 3034 3c2f 613e 3c2f 7464 .cpp:204this should │ │ │ +0005aad0: 206e 6f74 2062 6520 6865 6170 2061 6c6c not be heap all │ │ │ +0005aae0: 6f63 6174 6564 2c20 736f 636b 6574 7320 ocated, sockets │ │ │ +0005aaf0: 7368 6f75 6c64 2062 6520 6d6f 7661 626c should be movabl │ │ │ +0005ab00: 653c 2f74 643e 3c2f 7472 3e3c 7472 2069 e

    t │ │ │ +0005ab50: 6869 7320 7368 6f75 6c64 206e 6f74 2062 his should not b │ │ │ +0005ab60: 6520 6865 6170 2061 6c6c 6f63 6174 6564 e heap allocated │ │ │ +0005ab70: 2c20 736f 636b 6574 7320 7368 6f75 6c64 , sockets should │ │ │ +0005ab80: 2062 6520 6d6f 7661 626c 653c 2f68 323e be movable

    │ │ │ +0005ab90: 3c68 343e 2e2e 2f73 7263 2f75 7470 5f73

    ../src/utp_s │ │ │ +0005aba0: 6f63 6b65 745f 6d61 6e61 6765 722e 6370 ocket_manager.cp │ │ │ +0005abb0: 703a 3230 343c 2f68 343e 3c70 7265 2073 p:204

    .//..UTP_LOG
    │ │ │ +0005ac00: 5628 2269 6e63 6f6d 696e 6720 7061 636b  V("incoming pack
    │ │ │ +0005ac10: 6574 2069 643a 2564 2073 6f75 7263 653a  et id:%d source:
    │ │ │ +0005ac20: 2573 5c6e 222c 2069 642c 2070 7269 6e74  %s\n", id, print
    │ │ │ +0005ac30: 5f65 6e64 706f 696e 7428 6570 292e 635f  _endpoint(ep).c_
    │ │ │ +0005ac40: 7374 7228 2929 3b0a 0a09 0969 6620 2821  str());....if (!
    │ │ │ +0005ac50: 6d5f 7365 7474 2e67 6574 5f62 6f6f 6c28  m_sett.get_bool(
    │ │ │ +0005ac60: 7365 7474 696e 6773 5f70 6163 6b3a 3a65  settings_pack::e
    │ │ │ +0005ac70: 6e61 626c 655f 696e 636f 6d69 6e67 5f75  nable_incoming_u
    │ │ │ +0005ac80: 7470 2929 0a09 0909 7265 7475 726e 2066  tp))....return f
    │ │ │ +0005ac90: 616c 7365 3b0a 0a09 092f 2f20 6966 206e  alse;....// if n
    │ │ │ +0005aca0: 6f74 2066 6f75 6e64 2c20 7365 6520 6966  ot found, see if
    │ │ │ +0005acb0: 2069 7427 7320 6120 5359 4e20 7061 636b   it's a SYN pack
    │ │ │ +0005acc0: 6574 2c20 6966 2069 7420 6973 2c0a 0909  et, if it is,...
    │ │ │ +0005acd0: 2f2f 2063 7265 6174 6520 6120 6e65 7720  // create a new 
    │ │ │ +0005ace0: 7574 705f 7374 7265 616d 0a09 0969 6620  utp_stream...if 
    │ │ │ +0005acf0: 2870 682d 2667 743b 6765 745f 7479 7065  (ph->get_type
    │ │ │ +0005ad00: 2829 203d 3d20 5354 5f53 594e 290a 0909  () == ST_SYN)...
    │ │ │ +0005ad10: 7b0a 0909 092f 2f20 706f 7373 6962 6c65  {....// possible
    │ │ │ +0005ad20: 2053 594e 2066 6c6f 6f64 2e20 4a75 7374   SYN flood. Just
    │ │ │ +0005ad30: 2069 676e 6f72 650a 0909 0969 6620 2869   ignore....if (i
    │ │ │ +0005ad40: 6e74 286d 5f75 7470 5f73 6f63 6b65 7473  nt(m_utp_sockets
    │ │ │ +0005ad50: 2e73 697a 6528 2929 2026 6774 3b20 6d5f  .size()) > m_
    │ │ │ +0005ad60: 7365 7474 2e67 6574 5f69 6e74 2873 6574  sett.get_int(set
    │ │ │ +0005ad70: 7469 6e67 735f 7061 636b 3a3a 636f 6e6e  tings_pack::conn
    │ │ │ +0005ad80: 6563 7469 6f6e 735f 6c69 6d69 7429 202a  ections_limit) *
    │ │ │ +0005ad90: 2032 290a 0909 0909 7265 7475 726e 2066   2).....return f
    │ │ │ +0005ada0: 616c 7365 3b0a 0a09 0909 544f 5252 454e  alse;.....TORREN
    │ │ │ +0005adb0: 545f 4153 5345 5254 286d 5f6e 6577 5f63  T_ASSERT(m_new_c
    │ │ │ +0005adc0: 6f6e 6e65 6374 696f 6e20 3d3d 202d 3129  onnection == -1)
    │ │ │ +0005add0: 3b0a 0909 092f 2f20 6372 6561 7465 2074  ;....// create t
    │ │ │ +0005ade0: 6865 206e 6577 2073 6f63 6b65 7420 7769  he new socket wi
    │ │ │ +0005adf0: 7468 2074 6869 7320 4944 0a09 0909 6d5f  th this ID....m_
    │ │ │ +0005ae00: 6e65 775f 636f 6e6e 6563 7469 6f6e 203d  new_connection =
    │ │ │ +0005ae10: 2069 643b 0a0a 2f2f 0909 0955 5450 5f4c   id;..//...UTP_L
    │ │ │ +0005ae20: 4f47 5628 226e 6f74 2066 6f75 6e64 2c20  OGV("not found, 
    │ │ │ +0005ae30: 6e65 7720 636f 6e6e 6563 7469 6f6e 2069  new connection i
    │ │ │ +0005ae40: 643a 2564 5c6e 222c 206d 5f6e 6577 5f63  d:%d\n", m_new_c
    │ │ │ +0005ae50: 6f6e 6e65 6374 696f 6e29 3b0a 0a3c 6469  onnection);.....au
    │ │ │ +0005ae90: 783a 3a73 6f63 6b65 745f 7479 7065 2063  x::socket_type c
    │ │ │ +0005aea0: 2861 7578 3a3a 696e 7374 616e 7469 6174  (aux::instantiat
    │ │ │ +0005aeb0: 655f 636f 6e6e 6563 7469 6f6e 286d 5f69  e_connection(m_i
    │ │ │ +0005aec0: 6f73 2c20 6175 783a 3a70 726f 7879 5f73  os, aux::proxy_s
    │ │ │ +0005aed0: 6574 7469 6e67 7328 292c 206d 5f73 736c  ettings(), m_ssl
    │ │ │ +0005aee0: 5f63 6f6e 7465 7874 2c20 7468 6973 2c20  _context, this, 
    │ │ │ +0005aef0: 7472 7565 2c20 6661 6c73 6529 293b 0a3c  true, false));.<
    │ │ │ +0005af00: 2f64 6976 3e0a 0909 0975 7470 5f73 7472  /div>....utp_str
    │ │ │ +0005af10: 6561 6d2a 2073 7472 203d 206e 756c 6c70  eam* str = nullp
    │ │ │ +0005af20: 7472 3b0a 2369 6664 6566 2054 4f52 5245  tr;.#ifdef TORRE
    │ │ │ +0005af30: 4e54 5f53 534c 5f50 4545 5253 0a09 0909  NT_SSL_PEERS....
    │ │ │ +0005af40: 6966 2028 6973 5f73 736c 2863 2929 0a09  if (is_ssl(c))..
    │ │ │ +0005af50: 0909 0973 7472 203d 2026 616d 703b 626f  ...str = &bo
    │ │ │ +0005af60: 6f73 743a 3a67 6574 266c 743b 7373 6c5f  ost::get<ssl_
    │ │ │ +0005af70: 7374 7265 616d 266c 743b 7574 705f 7374  stream<utp_st
    │ │ │ +0005af80: 7265 616d 2667 743b 2667 743b 2863 292e  ream>>(c).
    │ │ │ +0005af90: 6e65 7874 5f6c 6179 6572 2829 3b0a 0909  next_layer();...
    │ │ │ +0005afa0: 0965 6c73 650a 2365 6e64 6966 0a09 0909  .else.#endif....
    │ │ │ +0005afb0: 0973 7472 203d 2062 6f6f 7374 3a3a 6765  .str = boost::ge
    │ │ │ +0005afc0: 7426 6c74 3b75 7470 5f73 7472 6561 6d26  t<utp_stream&
    │ │ │ +0005afd0: 6774 3b28 2661 6d70 3b63 293b 0a0a 0909  gt;(&c);....
    │ │ │ +0005afe0: 0954 4f52 5245 4e54 5f41 5353 4552 5428  .TORRENT_ASSERT(
    │ │ │ +0005aff0: 7374 7229 3b0a 0909 0969 6e74 2063 6f6e  str);....int con
    │ │ │ +0005b000: 7374 206d 7475 203d 206d 7475 5f66 6f72  st mtu = mtu_for
    │ │ │ +0005b010: 5f64 6573 7428 6570 2e61 6464 7265 7373  _dest(ep.address
    │ │ │ +0005b020: 2829 293b 0a09 0909 7374 722d 2667 743b  ());....str->
    │ │ │ +0005b030: 6765 745f 696d 706c 2829 2d26 6774 3b69  get_impl()->i
    │ │ │ +0005b040: 6e69 745f 6d74 7528 6d74 7529 3b0a 0909  nit_mtu(mtu);...
    │ │ │ +0005b050: 0973 7472 2d26 6774 3b67 6574 5f69 6d70  .str->get_imp
    │ │ │ +0005b060: 6c28 292d 2667 743b 6d5f 736f 636b 203d  l()->m_sock =
    │ │ │ +0005b070: 2073 7464 3a3a 6d6f 7665 2873 6f63 6b65   std::move(socke
    │ │ │ +0005b080: 7429 3b0a 0909 0962 6f6f 6c20 636f 6e73  t);....bool cons
    │ │ │ +0005b090: 7420 7265 7420 3d20 7374 722d 2667 743b  t ret = str->
    │ │ │ +0005b0a0: 6765 745f 696d 706c 2829 2d26 6774 3b69  get_impl()->i
    │ │ │ +0005b0b0: 6e63 6f6d 696e 675f 7061 636b 6574 2870  ncoming_packet(p
    │ │ │ +0005b0c0: 2c20 6570 2c20 7265 6365 6976 655f 7469  , ep, receive_ti
    │ │ │ +0005b0d0: 6d65 293b 0a09 0909 6966 2028 2172 6574  me);....if (!ret
    │ │ │ +0005b0e0: 2920 7265 7475 726e 2066 616c 7365 3b0a  ) return false;.
    │ │ │ +0005b0f0: 0909 096d 5f6c 6173 745f 736f 636b 6574  ...m_last_socket
    │ │ │ +0005b100: 203d 2073 7472 2d26 6774 3b67 6574 5f69   = str->get_i
    │ │ │ +0005b110: 6d70 6c28 293b 0a09 0909 6d5f 6362 2873  mpl();....m_cb(s
    │ │ │ +0005b120: 7464 3a3a 6d6f 7665 2863 2929 3b0a 0909  td::move(c));...
    │ │ │ +0005b130: 092f 2f20 7468 6520 636f 6e6e 6563 7469  .// the connecti
    │ │ │ +0005b140: 6f6e 206d 6f73 7420 6c69 6b65 6c79 2063  on most likely c
    │ │ │ +0005b150: 6861 6e67 6564 2069 7473 2063 6f6e 6e65  hanged its conne
    │ │ │ +0005b160: 6374 696f 6e20 4944 2068 6572 650a 0909  ction ID here...
    │ │ │ +0005b170: 092f 2f20 7765 206e 6565 6420 746f 206d  .// we need to m
    │ │ │ +0005b180: 6f76 6520 6974 2074 6f20 7468 6520 636f  ove it to the co
    │ │ │ +0005b190: 7272 6563 7420 4944 0a09 0909 7265 7475  rrect ID....retu
    │ │ │ +0005b1a0: 726e 2074 7275 653b 0a09 097d 0a0a 0909  rn true;...}....
    │ │ │ +0005b1b0: 6966 2028 7068 2d26 6774 3b67 6574 5f74  if (ph->get_t
    │ │ │ +0005b1c0: 7970 6528 2920 3d3d 2053 545f 5245 5345  ype() == ST_RESE
    │ │ │ +0005b1d0: 5429 2072 6574 7572 6e20 6661 6c73 653b  T) return false;
    │ │ │ +0005b1e0: 0a0a 0909 2f2f 2023 6572 726f 7220 7365  ....// #error se
    │ │ │ +0005b1f0: 6e64 2072 6573 6574 0a0a 0909 7265 7475  nd reset....retu
    │ │ │ +0005b200: 726e 2066 616c 7365 3b0a 097d 0a0a 0976  rn false;..}...v
    │ │ │ +0005b210: 6f69 6420 7574 705f 736f 636b 6574 5f6d  oid utp_socket_m
    │ │ │ +0005b220: 616e 6167 6572 3a3a 7375 6273 6372 6962  anager::subscrib
    │ │ │ +0005b230: 655f 7772 6974 6162 6c65 2875 7470 5f73  e_writable(utp_s
    │ │ │ +0005b240: 6f63 6b65 745f 696d 706c 2a20 7329 0a3c  ocket_impl* s).<
    │ │ │ +0005b250: 2f70 7265 3e3c 2f74 643e 3c2f 7472 3e3c  /pre><
    │ │ │ +0005b260: 7472 2073 7479 6c65 3d22 6261 636b 6772  tr style="backgr
    │ │ │ +0005b270: 6f75 6e64 3a20 2363 6363 223e 3c74 643e  ound: #ccc">
    │ │ │ +0005b280: 7265 6c65 7661 6e63 6526 6e62 7370 3b30  relevance 0
    │ │ │ +0005b290: 3c2f 7464 3e3c 7464 3e3c 6120 6872 6566  ../src
    │ │ │ +0005b2c0: 2f73 6d61 7274 5f62 616e 2e63 7070 3a31  /smart_ban.cpp:1
    │ │ │ +0005b2d0: 3738 3c2f 613e 3c2f 7464 3e3c 7464 3e72  78r
    │ │ │ +0005b2e0: 6570 6c61 6365 2077 6974 6820 7374 643a  eplace with std:
    │ │ │ +0005b2f0: 3a65 7261 7365 5f69 6628 2920 6f6e 6365  :erase_if() once
    │ │ │ +0005b300: 2077 6520 7265 7175 6972 6520 432b 2b32   we require C++2
    │ │ │ +0005b310: 303c 2f74 643e 3c2f 7472 3e3c 7472 2069  0

    r │ │ │ +0005b360: 6570 6c61 6365 2077 6974 6820 7374 643a eplace with std: │ │ │ +0005b370: 3a65 7261 7365 5f69 6628 2920 6f6e 6365 :erase_if() once │ │ │ +0005b380: 2077 6520 7265 7175 6972 6520 432b 2b32 we require C++2 │ │ │ +0005b390: 303c 2f68 323e 3c68 343e 2e2e 2f73 7263 0

    ../src │ │ │ +0005b3a0: 2f73 6d61 7274 5f62 616e 2e63 7070 3a31 /smart_ban.cpp:1 │ │ │ +0005b3b0: 3738 3c2f 6834 3e3c 7072 6520 7374 796c 78

    ......, disk_in
    │ │ │ +0005b400: 7465 7266 6163 653a 3a66 6f72 6365 5f63  terface::force_c
    │ │ │ +0005b410: 6f70 7929 3b0a 0909 0909 7d0a 0a09 0909  opy);.....}.....
    │ │ │ +0005b420: 0972 2e73 7461 7274 202b 3d20 3136 2a31  .r.start += 16*1
    │ │ │ +0005b430: 3032 343b 0a09 0909 0973 697a 6520 2d3d  024;.....size -=
    │ │ │ +0005b440: 2031 362a 3130 3234 3b0a 0909 0909 722e   16*1024;.....r.
    │ │ │ +0005b450: 6c65 6e67 7468 203d 2073 7464 3a3a 6d69  length = std::mi
    │ │ │ +0005b460: 6e28 3136 2a31 3032 342c 2073 697a 6529  n(16*1024, size)
    │ │ │ +0005b470: 3b0a 0909 0909 2b2b 7062 2e62 6c6f 636b  ;.....++pb.block
    │ │ │ +0005b480: 5f69 6e64 6578 3b0a 0909 097d 0a09 0909  _index;....}....
    │ │ │ +0005b490: 544f 5252 454e 545f 4153 5345 5254 2873  TORRENT_ASSERT(s
    │ │ │ +0005b4a0: 697a 6520 266c 743b 3d20 3029 3b0a 0909  ize <= 0);...
    │ │ │ +0005b4b0: 7d0a 0a09 092f 2f20 6e6f 7420 6465 636c  }....// not decl
    │ │ │ +0005b4c0: 6172 6564 206f 6e20 746f 7272 656e 745f  ared on torrent_
    │ │ │ +0005b4d0: 706c 7567 696e 2028 776f 756c 6420 7265  plugin (would re
    │ │ │ +0005b4e0: 7175 6972 6520 616e 2041 4249 2d62 7265  quire an ABI-bre
    │ │ │ +0005b4f0: 616b 696e 6720 6e65 770a 0909 2f2f 2076  aking new...// v
    │ │ │ +0005b500: 6972 7475 616c 292e 2043 616c 6c65 6420  irtual). Called 
    │ │ │ +0005b510: 7669 6120 6120 646f 776e 6361 7374 2069  via a downcast i
    │ │ │ +0005b520: 6e20 746f 7272 656e 743a 3a70 6565 7273  n torrent::peers
    │ │ │ +0005b530: 5f65 7261 7365 6428 2920 e280 9420 7365  _erased() ... se
    │ │ │ +0005b540: 650a 0909 2f2f 2073 6d61 7274 5f62 616e  e...// smart_ban
    │ │ │ +0005b550: 5f6e 6f74 6966 795f 6572 6173 655f 7065  _notify_erase_pe
    │ │ │ +0005b560: 6572 7328 2920 6265 6c6f 770a 0909 766f  ers() below...vo
    │ │ │ +0005b570: 6964 206f 6e5f 6572 6173 655f 7065 6572  id on_erase_peer
    │ │ │ +0005b580: 7328 7370 616e 266c 743b 746f 7272 656e  s(span<torren
    │ │ │ +0005b590: 745f 7065 6572 2a20 636f 6e73 7426 6774  t_peer* const>
    │ │ │ +0005b5a0: 3b20 7065 6572 7329 0a09 097b 0a09 0909  ; peers)...{....
    │ │ │ +0005b5b0: 6966 2028 6d5f 626c 6f63 6b5f 6861 7368  if (m_block_hash
    │ │ │ +0005b5c0: 6573 2e65 6d70 7479 2829 207c 7c20 7065  es.empty() || pe
    │ │ │ +0005b5d0: 6572 732e 656d 7074 7928 2929 2072 6574  ers.empty()) ret
    │ │ │ +0005b5e0: 7572 6e3b 0a0a 0909 0973 7464 3a3a 7665  urn;.....std::ve
    │ │ │ +0005b5f0: 6374 6f72 266c 743b 746f 7272 656e 745f  ctor<torrent_
    │ │ │ +0005b600: 7065 6572 2a26 6774 3b20 6572 6173 6564  peer*> erased
    │ │ │ +0005b610: 2870 6565 7273 2e62 6567 696e 2829 2c20  (peers.begin(), 
    │ │ │ +0005b620: 7065 6572 732e 656e 6428 2929 3b0a 0909  peers.end());...
    │ │ │ +0005b630: 0973 7464 3a3a 736f 7274 2865 7261 7365  .std::sort(erase
    │ │ │ +0005b640: 642e 6265 6769 6e28 292c 2065 7261 7365  d.begin(), erase
    │ │ │ +0005b650: 642e 656e 6428 2929 3b0a 3c64 6976 2073  d.end());.
    ...for ( │ │ │ +0005b690: 6175 746f 2069 203d 206d 5f62 6c6f 636b auto i = m_block │ │ │ +0005b6a0: 5f68 6173 6865 732e 6265 6769 6e28 293b _hashes.begin(); │ │ │ +0005b6b0: 2069 2021 3d20 6d5f 626c 6f63 6b5f 6861 i != m_block_ha │ │ │ +0005b6c0: 7368 6573 2e65 6e64 2829 3b29 0a3c 2f64 shes.end();)....{.....if ( │ │ │ +0005b6e0: 7374 643a 3a62 696e 6172 795f 7365 6172 std::binary_sear │ │ │ +0005b6f0: 6368 2865 7261 7365 642e 6265 6769 6e28 ch(erased.begin( │ │ │ +0005b700: 292c 2065 7261 7365 642e 656e 6428 292c ), erased.end(), │ │ │ +0005b710: 2069 2d26 6774 3b73 6563 6f6e 642e 7065 i->second.pe │ │ │ +0005b720: 6572 2929 0a09 0909 0909 6920 3d20 6d5f er))......i = m_ │ │ │ +0005b730: 626c 6f63 6b5f 6861 7368 6573 2e65 7261 block_hashes.era │ │ │ +0005b740: 7365 2869 293b 0a09 0909 0965 6c73 650a se(i);.....else. │ │ │ +0005b750: 0909 0909 092b 2b69 3b0a 0909 097d 0a09 .....++i;....}.. │ │ │ +0005b760: 097d 0a0a 0970 7269 7661 7465 3a0a 0a09 .}...private:... │ │ │ +0005b770: 092f 2f20 7468 6973 2065 6e74 7279 2074 .// this entry t │ │ │ +0005b780: 6965 7320 6120 7370 6563 6966 6963 2062 ies a specific b │ │ │ +0005b790: 6c6f 636b 2043 5243 2074 6f0a 0909 2f2f lock CRC to...// │ │ │ +0005b7a0: 2061 2070 6565 722e 0a09 0973 7472 7563 a peer....struc │ │ │ +0005b7b0: 7420 626c 6f63 6b5f 656e 7472 790a 0909 t block_entry... │ │ │ +0005b7c0: 7b0a 0909 0974 6f72 7265 6e74 5f70 6565 {....torrent_pee │ │ │ +0005b7d0: 722a 2070 6565 723b 0a09 0909 7368 6131 r* peer;....sha1 │ │ │ +0005b7e0: 5f68 6173 6820 6469 6765 7374 3b0a 0909 _hash digest;... │ │ │ +0005b7f0: 7d3b 0a0a 0909 766f 6964 206f 6e5f 7265 };....void on_re │ │ │ +0005b800: 6164 5f66 6169 6c65 645f 626c 6f63 6b28 ad_failed_block( │ │ │ +0005b810: 7069 6563 655f 626c 6f63 6b20 636f 6e73 piece_block cons │ │ │ +0005b820: 7420 622c 2061 6464 7265 7373 2063 6f6e t b, address con │ │ │ +0005b830: 7374 2061 0a09 0909 2c20 6469 736b 5f62 st a...., disk_b │ │ │ +0005b840: 7566 6665 725f 686f 6c64 6572 2062 7566 uffer_holder buf │ │ │ +0005b850: 6665 722c 2069 6e74 2063 6f6e 7374 2062 fer, int const b │ │ │ +0005b860: 6c6f 636b 5f73 697a 650a 0909 092c 2073 lock_size...., s │ │ │ +0005b870: 746f 7261 6765 5f65 7272 6f72 2063 6f6e torage_error con │ │ │ +0005b880: 7374 2661 6d70 3b20 6572 726f 7229 0a09 st& error).. │ │ │ +0005b890: 097b 0a09 0909 544f 5252 454e 545f 4153 .{....TORRENT_AS │ │ │ +0005b8a0: 5345 5254 286d 5f74 6f72 7265 6e74 2e73 SERT(m_torrent.s │ │ │ +0005b8b0: 6573 7369 6f6e 2829 2e69 735f 7369 6e67 ession().is_sing │ │ │ +0005b8c0: 6c65 5f74 6872 6561 6428 2929 3b0a 0a09 le_thread());... │ │ │ +0005b8d0: 0909 2f2f 2069 676e 6f72 6520 7265 6164 ..// ignore read │ │ │ +0005b8e0: 2065 7272 6f72 730a 0909 0969 6620 2865 errors....if (e │ │ │ +0005b8f0: 7272 6f72 2920 7265 7475 726e 3b0a 0a09 rror) return;... │ │ │ +0005b900: 0909 6861 7368 6572 2068 3b0a 0909 0968 ..hasher h;....h │ │ │ +0005b910: 2e75 7064 6174 6528 7b62 7566 6665 722e .update({buffer. │ │ │ +0005b920: 6461 7461 2829 2c20 626c 6f63 6b5f 7369 data(), block_si │ │ │ +0005b930: 7a65 7d29 3b0a 0a3c 2f70 7265 3e3c 2f74 ze});..
    relevanc │ │ │ +0005b970: 6526 6e62 7370 3b30 3c2f 7464 3e3c 7464 e 0../src/ut_meta │ │ │ +0005b9b0: 6461 7461 2e63 7070 3a32 3831 3c2f 613e data.cpp:281 │ │ │ +0005b9c0: 3c2f 7464 3e3c 7464 3e77 6520 7265 616c we real │ │ │ +0005b9d0: 6c79 206e 6565 6420 746f 2069 6e63 7265 ly need to incre │ │ │ +0005b9e0: 6d65 6e74 2074 6865 2072 6566 636f 756e ment the refcoun │ │ │ +0005b9f0: 7465 7220 6f6e 2074 6865 2074 6f72 7265 ter on the torre │ │ │ +0005ba00: 6e74 2077 6869 6c65 2074 6869 7320 6275 nt while this bu │ │ │ +0005ba10: 6666 6572 2069 7320 7374 696c 6c20 696e ffer is still in │ │ │ +0005ba20: 2074 6865 2070 6565 7227 7320 7365 6e64 the peer's send │ │ │ +0005ba30: 2062 7566 6665 723c 2f74 643e 3c2f 7472 buffer

    we really n │ │ │ +0005ba90: 6565 6420 746f 2069 6e63 7265 6d65 6e74 eed to increment │ │ │ +0005baa0: 2074 6865 2072 6566 636f 756e 7465 7220 the refcounter │ │ │ +0005bab0: 6f6e 2074 6865 2074 6f72 7265 6e74 0a77 on the torrent.w │ │ │ +0005bac0: 6869 6c65 2074 6869 7320 6275 6666 6572 hile this buffer │ │ │ +0005bad0: 2069 7320 7374 696c 6c20 696e 2074 6865 is still in the │ │ │ +0005bae0: 2070 6565 7227 7320 7365 6e64 2062 7566 peer's send buf │ │ │ +0005baf0: 6665 723c 2f68 323e 3c68 343e 2e2e 2f73 fer

    ../s │ │ │ +0005bb00: 7263 2f75 745f 6d65 7461 6461 7461 2e63 rc/ut_metadata.c │ │ │ +0005bb10: 7070 3a32 3831 3c2f 6834 3e3c 7072 6520 pp:281

    ....int con
    │ │ │ +0005bb60: 7374 206f 6666 7365 7420 3d20 7069 6563  st offset = piec
    │ │ │ +0005bb70: 6520 2a20 3136 202a 2031 3032 343b 0a09  e * 16 * 1024;..
    │ │ │ +0005bb80: 0909 096d 6574 6164 6174 6120 3d20 6d5f  ...metadata = m_
    │ │ │ +0005bb90: 7470 2e6d 6574 6164 6174 6128 292e 6461  tp.metadata().da
    │ │ │ +0005bba0: 7461 2829 202b 206f 6666 7365 743b 0a09  ta() + offset;..
    │ │ │ +0005bbb0: 0909 096d 6574 6164 6174 615f 7069 6563  ...metadata_piec
    │ │ │ +0005bbc0: 655f 7369 7a65 203d 2073 7464 3a3a 6d69  e_size = std::mi
    │ │ │ +0005bbd0: 6e28 0a09 0909 0909 696e 7428 6d5f 7470  n(......int(m_tp
    │ │ │ +0005bbe0: 2e6d 6574 6164 6174 6128 292e 7369 7a65  .metadata().size
    │ │ │ +0005bbf0: 2829 2920 2d20 6f66 6673 6574 2c20 3136  ()) - offset, 16
    │ │ │ +0005bc00: 202a 2031 3032 3429 3b0a 0909 0909 544f   * 1024);.....TO
    │ │ │ +0005bc10: 5252 454e 545f 4153 5345 5254 286d 6574  RRENT_ASSERT(met
    │ │ │ +0005bc20: 6164 6174 615f 7069 6563 655f 7369 7a65  adata_piece_size
    │ │ │ +0005bc30: 2026 6774 3b20 3029 3b0a 0909 0909 544f   > 0);.....TO
    │ │ │ +0005bc40: 5252 454e 545f 4153 5345 5254 286f 6666  RRENT_ASSERT(off
    │ │ │ +0005bc50: 7365 7420 2667 743b 3d20 3029 3b0a 0909  set >= 0);...
    │ │ │ +0005bc60: 0909 544f 5252 454e 545f 4153 5345 5254  ..TORRENT_ASSERT
    │ │ │ +0005bc70: 286f 6666 7365 7420 2b20 6d65 7461 6461  (offset + metada
    │ │ │ +0005bc80: 7461 5f70 6965 6365 5f73 697a 6520 266c  ta_piece_size &l
    │ │ │ +0005bc90: 743b 3d20 6d5f 7470 2e6d 6574 6164 6174  t;= m_tp.metadat
    │ │ │ +0005bca0: 6128 292e 7369 7a65 2829 293b 0a09 0909  a().size());....
    │ │ │ +0005bcb0: 7d0a 0a09 0909 6368 6172 206d 7367 5b32  }.....char msg[2
    │ │ │ +0005bcc0: 3030 5d3b 0a09 0909 6368 6172 2a20 6865  00];....char* he
    │ │ │ +0005bcd0: 6164 6572 203d 206d 7367 3b0a 0909 0963  ader = msg;....c
    │ │ │ +0005bce0: 6861 722a 2070 203d 2026 616d 703b 6d73  har* p = &ms
    │ │ │ +0005bcf0: 675b 365d 3b0a 0909 0969 6e74 2063 6f6e  g[6];....int con
    │ │ │ +0005bd00: 7374 206c 656e 203d 2062 656e 636f 6465  st len = bencode
    │ │ │ +0005bd10: 2870 2c20 6529 3b0a 0909 0969 6e74 2063  (p, e);....int c
    │ │ │ +0005bd20: 6f6e 7374 2074 6f74 616c 5f73 697a 6520  onst total_size 
    │ │ │ +0005bd30: 3d20 3220 2b20 6c65 6e20 2b20 6d65 7461  = 2 + len + meta
    │ │ │ +0005bd40: 6461 7461 5f70 6965 6365 5f73 697a 653b  data_piece_size;
    │ │ │ +0005bd50: 0a09 0909 6e61 6d65 7370 6163 6520 696f  ....namespace io
    │ │ │ +0005bd60: 203d 2061 7578 3b0a 0909 0969 6f3a 3a77   = aux;....io::w
    │ │ │ +0005bd70: 7269 7465 5f75 696e 7433 3228 746f 7461  rite_uint32(tota
    │ │ │ +0005bd80: 6c5f 7369 7a65 2c20 6865 6164 6572 293b  l_size, header);
    │ │ │ +0005bd90: 0a09 0909 696f 3a3a 7772 6974 655f 7569  ....io::write_ui
    │ │ │ +0005bda0: 6e74 3828 6274 5f70 6565 725f 636f 6e6e  nt8(bt_peer_conn
    │ │ │ +0005bdb0: 6563 7469 6f6e 3a3a 6d73 675f 6578 7465  ection::msg_exte
    │ │ │ +0005bdc0: 6e64 6564 2c20 6865 6164 6572 293b 0a09  nded, header);..
    │ │ │ +0005bdd0: 0909 696f 3a3a 7772 6974 655f 7569 6e74  ..io::write_uint
    │ │ │ +0005bde0: 3828 6d5f 6d65 7373 6167 655f 696e 6465  8(m_message_inde
    │ │ │ +0005bdf0: 782c 2068 6561 6465 7229 3b0a 0a09 0909  x, header);.....
    │ │ │ +0005be00: 6d5f 7063 2e73 656e 645f 6275 6666 6572  m_pc.send_buffer
    │ │ │ +0005be10: 287b 6d73 672c 206c 656e 202b 2036 7d29  ({msg, len + 6})
    │ │ │ +0005be20: 3b0a 3c64 6976 2073 7479 6c65 3d22 6261  ;.
    │ │ │ +0005be50: 0909 0969 6620 286d 6574 6164 6174 615f ...if (metadata_ │ │ │ +0005be60: 7069 6563 655f 7369 7a65 290a 3c2f 6469 piece_size)....{.....m_pc. │ │ │ +0005be80: 6170 7065 6e64 5f63 6f6e 7374 5f73 656e append_const_sen │ │ │ +0005be90: 645f 6275 6666 6572 280a 0909 0909 0973 d_buffer(......s │ │ │ +0005bea0: 7061 6e26 6c74 3b63 6861 7226 6774 3b28 pan<char>( │ │ │ +0005beb0: 636f 6e73 745f 6361 7374 266c 743b 6368 const_cast<ch │ │ │ +0005bec0: 6172 2a26 6774 3b28 6d65 7461 6461 7461 ar*>(metadata │ │ │ +0005bed0: 292c 206d 6574 6164 6174 615f 7069 6563 ), metadata_piec │ │ │ +0005bee0: 655f 7369 7a65 292c 206d 6574 6164 6174 e_size), metadat │ │ │ +0005bef0: 615f 7069 6563 655f 7369 7a65 293b 0a09 a_piece_size);.. │ │ │ +0005bf00: 0909 7d0a 0a09 0909 6d5f 7063 2e73 7461 ..}.....m_pc.sta │ │ │ +0005bf10: 7473 5f63 6f75 6e74 6572 7328 292e 696e ts_counters().in │ │ │ +0005bf20: 635f 7374 6174 735f 636f 756e 7465 7228 c_stats_counter( │ │ │ +0005bf30: 636f 756e 7465 7273 3a3a 6e75 6d5f 6f75 counters::num_ou │ │ │ +0005bf40: 7467 6f69 6e67 5f65 7874 656e 6465 6429 tgoing_extended) │ │ │ +0005bf50: 3b0a 0909 096d 5f70 632e 7374 6174 735f ;....m_pc.stats_ │ │ │ +0005bf60: 636f 756e 7465 7273 2829 2e69 6e63 5f73 counters().inc_s │ │ │ +0005bf70: 7461 7473 5f63 6f75 6e74 6572 2863 6f75 tats_counter(cou │ │ │ +0005bf80: 6e74 6572 733a 3a6e 756d 5f6f 7574 676f nters::num_outgo │ │ │ +0005bf90: 696e 675f 6d65 7461 6461 7461 293b 0a09 ing_metadata);.. │ │ │ +0005bfa0: 097d 0a0a 0909 626f 6f6c 206f 6e5f 6578 .}....bool on_ex │ │ │ +0005bfb0: 7465 6e64 6564 2869 6e74 2063 6f6e 7374 tended(int const │ │ │ +0005bfc0: 206c 656e 6774 680a 0909 092c 2069 6e74 length...., int │ │ │ +0005bfd0: 2063 6f6e 7374 2065 7874 656e 6465 645f const extended_ │ │ │ +0005bfe0: 6d73 672c 2073 7061 6e26 6c74 3b63 6861 msg, span<cha │ │ │ +0005bff0: 7220 636f 6e73 7426 6774 3b20 626f 6479 r const> body │ │ │ +0005c000: 2920 6f76 6572 7269 6465 0a09 097b 0a09 ) override...{.. │ │ │ +0005c010: 0909 6966 2028 6578 7465 6e64 6564 5f6d ..if (extended_m │ │ │ +0005c020: 7367 2021 3d20 3229 2072 6574 7572 6e20 sg != 2) return │ │ │ +0005c030: 6661 6c73 653b 0a09 0909 6966 2028 6d5f false;....if (m_ │ │ │ +0005c040: 6d65 7373 6167 655f 696e 6465 7820 3d3d message_index == │ │ │ +0005c050: 2030 2920 7265 7475 726e 2066 616c 7365 0) return false │ │ │ +0005c060: 3b0a 0a09 0909 6966 2028 6c65 6e67 7468 ;.....if (length │ │ │ +0005c070: 2026 6774 3b20 3137 202a 2031 3032 3429 > 17 * 1024) │ │ │ +0005c080: 0a09 0909 7b0a 2369 666e 6465 6620 544f ....{.#ifndef TO │ │ │ +0005c090: 5252 454e 545f 4449 5341 424c 455f 4c4f RRENT_DISABLE_LO │ │ │ +0005c0a0: 4747 494e 470a 0909 0909 6d5f 7063 2e70 GGING.....m_pc.p │ │ │ +0005c0b0: 6565 725f 6c6f 6728 7065 6572 5f6c 6f67 eer_log(peer_log │ │ │ +0005c0c0: 5f61 6c65 7274 3a3a 696e 636f 6d69 6e67 _alert::incoming │ │ │ +0005c0d0: 5f6d 6573 7361 6765 2c20 2255 545f 4d45 _message, "UT_ME │ │ │ +0005c0e0: 5441 4441 5441 220a 0909 0909 092c 2022 TADATA"......, " │ │ │ +0005c0f0: 7061 636b 6574 2074 6f6f 2062 6967 2025 packet too big % │ │ │ +0005c100: 6422 2c20 6c65 6e67 7468 293b 0a23 656e d", length);.#en │ │ │ +0005c110: 6469 660a 0909 0909 6d5f 7063 2e64 6973 dif.....m_pc.dis │ │ │ +0005c120: 636f 6e6e 6563 7428 6572 726f 7273 3a3a connect(errors:: │ │ │ +0005c130: 696e 7661 6c69 645f 6d65 7461 6461 7461 invalid_metadata │ │ │ +0005c140: 5f6d 6573 7361 6765 2c20 6f70 6572 6174 _message, operat │ │ │ +0005c150: 696f 6e5f 743a 3a62 6974 746f 7272 656e ion_t::bittorren │ │ │ +0005c160: 742c 2070 6565 725f 636f 6e6e 6563 7469 t, peer_connecti │ │ │ +0005c170: 6f6e 5f69 6e74 6572 6661 6365 3a3a 7065 on_interface::pe │ │ │ +0005c180: 6572 5f65 7272 6f72 293b 0a09 0909 0972 er_error);.....r │ │ │ +0005c190: 6574 7572 6e20 7472 7565 3b0a 0909 097d eturn true;....} │ │ │ +0005c1a0: 0a0a 0909 0969 6620 2821 6d5f 7063 2e70 .....if (!m_pc.p │ │ │ +0005c1b0: 6163 6b65 745f 6669 6e69 7368 6564 2829 acket_finished() │ │ │ +0005c1c0: 2920 7265 7475 726e 2074 7275 653b 0a0a ) return true;.. │ │ │ +0005c1d0: 0909 0965 7272 6f72 5f63 6f64 6520 6563 ...error_code ec │ │ │ +0005c1e0: 3b0a 0909 0962 6465 636f 6465 5f6e 6f64 ;....bdecode_nod │ │ │ +0005c1f0: 6520 6d73 6720 3d20 6264 6563 6f64 6528 e msg = bdecode( │ │ │ +0005c200: 626f 6479 2c20 6563 293b 0a09 0909 6966 body, ec);....if │ │ │ +0005c210: 2028 6d73 672e 7479 7065 2829 2021 3d20 (msg.type() != │ │ │ +0005c220: 6264 6563 6f64 655f 6e6f 6465 3a3a 6469 bdecode_node::di │ │ │ +0005c230: 6374 5f74 290a 3c2f 7072 653e 3c2f 7464 ct_t).
    relevance │ │ │ +0005c270: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ +0005c280: 3c61 2068 7265 663d 226a 6176 6173 6372 ../src/disabled │ │ │ +0005c2b0: 5f64 6973 6b5f 696f 2e63 7070 3a31 3036 _disk_io.cpp:106 │ │ │ +0005c2c0: 3c2f 613e 3c2f 7464 3e3c 7464 3e69 7420 it │ │ │ +0005c2d0: 776f 756c 6420 6265 206e 6963 6520 746f would be nice to │ │ │ +0005c2e0: 2072 6574 7572 6e20 6120 7661 6c69 6420 return a valid │ │ │ +0005c2f0: 6861 7368 206f 6620 7a65 726f 6573 2068 hash of zeroes h │ │ │ +0005c300: 6572 653c 2f74 643e 3c2f 7472 3e3c 7472 ere

    it would be nic │ │ │ +0005c360: 6520 746f 2072 6574 7572 6e20 6120 7661 e to return a va │ │ │ +0005c370: 6c69 6420 6861 7368 206f 6620 7a65 726f lid hash of zero │ │ │ +0005c380: 6573 2068 6572 653c 2f68 323e 3c68 343e es here

    │ │ │ +0005c390: 2e2e 2f73 7263 2f64 6973 6162 6c65 645f ../src/disabled_ │ │ │ +0005c3a0: 6469 736b 5f69 6f2e 6370 703a 3130 363c disk_io.cpp:106< │ │ │ +0005c3b0: 2f68 343e 3c70 7265 2073 7479 6c65 3d22 /h4>
    ..
    │ │ │ +0005c3f0: 7d29 3b0a 097d 0a0a 0962 6f6f 6c20 6173  });..}...bool as
    │ │ │ +0005c400: 796e 635f 7772 6974 6528 7374 6f72 6167  ync_write(storag
    │ │ │ +0005c410: 655f 696e 6465 785f 740a 0909 2c20 7065  e_index_t..., pe
    │ │ │ +0005c420: 6572 5f72 6571 7565 7374 2063 6f6e 7374  er_request const
    │ │ │ +0005c430: 2661 6d70 3b20 720a 0909 2c20 6368 6172  & r..., char
    │ │ │ +0005c440: 2063 6f6e 7374 2a2c 2073 7464 3a3a 7368   const*, std::sh
    │ │ │ +0005c450: 6172 6564 5f70 7472 266c 743b 6469 736b  ared_ptr<disk
    │ │ │ +0005c460: 5f6f 6273 6572 7665 7226 6774 3b0a 0909  _observer>...
    │ │ │ +0005c470: 2c20 7374 643a 3a66 756e 6374 696f 6e26  , std::function&
    │ │ │ +0005c480: 6c74 3b76 6f69 6428 7374 6f72 6167 655f  lt;void(storage_
    │ │ │ +0005c490: 6572 726f 7220 636f 6e73 7426 616d 703b  error const&
    │ │ │ +0005c4a0: 2926 6774 3b20 6861 6e64 6c65 720a 0909  )> handler...
    │ │ │ +0005c4b0: 2c20 6469 736b 5f6a 6f62 5f66 6c61 6773  , disk_job_flags
    │ │ │ +0005c4c0: 5f74 2920 6f76 6572 7269 6465 0a09 7b0a  _t) override..{.
    │ │ │ +0005c4d0: 0909 544f 5252 454e 545f 4153 5345 5254  ..TORRENT_ASSERT
    │ │ │ +0005c4e0: 2872 2e6c 656e 6774 6820 266c 743b 3d20  (r.length <= 
    │ │ │ +0005c4f0: 6465 6661 756c 745f 626c 6f63 6b5f 7369  default_block_si
    │ │ │ +0005c500: 7a65 293b 0a09 0954 4f52 5245 4e54 5f55  ze);...TORRENT_U
    │ │ │ +0005c510: 4e55 5345 4428 7229 3b0a 0a09 0970 6f73  NUSED(r);....pos
    │ │ │ +0005c520: 7428 6d5f 696f 732c 205b 6820 3d20 7374  t(m_ios, [h = st
    │ │ │ +0005c530: 643a 3a6d 6f76 6528 6861 6e64 6c65 7229  d::move(handler)
    │ │ │ +0005c540: 5d20 7b20 6828 7374 6f72 6167 655f 6572  ] { h(storage_er
    │ │ │ +0005c550: 726f 727b 7d29 3b20 7d29 3b0a 0909 7265  ror{}); });...re
    │ │ │ +0005c560: 7475 726e 2066 616c 7365 3b0a 097d 0a0a  turn false;..}..
    │ │ │ +0005c570: 0976 6f69 6420 6173 796e 635f 6861 7368  .void async_hash
    │ │ │ +0005c580: 2873 746f 7261 6765 5f69 6e64 6578 5f74  (storage_index_t
    │ │ │ +0005c590: 0a09 092c 2070 6965 6365 5f69 6e64 6578  ..., piece_index
    │ │ │ +0005c5a0: 5f74 2070 6965 6365 2c20 7370 616e 266c  _t piece, span&l
    │ │ │ +0005c5b0: 743b 7368 6132 3536 5f68 6173 6826 6774  t;sha256_hash>
    │ │ │ +0005c5c0: 3b2c 2064 6973 6b5f 6a6f 625f 666c 6167  ;, disk_job_flag
    │ │ │ +0005c5d0: 735f 740a 0909 2c20 7374 643a 3a66 756e  s_t..., std::fun
    │ │ │ +0005c5e0: 6374 696f 6e26 6c74 3b76 6f69 6428 7069  ction<void(pi
    │ │ │ +0005c5f0: 6563 655f 696e 6465 785f 742c 2073 6861  ece_index_t, sha
    │ │ │ +0005c600: 315f 6861 7368 2063 6f6e 7374 2661 6d70  1_hash const&
    │ │ │ +0005c610: 3b2c 2073 746f 7261 6765 5f65 7272 6f72  ;, storage_error
    │ │ │ +0005c620: 2063 6f6e 7374 2661 6d70 3b29 2667 743b   const&)>
    │ │ │ +0005c630: 2068 616e 646c 6572 2920 6f76 6572 7269   handler) overri
    │ │ │ +0005c640: 6465 0a09 7b0a 3c64 6976 2073 7479 6c65  de..{.
    ..post(m_ios │ │ │ +0005c680: 2c20 5b68 203d 2073 7464 3a3a 6d6f 7665 , [h = std::move │ │ │ +0005c690: 2868 616e 646c 6572 292c 2070 6965 6365 (handler), piece │ │ │ +0005c6a0: 5d20 7b20 6828 7069 6563 652c 2073 6861 ] { h(piece, sha │ │ │ +0005c6b0: 315f 6861 7368 7b7d 2c20 7374 6f72 6167 1_hash{}, storag │ │ │ +0005c6c0: 655f 6572 726f 727b 7d29 3b20 7d29 3b0a e_error{}); });. │ │ │ +0005c6d0: 3c2f 6469 763e 097d 0a0a 0976 6f69 6420
    .}...void │ │ │ +0005c6e0: 6173 796e 635f 6861 7368 3228 7374 6f72 async_hash2(stor │ │ │ +0005c6f0: 6167 655f 696e 6465 785f 742c 2070 6965 age_index_t, pie │ │ │ +0005c700: 6365 5f69 6e64 6578 5f74 2070 6965 6365 ce_index_t piece │ │ │ +0005c710: 2c20 696e 740a 0909 2c20 6469 736b 5f6a , int..., disk_j │ │ │ +0005c720: 6f62 5f66 6c61 6773 5f74 0a09 092c 2073 ob_flags_t..., s │ │ │ +0005c730: 7464 3a3a 6675 6e63 7469 6f6e 266c 743b td::function< │ │ │ +0005c740: 766f 6964 2870 6965 6365 5f69 6e64 6578 void(piece_index │ │ │ +0005c750: 5f74 2c20 7368 6132 3536 5f68 6173 6820 _t, sha256_hash │ │ │ +0005c760: 636f 6e73 7426 616d 703b 2c20 7374 6f72 const&, stor │ │ │ +0005c770: 6167 655f 6572 726f 7220 636f 6e73 7426 age_error const& │ │ │ +0005c780: 616d 703b 2926 6774 3b20 6861 6e64 6c65 amp;)> handle │ │ │ +0005c790: 7229 206f 7665 7272 6964 650a 097b 0a09 r) override..{.. │ │ │ +0005c7a0: 0970 6f73 7428 6d5f 696f 732c 205b 6820 .post(m_ios, [h │ │ │ +0005c7b0: 3d20 7374 643a 3a6d 6f76 6528 6861 6e64 = std::move(hand │ │ │ +0005c7c0: 6c65 7229 2c20 7069 6563 655d 2829 207b ler), piece]() { │ │ │ +0005c7d0: 2068 2870 6965 6365 2c20 7368 6132 3536 h(piece, sha256 │ │ │ +0005c7e0: 5f68 6173 687b 7d2c 2073 746f 7261 6765 _hash{}, storage │ │ │ +0005c7f0: 5f65 7272 6f72 7b7d 293b 207d 293b 0a09 _error{}); });.. │ │ │ +0005c800: 7d0a 0a09 766f 6964 2061 7379 6e63 5f6d }...void async_m │ │ │ +0005c810: 6f76 655f 7374 6f72 6167 6528 7374 6f72 ove_storage(stor │ │ │ +0005c820: 6167 655f 696e 6465 785f 740a 0909 2c20 age_index_t..., │ │ │ +0005c830: 7374 643a 3a73 7472 696e 6720 702c 206d std::string p, m │ │ │ +0005c840: 6f76 655f 666c 6167 735f 740a 0909 2c20 ove_flags_t..., │ │ │ +0005c850: 7374 643a 3a66 756e 6374 696f 6e26 6c74 std::function< │ │ │ +0005c860: 3b76 6f69 6428 7374 6174 7573 5f74 2c20 ;void(status_t, │ │ │ +0005c870: 7374 643a 3a73 7472 696e 6720 636f 6e73 std::string cons │ │ │ +0005c880: 7426 616d 703b 2c20 7374 6f72 6167 655f t&, storage_ │ │ │ +0005c890: 6572 726f 7220 636f 6e73 7426 616d 703b error const& │ │ │ +0005c8a0: 2926 6774 3b20 6861 6e64 6c65 7229 206f )> handler) o │ │ │ +0005c8b0: 7665 7272 6964 650a 097b 0a09 0970 6f73 verride..{...pos │ │ │ +0005c8c0: 7428 6d5f 696f 732c 205b 6820 3d20 7374 t(m_ios, [h = st │ │ │ +0005c8d0: 643a 3a6d 6f76 6528 6861 6e64 6c65 7229 d::move(handler) │ │ │ +0005c8e0: 2c20 7061 7468 203d 2073 7464 3a3a 6d6f , path = std::mo │ │ │ +0005c8f0: 7665 2870 295d 2028 2920 6d75 7461 626c ve(p)] () mutabl │ │ │ +0005c900: 650a 0909 097b 2068 2873 7461 7475 735f e....{ h(status_ │ │ │ +0005c910: 743a 3a6e 6f5f 6572 726f 722c 2073 7464 t::no_error, std │ │ │ +0005c920: 3a3a 6d6f 7665 2870 6174 6829 2c20 7374 ::move(path), st │ │ │ +0005c930: 6f72 6167 655f 6572 726f 727b 7d29 3b20 orage_error{}); │ │ │ +0005c940: 7d29 3b0a 097d 0a0a 0976 6f69 6420 6173 });..}...void as │ │ │ +0005c950: 796e 635f 7265 6c65 6173 655f 6669 6c65 ync_release_file │ │ │ +0005c960: 7328 7374 6f72 6167 655f 696e 6465 785f s(storage_index_ │ │ │ +0005c970: 742c 2073 7464 3a3a 6675 6e63 7469 6f6e t, std::function │ │ │ +0005c980: 266c 743b 766f 6964 2829 2667 743b 2068 <void()> h │ │ │ +0005c990: 616e 646c 6572 2920 6f76 6572 7269 6465 andler) override │ │ │ +0005c9a0: 0a09 7b0a 0909 706f 7374 286d 5f69 6f73 ..{...post(m_ios │ │ │ +0005c9b0: 2c20 5b68 203d 2073 7464 3a3a 6d6f 7665 , [h = std::move │ │ │ +0005c9c0: 2868 616e 646c 6572 295d 207b 2068 2829 (handler)] { h() │ │ │ +0005c9d0: 3b20 7d29 3b0a 097d 0a0a 0976 6f69 6420 ; });..}...void │ │ │ +0005c9e0: 6173 796e 635f 6465 6c65 7465 5f66 696c async_delete_fil │ │ │ +0005c9f0: 6573 2873 746f 7261 6765 5f69 6e64 6578 es(storage_index │ │ │ +0005ca00: 5f74 0a09 092c 2072 656d 6f76 655f 666c _t..., remove_fl │ │ │ +0005ca10: 6167 735f 742c 2073 7464 3a3a 6675 6e63 ags_t, std::func │ │ │ +0005ca20: 7469 6f6e 266c 743b 766f 6964 2873 746f tion<void(sto │ │ │ +0005ca30: 7261 6765 5f65 7272 6f72 2063 6f6e 7374 rage_error const │ │ │ +0005ca40: 2661 6d70 3b29 2667 743b 2068 616e 646c &)> handl │ │ │ +0005ca50: 6572 2920 6f76 6572 7269 6465 0a09 7b0a er) override..{. │ │ │ +0005ca60: 0909 706f 7374 286d 5f69 6f73 2c20 5b68 ..post(m_ios, [h │ │ │ +0005ca70: 203d 2073 7464 3a3a 6d6f 7665 2868 616e = std::move(han │ │ │ +0005ca80: 646c 6572 295d 207b 2068 2873 746f 7261 dler)] { h(stora │ │ │ +0005ca90: 6765 5f65 7272 6f72 7b7d 293b 207d 293b ge_error{}); }); │ │ │ +0005caa0: 0a09 7d0a 0a09 766f 6964 2061 7379 6e63 ..}...void async │ │ │ +0005cab0: 5f63 6865 636b 5f66 696c 6573 2873 746f _check_files(sto │ │ │ +0005cac0: 7261 6765 5f69 6e64 6578 5f74 0a09 092c rage_index_t..., │ │ │ +0005cad0: 2061 6464 5f74 6f72 7265 6e74 5f70 6172 add_torrent_par │ │ │ +0005cae0: 616d 7320 636f 6e73 742a 0a3c 2f70 7265 ams const*.
    rele │ │ │ +0005cb20: 7661 6e63 6526 6e62 7370 3b30 3c2f 7464 vance 0../src/pie │ │ │ +0005cb60: 6365 5f70 6963 6b65 722e 6370 703a 3132 ce_picker.cpp:12 │ │ │ +0005cb70: 313c 2f61 3e3c 2f74 643e 3c74 643e 6669 1fi │ │ │ +0005cb80: 6e64 2061 2062 6574 7465 7220 706c 6163 nd a better plac │ │ │ +0005cb90: 6520 666f 7220 7468 6973 3c2f 7464 3e3c e for this< │ │ │ +0005cba0: 2f74 723e 3c74 7220 6964 3d22 3231 3522 /tr>

    find a b │ │ │ +0005cbf0: 6574 7465 7220 706c 6163 6520 666f 7220 etter place for │ │ │ +0005cc00: 7468 6973 3c2f 6832 3e3c 6834 3e2e 2e2f this

    ../ │ │ │ +0005cc10: 7372 632f 7069 6563 655f 7069 636b 6572 src/piece_picker │ │ │ +0005cc20: 2e63 7070 3a31 3231 3c2f 6834 3e3c 7072 .cpp:121

    ...if (li │ │ │ +0005cc70: 6d69 7420 3d3d 2030 290a 0909 097b 0a09 mit == 0)....{.. │ │ │ +0005cc80: 0909 0973 7464 3a3a 6365 7272 2026 6c74 ...std::cerr < │ │ │ +0005cc90: 3b26 6c74 3b20 2220 2e2e 2e22 3b0a 0909 ;< " ...";... │ │ │ +0005cca0: 0909 6272 6561 6b3b 0a09 0909 7d0a 0909 ..break;....}... │ │ │ +0005ccb0: 0969 6620 282a 6920 3d3d 202d 3129 2062 .if (*i == -1) b │ │ │ +0005ccc0: 7265 616b 3b0a 0909 0977 6869 6c65 2028 reak;....while ( │ │ │ +0005ccd0: 6a20 213d 2070 2e6d 5f70 7269 6f72 6974 j != p.m_priorit │ │ │ +0005cce0: 795f 626f 756e 6461 7269 6573 2e65 6e64 y_boundaries.end │ │ │ +0005ccf0: 2829 2026 616d 703b 2661 6d70 3b20 2a6a () && *j │ │ │ +0005cd00: 2026 6c74 3b3d 2069 6e64 6578 290a 0909 <= index)... │ │ │ +0005cd10: 097b 0a09 0909 0973 7464 3a3a 6365 7272 .{.....std::cerr │ │ │ +0005cd20: 2026 6c74 3b26 6c74 3b20 227c 2022 3b0a << "| ";. │ │ │ +0005cd30: 0909 0909 2b2b 6a3b 0a09 0909 7d0a 0909 ....++j;....}... │ │ │ +0005cd40: 0973 7464 3a3a 6365 7272 2026 6c74 3b26 .std::cerr <& │ │ │ +0005cd50: 6c74 3b20 2a69 2026 6c74 3b26 6c74 3b20 lt; *i << │ │ │ +0005cd60: 2228 2220 266c 743b 266c 743b 2070 2e6d "(" << p.m │ │ │ +0005cd70: 5f70 6965 6365 5f6d 6170 5b2a 695d 2e69 _piece_map[*i].i │ │ │ +0005cd80: 6e64 6578 2026 6c74 3b26 6c74 3b20 2229 ndex << ") │ │ │ +0005cd90: 2022 3b0a 0909 092d 2d6c 696d 6974 3b0a ";....--limit;. │ │ │ +0005cda0: 0909 7d0a 0909 7374 643a 3a63 6572 7220 ..}...std::cerr │ │ │ +0005cdb0: 266c 743b 266c 743b 2073 7464 3a3a 656e << std::en │ │ │ +0005cdc0: 646c 3b0a 097d 0a7d 0a23 656e 6469 6620 dl;..}.}.#endif │ │ │ +0005cdd0: 2f2f 2054 4f52 5245 4e54 5f50 4943 4b45 // TORRENT_PICKE │ │ │ +0005cde0: 525f 4c4f 470a 6e61 6d65 7370 6163 6520 R_LOG.namespace │ │ │ +0005cdf0: 6c69 6274 6f72 7265 6e74 207b 0a0a 3c64 libtorrent {...con │ │ │ +0005ce30: 7374 2070 6965 6365 5f62 6c6f 636b 2070 st piece_block p │ │ │ +0005ce40: 6965 6365 5f62 6c6f 636b 3a3a 696e 7661 iece_block::inva │ │ │ +0005ce50: 6c69 6428 0a3c 2f64 6976 3e09 0973 7464 lid(...std │ │ │ +0005ce60: 3a3a 6e75 6d65 7269 635f 6c69 6d69 7473 ::numeric_limits │ │ │ +0005ce70: 266c 743b 7069 6563 655f 696e 6465 785f <piece_index_ │ │ │ +0005ce80: 7426 6774 3b3a 3a6d 6178 2829 0a09 092c t>::max()..., │ │ │ +0005ce90: 2073 7464 3a3a 6e75 6d65 7269 635f 6c69 std::numeric_li │ │ │ +0005cea0: 6d69 7473 266c 743b 696e 7426 6774 3b3a mits<int>: │ │ │ +0005ceb0: 3a6d 6178 2829 293b 0a0a 0963 6f6e 7374 :max());...const │ │ │ +0005cec0: 6578 7072 2070 7269 6f5f 696e 6465 785f expr prio_index_ │ │ │ +0005ced0: 7420 7069 6563 655f 7069 636b 6572 3a3a t piece_picker:: │ │ │ +0005cee0: 7069 6563 655f 706f 733a 3a77 655f 6861 piece_pos::we_ha │ │ │ +0005cef0: 7665 5f69 6e64 6578 3b0a 0a09 636f 6e73 ve_index;...cons │ │ │ +0005cf00: 7465 7870 7220 7069 636b 6572 5f6f 7074 texpr picker_opt │ │ │ +0005cf10: 696f 6e73 5f74 2070 6965 6365 5f70 6963 ions_t piece_pic │ │ │ +0005cf20: 6b65 723a 3a72 6172 6573 745f 6669 7273 ker::rarest_firs │ │ │ +0005cf30: 743b 0a09 636f 6e73 7465 7870 7220 7069 t;..constexpr pi │ │ │ +0005cf40: 636b 6572 5f6f 7074 696f 6e73 5f74 2070 cker_options_t p │ │ │ +0005cf50: 6965 6365 5f70 6963 6b65 723a 3a72 6576 iece_picker::rev │ │ │ +0005cf60: 6572 7365 3b0a 0963 6f6e 7374 6578 7072 erse;..constexpr │ │ │ +0005cf70: 2070 6963 6b65 725f 6f70 7469 6f6e 735f picker_options_ │ │ │ +0005cf80: 7420 7069 6563 655f 7069 636b 6572 3a3a t piece_picker:: │ │ │ +0005cf90: 6f6e 5f70 6172 6f6c 653b 0a09 636f 6e73 on_parole;..cons │ │ │ +0005cfa0: 7465 7870 7220 7069 636b 6572 5f6f 7074 texpr picker_opt │ │ │ +0005cfb0: 696f 6e73 5f74 2070 6965 6365 5f70 6963 ions_t piece_pic │ │ │ +0005cfc0: 6b65 723a 3a70 7269 6f72 6974 697a 655f ker::prioritize_ │ │ │ +0005cfd0: 7061 7274 6961 6c73 3b0a 0963 6f6e 7374 partials;..const │ │ │ +0005cfe0: 6578 7072 2070 6963 6b65 725f 6f70 7469 expr picker_opti │ │ │ +0005cff0: 6f6e 735f 7420 7069 6563 655f 7069 636b ons_t piece_pick │ │ │ +0005d000: 6572 3a3a 7365 7175 656e 7469 616c 3b0a er::sequential;. │ │ │ +0005d010: 0963 6f6e 7374 6578 7072 2070 6963 6b65 .constexpr picke │ │ │ +0005d020: 725f 6f70 7469 6f6e 735f 7420 7069 6563 r_options_t piec │ │ │ +0005d030: 655f 7069 636b 6572 3a3a 616c 6967 6e5f e_picker::align_ │ │ │ +0005d040: 6578 7061 6e64 6564 5f70 6965 6365 733b expanded_pieces; │ │ │ +0005d050: 0a09 636f 6e73 7465 7870 7220 7069 636b ..constexpr pick │ │ │ +0005d060: 6572 5f6f 7074 696f 6e73 5f74 2070 6965 er_options_t pie │ │ │ +0005d070: 6365 5f70 6963 6b65 723a 3a70 6965 6365 ce_picker::piece │ │ │ +0005d080: 5f65 7874 656e 745f 6166 6669 6e69 7479 _extent_affinity │ │ │ +0005d090: 3b0a 0a09 636f 6e73 7465 7870 7220 646f ;...constexpr do │ │ │ +0005d0a0: 776e 6c6f 6164 5f71 7565 7565 5f74 2070 wnload_queue_t p │ │ │ +0005d0b0: 6965 6365 5f70 6963 6b65 723a 3a70 6965 iece_picker::pie │ │ │ +0005d0c0: 6365 5f70 6f73 3a3a 7069 6563 655f 646f ce_pos::piece_do │ │ │ +0005d0d0: 776e 6c6f 6164 696e 673b 0a09 636f 6e73 wnloading;..cons │ │ │ +0005d0e0: 7465 7870 7220 646f 776e 6c6f 6164 5f71 texpr download_q │ │ │ +0005d0f0: 7565 7565 5f74 2070 6965 6365 5f70 6963 ueue_t piece_pic │ │ │ +0005d100: 6b65 723a 3a70 6965 6365 5f70 6f73 3a3a ker::piece_pos:: │ │ │ +0005d110: 7069 6563 655f 6675 6c6c 3b0a 0963 6f6e piece_full;..con │ │ │ +0005d120: 7374 6578 7072 2064 6f77 6e6c 6f61 645f stexpr download_ │ │ │ +0005d130: 7175 6575 655f 7420 7069 6563 655f 7069 queue_t piece_pi │ │ │ +0005d140: 636b 6572 3a3a 7069 6563 655f 706f 733a cker::piece_pos: │ │ │ +0005d150: 3a70 6965 6365 5f66 696e 6973 6865 643b :piece_finished; │ │ │ +0005d160: 0a09 636f 6e73 7465 7870 7220 646f 776e ..constexpr down │ │ │ +0005d170: 6c6f 6164 5f71 7565 7565 5f74 2070 6965 load_queue_t pie │ │ │ +0005d180: 6365 5f70 6963 6b65 723a 3a70 6965 6365 ce_picker::piece │ │ │ +0005d190: 5f70 6f73 3a3a 7069 6563 655f 7a65 726f _pos::piece_zero │ │ │ +0005d1a0: 5f70 7269 6f3b 0a09 636f 6e73 7465 7870 _prio;..constexp │ │ │ +0005d1b0: 7220 646f 776e 6c6f 6164 5f71 7565 7565 r download_queue │ │ │ +0005d1c0: 5f74 2070 6965 6365 5f70 6963 6b65 723a _t piece_picker: │ │ │ +0005d1d0: 3a70 6965 6365 5f70 6f73 3a3a 6e75 6d5f :piece_pos::num_ │ │ │ +0005d1e0: 646f 776e 6c6f 6164 5f63 6174 6567 6f72 download_categor │ │ │ +0005d1f0: 6965 733b 0a09 636f 6e73 7465 7870 7220 ies;..constexpr │ │ │ +0005d200: 646f 776e 6c6f 6164 5f71 7565 7565 5f74 download_queue_t │ │ │ +0005d210: 2070 6965 6365 5f70 6963 6b65 723a 3a70 piece_picker::p │ │ │ +0005d220: 6965 6365 5f70 6f73 3a3a 7069 6563 655f iece_pos::piece_ │ │ │ +0005d230: 6f70 656e 3b0a 0963 6f6e 7374 6578 7072 open;..constexpr │ │ │ +0005d240: 2064 6f77 6e6c 6f61 645f 7175 6575 655f download_queue_ │ │ │ +0005d250: 7420 7069 6563 655f 7069 636b 6572 3a3a t piece_picker:: │ │ │ +0005d260: 7069 6563 655f 706f 733a 3a70 6965 6365 piece_pos::piece │ │ │ +0005d270: 5f64 6f77 6e6c 6f61 6469 6e67 5f72 6576 _downloading_rev │ │ │ +0005d280: 6572 7365 3b0a 0963 6f6e 7374 6578 7072 erse;..constexpr │ │ │ +0005d290: 2064 6f77 6e6c 6f61 645f 7175 6575 655f download_queue_ │ │ │ +0005d2a0: 7420 7069 6563 655f 7069 636b 6572 3a3a t piece_picker:: │ │ │ +0005d2b0: 7069 6563 655f 706f 733a 3a70 6965 6365 piece_pos::piece │ │ │ +0005d2c0: 5f66 756c 6c5f 7265 7665 7273 653b 0a0a _full_reverse;.. │ │ │ +0005d2d0: 092f 2f20 7468 6520 6d61 7820 6e75 6d62 .// the max numb │ │ │ +0005d2e0: 6572 206f 6620 626c 6f63 6b73 2074 6f20 er of blocks to │ │ │ +0005d2f0: 6372 6561 7465 2061 6e20 6166 6669 6e69 create an affini │ │ │ +0005d300: 7479 2066 6f72 0a09 636f 6e73 7465 7870 ty for..constexp │ │ │ +0005d310: 7220 696e 7420 6d61 785f 7069 6563 655f r int max_piece_ │ │ │ +0005d320: 6166 6669 6e69 7479 5f65 7874 656e 7420 affinity_extent │ │ │ +0005d330: 3d20 3420 2a20 3130 3234 202a 2031 3032 = 4 * 1024 * 102 │ │ │ +0005d340: 3420 2f20 6465 6661 756c 745f 626c 6f63 4 / default_bloc │ │ │ +0005d350: 6b5f 7369 7a65 3b0a 0a09 7069 6563 655f k_size;...piece_ │ │ │ +0005d360: 7069 636b 6572 3a3a 7069 6563 655f 7069 picker::piece_pi │ │ │ +0005d370: 636b 6572 2873 7464 3a3a 696e 7436 345f cker(std::int64_ │ │ │ +0005d380: 7420 636f 6e73 7420 746f 7461 6c5f 7369 t const total_si │ │ │ +0005d390: 7a65 2c20 696e 7420 636f 6e73 7420 7069 ze, int const pi │ │ │ +0005d3a0: 6563 655f 7369 7a65 290a 0909 3a20 6d5f ece_size)...: m_ │ │ │ +0005d3b0: 7072 696f 7269 7479 5f62 6f75 6e64 6172 priority_boundar │ │ │ +0005d3c0: 6965 7328 312c 206d 5f70 6965 6365 732e ies(1, m_pieces. │ │ │ +0005d3d0: 656e 645f 696e 6465 7828 2929 0a09 7b0a end_index())..{. │ │ │ +0005d3e0: 0909 544f 5252 454e 545f 4153 5345 5254 ..TORRENT_ASSERT │ │ │ +0005d3f0: 2874 6f74 616c 5f73 697a 6520 2667 743b (total_size > │ │ │ +0005d400: 2030 293b 0a09 0954 4f52 5245 4e54 5f41 0);...TORRENT_A │ │ │ +0005d410: 5353 4552 5428 7069 6563 655f 7369 7a65 SSERT(piece_size │ │ │ +0005d420: 2026 6774 3b20 3029 3b0a 3c2f 7072 653e > 0);.
    │ │ │ +0005d430: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ +0005d460: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ +0005d470: 3c74 643e 3c61 2068 7265 663d 226a 6176 ../src/piec │ │ │ +0005d4a0: 655f 7069 636b 6572 2e63 7070 3a32 3038 e_picker.cpp:208 │ │ │ +0005d4b0: 343c 2f61 3e3c 2f74 643e 3c74 643e 7468 4th │ │ │ +0005d4c0: 6973 2063 6f75 6c64 2070 726f 6261 626c is could probabl │ │ │ +0005d4d0: 7920 6265 206f 7074 696d 697a 6564 2062 y be optimized b │ │ │ +0005d4e0: 7920 696e 6372 656d 656e 7461 6c6c 7920 y incrementally │ │ │ +0005d4f0: 6361 6c6c 696e 6720 7061 7274 6961 6c5f calling partial_ │ │ │ +0005d500: 736f 7274 2074 6f20 736f 7274 206f 6e65 sort to sort one │ │ │ +0005d510: 206d 6f72 6520 656c 656d 656e 7420 696e more element in │ │ │ +0005d520: 2074 6865 206c 6973 742e 2042 6563 6175 the list. Becau │ │ │ +0005d530: 7365 2063 6861 6e63 6573 2061 7265 2074 se chances are t │ │ │ +0005d540: 6861 7420 7765 276c 6c20 6a75 7374 206e hat we'll just n │ │ │ +0005d550: 6565 6420 6120 7369 6e67 6c65 2070 6965 eed a single pie │ │ │ +0005d560: 6365 2c20 616e 6420 6f6e 6365 2077 6527 ce, and once we' │ │ │ +0005d570: 7665 2070 6963 6b65 6420 6672 6f6d 2069 ve picked from i │ │ │ +0005d580: 7420 7765 2772 6520 646f 6e65 2e20 536f t we're done. So │ │ │ +0005d590: 7274 696e 6720 7468 6520 7265 7374 206f rting the rest o │ │ │ +0005d5a0: 6620 7468 6520 6c69 7374 2069 6e20 7468 f the list in th │ │ │ +0005d5b0: 6174 2063 6173 6520 6973 2061 2077 6173 at case is a was │ │ │ +0005d5c0: 7465 206f 6620 7469 6d65 2e3c 2f74 643e te of time. │ │ │ +0005d5d0: 3c2f 7472 3e3c 7472 2069 643d 2232 3136

    this co │ │ │ +0005d620: 756c 6420 7072 6f62 6162 6c79 2062 6520 uld probably be │ │ │ +0005d630: 6f70 7469 6d69 7a65 6420 6279 2069 6e63 optimized by inc │ │ │ +0005d640: 7265 6d65 6e74 616c 6c79 0a63 616c 6c69 rementally.calli │ │ │ +0005d650: 6e67 2070 6172 7469 616c 5f73 6f72 7420 ng partial_sort │ │ │ +0005d660: 746f 2073 6f72 7420 6f6e 6520 6d6f 7265 to sort one more │ │ │ +0005d670: 2065 6c65 6d65 6e74 2069 6e20 7468 6520 element in the │ │ │ +0005d680: 6c69 7374 2e20 4265 6361 7573 650a 6368 list. Because.ch │ │ │ +0005d690: 616e 6365 7320 6172 6520 7468 6174 2077 ances are that w │ │ │ +0005d6a0: 6527 6c6c 206a 7573 7420 6e65 6564 2061 e'll just need a │ │ │ +0005d6b0: 2073 696e 676c 6520 7069 6563 652c 2061 single piece, a │ │ │ +0005d6c0: 6e64 206f 6e63 6520 7765 2776 650a 7069 nd once we've.pi │ │ │ +0005d6d0: 636b 6564 2066 726f 6d20 6974 2077 6527 cked from it we' │ │ │ +0005d6e0: 7265 2064 6f6e 652e 2053 6f72 7469 6e67 re done. Sorting │ │ │ +0005d6f0: 2074 6865 2072 6573 7420 6f66 2074 6865 the rest of the │ │ │ +0005d700: 206c 6973 7420 696e 2074 6861 740a 6361 list in that.ca │ │ │ +0005d710: 7365 2069 7320 6120 7761 7374 6520 6f66 se is a waste of │ │ │ +0005d720: 2074 696d 652e 3c2f 6832 3e3c 6834 3e2e time.

    . │ │ │ +0005d730: 2e2f 7372 632f 7069 6563 655f 7069 636b ./src/piece_pick │ │ │ +0005d740: 6572 2e63 7070 3a32 3038 343c 2f68 343e er.cpp:2084

    │ │ │ +0005d750: 3c70 7265 2073 7479 6c65 3d22 6261 636b
    ...// 
    │ │ │ +0005d790: 6e6f 772c 2063 6f70 7920 6f76 6572 2074  now, copy over t
    │ │ │ +0005d7a0: 6865 2070 6f69 6e74 6572 732e 2057 6520  he pointers. We 
    │ │ │ +0005d7b0: 616c 736f 2061 7070 6c79 2061 2066 696c  also apply a fil
    │ │ │ +0005d7c0: 7465 7220 6865 7265 2074 6f20 6e6f 740a  ter here to not.
    │ │ │ +0005d7d0: 0909 092f 2f20 696e 636c 7564 6520 696e  ...// include in
    │ │ │ +0005d7e0: 656c 6967 6962 6c65 2070 6965 6365 7320  eligible pieces 
    │ │ │ +0005d7f0: 696e 2063 6572 7461 696e 206d 6f64 6573  in certain modes
    │ │ │ +0005d800: 2e20 466f 7220 696e 7374 616e 6365 2c20  . For instance, 
    │ │ │ +0005d810: 6120 7069 6563 650a 0909 092f 2f20 7468  a piece....// th
    │ │ │ +0005d820: 6174 2074 6865 2063 7572 7265 6e74 2070  at the current p
    │ │ │ +0005d830: 6565 7220 646f 6573 6e27 7420 6861 7665  eer doesn't have
    │ │ │ +0005d840: 2069 7320 6e6f 7420 696e 636c 7564 6564   is not included
    │ │ │ +0005d850: 2e0a 0909 0966 6f72 2028 6175 746f 2661  .....for (auto&a
    │ │ │ +0005d860: 6d70 3b20 6470 203a 206d 5f64 6f77 6e6c  mp; dp : m_downl
    │ │ │ +0005d870: 6f61 6473 5b70 6965 6365 5f70 6f73 3a3a  oads[piece_pos::
    │ │ │ +0005d880: 7069 6563 655f 646f 776e 6c6f 6164 696e  piece_downloadin
    │ │ │ +0005d890: 675d 290a 0909 097b 0a09 0909 0970 632e  g])....{.....pc.
    │ │ │ +0005d8a0: 696e 635f 7374 6174 735f 636f 756e 7465  inc_stats_counte
    │ │ │ +0005d8b0: 7228 636f 756e 7465 7273 3a3a 7069 6563  r(counters::piec
    │ │ │ +0005d8c0: 655f 7069 636b 6572 5f70 6172 7469 616c  e_picker_partial
    │ │ │ +0005d8d0: 5f6c 6f6f 7073 293b 0a0a 0909 0909 6966  _loops);......if
    │ │ │ +0005d8e0: 2028 2169 735f 7069 6563 655f 6672 6565   (!is_piece_free
    │ │ │ +0005d8f0: 2864 702e 696e 6465 782c 2070 6965 6365  (dp.index, piece
    │ │ │ +0005d900: 7329 2920 636f 6e74 696e 7565 3b0a 0a09  s)) continue;...
    │ │ │ +0005d910: 0909 0954 4f52 5245 4e54 5f41 5353 4552  ...TORRENT_ASSER
    │ │ │ +0005d920: 5428 6d5f 7069 6563 655f 6d61 705b 6470  T(m_piece_map[dp
    │ │ │ +0005d930: 2e69 6e64 6578 5d2e 646f 776e 6c6f 6164  .index].download
    │ │ │ +0005d940: 5f71 7565 7565 2829 0a09 0909 0909 3d3d  _queue()......==
    │ │ │ +0005d950: 2070 6965 6365 5f70 6f73 3a3a 7069 6563   piece_pos::piec
    │ │ │ +0005d960: 655f 646f 776e 6c6f 6164 696e 6729 3b0a  e_downloading);.
    │ │ │ +0005d970: 0a09 0909 096f 7264 6572 6564 5f70 6172  .....ordered_par
    │ │ │ +0005d980: 7469 616c 735b 6e75 6d5f 6f72 6465 7265  tials[num_ordere
    │ │ │ +0005d990: 645f 7061 7274 6961 6c73 2b2b 5d20 3d20  d_partials++] = 
    │ │ │ +0005d9a0: 2661 6d70 3b64 703b 0a09 0909 7d0a 0a09  &dp;....}...
    │ │ │ +0005d9b0: 0909 2f2f 206e 6f77 2c20 736f 7274 2074  ..// now, sort t
    │ │ │ +0005d9c0: 6865 206c 6973 742e 0a09 0909 6966 2028  he list.....if (
    │ │ │ +0005d9d0: 6f70 7469 6f6e 7320 2661 6d70 3b20 7261  options & ra
    │ │ │ +0005d9e0: 7265 7374 5f66 6972 7374 290a 0909 097b  rest_first)....{
    │ │ │ +0005d9f0: 0a09 0909 0972 6574 207c 3d20 7069 636b  .....ret |= pick
    │ │ │ +0005da00: 6572 5f6c 6f67 5f61 6c65 7274 3a3a 7261  er_log_alert::ra
    │ │ │ +0005da10: 7265 7374 5f66 6972 7374 5f70 6172 7469  rest_first_parti
    │ │ │ +0005da20: 616c 733b 0a0a 3c64 6976 2073 7479 6c65  als;..
    ....std::sor │ │ │ +0005da60: 7428 6f72 6465 7265 645f 7061 7274 6961 t(ordered_partia │ │ │ +0005da70: 6c73 2e62 6567 696e 2829 2c20 6f72 6465 ls.begin(), orde │ │ │ +0005da80: 7265 645f 7061 7274 6961 6c73 2e62 6567 red_partials.beg │ │ │ +0005da90: 696e 2829 202b 206e 756d 5f6f 7264 6572 in() + num_order │ │ │ +0005daa0: 6564 5f70 6172 7469 616c 730a 3c2f 6469 ed_partials......, std::bi │ │ │ +0005dac0: 6e64 2826 616d 703b 7069 6563 655f 7069 nd(&piece_pi │ │ │ +0005dad0: 636b 6572 3a3a 7061 7274 6961 6c5f 636f cker::partial_co │ │ │ +0005dae0: 6d70 6172 655f 7261 7265 7374 5f66 6972 mpare_rarest_fir │ │ │ +0005daf0: 7374 2c20 7468 6973 0a09 0909 0909 092c st, this......., │ │ │ +0005db00: 205f 312c 205f 3229 293b 0a09 0909 7d0a _1, _2));....}. │ │ │ +0005db10: 0a09 0909 666f 7220 2869 6e74 2069 203d ....for (int i = │ │ │ +0005db20: 2030 3b20 6920 266c 743b 206e 756d 5f6f 0; i < num_o │ │ │ +0005db30: 7264 6572 6564 5f70 6172 7469 616c 733b rdered_partials; │ │ │ +0005db40: 202b 2b69 290a 0909 097b 0a09 0909 0972 ++i)....{.....r │ │ │ +0005db50: 6574 207c 3d20 7069 636b 6572 5f6c 6f67 et |= picker_log │ │ │ +0005db60: 5f61 6c65 7274 3a3a 7072 696f 7269 7469 _alert::prioriti │ │ │ +0005db70: 7a65 5f70 6172 7469 616c 733b 0a0a 0909 ze_partials;.... │ │ │ +0005db80: 0909 6e75 6d5f 626c 6f63 6b73 203d 2061 ..num_blocks = a │ │ │ +0005db90: 6464 5f62 6c6f 636b 735f 646f 776e 6c6f dd_blocks_downlo │ │ │ +0005dba0: 6164 696e 6728 2a6f 7264 6572 6564 5f70 ading(*ordered_p │ │ │ +0005dbb0: 6172 7469 616c 735b 695d 2c20 7069 6563 artials[i], piec │ │ │ +0005dbc0: 6573 0a09 0909 0909 2c20 696e 7465 7265 es......, intere │ │ │ +0005dbd0: 7374 696e 675f 626c 6f63 6b73 2c20 6261 sting_blocks, ba │ │ │ +0005dbe0: 636b 7570 5f62 6c6f 636b 732c 2062 6163 ckup_blocks, bac │ │ │ +0005dbf0: 6b75 705f 626c 6f63 6b73 320a 0909 0909 kup_blocks2..... │ │ │ +0005dc00: 092c 206e 756d 5f62 6c6f 636b 732c 2070 ., num_blocks, p │ │ │ +0005dc10: 7265 6665 725f 636f 6e74 6967 756f 7573 refer_contiguous │ │ │ +0005dc20: 5f62 6c6f 636b 732c 2070 6565 722c 206f _blocks, peer, o │ │ │ +0005dc30: 7074 696f 6e73 293b 0a09 0909 0969 6620 ptions);.....if │ │ │ +0005dc40: 286e 756d 5f62 6c6f 636b 7320 266c 743b (num_blocks < │ │ │ +0005dc50: 3d20 3029 2072 6574 7572 6e20 7265 743b = 0) return ret; │ │ │ +0005dc60: 0a09 0909 0969 6620 2869 6e74 2862 6163 .....if (int(bac │ │ │ +0005dc70: 6b75 705f 626c 6f63 6b73 2e73 697a 6528 kup_blocks.size( │ │ │ +0005dc80: 2929 2026 6774 3b3d 206e 756d 5f62 6c6f )) >= num_blo │ │ │ +0005dc90: 636b 730a 0909 0909 0926 616d 703b 2661 cks......&&a │ │ │ +0005dca0: 6d70 3b20 696e 7428 6261 636b 7570 5f62 mp; int(backup_b │ │ │ +0005dcb0: 6c6f 636b 7332 2e73 697a 6528 2929 2026 locks2.size()) & │ │ │ +0005dcc0: 6774 3b3d 206e 756d 5f62 6c6f 636b 7329 gt;= num_blocks) │ │ │ +0005dcd0: 0a09 0909 0909 6272 6561 6b3b 0a09 0909 ......break;.... │ │ │ +0005dce0: 7d0a 0a09 0909 6e75 6d5f 626c 6f63 6b73 }.....num_blocks │ │ │ +0005dcf0: 203d 2061 7070 656e 645f 626c 6f63 6b73 = append_blocks │ │ │ +0005dd00: 2869 6e74 6572 6573 7469 6e67 5f62 6c6f (interesting_blo │ │ │ +0005dd10: 636b 732c 2062 6163 6b75 705f 626c 6f63 cks, backup_bloc │ │ │ +0005dd20: 6b73 0a09 0909 092c 206e 756d 5f62 6c6f ks....., num_blo │ │ │ +0005dd30: 636b 7329 3b0a 0909 0969 6620 286e 756d cks);....if (num │ │ │ +0005dd40: 5f62 6c6f 636b 7320 266c 743b 3d20 3029 _blocks <= 0) │ │ │ +0005dd50: 2072 6574 7572 6e20 7265 743b 0a0a 0909 return ret;.... │ │ │ +0005dd60: 096e 756d 5f62 6c6f 636b 7320 3d20 6170 .num_blocks = ap │ │ │ +0005dd70: 7065 6e64 5f62 6c6f 636b 7328 696e 7465 pend_blocks(inte │ │ │ +0005dd80: 7265 7374 696e 675f 626c 6f63 6b73 2c20 resting_blocks, │ │ │ +0005dd90: 6261 636b 7570 5f62 6c6f 636b 7332 0a09 backup_blocks2.. │ │ │ +0005dda0: 0909 092c 206e 756d 5f62 6c6f 636b 7329 ..., num_blocks) │ │ │ +0005ddb0: 3b0a 0909 0969 6620 286e 756d 5f62 6c6f ;....if (num_blo │ │ │ +0005ddc0: 636b 7320 266c 743b 3d20 3029 2072 6574 cks <= 0) ret │ │ │ +0005ddd0: 7572 6e20 7265 743b 0a09 097d 0a0a 0909 urn ret;...}.... │ │ │ +0005dde0: 6966 2028 2173 7567 6765 7374 6564 5f70 if (!suggested_p │ │ │ +0005ddf0: 6965 6365 732e 656d 7074 7928 2929 0a09 ieces.empty()).. │ │ │ +0005de00: 097b 0a09 0909 666f 7220 2870 6965 6365 .{....for (piece │ │ │ +0005de10: 5f69 6e64 6578 5f74 2069 203a 2073 7567 _index_t i : sug │ │ │ +0005de20: 6765 7374 6564 5f70 6965 6365 7329 0a09 gested_pieces).. │ │ │ +0005de30: 0909 7b0a 3c2f 7072 653e 3c2f 7464 3e3c ..{.
    < │ │ │ +0005de40: 2f74 723e 3c74 7220 7374 796c 653d 2262 /tr>relevance&n │ │ │ +0005de70: 6273 703b 303c 2f74 643e 3c74 643e 3c61 bsp;0. │ │ │ +0005dea0: 2e2f 7372 632f 7069 6563 655f 7069 636b ./src/piece_pick │ │ │ +0005deb0: 6572 2e63 7070 3a32 3232 383c 2f61 3e3c er.cpp:2228< │ │ │ +0005dec0: 2f74 643e 3c74 643e 4973 2069 7420 6120 /td>Is it a │ │ │ +0005ded0: 676f 6f64 2069 6465 6120 7468 6174 2074 good idea that t │ │ │ +0005dee0: 6869 7320 6166 6669 6e69 7479 2074 616b his affinity tak │ │ │ +0005def0: 6573 2070 7265 6365 6465 6e63 6520 6f76 es precedence ov │ │ │ +0005df00: 6572 2070 6965 6365 2070 7269 6f72 6974 er piece priorit │ │ │ +0005df10: 793f 3c2f 7464 3e3c 2f74 723e 3c74 7220 y?

    │ │ │ +0005df60: 4973 2069 7420 6120 676f 6f64 2069 6465 Is it a good ide │ │ │ +0005df70: 6120 7468 6174 2074 6869 7320 6166 6669 a that this affi │ │ │ +0005df80: 6e69 7479 2074 616b 6573 2070 7265 6365 nity takes prece │ │ │ +0005df90: 6465 6e63 6520 6f76 6572 0a70 6965 6365 dence over.piece │ │ │ +0005dfa0: 2070 7269 6f72 6974 793f 3c2f 6832 3e3c priority?

    < │ │ │ +0005dfb0: 6834 3e2e 2e2f 7372 632f 7069 6563 655f h4>../src/piece_ │ │ │ +0005dfc0: 7069 636b 6572 2e63 7070 3a32 3232 383c picker.cpp:2228< │ │ │ +0005dfd0: 2f68 343e 3c70 7265 2073 7479 6c65 3d22 /h4>
    ..
    │ │ │ +0005e010: 0909 0970 7269 6f5f 696e 6465 785f 7420  ...prio_index_t 
    │ │ │ +0005e020: 636f 6e73 7420 656e 6420 3d20 7072 696f  const end = prio
    │ │ │ +0005e030: 7269 7479 5f65 6e64 2869 293b 0a09 0909  rity_end(i);....
    │ │ │ +0005e040: 0909 666f 7220 2870 7269 6f5f 696e 6465  ..for (prio_inde
    │ │ │ +0005e050: 785f 7420 7020 3d20 7072 6576 2865 6e64  x_t p = prev(end
    │ │ │ +0005e060: 293b 2070 2026 6774 3b3d 2073 7461 7274  ); p >= start
    │ │ │ +0005e070: 3b20 2d2d 7029 0a09 0909 0909 7b0a 0909  ; --p)......{...
    │ │ │ +0005e080: 0909 0909 7063 2e69 6e63 5f73 7461 7473  ....pc.inc_stats
    │ │ │ +0005e090: 5f63 6f75 6e74 6572 2863 6f75 6e74 6572  _counter(counter
    │ │ │ +0005e0a0: 733a 3a70 6965 6365 5f70 6963 6b65 725f  s::piece_picker_
    │ │ │ +0005e0b0: 7265 7665 7273 655f 7261 7265 5f6c 6f6f  reverse_rare_loo
    │ │ │ +0005e0c0: 7073 293b 0a0a 0909 0909 0909 6966 2028  ps);........if (
    │ │ │ +0005e0d0: 2169 735f 7069 6563 655f 6672 6565 286d  !is_piece_free(m
    │ │ │ +0005e0e0: 5f70 6965 6365 735b 705d 2c20 7069 6563  _pieces[p], piec
    │ │ │ +0005e0f0: 6573 2929 2063 6f6e 7469 6e75 653b 0a0a  es)) continue;..
    │ │ │ +0005e100: 0909 0909 0909 7265 7420 7c3d 2070 6963  ......ret |= pic
    │ │ │ +0005e110: 6b65 725f 6c6f 675f 616c 6572 743a 3a72  ker_log_alert::r
    │ │ │ +0005e120: 6576 6572 7365 5f72 6172 6573 745f 6669  everse_rarest_fi
    │ │ │ +0005e130: 7273 743b 0a0a 0909 0909 0909 6e75 6d5f  rst;........num_
    │ │ │ +0005e140: 626c 6f63 6b73 203d 2061 6464 5f62 6c6f  blocks = add_blo
    │ │ │ +0005e150: 636b 7328 6d5f 7069 6563 6573 5b70 5d2c  cks(m_pieces[p],
    │ │ │ +0005e160: 2070 6965 6365 730a 0909 0909 0909 092c   pieces........,
    │ │ │ +0005e170: 2069 6e74 6572 6573 7469 6e67 5f62 6c6f   interesting_blo
    │ │ │ +0005e180: 636b 732c 2062 6163 6b75 705f 626c 6f63  cks, backup_bloc
    │ │ │ +0005e190: 6b73 0a09 0909 0909 0909 2c20 6261 636b  ks........, back
    │ │ │ +0005e1a0: 7570 5f62 6c6f 636b 7332 2c20 6e75 6d5f  up_blocks2, num_
    │ │ │ +0005e1b0: 626c 6f63 6b73 0a09 0909 0909 0909 2c20  blocks........, 
    │ │ │ +0005e1c0: 7072 6566 6572 5f63 6f6e 7469 6775 6f75  prefer_contiguou
    │ │ │ +0005e1d0: 735f 626c 6f63 6b73 2c20 7065 6572 2c20  s_blocks, peer, 
    │ │ │ +0005e1e0: 6967 6e6f 7265 645f 7069 6563 6573 0a09  ignored_pieces..
    │ │ │ +0005e1f0: 0909 0909 0909 2c20 6f70 7469 6f6e 7329  ......, options)
    │ │ │ +0005e200: 3b0a 0909 0909 0909 6966 2028 6e75 6d5f  ;.......if (num_
    │ │ │ +0005e210: 626c 6f63 6b73 2026 6c74 3b3d 2030 2920  blocks <= 0) 
    │ │ │ +0005e220: 7265 7475 726e 2072 6574 3b0a 0909 0909  return ret;.....
    │ │ │ +0005e230: 097d 0a09 0909 097d 0a09 0909 7d0a 0909  .}.....}....}...
    │ │ │ +0005e240: 0965 6c73 650a 0909 097b 0a3c 6469 7620  .else....{.
    ....if │ │ │ +0005e280: 286f 7074 696f 6e73 2026 616d 703b 2070 (options & p │ │ │ +0005e290: 6965 6365 5f65 7874 656e 745f 6166 6669 iece_extent_affi │ │ │ +0005e2a0: 6e69 7479 290a 3c2f 6469 763e 0909 0909 nity).
    .... │ │ │ +0005e2b0: 7b0a 0909 0909 0969 6e74 2074 6f5f 6572 {......int to_er │ │ │ +0005e2c0: 6173 6520 3d20 2d31 3b0a 0909 0909 0969 ase = -1;......i │ │ │ +0005e2d0: 6e74 2069 6478 203d 202d 313b 0a09 0909 nt idx = -1;.... │ │ │ +0005e2e0: 0909 666f 7220 2870 6965 6365 5f65 7874 ..for (piece_ext │ │ │ +0005e2f0: 656e 745f 7420 636f 6e73 7420 6520 3a20 ent_t const e : │ │ │ +0005e300: 6d5f 7265 6365 6e74 5f65 7874 656e 7473 m_recent_extents │ │ │ +0005e310: 290a 0909 0909 097b 0a09 0909 0909 092b )......{.......+ │ │ │ +0005e320: 2b69 6478 3b0a 0909 0909 0909 626f 6f6c +idx;.......bool │ │ │ +0005e330: 2068 6176 655f 616c 6c20 3d20 7472 7565 have_all = true │ │ │ +0005e340: 3b0a 0909 0909 0909 666f 7220 2870 6965 ;.......for (pie │ │ │ +0005e350: 6365 5f69 6e64 6578 5f74 2063 6f6e 7374 ce_index_t const │ │ │ +0005e360: 2070 203a 2065 7874 656e 745f 666f 7228 p : extent_for( │ │ │ +0005e370: 6529 290a 0909 0909 0909 7b0a 0909 0909 e)).......{..... │ │ │ +0005e380: 0909 0969 6620 2821 6d5f 7069 6563 655f ...if (!m_piece_ │ │ │ +0005e390: 6d61 705b 705d 2e68 6176 6528 2929 2068 map[p].have()) h │ │ │ +0005e3a0: 6176 655f 616c 6c20 3d20 6661 6c73 653b ave_all = false; │ │ │ +0005e3b0: 0a09 0909 0909 0909 6966 2028 2169 735f ........if (!is_ │ │ │ +0005e3c0: 7069 6563 655f 6672 6565 2870 2c20 7069 piece_free(p, pi │ │ │ +0005e3d0: 6563 6573 2929 2063 6f6e 7469 6e75 653b eces)) continue; │ │ │ +0005e3e0: 0a0a 0909 0909 0909 0972 6574 207c 3d20 .........ret |= │ │ │ +0005e3f0: 7069 636b 6572 5f6c 6f67 5f61 6c65 7274 picker_log_alert │ │ │ +0005e400: 3a3a 6578 7465 6e74 5f61 6666 696e 6974 ::extent_affinit │ │ │ +0005e410: 793b 0a0a 0909 0909 0909 096e 756d 5f62 y;.........num_b │ │ │ +0005e420: 6c6f 636b 7320 3d20 6164 645f 626c 6f63 locks = add_bloc │ │ │ +0005e430: 6b73 2870 2c20 7069 6563 6573 0a09 0909 ks(p, pieces.... │ │ │ +0005e440: 0909 0909 092c 2069 6e74 6572 6573 7469 ....., interesti │ │ │ +0005e450: 6e67 5f62 6c6f 636b 732c 2062 6163 6b75 ng_blocks, backu │ │ │ +0005e460: 705f 626c 6f63 6b73 0a09 0909 0909 0909 p_blocks........ │ │ │ +0005e470: 092c 2062 6163 6b75 705f 626c 6f63 6b73 ., backup_blocks │ │ │ +0005e480: 322c 206e 756d 5f62 6c6f 636b 730a 0909 2, num_blocks... │ │ │ +0005e490: 0909 0909 0909 2c20 7072 6566 6572 5f63 ......, prefer_c │ │ │ +0005e4a0: 6f6e 7469 6775 6f75 735f 626c 6f63 6b73 ontiguous_blocks │ │ │ +0005e4b0: 2c20 7065 6572 2c20 6967 6e6f 7265 645f , peer, ignored_ │ │ │ +0005e4c0: 7069 6563 6573 0a09 0909 0909 0909 092c pieces........., │ │ │ +0005e4d0: 206f 7074 696f 6e73 293b 0a09 0909 0909 options);...... │ │ │ +0005e4e0: 0909 6966 2028 6e75 6d5f 626c 6f63 6b73 ..if (num_blocks │ │ │ +0005e4f0: 2026 6c74 3b3d 2030 290a 0909 0909 0909 <= 0)....... │ │ │ +0005e500: 097b 0a09 0909 0909 0909 092f 2f20 6966 .{.........// if │ │ │ +0005e510: 2077 6520 6861 7665 2061 6c6c 2070 6965 we have all pie │ │ │ +0005e520: 6365 7320 6265 6c6f 6e67 696e 6720 746f ces belonging to │ │ │ +0005e530: 2074 6869 7320 6578 7465 6e74 2c20 7265 this extent, re │ │ │ +0005e540: 6d6f 7665 2069 740a 0909 0909 0909 0909 move it......... │ │ │ +0005e550: 6966 2028 746f 5f65 7261 7365 2021 3d20 if (to_erase != │ │ │ +0005e560: 2d31 2920 6d5f 7265 6365 6e74 5f65 7874 -1) m_recent_ext │ │ │ +0005e570: 656e 7473 2e65 7261 7365 286d 5f72 6563 ents.erase(m_rec │ │ │ +0005e580: 656e 745f 6578 7465 6e74 732e 6265 6769 ent_extents.begi │ │ │ +0005e590: 6e28 2920 2b20 746f 5f65 7261 7365 293b n() + to_erase); │ │ │ +0005e5a0: 0a09 0909 0909 0909 0972 6574 7572 6e20 .........return │ │ │ +0005e5b0: 7265 743b 0a09 0909 0909 0909 7d0a 0909 ret;........}... │ │ │ +0005e5c0: 0909 0909 7d0a 0909 0909 0909 2f2f 2069 ....}.......// i │ │ │ +0005e5d0: 6620 7765 2068 6176 6520 616c 6c20 7069 f we have all pi │ │ │ +0005e5e0: 6563 6573 2062 656c 6f6e 6769 6e67 2074 eces belonging t │ │ │ +0005e5f0: 6f20 7468 6973 2065 7874 656e 742c 2072 o this extent, r │ │ │ +0005e600: 656d 6f76 6520 6974 0a09 0909 0909 0969 emove it.......i │ │ │ +0005e610: 6620 2868 6176 655f 616c 6c29 2074 6f5f f (have_all) to_ │ │ │ +0005e620: 6572 6173 6520 3d20 6964 783b 0a09 0909 erase = idx;.... │ │ │ +0005e630: 0909 7d0a 0909 0909 0969 6620 2874 6f5f ..}......if (to_ │ │ │ +0005e640: 6572 6173 6520 213d 202d 3129 206d 5f72 erase != -1) m_r │ │ │ +0005e650: 6563 656e 745f 6578 7465 6e74 732e 6572 ecent_extents.er │ │ │ +0005e660: 6173 6528 6d5f 7265 6365 6e74 5f65 7874 ase(m_recent_ext │ │ │ +0005e670: 656e 7473 2e62 6567 696e 2829 202b 2074 ents.begin() + t │ │ │ +0005e680: 6f5f 6572 6173 6529 3b0a 3c2f 7072 653e o_erase);.
    │ │ │ +0005e690: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ +0005e6c0: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ +0005e6d0: 3c74 643e 3c61 2068 7265 663d 226a 6176 ../src/piec │ │ │ +0005e700: 655f 7069 636b 6572 2e63 7070 3a32 3538 e_picker.cpp:258 │ │ │ +0005e710: 333c 2f61 3e3c 2f74 643e 3c74 643e 7768 3wh │ │ │ +0005e720: 656e 2065 7870 616e 6469 6e67 2070 6965 en expanding pie │ │ │ +0005e730: 6365 7320 666f 7220 6361 6368 6520 7374 ces for cache st │ │ │ +0005e740: 7269 7065 2072 6561 736f 6e73 2c20 7468 ripe reasons, th │ │ │ +0005e750: 6520 2164 6f77 6e6c 6f61 6469 6e67 2063 e !downloading c │ │ │ +0005e760: 6f6e 6469 7469 6f6e 2064 6f65 736e 2774 ondition doesn't │ │ │ +0005e770: 206d 616b 6520 6d75 6368 2073 656e 7365 make much sense │ │ │ +0005e780: 3c2f 7464 3e3c 2f74 723e 3c74 7220 6964

    wh │ │ │ +0005e7d0: 656e 2065 7870 616e 6469 6e67 2070 6965 en expanding pie │ │ │ +0005e7e0: 6365 7320 666f 7220 6361 6368 6520 7374 ces for cache st │ │ │ +0005e7f0: 7269 7065 2072 6561 736f 6e73 2c0a 7468 ripe reasons,.th │ │ │ +0005e800: 6520 2164 6f77 6e6c 6f61 6469 6e67 2063 e !downloading c │ │ │ +0005e810: 6f6e 6469 7469 6f6e 2064 6f65 736e 2774 ondition doesn't │ │ │ +0005e820: 206d 616b 6520 6d75 6368 2073 656e 7365 make much sense │ │ │ +0005e830: 3c2f 6832 3e3c 6834 3e2e 2e2f 7372 632f

    ../src/ │ │ │ +0005e840: 7069 6563 655f 7069 636b 6572 2e63 7070 piece_picker.cpp │ │ │ +0005e850: 3a32 3538 333c 2f68 343e 3c70 7265 2073 :2583

    ..TORRENT_AS
    │ │ │ +0005e8a0: 5345 5254 2869 6e64 6578 2026 6c74 3b20  SERT(index < 
    │ │ │ +0005e8b0: 6d5f 7069 6563 655f 6d61 702e 656e 645f  m_piece_map.end_
    │ │ │ +0005e8c0: 696e 6465 7828 2929 3b0a 0909 6966 2028  index());...if (
    │ │ │ +0005e8d0: 6e65 7874 2869 6e64 6578 2920 3d3d 206d  next(index) == m
    │ │ │ +0005e8e0: 5f70 6965 6365 5f6d 6170 2e65 6e64 5f69  _piece_map.end_i
    │ │ │ +0005e8f0: 6e64 6578 2829 290a 0909 0972 6574 7572  ndex())....retur
    │ │ │ +0005e900: 6e20 6d5f 626c 6f63 6b73 5f69 6e5f 6c61  n m_blocks_in_la
    │ │ │ +0005e910: 7374 5f70 6965 6365 3b0a 0909 656c 7365  st_piece;...else
    │ │ │ +0005e920: 0a09 0909 7265 7475 726e 2062 6c6f 636b  ....return block
    │ │ │ +0005e930: 735f 7065 725f 7069 6563 6528 293b 0a09  s_per_piece();..
    │ │ │ +0005e940: 7d0a 0a09 626f 6f6c 2070 6965 6365 5f70  }...bool piece_p
    │ │ │ +0005e950: 6963 6b65 723a 3a69 735f 7069 6563 655f  icker::is_piece_
    │ │ │ +0005e960: 6672 6565 2870 6965 6365 5f69 6e64 6578  free(piece_index
    │ │ │ +0005e970: 5f74 2063 6f6e 7374 2070 6965 6365 0a09  _t const piece..
    │ │ │ +0005e980: 092c 2074 7970 6564 5f62 6974 6669 656c  ., typed_bitfiel
    │ │ │ +0005e990: 6426 6c74 3b70 6965 6365 5f69 6e64 6578  d<piece_index
    │ │ │ +0005e9a0: 5f74 2667 743b 2063 6f6e 7374 2661 6d70  _t> const&
    │ │ │ +0005e9b0: 3b20 6269 746d 6173 6b29 2063 6f6e 7374  ; bitmask) const
    │ │ │ +0005e9c0: 0a09 7b0a 0909 7265 7475 726e 2062 6974  ..{...return bit
    │ │ │ +0005e9d0: 6d61 736b 5b70 6965 6365 5d0a 0909 0926  mask[piece]....&
    │ │ │ +0005e9e0: 616d 703b 2661 6d70 3b20 216d 5f70 6965  amp;& !m_pie
    │ │ │ +0005e9f0: 6365 5f6d 6170 5b70 6965 6365 5d2e 6861  ce_map[piece].ha
    │ │ │ +0005ea00: 7665 2829 0a09 0909 2661 6d70 3b26 616d  ve()....&&am
    │ │ │ +0005ea10: 703b 2021 6d5f 7069 6563 655f 6d61 705b  p; !m_piece_map[
    │ │ │ +0005ea20: 7069 6563 655d 2e66 696c 7465 7265 6428  piece].filtered(
    │ │ │ +0005ea30: 293b 0a09 7d0a 0a09 626f 6f6c 2070 6965  );..}...bool pie
    │ │ │ +0005ea40: 6365 5f70 6963 6b65 723a 3a63 616e 5f70  ce_picker::can_p
    │ │ │ +0005ea50: 6963 6b28 7069 6563 655f 696e 6465 785f  ick(piece_index_
    │ │ │ +0005ea60: 7420 636f 6e73 7420 7069 6563 650a 0909  t const piece...
    │ │ │ +0005ea70: 2c20 7479 7065 645f 6269 7466 6965 6c64  , typed_bitfield
    │ │ │ +0005ea80: 266c 743b 7069 6563 655f 696e 6465 785f  <piece_index_
    │ │ │ +0005ea90: 7426 6774 3b20 636f 6e73 7426 616d 703b  t> const&
    │ │ │ +0005eaa0: 2062 6974 6d61 736b 2920 636f 6e73 740a   bitmask) const.
    │ │ │ +0005eab0: 097b 0a09 0972 6574 7572 6e20 6269 746d  .{...return bitm
    │ │ │ +0005eac0: 6173 6b5b 7069 6563 655d 0a09 0909 2661  ask[piece]....&a
    │ │ │ +0005ead0: 6d70 3b26 616d 703b 2021 6d5f 7069 6563  mp;& !m_piec
    │ │ │ +0005eae0: 655f 6d61 705b 7069 6563 655d 2e68 6176  e_map[piece].hav
    │ │ │ +0005eaf0: 6528 290a 3c64 6976 2073 7479 6c65 3d22  e().
    ...&& │ │ │ +0005eb30: 216d 5f70 6965 6365 5f6d 6170 5b70 6965 !m_piece_map[pie │ │ │ +0005eb40: 6365 5d2e 646f 776e 6c6f 6164 696e 6728 ce].downloading( │ │ │ +0005eb50: 290a 3c2f 6469 763e 0909 0926 616d 703b ).
    ...& │ │ │ +0005eb60: 2661 6d70 3b20 216d 5f70 6965 6365 5f6d & !m_piece_m │ │ │ +0005eb70: 6170 5b70 6965 6365 5d2e 6669 6c74 6572 ap[piece].filter │ │ │ +0005eb80: 6564 2829 3b0a 097d 0a0a 2369 6620 544f ed();..}..#if TO │ │ │ +0005eb90: 5252 454e 545f 5553 455f 494e 5641 5249 RRENT_USE_INVARI │ │ │ +0005eba0: 414e 545f 4348 4543 4b53 0a09 766f 6964 ANT_CHECKS..void │ │ │ +0005ebb0: 2070 6965 6365 5f70 6963 6b65 723a 3a63 piece_picker::c │ │ │ +0005ebc0: 6865 636b 5f70 6565 7273 2829 0a09 7b0a heck_peers()..{. │ │ │ +0005ebd0: 0909 666f 7220 2861 7574 6f20 636f 6e73 ..for (auto cons │ │ │ +0005ebe0: 7426 616d 703b 2062 203a 206d 5f62 6c6f t& b : m_blo │ │ │ +0005ebf0: 636b 5f69 6e66 6f29 0a09 097b 0a09 0909 ck_info)...{.... │ │ │ +0005ec00: 544f 5252 454e 545f 4153 5345 5254 2862 TORRENT_ASSERT(b │ │ │ +0005ec10: 2e70 6565 7220 3d3d 206e 756c 6c70 7472 .peer == nullptr │ │ │ +0005ec20: 207c 7c20 7374 6174 6963 5f63 6173 7426 || static_cast& │ │ │ +0005ec30: 6c74 3b74 6f72 7265 6e74 5f70 6565 722a lt;torrent_peer* │ │ │ +0005ec40: 2667 743b 2862 2e70 6565 7229 2d26 6774 >(b.peer)-> │ │ │ +0005ec50: 3b69 6e5f 7573 6529 3b0a 0909 7d0a 097d ;in_use);...}..} │ │ │ +0005ec60: 0a23 656e 6469 660a 0a09 766f 6964 2070 .#endif...void p │ │ │ +0005ec70: 6965 6365 5f70 6963 6b65 723a 3a63 6c65 iece_picker::cle │ │ │ +0005ec80: 6172 5f70 6565 7228 746f 7272 656e 745f ar_peer(torrent_ │ │ │ +0005ec90: 7065 6572 2a20 7065 6572 290a 097b 0a09 peer* peer)..{.. │ │ │ +0005eca0: 0966 6f72 2028 6175 746f 2661 6d70 3b20 .for (auto& │ │ │ +0005ecb0: 6220 3a20 6d5f 626c 6f63 6b5f 696e 666f b : m_block_info │ │ │ +0005ecc0: 290a 0909 7b0a 0909 0969 6620 2862 2e70 )...{....if (b.p │ │ │ +0005ecd0: 6565 7220 3d3d 2070 6565 7229 2062 2e70 eer == peer) b.p │ │ │ +0005ece0: 6565 7220 3d20 6e75 6c6c 7074 723b 0a09 eer = nullptr;.. │ │ │ +0005ecf0: 097d 0a09 7d0a 0a09 2f2f 2074 6865 2066 .}..}...// the f │ │ │ +0005ed00: 6972 7374 2062 6f6f 6c20 6973 2074 7275 irst bool is tru │ │ │ +0005ed10: 6520 6966 2074 6869 7320 6973 2074 6865 e if this is the │ │ │ +0005ed20: 206f 6e6c 7920 7065 6572 2074 6861 7420 only peer that │ │ │ +0005ed30: 6861 7320 7265 7175 6573 7465 6420 616e has requested an │ │ │ +0005ed40: 6420 646f 776e 6c6f 6164 6564 0a09 2f2f d downloaded..// │ │ │ +0005ed50: 2062 6c6f 636b 7320 6672 6f6d 2074 6869 blocks from thi │ │ │ +0005ed60: 7320 7069 6563 652e 0a09 2f2f 2074 6865 s piece...// the │ │ │ +0005ed70: 2073 6563 6f6e 6420 626f 6f6c 2069 7320 second bool is │ │ │ +0005ed80: 7472 7565 2069 6620 7468 6973 2069 7320 true if this is │ │ │ +0005ed90: 7468 6520 6f6e 6c79 2061 6374 6976 6520 the only active │ │ │ +0005eda0: 7065 6572 2074 6861 7420 6973 2072 6571 peer that is req │ │ │ +0005edb0: 7565 7374 696e 670a 092f 2f20 616e 6420 uesting..// and │ │ │ +0005edc0: 646f 776e 6c6f 6164 696e 6720 626c 6f63 downloading bloc │ │ │ +0005edd0: 6b73 2066 726f 6d20 7468 6973 2070 6965 ks from this pie │ │ │ +0005ede0: 6365 2e20 4163 7469 7665 206d 6561 6e73 ce. Active means │ │ │ +0005edf0: 2068 6176 696e 6720 6120 636f 6e6e 6563 having a connec │ │ │ +0005ee00: 7469 6f6e 2e0a 3c2f 7072 653e 3c2f 7464 tion..
    relevance │ │ │ +0005ee40: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ +0005ee50: 3c61 2068 7265 663d 226a 6176 6173 6372 ../src/piece_pi │ │ │ +0005ee80: 636b 6572 2e63 7070 3a33 3136 313c 2f61 cker.cpp:3161should │ │ │ +0005eea0: 2035 2062 6520 636f 6e66 6967 7572 6162 5 be configurab │ │ │ +0005eeb0: 6c65 3f3c 2f74 643e 3c2f 7472 3e3c 7472 le?

    should 5 be con │ │ │ +0005ef10: 6669 6775 7261 626c 653f 3c2f 6832 3e3c figurable?

    < │ │ │ +0005ef20: 6834 3e2e 2e2f 7372 632f 7069 6563 655f h4>../src/piece_ │ │ │ +0005ef30: 7069 636b 6572 2e63 7070 3a33 3136 313c picker.cpp:3161< │ │ │ +0005ef40: 2f68 343e 3c70 7265 2073 7479 6c65 3d22 /h4>
    ..
    │ │ │ +0005ef80: 626f 6f6c 2068 6176 655f 616c 6c20 3d20  bool have_all = 
    │ │ │ +0005ef90: 7472 7565 3b0a 0a09 0966 6f72 2028 6175  true;....for (au
    │ │ │ +0005efa0: 746f 2063 6f6e 7374 2070 6965 6365 203a  to const piece :
    │ │ │ +0005efb0: 2065 7874 656e 745f 666f 7228 7468 6973   extent_for(this
    │ │ │ +0005efc0: 5f65 7874 656e 7429 290a 0909 7b0a 0909  _extent))...{...
    │ │ │ +0005efd0: 0969 6620 2870 6965 6365 203d 3d20 7029  .if (piece == p)
    │ │ │ +0005efe0: 2063 6f6e 7469 6e75 653b 0a0a 0909 0969   continue;.....i
    │ │ │ +0005eff0: 6620 2821 6d5f 7069 6563 655f 6d61 705b  f (!m_piece_map[
    │ │ │ +0005f000: 7069 6563 655d 2e68 6176 6528 2929 2068  piece].have()) h
    │ │ │ +0005f010: 6176 655f 616c 6c20 3d20 6661 6c73 653b  ave_all = false;
    │ │ │ +0005f020: 0a0a 0909 092f 2f20 6966 2061 7420 6c65  .....// if at le
    │ │ │ +0005f030: 6173 7420 6f6e 6520 7069 6563 6520 696e  ast one piece in
    │ │ │ +0005f040: 2074 6869 7320 6578 7465 6e74 2068 6173   this extent has
    │ │ │ +0005f050: 2061 2064 6966 6665 7265 6e74 2070 7269   a different pri
    │ │ │ +0005f060: 6f72 6974 7920 7468 616e 0a09 0909 2f2f  ority than....//
    │ │ │ +0005f070: 2074 6865 206f 6e65 2077 6520 6a75 7374   the one we just
    │ │ │ +0005f080: 2073 7461 7274 6564 2064 6f77 6e6c 6f61   started downloa
    │ │ │ +0005f090: 6469 6e67 2c20 646f 6e27 7420 6372 6561  ding, don't crea
    │ │ │ +0005f0a0: 7465 2061 6e20 6166 6669 6e69 7479 2066  te an affinity f
    │ │ │ +0005f0b0: 6f72 0a09 0909 2f2f 2061 646a 6163 656e  or....// adjacen
    │ │ │ +0005f0c0: 7420 7069 6563 6573 2e20 5468 6973 2070  t pieces. This p
    │ │ │ +0005f0d0: 726f 6261 626c 7920 6d65 616e 7320 7468  robably means th
    │ │ │ +0005f0e0: 6520 7069 6563 6573 2062 656c 6f6e 6720  e pieces belong 
    │ │ │ +0005f0f0: 746f 2064 6966 6665 7265 6e74 0a09 0909  to different....
    │ │ │ +0005f100: 2f2f 2066 696c 6573 2c20 6f72 2074 6861  // files, or tha
    │ │ │ +0005f110: 7420 736f 6d65 206f 7468 6572 206d 6563  t some other mec
    │ │ │ +0005f120: 6861 6e69 736d 2064 6574 6572 6d69 6e69  hanism determini
    │ │ │ +0005f130: 6e67 2074 6865 2070 7269 6f72 6974 7920  ng the priority 
    │ │ │ +0005f140: 7368 6f75 6c64 0a09 0909 2f2f 2074 616b  should....// tak
    │ │ │ +0005f150: 6520 7072 6563 6564 656e 6365 2e0a 0909  e precedence....
    │ │ │ +0005f160: 0969 6620 2870 6965 6365 5f70 7269 6f72  .if (piece_prior
    │ │ │ +0005f170: 6974 7928 7069 6563 6529 2021 3d20 7468  ity(piece) != th
    │ │ │ +0005f180: 6973 5f70 7269 6f29 2072 6574 7572 6e3b  is_prio) return;
    │ │ │ +0005f190: 0a09 097d 0a0a 0909 2f2f 2069 6620 7765  ...}....// if we
    │ │ │ +0005f1a0: 2061 6c72 6561 6479 2068 6176 6520 616c   already have al
    │ │ │ +0005f1b0: 6c20 7468 6520 2a6f 7468 6572 2a20 7069  l the *other* pi
    │ │ │ +0005f1c0: 6563 6573 2069 6e20 7468 6973 2065 7874  eces in this ext
    │ │ │ +0005f1d0: 656e 742c 2074 6865 7265 2773 206e 6f0a  ent, there's no.
    │ │ │ +0005f1e0: 0909 2f2f 206e 6565 6420 746f 2069 6e66  ..// need to inf
    │ │ │ +0005f1f0: 6c61 7465 2074 6865 6972 2070 7269 6f72  late their prior
    │ │ │ +0005f200: 6974 6965 730a 0909 6966 2028 6861 7665  ities...if (have
    │ │ │ +0005f210: 5f61 6c6c 2920 7265 7475 726e 3b0a 0a3c  _all) return;..<
    │ │ │ +0005f220: 6469 7620 7374 796c 653d 2262 6163 6b67  div style="backg
    │ │ │ +0005f230: 726f 756e 643a 2023 6666 6666 3030 2220  round: #ffff00" 
    │ │ │ +0005f240: 7769 6474 683d 2231 3030 2522 3e09 0969  width="100%">..i
    │ │ │ +0005f250: 6620 286d 5f72 6563 656e 745f 6578 7465  f (m_recent_exte
    │ │ │ +0005f260: 6e74 732e 7369 7a65 2829 2026 6c74 3b20  nts.size() < 
    │ │ │ +0005f270: 3529 0a3c 2f64 6976 3e09 0909 6d5f 7265  5)....m_re
    │ │ │ +0005f280: 6365 6e74 5f65 7874 656e 7473 2e70 7573  cent_extents.pus
    │ │ │ +0005f290: 685f 6261 636b 2874 6869 735f 6578 7465  h_back(this_exte
    │ │ │ +0005f2a0: 6e74 293b 0a0a 0909 2f2f 206c 696d 6974  nt);....// limit
    │ │ │ +0005f2b0: 2074 6865 206e 756d 6265 7220 6f66 2065   the number of e
    │ │ │ +0005f2c0: 7874 656e 7420 6166 6669 6e69 7469 6573  xtent affinities
    │ │ │ +0005f2d0: 2061 6374 6976 6520 6174 2061 6e79 2067   active at any g
    │ │ │ +0005f2e0: 6976 656e 2074 696d 6520 746f 206c 696d  iven time to lim
    │ │ │ +0005f2f0: 6974 0a09 092f 2f20 7468 6520 636f 7374  it...// the cost
    │ │ │ +0005f300: 206f 6620 6368 6563 6b69 6e67 2074 6865   of checking the
    │ │ │ +0005f310: 6d2e 2041 6c73 6f2c 2064 6f6e 2774 2072  m. Also, don't r
    │ │ │ +0005f320: 6570 6c61 6365 2074 6865 6d2c 2063 6f6d  eplace them, com
    │ │ │ +0005f330: 6d69 7420 746f 0a09 092f 2f20 6669 6e69  mit to...// fini
    │ │ │ +0005f340: 7368 696e 6720 7468 656d 2062 6566 6f72  shing them befor
    │ │ │ +0005f350: 6520 7374 6172 7469 6e67 2061 6e6f 7468  e starting anoth
    │ │ │ +0005f360: 6572 2065 7874 656e 742e 2054 6869 7320  er extent. This 
    │ │ │ +0005f370: 6973 2061 6e61 6c6f 676f 7573 2074 6f0a  is analogous to.
    │ │ │ +0005f380: 0909 2f2f 206c 696d 6974 696e 6720 7468  ..// limiting th
    │ │ │ +0005f390: 6520 6e75 6d62 6572 206f 6620 7061 7274  e number of part
    │ │ │ +0005f3a0: 6961 6c20 7069 6563 6573 2e0a 097d 0a0a  ial pieces...}..
    │ │ │ +0005f3b0: 092f 2f20 6f70 7469 6f6e 7320 6d61 7920  .// options may 
    │ │ │ +0005f3c0: 6265 2030 206f 7220 7069 6563 655f 7069  be 0 or piece_pi
    │ │ │ +0005f3d0: 636b 6572 3a3a 7265 7665 7273 650a 092f  cker::reverse../
    │ │ │ +0005f3e0: 2f20 7265 7475 726e 7320 6661 6c73 6520  / returns false 
    │ │ │ +0005f3f0: 6966 2074 6865 2062 6c6f 636b 2063 6f75  if the block cou
    │ │ │ +0005f400: 6c64 206e 6f74 2062 6520 6d61 726b 6564  ld not be marked
    │ │ │ +0005f410: 2061 7320 646f 776e 6c6f 6164 696e 670a   as downloading.
    │ │ │ +0005f420: 0962 6f6f 6c20 7069 6563 655f 7069 636b  .bool piece_pick
    │ │ │ +0005f430: 6572 3a3a 6d61 726b 5f61 735f 646f 776e  er::mark_as_down
    │ │ │ +0005f440: 6c6f 6164 696e 6728 7069 6563 655f 626c  loading(piece_bl
    │ │ │ +0005f450: 6f63 6b20 636f 6e73 7420 626c 6f63 6b0a  ock const block.
    │ │ │ +0005f460: 0909 2c20 746f 7272 656e 745f 7065 6572  .., torrent_peer
    │ │ │ +0005f470: 2a20 7065 6572 2c20 7069 636b 6572 5f6f  * peer, picker_o
    │ │ │ +0005f480: 7074 696f 6e73 5f74 2063 6f6e 7374 206f  ptions_t const o
    │ │ │ +0005f490: 7074 696f 6e73 290a 097b 0a23 6966 6465  ptions)..{.#ifde
    │ │ │ +0005f4a0: 6620 544f 5252 454e 545f 5049 434b 4552  f TORRENT_PICKER
    │ │ │ +0005f4b0: 5f4c 4f47 0a09 0973 7464 3a3a 6365 7272  _LOG...std::cerr
    │ │ │ +0005f4c0: 2026 6c74 3b26 6c74 3b20 225b 2220 266c   << "[" &l
    │ │ │ +0005f4d0: 743b 266c 743b 2074 6869 7320 266c 743b  t;< this <
    │ │ │ +0005f4e0: 266c 743b 2022 5d20 2220 266c 743b 266c  < "] " <&l
    │ │ │ +0005f4f0: 743b 2022 6d61 726b 5f61 735f 646f 776e  t; "mark_as_down
    │ │ │ +0005f500: 6c6f 6164 696e 6728 207b 220a 0909 0926  loading( {"....&
    │ │ │ +0005f510: 6c74 3b26 6c74 3b20 626c 6f63 6b2e 7069  lt;< block.pi
    │ │ │ +0005f520: 6563 655f 696e 6465 7820 266c 743b 266c  ece_index <&l
    │ │ │ +0005f530: 743b 2022 2c20 2220 266c 743b 266c 743b  t; ", " <<
    │ │ │ +0005f540: 2062 6c6f 636b 2e62 6c6f 636b 5f69 6e64   block.block_ind
    │ │ │ +0005f550: 6578 2026 6c74 3b26 6c74 3b20 227d 2029  ex << "} )
    │ │ │ +0005f560: 2220 266c 743b 266c 743b 2073 7464 3a3a  " << std::
    │ │ │ +0005f570: 656e 646c 3b0a 2365 6e64 6966 0a0a 0909  endl;.#endif....
    │ │ │ +0005f580: 544f 5252 454e 545f 4153 5345 5254 2870  TORRENT_ASSERT(p
    │ │ │ +0005f590: 6565 7220 3d3d 206e 756c 6c70 7472 207c  eer == nullptr |
    │ │ │ +0005f5a0: 7c20 7065 6572 2d26 6774 3b69 6e5f 7573  | peer->in_us
    │ │ │ +0005f5b0: 6529 3b0a 0909 544f 5252 454e 545f 4153  e);...TORRENT_AS
    │ │ │ +0005f5c0: 5345 5254 2862 6c6f 636b 2e62 6c6f 636b  SERT(block.block
    │ │ │ +0005f5d0: 5f69 6e64 6578 2021 3d20 7069 6563 655f  _index != piece_
    │ │ │ +0005f5e0: 626c 6f63 6b3a 3a69 6e76 616c 6964 2e62  block::invalid.b
    │ │ │ +0005f5f0: 6c6f 636b 5f69 6e64 6578 293b 0a09 0954  lock_index);...T
    │ │ │ +0005f600: 4f52 5245 4e54 5f41 5353 4552 5428 626c  ORRENT_ASSERT(bl
    │ │ │ +0005f610: 6f63 6b2e 7069 6563 655f 696e 6465 7820  ock.piece_index 
    │ │ │ +0005f620: 213d 2070 6965 6365 5f62 6c6f 636b 3a3a  != piece_block::
    │ │ │ +0005f630: 696e 7661 6c69 642e 7069 6563 655f 696e  invalid.piece_in
    │ │ │ +0005f640: 6465 7829 3b0a 0909 544f 5252 454e 545f  dex);...TORRENT_
    │ │ │ +0005f650: 4153 5345 5254 2862 6c6f 636b 2e70 6965  ASSERT(block.pie
    │ │ │ +0005f660: 6365 5f69 6e64 6578 2026 6c74 3b20 6d5f  ce_index < m_
    │ │ │ +0005f670: 7069 6563 655f 6d61 702e 656e 645f 696e  piece_map.end_in
    │ │ │ +0005f680: 6465 7828 2929 3b0a 0909 544f 5252 454e  dex());...TORREN
    │ │ │ +0005f690: 545f 4153 5345 5254 2862 6c6f 636b 2e62  T_ASSERT(block.b
    │ │ │ +0005f6a0: 6c6f 636b 5f69 6e64 6578 2026 6c74 3b20  lock_index < 
    │ │ │ +0005f6b0: 626c 6f63 6b73 5f69 6e5f 7069 6563 6528  blocks_in_piece(
    │ │ │ +0005f6c0: 626c 6f63 6b2e 7069 6563 655f 696e 6465  block.piece_inde
    │ │ │ +0005f6d0: 7829 293b 0a09 0954 4f52 5245 4e54 5f41  x));...TORRENT_A
    │ │ │ +0005f6e0: 5353 4552 5428 216d 5f70 6965 6365 5f6d  SSERT(!m_piece_m
    │ │ │ +0005f6f0: 6170 5b62 6c6f 636b 2e70 6965 6365 5f69  ap[block.piece_i
    │ │ │ +0005f700: 6e64 6578 5d2e 6861 7665 2829 293b 0a0a  ndex].have());..
    │ │ │ +0005f710: 0909 7069 6563 655f 706f 7326 616d 703b  ..piece_pos&
    │ │ │ +0005f720: 2070 203d 206d 5f70 6965 6365 5f6d 6170   p = m_piece_map
    │ │ │ +0005f730: 5b62 6c6f 636b 2e70 6965 6365 5f69 6e64  [block.piece_ind
    │ │ │ +0005f740: 6578 5d3b 0a09 0969 6620 2870 2e64 6f77  ex];...if (p.dow
    │ │ │ +0005f750: 6e6c 6f61 645f 7175 6575 6528 2920 3d3d  nload_queue() ==
    │ │ │ +0005f760: 2070 6965 6365 5f70 6f73 3a3a 7069 6563   piece_pos::piec
    │ │ │ +0005f770: 655f 6f70 656e 290a 0909 7b0a 2369 6664  e_open)...{.#ifd
    │ │ │ +0005f780: 6566 2054 4f52 5245 4e54 5f45 5850 454e  ef TORRENT_EXPEN
    │ │ │ +0005f790: 5349 5645 5f49 4e56 4152 4941 4e54 5f43  SIVE_INVARIANT_C
    │ │ │ +0005f7a0: 4845 434b 530a 0909 0949 4e56 4152 4941  HECKS....INVARIA
    │ │ │ +0005f7b0: 4e54 5f43 4845 434b 3b0a 3c2f 7072 653e  NT_CHECK;.
    │ │ │ +0005f7c0: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ +0005f7f0: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ +0005f800: 3c74 643e 3c61 2068 7265 663d 226a 6176 ../src/ip_n │ │ │ +0005f830: 6f74 6966 6965 722e 6370 703a 3431 3c2f otifier.cpp:41simul │ │ │ +0005f850: 6174 6f72 2073 7570 706f 7274 3c2f 7464 ator support

    simula │ │ │ +0005f8b0: 746f 7220 7375 7070 6f72 743c 2f68 323e tor support

    │ │ │ +0005f8c0: 3c68 343e 2e2e 2f73 7263 2f69 705f 6e6f

    ../src/ip_no │ │ │ +0005f8d0: 7469 6669 6572 2e63 7070 3a34 313c 2f68 tifier.cpp:41
        
    │ │ │ +0005f920: 2020 6672 6f6d 2074 6869 7320 736f 6674    from this soft
    │ │ │ +0005f930: 7761 7265 2077 6974 686f 7574 2073 7065  ware without spe
    │ │ │ +0005f940: 6369 6669 6320 7072 696f 7220 7772 6974  cific prior writ
    │ │ │ +0005f950: 7465 6e20 7065 726d 6973 7369 6f6e 2e0a  ten permission..
    │ │ │ +0005f960: 0a54 4849 5320 534f 4654 5741 5245 2049  .THIS SOFTWARE I
    │ │ │ +0005f970: 5320 5052 4f56 4944 4544 2042 5920 5448  S PROVIDED BY TH
    │ │ │ +0005f980: 4520 434f 5059 5249 4748 5420 484f 4c44  E COPYRIGHT HOLD
    │ │ │ +0005f990: 4552 5320 414e 4420 434f 4e54 5249 4255  ERS AND CONTRIBU
    │ │ │ +0005f9a0: 544f 5253 2022 4153 2049 5322 0a41 4e44  TORS "AS IS".AND
    │ │ │ +0005f9b0: 2041 4e59 2045 5850 5245 5353 204f 5220   ANY EXPRESS OR 
    │ │ │ +0005f9c0: 494d 504c 4945 4420 5741 5252 414e 5449  IMPLIED WARRANTI
    │ │ │ +0005f9d0: 4553 2c20 494e 434c 5544 494e 472c 2042  ES, INCLUDING, B
    │ │ │ +0005f9e0: 5554 204e 4f54 204c 494d 4954 4544 2054  UT NOT LIMITED T
    │ │ │ +0005f9f0: 4f2c 2054 4845 0a49 4d50 4c49 4544 2057  O, THE.IMPLIED W
    │ │ │ +0005fa00: 4152 5241 4e54 4945 5320 4f46 204d 4552  ARRANTIES OF MER
    │ │ │ +0005fa10: 4348 414e 5441 4249 4c49 5459 2041 4e44  CHANTABILITY AND
    │ │ │ +0005fa20: 2046 4954 4e45 5353 2046 4f52 2041 2050   FITNESS FOR A P
    │ │ │ +0005fa30: 4152 5449 4355 4c41 5220 5055 5250 4f53  ARTICULAR PURPOS
    │ │ │ +0005fa40: 450a 4152 4520 4449 5343 4c41 494d 4544  E.ARE DISCLAIMED
    │ │ │ +0005fa50: 2e20 494e 204e 4f20 4556 454e 5420 5348  . IN NO EVENT SH
    │ │ │ +0005fa60: 414c 4c20 5448 4520 434f 5059 5249 4748  ALL THE COPYRIGH
    │ │ │ +0005fa70: 5420 4f57 4e45 5220 4f52 2043 4f4e 5452  T OWNER OR CONTR
    │ │ │ +0005fa80: 4942 5554 4f52 5320 4245 0a4c 4941 424c  IBUTORS BE.LIABL
    │ │ │ +0005fa90: 4520 464f 5220 414e 5920 4449 5245 4354  E FOR ANY DIRECT
    │ │ │ +0005faa0: 2c20 494e 4449 5245 4354 2c20 494e 4349  , INDIRECT, INCI
    │ │ │ +0005fab0: 4445 4e54 414c 2c20 5350 4543 4941 4c2c  DENTAL, SPECIAL,
    │ │ │ +0005fac0: 2045 5845 4d50 4c41 5259 2c20 4f52 0a43   EXEMPLARY, OR.C
    │ │ │ +0005fad0: 4f4e 5345 5155 454e 5449 414c 2044 414d  ONSEQUENTIAL DAM
    │ │ │ +0005fae0: 4147 4553 2028 494e 434c 5544 494e 472c  AGES (INCLUDING,
    │ │ │ +0005faf0: 2042 5554 204e 4f54 204c 494d 4954 4544   BUT NOT LIMITED
    │ │ │ +0005fb00: 2054 4f2c 2050 524f 4355 5245 4d45 4e54   TO, PROCUREMENT
    │ │ │ +0005fb10: 204f 460a 5355 4253 5449 5455 5445 2047   OF.SUBSTITUTE G
    │ │ │ +0005fb20: 4f4f 4453 204f 5220 5345 5256 4943 4553  OODS OR SERVICES
    │ │ │ +0005fb30: 3b20 4c4f 5353 204f 4620 5553 452c 2044  ; LOSS OF USE, D
    │ │ │ +0005fb40: 4154 412c 204f 5220 5052 4f46 4954 533b  ATA, OR PROFITS;
    │ │ │ +0005fb50: 204f 5220 4255 5349 4e45 5353 0a49 4e54   OR BUSINESS.INT
    │ │ │ +0005fb60: 4552 5255 5054 494f 4e29 2048 4f57 4556  ERRUPTION) HOWEV
    │ │ │ +0005fb70: 4552 2043 4155 5345 4420 414e 4420 4f4e  ER CAUSED AND ON
    │ │ │ +0005fb80: 2041 4e59 2054 4845 4f52 5920 4f46 204c   ANY THEORY OF L
    │ │ │ +0005fb90: 4941 4249 4c49 5459 2c20 5748 4554 4845  IABILITY, WHETHE
    │ │ │ +0005fba0: 5220 494e 0a43 4f4e 5452 4143 542c 2053  R IN.CONTRACT, S
    │ │ │ +0005fbb0: 5452 4943 5420 4c49 4142 494c 4954 592c  TRICT LIABILITY,
    │ │ │ +0005fbc0: 204f 5220 544f 5254 2028 494e 434c 5544   OR TORT (INCLUD
    │ │ │ +0005fbd0: 494e 4720 4e45 474c 4947 454e 4345 204f  ING NEGLIGENCE O
    │ │ │ +0005fbe0: 5220 4f54 4845 5257 4953 4529 0a41 5249  R OTHERWISE).ARI
    │ │ │ +0005fbf0: 5349 4e47 2049 4e20 414e 5920 5741 5920  SING IN ANY WAY 
    │ │ │ +0005fc00: 4f55 5420 4f46 2054 4845 2055 5345 204f  OUT OF THE USE O
    │ │ │ +0005fc10: 4620 5448 4953 2053 4f46 5457 4152 452c  F THIS SOFTWARE,
    │ │ │ +0005fc20: 2045 5645 4e20 4946 2041 4456 4953 4544   EVEN IF ADVISED
    │ │ │ +0005fc30: 204f 4620 5448 450a 504f 5353 4942 494c   OF THE.POSSIBIL
    │ │ │ +0005fc40: 4954 5920 4f46 2053 5543 4820 4441 4d41  ITY OF SUCH DAMA
    │ │ │ +0005fc50: 4745 2e0a 0a2a 2f0a 0a23 696e 636c 7564  GE...*/..#includ
    │ │ │ +0005fc60: 6520 226c 6962 746f 7272 656e 742f 6175  e "libtorrent/au
    │ │ │ +0005fc70: 785f 2f69 705f 6e6f 7469 6669 6572 2e68  x_/ip_notifier.h
    │ │ │ +0005fc80: 7070 220a 2369 6e63 6c75 6465 2022 6c69  pp".#include "li
    │ │ │ +0005fc90: 6274 6f72 7265 6e74 2f61 7373 6572 742e  btorrent/assert.
    │ │ │ +0005fca0: 6870 7022 0a0a 2369 6620 6465 6669 6e65  hpp"..#if define
    │ │ │ +0005fcb0: 6420 544f 5252 454e 545f 4255 494c 445f  d TORRENT_BUILD_
    │ │ │ +0005fcc0: 5349 4d55 4c41 544f 520a 3c64 6976 2073  SIMULATOR.
    #elif TO │ │ │ +0005fd00: 5252 454e 545f 5553 455f 4e45 544c 494e RRENT_USE_NETLIN │ │ │ +0005fd10: 4b0a 3c2f 6469 763e 2369 6e63 6c75 6465 K.
    #include │ │ │ +0005fd20: 2022 6c69 6274 6f72 7265 6e74 2f6e 6574 "libtorrent/net │ │ │ +0005fd30: 6c69 6e6b 2e68 7070 220a 2369 6e63 6c75 link.hpp".#inclu │ │ │ +0005fd40: 6465 2022 6c69 6274 6f72 7265 6e74 2f73 de "libtorrent/s │ │ │ +0005fd50: 6f63 6b65 742e 6870 7022 0a23 696e 636c ocket.hpp".#incl │ │ │ +0005fd60: 7564 6520 266c 743b 6172 7261 7926 6774 ude <array> │ │ │ +0005fd70: 3b0a 2369 6e63 6c75 6465 2026 6c74 3b75 ;.#include <u │ │ │ +0005fd80: 6e6f 7264 6572 6564 5f6d 6170 2667 743b nordered_map> │ │ │ +0005fd90: 0a23 656c 6966 2054 4f52 5245 4e54 5f55 .#elif TORRENT_U │ │ │ +0005fda0: 5345 5f53 5953 5445 4d43 4f4e 4649 4755 SE_SYSTEMCONFIGU │ │ │ +0005fdb0: 5241 5449 4f4e 207c 7c20 544f 5252 454e RATION || TORREN │ │ │ +0005fdc0: 545f 5553 455f 5343 5f4e 4554 574f 524b T_USE_SC_NETWORK │ │ │ +0005fdd0: 5f52 4541 4348 4142 494c 4954 590a 2369 _REACHABILITY.#i │ │ │ +0005fde0: 6e63 6c75 6465 2026 6c74 3b53 7973 7465 nclude <Syste │ │ │ +0005fdf0: 6d43 6f6e 6669 6775 7261 7469 6f6e 2f53 mConfiguration/S │ │ │ +0005fe00: 7973 7465 6d43 6f6e 6669 6775 7261 7469 ystemConfigurati │ │ │ +0005fe10: 6f6e 2e68 2667 743b 0a23 656c 6966 2064 on.h>.#elif d │ │ │ +0005fe20: 6566 696e 6564 2054 4f52 5245 4e54 5f57 efined TORRENT_W │ │ │ +0005fe30: 494e 444f 5753 0a23 696e 636c 7564 6520 INDOWS.#include │ │ │ +0005fe40: 226c 6962 746f 7272 656e 742f 6175 785f "libtorrent/aux_ │ │ │ +0005fe50: 2f74 6872 6f77 2e68 7070 220a 2369 6e63 /throw.hpp".#inc │ │ │ +0005fe60: 6c75 6465 2022 6c69 6274 6f72 7265 6e74 lude "libtorrent │ │ │ +0005fe70: 2f61 7578 5f2f 6469 7361 626c 655f 7761 /aux_/disable_wa │ │ │ +0005fe80: 726e 696e 6773 5f70 7573 682e 6870 7022 rnings_push.hpp" │ │ │ +0005fe90: 0a23 696e 636c 7564 6520 266c 743b 6970 .#include <ip │ │ │ +0005fea0: 686c 7061 7069 2e68 2667 743b 0a23 6966 hlpapi.h>.#if │ │ │ +0005feb0: 6465 6620 544f 5252 454e 545f 5749 4e52 def TORRENT_WINR │ │ │ +0005fec0: 540a 2369 6e63 6c75 6465 2026 6c74 3b6e T.#include <n │ │ │ +0005fed0: 6574 696f 6170 692e 6826 6774 3b0a 2365 etioapi.h>.#e │ │ │ +0005fee0: 6e64 6966 0a23 696e 636c 7564 6520 266c ndif.#include &l │ │ │ +0005fef0: 743b 6d75 7465 7826 6774 3b0a 2369 6e63 t;mutex>.#inc │ │ │ +0005ff00: 6c75 6465 2022 6c69 6274 6f72 7265 6e74 lude "libtorrent │ │ │ +0005ff10: 2f61 7578 5f2f 6469 7361 626c 655f 7761 /aux_/disable_wa │ │ │ +0005ff20: 726e 696e 6773 5f70 6f70 2e68 7070 220a rnings_pop.hpp". │ │ │ +0005ff30: 2365 6e64 6966 0a0a 2369 6e63 6c75 6465 #endif..#include │ │ │ +0005ff40: 2022 6c69 6274 6f72 7265 6e74 2f61 7578 "libtorrent/aux │ │ │ +0005ff50: 5f2f 6e65 746c 696e 6b5f 7574 696c 732e _/netlink_utils. │ │ │ +0005ff60: 6870 7022 0a0a 6e61 6d65 7370 6163 6520 hpp"..namespace │ │ │ +0005ff70: 6c69 6274 6f72 7265 6e74 207b 206e 616d libtorrent { nam │ │ │ +0005ff80: 6573 7061 6365 2061 7578 207b 0a0a 6e61 espace aux {..na │ │ │ +0005ff90: 6d65 7370 6163 6520 7b0a 0a23 6966 2028 mespace {..#if ( │ │ │ +0005ffa0: 544f 5252 454e 545f 5553 455f 5359 5354 TORRENT_USE_SYST │ │ │ +0005ffb0: 454d 434f 4e46 4947 5552 4154 494f 4e20 EMCONFIGURATION │ │ │ +0005ffc0: 7c7c 2054 4f52 5245 4e54 5f55 5345 5f53 || TORRENT_USE_S │ │ │ +0005ffd0: 435f 4e45 5457 4f52 4b5f 5245 4143 4841 C_NETWORK_REACHA │ │ │ +0005ffe0: 4249 4c49 5459 2920 2661 6d70 3b26 616d BILITY) &&am │ │ │ +0005fff0: 703b 205c 0a09 2164 6566 696e 6564 2054 p; \..!defined T │ │ │ +00060000: 4f52 5245 4e54 5f42 5549 4c44 5f53 494d ORRENT_BUILD_SIM │ │ │ +00060010: 554c 4154 4f52 0a0a 2f2f 2063 6f6d 6d6f ULATOR..// commo │ │ │ +00060020: 6e20 7574 696c 6974 6965 7320 666f 7220 n utilities for │ │ │ +00060030: 4d61 6320 616e 6420 694f 530a 7465 6d70 Mac and iOS.temp │ │ │ +00060040: 6c61 7465 2026 6c74 3b74 7970 656e 616d late <typenam │ │ │ +00060050: 6520 5426 6774 3b20 766f 6964 2043 4652 e T> void CFR │ │ │ +00060060: 6566 5265 7461 696e 2854 2068 2920 7b20 efRetain(T h) { │ │ │ +00060070: 4346 5265 7461 696e 2868 293b 207d 0a74 CFRetain(h); }.t │ │ │ +00060080: 656d 706c 6174 6520 266c 743b 7479 7065 emplate <type │ │ │ +00060090: 6e61 6d65 2054 2667 743b 2076 6f69 6420 name T> void │ │ │ +000600a0: 4346 5265 6652 656c 6561 7365 2854 2068 CFRefRelease(T h │ │ │ +000600b0: 2920 7b20 4346 5265 6c65 6173 6528 6829 ) { CFRelease(h) │ │ │ +000600c0: 3b20 7d0a 0a3c 2f70 7265 3e3c 2f74 643e ; }..
    │ │ │ +000600d0: 3c2f 7472 3e3c 7472 2073 7479 6c65 3d22 relevance& │ │ │ +00060100: 6e62 7370 3b30 3c2f 7464 3e3c 7464 3e3c nbsp;0< │ │ │ +00060110: 6120 6872 6566 3d22 6a61 7661 7363 7269 a href="javascri │ │ │ +00060120: 7074 3a65 7870 616e 6428 3232 3129 223e pt:expand(221)"> │ │ │ +00060130: 2e2e 2f73 7263 2f70 655f 6372 7970 746f ../src/pe_crypto │ │ │ +00060140: 2e63 7070 3a36 303c 2f61 3e3c 2f74 643e .cpp:60
    │ │ │ +00060150: 3c74 643e 6974 2077 6f75 6c64 2062 6520 it would be │ │ │ +00060160: 6e69 6365 2074 6f20 6765 7420 7468 6520 nice to get the │ │ │ +00060170: 6c69 7465 7261 6c20 776f 726b 696e 673c literal working< │ │ │ +00060180: 2f74 643e 3c2f 7472 3e3c 7472 2069 643d /td>

    it │ │ │ +000601d0: 776f 756c 6420 6265 206e 6963 6520 746f would be nice to │ │ │ +000601e0: 2067 6574 2074 6865 206c 6974 6572 616c get the literal │ │ │ +000601f0: 2077 6f72 6b69 6e67 3c2f 6832 3e3c 6834 working

    ../src/pe_crypt │ │ │ +00060210: 6f2e 6370 703a 3630 3c2f 6834 3e3c 7072 o.cpp:60

    #include │ │ │ +00060260: 266c 743b 616c 676f 7269 7468 6d26 6774 <algorithm> │ │ │ +00060270: 3b0a 2369 6e63 6c75 6465 2026 6c74 3b72 ;.#include <r │ │ │ +00060280: 616e 646f 6d26 6774 3b0a 0a23 696e 636c andom>..#incl │ │ │ +00060290: 7564 6520 226c 6962 746f 7272 656e 742f ude "libtorrent/ │ │ │ +000602a0: 6175 785f 2f64 6973 6162 6c65 5f77 6172 aux_/disable_war │ │ │ +000602b0: 6e69 6e67 735f 7075 7368 2e68 7070 220a nings_push.hpp". │ │ │ +000602c0: 0a23 696e 636c 7564 6520 266c 743b 626f .#include <bo │ │ │ +000602d0: 6f73 742f 6d75 6c74 6970 7265 6369 7369 ost/multiprecisi │ │ │ +000602e0: 6f6e 2f69 6e74 6567 6572 2e68 7070 2667 on/integer.hpp&g │ │ │ +000602f0: 743b 0a23 696e 636c 7564 6520 266c 743b t;.#include < │ │ │ +00060300: 626f 6f73 742f 6d75 6c74 6970 7265 6369 boost/multipreci │ │ │ +00060310: 7369 6f6e 2f63 7070 5f69 6e74 2e68 7070 sion/cpp_int.hpp │ │ │ +00060320: 2667 743b 0a0a 2369 6e63 6c75 6465 2022 >..#include " │ │ │ +00060330: 6c69 6274 6f72 7265 6e74 2f61 7578 5f2f libtorrent/aux_/ │ │ │ +00060340: 6469 7361 626c 655f 7761 726e 696e 6773 disable_warnings │ │ │ +00060350: 5f70 6f70 2e68 7070 220a 0a23 696e 636c _pop.hpp"..#incl │ │ │ +00060360: 7564 6520 226c 6962 746f 7272 656e 742f ude "libtorrent/ │ │ │ +00060370: 7261 6e64 6f6d 2e68 7070 220a 2369 6e63 random.hpp".#inc │ │ │ +00060380: 6c75 6465 2022 6c69 6274 6f72 7265 6e74 lude "libtorrent │ │ │ +00060390: 2f61 7578 5f2f 616c 6c6f 6361 2e68 7070 /aux_/alloca.hpp │ │ │ +000603a0: 220a 2369 6e63 6c75 6465 2022 6c69 6274 ".#include "libt │ │ │ +000603b0: 6f72 7265 6e74 2f70 655f 6372 7970 746f orrent/pe_crypto │ │ │ +000603c0: 2e68 7070 220a 2369 6e63 6c75 6465 2022 .hpp".#include " │ │ │ +000603d0: 6c69 6274 6f72 7265 6e74 2f68 6173 6865 libtorrent/hashe │ │ │ +000603e0: 722e 6870 7022 0a0a 6e61 6d65 7370 6163 r.hpp"..namespac │ │ │ +000603f0: 6520 6c69 6274 6f72 7265 6e74 207b 0a0a e libtorrent {.. │ │ │ +00060400: 096e 616d 6573 7061 6365 206d 7020 3d20 .namespace mp = │ │ │ +00060410: 626f 6f73 743a 3a6d 756c 7469 7072 6563 boost::multiprec │ │ │ +00060420: 6973 696f 6e3b 0a0a 096e 616d 6573 7061 ision;...namespa │ │ │ +00060430: 6365 207b 0a3c 6469 7620 7374 796c 653d ce {.
    ..key_t const │ │ │ +00060470: 2064 685f 7072 696d 650a 3c2f 6469 763e dh_prime.
    │ │ │ +00060480: 0909 0928 2230 7846 4646 4646 4646 4646 ...("0xFFFFFFFFF │ │ │ +00060490: 4646 4646 4646 4643 3930 4644 4141 3232 FFFFFFFC90FDAA22 │ │ │ +000604a0: 3136 3843 3233 3443 3443 3636 3238 4238 168C234C4C6628B8 │ │ │ +000604b0: 3044 4331 4344 3132 3930 3234 4530 3838 0DC1CD129024E088 │ │ │ +000604c0: 4136 3743 4337 3430 3230 4242 4541 3633 A67CC74020BBEA63 │ │ │ +000604d0: 4231 3339 4232 3235 3134 4130 3837 3938 B139B22514A08798 │ │ │ +000604e0: 4533 3430 3444 4445 4639 3531 3942 3343 E3404DDEF9519B3C │ │ │ +000604f0: 4433 4134 3331 4233 3032 4230 4136 4446 D3A431B302B0A6DF │ │ │ +00060500: 3235 4631 3433 3734 4645 3133 3536 4436 25F14374FE1356D6 │ │ │ +00060510: 4435 3143 3234 3545 3438 3542 3537 3636 D51C245E485B5766 │ │ │ +00060520: 3235 4537 4543 3646 3434 4334 3245 3941 25E7EC6F44C42E9A │ │ │ +00060530: 3633 4133 3632 3130 3030 3030 3030 3030 63A3621000000000 │ │ │ +00060540: 3030 3930 3536 3322 293b 0a09 7d0a 0a09 0090563");..}... │ │ │ +00060550: 7374 643a 3a61 7272 6179 266c 743b 6368 std::array<ch │ │ │ +00060560: 6172 2c20 3936 2667 743b 2065 7870 6f72 ar, 96> expor │ │ │ +00060570: 745f 6b65 7928 6b65 795f 7420 636f 6e73 t_key(key_t cons │ │ │ +00060580: 7426 616d 703b 206b 290a 097b 0a09 0973 t& k)..{...s │ │ │ +00060590: 7464 3a3a 6172 7261 7926 6c74 3b63 6861 td::array<cha │ │ │ +000605a0: 722c 2039 3626 6774 3b20 7265 743b 0a09 r, 96> ret;.. │ │ │ +000605b0: 0961 7574 6f2a 2062 6567 696e 203d 2072 .auto* begin = r │ │ │ +000605c0: 6569 6e74 6572 7072 6574 5f63 6173 7426 einterpret_cast& │ │ │ +000605d0: 6c74 3b73 7464 3a3a 7569 6e74 385f 742a lt;std::uint8_t* │ │ │ +000605e0: 2667 743b 2872 6574 2e64 6174 6128 2929 >(ret.data()) │ │ │ +000605f0: 3b0a 0909 7374 643a 3a75 696e 7438 5f74 ;...std::uint8_t │ │ │ +00060600: 2a20 656e 6420 3d20 6d70 3a3a 6578 706f * end = mp::expo │ │ │ +00060610: 7274 5f62 6974 7328 6b2c 2062 6567 696e rt_bits(k, begin │ │ │ +00060620: 2c20 3829 3b0a 0a3c 2f70 7265 3e3c 2f74 , 8);..relevanc │ │ │ +00060660: 6526 6e62 7370 3b30 3c2f 7464 3e3c 7464 e 0../src/pe_cryp │ │ │ +000606a0: 746f 2e63 7070 3a37 313c 2f61 3e3c 2f74 to.cpp:71it would b │ │ │ +000606c0: 6520 6e69 6365 2074 6f20 6265 2061 626c e nice to be abl │ │ │ +000606d0: 6520 746f 2065 7870 6f72 7420 746f 2061 e to export to a │ │ │ +000606e0: 2066 6978 6564 2077 6964 7468 2066 6965 fixed width fie │ │ │ +000606f0: 6c64 2c20 736f 2077 6520 776f 756c 646e ld, so we wouldn │ │ │ +00060700: 2774 2068 6176 6520 746f 2073 6869 6674 't have to shift │ │ │ +00060710: 2069 7420 6c61 7465 723c 2f74 643e 3c2f it later

    it would │ │ │ +00060770: 6265 206e 6963 6520 746f 2062 6520 6162 be nice to be ab │ │ │ +00060780: 6c65 2074 6f20 6578 706f 7274 2074 6f20 le to export to │ │ │ +00060790: 6120 6669 7865 6420 7769 6474 6820 6669 a fixed width fi │ │ │ +000607a0: 656c 642c 2073 6f0a 7765 2077 6f75 6c64 eld, so.we would │ │ │ +000607b0: 6e27 7420 6861 7665 2074 6f20 7368 6966 n't have to shif │ │ │ +000607c0: 7420 6974 206c 6174 6572 3c2f 6832 3e3c t it later

    < │ │ │ +000607d0: 6834 3e2e 2e2f 7372 632f 7065 5f63 7279 h4>../src/pe_cry │ │ │ +000607e0: 7074 6f2e 6370 703a 3731 3c2f 6834 3e3c pto.cpp:71< │ │ │ +000607f0: 7072 6520 7374 796c 653d 2262 6163 6b67 pre style="backg │ │ │ +00060800: 726f 756e 643a 2023 6636 6636 6636 3b20 round: #f6f6f6; │ │ │ +00060810: 626f 7264 6572 3a20 736f 6c69 6420 3170 border: solid 1p │ │ │ +00060820: 7820 2364 6464 3b22 3e23 696e 636c 7564 x #ddd;">#includ │ │ │ +00060830: 6520 226c 6962 746f 7272 656e 742f 7261 e "libtorrent/ra │ │ │ +00060840: 6e64 6f6d 2e68 7070 220a 2369 6e63 6c75 ndom.hpp".#inclu │ │ │ +00060850: 6465 2022 6c69 6274 6f72 7265 6e74 2f61 de "libtorrent/a │ │ │ +00060860: 7578 5f2f 616c 6c6f 6361 2e68 7070 220a ux_/alloca.hpp". │ │ │ +00060870: 2369 6e63 6c75 6465 2022 6c69 6274 6f72 #include "libtor │ │ │ +00060880: 7265 6e74 2f70 655f 6372 7970 746f 2e68 rent/pe_crypto.h │ │ │ +00060890: 7070 220a 2369 6e63 6c75 6465 2022 6c69 pp".#include "li │ │ │ +000608a0: 6274 6f72 7265 6e74 2f68 6173 6865 722e btorrent/hasher. │ │ │ +000608b0: 6870 7022 0a0a 6e61 6d65 7370 6163 6520 hpp"..namespace │ │ │ +000608c0: 6c69 6274 6f72 7265 6e74 207b 0a0a 096e libtorrent {...n │ │ │ +000608d0: 616d 6573 7061 6365 206d 7020 3d20 626f amespace mp = bo │ │ │ +000608e0: 6f73 743a 3a6d 756c 7469 7072 6563 6973 ost::multiprecis │ │ │ +000608f0: 696f 6e3b 0a0a 096e 616d 6573 7061 6365 ion;...namespace │ │ │ +00060900: 207b 0a09 096b 6579 5f74 2063 6f6e 7374 {...key_t const │ │ │ +00060910: 2064 685f 7072 696d 650a 0909 0928 2230 dh_prime....("0 │ │ │ +00060920: 7846 4646 4646 4646 4646 4646 4646 4646 xFFFFFFFFFFFFFFF │ │ │ +00060930: 4643 3930 4644 4141 3232 3136 3843 3233 FC90FDAA22168C23 │ │ │ +00060940: 3443 3443 3636 3238 4238 3044 4331 4344 4C4C6628B80DC1CD │ │ │ +00060950: 3132 3930 3234 4530 3838 4136 3743 4337 129024E088A67CC7 │ │ │ +00060960: 3430 3230 4242 4541 3633 4231 3339 4232 4020BBEA63B139B2 │ │ │ +00060970: 3235 3134 4130 3837 3938 4533 3430 3444 2514A08798E3404D │ │ │ +00060980: 4445 4639 3531 3942 3343 4433 4134 3331 DEF9519B3CD3A431 │ │ │ +00060990: 4233 3032 4230 4136 4446 3235 4631 3433 B302B0A6DF25F143 │ │ │ +000609a0: 3734 4645 3133 3536 4436 4435 3143 3234 74FE1356D6D51C24 │ │ │ +000609b0: 3545 3438 3542 3537 3636 3235 4537 4543 5E485B576625E7EC │ │ │ +000609c0: 3646 3434 4334 3245 3941 3633 4133 3632 6F44C42E9A63A362 │ │ │ +000609d0: 3130 3030 3030 3030 3030 3030 3930 3536 1000000000009056 │ │ │ +000609e0: 3322 293b 0a09 7d0a 0a09 7374 643a 3a61 3");..}...std::a │ │ │ +000609f0: 7272 6179 266c 743b 6368 6172 2c20 3936 rray<char, 96 │ │ │ +00060a00: 2667 743b 2065 7870 6f72 745f 6b65 7928 > export_key( │ │ │ +00060a10: 6b65 795f 7420 636f 6e73 7426 616d 703b key_t const& │ │ │ +00060a20: 206b 290a 097b 0a09 0973 7464 3a3a 6172 k)..{...std::ar │ │ │ +00060a30: 7261 7926 6c74 3b63 6861 722c 2039 3626 ray<char, 96& │ │ │ +00060a40: 6774 3b20 7265 743b 0a09 0961 7574 6f2a gt; ret;...auto* │ │ │ +00060a50: 2062 6567 696e 203d 2072 6569 6e74 6572 begin = reinter │ │ │ +00060a60: 7072 6574 5f63 6173 7426 6c74 3b73 7464 pret_cast<std │ │ │ +00060a70: 3a3a 7569 6e74 385f 742a 2667 743b 2872 ::uint8_t*>(r │ │ │ +00060a80: 6574 2e64 6174 6128 2929 3b0a 0909 7374 et.data());...st │ │ │ +00060a90: 643a 3a75 696e 7438 5f74 2a20 656e 6420 d::uint8_t* end │ │ │ +00060aa0: 3d20 6d70 3a3a 6578 706f 7274 5f62 6974 = mp::export_bit │ │ │ +00060ab0: 7328 6b2c 2062 6567 696e 2c20 3829 3b0a s(k, begin, 8);. │ │ │ +00060ac0: 0a3c 6469 7620 7374 796c 653d 2262 6163 .
    . │ │ │ +00060af0: 0969 6620 2865 6e64 2026 6c74 3b20 6265 .if (end < be │ │ │ +00060b00: 6769 6e20 2b20 3936 290a 3c2f 6469 763e gin + 96).
    │ │ │ +00060b10: 0909 7b0a 0909 0969 6e74 2063 6f6e 7374 ..{....int const │ │ │ +00060b20: 206c 656e 203d 2069 6e74 2865 6e64 202d len = int(end - │ │ │ +00060b30: 2062 6567 696e 293b 0a23 6966 2064 6566 begin);.#if def │ │ │ +00060b40: 696e 6564 205f 5f47 4e55 435f 5f20 2661 ined __GNUC__ &a │ │ │ +00060b50: 6d70 3b26 616d 703b 205f 5f47 4e55 435f mp;& __GNUC_ │ │ │ +00060b60: 5f20 3d3d 2031 320a 2370 7261 676d 6120 _ == 12.#pragma │ │ │ +00060b70: 4743 4320 6469 6167 6e6f 7374 6963 2070 GCC diagnostic p │ │ │ +00060b80: 7573 680a 2370 7261 676d 6120 4743 4320 ush.#pragma GCC │ │ │ +00060b90: 6469 6167 6e6f 7374 6963 2069 676e 6f72 diagnostic ignor │ │ │ +00060ba0: 6564 2022 2d57 7374 7269 6e67 6f70 2d6f ed "-Wstringop-o │ │ │ +00060bb0: 7665 7266 6c6f 7722 0a23 656e 6469 660a verflow".#endif. │ │ │ +00060bc0: 0909 0973 7464 3a3a 6d65 6d6d 6f76 6528 ...std::memmove( │ │ │ +00060bd0: 6265 6769 6e20 2b20 3936 202d 206c 656e begin + 96 - len │ │ │ +00060be0: 2c20 6265 6769 6e2c 2061 7578 3a3a 6e75 , begin, aux::nu │ │ │ +00060bf0: 6d65 7269 635f 6361 7374 266c 743b 7374 meric_cast<st │ │ │ +00060c00: 643a 3a73 697a 655f 7426 6774 3b28 6c65 d::size_t>(le │ │ │ +00060c10: 6e29 293b 0a23 6966 2064 6566 696e 6564 n));.#if defined │ │ │ +00060c20: 205f 5f47 4e55 435f 5f20 2661 6d70 3b26 __GNUC__ && │ │ │ +00060c30: 616d 703b 205f 5f47 4e55 435f 5f20 3d3d amp; __GNUC__ == │ │ │ +00060c40: 2031 320a 2370 7261 676d 6120 4743 4320 12.#pragma GCC │ │ │ +00060c50: 6469 6167 6e6f 7374 6963 2070 6f70 0a23 diagnostic pop.# │ │ │ +00060c60: 656e 6469 660a 0909 0973 7464 3a3a 6d65 endif....std::me │ │ │ +00060c70: 6d73 6574 2862 6567 696e 2c20 302c 2061 mset(begin, 0, a │ │ │ +00060c80: 7578 3a3a 6e75 6d65 7269 635f 6361 7374 ux::numeric_cast │ │ │ +00060c90: 266c 743b 7374 643a 3a73 697a 655f 7426 <std::size_t& │ │ │ +00060ca0: 6774 3b28 3936 202d 206c 656e 2929 3b0a gt;(96 - len));. │ │ │ +00060cb0: 0909 7d0a 0909 7265 7475 726e 2072 6574 ..}...return ret │ │ │ +00060cc0: 3b0a 097d 0a0a 0976 6f69 6420 7263 345f ;..}...void rc4_ │ │ │ +00060cd0: 696e 6974 2863 6f6e 7374 2075 6e73 6967 init(const unsig │ │ │ +00060ce0: 6e65 6420 6368 6172 2a20 696e 2c20 7374 ned char* in, st │ │ │ +00060cf0: 643a 3a73 697a 655f 7420 6c65 6e2c 2072 d::size_t len, r │ │ │ +00060d00: 6334 202a 7374 6174 6529 3b0a 0973 7464 c4 *state);..std │ │ │ +00060d10: 3a3a 7369 7a65 5f74 2072 6334 5f65 6e63 ::size_t rc4_enc │ │ │ +00060d20: 7279 7074 2875 6e73 6967 6e65 6420 6368 rypt(unsigned ch │ │ │ +00060d30: 6172 202a 6f75 742c 2073 7464 3a3a 7369 ar *out, std::si │ │ │ +00060d40: 7a65 5f74 206f 7574 6c65 6e2c 2072 6334 ze_t outlen, rc4 │ │ │ +00060d50: 202a 7374 6174 6529 3b0a 0a09 2f2f 2053 *state);...// S │ │ │ +00060d60: 6574 2074 6865 2070 7269 6d65 2050 2061 et the prime P a │ │ │ +00060d70: 6e64 2074 6865 2067 656e 6572 6174 6f72 nd the generator │ │ │ +00060d80: 2c20 6765 6e65 7261 7465 206c 6f63 616c , generate local │ │ │ +00060d90: 2070 7562 6c69 6320 6b65 790a 0964 685f public key..dh_ │ │ │ +00060da0: 6b65 795f 6578 6368 616e 6765 3a3a 6468 key_exchange::dh │ │ │ +00060db0: 5f6b 6579 5f65 7863 6861 6e67 6528 290a _key_exchange(). │ │ │ +00060dc0: 097b 0a09 0961 7578 3a3a 6172 7261 7926 .{...aux::array& │ │ │ +00060dd0: 6c74 3b73 7464 3a3a 7569 6e74 385f 742c lt;std::uint8_t, │ │ │ +00060de0: 2039 3626 6774 3b20 7261 6e64 6f6d 5f6b 96> random_k │ │ │ +00060df0: 6579 3b0a 0909 6175 783a 3a72 616e 646f ey;...aux::rando │ │ │ +00060e00: 6d5f 6279 7465 7328 7b72 6569 6e74 6572 m_bytes({reinter │ │ │ +00060e10: 7072 6574 5f63 6173 7426 6c74 3b63 6861 pret_cast<cha │ │ │ +00060e20: 722a 2667 743b 2872 616e 646f 6d5f 6b65 r*>(random_ke │ │ │ +00060e30: 792e 6461 7461 2829 290a 0909 092c 2073 y.data())...., s │ │ │ +00060e40: 7461 7469 635f 6361 7374 266c 743b 7374 tatic_cast<st │ │ │ +00060e50: 643a 3a70 7472 6469 6666 5f74 2667 743b d::ptrdiff_t> │ │ │ +00060e60: 2872 616e 646f 6d5f 6b65 792e 7369 7a65 (random_key.size │ │ │ +00060e70: 2829 297d 293b 0a0a 0909 2f2f 2063 7265 ())});....// cre │ │ │ +00060e80: 6174 6520 6c6f 6361 6c20 6b65 7920 2872 ate local key (r │ │ │ +00060e90: 616e 646f 6d29 0a09 096d 703a 3a69 6d70 andom)...mp::imp │ │ │ +00060ea0: 6f72 745f 6269 7473 286d 5f64 685f 6c6f ort_bits(m_dh_lo │ │ │ +00060eb0: 6361 6c5f 7365 6372 6574 2c20 7261 6e64 cal_secret, rand │ │ │ +00060ec0: 6f6d 5f6b 6579 2e62 6567 696e 2829 2c20 om_key.begin(), │ │ │ +00060ed0: 7261 6e64 6f6d 5f6b 6579 2e65 6e64 2829 random_key.end() │ │ │ +00060ee0: 293b 0a0a 0909 2f2f 206b 6579 203d 2028 );....// key = ( │ │ │ +00060ef0: 3220 5e20 7365 6372 6574 2920 2520 7072 2 ^ secret) % pr │ │ │ +00060f00: 696d 650a 0909 6d5f 6468 5f6c 6f63 616c ime...m_dh_local │ │ │ +00060f10: 5f6b 6579 203d 206d 703a 3a70 6f77 6d28 _key = mp::powm( │ │ │ +00060f20: 6b65 795f 7428 3229 2c20 6d5f 6468 5f6c key_t(2), m_dh_l │ │ │ +00060f30: 6f63 616c 5f73 6563 7265 742c 2064 685f ocal_secret, dh_ │ │ │ +00060f40: 7072 696d 6529 3b0a 3c2f 7072 653e 3c2f prime);.relevan │ │ │ +00060f80: 6365 266e 6273 703b 303c 2f74 643e 3c74 ce 0../src/mmap_d │ │ │ +00060fc0: 6973 6b5f 696f 2e63 7070 3a35 3738 3c2f isk_io.cpp:578in th │ │ │ +00060fe0: 6520 6675 7475 7265 2c20 7072 6f70 6167 e future, propag │ │ │ +00060ff0: 6174 6520 6578 6365 7074 696f 6e73 2062 ate exceptions b │ │ │ +00061000: 6163 6b20 746f 2074 6865 2068 616e 646c ack to the handl │ │ │ +00061010: 6572 733c 2f74 643e 3c2f 7472 3e3c 7472 ers

    in the future, │ │ │ +00061070: 7072 6f70 6167 6174 6520 6578 6365 7074 propagate except │ │ │ +00061080: 696f 6e73 2062 6163 6b20 746f 2074 6865 ions back to the │ │ │ +00061090: 2068 616e 646c 6572 733c 2f68 323e 3c68 handlers

    ../src/mmap_di │ │ │ +000610b0: 736b 5f69 6f2e 6370 703a 3537 383c 2f68 sk_io.cpp:578
    #if 
    │ │ │ +00061100: 4445 4255 475f 4449 534b 5f54 4852 4541  DEBUG_DISK_THREA
    │ │ │ +00061110: 440a 0909 7b0a 0909 0973 7464 3a3a 756e  D...{....std::un
    │ │ │ +00061120: 6971 7565 5f6c 6f63 6b26 6c74 3b73 7464  ique_lock<std
    │ │ │ +00061130: 3a3a 6d75 7465 7826 6774 3b20 6c28 6d5f  ::mutex> l(m_
    │ │ │ +00061140: 6a6f 625f 6d75 7465 7829 3b0a 0a09 0909  job_mutex);.....
    │ │ │ +00061150: 444c 4f47 2822 7065 7266 6f72 6d5f 6a6f  DLOG("perform_jo
    │ │ │ +00061160: 6220 6a6f 623a 2025 7320 2820 2573 2573  b job: %s ( %s%s
    │ │ │ +00061170: 2920 7069 6563 653a 2025 6420 6f66 6673  ) piece: %d offs
    │ │ │ +00061180: 6574 3a20 2564 206f 7574 7374 616e 6469  et: %d outstandi
    │ │ │ +00061190: 6e67 3a20 2564 5c6e 220a 0909 0909 2c20  ng: %d\n"....., 
    │ │ │ +000611a0: 6a6f 625f 6163 7469 6f6e 5f6e 616d 655b  job_action_name[
    │ │ │ +000611b0: 6a2d 2667 743b 6163 7469 6f6e 5d0a 0909  j->action]...
    │ │ │ +000611c0: 0909 2c20 286a 2d26 6774 3b66 6c61 6773  .., (j->flags
    │ │ │ +000611d0: 2026 616d 703b 206d 6d61 705f 6469 736b   & mmap_disk
    │ │ │ +000611e0: 5f6a 6f62 3a3a 6665 6e63 6529 203f 2022  _job::fence) ? "
    │ │ │ +000611f0: 6665 6e63 6520 223a 2022 220a 0909 0909  fence ": "".....
    │ │ │ +00061200: 2c20 286a 2d26 6774 3b66 6c61 6773 2026  , (j->flags &
    │ │ │ +00061210: 616d 703b 206d 6d61 705f 6469 736b 5f6a  amp; mmap_disk_j
    │ │ │ +00061220: 6f62 3a3a 666f 7263 655f 636f 7079 2920  ob::force_copy) 
    │ │ │ +00061230: 3f20 2266 6f72 6365 5f63 6f70 7920 223a  ? "force_copy ":
    │ │ │ +00061240: 2022 220a 0909 0909 2c20 7374 6174 6963   ""....., static
    │ │ │ +00061250: 5f63 6173 7426 6c74 3b69 6e74 2667 743b  _cast<int>
    │ │ │ +00061260: 286a 2d26 6774 3b70 6965 6365 292c 206a  (j->piece), j
    │ │ │ +00061270: 2d26 6774 3b64 2e69 6f2e 6f66 6673 6574  ->d.io.offset
    │ │ │ +00061280: 0a09 0909 092c 206a 2d26 6774 3b73 746f  ....., j->sto
    │ │ │ +00061290: 7261 6765 203f 206a 2d26 6774 3b73 746f  rage ? j->sto
    │ │ │ +000612a0: 7261 6765 2d26 6774 3b6e 756d 5f6f 7574  rage->num_out
    │ │ │ +000612b0: 7374 616e 6469 6e67 5f6a 6f62 7328 2920  standing_jobs() 
    │ │ │ +000612c0: 3a20 2d31 293b 0a09 097d 0a23 656e 6469  : -1);...}.#endi
    │ │ │ +000612d0: 660a 0a09 0973 7464 3a3a 7368 6172 6564  f....std::shared
    │ │ │ +000612e0: 5f70 7472 266c 743b 6d6d 6170 5f73 746f  _ptr<mmap_sto
    │ │ │ +000612f0: 7261 6765 2667 743b 2073 746f 7261 6765  rage> storage
    │ │ │ +00061300: 203d 206a 2d26 6774 3b73 746f 7261 6765   = j->storage
    │ │ │ +00061310: 3b0a 0a09 0954 4f52 5245 4e54 5f41 5353  ;....TORRENT_ASS
    │ │ │ +00061320: 4552 5428 7374 6174 6963 5f63 6173 7426  ERT(static_cast&
    │ │ │ +00061330: 6c74 3b69 6e74 2667 743b 286a 2d26 6774  lt;int>(j->
    │ │ │ +00061340: 3b61 6374 696f 6e29 2026 6c74 3b20 696e  ;action) < in
    │ │ │ +00061350: 7428 6a6f 625f 6675 6e63 7469 6f6e 732e  t(job_functions.
    │ │ │ +00061360: 7369 7a65 2829 2929 3b0a 0a09 096d 5f73  size()));....m_s
    │ │ │ +00061370: 7461 7473 5f63 6f75 6e74 6572 732e 696e  tats_counters.in
    │ │ │ +00061380: 635f 7374 6174 735f 636f 756e 7465 7228  c_stats_counter(
    │ │ │ +00061390: 636f 756e 7465 7273 3a3a 6e75 6d5f 7275  counters::num_ru
    │ │ │ +000613a0: 6e6e 696e 675f 6469 736b 5f6a 6f62 732c  nning_disk_jobs,
    │ │ │ +000613b0: 2031 293b 0a0a 0909 2f2f 2063 616c 6c20   1);....// call 
    │ │ │ +000613c0: 6469 736b 2066 756e 6374 696f 6e0a 3c64  disk function...st
    │ │ │ +00061400: 6174 7573 5f74 2072 6574 203d 2073 7461  atus_t ret = sta
    │ │ │ +00061410: 7475 735f 743a 3a6e 6f5f 6572 726f 723b  tus_t::no_error;
    │ │ │ +00061420: 0a3c 2f64 6976 3e09 0974 7279 0a09 097b  ...try...{
    │ │ │ +00061430: 0a09 0909 696e 7420 636f 6e73 7420 6964  ....int const id
    │ │ │ +00061440: 7820 3d20 7374 6174 6963 5f63 6173 7426  x = static_cast&
    │ │ │ +00061450: 6c74 3b69 6e74 2667 743b 286a 2d26 6774  lt;int>(j->
    │ │ │ +00061460: 3b61 6374 696f 6e29 3b0a 0909 0972 6574  ;action);....ret
    │ │ │ +00061470: 203d 2028 7468 6973 2d26 6774 3b2a 286a   = (this->*(j
    │ │ │ +00061480: 6f62 5f66 756e 6374 696f 6e73 5b73 7461  ob_functions[sta
    │ │ │ +00061490: 7469 635f 6361 7374 266c 743b 7374 643a  tic_cast<std:
    │ │ │ +000614a0: 3a73 697a 655f 7426 6774 3b28 6964 7829  :size_t>(idx)
    │ │ │ +000614b0: 5d29 2928 6a29 3b0a 0909 7d0a 0909 6361  ]))(j);...}...ca
    │ │ │ +000614c0: 7463 6820 2862 6f6f 7374 3a3a 7379 7374  tch (boost::syst
    │ │ │ +000614d0: 656d 3a3a 7379 7374 656d 5f65 7272 6f72  em::system_error
    │ │ │ +000614e0: 2063 6f6e 7374 2661 6d70 3b20 6572 7229   const& err)
    │ │ │ +000614f0: 0a09 097b 0a09 0909 7265 7420 3d20 7374  ...{....ret = st
    │ │ │ +00061500: 6174 7573 5f74 3a3a 6661 7461 6c5f 6469  atus_t::fatal_di
    │ │ │ +00061510: 736b 5f65 7272 6f72 3b0a 0909 096a 2d26  sk_error;....j-&
    │ │ │ +00061520: 6774 3b65 7272 6f72 2e65 6320 3d20 6572  gt;error.ec = er
    │ │ │ +00061530: 722e 636f 6465 2829 3b0a 0909 096a 2d26  r.code();....j-&
    │ │ │ +00061540: 6774 3b65 7272 6f72 2e6f 7065 7261 7469  gt;error.operati
    │ │ │ +00061550: 6f6e 203d 206f 7065 7261 7469 6f6e 5f74  on = operation_t
    │ │ │ +00061560: 3a3a 6578 6365 7074 696f 6e3b 0a09 097d  ::exception;...}
    │ │ │ +00061570: 0a09 0963 6174 6368 2028 7374 643a 3a62  ...catch (std::b
    │ │ │ +00061580: 6164 5f61 6c6c 6f63 2063 6f6e 7374 2661  ad_alloc const&a
    │ │ │ +00061590: 6d70 3b29 0a09 097b 0a09 0909 7265 7420  mp;)...{....ret 
    │ │ │ +000615a0: 3d20 7374 6174 7573 5f74 3a3a 6661 7461  = status_t::fata
    │ │ │ +000615b0: 6c5f 6469 736b 5f65 7272 6f72 3b0a 0909  l_disk_error;...
    │ │ │ +000615c0: 096a 2d26 6774 3b65 7272 6f72 2e65 6320  .j->error.ec 
    │ │ │ +000615d0: 3d20 6572 726f 7273 3a3a 6e6f 5f6d 656d  = errors::no_mem
    │ │ │ +000615e0: 6f72 793b 0a09 0909 6a2d 2667 743b 6572  ory;....j->er
    │ │ │ +000615f0: 726f 722e 6f70 6572 6174 696f 6e20 3d20  ror.operation = 
    │ │ │ +00061600: 6f70 6572 6174 696f 6e5f 743a 3a65 7863  operation_t::exc
    │ │ │ +00061610: 6570 7469 6f6e 3b0a 0909 7d0a 0909 6361  eption;...}...ca
    │ │ │ +00061620: 7463 6820 2873 7464 3a3a 6578 6365 7074  tch (std::except
    │ │ │ +00061630: 696f 6e20 636f 6e73 7426 616d 703b 290a  ion const&).
    │ │ │ +00061640: 0909 7b0a 0909 0972 6574 203d 2073 7461  ..{....ret = sta
    │ │ │ +00061650: 7475 735f 743a 3a66 6174 616c 5f64 6973  tus_t::fatal_dis
    │ │ │ +00061660: 6b5f 6572 726f 723b 0a09 0909 6a2d 2667  k_error;....j-&g
    │ │ │ +00061670: 743b 6572 726f 722e 6563 203d 2062 6f6f  t;error.ec = boo
    │ │ │ +00061680: 7374 3a3a 6173 696f 3a3a 6572 726f 723a  st::asio::error:
    │ │ │ +00061690: 3a66 6175 6c74 3b0a 0909 096a 2d26 6774  :fault;....j->
    │ │ │ +000616a0: 3b65 7272 6f72 2e6f 7065 7261 7469 6f6e  ;error.operation
    │ │ │ +000616b0: 203d 206f 7065 7261 7469 6f6e 5f74 3a3a   = operation_t::
    │ │ │ +000616c0: 6578 6365 7074 696f 6e3b 0a09 097d 0a0a  exception;...}..
    │ │ │ +000616d0: 0909 2f2f 206e 6f74 6520 7468 6174 202d  ..// note that -
    │ │ │ +000616e0: 3220 6572 726f 7273 2061 7265 204f 4b0a  2 errors are OK.
    │ │ │ +000616f0: 0909 544f 5252 454e 545f 4153 5345 5254  ..TORRENT_ASSERT
    │ │ │ +00061700: 2872 6574 2021 3d20 7374 6174 7573 5f74  (ret != status_t
    │ │ │ +00061710: 3a3a 6661 7461 6c5f 6469 736b 5f65 7272  ::fatal_disk_err
    │ │ │ +00061720: 6f72 0a09 0909 7c7c 2028 6a2d 2667 743b  or....|| (j->
    │ │ │ +00061730: 6572 726f 722e 6563 2026 616d 703b 2661  error.ec &&a
    │ │ │ +00061740: 6d70 3b20 6a2d 2667 743b 6572 726f 722e  mp; j->error.
    │ │ │ +00061750: 6f70 6572 6174 696f 6e20 213d 206f 7065  operation != ope
    │ │ │ +00061760: 7261 7469 6f6e 5f74 3a3a 756e 6b6e 6f77  ration_t::unknow
    │ │ │ +00061770: 6e29 293b 0a0a 0909 6d5f 7374 6174 735f  n));....m_stats_
    │ │ │ +00061780: 636f 756e 7465 7273 2e69 6e63 5f73 7461  counters.inc_sta
    │ │ │ +00061790: 7473 5f63 6f75 6e74 6572 2863 6f75 6e74  ts_counter(count
    │ │ │ +000617a0: 6572 733a 3a6e 756d 5f72 756e 6e69 6e67  ers::num_running
    │ │ │ +000617b0: 5f64 6973 6b5f 6a6f 6273 2c20 2d31 293b  _disk_jobs, -1);
    │ │ │ +000617c0: 0a0a 3c2f 7072 653e 3c2f 7464 3e3c 2f74  ..
    < │ │ │ +000617f0: 7464 3e72 656c 6576 616e 6365 266e 6273 td>relevance&nbs │ │ │ +00061800: 703b 303c 2f74 643e 3c74 643e 3c61 2068 p;0../ │ │ │ +00061830: 7372 632f 6d6d 6170 5f64 6973 6b5f 696f src/mmap_disk_io │ │ │ +00061840: 2e63 7070 3a31 3031 373c 2f61 3e3c 2f74 .cpp:1017this is po │ │ │ +00061860: 7465 6e74 6961 6c6c 7920 7665 7279 2065 tentially very e │ │ │ +00061870: 7870 656e 7369 7665 2e20 4f6e 6520 7761 xpensive. One wa │ │ │ +00061880: 7920 746f 2073 6f6c 7665 2069 7420 776f y to solve it wo │ │ │ +00061890: 756c 6420 6265 2074 6f20 6861 7665 2061 uld be to have a │ │ │ +000618a0: 2066 656e 6365 2066 6f72 206a 7573 7420 fence for just │ │ │ +000618b0: 7468 6973 206f 6e65 2070 6965 6365 2e20 this one piece. │ │ │ +000618c0: 6275 7420 6974 2068 6172 646c 7920 7365 but it hardly se │ │ │ +000618d0: 656d 7320 776f 7274 6820 7468 6520 636f ems worth the co │ │ │ +000618e0: 6d70 6c65 7869 7479 2061 6e64 2063 6f73 mplexity and cos │ │ │ +000618f0: 7420 6a75 7374 2066 6f72 2074 6865 2065 t just for the e │ │ │ +00061900: 6467 6520 6361 7365 206f 6620 7265 6365 dge case of rece │ │ │ +00061910: 6976 696e 6720 6120 636f 7272 7570 7420 iving a corrupt │ │ │ +00061920: 7069 6563 653c 2f74 643e 3c2f 7472 3e3c piece< │ │ │ +00061930: 7472 2069 643d 2232 3234 2220 7374 796c tr id="224" styl │ │ │ +00061940: 653d 2264 6973 706c 6179 3a20 6e6f 6e65 e="display: none │ │ │ +00061950: 3b22 2063 6f6c 7370 616e 3d22 3322 3e3c ;" colspan="3">< │ │ │ +00061960: 7464 2063 6f6c 7370 616e 3d22 3322 3e3c td colspan="3">< │ │ │ +00061970: 6832 3e74 6869 7320 6973 2070 6f74 656e h2>this is poten │ │ │ +00061980: 7469 616c 6c79 2076 6572 7920 6578 7065 tially very expe │ │ │ +00061990: 6e73 6976 652e 204f 6e65 2077 6179 2074 nsive. One way t │ │ │ +000619a0: 6f20 736f 6c76 650a 6974 2077 6f75 6c64 o solve.it would │ │ │ +000619b0: 2062 6520 746f 2068 6176 6520 6120 6665 be to have a fe │ │ │ +000619c0: 6e63 6520 666f 7220 6a75 7374 2074 6869 nce for just thi │ │ │ +000619d0: 7320 6f6e 6520 7069 6563 652e 0a62 7574 s one piece..but │ │ │ +000619e0: 2069 7420 6861 7264 6c79 2073 6565 6d73 it hardly seems │ │ │ +000619f0: 2077 6f72 7468 2074 6865 2063 6f6d 706c worth the compl │ │ │ +00061a00: 6578 6974 7920 616e 6420 636f 7374 206a exity and cost j │ │ │ +00061a10: 7573 7420 666f 7220 7468 6520 6564 6765 ust for the edge │ │ │ +00061a20: 0a63 6173 6520 6f66 2072 6563 6569 7669 .case of receivi │ │ │ +00061a30: 6e67 2061 2063 6f72 7275 7074 2070 6965 ng a corrupt pie │ │ │ +00061a40: 6365 3c2f 6832 3e3c 6834 3e2e 2e2f 7372 ce

    ../sr │ │ │ +00061a50: 632f 6d6d 6170 5f64 6973 6b5f 696f 2e63 c/mmap_disk_io.c │ │ │ +00061a60: 7070 3a31 3031 373c 2f68 343e 3c70 7265 pp:1017

    ..aux::mma
    │ │ │ +00061ab0: 705f 6469 736b 5f6a 6f62 2a20 6a20 3d20  p_disk_job* j = 
    │ │ │ +00061ac0: 6d5f 6a6f 625f 706f 6f6c 2e61 6c6c 6f63  m_job_pool.alloc
    │ │ │ +00061ad0: 6174 655f 6a6f 6228 6175 783a 3a6a 6f62  ate_job(aux::job
    │ │ │ +00061ae0: 5f61 6374 696f 6e5f 743a 3a66 696c 655f  _action_t::file_
    │ │ │ +00061af0: 7072 696f 7269 7479 293b 0a09 096a 2d26  priority);...j-&
    │ │ │ +00061b00: 6774 3b73 746f 7261 6765 203d 206d 5f74  gt;storage = m_t
    │ │ │ +00061b10: 6f72 7265 6e74 735b 7374 6f72 6167 655d  orrents[storage]
    │ │ │ +00061b20: 2d26 6774 3b73 6861 7265 645f 6672 6f6d  ->shared_from
    │ │ │ +00061b30: 5f74 6869 7328 293b 0a09 096a 2d26 6774  _this();...j->
    │ │ │ +00061b40: 3b61 7267 756d 656e 7420 3d20 7374 643a  ;argument = std:
    │ │ │ +00061b50: 3a6d 6f76 6528 7072 696f 7329 3b0a 0909  :move(prios);...
    │ │ │ +00061b60: 6a2d 2667 743b 6361 6c6c 6261 636b 203d  j->callback =
    │ │ │ +00061b70: 2073 7464 3a3a 6d6f 7665 2868 616e 646c   std::move(handl
    │ │ │ +00061b80: 6572 293b 0a0a 0909 6164 645f 6665 6e63  er);....add_fenc
    │ │ │ +00061b90: 655f 6a6f 6228 6a29 3b0a 097d 0a0a 0976  e_job(j);..}...v
    │ │ │ +00061ba0: 6f69 6420 6d6d 6170 5f64 6973 6b5f 696f  oid mmap_disk_io
    │ │ │ +00061bb0: 3a3a 6173 796e 635f 636c 6561 725f 7069  ::async_clear_pi
    │ │ │ +00061bc0: 6563 6528 7374 6f72 6167 655f 696e 6465  ece(storage_inde
    │ │ │ +00061bd0: 785f 7420 636f 6e73 7420 7374 6f72 6167  x_t const storag
    │ │ │ +00061be0: 650a 0909 2c20 7069 6563 655f 696e 6465  e..., piece_inde
    │ │ │ +00061bf0: 785f 7420 636f 6e73 7420 696e 6465 782c  x_t const index,
    │ │ │ +00061c00: 2073 7464 3a3a 6675 6e63 7469 6f6e 266c   std::function&l
    │ │ │ +00061c10: 743b 766f 6964 2870 6965 6365 5f69 6e64  t;void(piece_ind
    │ │ │ +00061c20: 6578 5f74 2926 6774 3b20 6861 6e64 6c65  ex_t)> handle
    │ │ │ +00061c30: 7229 0a09 7b0a 0909 6175 783a 3a6d 6d61  r)..{...aux::mma
    │ │ │ +00061c40: 705f 6469 736b 5f6a 6f62 2a20 6a20 3d20  p_disk_job* j = 
    │ │ │ +00061c50: 6d5f 6a6f 625f 706f 6f6c 2e61 6c6c 6f63  m_job_pool.alloc
    │ │ │ +00061c60: 6174 655f 6a6f 6228 6175 783a 3a6a 6f62  ate_job(aux::job
    │ │ │ +00061c70: 5f61 6374 696f 6e5f 743a 3a63 6c65 6172  _action_t::clear
    │ │ │ +00061c80: 5f70 6965 6365 293b 0a09 096a 2d26 6774  _piece);...j->
    │ │ │ +00061c90: 3b73 746f 7261 6765 203d 206d 5f74 6f72  ;storage = m_tor
    │ │ │ +00061ca0: 7265 6e74 735b 7374 6f72 6167 655d 2d26  rents[storage]-&
    │ │ │ +00061cb0: 6774 3b73 6861 7265 645f 6672 6f6d 5f74  gt;shared_from_t
    │ │ │ +00061cc0: 6869 7328 293b 0a09 096a 2d26 6774 3b70  his();...j->p
    │ │ │ +00061cd0: 6965 6365 203d 2069 6e64 6578 3b0a 0909  iece = index;...
    │ │ │ +00061ce0: 6a2d 2667 743b 6361 6c6c 6261 636b 203d  j->callback =
    │ │ │ +00061cf0: 2073 7464 3a3a 6d6f 7665 2868 616e 646c   std::move(handl
    │ │ │ +00061d00: 6572 293b 0a0a 0909 2f2f 2072 6567 756c  er);....// regul
    │ │ │ +00061d10: 6172 206a 6f62 7320 6172 6520 6e6f 7420  ar jobs are not 
    │ │ │ +00061d20: 6775 6172 616e 7465 6564 2074 6f20 6265  guaranteed to be
    │ │ │ +00061d30: 2065 7865 6375 7465 6420 696e 2d6f 7264   executed in-ord
    │ │ │ +00061d40: 6572 0a09 092f 2f20 7369 6e63 6520 636c  er...// since cl
    │ │ │ +00061d50: 6561 7220 7069 6563 6520 6d75 7374 2067  ear piece must g
    │ │ │ +00061d60: 7561 7261 6e74 6565 2074 6861 7420 616c  uarantee that al
    │ │ │ +00061d70: 6c20 7772 6974 6520 6a6f 6273 2074 6861  l write jobs tha
    │ │ │ +00061d80: 740a 0909 2f2f 2068 6176 6520 6265 656e  t...// have been
    │ │ │ +00061d90: 2069 7373 7565 6420 6669 6e69 7368 2062   issued finish b
    │ │ │ +00061da0: 6566 6f72 6520 7468 6520 636c 6561 7220  efore the clear 
    │ │ │ +00061db0: 7069 6563 6520 6a6f 6220 636f 6d70 6c65  piece job comple
    │ │ │ +00061dc0: 7465 730a 0a3c 6469 7620 7374 796c 653d  tes..
    .
    │ │ │ +00061e00: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ +00061e30: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ +00061e40: 3c74 643e 3c61 2068 7265 663d 226a 6176 ../src/mmap │ │ │ +00061e70: 5f64 6973 6b5f 696f 2e63 7070 3a31 3032 _disk_io.cpp:102 │ │ │ +00061e80: 323c 2f61 3e3c 2f74 643e 3c74 643e 5065 2Pe │ │ │ +00061e90: 7268 6170 7320 7468 6520 6a6f 6220 7175 rhaps the job qu │ │ │ +00061ea0: 6575 6520 636f 756c 6420 6265 2074 7261 eue could be tra │ │ │ +00061eb0: 7665 7273 6564 2061 6e64 2061 6c6c 206a versed and all j │ │ │ +00061ec0: 6f62 7320 666f 7220 7468 6973 2070 6965 obs for this pie │ │ │ +00061ed0: 6365 2063 6f75 6c64 2062 6520 6361 6e63 ce could be canc │ │ │ +00061ee0: 656c 6c65 642e 2049 6620 7468 6572 6520 elled. If there │ │ │ +00061ef0: 6172 6520 6e6f 2074 6872 6561 6473 2063 are no threads c │ │ │ +00061f00: 7572 7265 6e74 6c79 2077 7269 7469 6e67 urrently writing │ │ │ +00061f10: 2074 6f20 7468 6973 2070 6965 6365 2c20 to this piece, │ │ │ +00061f20: 7765 2063 6f75 6c64 2073 6b69 7020 7468 we could skip th │ │ │ +00061f30: 6520 6665 6e63 6520 616c 746f 6765 7468 e fence altogeth │ │ │ +00061f40: 6572 3c2f 7464 3e3c 2f74 723e 3c74 7220 er

    │ │ │ +00061f90: 5065 7268 6170 7320 7468 6520 6a6f 6220 Perhaps the job │ │ │ +00061fa0: 7175 6575 6520 636f 756c 6420 6265 2074 queue could be t │ │ │ +00061fb0: 7261 7665 7273 6564 2061 6e64 2061 6c6c raversed and all │ │ │ +00061fc0: 206a 6f62 7320 666f 7220 7468 6973 0a70 jobs for this.p │ │ │ +00061fd0: 6965 6365 2063 6f75 6c64 2062 6520 6361 iece could be ca │ │ │ +00061fe0: 6e63 656c 6c65 642e 2049 6620 7468 6572 ncelled. If ther │ │ │ +00061ff0: 6520 6172 6520 6e6f 2074 6872 6561 6473 e are no threads │ │ │ +00062000: 2063 7572 7265 6e74 6c79 2077 7269 7469 currently writi │ │ │ +00062010: 6e67 0a74 6f20 7468 6973 2070 6965 6365 ng.to this piece │ │ │ +00062020: 2c20 7765 2063 6f75 6c64 2073 6b69 7020 , we could skip │ │ │ +00062030: 7468 6520 6665 6e63 6520 616c 746f 6765 the fence altoge │ │ │ +00062040: 7468 6572 3c2f 6832 3e3c 6834 3e2e 2e2f ther

    ../ │ │ │ +00062050: 7372 632f 6d6d 6170 5f64 6973 6b5f 696f src/mmap_disk_io │ │ │ +00062060: 2e63 7070 3a31 3032 323c 2f68 343e 3c70 .cpp:1022

    ..j-> │ │ │ +000620b0: 7374 6f72 6167 6520 3d20 6d5f 746f 7272 storage = m_torr │ │ │ +000620c0: 656e 7473 5b73 746f 7261 6765 5d2d 2667 ents[storage]-&g │ │ │ +000620d0: 743b 7368 6172 6564 5f66 726f 6d5f 7468 t;shared_from_th │ │ │ +000620e0: 6973 2829 3b0a 0909 6a2d 2667 743b 6172 is();...j->ar │ │ │ +000620f0: 6775 6d65 6e74 203d 2073 7464 3a3a 6d6f gument = std::mo │ │ │ +00062100: 7665 2870 7269 6f73 293b 0a09 096a 2d26 ve(prios);...j-& │ │ │ +00062110: 6774 3b63 616c 6c62 6163 6b20 3d20 7374 gt;callback = st │ │ │ +00062120: 643a 3a6d 6f76 6528 6861 6e64 6c65 7229 d::move(handler) │ │ │ +00062130: 3b0a 0a09 0961 6464 5f66 656e 6365 5f6a ;....add_fence_j │ │ │ +00062140: 6f62 286a 293b 0a09 7d0a 0a09 766f 6964 ob(j);..}...void │ │ │ +00062150: 206d 6d61 705f 6469 736b 5f69 6f3a 3a61 mmap_disk_io::a │ │ │ +00062160: 7379 6e63 5f63 6c65 6172 5f70 6965 6365 sync_clear_piece │ │ │ +00062170: 2873 746f 7261 6765 5f69 6e64 6578 5f74 (storage_index_t │ │ │ +00062180: 2063 6f6e 7374 2073 746f 7261 6765 0a09 const storage.. │ │ │ +00062190: 092c 2070 6965 6365 5f69 6e64 6578 5f74 ., piece_index_t │ │ │ +000621a0: 2063 6f6e 7374 2069 6e64 6578 2c20 7374 const index, st │ │ │ +000621b0: 643a 3a66 756e 6374 696f 6e26 6c74 3b76 d::function<v │ │ │ +000621c0: 6f69 6428 7069 6563 655f 696e 6465 785f oid(piece_index_ │ │ │ +000621d0: 7429 2667 743b 2068 616e 646c 6572 290a t)> handler). │ │ │ +000621e0: 097b 0a09 0961 7578 3a3a 6d6d 6170 5f64 .{...aux::mmap_d │ │ │ +000621f0: 6973 6b5f 6a6f 622a 206a 203d 206d 5f6a isk_job* j = m_j │ │ │ +00062200: 6f62 5f70 6f6f 6c2e 616c 6c6f 6361 7465 ob_pool.allocate │ │ │ +00062210: 5f6a 6f62 2861 7578 3a3a 6a6f 625f 6163 _job(aux::job_ac │ │ │ +00062220: 7469 6f6e 5f74 3a3a 636c 6561 725f 7069 tion_t::clear_pi │ │ │ +00062230: 6563 6529 3b0a 0909 6a2d 2667 743b 7374 ece);...j->st │ │ │ +00062240: 6f72 6167 6520 3d20 6d5f 746f 7272 656e orage = m_torren │ │ │ +00062250: 7473 5b73 746f 7261 6765 5d2d 2667 743b ts[storage]-> │ │ │ +00062260: 7368 6172 6564 5f66 726f 6d5f 7468 6973 shared_from_this │ │ │ +00062270: 2829 3b0a 0909 6a2d 2667 743b 7069 6563 ();...j->piec │ │ │ +00062280: 6520 3d20 696e 6465 783b 0a09 096a 2d26 e = index;...j-& │ │ │ +00062290: 6774 3b63 616c 6c62 6163 6b20 3d20 7374 gt;callback = st │ │ │ +000622a0: 643a 3a6d 6f76 6528 6861 6e64 6c65 7229 d::move(handler) │ │ │ +000622b0: 3b0a 0a09 092f 2f20 7265 6775 6c61 7220 ;....// regular │ │ │ +000622c0: 6a6f 6273 2061 7265 206e 6f74 2067 7561 jobs are not gua │ │ │ +000622d0: 7261 6e74 6565 6420 746f 2062 6520 6578 ranteed to be ex │ │ │ +000622e0: 6563 7574 6564 2069 6e2d 6f72 6465 720a ecuted in-order. │ │ │ +000622f0: 0909 2f2f 2073 696e 6365 2063 6c65 6172 ..// since clear │ │ │ +00062300: 2070 6965 6365 206d 7573 7420 6775 6172 piece must guar │ │ │ +00062310: 616e 7465 6520 7468 6174 2061 6c6c 2077 antee that all w │ │ │ +00062320: 7269 7465 206a 6f62 7320 7468 6174 0a09 rite jobs that.. │ │ │ +00062330: 092f 2f20 6861 7665 2062 6565 6e20 6973 .// have been is │ │ │ +00062340: 7375 6564 2066 696e 6973 6820 6265 666f sued finish befo │ │ │ +00062350: 7265 2074 6865 2063 6c65 6172 2070 6965 re the clear pie │ │ │ +00062360: 6365 206a 6f62 2063 6f6d 706c 6574 6573 ce job completes │ │ │ +00062370: 0a0a 0a3c 6469 7620 7374 796c 653d 2262 ...

    ..add_fence_job │ │ │ +000623b0: 286a 293b 0a3c 2f64 6976 3e09 7d0a 0a09 (j);.
    .}... │ │ │ +000623c0: 7374 6174 7573 5f74 206d 6d61 705f 6469 status_t mmap_di │ │ │ +000623d0: 736b 5f69 6f3a 3a64 6f5f 6861 7368 2861 sk_io::do_hash(a │ │ │ +000623e0: 7578 3a3a 6d6d 6170 5f64 6973 6b5f 6a6f ux::mmap_disk_jo │ │ │ +000623f0: 622a 206a 290a 097b 0a09 092f 2f20 7765 b* j)..{...// we │ │ │ +00062400: 2772 6520 6e6f 7420 7573 696e 6720 6120 're not using a │ │ │ +00062410: 6361 6368 652e 2054 6869 7320 6973 2074 cache. This is t │ │ │ +00062420: 6865 2073 696d 706c 6520 7061 7468 0a09 he simple path.. │ │ │ +00062430: 092f 2f20 6a75 7374 2072 6561 6420 7374 .// just read st │ │ │ +00062440: 7261 6967 6874 2066 726f 6d20 7468 6520 raight from the │ │ │ +00062450: 6669 6c65 0a09 0954 4f52 5245 4e54 5f41 file...TORRENT_A │ │ │ +00062460: 5353 4552 5428 6d5f 6d61 6769 6320 3d3d SSERT(m_magic == │ │ │ +00062470: 2030 7831 3333 3729 3b0a 0a09 0962 6f6f 0x1337);....boo │ │ │ +00062480: 6c20 636f 6e73 7420 7631 203d 2062 6f6f l const v1 = boo │ │ │ +00062490: 6c28 6a2d 2667 743b 666c 6167 7320 2661 l(j->flags &a │ │ │ +000624a0: 6d70 3b20 6469 736b 5f69 6e74 6572 6661 mp; disk_interfa │ │ │ +000624b0: 6365 3a3a 7631 5f68 6173 6829 3b0a 0909 ce::v1_hash);... │ │ │ +000624c0: 626f 6f6c 2063 6f6e 7374 2076 3220 3d20 bool const v2 = │ │ │ +000624d0: 216a 2d26 6774 3b64 2e68 2e62 6c6f 636b !j->d.h.block │ │ │ +000624e0: 5f68 6173 6865 732e 656d 7074 7928 293b _hashes.empty(); │ │ │ +000624f0: 0a0a 0909 696e 7420 636f 6e73 7420 7069 ....int const pi │ │ │ +00062500: 6563 655f 7369 7a65 203d 2076 3120 3f20 ece_size = v1 ? │ │ │ +00062510: 6a2d 2667 743b 7374 6f72 6167 652d 2667 j->storage-&g │ │ │ +00062520: 743b 6669 6c65 7328 292e 7069 6563 655f t;files().piece_ │ │ │ +00062530: 7369 7a65 286a 2d26 6774 3b70 6965 6365 size(j->piece │ │ │ +00062540: 2920 3a20 303b 0a09 0969 6e74 2063 6f6e ) : 0;...int con │ │ │ +00062550: 7374 2070 6965 6365 5f73 697a 6532 203d st piece_size2 = │ │ │ +00062560: 2076 3220 3f20 6a2d 2667 743b 7374 6f72 v2 ? j->stor │ │ │ +00062570: 6167 652d 2667 743b 6669 6c65 7328 292e age->files(). │ │ │ +00062580: 7069 6563 655f 7369 7a65 3228 6a2d 2667 piece_size2(j-&g │ │ │ +00062590: 743b 7069 6563 6529 203a 2030 3b0a 0909 t;piece) : 0;... │ │ │ +000625a0: 696e 7420 636f 6e73 7420 626c 6f63 6b73 int const blocks │ │ │ +000625b0: 5f69 6e5f 7069 6563 6520 3d20 7631 203f _in_piece = v1 ? │ │ │ +000625c0: 2028 7069 6563 655f 7369 7a65 202b 2064 (piece_size + d │ │ │ +000625d0: 6566 6175 6c74 5f62 6c6f 636b 5f73 697a efault_block_siz │ │ │ +000625e0: 6520 2d20 3129 202f 2064 6566 6175 6c74 e - 1) / default │ │ │ +000625f0: 5f62 6c6f 636b 5f73 697a 6520 3a20 303b _block_size : 0; │ │ │ +00062600: 0a09 0969 6e74 2063 6f6e 7374 2062 6c6f ...int const blo │ │ │ +00062610: 636b 735f 696e 5f70 6965 6365 3220 3d20 cks_in_piece2 = │ │ │ +00062620: 7632 203f 206a 2d26 6774 3b73 746f 7261 v2 ? j->stora │ │ │ +00062630: 6765 2d26 6774 3b66 696c 6573 2829 2e62 ge->files().b │ │ │ +00062640: 6c6f 636b 735f 696e 5f70 6965 6365 3228 locks_in_piece2( │ │ │ +00062650: 6a2d 2667 743b 7069 6563 6529 203a 2030 j->piece) : 0 │ │ │ +00062660: 3b0a 0909 6175 783a 3a6f 7065 6e5f 6d6f ;...aux::open_mo │ │ │ +00062670: 6465 5f74 2063 6f6e 7374 2066 696c 655f de_t const file_ │ │ │ +00062680: 6d6f 6465 203d 2066 696c 655f 6d6f 6465 mode = file_mode │ │ │ +00062690: 5f66 6f72 5f6a 6f62 286a 293b 0a0a 0909 _for_job(j);.... │ │ │ +000626a0: 544f 5252 454e 545f 4153 5345 5254 2821 TORRENT_ASSERT(! │ │ │ +000626b0: 7632 207c 7c20 696e 7428 6a2d 2667 743b v2 || int(j-> │ │ │ +000626c0: 642e 682e 626c 6f63 6b5f 6861 7368 6573 d.h.block_hashes │ │ │ +000626d0: 2e73 697a 6528 2929 2026 6774 3b3d 2062 .size()) >= b │ │ │ +000626e0: 6c6f 636b 735f 696e 5f70 6965 6365 3229 locks_in_piece2) │ │ │ +000626f0: 3b0a 0909 544f 5252 454e 545f 4153 5345 ;...TORRENT_ASSE │ │ │ +00062700: 5254 2876 3120 7c7c 2076 3229 3b0a 0a09 RT(v1 || v2);... │ │ │ +00062710: 0968 6173 6865 7220 683b 0a09 0969 6e74 .hasher h;...int │ │ │ +00062720: 2072 6574 203d 2030 3b0a 0909 696e 7420 ret = 0;...int │ │ │ +00062730: 6f66 6673 6574 203d 2030 3b0a 0909 696e offset = 0;...in │ │ │ +00062740: 7420 636f 6e73 7420 626c 6f63 6b73 5f74 t const blocks_t │ │ │ +00062750: 6f5f 7265 6164 203d 2073 7464 3a3a 6d61 o_read = std::ma │ │ │ +00062760: 7828 626c 6f63 6b73 5f69 6e5f 7069 6563 x(blocks_in_piec │ │ │ +00062770: 652c 2062 6c6f 636b 735f 696e 5f70 6965 e, blocks_in_pie │ │ │ +00062780: 6365 3229 3b0a 0909 7469 6d65 5f70 6f69 ce2);...time_poi │ │ │ +00062790: 6e74 2063 6f6e 7374 2073 7461 7274 5f74 nt const start_t │ │ │ +000627a0: 696d 6520 3d20 636c 6f63 6b5f 7479 7065 ime = clock_type │ │ │ +000627b0: 3a3a 6e6f 7728 293b 0a09 0966 6f72 2028 ::now();...for ( │ │ │ +000627c0: 696e 7420 6920 3d20 303b 2069 2026 6c74 int i = 0; i < │ │ │ +000627d0: 3b20 626c 6f63 6b73 5f74 6f5f 7265 6164 ; blocks_to_read │ │ │ +000627e0: 3b20 2b2b 6929 0a09 097b 0a09 0909 626f ; ++i)...{....bo │ │ │ +000627f0: 6f6c 2063 6f6e 7374 2076 325f 626c 6f63 ol const v2_bloc │ │ │ +00062800: 6b20 3d20 6920 266c 743b 2062 6c6f 636b k = i < block │ │ │ +00062810: 735f 696e 5f70 6965 6365 323b 0a0a 0909 s_in_piece2;.... │ │ │ +00062820: 0944 4c4f 4728 2264 6f5f 6861 7368 3a20 .DLOG("do_hash: │ │ │ +00062830: 7265 6164 696e 6720 2870 6965 6365 3a20 reading (piece: │ │ │ +00062840: 2564 2062 6c6f 636b 3a20 2564 295c 6e22 %d block: %d)\n" │ │ │ +00062850: 2c20 696e 7428 6a2d 2667 743b 7069 6563 , int(j->piec │ │ │ +00062860: 6529 2c20 6929 3b0a 3c2f 7072 653e 3c2f e), i);.relevan │ │ │ +000628a0: 6365 266e 6273 703b 303c 2f74 643e 3c74 ce 0../src/load_t │ │ │ +000628e0: 6f72 7265 6e74 2e63 7070 3a31 3231 3c2f orrent.cpp:121move │ │ │ +00062900: 7468 6520 6c6f 6164 696e 6720 6c6f 6769 the loading logi │ │ │ +00062910: 6320 6672 6f6d 2074 6f72 7265 6e74 5f69 c from torrent_i │ │ │ +00062920: 6e66 6f20 636f 6e73 7472 7563 746f 7220 nfo constructor │ │ │ +00062930: 696e 746f 2068 6572 653c 2f74 643e 3c2f into here

    move the │ │ │ +00062990: 6c6f 6164 696e 6720 6c6f 6769 6320 6672 loading logic fr │ │ │ +000629a0: 6f6d 2074 6f72 7265 6e74 5f69 6e66 6f20 om torrent_info │ │ │ +000629b0: 636f 6e73 7472 7563 746f 7220 696e 746f constructor into │ │ │ +000629c0: 2068 6572 653c 2f68 323e 3c68 343e 2e2e here

    .. │ │ │ +000629d0: 2f73 7263 2f6c 6f61 645f 746f 7272 656e /src/load_torren │ │ │ +000629e0: 742e 6370 703a 3132 313c 2f68 343e 3c70 t.cpp:121

    ....mask │ │ │ +00062a30: 2e72 6573 697a 6528 7374 643a 3a73 697a .resize(std::siz │ │ │ +00062a40: 655f 7428 6675 6c6c 5f73 697a 6529 2c20 e_t(full_size), │ │ │ +00062a50: 6661 6c73 6529 3b0a 0909 0909 666f 7220 false);.....for │ │ │ +00062a60: 2869 6e74 2069 203d 206d 6572 6b6c 655f (int i = merkle_ │ │ │ +00062a70: 6669 7273 745f 6c65 6166 2870 6965 6365 first_leaf(piece │ │ │ +00062a80: 5f6c 6179 6572 5f73 697a 6529 0a09 0909 _layer_size).... │ │ │ +00062a90: 0909 2c20 656e 6420 3d20 6920 2b20 6e75 .., end = i + nu │ │ │ +00062aa0: 6d5f 7069 6563 6573 3b20 6920 266c 743b m_pieces; i < │ │ │ +00062ab0: 2065 6e64 3b20 2b2b 6929 0a09 0909 097b end; ++i).....{ │ │ │ +00062ac0: 0a09 0909 0909 6d61 736b 5b73 7464 3a3a ......mask[std:: │ │ │ +00062ad0: 7369 7a65 5f74 2869 295d 203d 2074 7275 size_t(i)] = tru │ │ │ +00062ae0: 653b 0a09 0909 097d 0a09 0909 7d0a 0909 e;.....}....}... │ │ │ +00062af0: 0974 692d 2667 743b 6672 6565 5f70 6965 .ti->free_pie │ │ │ +00062b00: 6365 5f6c 6179 6572 7328 293b 0a09 097d ce_layers();...} │ │ │ +00062b10: 0a09 0961 7470 2e69 6e66 6f5f 6861 7368 ...atp.info_hash │ │ │ +00062b20: 6573 203d 2061 7470 2e74 692d 2667 743b es = atp.ti-> │ │ │ +00062b30: 696e 666f 5f68 6173 6865 7328 293b 0a09 info_hashes();.. │ │ │ +00062b40: 7d0a 7d0a 0a09 6164 645f 746f 7272 656e }.}...add_torren │ │ │ +00062b50: 745f 7061 7261 6d73 206c 6f61 645f 746f t_params load_to │ │ │ +00062b60: 7272 656e 745f 6669 6c65 2873 7464 3a3a rrent_file(std:: │ │ │ +00062b70: 7374 7269 6e67 2063 6f6e 7374 2661 6d70 string const& │ │ │ +00062b80: 3b20 6669 6c65 6e61 6d65 290a 097b 2072 ; filename)..{ r │ │ │ +00062b90: 6574 7572 6e20 6c6f 6164 5f74 6f72 7265 eturn load_torre │ │ │ +00062ba0: 6e74 5f66 696c 6528 6669 6c65 6e61 6d65 nt_file(filename │ │ │ +00062bb0: 2c20 6c6f 6164 5f74 6f72 7265 6e74 5f6c , load_torrent_l │ │ │ +00062bc0: 696d 6974 737b 7d29 3b20 7d0a 0961 6464 imits{}); }..add │ │ │ +00062bd0: 5f74 6f72 7265 6e74 5f70 6172 616d 7320 _torrent_params │ │ │ +00062be0: 6c6f 6164 5f74 6f72 7265 6e74 5f62 7566 load_torrent_buf │ │ │ +00062bf0: 6665 7228 7370 616e 266c 743b 6368 6172 fer(span<char │ │ │ +00062c00: 2063 6f6e 7374 2667 743b 2062 7566 6665 const> buffe │ │ │ +00062c10: 7229 0a09 7b20 7265 7475 726e 206c 6f61 r)..{ return loa │ │ │ +00062c20: 645f 746f 7272 656e 745f 6275 6666 6572 d_torrent_buffer │ │ │ +00062c30: 2862 7566 6665 722c 206c 6f61 645f 746f (buffer, load_to │ │ │ +00062c40: 7272 656e 745f 6c69 6d69 7473 7b7d 293b rrent_limits{}); │ │ │ +00062c50: 207d 0a09 6164 645f 746f 7272 656e 745f }..add_torrent_ │ │ │ +00062c60: 7061 7261 6d73 206c 6f61 645f 746f 7272 params load_torr │ │ │ +00062c70: 656e 745f 7061 7273 6564 2862 6465 636f ent_parsed(bdeco │ │ │ +00062c80: 6465 5f6e 6f64 6520 636f 6e73 7426 616d de_node const&am │ │ │ +00062c90: 703b 2074 6f72 7265 6e74 5f66 696c 6529 p; torrent_file) │ │ │ +00062ca0: 0a09 7b20 7265 7475 726e 206c 6f61 645f ..{ return load_ │ │ │ +00062cb0: 746f 7272 656e 745f 7061 7273 6564 2874 torrent_parsed(t │ │ │ +00062cc0: 6f72 7265 6e74 5f66 696c 652c 206c 6f61 orrent_file, loa │ │ │ +00062cd0: 645f 746f 7272 656e 745f 6c69 6d69 7473 d_torrent_limits │ │ │ +00062ce0: 7b7d 293b 207d 0a0a 3c64 6976 2073 7479 {}); }..

    .add_torre │ │ │ +00062d20: 6e74 5f70 6172 616d 7320 6c6f 6164 5f74 nt_params load_t │ │ │ +00062d30: 6f72 7265 6e74 5f66 696c 6528 7374 643a orrent_file(std: │ │ │ +00062d40: 3a73 7472 696e 6720 636f 6e73 7426 616d :string const&am │ │ │ +00062d50: 703b 2066 696c 656e 616d 652c 206c 6f61 p; filename, loa │ │ │ +00062d60: 645f 746f 7272 656e 745f 6c69 6d69 7473 d_torrent_limits │ │ │ +00062d70: 2063 6f6e 7374 2661 6d70 3b20 6366 6729 const& cfg) │ │ │ +00062d80: 0a3c 2f64 6976 3e09 7b0a 0909 6164 645f .
    .{...add_ │ │ │ +00062d90: 746f 7272 656e 745f 7061 7261 6d73 2072 torrent_params r │ │ │ +00062da0: 6574 3b0a 0909 7265 742e 7469 203d 2073 et;...ret.ti = s │ │ │ +00062db0: 7464 3a3a 6d61 6b65 5f73 6861 7265 6426 td::make_shared& │ │ │ +00062dc0: 6c74 3b74 6f72 7265 6e74 5f69 6e66 6f26 lt;torrent_info& │ │ │ +00062dd0: 6774 3b28 6669 6c65 6e61 6d65 2c20 6366 gt;(filename, cf │ │ │ +00062de0: 6729 3b0a 0909 7570 6461 7465 5f61 7470 g);...update_atp │ │ │ +00062df0: 2872 6574 293b 0a09 0972 6574 7572 6e20 (ret);...return │ │ │ +00062e00: 7265 743b 0a09 7d0a 0a09 6164 645f 746f ret;..}...add_to │ │ │ +00062e10: 7272 656e 745f 7061 7261 6d73 206c 6f61 rrent_params loa │ │ │ +00062e20: 645f 746f 7272 656e 745f 6275 6666 6572 d_torrent_buffer │ │ │ +00062e30: 2873 7061 6e26 6c74 3b63 6861 7220 636f (span<char co │ │ │ +00062e40: 6e73 7426 6774 3b20 6275 6666 6572 2c20 nst> buffer, │ │ │ +00062e50: 6c6f 6164 5f74 6f72 7265 6e74 5f6c 696d load_torrent_lim │ │ │ +00062e60: 6974 7320 636f 6e73 7426 616d 703b 2063 its const& c │ │ │ +00062e70: 6667 290a 097b 0a09 0961 6464 5f74 6f72 fg)..{...add_tor │ │ │ +00062e80: 7265 6e74 5f70 6172 616d 7320 7265 743b rent_params ret; │ │ │ +00062e90: 0a09 0972 6574 2e74 6920 3d20 7374 643a ...ret.ti = std: │ │ │ +00062ea0: 3a6d 616b 655f 7368 6172 6564 266c 743b :make_shared< │ │ │ +00062eb0: 746f 7272 656e 745f 696e 666f 2667 743b torrent_info> │ │ │ +00062ec0: 2862 7566 6665 722c 2063 6667 2c20 6672 (buffer, cfg, fr │ │ │ +00062ed0: 6f6d 5f73 7061 6e29 3b0a 0909 7570 6461 om_span);...upda │ │ │ +00062ee0: 7465 5f61 7470 2872 6574 293b 0a09 0972 te_atp(ret);...r │ │ │ +00062ef0: 6574 7572 6e20 7265 743b 0a09 7d0a 0a09 eturn ret;..}... │ │ │ +00062f00: 6164 645f 746f 7272 656e 745f 7061 7261 add_torrent_para │ │ │ +00062f10: 6d73 206c 6f61 645f 746f 7272 656e 745f ms load_torrent_ │ │ │ +00062f20: 7061 7273 6564 2862 6465 636f 6465 5f6e parsed(bdecode_n │ │ │ +00062f30: 6f64 6520 636f 6e73 7426 616d 703b 2074 ode const& t │ │ │ +00062f40: 6f72 7265 6e74 5f66 696c 652c 206c 6f61 orrent_file, loa │ │ │ +00062f50: 645f 746f 7272 656e 745f 6c69 6d69 7473 d_torrent_limits │ │ │ +00062f60: 2063 6f6e 7374 2661 6d70 3b20 6366 6729 const& cfg) │ │ │ +00062f70: 0a09 7b0a 0909 6164 645f 746f 7272 656e ..{...add_torren │ │ │ +00062f80: 745f 7061 7261 6d73 2072 6574 3b0a 0909 t_params ret;... │ │ │ +00062f90: 7265 742e 7469 203d 2073 7464 3a3a 6d61 ret.ti = std::ma │ │ │ +00062fa0: 6b65 5f73 6861 7265 6426 6c74 3b74 6f72 ke_shared<tor │ │ │ +00062fb0: 7265 6e74 5f69 6e66 6f26 6774 3b28 746f rent_info>(to │ │ │ +00062fc0: 7272 656e 745f 6669 6c65 2c20 6366 6729 rrent_file, cfg) │ │ │ +00062fd0: 3b0a 0909 7570 6461 7465 5f61 7470 2872 ;...update_atp(r │ │ │ +00062fe0: 6574 293b 0a09 0972 6574 7572 6e20 7265 et);...return re │ │ │ +00062ff0: 743b 0a09 7d0a 0a7d 0a0a 3c2f 7072 653e t;..}..}.. │ │ │ +00063000: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ +00063030: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ +00063040: 3c74 643e 3c61 2068 7265 663d 226a 6176
    ../src/perf │ │ │ +00063070: 6f72 6d61 6e63 655f 636f 756e 7465 7273 ormance_counters │ │ │ +00063080: 2e63 7070 3a34 303c 2f61 3e3c 2f74 643e .cpp:40 │ │ │ +00063090: 3c74 643e 6d6f 7665 2073 7461 7473 5f63 move stats_c │ │ │ +000630a0: 6f75 6e74 6572 5f74 206f 7574 206f 6620 ounter_t out of │ │ │ +000630b0: 636f 756e 7465 7273 3c2f 7464 3e3c 2f74 counters

    move stats │ │ │ +00063110: 5f63 6f75 6e74 6572 5f74 206f 7574 206f _counter_t out o │ │ │ +00063120: 6620 636f 756e 7465 7273 3c2f 6832 3e3c f counters

    < │ │ │ +00063130: 6834 3e2e 2e2f 7372 632f 7065 7266 6f72 h4>../src/perfor │ │ │ +00063140: 6d61 6e63 655f 636f 756e 7465 7273 2e63 mance_counters.c │ │ │ +00063150: 7070 3a34 303c 2f68 343e 3c70 7265 2073 pp:40
    <
    │ │ │ +000631a0: 2f74 723e 3c74 7220 7374 796c 653d 2262  /tr>relevance&n
    │ │ │ +000631d0: 6273 703b 303c 2f74 643e 3c74 643e 3c61  bsp;0.
    │ │ │ +00063200: 2e2f 7372 632f 7065 7266 6f72 6d61 6e63  ./src/performanc
    │ │ │ +00063210: 655f 636f 756e 7465 7273 2e63 7070 3a34  e_counters.cpp:4
    │ │ │ +00063220: 313c 2f61 3e3c 2f74 643e 3c74 643e 7368  1sh
    │ │ │ +00063230: 6f75 6c64 2062 6974 746f 7272 656e 7420  ould bittorrent 
    │ │ │ +00063240: 6b65 6570 2d61 6c69 7665 206d 6573 7361  keep-alive messa
    │ │ │ +00063250: 6765 7320 6861 7665 2061 2063 6f75 6e74  ges have a count
    │ │ │ +00063260: 6572 2074 6f6f 3f3c 2f74 643e 3c2f 7472  er too?

    should bitt │ │ │ +000632c0: 6f72 7265 6e74 206b 6565 702d 616c 6976 orrent keep-aliv │ │ │ +000632d0: 6520 6d65 7373 6167 6573 2068 6176 6520 e messages have │ │ │ +000632e0: 6120 636f 756e 7465 7220 746f 6f3f 3c2f a counter too?

    ../src/pe │ │ │ +00063300: 7266 6f72 6d61 6e63 655f 636f 756e 7465 rformance_counte │ │ │ +00063310: 7273 2e63 7070 3a34 313c 2f68 343e 3c70 rs.cpp:41

    relevan │ │ │ +00063390: 6365 266e 6273 703b 303c 2f74 643e 3c74 ce 0../src/perfor │ │ │ +000633d0: 6d61 6e63 655f 636f 756e 7465 7273 2e63 mance_counters.c │ │ │ +000633e0: 7070 3a34 323c 2f61 3e3c 2f74 643e 3c74 pp:42It would be ni │ │ │ +00063400: 6365 2069 6620 7468 6973 2063 6f75 6c64 ce if this could │ │ │ +00063410: 2062 6520 616e 2069 6e74 6572 6e61 6c20 be an internal │ │ │ +00063420: 7479 7065 2e20 6465 6661 756c 745f 6469 type. default_di │ │ │ +00063430: 736b 5f63 6f6e 7374 7275 6374 6f72 2064 sk_constructor d │ │ │ +00063440: 6570 656e 6473 206f 6e20 6974 206e 6f77 epends on it now │ │ │ +00063450: 3c2f 7464 3e3c 2f74 723e 3c74 7220 6964

    It │ │ │ +000634a0: 2077 6f75 6c64 2062 6520 6e69 6365 2069 would be nice i │ │ │ +000634b0: 6620 7468 6973 2063 6f75 6c64 2062 6520 f this could be │ │ │ +000634c0: 616e 2069 6e74 6572 6e61 6c20 7479 7065 an internal type │ │ │ +000634d0: 2e20 6465 6661 756c 745f 6469 736b 5f63 . default_disk_c │ │ │ +000634e0: 6f6e 7374 7275 6374 6f72 2064 6570 656e onstructor depen │ │ │ +000634f0: 6473 206f 6e20 6974 206e 6f77 3c2f 6832 ds on it now

    ../src/perf │ │ │ +00063510: 6f72 6d61 6e63 655f 636f 756e 7465 7273 ormance_counters │ │ │ +00063520: 2e63 7070 3a34 323c 2f68 343e 3c70 7265 .cpp:42

    THIS SOFTW
    │ │ │ +00063570: 4152 4520 4953 2050 524f 5649 4445 4420  ARE IS PROVIDED 
    │ │ │ +00063580: 4259 2054 4845 2043 4f50 5952 4947 4854  BY THE COPYRIGHT
    │ │ │ +00063590: 2048 4f4c 4445 5253 2041 4e44 2043 4f4e   HOLDERS AND CON
    │ │ │ +000635a0: 5452 4942 5554 4f52 5320 2241 5320 4953  TRIBUTORS "AS IS
    │ │ │ +000635b0: 220a 414e 4420 414e 5920 4558 5052 4553  ".AND ANY EXPRES
    │ │ │ +000635c0: 5320 4f52 2049 4d50 4c49 4544 2057 4152  S OR IMPLIED WAR
    │ │ │ +000635d0: 5241 4e54 4945 532c 2049 4e43 4c55 4449  RANTIES, INCLUDI
    │ │ │ +000635e0: 4e47 2c20 4255 5420 4e4f 5420 4c49 4d49  NG, BUT NOT LIMI
    │ │ │ +000635f0: 5445 4420 544f 2c20 5448 450a 494d 504c  TED TO, THE.IMPL
    │ │ │ +00063600: 4945 4420 5741 5252 414e 5449 4553 204f  IED WARRANTIES O
    │ │ │ +00063610: 4620 4d45 5243 4841 4e54 4142 494c 4954  F MERCHANTABILIT
    │ │ │ +00063620: 5920 414e 4420 4649 544e 4553 5320 464f  Y AND FITNESS FO
    │ │ │ +00063630: 5220 4120 5041 5254 4943 554c 4152 2050  R A PARTICULAR P
    │ │ │ +00063640: 5552 504f 5345 0a41 5245 2044 4953 434c  URPOSE.ARE DISCL
    │ │ │ +00063650: 4149 4d45 442e 2049 4e20 4e4f 2045 5645  AIMED. IN NO EVE
    │ │ │ +00063660: 4e54 2053 4841 4c4c 2054 4845 2043 4f50  NT SHALL THE COP
    │ │ │ +00063670: 5952 4947 4854 204f 574e 4552 204f 5220  YRIGHT OWNER OR 
    │ │ │ +00063680: 434f 4e54 5249 4255 544f 5253 2042 450a  CONTRIBUTORS BE.
    │ │ │ +00063690: 4c49 4142 4c45 2046 4f52 2041 4e59 2044  LIABLE FOR ANY D
    │ │ │ +000636a0: 4952 4543 542c 2049 4e44 4952 4543 542c  IRECT, INDIRECT,
    │ │ │ +000636b0: 2049 4e43 4944 454e 5441 4c2c 2053 5045   INCIDENTAL, SPE
    │ │ │ +000636c0: 4349 414c 2c20 4558 454d 504c 4152 592c  CIAL, EXEMPLARY,
    │ │ │ +000636d0: 204f 520a 434f 4e53 4551 5545 4e54 4941   OR.CONSEQUENTIA
    │ │ │ +000636e0: 4c20 4441 4d41 4745 5320 2849 4e43 4c55  L DAMAGES (INCLU
    │ │ │ +000636f0: 4449 4e47 2c20 4255 5420 4e4f 5420 4c49  DING, BUT NOT LI
    │ │ │ +00063700: 4d49 5445 4420 544f 2c20 5052 4f43 5552  MITED TO, PROCUR
    │ │ │ +00063710: 454d 454e 5420 4f46 0a53 5542 5354 4954  EMENT OF.SUBSTIT
    │ │ │ +00063720: 5554 4520 474f 4f44 5320 4f52 2053 4552  UTE GOODS OR SER
    │ │ │ +00063730: 5649 4345 533b 204c 4f53 5320 4f46 2055  VICES; LOSS OF U
    │ │ │ +00063740: 5345 2c20 4441 5441 2c20 4f52 2050 524f  SE, DATA, OR PRO
    │ │ │ +00063750: 4649 5453 3b20 4f52 2042 5553 494e 4553  FITS; OR BUSINES
    │ │ │ +00063760: 530a 494e 5445 5252 5550 5449 4f4e 2920  S.INTERRUPTION) 
    │ │ │ +00063770: 484f 5745 5645 5220 4341 5553 4544 2041  HOWEVER CAUSED A
    │ │ │ +00063780: 4e44 204f 4e20 414e 5920 5448 454f 5259  ND ON ANY THEORY
    │ │ │ +00063790: 204f 4620 4c49 4142 494c 4954 592c 2057   OF LIABILITY, W
    │ │ │ +000637a0: 4845 5448 4552 2049 4e0a 434f 4e54 5241  HETHER IN.CONTRA
    │ │ │ +000637b0: 4354 2c20 5354 5249 4354 204c 4941 4249  CT, STRICT LIABI
    │ │ │ +000637c0: 4c49 5459 2c20 4f52 2054 4f52 5420 2849  LITY, OR TORT (I
    │ │ │ +000637d0: 4e43 4c55 4449 4e47 204e 4547 4c49 4745  NCLUDING NEGLIGE
    │ │ │ +000637e0: 4e43 4520 4f52 204f 5448 4552 5749 5345  NCE OR OTHERWISE
    │ │ │ +000637f0: 290a 4152 4953 494e 4720 494e 2041 4e59  ).ARISING IN ANY
    │ │ │ +00063800: 2057 4159 204f 5554 204f 4620 5448 4520   WAY OUT OF THE 
    │ │ │ +00063810: 5553 4520 4f46 2054 4849 5320 534f 4654  USE OF THIS SOFT
    │ │ │ +00063820: 5741 5245 2c20 4556 454e 2049 4620 4144  WARE, EVEN IF AD
    │ │ │ +00063830: 5649 5345 4420 4f46 2054 4845 0a50 4f53  VISED OF THE.POS
    │ │ │ +00063840: 5349 4249 4c49 5459 204f 4620 5355 4348  SIBILITY OF SUCH
    │ │ │ +00063850: 2044 414d 4147 452e 0a0a 2a2f 0a0a 2369   DAMAGE...*/..#i
    │ │ │ +00063860: 6e63 6c75 6465 2022 6c69 6274 6f72 7265  nclude "libtorre
    │ │ │ +00063870: 6e74 2f70 6572 666f 726d 616e 6365 5f63  nt/performance_c
    │ │ │ +00063880: 6f75 6e74 6572 732e 6870 7022 0a23 696e  ounters.hpp".#in
    │ │ │ +00063890: 636c 7564 6520 226c 6962 746f 7272 656e  clude "libtorren
    │ │ │ +000638a0: 742f 6173 7365 7274 2e68 7070 220a 2369  t/assert.hpp".#i
    │ │ │ +000638b0: 6e63 6c75 6465 2026 6c74 3b63 7374 7269  nclude <cstri
    │ │ │ +000638c0: 6e67 2667 743b 202f 2f20 666f 7220 6d65  ng> // for me
    │ │ │ +000638d0: 6d73 6574 0a0a 6e61 6d65 7370 6163 6520  mset..namespace 
    │ │ │ +000638e0: 6c69 6274 6f72 7265 6e74 207b 0a0a 3c64  libtorrent {...cou
    │ │ │ +00063920: 6e74 6572 733a 3a63 6f75 6e74 6572 7328  nters::counters(
    │ │ │ +00063930: 2920 544f 5252 454e 545f 434f 554e 5445  ) TORRENT_COUNTE
    │ │ │ +00063940: 525f 4e4f 4558 4345 5054 0a3c 2f64 6976  R_NOEXCEPT..{.#ifdef ATOMI
    │ │ │ +00063960: 435f 4c4c 4f4e 475f 4c4f 434b 5f46 5245  C_LLONG_LOCK_FRE
    │ │ │ +00063970: 450a 0909 666f 7220 2861 7574 6f26 616d  E...for (auto&am
    │ │ │ +00063980: 703b 2063 6f75 6e74 6572 203a 206d 5f73  p; counter : m_s
    │ │ │ +00063990: 7461 7473 5f63 6f75 6e74 6572 290a 0909  tats_counter)...
    │ │ │ +000639a0: 0963 6f75 6e74 6572 2e73 746f 7265 2830  .counter.store(0
    │ │ │ +000639b0: 2c20 7374 643a 3a6d 656d 6f72 795f 6f72  , std::memory_or
    │ │ │ +000639c0: 6465 725f 7265 6c61 7865 6429 3b0a 2365  der_relaxed);.#e
    │ │ │ +000639d0: 6c73 650a 0909 6d5f 7374 6174 735f 636f  lse...m_stats_co
    │ │ │ +000639e0: 756e 7465 722e 6669 6c6c 2830 293b 0a23  unter.fill(0);.#
    │ │ │ +000639f0: 656e 6469 660a 097d 0a0a 0963 6f75 6e74  endif..}...count
    │ │ │ +00063a00: 6572 733a 3a63 6f75 6e74 6572 7328 636f  ers::counters(co
    │ │ │ +00063a10: 756e 7465 7273 2063 6f6e 7374 2661 6d70  unters const&
    │ │ │ +00063a20: 3b20 6329 2054 4f52 5245 4e54 5f43 4f55  ; c) TORRENT_COU
    │ │ │ +00063a30: 4e54 4552 5f4e 4f45 5843 4550 540a 097b  NTER_NOEXCEPT..{
    │ │ │ +00063a40: 0a23 6966 6465 6620 4154 4f4d 4943 5f4c  .#ifdef ATOMIC_L
    │ │ │ +00063a50: 4c4f 4e47 5f4c 4f43 4b5f 4652 4545 0a09  LONG_LOCK_FREE..
    │ │ │ +00063a60: 0966 6f72 2028 696e 7420 6920 3d20 303b  .for (int i = 0;
    │ │ │ +00063a70: 2069 2026 6c74 3b20 6d5f 7374 6174 735f   i < m_stats_
    │ │ │ +00063a80: 636f 756e 7465 722e 656e 645f 696e 6465  counter.end_inde
    │ │ │ +00063a90: 7828 293b 202b 2b69 290a 0909 096d 5f73  x(); ++i)....m_s
    │ │ │ +00063aa0: 7461 7473 5f63 6f75 6e74 6572 5b69 5d2e  tats_counter[i].
    │ │ │ +00063ab0: 7374 6f72 6528 0a09 0909 0963 2e6d 5f73  store(.....c.m_s
    │ │ │ +00063ac0: 7461 7473 5f63 6f75 6e74 6572 5b69 5d2e  tats_counter[i].
    │ │ │ +00063ad0: 6c6f 6164 2873 7464 3a3a 6d65 6d6f 7279  load(std::memory
    │ │ │ +00063ae0: 5f6f 7264 6572 5f72 656c 6178 6564 290a  _order_relaxed).
    │ │ │ +00063af0: 0909 0909 092c 2073 7464 3a3a 6d65 6d6f  ....., std::memo
    │ │ │ +00063b00: 7279 5f6f 7264 6572 5f72 656c 6178 6564  ry_order_relaxed
    │ │ │ +00063b10: 293b 0a23 656c 7365 0a09 0973 7464 3a3a  );.#else...std::
    │ │ │ +00063b20: 6c6f 636b 5f67 7561 7264 266c 743b 7374  lock_guard<st
    │ │ │ +00063b30: 643a 3a6d 7574 6578 2667 743b 206c 2863  d::mutex> l(c
    │ │ │ +00063b40: 2e6d 5f6d 7574 6578 293b 0a09 096d 5f73  .m_mutex);...m_s
    │ │ │ +00063b50: 7461 7473 5f63 6f75 6e74 6572 203d 2063  tats_counter = c
    │ │ │ +00063b60: 2e6d 5f73 7461 7473 5f63 6f75 6e74 6572  .m_stats_counter
    │ │ │ +00063b70: 3b0a 2365 6e64 6966 0a09 7d0a 0a09 636f  ;.#endif..}...co
    │ │ │ +00063b80: 756e 7465 7273 2661 6d70 3b20 636f 756e  unters& coun
    │ │ │ +00063b90: 7465 7273 3a3a 6f70 6572 6174 6f72 3d28  ters::operator=(
    │ │ │ +00063ba0: 636f 756e 7465 7273 2063 6f6e 7374 2661  counters const&a
    │ │ │ +00063bb0: 6d70 3b20 6329 2026 616d 703b 2054 4f52  mp; c) & TOR
    │ │ │ +00063bc0: 5245 4e54 5f43 4f55 4e54 4552 5f4e 4f45  RENT_COUNTER_NOE
    │ │ │ +00063bd0: 5843 4550 540a 097b 0a09 0969 6620 2826  XCEPT..{...if (&
    │ │ │ +00063be0: 616d 703b 6320 3d3d 2074 6869 7329 2072  amp;c == this) r
    │ │ │ +00063bf0: 6574 7572 6e20 2a74 6869 733b 0a23 6966  eturn *this;.#if
    │ │ │ +00063c00: 6465 6620 4154 4f4d 4943 5f4c 4c4f 4e47  def ATOMIC_LLONG
    │ │ │ +00063c10: 5f4c 4f43 4b5f 4652 4545 0a09 0966 6f72  _LOCK_FREE...for
    │ │ │ +00063c20: 2028 696e 7420 6920 3d20 303b 2069 2026   (int i = 0; i &
    │ │ │ +00063c30: 6c74 3b20 6d5f 7374 6174 735f 636f 756e  lt; m_stats_coun
    │ │ │ +00063c40: 7465 722e 656e 645f 696e 6465 7828 293b  ter.end_index();
    │ │ │ +00063c50: 202b 2b69 290a 0909 096d 5f73 7461 7473   ++i)....m_stats
    │ │ │ +00063c60: 5f63 6f75 6e74 6572 5b69 5d2e 7374 6f72  _counter[i].stor
    │ │ │ +00063c70: 6528 0a09 0909 0963 2e6d 5f73 7461 7473  e(.....c.m_stats
    │ │ │ +00063c80: 5f63 6f75 6e74 6572 5b69 5d2e 6c6f 6164  _counter[i].load
    │ │ │ +00063c90: 2873 7464 3a3a 6d65 6d6f 7279 5f6f 7264  (std::memory_ord
    │ │ │ +00063ca0: 6572 5f72 656c 6178 6564 290a 0909 0909  er_relaxed).....
    │ │ │ +00063cb0: 092c 2073 7464 3a3a 6d65 6d6f 7279 5f6f  ., std::memory_o
    │ │ │ +00063cc0: 7264 6572 5f72 656c 6178 6564 293b 0a3c  rder_relaxed);.<
    │ │ │ +00063cd0: 2f70 7265 3e3c 2f74 643e 3c2f 7472 3e3c  /pre><
    │ │ │ +00063ce0: 7472 2073 7479 6c65 3d22 6261 636b 6772  tr style="backgr
    │ │ │ +00063cf0: 6f75 6e64 3a20 2363 6363 223e 3c74 643e  ound: #ccc">
    │ │ │ +00063d00: 7265 6c65 7661 6e63 6526 6e62 7370 3b30  relevance 0
    │ │ │ +00063d10: 3c2f 7464 3e3c 7464 3e3c 6120 6872 6566  ../src
    │ │ │ +00063d40: 2f63 7265 6174 655f 746f 7272 656e 742e  /create_torrent.
    │ │ │ +00063d50: 6370 703a 3634 353c 2f61 3e3c 2f74 643e  cpp:645
    │ │ │ +00063d60: 3c74 643e 7468 6973 2063 616e 2062 6520  this can be 
    │ │ │ +00063d70: 6f70 7469 6d69 7a65 643c 2f74 643e 3c2f  optimized

    this can │ │ │ +00063dd0: 6265 206f 7074 696d 697a 6564 3c2f 6832 be optimized

    ../src/crea │ │ │ +00063df0: 7465 5f74 6f72 7265 6e74 2e63 7070 3a36 te_torrent.cpp:6 │ │ │ +00063e00: 3435 3c2f 6834 3e3c 7072 6520 7374 796c 45

    ..std::string&a
    │ │ │ +00063e50: 6d70 3b20 6174 7472 203d 2065 5b22 6174  mp; attr = e["at
    │ │ │ +00063e60: 7472 225d 2e73 7472 696e 6728 293b 0a09  tr"].string();..
    │ │ │ +00063e70: 0969 6620 2866 6c61 6773 2026 616d 703b  .if (flags &
    │ │ │ +00063e80: 2066 696c 655f 7374 6f72 6167 653a 3a66   file_storage::f
    │ │ │ +00063e90: 6c61 675f 7061 645f 6669 6c65 2920 6174  lag_pad_file) at
    │ │ │ +00063ea0: 7472 202b 3d20 2770 273b 0a09 0969 6620  tr += 'p';...if 
    │ │ │ +00063eb0: 2866 6c61 6773 2026 616d 703b 2066 696c  (flags & fil
    │ │ │ +00063ec0: 655f 7374 6f72 6167 653a 3a66 6c61 675f  e_storage::flag_
    │ │ │ +00063ed0: 6869 6464 656e 2920 6174 7472 202b 3d20  hidden) attr += 
    │ │ │ +00063ee0: 2768 273b 0a09 0969 6620 2866 6c61 6773  'h';...if (flags
    │ │ │ +00063ef0: 2026 616d 703b 2066 696c 655f 7374 6f72   & file_stor
    │ │ │ +00063f00: 6167 653a 3a66 6c61 675f 6578 6563 7574  age::flag_execut
    │ │ │ +00063f10: 6162 6c65 2920 6174 7472 202b 3d20 2778  able) attr += 'x
    │ │ │ +00063f20: 273b 0a09 0969 6620 2869 6e63 6c75 6465  ';...if (include
    │ │ │ +00063f30: 5f73 796d 6c69 6e6b 7320 2661 6d70 3b26  _symlinks &&
    │ │ │ +00063f40: 616d 703b 2028 666c 6167 7320 2661 6d70  amp; (flags &
    │ │ │ +00063f50: 3b20 6669 6c65 5f73 746f 7261 6765 3a3a  ; file_storage::
    │ │ │ +00063f60: 666c 6167 5f73 796d 6c69 6e6b 2929 2061  flag_symlink)) a
    │ │ │ +00063f70: 7474 7220 2b3d 2027 6c27 3b0a 097d 0a0a  ttr += 'l';..}..
    │ │ │ +00063f80: 0976 6f69 6420 6164 645f 7379 6d6c 696e  .void add_symlin
    │ │ │ +00063f90: 6b5f 7061 7468 2865 6e74 7279 2661 6d70  k_path(entry&
    │ │ │ +00063fa0: 3b20 652c 2073 7464 3a3a 7374 7269 6e67  ; e, std::string
    │ │ │ +00063fb0: 2073 796d 6c69 6e6b 5f70 6174 6829 0a09   symlink_path)..
    │ │ │ +00063fc0: 7b0a 0909 656e 7472 7926 616d 703b 2073  {...entry& s
    │ │ │ +00063fd0: 796d 7061 7468 5f65 203d 2065 5b22 7379  ympath_e = e["sy
    │ │ │ +00063fe0: 6d6c 696e 6b20 7061 7468 225d 3b0a 0a09  mlink path"];...
    │ │ │ +00063ff0: 0973 7464 3a3a 7374 7269 6e67 2063 6f6e  .std::string con
    │ │ │ +00064000: 7374 206c 696e 6b20 3d20 6c65 7869 6361  st link = lexica
    │ │ │ +00064010: 6c6c 795f 7265 6c61 7469 7665 2822 222c  lly_relative("",
    │ │ │ +00064020: 2073 796d 6c69 6e6b 5f70 6174 6829 3b0a   symlink_path);.
    │ │ │ +00064030: 0909 666f 7220 2861 7574 6f20 656c 656d  ..for (auto elem
    │ │ │ +00064040: 7320 3d20 6c73 706c 6974 5f70 6174 6828  s = lsplit_path(
    │ │ │ +00064050: 6c69 6e6b 293b 2021 656c 656d 732e 6669  link); !elems.fi
    │ │ │ +00064060: 7273 742e 656d 7074 7928 293b 0a09 0909  rst.empty();....
    │ │ │ +00064070: 656c 656d 7320 3d20 6c73 706c 6974 5f70  elems = lsplit_p
    │ │ │ +00064080: 6174 6828 656c 656d 732e 7365 636f 6e64  ath(elems.second
    │ │ │ +00064090: 2929 0a09 0909 7379 6d70 6174 685f 652e  ))....sympath_e.
    │ │ │ +000640a0: 6c69 7374 2829 2e65 6d70 6c61 6365 5f62  list().emplace_b
    │ │ │ +000640b0: 6163 6b28 656c 656d 732e 6669 7273 7429  ack(elems.first)
    │ │ │ +000640c0: 3b0a 097d 0a7d 0a0a 0973 7464 3a3a 7665  ;..}.}...std::ve
    │ │ │ +000640d0: 6374 6f72 266c 743b 6368 6172 2667 743b  ctor<char>
    │ │ │ +000640e0: 2063 7265 6174 655f 746f 7272 656e 743a   create_torrent:
    │ │ │ +000640f0: 3a67 656e 6572 6174 655f 6275 6628 2920  :generate_buf() 
    │ │ │ +00064100: 636f 6e73 740a 097b 0a3c 6469 7620 7374  const..{.
    ..std::ve │ │ │ +00064140: 6374 6f72 266c 743b 6368 6172 2667 743b ctor<char> │ │ │ +00064150: 2072 6574 3b0a 3c2f 6469 763e 0909 6265 ret;.
    ..be │ │ │ +00064160: 6e63 6f64 6528 7374 643a 3a62 6163 6b5f ncode(std::back_ │ │ │ +00064170: 696e 7365 7274 6572 2872 6574 292c 2067 inserter(ret), g │ │ │ +00064180: 656e 6572 6174 6528 2929 3b0a 0909 7265 enerate());...re │ │ │ +00064190: 7475 726e 2072 6574 3b0a 097d 0a0a 0965 turn ret;..}...e │ │ │ +000641a0: 6e74 7279 2063 7265 6174 655f 746f 7272 ntry create_torr │ │ │ +000641b0: 656e 743a 3a67 656e 6572 6174 6528 2920 ent::generate() │ │ │ +000641c0: 636f 6e73 740a 097b 0a09 0969 6620 286d const..{...if (m │ │ │ +000641d0: 5f66 696c 6573 2e6e 756d 5f66 696c 6573 _files.num_files │ │ │ +000641e0: 2829 203d 3d20 3020 7c7c 206d 5f66 696c () == 0 || m_fil │ │ │ +000641f0: 6573 2e74 6f74 616c 5f73 697a 6528 2920 es.total_size() │ │ │ +00064200: 3d3d 2030 290a 0909 0961 7578 3a3a 7468 == 0)....aux::th │ │ │ +00064210: 726f 775f 6578 266c 743b 7379 7374 656d row_ex<system │ │ │ +00064220: 5f65 7272 6f72 2667 743b 2865 7272 6f72 _error>(error │ │ │ +00064230: 733a 3a74 6f72 7265 6e74 5f6d 6973 7369 s::torrent_missi │ │ │ +00064240: 6e67 5f66 696c 655f 7472 6565 293b 0a0a ng_file_tree);.. │ │ │ +00064250: 0909 2f2f 2069 6620 616c 6c20 7632 2068 ..// if all v2 h │ │ │ +00064260: 6173 6865 7320 6172 6520 7365 7420 636f ashes are set co │ │ │ +00064270: 7272 6563 746c 792c 2067 656e 6572 6174 rrectly, generat │ │ │ +00064280: 6520 7468 6520 7632 2070 6172 7473 206f e the v2 parts o │ │ │ +00064290: 6620 7468 650a 0909 2f2f 2074 6f72 7265 f the...// torre │ │ │ +000642a0: 6e74 0a09 0962 6f6f 6c20 636f 6e73 7420 nt...bool const │ │ │ +000642b0: 6d61 6b65 5f76 3220 3d20 7661 6c69 6461 make_v2 = valida │ │ │ +000642c0: 7465 5f76 325f 6861 7368 6573 286d 5f66 te_v2_hashes(m_f │ │ │ +000642d0: 696c 6573 2c20 6d5f 6669 6c65 5f70 6965 iles, m_file_pie │ │ │ +000642e0: 6365 5f68 6173 6829 3b0a 0909 626f 6f6c ce_hash);...bool │ │ │ +000642f0: 2063 6f6e 7374 206d 616b 655f 7631 203d const make_v1 = │ │ │ +00064300: 2076 616c 6964 6174 655f 7631 5f68 6173 validate_v1_has │ │ │ +00064310: 6865 7328 6d5f 6669 6c65 732c 206d 5f70 hes(m_files, m_p │ │ │ +00064320: 6965 6365 5f68 6173 6829 3b0a 0a09 092f iece_hash);..../ │ │ │ +00064330: 2f20 6966 206e 6569 7468 6572 2076 3120 / if neither v1 │ │ │ +00064340: 6e6f 7220 7632 2068 6173 6865 7320 7765 nor v2 hashes we │ │ │ +00064350: 7265 2073 6574 2c20 7765 2063 616e 2774 re set, we can't │ │ │ +00064360: 2063 7265 6174 6520 6120 746f 7272 656e create a torren │ │ │ +00064370: 740a 0909 6966 2028 216d 616b 655f 7631 t...if (!make_v1 │ │ │ +00064380: 2026 616d 703b 2661 6d70 3b20 216d 616b && !mak │ │ │ +00064390: 655f 7632 290a 0909 0961 7578 3a3a 7468 e_v2)....aux::th │ │ │ +000643a0: 726f 775f 6578 266c 743b 7379 7374 656d row_ex<system │ │ │ +000643b0: 5f65 7272 6f72 2667 743b 2865 7272 6f72 _error>(error │ │ │ +000643c0: 733a 3a69 6e76 616c 6964 5f68 6173 685f s::invalid_hash_ │ │ │ +000643d0: 656e 7472 7929 3b0a 0a09 0954 4f52 5245 entry);....TORRE │ │ │ +000643e0: 4e54 5f41 5353 4552 5428 6d5f 6669 6c65 NT_ASSERT(m_file │ │ │ +000643f0: 732e 7069 6563 655f 6c65 6e67 7468 2829 s.piece_length() │ │ │ +00064400: 2026 6774 3b20 3029 3b0a 0a09 0965 6e74 > 0);....ent │ │ │ +00064410: 7279 2064 6963 743b 0a0a 0909 6966 2028 ry dict;....if ( │ │ │ +00064420: 216d 5f75 726c 732e 656d 7074 7928 2929 !m_urls.empty()) │ │ │ +00064430: 2064 6963 745b 2261 6e6e 6f75 6e63 6522 dict["announce" │ │ │ +00064440: 5d20 3d20 6d5f 7572 6c73 2e66 726f 6e74 ] = m_urls.front │ │ │ +00064450: 2829 2e66 6972 7374 3b0a 0a09 0969 6620 ().first;....if │ │ │ +00064460: 2821 6d5f 6e6f 6465 732e 656d 7074 7928 (!m_nodes.empty( │ │ │ +00064470: 2929 0a09 097b 0a09 0909 656e 7472 7926 ))...{....entry& │ │ │ +00064480: 616d 703b 206e 6f64 6573 203d 2064 6963 amp; nodes = dic │ │ │ +00064490: 745b 226e 6f64 6573 225d 3b0a 0909 0965 t["nodes"];....e │ │ │ +000644a0: 6e74 7279 3a3a 6c69 7374 5f74 7970 6526 ntry::list_type& │ │ │ +000644b0: 616d 703b 206e 6f64 6573 5f6c 6973 7420 amp; nodes_list │ │ │ +000644c0: 3d20 6e6f 6465 732e 6c69 7374 2829 3b0a = nodes.list();. │ │ │ +000644d0: 0909 0966 6f72 2028 6175 746f 2063 6f6e ...for (auto con │ │ │ +000644e0: 7374 2661 6d70 3b20 6e20 3a20 6d5f 6e6f st& n : m_no │ │ │ +000644f0: 6465 7329 0a09 0909 7b0a 3c2f 7072 653e des)....{.
    │ │ │ +00064500: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ +00064530: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ +00064540: 3c74 643e 3c61 2068 7265 663d 226a 6176 ../src/udp_ │ │ │ +00064570: 7472 6163 6b65 725f 636f 6e6e 6563 7469 tracker_connecti │ │ │ +00064580: 6f6e 2e63 7070 3a36 3331 3c2f 613e 3c2f on.cpp:631why is th │ │ │ +000645a0: 6973 2061 206c 696e 6b65 6420 6c69 7374 is a linked list │ │ │ +000645b0: 3f3c 2f74 643e 3c2f 7472 3e3c 7472 2069 ?

    w │ │ │ +00064600: 6879 2069 7320 7468 6973 2061 206c 696e hy is this a lin │ │ │ +00064610: 6b65 6420 6c69 7374 3f3c 2f68 323e 3c68 ked list?

    ../src/udp_tra │ │ │ +00064630: 636b 6572 5f63 6f6e 6e65 6374 696f 6e2e cker_connection. │ │ │ +00064640: 6370 703a 3633 313c 2f68 343e 3c70 7265 cpp:631
    ....ipv6_p
    │ │ │ +00064690: 6565 725f 656e 7472 7920 657b 7d3b 0a09  eer_entry e{};..
    │ │ │ +000646a0: 0909 0973 7464 3a3a 6d65 6d63 7079 2865  ...std::memcpy(e
    │ │ │ +000646b0: 2e69 702e 6461 7461 2829 2c20 6275 662e  .ip.data(), buf.
    │ │ │ +000646c0: 6461 7461 2829 2c20 3136 293b 0a09 0909  data(), 16);....
    │ │ │ +000646d0: 0962 7566 203d 2062 7566 2e73 7562 7370  .buf = buf.subsp
    │ │ │ +000646e0: 616e 2831 3629 3b0a 0909 0909 652e 706f  an(16);.....e.po
    │ │ │ +000646f0: 7274 203d 2061 7578 3a3a 7265 6164 5f75  rt = aux::read_u
    │ │ │ +00064700: 696e 7431 3628 6275 6629 3b0a 0909 0909  int16(buf);.....
    │ │ │ +00064710: 7265 7370 2e70 6565 7273 362e 7075 7368  resp.peers6.push
    │ │ │ +00064720: 5f62 6163 6b28 6529 3b0a 0909 097d 0a09  _back(e);....}..
    │ │ │ +00064730: 097d 0a09 0965 6c73 650a 0909 7b0a 0909  .}...else...{...
    │ │ │ +00064740: 0972 6573 702e 7065 6572 7334 2e72 6573  .resp.peers4.res
    │ │ │ +00064750: 6572 7665 2873 7461 7469 635f 6361 7374  erve(static_cast
    │ │ │ +00064760: 266c 743b 7374 643a 3a73 697a 655f 7426  <std::size_t&
    │ │ │ +00064770: 6774 3b28 6e75 6d5f 7065 6572 7329 293b  gt;(num_peers));
    │ │ │ +00064780: 0a09 0909 666f 7220 2869 6e74 2069 203d  ....for (int i =
    │ │ │ +00064790: 2030 3b20 6920 266c 743b 206e 756d 5f70   0; i < num_p
    │ │ │ +000647a0: 6565 7273 3b20 2b2b 6929 0a09 0909 7b0a  eers; ++i)....{.
    │ │ │ +000647b0: 0909 0909 6970 7634 5f70 6565 725f 656e  ....ipv4_peer_en
    │ │ │ +000647c0: 7472 7920 657b 7d3b 0a09 0909 0973 7464  try e{};.....std
    │ │ │ +000647d0: 3a3a 6d65 6d63 7079 2865 2e69 702e 6461  ::memcpy(e.ip.da
    │ │ │ +000647e0: 7461 2829 2c20 6275 662e 6461 7461 2829  ta(), buf.data()
    │ │ │ +000647f0: 2c20 3429 3b0a 0909 0909 6275 6620 3d20  , 4);.....buf = 
    │ │ │ +00064800: 6275 662e 7375 6273 7061 6e28 3429 3b0a  buf.subspan(4);.
    │ │ │ +00064810: 0909 0909 652e 706f 7274 203d 2061 7578  ....e.port = aux
    │ │ │ +00064820: 3a3a 7265 6164 5f75 696e 7431 3628 6275  ::read_uint16(bu
    │ │ │ +00064830: 6629 3b0a 0909 0909 7265 7370 2e70 6565  f);.....resp.pee
    │ │ │ +00064840: 7273 342e 7075 7368 5f62 6163 6b28 6529  rs4.push_back(e)
    │ │ │ +00064850: 3b0a 0909 097d 0a09 097d 0a0a 3c64 6976  ;....}...}..
    ..std: │ │ │ +00064890: 3a6c 6973 7426 6c74 3b61 6464 7265 7373 :list<address │ │ │ +000648a0: 2667 743b 2069 705f 6c69 7374 3b0a 3c2f > ip_list;...std::trans │ │ │ +000648c0: 666f 726d 286d 5f65 6e64 706f 696e 7473 form(m_endpoints │ │ │ +000648d0: 2e62 6567 696e 2829 2c20 6d5f 656e 6470 .begin(), m_endp │ │ │ +000648e0: 6f69 6e74 732e 656e 6428 292c 2073 7464 oints.end(), std │ │ │ +000648f0: 3a3a 6261 636b 5f69 6e73 6572 7465 7228 ::back_inserter( │ │ │ +00064900: 6970 5f6c 6973 7429 0a09 0909 2c20 5b5d ip_list)...., [] │ │ │ +00064910: 2874 6370 3a3a 656e 6470 6f69 6e74 2063 (tcp::endpoint c │ │ │ +00064920: 6f6e 7374 2661 6d70 3b20 6570 2920 7b20 onst& ep) { │ │ │ +00064930: 7265 7475 726e 2065 702e 6164 6472 6573 return ep.addres │ │ │ +00064940: 7328 293b 207d 2029 3b0a 0a09 0963 622d s(); } );....cb- │ │ │ +00064950: 2667 743b 7472 6163 6b65 725f 7265 7370 >tracker_resp │ │ │ +00064960: 6f6e 7365 2874 7261 636b 6572 5f72 6571 onse(tracker_req │ │ │ +00064970: 2829 2c20 6d5f 7461 7267 6574 2e61 6464 (), m_target.add │ │ │ +00064980: 7265 7373 2829 2c20 6970 5f6c 6973 742c ress(), ip_list, │ │ │ +00064990: 2072 6573 7029 3b0a 0a09 0963 6c6f 7365 resp);....close │ │ │ +000649a0: 2829 3b0a 0909 7265 7475 726e 2074 7275 ();...return tru │ │ │ +000649b0: 653b 0a09 7d0a 0a09 626f 6f6c 2075 6470 e;..}...bool udp │ │ │ +000649c0: 5f74 7261 636b 6572 5f63 6f6e 6e65 6374 _tracker_connect │ │ │ +000649d0: 696f 6e3a 3a6f 6e5f 7363 7261 7065 5f72 ion::on_scrape_r │ │ │ +000649e0: 6573 706f 6e73 6528 7370 616e 266c 743b esponse(span< │ │ │ +000649f0: 6368 6172 2063 6f6e 7374 2667 743b 2062 char const> b │ │ │ +00064a00: 7566 290a 097b 0a09 0972 6573 7461 7274 uf)..{...restart │ │ │ +00064a10: 5f72 6561 645f 7469 6d65 6f75 7428 293b _read_timeout(); │ │ │ +00064a20: 0a09 0961 7574 6f20 636f 6e73 7420 6163 ...auto const ac │ │ │ +00064a30: 7469 6f6e 203d 2073 7461 7469 635f 6361 tion = static_ca │ │ │ +00064a40: 7374 266c 743b 6163 7469 6f6e 5f74 2667 st<action_t&g │ │ │ +00064a50: 743b 2861 7578 3a3a 7265 6164 5f69 6e74 t;(aux::read_int │ │ │ +00064a60: 3332 2862 7566 2929 3b0a 0909 7374 643a 32(buf));...std: │ │ │ +00064a70: 3a75 696e 7433 325f 7420 636f 6e73 7420 :uint32_t const │ │ │ +00064a80: 7472 616e 7361 6374 696f 6e20 3d20 6175 transaction = au │ │ │ +00064a90: 783a 3a72 6561 645f 7569 6e74 3332 2862 x::read_uint32(b │ │ │ +00064aa0: 7566 293b 0a0a 0909 6966 2028 7472 616e uf);....if (tran │ │ │ +00064ab0: 7361 6374 696f 6e20 213d 206d 5f74 7261 saction != m_tra │ │ │ +00064ac0: 6e73 6163 7469 6f6e 5f69 6429 0a09 097b nsaction_id)...{ │ │ │ +00064ad0: 0a09 0909 6661 696c 2865 7272 6f72 5f63 ....fail(error_c │ │ │ +00064ae0: 6f64 6528 6572 726f 7273 3a3a 696e 7661 ode(errors::inva │ │ │ +00064af0: 6c69 645f 7472 6163 6b65 725f 7472 616e lid_tracker_tran │ │ │ +00064b00: 7361 6374 696f 6e5f 6964 292c 206f 7065 saction_id), ope │ │ │ +00064b10: 7261 7469 6f6e 5f74 3a3a 6269 7474 6f72 ration_t::bittor │ │ │ +00064b20: 7265 6e74 293b 0a09 0909 7265 7475 726e rent);....return │ │ │ +00064b30: 2066 616c 7365 3b0a 0909 7d0a 0a09 0969 false;...}....i │ │ │ +00064b40: 6620 2861 6374 696f 6e20 3d3d 2061 6374 f (action == act │ │ │ +00064b50: 696f 6e5f 743a 3a65 7272 6f72 290a 0909 ion_t::error)... │ │ │ +00064b60: 7b0a 0909 0966 6169 6c28 6572 726f 725f {....fail(error_ │ │ │ +00064b70: 636f 6465 2865 7272 6f72 733a 3a74 7261 code(errors::tra │ │ │ +00064b80: 636b 6572 5f66 6169 6c75 7265 292c 206f cker_failure), o │ │ │ +00064b90: 7065 7261 7469 6f6e 5f74 3a3a 6269 7474 peration_t::bitt │ │ │ +00064ba0: 6f72 7265 6e74 0a09 0909 092c 2073 7464 orrent....., std │ │ │ +00064bb0: 3a3a 7374 7269 6e67 2862 7566 2e64 6174 ::string(buf.dat │ │ │ +00064bc0: 6128 292c 2073 7461 7469 635f 6361 7374 a(), static_cast │ │ │ +00064bd0: 266c 743b 7374 643a 3a73 697a 655f 7426 <std::size_t& │ │ │ +00064be0: 6774 3b28 6275 662e 7369 7a65 2829 2929 gt;(buf.size())) │ │ │ +00064bf0: 2e63 5f73 7472 2829 293b 0a09 0909 7265 .c_str());....re │ │ │ +00064c00: 7475 726e 2074 7275 653b 0a09 097d 0a0a turn true;...}.. │ │ │ +00064c10: 0909 6966 2028 6163 7469 6f6e 2021 3d20 ..if (action != │ │ │ +00064c20: 6163 7469 6f6e 5f74 3a3a 7363 7261 7065 action_t::scrape │ │ │ +00064c30: 290a 0909 7b0a 3c2f 7072 653e 3c2f 7464 )...{.
    relevance │ │ │ +00064c70: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ +00064c80: 3c61 2068 7265 663d 226a 6176 6173 6372 ../src/alert.cp │ │ │ +00064cb0: 703a 3338 373c 2f61 3e3c 2f74 643e 3c74 p:387move this fiel │ │ │ +00064cd0: 6420 696e 746f 2074 7261 636b 6572 5f61 d into tracker_a │ │ │ +00064ce0: 6c65 7274 3c2f 7464 3e3c 2f74 723e 3c74 lertmove this fiel │ │ │ +00064d40: 6420 696e 746f 2074 7261 636b 6572 5f61 d into tracker_a │ │ │ +00064d50: 6c65 7274 3c2f 6832 3e3c 6834 3e2e 2e2f lert

    ../ │ │ │ +00064d60: 7372 632f 616c 6572 742e 6370 703a 3338 src/alert.cpp:38 │ │ │ +00064d70: 373c 2f68 343e 3c70 7265 2073 7479 6c65 7

    │ │ │ +00064db0: 0a09 0972 6574 7572 6e20 746f 7272 656e  ...return torren
    │ │ │ +00064dc0: 745f 616c 6572 743a 3a6d 6573 7361 6765  t_alert::message
    │ │ │ +00064dd0: 2829 202b 2022 3a20 7374 6174 6520 6368  () + ": state ch
    │ │ │ +00064de0: 616e 6765 6420 746f 3a20 220a 0909 092b  anged to: "....+
    │ │ │ +00064df0: 2073 7461 7465 5f73 7472 5b73 7461 7465   state_str[state
    │ │ │ +00064e00: 5d3b 0a23 656e 6469 660a 097d 0a0a 0974  ];.#endif..}...t
    │ │ │ +00064e10: 7261 636b 6572 5f65 7272 6f72 5f61 6c65  racker_error_ale
    │ │ │ +00064e20: 7274 3a3a 7472 6163 6b65 725f 6572 726f  rt::tracker_erro
    │ │ │ +00064e30: 725f 616c 6572 7428 6175 783a 3a73 7461  r_alert(aux::sta
    │ │ │ +00064e40: 636b 5f61 6c6c 6f63 6174 6f72 2661 6d70  ck_allocator&
    │ │ │ +00064e50: 3b20 616c 6c6f 630a 0909 2c20 746f 7272  ; alloc..., torr
    │ │ │ +00064e60: 656e 745f 6861 6e64 6c65 2063 6f6e 7374  ent_handle const
    │ │ │ +00064e70: 2661 6d70 3b20 682c 2074 6370 3a3a 656e  & h, tcp::en
    │ │ │ +00064e80: 6470 6f69 6e74 2063 6f6e 7374 2661 6d70  dpoint const&
    │ │ │ +00064e90: 3b20 6570 2c20 696e 7420 7469 6d65 730a  ; ep, int times.
    │ │ │ +00064ea0: 0909 2c20 7072 6f74 6f63 6f6c 5f76 6572  .., protocol_ver
    │ │ │ +00064eb0: 7369 6f6e 2076 2c20 7374 7269 6e67 5f76  sion v, string_v
    │ │ │ +00064ec0: 6965 7720 752c 206f 7065 7261 7469 6f6e  iew u, operation
    │ │ │ +00064ed0: 5f74 2063 6f6e 7374 206f 7065 7261 7469  _t const operati
    │ │ │ +00064ee0: 6f6e 0a09 092c 2065 7272 6f72 5f63 6f64  on..., error_cod
    │ │ │ +00064ef0: 6520 636f 6e73 7426 616d 703b 2065 0a09  e const& e..
    │ │ │ +00064f00: 092c 2073 7472 696e 675f 7669 6577 206d  ., string_view m
    │ │ │ +00064f10: 290a 0909 3a20 7472 6163 6b65 725f 616c  )...: tracker_al
    │ │ │ +00064f20: 6572 7428 616c 6c6f 632c 2068 2c20 6570  ert(alloc, h, ep
    │ │ │ +00064f30: 2c20 7529 0a09 092c 2074 696d 6573 5f69  , u)..., times_i
    │ │ │ +00064f40: 6e5f 726f 7728 7469 6d65 7329 0a09 092c  n_row(times)...,
    │ │ │ +00064f50: 2065 7272 6f72 2865 290a 0909 2c20 6f70   error(e)..., op
    │ │ │ +00064f60: 286f 7065 7261 7469 6f6e 290a 0909 2c20  (operation)..., 
    │ │ │ +00064f70: 6d5f 6d73 675f 6964 7828 616c 6c6f 632e  m_msg_idx(alloc.
    │ │ │ +00064f80: 636f 7079 5f73 7472 696e 6728 6d29 290a  copy_string(m)).
    │ │ │ +00064f90: 2369 6620 544f 5252 454e 545f 4142 495f  #if TORRENT_ABI_
    │ │ │ +00064fa0: 5645 5253 494f 4e20 3d3d 2031 0a09 092c  VERSION == 1...,
    │ │ │ +00064fb0: 2073 7461 7475 735f 636f 6465 2865 2026   status_code(e &
    │ │ │ +00064fc0: 616d 703b 2661 6d70 3b20 652e 6361 7465  amp;& e.cate
    │ │ │ +00064fd0: 676f 7279 2829 203d 3d20 6874 7470 5f63  gory() == http_c
    │ │ │ +00064fe0: 6174 6567 6f72 7928 2920 3f20 652e 7661  ategory() ? e.va
    │ │ │ +00064ff0: 6c75 6528 2920 3a20 2d31 290a 0909 2c20  lue() : -1)..., 
    │ │ │ +00065000: 6d73 6728 6d29 0a23 656e 6469 660a 3c64  msg(m).#endif..., 
    │ │ │ +00065040: 7665 7273 696f 6e28 7629 0a3c 2f64 6976  version(v)..{...TORRENT_AS
    │ │ │ +00065060: 5345 5254 2821 752e 656d 7074 7928 2929  SERT(!u.empty())
    │ │ │ +00065070: 3b0a 097d 0a0a 0963 6861 7220 636f 6e73  ;..}...char cons
    │ │ │ +00065080: 742a 2074 7261 636b 6572 5f65 7272 6f72  t* tracker_error
    │ │ │ +00065090: 5f61 6c65 7274 3a3a 6661 696c 7572 655f  _alert::failure_
    │ │ │ +000650a0: 7265 6173 6f6e 2829 2063 6f6e 7374 0a09  reason() const..
    │ │ │ +000650b0: 7b0a 0909 7265 7475 726e 206d 5f61 6c6c  {...return m_all
    │ │ │ +000650c0: 6f63 2e67 6574 2829 2e70 7472 286d 5f6d  oc.get().ptr(m_m
    │ │ │ +000650d0: 7367 5f69 6478 293b 0a09 7d0a 0a09 7374  sg_idx);..}...st
    │ │ │ +000650e0: 643a 3a73 7472 696e 6720 7472 6163 6b65  d::string tracke
    │ │ │ +000650f0: 725f 6572 726f 725f 616c 6572 743a 3a6d  r_error_alert::m
    │ │ │ +00065100: 6573 7361 6765 2829 2063 6f6e 7374 0a09  essage() const..
    │ │ │ +00065110: 7b0a 2369 6664 6566 2054 4f52 5245 4e54  {.#ifdef TORRENT
    │ │ │ +00065120: 5f44 4953 4142 4c45 5f41 4c45 5254 5f4d  _DISABLE_ALERT_M
    │ │ │ +00065130: 5347 0a09 0972 6574 7572 6e20 7b7d 3b0a  SG...return {};.
    │ │ │ +00065140: 2365 6c73 650a 0909 6368 6172 2072 6574  #else...char ret
    │ │ │ +00065150: 5b34 3030 5d3b 0a09 0973 7464 3a3a 736e  [400];...std::sn
    │ │ │ +00065160: 7072 696e 7466 2872 6574 2c20 7369 7a65  printf(ret, size
    │ │ │ +00065170: 6f66 2872 6574 292c 2022 2573 2025 7320  of(ret), "%s %s 
    │ │ │ +00065180: 2573 205c 2225 735c 2220 2825 6429 220a  %s \"%s\" (%d)".
    │ │ │ +00065190: 0909 092c 2074 7261 636b 6572 5f61 6c65  ..., tracker_ale
    │ │ │ +000651a0: 7274 3a3a 6d65 7373 6167 6528 292e 635f  rt::message().c_
    │ │ │ +000651b0: 7374 7228 290a 0909 092c 2076 6572 7369  str()...., versi
    │ │ │ +000651c0: 6f6e 203d 3d20 7072 6f74 6f63 6f6c 5f76  on == protocol_v
    │ │ │ +000651d0: 6572 7369 6f6e 3a3a 5631 203f 2022 7631  ersion::V1 ? "v1
    │ │ │ +000651e0: 2220 3a20 2276 3222 0a09 0909 2c20 636f  " : "v2"...., co
    │ │ │ +000651f0: 6e76 6572 745f 6672 6f6d 5f6e 6174 6976  nvert_from_nativ
    │ │ │ +00065200: 6528 6572 726f 722e 6d65 7373 6167 6528  e(error.message(
    │ │ │ +00065210: 2929 2e63 5f73 7472 2829 2c20 6572 726f  )).c_str(), erro
    │ │ │ +00065220: 725f 6d65 7373 6167 6528 290a 0909 092c  r_message()....,
    │ │ │ +00065230: 2074 696d 6573 5f69 6e5f 726f 7729 3b0a   times_in_row);.
    │ │ │ +00065240: 0909 7265 7475 726e 2072 6574 3b0a 2365  ..return ret;.#e
    │ │ │ +00065250: 6e64 6966 0a09 7d0a 0a09 7472 6163 6b65  ndif..}...tracke
    │ │ │ +00065260: 725f 7761 726e 696e 675f 616c 6572 743a  r_warning_alert:
    │ │ │ +00065270: 3a74 7261 636b 6572 5f77 6172 6e69 6e67  :tracker_warning
    │ │ │ +00065280: 5f61 6c65 7274 2861 7578 3a3a 7374 6163  _alert(aux::stac
    │ │ │ +00065290: 6b5f 616c 6c6f 6361 746f 7226 616d 703b  k_allocator&
    │ │ │ +000652a0: 2061 6c6c 6f63 0a09 092c 2074 6f72 7265   alloc..., torre
    │ │ │ +000652b0: 6e74 5f68 616e 646c 6520 636f 6e73 7426  nt_handle const&
    │ │ │ +000652c0: 616d 703b 2068 2c20 7463 703a 3a65 6e64  amp; h, tcp::end
    │ │ │ +000652d0: 706f 696e 7420 636f 6e73 7426 616d 703b  point const&
    │ │ │ +000652e0: 2065 700a 0909 2c20 7374 7269 6e67 5f76   ep..., string_v
    │ │ │ +000652f0: 6965 7720 752c 2070 726f 746f 636f 6c5f  iew u, protocol_
    │ │ │ +00065300: 7665 7273 696f 6e20 762c 2073 7472 696e  version v, strin
    │ │ │ +00065310: 675f 7669 6577 206d 290a 0909 3a20 7472  g_view m)...: tr
    │ │ │ +00065320: 6163 6b65 725f 616c 6572 7428 616c 6c6f  acker_alert(allo
    │ │ │ +00065330: 632c 2068 2c20 6570 2c20 7529 0a09 092c  c, h, ep, u)...,
    │ │ │ +00065340: 206d 5f6d 7367 5f69 6478 2861 6c6c 6f63   m_msg_idx(alloc
    │ │ │ +00065350: 2e63 6f70 795f 7374 7269 6e67 286d 2929  .copy_string(m))
    │ │ │ +00065360: 0a23 6966 2054 4f52 5245 4e54 5f41 4249  .#if TORRENT_ABI
    │ │ │ +00065370: 5f56 4552 5349 4f4e 203d 3d20 310a 3c2f  _VERSION == 1.r
    │ │ │ +000653b0: 656c 6576 616e 6365 266e 6273 703b 303c  elevance 0<
    │ │ │ +000653c0: 2f74 643e 3c74 643e 3c61 2068 7265 663d  /td>../src/
    │ │ │ +000653f0: 616c 6572 742e 6370 703a 3432 313c 2f61  alert.cpp:421move t
    │ │ │ +00065410: 6869 7320 696e 746f 2074 7261 636b 6572  his into tracker
    │ │ │ +00065420: 5f61 6c65 7274 3c2f 7464 3e3c 2f74 723e  _alert
    │ │ │ +00065430: 3c74 7220 6964 3d22 3233 3322 2073 7479  
    │ │ │ +00065460: 3c74 6420 636f 6c73 7061 6e3d 2233 223e  
    │ │ │ +00065470: 3c68 323e 6d6f 7665 2074 6869 7320 696e  

    move this in │ │ │ +00065480: 746f 2074 7261 636b 6572 5f61 6c65 7274 to tracker_alert │ │ │ +00065490: 3c2f 6832 3e3c 6834 3e2e 2e2f 7372 632f

    ../src/ │ │ │ +000654a0: 616c 6572 742e 6370 703a 3432 313c 2f68 alert.cpp:421
    ..re
    │ │ │ +000654f0: 7475 726e 207b 7d3b 0a23 656c 7365 0a09  turn {};.#else..
    │ │ │ +00065500: 0963 6861 7220 7265 745b 3430 305d 3b0a  .char ret[400];.
    │ │ │ +00065510: 0909 7374 643a 3a73 6e70 7269 6e74 6628  ..std::snprintf(
    │ │ │ +00065520: 7265 742c 2073 697a 656f 6628 7265 7429  ret, sizeof(ret)
    │ │ │ +00065530: 2c20 2225 7320 2573 2025 7320 5c22 2573  , "%s %s %s \"%s
    │ │ │ +00065540: 5c22 2028 2564 2922 0a09 0909 2c20 7472  \" (%d)"...., tr
    │ │ │ +00065550: 6163 6b65 725f 616c 6572 743a 3a6d 6573  acker_alert::mes
    │ │ │ +00065560: 7361 6765 2829 2e63 5f73 7472 2829 0a09  sage().c_str()..
    │ │ │ +00065570: 0909 2c20 7665 7273 696f 6e20 3d3d 2070  .., version == p
    │ │ │ +00065580: 726f 746f 636f 6c5f 7665 7273 696f 6e3a  rotocol_version:
    │ │ │ +00065590: 3a56 3120 3f20 2276 3122 203a 2022 7632  :V1 ? "v1" : "v2
    │ │ │ +000655a0: 220a 0909 092c 2063 6f6e 7665 7274 5f66  "...., convert_f
    │ │ │ +000655b0: 726f 6d5f 6e61 7469 7665 2865 7272 6f72  rom_native(error
    │ │ │ +000655c0: 2e6d 6573 7361 6765 2829 292e 635f 7374  .message()).c_st
    │ │ │ +000655d0: 7228 292c 2065 7272 6f72 5f6d 6573 7361  r(), error_messa
    │ │ │ +000655e0: 6765 2829 0a09 0909 2c20 7469 6d65 735f  ge()...., times_
    │ │ │ +000655f0: 696e 5f72 6f77 293b 0a09 0972 6574 7572  in_row);...retur
    │ │ │ +00065600: 6e20 7265 743b 0a23 656e 6469 660a 097d  n ret;.#endif..}
    │ │ │ +00065610: 0a0a 0974 7261 636b 6572 5f77 6172 6e69  ...tracker_warni
    │ │ │ +00065620: 6e67 5f61 6c65 7274 3a3a 7472 6163 6b65  ng_alert::tracke
    │ │ │ +00065630: 725f 7761 726e 696e 675f 616c 6572 7428  r_warning_alert(
    │ │ │ +00065640: 6175 783a 3a73 7461 636b 5f61 6c6c 6f63  aux::stack_alloc
    │ │ │ +00065650: 6174 6f72 2661 6d70 3b20 616c 6c6f 630a  ator& alloc.
    │ │ │ +00065660: 0909 2c20 746f 7272 656e 745f 6861 6e64  .., torrent_hand
    │ │ │ +00065670: 6c65 2063 6f6e 7374 2661 6d70 3b20 682c  le const& h,
    │ │ │ +00065680: 2074 6370 3a3a 656e 6470 6f69 6e74 2063   tcp::endpoint c
    │ │ │ +00065690: 6f6e 7374 2661 6d70 3b20 6570 0a09 092c  onst& ep...,
    │ │ │ +000656a0: 2073 7472 696e 675f 7669 6577 2075 2c20   string_view u, 
    │ │ │ +000656b0: 7072 6f74 6f63 6f6c 5f76 6572 7369 6f6e  protocol_version
    │ │ │ +000656c0: 2076 2c20 7374 7269 6e67 5f76 6965 7720   v, string_view 
    │ │ │ +000656d0: 6d29 0a09 093a 2074 7261 636b 6572 5f61  m)...: tracker_a
    │ │ │ +000656e0: 6c65 7274 2861 6c6c 6f63 2c20 682c 2065  lert(alloc, h, e
    │ │ │ +000656f0: 702c 2075 290a 0909 2c20 6d5f 6d73 675f  p, u)..., m_msg_
    │ │ │ +00065700: 6964 7828 616c 6c6f 632e 636f 7079 5f73  idx(alloc.copy_s
    │ │ │ +00065710: 7472 696e 6728 6d29 290a 2369 6620 544f  tring(m)).#if TO
    │ │ │ +00065720: 5252 454e 545f 4142 495f 5645 5253 494f  RRENT_ABI_VERSIO
    │ │ │ +00065730: 4e20 3d3d 2031 0a09 092c 206d 7367 286d  N == 1..., msg(m
    │ │ │ +00065740: 290a 2365 6e64 6966 0a3c 6469 7620 7374  ).#endif.
    .., versi │ │ │ +00065780: 6f6e 2876 290a 3c2f 6469 763e 097b 0a09 on(v).
    .{.. │ │ │ +00065790: 0954 4f52 5245 4e54 5f41 5353 4552 5428 .TORRENT_ASSERT( │ │ │ +000657a0: 2175 2e65 6d70 7479 2829 293b 0a09 7d0a !u.empty());..}. │ │ │ +000657b0: 0a09 6368 6172 2063 6f6e 7374 2a20 7472 ..char const* tr │ │ │ +000657c0: 6163 6b65 725f 7761 726e 696e 675f 616c acker_warning_al │ │ │ +000657d0: 6572 743a 3a77 6172 6e69 6e67 5f6d 6573 ert::warning_mes │ │ │ +000657e0: 7361 6765 2829 2063 6f6e 7374 0a09 7b0a sage() const..{. │ │ │ +000657f0: 0909 7265 7475 726e 206d 5f61 6c6c 6f63 ..return m_alloc │ │ │ +00065800: 2e67 6574 2829 2e70 7472 286d 5f6d 7367 .get().ptr(m_msg │ │ │ +00065810: 5f69 6478 293b 0a09 7d0a 0a09 7374 643a _idx);..}...std: │ │ │ +00065820: 3a73 7472 696e 6720 7472 6163 6b65 725f :string tracker_ │ │ │ +00065830: 7761 726e 696e 675f 616c 6572 743a 3a6d warning_alert::m │ │ │ +00065840: 6573 7361 6765 2829 2063 6f6e 7374 0a09 essage() const.. │ │ │ +00065850: 7b0a 2369 6664 6566 2054 4f52 5245 4e54 {.#ifdef TORRENT │ │ │ +00065860: 5f44 4953 4142 4c45 5f41 4c45 5254 5f4d _DISABLE_ALERT_M │ │ │ +00065870: 5347 0a09 0972 6574 7572 6e20 7b7d 3b0a SG...return {};. │ │ │ +00065880: 2365 6c73 650a 0909 7265 7475 726e 2074 #else...return t │ │ │ +00065890: 7261 636b 6572 5f61 6c65 7274 3a3a 6d65 racker_alert::me │ │ │ +000658a0: 7373 6167 6528 2920 2b20 2876 6572 7369 ssage() + (versi │ │ │ +000658b0: 6f6e 203d 3d20 7072 6f74 6f63 6f6c 5f76 on == protocol_v │ │ │ +000658c0: 6572 7369 6f6e 3a3a 5631 203f 2022 2076 ersion::V1 ? " v │ │ │ +000658d0: 3122 203a 2022 2076 3222 2920 2b20 2220 1" : " v2") + " │ │ │ +000658e0: 7761 726e 696e 673a 2022 202b 2077 6172 warning: " + war │ │ │ +000658f0: 6e69 6e67 5f6d 6573 7361 6765 2829 3b0a ning_message();. │ │ │ +00065900: 2365 6e64 6966 0a09 7d0a 0a09 7363 7261 #endif..}...scra │ │ │ +00065910: 7065 5f72 6570 6c79 5f61 6c65 7274 3a3a pe_reply_alert:: │ │ │ +00065920: 7363 7261 7065 5f72 6570 6c79 5f61 6c65 scrape_reply_ale │ │ │ +00065930: 7274 2861 7578 3a3a 7374 6163 6b5f 616c rt(aux::stack_al │ │ │ +00065940: 6c6f 6361 746f 7226 616d 703b 2061 6c6c locator& all │ │ │ +00065950: 6f63 0a09 092c 2074 6f72 7265 6e74 5f68 oc..., torrent_h │ │ │ +00065960: 616e 646c 6520 636f 6e73 7426 616d 703b andle const& │ │ │ +00065970: 2068 2c20 7463 703a 3a65 6e64 706f 696e h, tcp::endpoin │ │ │ +00065980: 7420 636f 6e73 7426 616d 703b 2065 700a t const& ep. │ │ │ +00065990: 0909 2c20 696e 7420 696e 636f 6d70 2c20 .., int incomp, │ │ │ +000659a0: 696e 7420 636f 6d70 2c20 7374 7269 6e67 int comp, string │ │ │ +000659b0: 5f76 6965 7720 752c 2070 726f 746f 636f _view u, protoco │ │ │ +000659c0: 6c5f 7665 7273 696f 6e20 636f 6e73 7420 l_version const │ │ │ +000659d0: 7629 0a09 093a 2074 7261 636b 6572 5f61 v)...: tracker_a │ │ │ +000659e0: 6c65 7274 2861 6c6c 6f63 2c20 682c 2065 lert(alloc, h, e │ │ │ +000659f0: 702c 2075 290a 0909 2c20 696e 636f 6d70 p, u)..., incomp │ │ │ +00065a00: 6c65 7465 2869 6e63 6f6d 7029 0a09 092c lete(incomp)..., │ │ │ +00065a10: 2063 6f6d 706c 6574 6528 636f 6d70 290a complete(comp). │ │ │ +00065a20: 3c2f 7072 653e 3c2f 7464 3e3c 2f74 723e
    │ │ │ +00065a30: 3c74 7220 7374 796c 653d 2262 6163 6b67 relevance  │ │ │ +00065a60: 303c 2f74 643e 3c74 643e 3c61 2068 7265 0../sr │ │ │ +00065a90: 632f 616c 6572 742e 6370 703a 3434 373c c/alert.cpp:447< │ │ │ +00065aa0: 2f61 3e3c 2f74 643e 3c74 643e 6d6f 7665 /a>move │ │ │ +00065ab0: 2074 6869 7320 696e 746f 2074 7261 636b this into track │ │ │ +00065ac0: 6572 5f61 6c65 7274 3c2f 7464 3e3c 2f74 er_alert

    move this │ │ │ +00065b20: 696e 746f 2074 7261 636b 6572 5f61 6c65 into tracker_ale │ │ │ +00065b30: 7274 3c2f 6832 3e3c 6834 3e2e 2e2f 7372 rt

    ../sr │ │ │ +00065b40: 632f 616c 6572 742e 6370 703a 3434 373c c/alert.cpp:447< │ │ │ +00065b50: 2f68 343e 3c70 7265 2073 7479 6c65 3d22 /h4>
    .c
    │ │ │ +00065b90: 6861 7220 636f 6e73 742a 2074 7261 636b  har const* track
    │ │ │ +00065ba0: 6572 5f77 6172 6e69 6e67 5f61 6c65 7274  er_warning_alert
    │ │ │ +00065bb0: 3a3a 7761 726e 696e 675f 6d65 7373 6167  ::warning_messag
    │ │ │ +00065bc0: 6528 2920 636f 6e73 740a 097b 0a09 0972  e() const..{...r
    │ │ │ +00065bd0: 6574 7572 6e20 6d5f 616c 6c6f 632e 6765  eturn m_alloc.ge
    │ │ │ +00065be0: 7428 292e 7074 7228 6d5f 6d73 675f 6964  t().ptr(m_msg_id
    │ │ │ +00065bf0: 7829 3b0a 097d 0a0a 0973 7464 3a3a 7374  x);..}...std::st
    │ │ │ +00065c00: 7269 6e67 2074 7261 636b 6572 5f77 6172  ring tracker_war
    │ │ │ +00065c10: 6e69 6e67 5f61 6c65 7274 3a3a 6d65 7373  ning_alert::mess
    │ │ │ +00065c20: 6167 6528 2920 636f 6e73 740a 097b 0a23  age() const..{.#
    │ │ │ +00065c30: 6966 6465 6620 544f 5252 454e 545f 4449  ifdef TORRENT_DI
    │ │ │ +00065c40: 5341 424c 455f 414c 4552 545f 4d53 470a  SABLE_ALERT_MSG.
    │ │ │ +00065c50: 0909 7265 7475 726e 207b 7d3b 0a23 656c  ..return {};.#el
    │ │ │ +00065c60: 7365 0a09 0972 6574 7572 6e20 7472 6163  se...return trac
    │ │ │ +00065c70: 6b65 725f 616c 6572 743a 3a6d 6573 7361  ker_alert::messa
    │ │ │ +00065c80: 6765 2829 202b 2028 7665 7273 696f 6e20  ge() + (version 
    │ │ │ +00065c90: 3d3d 2070 726f 746f 636f 6c5f 7665 7273  == protocol_vers
    │ │ │ +00065ca0: 696f 6e3a 3a56 3120 3f20 2220 7631 2220  ion::V1 ? " v1" 
    │ │ │ +00065cb0: 3a20 2220 7632 2229 202b 2022 2077 6172  : " v2") + " war
    │ │ │ +00065cc0: 6e69 6e67 3a20 2220 2b20 7761 726e 696e  ning: " + warnin
    │ │ │ +00065cd0: 675f 6d65 7373 6167 6528 293b 0a23 656e  g_message();.#en
    │ │ │ +00065ce0: 6469 660a 097d 0a0a 0973 6372 6170 655f  dif..}...scrape_
    │ │ │ +00065cf0: 7265 706c 795f 616c 6572 743a 3a73 6372  reply_alert::scr
    │ │ │ +00065d00: 6170 655f 7265 706c 795f 616c 6572 7428  ape_reply_alert(
    │ │ │ +00065d10: 6175 783a 3a73 7461 636b 5f61 6c6c 6f63  aux::stack_alloc
    │ │ │ +00065d20: 6174 6f72 2661 6d70 3b20 616c 6c6f 630a  ator& alloc.
    │ │ │ +00065d30: 0909 2c20 746f 7272 656e 745f 6861 6e64  .., torrent_hand
    │ │ │ +00065d40: 6c65 2063 6f6e 7374 2661 6d70 3b20 682c  le const& h,
    │ │ │ +00065d50: 2074 6370 3a3a 656e 6470 6f69 6e74 2063   tcp::endpoint c
    │ │ │ +00065d60: 6f6e 7374 2661 6d70 3b20 6570 0a09 092c  onst& ep...,
    │ │ │ +00065d70: 2069 6e74 2069 6e63 6f6d 702c 2069 6e74   int incomp, int
    │ │ │ +00065d80: 2063 6f6d 702c 2073 7472 696e 675f 7669   comp, string_vi
    │ │ │ +00065d90: 6577 2075 2c20 7072 6f74 6f63 6f6c 5f76  ew u, protocol_v
    │ │ │ +00065da0: 6572 7369 6f6e 2063 6f6e 7374 2076 290a  ersion const v).
    │ │ │ +00065db0: 0909 3a20 7472 6163 6b65 725f 616c 6572  ..: tracker_aler
    │ │ │ +00065dc0: 7428 616c 6c6f 632c 2068 2c20 6570 2c20  t(alloc, h, ep, 
    │ │ │ +00065dd0: 7529 0a09 092c 2069 6e63 6f6d 706c 6574  u)..., incomplet
    │ │ │ +00065de0: 6528 696e 636f 6d70 290a 0909 2c20 636f  e(incomp)..., co
    │ │ │ +00065df0: 6d70 6c65 7465 2863 6f6d 7029 0a3c 6469  mplete(comp)..., v
    │ │ │ +00065e30: 6572 7369 6f6e 2876 290a 3c2f 6469 763e  ersion(v).
    │ │ │ +00065e40: 097b 0a09 0954 4f52 5245 4e54 5f41 5353  .{...TORRENT_ASS
    │ │ │ +00065e50: 4552 5428 2175 2e65 6d70 7479 2829 293b  ERT(!u.empty());
    │ │ │ +00065e60: 0a09 7d0a 0a09 7374 643a 3a73 7472 696e  ..}...std::strin
    │ │ │ +00065e70: 6720 7363 7261 7065 5f72 6570 6c79 5f61  g scrape_reply_a
    │ │ │ +00065e80: 6c65 7274 3a3a 6d65 7373 6167 6528 2920  lert::message() 
    │ │ │ +00065e90: 636f 6e73 740a 097b 0a23 6966 6465 6620  const..{.#ifdef 
    │ │ │ +00065ea0: 544f 5252 454e 545f 4449 5341 424c 455f  TORRENT_DISABLE_
    │ │ │ +00065eb0: 414c 4552 545f 4d53 470a 0909 7265 7475  ALERT_MSG...retu
    │ │ │ +00065ec0: 726e 207b 7d3b 0a23 656c 7365 0a09 0963  rn {};.#else...c
    │ │ │ +00065ed0: 6861 7220 7265 745b 3430 305d 3b0a 0909  har ret[400];...
    │ │ │ +00065ee0: 7374 643a 3a73 6e70 7269 6e74 6628 7265  std::snprintf(re
    │ │ │ +00065ef0: 742c 2073 697a 656f 6628 7265 7429 2c20  t, sizeof(ret), 
    │ │ │ +00065f00: 2225 7320 2573 2073 6372 6170 6520 7265  "%s %s scrape re
    │ │ │ +00065f10: 706c 793a 2025 6420 2564 220a 0909 092c  ply: %d %d"....,
    │ │ │ +00065f20: 2074 7261 636b 6572 5f61 6c65 7274 3a3a   tracker_alert::
    │ │ │ +00065f30: 6d65 7373 6167 6528 292e 635f 7374 7228  message().c_str(
    │ │ │ +00065f40: 290a 0909 092c 2076 6572 7369 6f6e 203d  )...., version =
    │ │ │ +00065f50: 3d20 7072 6f74 6f63 6f6c 5f76 6572 7369  = protocol_versi
    │ │ │ +00065f60: 6f6e 3a3a 5631 203f 2022 7631 2220 3a20  on::V1 ? "v1" : 
    │ │ │ +00065f70: 2276 3222 0a09 0909 2c20 696e 636f 6d70  "v2"...., incomp
    │ │ │ +00065f80: 6c65 7465 2c20 636f 6d70 6c65 7465 293b  lete, complete);
    │ │ │ +00065f90: 0a09 0972 6574 7572 6e20 7265 743b 0a23  ...return ret;.#
    │ │ │ +00065fa0: 656e 6469 660a 097d 0a0a 0973 6372 6170  endif..}...scrap
    │ │ │ +00065fb0: 655f 6661 696c 6564 5f61 6c65 7274 3a3a  e_failed_alert::
    │ │ │ +00065fc0: 7363 7261 7065 5f66 6169 6c65 645f 616c  scrape_failed_al
    │ │ │ +00065fd0: 6572 7428 6175 783a 3a73 7461 636b 5f61  ert(aux::stack_a
    │ │ │ +00065fe0: 6c6c 6f63 6174 6f72 2661 6d70 3b20 616c  llocator& al
    │ │ │ +00065ff0: 6c6f 630a 0909 2c20 746f 7272 656e 745f  loc..., torrent_
    │ │ │ +00066000: 6861 6e64 6c65 2063 6f6e 7374 2661 6d70  handle const&
    │ │ │ +00066010: 3b20 682c 2074 6370 3a3a 656e 6470 6f69  ; h, tcp::endpoi
    │ │ │ +00066020: 6e74 2063 6f6e 7374 2661 6d70 3b20 6570  nt const& ep
    │ │ │ +00066030: 0a09 092c 2073 7472 696e 675f 7669 6577  ..., string_view
    │ │ │ +00066040: 2075 2c20 7072 6f74 6f63 6f6c 5f76 6572   u, protocol_ver
    │ │ │ +00066050: 7369 6f6e 2063 6f6e 7374 2076 2c20 6572  sion const v, er
    │ │ │ +00066060: 726f 725f 636f 6465 2063 6f6e 7374 2661  ror_code const&a
    │ │ │ +00066070: 6d70 3b20 6529 0a09 093a 2074 7261 636b  mp; e)...: track
    │ │ │ +00066080: 6572 5f61 6c65 7274 2861 6c6c 6f63 2c20  er_alert(alloc, 
    │ │ │ +00066090: 682c 2065 702c 2075 290a 0909 2c20 6572  h, ep, u)..., er
    │ │ │ +000660a0: 726f 7228 6529 0a09 092c 206d 5f6d 7367  ror(e)..., m_msg
    │ │ │ +000660b0: 5f69 6478 2829 0a23 6966 2054 4f52 5245  _idx().#if TORRE
    │ │ │ +000660c0: 4e54 5f41 4249 5f56 4552 5349 4f4e 203d  NT_ABI_VERSION =
    │ │ │ +000660d0: 3d20 310a 0909 2c20 6d73 6728 636f 6e76  = 1..., msg(conv
    │ │ │ +000660e0: 6572 745f 6672 6f6d 5f6e 6174 6976 6528  ert_from_native(
    │ │ │ +000660f0: 652e 6d65 7373 6167 6528 2929 290a 2365  e.message())).#e
    │ │ │ +00066100: 6e64 6966 0a3c 2f70 7265 3e3c 2f74 643e  ndif.
    │ │ │ +00066110: 3c2f 7472 3e3c 7472 2073 7479 6c65 3d22 relevance& │ │ │ +00066140: 6e62 7370 3b30 3c2f 7464 3e3c 7464 3e3c nbsp;0< │ │ │ +00066150: 6120 6872 6566 3d22 6a61 7661 7363 7269 a href="javascri │ │ │ +00066160: 7074 3a65 7870 616e 6428 3233 3529 223e pt:expand(235)"> │ │ │ +00066170: 2e2e 2f73 7263 2f61 6c65 7274 2e63 7070 ../src/alert.cpp │ │ │ +00066180: 3a34 3736 3c2f 613e 3c2f 7464 3e3c 7464 :476
    move this into │ │ │ +000661a0: 7472 6163 6b65 725f 616c 6572 743c 2f74 tracker_alert

    move │ │ │ +00066200: 7468 6973 2069 6e74 6f20 7472 6163 6b65 this into tracke │ │ │ +00066210: 725f 616c 6572 743c 2f68 323e 3c68 343e r_alert

    │ │ │ +00066220: 2e2e 2f73 7263 2f61 6c65 7274 2e63 7070 ../src/alert.cpp │ │ │ +00066230: 3a34 3736 3c2f 6834 3e3c 7072 6520 7374 :476

    ..return {};.
    │ │ │ +00066280: 2365 6c73 650a 0909 6368 6172 2072 6574  #else...char ret
    │ │ │ +00066290: 5b34 3030 5d3b 0a09 0973 7464 3a3a 736e  [400];...std::sn
    │ │ │ +000662a0: 7072 696e 7466 2872 6574 2c20 7369 7a65  printf(ret, size
    │ │ │ +000662b0: 6f66 2872 6574 292c 2022 2573 2025 7320  of(ret), "%s %s 
    │ │ │ +000662c0: 7363 7261 7065 2072 6570 6c79 3a20 2564  scrape reply: %d
    │ │ │ +000662d0: 2025 6422 0a09 0909 2c20 7472 6163 6b65   %d"...., tracke
    │ │ │ +000662e0: 725f 616c 6572 743a 3a6d 6573 7361 6765  r_alert::message
    │ │ │ +000662f0: 2829 2e63 5f73 7472 2829 0a09 0909 2c20  ().c_str()...., 
    │ │ │ +00066300: 7665 7273 696f 6e20 3d3d 2070 726f 746f  version == proto
    │ │ │ +00066310: 636f 6c5f 7665 7273 696f 6e3a 3a56 3120  col_version::V1 
    │ │ │ +00066320: 3f20 2276 3122 203a 2022 7632 220a 0909  ? "v1" : "v2"...
    │ │ │ +00066330: 092c 2069 6e63 6f6d 706c 6574 652c 2063  ., incomplete, c
    │ │ │ +00066340: 6f6d 706c 6574 6529 3b0a 0909 7265 7475  omplete);...retu
    │ │ │ +00066350: 726e 2072 6574 3b0a 2365 6e64 6966 0a09  rn ret;.#endif..
    │ │ │ +00066360: 7d0a 0a09 7363 7261 7065 5f66 6169 6c65  }...scrape_faile
    │ │ │ +00066370: 645f 616c 6572 743a 3a73 6372 6170 655f  d_alert::scrape_
    │ │ │ +00066380: 6661 696c 6564 5f61 6c65 7274 2861 7578  failed_alert(aux
    │ │ │ +00066390: 3a3a 7374 6163 6b5f 616c 6c6f 6361 746f  ::stack_allocato
    │ │ │ +000663a0: 7226 616d 703b 2061 6c6c 6f63 0a09 092c  r& alloc...,
    │ │ │ +000663b0: 2074 6f72 7265 6e74 5f68 616e 646c 6520   torrent_handle 
    │ │ │ +000663c0: 636f 6e73 7426 616d 703b 2068 2c20 7463  const& h, tc
    │ │ │ +000663d0: 703a 3a65 6e64 706f 696e 7420 636f 6e73  p::endpoint cons
    │ │ │ +000663e0: 7426 616d 703b 2065 700a 0909 2c20 7374  t& ep..., st
    │ │ │ +000663f0: 7269 6e67 5f76 6965 7720 752c 2070 726f  ring_view u, pro
    │ │ │ +00066400: 746f 636f 6c5f 7665 7273 696f 6e20 636f  tocol_version co
    │ │ │ +00066410: 6e73 7420 762c 2065 7272 6f72 5f63 6f64  nst v, error_cod
    │ │ │ +00066420: 6520 636f 6e73 7426 616d 703b 2065 290a  e const& e).
    │ │ │ +00066430: 0909 3a20 7472 6163 6b65 725f 616c 6572  ..: tracker_aler
    │ │ │ +00066440: 7428 616c 6c6f 632c 2068 2c20 6570 2c20  t(alloc, h, ep, 
    │ │ │ +00066450: 7529 0a09 092c 2065 7272 6f72 2865 290a  u)..., error(e).
    │ │ │ +00066460: 0909 2c20 6d5f 6d73 675f 6964 7828 290a  .., m_msg_idx().
    │ │ │ +00066470: 2369 6620 544f 5252 454e 545f 4142 495f  #if TORRENT_ABI_
    │ │ │ +00066480: 5645 5253 494f 4e20 3d3d 2031 0a09 092c  VERSION == 1...,
    │ │ │ +00066490: 206d 7367 2863 6f6e 7665 7274 5f66 726f   msg(convert_fro
    │ │ │ +000664a0: 6d5f 6e61 7469 7665 2865 2e6d 6573 7361  m_native(e.messa
    │ │ │ +000664b0: 6765 2829 2929 0a23 656e 6469 660a 3c64  ge())).#endif..., 
    │ │ │ +000664f0: 7665 7273 696f 6e28 7629 0a3c 2f64 6976  version(v)..{...TORRENT_AS
    │ │ │ +00066510: 5345 5254 2821 752e 656d 7074 7928 2929  SERT(!u.empty())
    │ │ │ +00066520: 3b0a 097d 0a0a 0973 6372 6170 655f 6661  ;..}...scrape_fa
    │ │ │ +00066530: 696c 6564 5f61 6c65 7274 3a3a 7363 7261  iled_alert::scra
    │ │ │ +00066540: 7065 5f66 6169 6c65 645f 616c 6572 7428  pe_failed_alert(
    │ │ │ +00066550: 6175 783a 3a73 7461 636b 5f61 6c6c 6f63  aux::stack_alloc
    │ │ │ +00066560: 6174 6f72 2661 6d70 3b20 616c 6c6f 630a  ator& alloc.
    │ │ │ +00066570: 0909 2c20 746f 7272 656e 745f 6861 6e64  .., torrent_hand
    │ │ │ +00066580: 6c65 2063 6f6e 7374 2661 6d70 3b20 682c  le const& h,
    │ │ │ +00066590: 2074 6370 3a3a 656e 6470 6f69 6e74 2063   tcp::endpoint c
    │ │ │ +000665a0: 6f6e 7374 2661 6d70 3b20 6570 0a09 092c  onst& ep...,
    │ │ │ +000665b0: 2073 7472 696e 675f 7669 6577 2075 2c20   string_view u, 
    │ │ │ +000665c0: 7374 7269 6e67 5f76 6965 7720 6d29 0a09  string_view m)..
    │ │ │ +000665d0: 093a 2074 7261 636b 6572 5f61 6c65 7274  .: tracker_alert
    │ │ │ +000665e0: 2861 6c6c 6f63 2c20 682c 2065 702c 2075  (alloc, h, ep, u
    │ │ │ +000665f0: 290a 0909 2c20 6572 726f 7228 6572 726f  )..., error(erro
    │ │ │ +00066600: 7273 3a3a 7472 6163 6b65 725f 6661 696c  rs::tracker_fail
    │ │ │ +00066610: 7572 6529 0a09 092c 206d 5f6d 7367 5f69  ure)..., m_msg_i
    │ │ │ +00066620: 6478 2861 6c6c 6f63 2e63 6f70 795f 7374  dx(alloc.copy_st
    │ │ │ +00066630: 7269 6e67 286d 2929 0a23 6966 2054 4f52  ring(m)).#if TOR
    │ │ │ +00066640: 5245 4e54 5f41 4249 5f56 4552 5349 4f4e  RENT_ABI_VERSION
    │ │ │ +00066650: 203d 3d20 310a 0909 2c20 6d73 6728 6d29   == 1..., msg(m)
    │ │ │ +00066660: 0a23 656e 6469 660a 097b 0a09 0954 4f52  .#endif..{...TOR
    │ │ │ +00066670: 5245 4e54 5f41 5353 4552 5428 2175 2e65  RENT_ASSERT(!u.e
    │ │ │ +00066680: 6d70 7479 2829 293b 0a09 7d0a 0a09 6368  mpty());..}...ch
    │ │ │ +00066690: 6172 2063 6f6e 7374 2a20 7363 7261 7065  ar const* scrape
    │ │ │ +000666a0: 5f66 6169 6c65 645f 616c 6572 743a 3a65  _failed_alert::e
    │ │ │ +000666b0: 7272 6f72 5f6d 6573 7361 6765 2829 2063  rror_message() c
    │ │ │ +000666c0: 6f6e 7374 0a09 7b0a 0909 6966 2028 6d5f  onst..{...if (m_
    │ │ │ +000666d0: 6d73 675f 6964 7820 3d3d 2061 7578 3a3a  msg_idx == aux::
    │ │ │ +000666e0: 616c 6c6f 6361 7469 6f6e 5f73 6c6f 7428  allocation_slot(
    │ │ │ +000666f0: 2929 2072 6574 7572 6e20 2222 3b0a 0909  )) return "";...
    │ │ │ +00066700: 656c 7365 2072 6574 7572 6e20 6d5f 616c  else return m_al
    │ │ │ +00066710: 6c6f 632e 6765 7428 292e 7074 7228 6d5f  loc.get().ptr(m_
    │ │ │ +00066720: 6d73 675f 6964 7829 3b0a 097d 0a0a 0973  msg_idx);..}...s
    │ │ │ +00066730: 7464 3a3a 7374 7269 6e67 2073 6372 6170  td::string scrap
    │ │ │ +00066740: 655f 6661 696c 6564 5f61 6c65 7274 3a3a  e_failed_alert::
    │ │ │ +00066750: 6d65 7373 6167 6528 2920 636f 6e73 740a  message() const.
    │ │ │ +00066760: 097b 0a23 6966 6465 6620 544f 5252 454e  .{.#ifdef TORREN
    │ │ │ +00066770: 545f 4449 5341 424c 455f 414c 4552 545f  T_DISABLE_ALERT_
    │ │ │ +00066780: 4d53 470a 0909 7265 7475 726e 207b 7d3b  MSG...return {};
    │ │ │ +00066790: 0a23 656c 7365 0a09 0972 6574 7572 6e20  .#else...return 
    │ │ │ +000667a0: 7472 6163 6b65 725f 616c 6572 743a 3a6d  tracker_alert::m
    │ │ │ +000667b0: 6573 7361 6765 2829 202b 2022 2073 6372  essage() + " scr
    │ │ │ +000667c0: 6170 6520 6661 696c 6564 3a20 2220 2b20  ape failed: " + 
    │ │ │ +000667d0: 6572 726f 725f 6d65 7373 6167 6528 293b  error_message();
    │ │ │ +000667e0: 0a23 656e 6469 660a 3c2f 7072 653e 3c2f  .#endif.
    relevan │ │ │ +00066820: 6365 266e 6273 703b 303c 2f74 643e 3c74 ce 0../src/alert. │ │ │ +00066860: 6370 703a 3531 353c 2f61 3e3c 2f74 643e cpp:515 │ │ │ +00066870: 3c74 643e 6d6f 7665 2074 6869 7320 6669 move this fi │ │ │ +00066880: 656c 6420 696e 746f 2074 7261 636b 6572 eld into tracker │ │ │ +00066890: 5f61 6c65 7274 3c2f 7464 3e3c 2f74 723e _alert │ │ │ +000668a0: 3c74 7220 6964 3d22 3233 3622 2073 7479 │ │ │ +000668d0: 3c74 6420 636f 6c73 7061 6e3d 2233 223e │ │ │ +000668e0: 3c68 323e 6d6f 7665 2074 6869 7320 6669

    move this fi │ │ │ +000668f0: 656c 6420 696e 746f 2074 7261 636b 6572 eld into tracker │ │ │ +00066900: 5f61 6c65 7274 3c2f 6832 3e3c 6834 3e2e _alert

    . │ │ │ +00066910: 2e2f 7372 632f 616c 6572 742e 6370 703a ./src/alert.cpp: │ │ │ +00066920: 3531 353c 2f68 343e 3c70 7265 2073 7479 515

    .char const* s
    │ │ │ +00066970: 6372 6170 655f 6661 696c 6564 5f61 6c65  crape_failed_ale
    │ │ │ +00066980: 7274 3a3a 6572 726f 725f 6d65 7373 6167  rt::error_messag
    │ │ │ +00066990: 6528 2920 636f 6e73 740a 097b 0a09 0969  e() const..{...i
    │ │ │ +000669a0: 6620 286d 5f6d 7367 5f69 6478 203d 3d20  f (m_msg_idx == 
    │ │ │ +000669b0: 6175 783a 3a61 6c6c 6f63 6174 696f 6e5f  aux::allocation_
    │ │ │ +000669c0: 736c 6f74 2829 2920 7265 7475 726e 2022  slot()) return "
    │ │ │ +000669d0: 223b 0a09 0965 6c73 6520 7265 7475 726e  ";...else return
    │ │ │ +000669e0: 206d 5f61 6c6c 6f63 2e67 6574 2829 2e70   m_alloc.get().p
    │ │ │ +000669f0: 7472 286d 5f6d 7367 5f69 6478 293b 0a09  tr(m_msg_idx);..
    │ │ │ +00066a00: 7d0a 0a09 7374 643a 3a73 7472 696e 6720  }...std::string 
    │ │ │ +00066a10: 7363 7261 7065 5f66 6169 6c65 645f 616c  scrape_failed_al
    │ │ │ +00066a20: 6572 743a 3a6d 6573 7361 6765 2829 2063  ert::message() c
    │ │ │ +00066a30: 6f6e 7374 0a09 7b0a 2369 6664 6566 2054  onst..{.#ifdef T
    │ │ │ +00066a40: 4f52 5245 4e54 5f44 4953 4142 4c45 5f41  ORRENT_DISABLE_A
    │ │ │ +00066a50: 4c45 5254 5f4d 5347 0a09 0972 6574 7572  LERT_MSG...retur
    │ │ │ +00066a60: 6e20 7b7d 3b0a 2365 6c73 650a 0909 7265  n {};.#else...re
    │ │ │ +00066a70: 7475 726e 2074 7261 636b 6572 5f61 6c65  turn tracker_ale
    │ │ │ +00066a80: 7274 3a3a 6d65 7373 6167 6528 2920 2b20  rt::message() + 
    │ │ │ +00066a90: 2220 7363 7261 7065 2066 6169 6c65 643a  " scrape failed:
    │ │ │ +00066aa0: 2022 202b 2065 7272 6f72 5f6d 6573 7361   " + error_messa
    │ │ │ +00066ab0: 6765 2829 3b0a 2365 6e64 6966 0a09 7d0a  ge();.#endif..}.
    │ │ │ +00066ac0: 0a09 7472 6163 6b65 725f 7265 706c 795f  ..tracker_reply_
    │ │ │ +00066ad0: 616c 6572 743a 3a74 7261 636b 6572 5f72  alert::tracker_r
    │ │ │ +00066ae0: 6570 6c79 5f61 6c65 7274 2861 7578 3a3a  eply_alert(aux::
    │ │ │ +00066af0: 7374 6163 6b5f 616c 6c6f 6361 746f 7226  stack_allocator&
    │ │ │ +00066b00: 616d 703b 2061 6c6c 6f63 0a09 092c 2074  amp; alloc..., t
    │ │ │ +00066b10: 6f72 7265 6e74 5f68 616e 646c 6520 636f  orrent_handle co
    │ │ │ +00066b20: 6e73 7426 616d 703b 2068 2c20 7463 703a  nst& h, tcp:
    │ │ │ +00066b30: 3a65 6e64 706f 696e 7420 636f 6e73 7426  :endpoint const&
    │ │ │ +00066b40: 616d 703b 2065 700a 0909 2c20 696e 7420  amp; ep..., int 
    │ │ │ +00066b50: 6e70 2c20 7072 6f74 6f63 6f6c 5f76 6572  np, protocol_ver
    │ │ │ +00066b60: 7369 6f6e 2076 2c20 7374 7269 6e67 5f76  sion v, string_v
    │ │ │ +00066b70: 6965 7720 7529 0a09 093a 2074 7261 636b  iew u)...: track
    │ │ │ +00066b80: 6572 5f61 6c65 7274 2861 6c6c 6f63 2c20  er_alert(alloc, 
    │ │ │ +00066b90: 682c 2065 702c 2075 290a 0909 2c20 6e75  h, ep, u)..., nu
    │ │ │ +00066ba0: 6d5f 7065 6572 7328 6e70 290a 3c64 6976  m_peers(np).
    .., ve │ │ │ +00066be0: 7273 696f 6e28 7629 0a3c 2f64 6976 3e09 rsion(v).
    . │ │ │ +00066bf0: 7b0a 0909 544f 5252 454e 545f 4153 5345 {...TORRENT_ASSE │ │ │ +00066c00: 5254 2821 752e 656d 7074 7928 2929 3b0a RT(!u.empty());. │ │ │ +00066c10: 097d 0a0a 0973 7464 3a3a 7374 7269 6e67 .}...std::string │ │ │ +00066c20: 2074 7261 636b 6572 5f72 6570 6c79 5f61 tracker_reply_a │ │ │ +00066c30: 6c65 7274 3a3a 6d65 7373 6167 6528 2920 lert::message() │ │ │ +00066c40: 636f 6e73 740a 097b 0a23 6966 6465 6620 const..{.#ifdef │ │ │ +00066c50: 544f 5252 454e 545f 4449 5341 424c 455f TORRENT_DISABLE_ │ │ │ +00066c60: 414c 4552 545f 4d53 470a 0909 7265 7475 ALERT_MSG...retu │ │ │ +00066c70: 726e 207b 7d3b 0a23 656c 7365 0a09 0963 rn {};.#else...c │ │ │ +00066c80: 6861 7220 7265 745b 3430 305d 3b0a 0909 har ret[400];... │ │ │ +00066c90: 7374 643a 3a73 6e70 7269 6e74 6628 7265 std::snprintf(re │ │ │ +00066ca0: 742c 2073 697a 656f 6628 7265 7429 2c20 t, sizeof(ret), │ │ │ +00066cb0: 2225 7320 2573 2072 6563 6569 7665 6420 "%s %s received │ │ │ +00066cc0: 7065 6572 733a 2025 6422 0a09 0909 2c20 peers: %d"...., │ │ │ +00066cd0: 7472 6163 6b65 725f 616c 6572 743a 3a6d tracker_alert::m │ │ │ +00066ce0: 6573 7361 6765 2829 2e63 5f73 7472 2829 essage().c_str() │ │ │ +00066cf0: 0a09 0909 2c20 7665 7273 696f 6e20 3d3d ...., version == │ │ │ +00066d00: 2070 726f 746f 636f 6c5f 7665 7273 696f protocol_versio │ │ │ +00066d10: 6e3a 3a56 3120 3f20 2276 3122 203a 2022 n::V1 ? "v1" : " │ │ │ +00066d20: 7632 220a 0909 092c 206e 756d 5f70 6565 v2"...., num_pee │ │ │ +00066d30: 7273 293b 0a09 0972 6574 7572 6e20 7265 rs);...return re │ │ │ +00066d40: 743b 0a23 656e 6469 660a 097d 0a0a 0964 t;.#endif..}...d │ │ │ +00066d50: 6874 5f72 6570 6c79 5f61 6c65 7274 3a3a ht_reply_alert:: │ │ │ +00066d60: 6468 745f 7265 706c 795f 616c 6572 7428 dht_reply_alert( │ │ │ +00066d70: 6175 783a 3a73 7461 636b 5f61 6c6c 6f63 aux::stack_alloc │ │ │ +00066d80: 6174 6f72 2661 6d70 3b20 616c 6c6f 630a ator& alloc. │ │ │ +00066d90: 0909 2c20 746f 7272 656e 745f 6861 6e64 .., torrent_hand │ │ │ +00066da0: 6c65 2063 6f6e 7374 2661 6d70 3b20 680a le const& h. │ │ │ +00066db0: 0909 2c20 696e 7420 6e70 290a 0909 3a20 .., int np)...: │ │ │ +00066dc0: 7472 6163 6b65 725f 616c 6572 7428 616c tracker_alert(al │ │ │ +00066dd0: 6c6f 632c 2068 2c20 7b7d 2c20 2222 290a loc, h, {}, ""). │ │ │ +00066de0: 0909 2c20 6e75 6d5f 7065 6572 7328 6e70 .., num_peers(np │ │ │ +00066df0: 290a 097b 7d0a 0a09 7374 643a 3a73 7472 )..{}...std::str │ │ │ +00066e00: 696e 6720 6468 745f 7265 706c 795f 616c ing dht_reply_al │ │ │ +00066e10: 6572 743a 3a6d 6573 7361 6765 2829 2063 ert::message() c │ │ │ +00066e20: 6f6e 7374 0a09 7b0a 2369 6664 6566 2054 onst..{.#ifdef T │ │ │ +00066e30: 4f52 5245 4e54 5f44 4953 4142 4c45 5f41 ORRENT_DISABLE_A │ │ │ +00066e40: 4c45 5254 5f4d 5347 0a09 0972 6574 7572 LERT_MSG...retur │ │ │ +00066e50: 6e20 7b7d 3b0a 2365 6c73 650a 3c2f 7072 n {};.#else.rel │ │ │ +00066e90: 6576 616e 6365 266e 6273 703b 303c 2f74 evance 0../src/al │ │ │ +00066ed0: 6572 742e 6370 703a 3535 393c 2f61 3e3c ert.cpp:559< │ │ │ +00066ee0: 2f74 643e 3c74 643e 6d6f 7665 2074 6869 /td>move thi │ │ │ +00066ef0: 7320 746f 2074 7261 636b 6572 5f61 6c65 s to tracker_ale │ │ │ +00066f00: 7274 3c2f 7464 3e3c 2f74 723e 3c74 7220 rt

    │ │ │ +00066f50: 6d6f 7665 2074 6869 7320 746f 2074 7261 move this to tra │ │ │ +00066f60: 636b 6572 5f61 6c65 7274 3c2f 6832 3e3c cker_alert

    < │ │ │ +00066f70: 6834 3e2e 2e2f 7372 632f 616c 6572 742e h4>../src/alert. │ │ │ +00066f80: 6370 703a 3535 393c 2f68 343e 3c70 7265 cpp:559
    .., num_pe
    │ │ │ +00066fd0: 6572 7328 6e70 290a 097b 7d0a 0a09 7374  ers(np)..{}...st
    │ │ │ +00066fe0: 643a 3a73 7472 696e 6720 6468 745f 7265  d::string dht_re
    │ │ │ +00066ff0: 706c 795f 616c 6572 743a 3a6d 6573 7361  ply_alert::messa
    │ │ │ +00067000: 6765 2829 2063 6f6e 7374 0a09 7b0a 2369  ge() const..{.#i
    │ │ │ +00067010: 6664 6566 2054 4f52 5245 4e54 5f44 4953  fdef TORRENT_DIS
    │ │ │ +00067020: 4142 4c45 5f41 4c45 5254 5f4d 5347 0a09  ABLE_ALERT_MSG..
    │ │ │ +00067030: 0972 6574 7572 6e20 7b7d 3b0a 2365 6c73  .return {};.#els
    │ │ │ +00067040: 650a 0909 6368 6172 2072 6574 5b34 3030  e...char ret[400
    │ │ │ +00067050: 5d3b 0a09 0973 7464 3a3a 736e 7072 696e  ];...std::snprin
    │ │ │ +00067060: 7466 2872 6574 2c20 7369 7a65 6f66 2872  tf(ret, sizeof(r
    │ │ │ +00067070: 6574 292c 2022 2573 2072 6563 6569 7665  et), "%s receive
    │ │ │ +00067080: 6420 4448 5420 7065 6572 733a 2025 6422  d DHT peers: %d"
    │ │ │ +00067090: 0a09 0909 2c20 7472 6163 6b65 725f 616c  ...., tracker_al
    │ │ │ +000670a0: 6572 743a 3a6d 6573 7361 6765 2829 2e63  ert::message().c
    │ │ │ +000670b0: 5f73 7472 2829 2c20 6e75 6d5f 7065 6572  _str(), num_peer
    │ │ │ +000670c0: 7329 3b0a 0909 7265 7475 726e 2072 6574  s);...return ret
    │ │ │ +000670d0: 3b0a 2365 6e64 6966 0a09 7d0a 0a09 7472  ;.#endif..}...tr
    │ │ │ +000670e0: 6163 6b65 725f 616e 6e6f 756e 6365 5f61  acker_announce_a
    │ │ │ +000670f0: 6c65 7274 3a3a 7472 6163 6b65 725f 616e  lert::tracker_an
    │ │ │ +00067100: 6e6f 756e 6365 5f61 6c65 7274 2861 7578  nounce_alert(aux
    │ │ │ +00067110: 3a3a 7374 6163 6b5f 616c 6c6f 6361 746f  ::stack_allocato
    │ │ │ +00067120: 7226 616d 703b 2061 6c6c 6f63 0a09 092c  r& alloc...,
    │ │ │ +00067130: 2074 6f72 7265 6e74 5f68 616e 646c 6520   torrent_handle 
    │ │ │ +00067140: 636f 6e73 7426 616d 703b 2068 2c20 7463  const& h, tc
    │ │ │ +00067150: 703a 3a65 6e64 706f 696e 7420 636f 6e73  p::endpoint cons
    │ │ │ +00067160: 7426 616d 703b 2065 702c 2073 7472 696e  t& ep, strin
    │ │ │ +00067170: 675f 7669 6577 2075 0a09 092c 2070 726f  g_view u..., pro
    │ │ │ +00067180: 746f 636f 6c5f 7665 7273 696f 6e20 636f  tocol_version co
    │ │ │ +00067190: 6e73 7420 762c 2065 7665 6e74 5f74 2063  nst v, event_t c
    │ │ │ +000671a0: 6f6e 7374 2065 290a 0909 3a20 7472 6163  onst e)...: trac
    │ │ │ +000671b0: 6b65 725f 616c 6572 7428 616c 6c6f 632c  ker_alert(alloc,
    │ │ │ +000671c0: 2068 2c20 6570 2c20 7529 0a09 092c 2065   h, ep, u)..., e
    │ │ │ +000671d0: 7665 6e74 2865 290a 3c64 6976 2073 7479  vent(e).
    .., versio │ │ │ +00067210: 6e28 7629 0a3c 2f64 6976 3e09 7b0a 0909 n(v).
    .{... │ │ │ +00067220: 544f 5252 454e 545f 4153 5345 5254 2821 TORRENT_ASSERT(! │ │ │ +00067230: 752e 656d 7074 7928 2929 3b0a 097d 0a0a u.empty());..}.. │ │ │ +00067240: 0973 7464 3a3a 7374 7269 6e67 2074 7261 .std::string tra │ │ │ +00067250: 636b 6572 5f61 6e6e 6f75 6e63 655f 616c cker_announce_al │ │ │ +00067260: 6572 743a 3a6d 6573 7361 6765 2829 2063 ert::message() c │ │ │ +00067270: 6f6e 7374 0a09 7b0a 2369 6664 6566 2054 onst..{.#ifdef T │ │ │ +00067280: 4f52 5245 4e54 5f44 4953 4142 4c45 5f41 ORRENT_DISABLE_A │ │ │ +00067290: 4c45 5254 5f4d 5347 0a09 0972 6574 7572 LERT_MSG...retur │ │ │ +000672a0: 6e20 7b7d 3b0a 2365 6c73 650a 0909 7374 n {};.#else...st │ │ │ +000672b0: 6174 6963 2063 6f6e 7374 2063 6861 722a atic const char* │ │ │ +000672c0: 2063 6f6e 7374 2065 7665 6e74 5f73 7472 const event_str │ │ │ +000672d0: 5b5d 203d 207b 226e 6f6e 6522 2c20 2263 [] = {"none", "c │ │ │ +000672e0: 6f6d 706c 6574 6564 222c 2022 7374 6172 ompleted", "star │ │ │ +000672f0: 7465 6422 2c20 2273 746f 7070 6564 222c ted", "stopped", │ │ │ +00067300: 2022 7061 7573 6564 227d 3b0a 0909 7265 "paused"};...re │ │ │ +00067310: 7475 726e 2074 7261 636b 6572 5f61 6c65 turn tracker_ale │ │ │ +00067320: 7274 3a3a 6d65 7373 6167 6528 290a 0909 rt::message()... │ │ │ +00067330: 092b 2028 7665 7273 696f 6e20 3d3d 2070 .+ (version == p │ │ │ +00067340: 726f 746f 636f 6c5f 7665 7273 696f 6e3a rotocol_version: │ │ │ +00067350: 3a56 3120 3f20 2220 7631 2220 3a20 2220 :V1 ? " v1" : " │ │ │ +00067360: 7632 2229 0a09 0909 2b20 2220 7365 6e64 v2")....+ " send │ │ │ +00067370: 696e 6720 616e 6e6f 756e 6365 2028 2220 ing announce (" │ │ │ +00067380: 2b20 6576 656e 745f 7374 725b 7374 6174 + event_str[stat │ │ │ +00067390: 6963 5f63 6173 7426 6c74 3b69 6e74 2667 ic_cast<int&g │ │ │ +000673a0: 743b 2865 7665 6e74 295d 202b 2022 2922 t;(event)] + ")" │ │ │ +000673b0: 3b0a 2365 6e64 6966 0a09 7d0a 0a09 6861 ;.#endif..}...ha │ │ │ +000673c0: 7368 5f66 6169 6c65 645f 616c 6572 743a sh_failed_alert: │ │ │ +000673d0: 3a68 6173 685f 6661 696c 6564 5f61 6c65 :hash_failed_ale │ │ │ +000673e0: 7274 280a 0909 6175 783a 3a73 7461 636b rt(...aux::stack │ │ │ +000673f0: 5f61 6c6c 6f63 6174 6f72 2661 6d70 3b20 _allocator& │ │ │ +00067400: 616c 6c6f 630a 0909 2c20 746f 7272 656e alloc..., torren │ │ │ +00067410: 745f 6861 6e64 6c65 2063 6f6e 7374 2661 t_handle const&a │ │ │ +00067420: 6d70 3b20 680a 0909 2c20 7069 6563 655f mp; h..., piece_ │ │ │ +00067430: 696e 6465 785f 7420 696e 6465 7829 0a09 index_t index).. │ │ │ +00067440: 093a 2074 6f72 7265 6e74 5f61 6c65 7274 .: torrent_alert │ │ │ +00067450: 2861 6c6c 6f63 2c20 6829 0a09 092c 2070 (alloc, h)..., p │ │ │ +00067460: 6965 6365 5f69 6e64 6578 2869 6e64 6578 iece_index(index │ │ │ +00067470: 290a 097b 0a09 0954 4f52 5245 4e54 5f41 )..{...TORRENT_A │ │ │ +00067480: 5353 4552 5428 696e 6465 7820 2667 743b SSERT(index > │ │ │ +00067490: 3d20 7069 6563 655f 696e 6465 785f 7428 = piece_index_t( │ │ │ +000674a0: 3029 293b 0a09 7d0a 0a09 7374 643a 3a73 0));..}...std::s │ │ │ +000674b0: 7472 696e 6720 6861 7368 5f66 6169 6c65 tring hash_faile │ │ │ +000674c0: 645f 616c 6572 743a 3a6d 6573 7361 6765 d_alert::message │ │ │ +000674d0: 2829 2063 6f6e 7374 0a09 7b0a 2369 6664 () const..{.#ifd │ │ │ +000674e0: 6566 2054 4f52 5245 4e54 5f44 4953 4142 ef TORRENT_DISAB │ │ │ +000674f0: 4c45 5f41 4c45 5254 5f4d 5347 0a09 0972 LE_ALERT_MSG...r │ │ │ +00067500: 6574 7572 6e20 7b7d 3b0a 3c2f 7072 653e eturn {};.
    │ │ │ +00067510: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ +00067540: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ +00067550: 3c74 643e 3c61 2068 7265 663d 226a 6176 ../src/file │ │ │ +00067580: 5f73 746f 7261 6765 2e63 7070 3a34 3538 _storage.cpp:458 │ │ │ +00067590: 3c2f 613e 3c2f 7464 3e3c 7464 3e6d 6179 may │ │ │ +000675a0: 6265 2069 7420 776f 756c 6420 6265 206e be it would be n │ │ │ +000675b0: 6963 6520 746f 2068 6176 6520 6120 6265 ice to have a be │ │ │ +000675c0: 7474 6572 2069 6e64 6578 2068 6572 653c tter index here< │ │ │ +000675d0: 2f74 643e 3c2f 7472 3e3c 7472 2069 643d /td>

    may │ │ │ +00067620: 6265 2069 7420 776f 756c 6420 6265 206e be it would be n │ │ │ +00067630: 6963 6520 746f 2068 6176 6520 6120 6265 ice to have a be │ │ │ +00067640: 7474 6572 2069 6e64 6578 2068 6572 653c tter index here< │ │ │ +00067650: 2f68 323e 3c68 343e 2e2e 2f73 7263 2f66 /h2>

    ../src/f │ │ │ +00067660: 696c 655f 7374 6f72 6167 652e 6370 703a ile_storage.cpp: │ │ │ +00067670: 3435 383c 2f68 343e 3c70 7265 2073 7479 458

    ..// find the 
    │ │ │ +000676c0: 6669 6c65 2069 7465 7261 746f 7220 616e  file iterator an
    │ │ │ +000676d0: 6420 6669 6c65 206f 6666 7365 740a 0909  d file offset...
    │ │ │ +000676e0: 6175 783a 3a66 696c 655f 656e 7472 7920  aux::file_entry 
    │ │ │ +000676f0: 7461 7267 6574 3b0a 0909 7461 7267 6574  target;...target
    │ │ │ +00067700: 2e6f 6666 7365 7420 3d20 6175 783a 3a6e  .offset = aux::n
    │ │ │ +00067710: 756d 6572 6963 5f63 6173 7426 6c74 3b73  umeric_cast<s
    │ │ │ +00067720: 7464 3a3a 7569 6e74 3634 5f74 2667 743b  td::uint64_t>
    │ │ │ +00067730: 286f 6666 7365 7429 3b0a 0909 544f 5252  (offset);...TORR
    │ │ │ +00067740: 454e 545f 4153 5345 5254 2821 636f 6d70  ENT_ASSERT(!comp
    │ │ │ +00067750: 6172 655f 6669 6c65 5f6f 6666 7365 7428  are_file_offset(
    │ │ │ +00067760: 7461 7267 6574 2c20 6d5f 6669 6c65 732e  target, m_files.
    │ │ │ +00067770: 6672 6f6e 7428 2929 293b 0a0a 0909 6175  front()));....au
    │ │ │ +00067780: 746f 2066 696c 655f 6974 6572 203d 2073  to file_iter = s
    │ │ │ +00067790: 7464 3a3a 7570 7065 725f 626f 756e 6428  td::upper_bound(
    │ │ │ +000677a0: 0a09 0909 6d5f 6669 6c65 732e 6265 6769  ....m_files.begi
    │ │ │ +000677b0: 6e28 292c 206d 5f66 696c 6573 2e65 6e64  n(), m_files.end
    │ │ │ +000677c0: 2829 2c20 7461 7267 6574 2c20 636f 6d70  (), target, comp
    │ │ │ +000677d0: 6172 655f 6669 6c65 5f6f 6666 7365 7429  are_file_offset)
    │ │ │ +000677e0: 3b0a 0a09 0954 4f52 5245 4e54 5f41 5353  ;....TORRENT_ASS
    │ │ │ +000677f0: 4552 5428 6669 6c65 5f69 7465 7220 213d  ERT(file_iter !=
    │ │ │ +00067800: 206d 5f66 696c 6573 2e62 6567 696e 2829   m_files.begin()
    │ │ │ +00067810: 293b 0a09 092d 2d66 696c 655f 6974 6572  );...--file_iter
    │ │ │ +00067820: 3b0a 0909 7265 7475 726e 2066 696c 655f  ;...return file_
    │ │ │ +00067830: 696e 6465 785f 747b 696e 7428 6669 6c65  index_t{int(file
    │ │ │ +00067840: 5f69 7465 7220 2d20 6d5f 6669 6c65 732e  _iter - m_files.
    │ │ │ +00067850: 6265 6769 6e28 2929 7d3b 0a09 7d0a 0a09  begin())};..}...
    │ │ │ +00067860: 6669 6c65 5f69 6e64 6578 5f74 2066 696c  file_index_t fil
    │ │ │ +00067870: 655f 7374 6f72 6167 653a 3a66 696c 655f  e_storage::file_
    │ │ │ +00067880: 696e 6465 785f 6174 5f70 6965 6365 2870  index_at_piece(p
    │ │ │ +00067890: 6965 6365 5f69 6e64 6578 5f74 2063 6f6e  iece_index_t con
    │ │ │ +000678a0: 7374 2070 6965 6365 2920 636f 6e73 740a  st piece) const.
    │ │ │ +000678b0: 097b 0a09 0972 6574 7572 6e20 6669 6c65  .{...return file
    │ │ │ +000678c0: 5f69 6e64 6578 5f61 745f 6f66 6673 6574  _index_at_offset
    │ │ │ +000678d0: 2873 7461 7469 635f 6361 7374 266c 743b  (static_cast<
    │ │ │ +000678e0: 696e 7426 6774 3b28 7069 6563 6529 202a  int>(piece) *
    │ │ │ +000678f0: 2073 7464 3a3a 696e 7436 345f 7428 7069   std::int64_t(pi
    │ │ │ +00067900: 6563 655f 6c65 6e67 7468 2829 2929 3b0a  ece_length()));.
    │ │ │ +00067910: 097d 0a0a 0966 696c 655f 696e 6465 785f  .}...file_index_
    │ │ │ +00067920: 7420 6669 6c65 5f73 746f 7261 6765 3a3a  t file_storage::
    │ │ │ +00067930: 6669 6c65 5f69 6e64 6578 5f66 6f72 5f72  file_index_for_r
    │ │ │ +00067940: 6f6f 7428 7368 6132 3536 5f68 6173 6820  oot(sha256_hash 
    │ │ │ +00067950: 636f 6e73 7426 616d 703b 2072 6f6f 745f  const& root_
    │ │ │ +00067960: 6861 7368 2920 636f 6e73 740a 097b 0a3c  hash) const..{.<
    │ │ │ +00067970: 6469 7620 7374 796c 653d 2262 6163 6b67  div style="backg
    │ │ │ +00067980: 726f 756e 643a 2023 6666 6666 3030 2220  round: #ffff00" 
    │ │ │ +00067990: 7769 6474 683d 2231 3030 2522 3e09 0966  width="100%">..f
    │ │ │ +000679a0: 6f72 2028 6669 6c65 5f69 6e64 6578 5f74  or (file_index_t
    │ │ │ +000679b0: 2063 6f6e 7374 2069 203a 2066 696c 655f   const i : file_
    │ │ │ +000679c0: 7261 6e67 6528 2929 0a3c 2f64 6976 3e09  range())..
    │ │ │ +000679d0: 097b 0a09 0909 6966 2028 726f 6f74 2869  .{....if (root(i
    │ │ │ +000679e0: 2920 3d3d 2072 6f6f 745f 6861 7368 2920  ) == root_hash) 
    │ │ │ +000679f0: 7265 7475 726e 2069 3b0a 0909 7d0a 0909  return i;...}...
    │ │ │ +00067a00: 7265 7475 726e 2066 696c 655f 696e 6465  return file_inde
    │ │ │ +00067a10: 785f 747b 2d31 7d3b 0a09 7d0a 0a09 7069  x_t{-1};..}...pi
    │ │ │ +00067a20: 6563 655f 696e 6465 785f 7420 6669 6c65  ece_index_t file
    │ │ │ +00067a30: 5f73 746f 7261 6765 3a3a 7069 6563 655f  _storage::piece_
    │ │ │ +00067a40: 696e 6465 785f 6174 5f66 696c 6528 6669  index_at_file(fi
    │ │ │ +00067a50: 6c65 5f69 6e64 6578 5f74 2066 2920 636f  le_index_t f) co
    │ │ │ +00067a60: 6e73 740a 097b 0a09 0972 6574 7572 6e20  nst..{...return 
    │ │ │ +00067a70: 7069 6563 655f 696e 6465 785f 747b 6175  piece_index_t{au
    │ │ │ +00067a80: 783a 3a6e 756d 6572 6963 5f63 6173 7426  x::numeric_cast&
    │ │ │ +00067a90: 6c74 3b69 6e74 2667 743b 2866 696c 655f  lt;int>(file_
    │ │ │ +00067aa0: 6f66 6673 6574 2866 2920 2f20 7069 6563  offset(f) / piec
    │ │ │ +00067ab0: 655f 6c65 6e67 7468 2829 297d 3b0a 097d  e_length())};..}
    │ │ │ +00067ac0: 0a0a 2369 6620 544f 5252 454e 545f 4142  ..#if TORRENT_AB
    │ │ │ +00067ad0: 495f 5645 5253 494f 4e20 266c 743b 3d20  I_VERSION <= 
    │ │ │ +00067ae0: 320a 0963 6861 7220 636f 6e73 742a 2066  2..char const* f
    │ │ │ +00067af0: 696c 655f 7374 6f72 6167 653a 3a66 696c  ile_storage::fil
    │ │ │ +00067b00: 655f 6e61 6d65 5f70 7472 2866 696c 655f  e_name_ptr(file_
    │ │ │ +00067b10: 696e 6465 785f 7420 636f 6e73 7420 696e  index_t const in
    │ │ │ +00067b20: 6465 7829 2063 6f6e 7374 0a09 7b0a 0909  dex) const..{...
    │ │ │ +00067b30: 7265 7475 726e 206d 5f66 696c 6573 5b69  return m_files[i
    │ │ │ +00067b40: 6e64 6578 5d2e 6e61 6d65 3b0a 097d 0a0a  ndex].name;..}..
    │ │ │ +00067b50: 0969 6e74 2066 696c 655f 7374 6f72 6167  .int file_storag
    │ │ │ +00067b60: 653a 3a66 696c 655f 6e61 6d65 5f6c 656e  e::file_name_len
    │ │ │ +00067b70: 2866 696c 655f 696e 6465 785f 7420 636f  (file_index_t co
    │ │ │ +00067b80: 6e73 7420 696e 6465 7829 2063 6f6e 7374  nst index) const
    │ │ │ +00067b90: 0a09 7b0a 0909 6966 2028 6d5f 6669 6c65  ..{...if (m_file
    │ │ │ +00067ba0: 735b 696e 6465 785d 2e6e 616d 655f 6c65  s[index].name_le
    │ │ │ +00067bb0: 6e20 3d3d 2061 7578 3a3a 6669 6c65 5f65  n == aux::file_e
    │ │ │ +00067bc0: 6e74 7279 3a3a 6e61 6d65 5f69 735f 6f77  ntry::name_is_ow
    │ │ │ +00067bd0: 6e65 6429 0a09 0909 7265 7475 726e 202d  ned)....return -
    │ │ │ +00067be0: 313b 0a09 0972 6574 7572 6e20 6d5f 6669  1;...return m_fi
    │ │ │ +00067bf0: 6c65 735b 696e 6465 785d 2e6e 616d 655f  les[index].name_
    │ │ │ +00067c00: 6c65 6e3b 0a09 7d0a 2365 6e64 6966 0a0a  len;..}.#endif..
    │ │ │ +00067c10: 0973 7464 3a3a 7665 6374 6f72 266c 743b  .std::vector<
    │ │ │ +00067c20: 6669 6c65 5f73 6c69 6365 2667 743b 2066  file_slice> f
    │ │ │ +00067c30: 696c 655f 7374 6f72 6167 653a 3a6d 6170  ile_storage::map
    │ │ │ +00067c40: 5f62 6c6f 636b 2870 6965 6365 5f69 6e64  _block(piece_ind
    │ │ │ +00067c50: 6578 5f74 2063 6f6e 7374 2070 6965 6365  ex_t const piece
    │ │ │ +00067c60: 0a09 092c 2073 7464 3a3a 696e 7436 345f  ..., std::int64_
    │ │ │ +00067c70: 7420 636f 6e73 7420 6f66 6673 6574 2c20  t const offset, 
    │ │ │ +00067c80: 7374 643a 3a69 6e74 3634 5f74 2073 697a  std::int64_t siz
    │ │ │ +00067c90: 6529 2063 6f6e 7374 0a09 7b0a 0909 544f  e) const..{...TO
    │ │ │ +00067ca0: 5252 454e 545f 4153 5345 5254 5f50 5245  RRENT_ASSERT_PRE
    │ │ │ +00067cb0: 434f 4e44 2870 6965 6365 2026 6774 3b3d  COND(piece >=
    │ │ │ +00067cc0: 2070 6965 6365 5f69 6e64 6578 5f74 7b30   piece_index_t{0
    │ │ │ +00067cd0: 7d29 3b0a 0909 544f 5252 454e 545f 4153  });...TORRENT_AS
    │ │ │ +00067ce0: 5345 5254 5f50 5245 434f 4e44 2870 6965  SERT_PRECOND(pie
    │ │ │ +00067cf0: 6365 2026 6c74 3b20 656e 645f 7069 6563  ce < end_piec
    │ │ │ +00067d00: 6528 2929 3b0a 3c2f 7072 653e 3c2f 7464  e());.
    relevance │ │ │ +00067d40: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ +00067d50: 3c61 2068 7265 663d 226a 6176 6173 6372 ../src/file_sto │ │ │ +00067d80: 7261 6765 2e63 7070 3a31 3234 333c 2f61 rage.cpp:1243this w │ │ │ +00067da0: 6f75 6c64 2062 6520 6d6f 7265 2065 6666 ould be more eff │ │ │ +00067db0: 6963 6965 6e74 2069 6620 6d5f 7061 7468 icient if m_path │ │ │ +00067dc0: 7320 7761 7320 736f 7274 6564 2066 6972 s was sorted fir │ │ │ +00067dd0: 7374 2c20 7375 6368 2074 6861 7420 6120 st, such that a │ │ │ +00067de0: 6c6f 7765 7220 7061 7468 2069 6e64 6578 lower path index │ │ │ +00067df0: 2061 6c77 6179 7320 6d65 616e 7420 736f always meant so │ │ │ +00067e00: 7274 6564 2d62 6566 6f72 653c 2f74 643e rted-before │ │ │ +00067e10: 3c2f 7472 3e3c 7472 2069 643d 2232 3339

    this wo │ │ │ +00067e60: 756c 6420 6265 206d 6f72 6520 6566 6669 uld be more effi │ │ │ +00067e70: 6369 656e 7420 6966 206d 5f70 6174 6873 cient if m_paths │ │ │ +00067e80: 2077 6173 2073 6f72 7465 6420 6669 7273 was sorted firs │ │ │ +00067e90: 742c 2073 7563 680a 7468 6174 2061 206c t, such.that a l │ │ │ +00067ea0: 6f77 6572 2070 6174 6820 696e 6465 7820 ower path index │ │ │ +00067eb0: 616c 7761 7973 206d 6561 6e74 2073 6f72 always meant sor │ │ │ +00067ec0: 7465 642d 6265 666f 7265 3c2f 6832 3e3c ted-before

    < │ │ │ +00067ed0: 6834 3e2e 2e2f 7372 632f 6669 6c65 5f73 h4>../src/file_s │ │ │ +00067ee0: 746f 7261 6765 2e63 7070 3a31 3234 333c torage.cpp:1243< │ │ │ +00067ef0: 2f68 343e 3c70 7265 2073 7479 6c65 3d22 /h4>
    .}
    │ │ │ +00067f30: 0a0a 0976 6f69 6420 6669 6c65 5f73 746f  ...void file_sto
    │ │ │ +00067f40: 7261 6765 3a3a 6361 6e6f 6e69 6361 6c69  rage::canonicali
    │ │ │ +00067f50: 7a65 5f69 6d70 6c28 626f 6f6c 2063 6f6e  ze_impl(bool con
    │ │ │ +00067f60: 7374 2062 6163 6b77 6172 6473 5f63 6f6d  st backwards_com
    │ │ │ +00067f70: 7061 7469 626c 6529 0a09 7b0a 0909 544f  patible)..{...TO
    │ │ │ +00067f80: 5252 454e 545f 4153 5345 5254 2870 6965  RRENT_ASSERT(pie
    │ │ │ +00067f90: 6365 5f6c 656e 6774 6828 2920 2667 743b  ce_length() >
    │ │ │ +00067fa0: 3d20 3136 202a 2031 3032 3429 3b0a 0a09  = 16 * 1024);...
    │ │ │ +00067fb0: 092f 2f20 7573 6520 7468 6973 2076 6563  .// use this vec
    │ │ │ +00067fc0: 746f 7220 746f 2074 7261 636b 2074 6865  tor to track the
    │ │ │ +00067fd0: 206e 6577 206f 7264 6572 696e 6720 6f66   new ordering of
    │ │ │ +00067fe0: 2066 696c 6573 0a09 092f 2f20 7468 6973   files...// this
    │ │ │ +00067ff0: 2061 6c6c 6f77 7320 7468 6520 7573 6520   allows the use 
    │ │ │ +00068000: 6f66 2053 544c 2061 6c67 6f72 6974 686d  of STL algorithm
    │ │ │ +00068010: 7320 6465 7370 6974 6520 7468 656d 0a09  s despite them..
    │ │ │ +00068020: 092f 2f20 6e6f 7420 7375 7070 6f72 7469  .// not supporti
    │ │ │ +00068030: 6e67 2061 2063 7573 746f 6d20 7377 6170  ng a custom swap
    │ │ │ +00068040: 2066 756e 6374 6f72 0a09 0961 7578 3a3a   functor...aux::
    │ │ │ +00068050: 7665 6374 6f72 266c 743b 6669 6c65 5f69  vector<file_i
    │ │ │ +00068060: 6e64 6578 5f74 2c20 6669 6c65 5f69 6e64  ndex_t, file_ind
    │ │ │ +00068070: 6578 5f74 2667 743b 206e 6577 5f6f 7264  ex_t> new_ord
    │ │ │ +00068080: 6572 2865 6e64 5f66 696c 6528 2929 3b0a  er(end_file());.
    │ │ │ +00068090: 0909 666f 7220 2861 7574 6f20 6920 3a20  ..for (auto i : 
    │ │ │ +000680a0: 6669 6c65 5f72 616e 6765 2829 290a 0909  file_range())...
    │ │ │ +000680b0: 096e 6577 5f6f 7264 6572 5b69 5d20 3d20  .new_order[i] = 
    │ │ │ +000680c0: 693b 0a0a 0909 2f2f 2072 656d 6f76 6520  i;....// remove 
    │ │ │ +000680d0: 616e 7920 6578 6973 7469 6e67 2070 6164  any existing pad
    │ │ │ +000680e0: 2066 696c 6573 0a09 097b 0a09 0909 6175   files...{....au
    │ │ │ +000680f0: 746f 2070 6164 5f62 6567 696e 203d 2073  to pad_begin = s
    │ │ │ +00068100: 7464 3a3a 7061 7274 6974 696f 6e28 6e65  td::partition(ne
    │ │ │ +00068110: 775f 6f72 6465 722e 6265 6769 6e28 292c  w_order.begin(),
    │ │ │ +00068120: 206e 6577 5f6f 7264 6572 2e65 6e64 2829   new_order.end()
    │ │ │ +00068130: 0a09 0909 092c 205b 7468 6973 5d28 6669  ....., [this](fi
    │ │ │ +00068140: 6c65 5f69 6e64 6578 5f74 2069 2920 7b20  le_index_t i) { 
    │ │ │ +00068150: 7265 7475 726e 2021 6d5f 6669 6c65 735b  return !m_files[
    │ │ │ +00068160: 695d 2e70 6164 5f66 696c 653b 207d 293b  i].pad_file; });
    │ │ │ +00068170: 0a09 0909 6e65 775f 6f72 6465 722e 6572  ....new_order.er
    │ │ │ +00068180: 6173 6528 7061 645f 6265 6769 6e2c 206e  ase(pad_begin, n
    │ │ │ +00068190: 6577 5f6f 7264 6572 2e65 6e64 2829 293b  ew_order.end());
    │ │ │ +000681a0: 0a09 097d 0a0a 3c64 6976 2073 7479 6c65  ...}..
    .
    ..// │ │ │ +000681e0: 736f 7274 2066 696c 6573 2062 7920 7061 sort files by pa │ │ │ +000681f0: 7468 2f6e 616d 650a 0909 7374 643a 3a73 th/name...std::s │ │ │ +00068200: 6f72 7428 6e65 775f 6f72 6465 722e 6265 ort(new_order.be │ │ │ +00068210: 6769 6e28 292c 206e 6577 5f6f 7264 6572 gin(), new_order │ │ │ +00068220: 2e65 6e64 2829 0a09 0909 2c20 5b74 6869 .end()...., [thi │ │ │ +00068230: 735d 2866 696c 655f 696e 6465 785f 7420 s](file_index_t │ │ │ +00068240: 6c2c 2066 696c 655f 696e 6465 785f 7420 l, file_index_t │ │ │ +00068250: 7229 0a09 097b 0a09 0909 2f2f 2061 7373 r)...{....// ass │ │ │ +00068260: 756d 696e 6720 6d5f 7061 7468 7320 6172 uming m_paths ar │ │ │ +00068270: 6520 756e 6971 7565 210a 0909 0961 7574 e unique!....aut │ │ │ +00068280: 6f20 636f 6e73 7426 616d 703b 206c 6620 o const& lf │ │ │ +00068290: 3d20 6d5f 6669 6c65 735b 6c5d 3b0a 0909 = m_files[l];... │ │ │ +000682a0: 0961 7574 6f20 636f 6e73 7426 616d 703b .auto const& │ │ │ +000682b0: 2072 6620 3d20 6d5f 6669 6c65 735b 725d rf = m_files[r] │ │ │ +000682c0: 3b0a 0909 0969 6620 286c 662e 7061 7468 ;....if (lf.path │ │ │ +000682d0: 5f69 6e64 6578 2021 3d20 7266 2e70 6174 _index != rf.pat │ │ │ +000682e0: 685f 696e 6465 7829 0a09 0909 7b0a 0909 h_index)....{... │ │ │ +000682f0: 0909 696e 7420 636f 6e73 7420 7265 7420 ..int const ret │ │ │ +00068300: 3d20 7061 7468 5f63 6f6d 7061 7265 286d = path_compare(m │ │ │ +00068310: 5f70 6174 6873 5b6c 662e 7061 7468 5f69 _paths[lf.path_i │ │ │ +00068320: 6e64 6578 5d2c 206c 662e 6669 6c65 6e61 ndex], lf.filena │ │ │ +00068330: 6d65 2829 0a09 0909 0909 2c20 6d5f 7061 me()......, m_pa │ │ │ +00068340: 7468 735b 7266 2e70 6174 685f 696e 6465 ths[rf.path_inde │ │ │ +00068350: 785d 2c20 7266 2e66 696c 656e 616d 6528 x], rf.filename( │ │ │ +00068360: 2929 3b0a 0909 0909 6966 2028 7265 7420 ));.....if (ret │ │ │ +00068370: 213d 2030 2920 7265 7475 726e 2072 6574 != 0) return ret │ │ │ +00068380: 2026 6c74 3b20 303b 0a09 0909 7d0a 0909 < 0;....}... │ │ │ +00068390: 0972 6574 7572 6e20 6c66 2e66 696c 656e .return lf.filen │ │ │ +000683a0: 616d 6528 2920 266c 743b 2072 662e 6669 ame() < rf.fi │ │ │ +000683b0: 6c65 6e61 6d65 2829 3b0a 0909 7d29 3b0a lename();...});. │ │ │ +000683c0: 0a09 0961 7578 3a3a 7665 6374 6f72 266c ...aux::vector&l │ │ │ +000683d0: 743b 6175 783a 3a66 696c 655f 656e 7472 t;aux::file_entr │ │ │ +000683e0: 792c 2066 696c 655f 696e 6465 785f 7426 y, file_index_t& │ │ │ +000683f0: 6774 3b20 6e65 775f 6669 6c65 733b 0a09 gt; new_files;.. │ │ │ +00068400: 0961 7578 3a3a 7665 6374 6f72 266c 743b .aux::vector< │ │ │ +00068410: 6368 6172 2063 6f6e 7374 2a2c 2066 696c char const*, fil │ │ │ +00068420: 655f 696e 6465 785f 7426 6774 3b20 6e65 e_index_t> ne │ │ │ +00068430: 775f 6669 6c65 5f68 6173 6865 733b 0a09 w_file_hashes;.. │ │ │ +00068440: 0961 7578 3a3a 7665 6374 6f72 266c 743b .aux::vector< │ │ │ +00068450: 7374 643a 3a74 696d 655f 742c 2066 696c std::time_t, fil │ │ │ +00068460: 655f 696e 6465 785f 7426 6774 3b20 6e65 e_index_t> ne │ │ │ +00068470: 775f 6d74 696d 653b 0a0a 0909 2f2f 2072 w_mtime;....// r │ │ │ +00068480: 6573 6572 7665 2065 6e6f 7567 6820 7370 eserve enough sp │ │ │ +00068490: 6163 6520 666f 7220 7468 6520 776f 7273 ace for the wors │ │ │ +000684a0: 7420 6361 7365 2061 6674 6572 2070 6164 t case after pad │ │ │ +000684b0: 6469 6e67 0a09 096e 6577 5f66 696c 6573 ding...new_files │ │ │ +000684c0: 2e72 6573 6572 7665 286e 6577 5f6f 7264 .reserve(new_ord │ │ │ +000684d0: 6572 2e73 697a 6528 2920 2a20 3220 2d20 er.size() * 2 - │ │ │ +000684e0: 3129 3b0a 0909 6966 2028 216d 5f66 696c 1);...if (!m_fil │ │ │ +000684f0: 655f 6861 7368 6573 2e65 6d70 7479 2829 e_hashes.empty() │ │ │ +00068500: 290a 0909 096e 6577 5f66 696c 655f 6861 )....new_file_ha │ │ │ +00068510: 7368 6573 2e72 6573 6572 7665 286e 6577 shes.reserve(new │ │ │ +00068520: 5f6f 7264 6572 2e73 697a 6528 2920 2a20 _order.size() * │ │ │ +00068530: 3220 2d20 3129 3b0a 0909 6966 2028 216d 2 - 1);...if (!m │ │ │ +00068540: 5f6d 7469 6d65 2e65 6d70 7479 2829 290a _mtime.empty()). │ │ │ +00068550: 0909 096e 6577 5f6d 7469 6d65 2e72 6573 ...new_mtime.res │ │ │ +00068560: 6572 7665 286e 6577 5f6f 7264 6572 2e73 erve(new_order.s │ │ │ +00068570: 697a 6528 2920 2a20 3220 2d20 3129 3b0a ize() * 2 - 1);. │ │ │ +00068580: 0a09 092f 2f20 7265 2d63 6f6d 7075 7465 ...// re-compute │ │ │ +00068590: 206f 6666 7365 7473 2061 6e64 2069 6e73 offsets and ins │ │ │ +000685a0: 6572 7420 7061 6420 6669 6c65 7320 6173 ert pad files as │ │ │ +000685b0: 206e 6563 6573 7361 7279 0a09 0973 7464 necessary...std │ │ │ +000685c0: 3a3a 696e 7436 345f 7420 6f66 6620 3d20 ::int64_t off = │ │ │ +000685d0: 303b 0a0a 3c2f 7072 653e 3c2f 7464 3e3c 0;..
    < │ │ │ +000685e0: 2f74 723e 3c74 7220 7374 796c 653d 2262 /tr>relevance&n │ │ │ +00068610: 6273 703b 303c 2f74 643e 3c74 643e 3c61 bsp;0. │ │ │ +00068640: 2e2f 7372 632f 7365 7373 696f 6e5f 6861 ./src/session_ha │ │ │ +00068650: 6e64 6c65 2e63 7070 3a35 3033 3c2f 613e ndle.cpp:503 │ │ │ +00068660: 3c2f 7464 3e3c 7464 3e69 6e20 432b 2b31 in C++1 │ │ │ +00068670: 342c 2075 7365 2075 6e69 7175 655f 7074 4, use unique_pt │ │ │ +00068680: 7220 616e 6420 6d6f 7665 2069 7420 696e r and move it in │ │ │ +00068690: 746f 2074 6865 206c 616d 6264 613c 2f74 to the lambda

    in C+ │ │ │ +000686f0: 2b31 342c 2075 7365 2075 6e69 7175 655f +14, use unique_ │ │ │ +00068700: 7074 7220 616e 6420 6d6f 7665 2069 7420 ptr and move it │ │ │ +00068710: 696e 746f 2074 6865 206c 616d 6264 613c into the lambda< │ │ │ +00068720: 2f68 323e 3c68 343e 2e2e 2f73 7263 2f73 /h2>

    ../src/s │ │ │ +00068730: 6573 7369 6f6e 5f68 616e 646c 652e 6370 ession_handle.cp │ │ │ +00068740: 703a 3530 333c 2f68 343e 3c70 7265 2073 p:503

    #ifndef BOOS
    │ │ │ +00068790: 545f 4e4f 5f45 5843 4550 5449 4f4e 530a  T_NO_EXCEPTIONS.
    │ │ │ +000687a0: 0909 6966 2028 7061 7261 6d73 2e73 6176  ..if (params.sav
    │ │ │ +000687b0: 655f 7061 7468 2e65 6d70 7479 2829 290a  e_path.empty()).
    │ │ │ +000687c0: 0909 0961 7578 3a3a 7468 726f 775f 6578  ...aux::throw_ex
    │ │ │ +000687d0: 266c 743b 7379 7374 656d 5f65 7272 6f72  <system_error
    │ │ │ +000687e0: 2667 743b 2865 7272 6f72 5f63 6f64 6528  >(error_code(
    │ │ │ +000687f0: 6572 726f 7273 3a3a 696e 7661 6c69 645f  errors::invalid_
    │ │ │ +00068800: 7361 7665 5f70 6174 6829 293b 0a23 656c  save_path));.#el
    │ │ │ +00068810: 7365 0a09 0954 4f52 5245 4e54 5f41 5353  se...TORRENT_ASS
    │ │ │ +00068820: 4552 545f 5052 4543 4f4e 4428 2170 6172  ERT_PRECOND(!par
    │ │ │ +00068830: 616d 732e 7361 7665 5f70 6174 682e 656d  ams.save_path.em
    │ │ │ +00068840: 7074 7928 2929 3b0a 2365 6e64 6966 0a0a  pty());.#endif..
    │ │ │ +00068850: 2369 6620 544f 5252 454e 545f 4142 495f  #if TORRENT_ABI_
    │ │ │ +00068860: 5645 5253 494f 4e20 266c 743b 2033 0a09  VERSION < 3..
    │ │ │ +00068870: 0969 6620 2821 7061 7261 6d73 2e69 6e66  .if (!params.inf
    │ │ │ +00068880: 6f5f 6861 7368 6573 2e68 6173 5f76 3128  o_hashes.has_v1(
    │ │ │ +00068890: 2920 2661 6d70 3b26 616d 703b 2021 7061  ) && !pa
    │ │ │ +000688a0: 7261 6d73 2e69 6e66 6f5f 6861 7368 6573  rams.info_hashes
    │ │ │ +000688b0: 2e68 6173 5f76 3228 2920 2661 6d70 3b26  .has_v2() &&
    │ │ │ +000688c0: 616d 703b 2021 7061 7261 6d73 2e74 6929  amp; !params.ti)
    │ │ │ +000688d0: 0a09 0909 7061 7261 6d73 2e69 6e66 6f5f  ....params.info_
    │ │ │ +000688e0: 6861 7368 6573 2e76 3120 3d20 7061 7261  hashes.v1 = para
    │ │ │ +000688f0: 6d73 2e69 6e66 6f5f 6861 7368 3b0a 2365  ms.info_hash;.#e
    │ │ │ +00068900: 6e64 6966 0a0a 0909 2f2f 2074 6865 2069  ndif....// the i
    │ │ │ +00068910: 6e74 6572 6e61 6c20 746f 7272 656e 7420  nternal torrent 
    │ │ │ +00068920: 6f62 6a65 6374 206b 6565 7073 2061 6e64  object keeps and
    │ │ │ +00068930: 206d 7574 6174 6573 2073 7461 7465 2069   mutates state i
    │ │ │ +00068940: 6e20 7468 650a 0909 2f2f 2074 6f72 7265  n the...// torre
    │ │ │ +00068950: 6e74 5f69 6e66 6f20 6f62 6a65 6374 2e20  nt_info object. 
    │ │ │ +00068960: 5765 2063 616e 2774 206c 6574 2074 6861  We can't let tha
    │ │ │ +00068970: 7420 6c65 616b 2062 6163 6b20 746f 2074  t leak back to t
    │ │ │ +00068980: 6865 2063 6c69 656e 740a 0909 6966 2028  he client...if (
    │ │ │ +00068990: 7061 7261 6d73 2e74 6929 0a09 0909 7061  params.ti)....pa
    │ │ │ +000689a0: 7261 6d73 2e74 6920 3d20 7374 643a 3a6d  rams.ti = std::m
    │ │ │ +000689b0: 616b 655f 7368 6172 6564 266c 743b 746f  ake_shared<to
    │ │ │ +000689c0: 7272 656e 745f 696e 666f 2667 743b 282a  rrent_info>(*
    │ │ │ +000689d0: 7061 7261 6d73 2e74 6929 3b0a 0a09 092f  params.ti);..../
    │ │ │ +000689e0: 2f20 7765 2063 616e 6e6f 7420 6361 7074  / we cannot capt
    │ │ │ +000689f0: 7572 6520 6120 756e 6971 7565 5f70 7472  ure a unique_ptr
    │ │ │ +00068a00: 2069 6e74 6f20 6120 6c61 6d62 6461 2069   into a lambda i
    │ │ │ +00068a10: 6e20 632b 2b31 312c 2073 6f20 7765 2075  n c++11, so we u
    │ │ │ +00068a20: 7365 2061 2072 6177 0a09 092f 2f20 706f  se a raw...// po
    │ │ │ +00068a30: 696e 7465 7220 666f 7220 6e6f 772e 2061  inter for now. a
    │ │ │ +00068a40: 7379 6e63 5f63 616c 6c20 7573 6573 2061  sync_call uses a
    │ │ │ +00068a50: 206c 616d 6264 6120 6578 7072 6573 7369   lambda expressi
    │ │ │ +00068a60: 6f6e 2074 6f20 706f 7374 2074 6865 2063  on to post the c
    │ │ │ +00068a70: 616c 6c0a 0909 2f2f 2074 6f20 7468 6520  all...// to the 
    │ │ │ +00068a80: 6d61 696e 2074 6872 6561 640a 3c64 6976  main thread.
    ..auto │ │ │ +00068ac0: 2a20 7020 3d20 6e65 7720 6164 645f 746f * p = new add_to │ │ │ +00068ad0: 7272 656e 745f 7061 7261 6d73 2873 7464 rrent_params(std │ │ │ +00068ae0: 3a3a 6d6f 7665 2870 6172 616d 7329 293b ::move(params)); │ │ │ +00068af0: 0a3c 2f64 6976 3e09 0961 7574 6f20 6775 .
    ..auto gu │ │ │ +00068b00: 6172 6420 3d20 6175 783a 3a73 636f 7065 ard = aux::scope │ │ │ +00068b10: 5f65 6e64 285b 705d 7b20 6465 6c65 7465 _end([p]{ delete │ │ │ +00068b20: 2070 3b20 7d29 3b0a 0909 702d 2667 743b p; });...p-> │ │ │ +00068b30: 7361 7665 5f70 6174 6820 3d20 636f 6d70 save_path = comp │ │ │ +00068b40: 6c65 7465 2870 2d26 6774 3b73 6176 655f lete(p->save_ │ │ │ +00068b50: 7061 7468 293b 0a0a 2369 6620 544f 5252 path);..#if TORR │ │ │ +00068b60: 454e 545f 4142 495f 5645 5253 494f 4e20 ENT_ABI_VERSION │ │ │ +00068b70: 3d3d 2031 0a09 0968 616e 646c 655f 6261 == 1...handle_ba │ │ │ +00068b80: 636b 7761 7264 735f 636f 6d70 6174 6962 ckwards_compatib │ │ │ +00068b90: 6c65 5f72 6573 756d 655f 6461 7461 282a le_resume_data(* │ │ │ +00068ba0: 7029 3b0a 2365 6e64 6966 0a0a 0909 6173 p);.#endif....as │ │ │ +00068bb0: 796e 635f 6361 6c6c 2826 616d 703b 7365 ync_call(&se │ │ │ +00068bc0: 7373 696f 6e5f 696d 706c 3a3a 6173 796e ssion_impl::asyn │ │ │ +00068bd0: 635f 6164 645f 746f 7272 656e 742c 2070 c_add_torrent, p │ │ │ +00068be0: 293b 0a09 0967 7561 7264 2e64 6973 6172 );...guard.disar │ │ │ +00068bf0: 6d28 293b 0a09 7d0a 0a23 6966 6e64 6566 m();..}..#ifndef │ │ │ +00068c00: 2042 4f4f 5354 5f4e 4f5f 4558 4345 5054 BOOST_NO_EXCEPT │ │ │ +00068c10: 494f 4e53 0a23 6966 2054 4f52 5245 4e54 IONS.#if TORRENT │ │ │ +00068c20: 5f41 4249 5f56 4552 5349 4f4e 203d 3d20 _ABI_VERSION == │ │ │ +00068c30: 310a 092f 2f20 6966 2074 6865 2074 6f72 1..// if the tor │ │ │ +00068c40: 7265 6e74 2061 6c72 6561 6479 2065 7869 rent already exi │ │ │ +00068c50: 7374 732c 2074 6869 7320 7769 6c6c 2074 sts, this will t │ │ │ +00068c60: 6872 6f77 2064 7570 6c69 6361 7465 5f74 hrow duplicate_t │ │ │ +00068c70: 6f72 7265 6e74 0a09 746f 7272 656e 745f orrent..torrent_ │ │ │ +00068c80: 6861 6e64 6c65 2073 6573 7369 6f6e 5f68 handle session_h │ │ │ +00068c90: 616e 646c 653a 3a61 6464 5f74 6f72 7265 andle::add_torre │ │ │ +00068ca0: 6e74 280a 0909 746f 7272 656e 745f 696e nt(...torrent_in │ │ │ +00068cb0: 666f 2063 6f6e 7374 2661 6d70 3b20 7469 fo const& ti │ │ │ +00068cc0: 0a09 092c 2073 7464 3a3a 7374 7269 6e67 ..., std::string │ │ │ +00068cd0: 2063 6f6e 7374 2661 6d70 3b20 7361 7665 const& save │ │ │ +00068ce0: 5f70 6174 680a 0909 2c20 656e 7472 7920 _path..., entry │ │ │ +00068cf0: 636f 6e73 7426 616d 703b 2072 6573 756d const& resum │ │ │ +00068d00: 655f 6461 7461 0a09 092c 2073 746f 7261 e_data..., stora │ │ │ +00068d10: 6765 5f6d 6f64 655f 7420 7374 6f72 6167 ge_mode_t storag │ │ │ +00068d20: 655f 6d6f 6465 0a09 092c 2062 6f6f 6c20 e_mode..., bool │ │ │ +00068d30: 636f 6e73 7420 6164 645f 7061 7573 6564 const add_paused │ │ │ +00068d40: 290a 097b 0a09 0961 6464 5f74 6f72 7265 )..{...add_torre │ │ │ +00068d50: 6e74 5f70 6172 616d 7320 703b 0a09 0970 nt_params p;...p │ │ │ +00068d60: 2e74 6920 3d20 7374 643a 3a6d 616b 655f .ti = std::make_ │ │ │ +00068d70: 7368 6172 6564 266c 743b 746f 7272 656e shared<torren │ │ │ +00068d80: 745f 696e 666f 2667 743b 2874 6929 3b0a t_info>(ti);. │ │ │ +00068d90: 0909 702e 7361 7665 5f70 6174 6820 3d20 ..p.save_path = │ │ │ +00068da0: 7361 7665 5f70 6174 683b 0a09 0969 6620 save_path;...if │ │ │ +00068db0: 2872 6573 756d 655f 6461 7461 2e74 7970 (resume_data.typ │ │ │ +00068dc0: 6528 2920 213d 2065 6e74 7279 3a3a 756e e() != entry::un │ │ │ +00068dd0: 6465 6669 6e65 645f 7429 0a09 097b 0a09 defined_t)...{.. │ │ │ +00068de0: 0909 6265 6e63 6f64 6528 7374 643a 3a62 ..bencode(std::b │ │ │ +00068df0: 6163 6b5f 696e 7365 7274 6572 2870 2e72 ack_inserter(p.r │ │ │ +00068e00: 6573 756d 655f 6461 7461 292c 2072 6573 esume_data), res │ │ │ +00068e10: 756d 655f 6461 7461 293b 0a09 097d 0a09 ume_data);...}.. │ │ │ +00068e20: 0970 2e73 746f 7261 6765 5f6d 6f64 6520 .p.storage_mode │ │ │ +00068e30: 3d20 7374 6f72 6167 655f 6d6f 6465 3b0a = storage_mode;. │ │ │ +00068e40: 0909 6966 2028 6164 645f 7061 7573 6564 ..if (add_paused │ │ │ +00068e50: 2920 702e 666c 6167 7320 7c3d 2061 6464 ) p.flags |= add │ │ │ +00068e60: 5f74 6f72 7265 6e74 5f70 6172 616d 733a _torrent_params: │ │ │ +00068e70: 3a66 6c61 675f 7061 7573 6564 3b0a 3c2f :flag_paused;.r │ │ │ 00068eb0: 656c 6576 616e 6365 266e 6273 703b 303c elevance 0< │ │ │ 00068ec0: 2f74 643e 3c74 643e 3c61 2068 7265 663d /td>../src/ │ │ │ -00068ef0: 6b61 6465 6d6c 6961 2f69 7465 6d2e 6370 kademlia/item.cp │ │ │ -00068f00: 703a 3134 333c 2f61 3e3c 2f74 643e 3c74 p:143implement ctor │ │ │ -00068f20: 2066 6f72 2065 6e74 7279 2066 726f 6d20 for entry from │ │ │ -00068f30: 6264 6563 6f64 655f 6e6f 6465 3f3c 2f74 bdecode_node?

    imple │ │ │ -00068f90: 6d65 6e74 2063 746f 7220 666f 7220 656e ment ctor for en │ │ │ -00068fa0: 7472 7920 6672 6f6d 2062 6465 636f 6465 try from bdecode │ │ │ -00068fb0: 5f6e 6f64 653f 3c2f 6832 3e3c 6834 3e2e _node?

    . │ │ │ -00068fc0: 2e2f 7372 632f 6b61 6465 6d6c 6961 2f69 ./src/kademlia/i │ │ │ -00068fd0: 7465 6d2e 6370 703a 3134 333c 2f68 343e tem.cpp:143

    │ │ │ -00068fe0: 3c70 7265 2073 7479 6c65 3d22 6261 636b
    ., sec
    │ │ │ -00069020: 7265 745f 6b65 7920 636f 6e73 7426 616d  ret_key const&am
    │ │ │ -00069030: 703b 2073 6b29 0a7b 0a09 6368 6172 2073  p; sk).{..char s
    │ │ │ -00069040: 7472 5b31 3230 305d 3b0a 0969 6e74 2063  tr[1200];..int c
    │ │ │ -00069050: 6f6e 7374 206c 656e 203d 2063 616e 6f6e  onst len = canon
    │ │ │ -00069060: 6963 616c 5f73 7472 696e 6728 762c 2073  ical_string(v, s
    │ │ │ -00069070: 6571 2c20 7361 6c74 2c20 7374 7229 3b0a  eq, salt, str);.
    │ │ │ -00069080: 0a09 7265 7475 726e 2065 6432 3535 3139  ..return ed25519
    │ │ │ -00069090: 5f73 6967 6e28 7b73 7472 2c20 6c65 6e7d  _sign({str, len}
    │ │ │ -000690a0: 2c20 706b 2c20 736b 293b 0a7d 0a0a 6974  , pk, sk);.}..it
    │ │ │ -000690b0: 656d 3a3a 6974 656d 2870 7562 6c69 635f  em::item(public_
    │ │ │ -000690c0: 6b65 7920 636f 6e73 7426 616d 703b 2070  key const& p
    │ │ │ -000690d0: 6b2c 2073 7061 6e26 6c74 3b63 6861 7220  k, span<char 
    │ │ │ -000690e0: 636f 6e73 7426 6774 3b20 7361 6c74 290a  const> salt).
    │ │ │ -000690f0: 093a 206d 5f73 616c 7428 7361 6c74 2e64  .: m_salt(salt.d
    │ │ │ -00069100: 6174 6128 292c 2073 7461 7469 635f 6361  ata(), static_ca
    │ │ │ -00069110: 7374 266c 743b 7374 643a 3a73 697a 655f  st<std::size_
    │ │ │ -00069120: 7426 6774 3b28 7361 6c74 2e73 697a 6528  t>(salt.size(
    │ │ │ -00069130: 2929 290a 092c 206d 5f70 6b28 706b 290a  ))).., m_pk(pk).
    │ │ │ -00069140: 092c 206d 5f6d 7574 6162 6c65 2874 7275  ., m_mutable(tru
    │ │ │ -00069150: 6529 0a7b 7d0a 0a69 7465 6d3a 3a69 7465  e).{}..item::ite
    │ │ │ -00069160: 6d28 656e 7472 7920 7629 0a09 3a20 6d5f  m(entry v)..: m_
    │ │ │ -00069170: 7661 6c75 6528 7374 643a 3a6d 6f76 6528  value(std::move(
    │ │ │ -00069180: 7629 290a 7b7d 0a0a 6974 656d 3a3a 6974  v)).{}..item::it
    │ │ │ -00069190: 656d 2862 6465 636f 6465 5f6e 6f64 6520  em(bdecode_node 
    │ │ │ -000691a0: 636f 6e73 7426 616d 703b 2076 290a 7b0a  const& v).{.
    │ │ │ -000691b0: 3c64 6976 2073 7479 6c65 3d22 6261 636b  
    .m │ │ │ -000691e0: 5f76 616c 7565 203d 2076 3b0a 3c2f 6469 _value = v;.}..item::item( │ │ │ -00069200: 656e 7472 7920 762c 2073 7061 6e26 6c74 entry v, span< │ │ │ -00069210: 3b63 6861 7220 636f 6e73 7426 6774 3b20 ;char const> │ │ │ -00069220: 7361 6c74 0a09 2c20 7365 7175 656e 6365 salt.., sequence │ │ │ -00069230: 5f6e 756d 6265 7220 636f 6e73 7420 7365 _number const se │ │ │ -00069240: 712c 2070 7562 6c69 635f 6b65 7920 636f q, public_key co │ │ │ -00069250: 6e73 7426 616d 703b 2070 6b2c 2073 6563 nst& pk, sec │ │ │ -00069260: 7265 745f 6b65 7920 636f 6e73 7426 616d ret_key const&am │ │ │ -00069270: 703b 2073 6b29 0a7b 0a09 6173 7369 676e p; sk).{..assign │ │ │ -00069280: 2873 7464 3a3a 6d6f 7665 2876 292c 2073 (std::move(v), s │ │ │ -00069290: 616c 742c 2073 6571 2c20 706b 2c20 736b alt, seq, pk, sk │ │ │ -000692a0: 293b 0a7d 0a0a 766f 6964 2069 7465 6d3a );.}..void item: │ │ │ -000692b0: 3a61 7373 6967 6e28 656e 7472 7920 7629 :assign(entry v) │ │ │ -000692c0: 0a7b 0a09 6d5f 6d75 7461 626c 6520 3d20 .{..m_mutable = │ │ │ -000692d0: 6661 6c73 653b 0a09 6d5f 7661 6c75 6520 false;..m_value │ │ │ -000692e0: 3d20 7374 643a 3a6d 6f76 6528 7629 3b0a = std::move(v);. │ │ │ -000692f0: 7d0a 0a76 6f69 6420 6974 656d 3a3a 6173 }..void item::as │ │ │ -00069300: 7369 676e 2865 6e74 7279 2076 2c20 7370 sign(entry v, sp │ │ │ -00069310: 616e 266c 743b 6368 6172 2063 6f6e 7374 an<char const │ │ │ -00069320: 2667 743b 2073 616c 740a 092c 2073 6571 > salt.., seq │ │ │ -00069330: 7565 6e63 655f 6e75 6d62 6572 2063 6f6e uence_number con │ │ │ -00069340: 7374 2073 6571 2c20 7075 626c 6963 5f6b st seq, public_k │ │ │ -00069350: 6579 2063 6f6e 7374 2661 6d70 3b20 706b ey const& pk │ │ │ -00069360: 2c20 7365 6372 6574 5f6b 6579 2063 6f6e , secret_key con │ │ │ -00069370: 7374 2661 6d70 3b20 736b 290a 7b0a 0973 st& sk).{..s │ │ │ -00069380: 7464 3a3a 6172 7261 7926 6c74 3b63 6861 td::array<cha │ │ │ -00069390: 722c 2031 3030 3026 6774 3b20 6275 6666 r, 1000> buff │ │ │ -000693a0: 6572 3b0a 0969 6e74 2063 6f6e 7374 2062 er;..int const b │ │ │ -000693b0: 7369 7a65 203d 2062 656e 636f 6465 2862 size = bencode(b │ │ │ -000693c0: 7566 6665 722e 6265 6769 6e28 292c 2076 uffer.begin(), v │ │ │ -000693d0: 293b 0a09 544f 5252 454e 545f 4153 5345 );..TORRENT_ASSE │ │ │ -000693e0: 5254 2862 7369 7a65 2026 6c74 3b3d 2031 RT(bsize <= 1 │ │ │ -000693f0: 3030 3029 3b0a 096d 5f73 6967 203d 2073 000);..m_sig = s │ │ │ -00069400: 6967 6e5f 6d75 7461 626c 655f 6974 656d ign_mutable_item │ │ │ -00069410: 2873 7061 6e26 6c74 3b63 6861 7220 636f (span<char co │ │ │ -00069420: 6e73 7426 6774 3b28 6275 6666 6572 292e nst>(buffer). │ │ │ -00069430: 6669 7273 7428 6273 697a 6529 0a09 092c first(bsize)..., │ │ │ -00069440: 2073 616c 742c 2073 6571 2c20 706b 2c20 salt, seq, pk, │ │ │ -00069450: 736b 293b 0a09 6d5f 7361 6c74 2e61 7373 sk);..m_salt.ass │ │ │ -00069460: 6967 6e28 7361 6c74 2e64 6174 6128 292c ign(salt.data(), │ │ │ -00069470: 2073 7461 7469 635f 6361 7374 266c 743b static_cast< │ │ │ -00069480: 7374 643a 3a73 697a 655f 7426 6774 3b28 std::size_t>( │ │ │ -00069490: 7361 6c74 2e73 697a 6528 2929 293b 0a09 salt.size()));.. │ │ │ -000694a0: 6d5f 706b 203d 2070 6b3b 0a09 6d5f 7365 m_pk = pk;..m_se │ │ │ -000694b0: 7120 3d20 7365 713b 0a09 6d5f 6d75 7461 q = seq;..m_muta │ │ │ -000694c0: 626c 6520 3d20 7472 7565 3b0a 096d 5f76 ble = true;..m_v │ │ │ -000694d0: 616c 7565 203d 2073 7464 3a3a 6d6f 7665 alue = std::move │ │ │ -000694e0: 2876 293b 0a7d 0a0a 766f 6964 2069 7465 (v);.}..void ite │ │ │ -000694f0: 6d3a 3a61 7373 6967 6e28 6264 6563 6f64 m::assign(bdecod │ │ │ -00069500: 655f 6e6f 6465 2063 6f6e 7374 2661 6d70 e_node const& │ │ │ -00069510: 3b20 7629 0a3c 2f70 7265 3e3c 2f74 643e ; v).
    │ │ │ -00069520: 3c2f 7472 3e3c 7472 2073 7479 6c65 3d22 relevance& │ │ │ -00069550: 6e62 7370 3b30 3c2f 7464 3e3c 7464 3e3c nbsp;0< │ │ │ -00069560: 6120 6872 6566 3d22 6a61 7661 7363 7269 a href="javascri │ │ │ -00069570: 7074 3a65 7870 616e 6428 3234 3229 223e pt:expand(242)"> │ │ │ -00069580: 2e2e 2f73 7263 2f6b 6164 656d 6c69 612f ../src/kademlia/ │ │ │ -00069590: 6e6f 6465 5f69 642e 6370 703a 3636 3c2f node_id.cpp:66it's │ │ │ -000695b0: 6120 6c69 7474 6c65 2062 6974 2077 6569 a little bit wei │ │ │ -000695c0: 7264 2074 6f20 7265 7475 726e 2031 3539 rd to return 159 │ │ │ -000695d0: 202d 206c 6561 6469 6e67 207a 6572 6f65 - leading zeroe │ │ │ -000695e0: 732e 2049 7420 7368 6f75 6c64 2070 726f s. It should pro │ │ │ -000695f0: 6261 626c 7920 6265 2031 3630 202d 206c bably be 160 - l │ │ │ -00069600: 6561 6469 6e67 207a 6572 6f65 732c 2062 eading zeroes, b │ │ │ -00069610: 7574 2061 6c6c 206f 7468 6572 2063 6f64 ut all other cod │ │ │ -00069620: 6520 696e 2068 6572 6520 6973 2074 756e e in here is tun │ │ │ -00069630: 6564 2074 6f20 7468 6973 2065 7870 6563 ed to this expec │ │ │ -00069640: 7461 7469 6f6e 206e 6f77 2c20 616e 6420 tation now, and │ │ │ -00069650: 6974 2064 6f65 736e 2774 2072 6561 6c6c it doesn't reall │ │ │ -00069660: 7920 6d61 7474 6572 2028 6f74 6865 7220 y matter (other │ │ │ -00069670: 7468 616e 2063 6f6d 706c 6578 6974 7929 than complexity) │ │ │ -00069680: 3c2f 7464 3e3c 2f74 723e 3c74 7220 6964

    it │ │ │ -000696d0: 2773 2061 206c 6974 746c 6520 6269 7420 's a little bit │ │ │ -000696e0: 7765 6972 6420 746f 2072 6574 7572 6e20 weird to return │ │ │ -000696f0: 3135 3920 2d20 6c65 6164 696e 6720 7a65 159 - leading ze │ │ │ -00069700: 726f 6573 2e20 4974 2073 686f 756c 640a roes. It should. │ │ │ -00069710: 7072 6f62 6162 6c79 2062 6520 3136 3020 probably be 160 │ │ │ -00069720: 2d20 6c65 6164 696e 6720 7a65 726f 6573 - leading zeroes │ │ │ -00069730: 2c20 6275 7420 616c 6c20 6f74 6865 7220 , but all other │ │ │ -00069740: 636f 6465 2069 6e20 6865 7265 2069 7320 code in here is │ │ │ -00069750: 7475 6e65 6420 746f 0a74 6869 7320 6578 tuned to.this ex │ │ │ -00069760: 7065 6374 6174 696f 6e20 6e6f 772c 2061 pectation now, a │ │ │ -00069770: 6e64 2069 7420 646f 6573 6e27 7420 7265 nd it doesn't re │ │ │ -00069780: 616c 6c79 206d 6174 7465 7220 286f 7468 ally matter (oth │ │ │ -00069790: 6572 2074 6861 6e20 636f 6d70 6c65 7869 er than complexi │ │ │ -000697a0: 7479 293c 2f68 323e 3c68 343e 2e2e 2f73 ty)

    ../s │ │ │ -000697b0: 7263 2f6b 6164 656d 6c69 612f 6e6f 6465 rc/kademlia/node │ │ │ -000697c0: 5f69 642e 6370 703a 3636 3c2f 6834 3e3c _id.cpp:66

    < │ │ │ -000697d0: 7072 6520 7374 796c 653d 2262 6163 6b67 pre style="backg │ │ │ -000697e0: 726f 756e 643a 2023 6636 6636 6636 3b20 round: #f6f6f6; │ │ │ -000697f0: 626f 7264 6572 3a20 736f 6c69 6420 3170 border: solid 1p │ │ │ -00069800: 7820 2364 6464 3b22 3e0a 2f2f 2072 6574 x #ddd;">.// ret │ │ │ -00069810: 7572 6e73 2074 6865 2064 6973 7461 6e63 urns the distanc │ │ │ -00069820: 6520 6265 7477 6565 6e20 7468 6520 7477 e between the tw │ │ │ -00069830: 6f20 6e6f 6465 730a 2f2f 2075 7369 6e67 o nodes.// using │ │ │ -00069840: 2074 6865 206b 6164 656d 6c69 6120 584f the kademlia XO │ │ │ -00069850: 522d 6d65 7472 6963 0a6e 6f64 655f 6964 R-metric.node_id │ │ │ -00069860: 2064 6973 7461 6e63 6528 6e6f 6465 5f69 distance(node_i │ │ │ -00069870: 6420 636f 6e73 7426 616d 703b 206e 312c d const& n1, │ │ │ -00069880: 206e 6f64 655f 6964 2063 6f6e 7374 2661 node_id const&a │ │ │ -00069890: 6d70 3b20 6e32 290a 7b0a 0972 6574 7572 mp; n2).{..retur │ │ │ -000698a0: 6e20 6e31 205e 206e 323b 0a7d 0a0a 2f2f n n1 ^ n2;.}..// │ │ │ -000698b0: 2072 6574 7572 6e73 2074 7275 6520 6966 returns true if │ │ │ -000698c0: 3a20 6469 7374 616e 6365 286e 312c 2072 : distance(n1, r │ │ │ -000698d0: 6566 2920 266c 743b 2064 6973 7461 6e63 ef) < distanc │ │ │ -000698e0: 6528 6e32 2c20 7265 6629 0a62 6f6f 6c20 e(n2, ref).bool │ │ │ -000698f0: 636f 6d70 6172 655f 7265 6628 6e6f 6465 compare_ref(node │ │ │ -00069900: 5f69 6420 636f 6e73 7426 616d 703b 206e _id const& n │ │ │ -00069910: 312c 206e 6f64 655f 6964 2063 6f6e 7374 1, node_id const │ │ │ -00069920: 2661 6d70 3b20 6e32 2c20 6e6f 6465 5f69 & n2, node_i │ │ │ -00069930: 6420 636f 6e73 7426 616d 703b 2072 6566 d const& ref │ │ │ -00069940: 290a 7b0a 096e 6f64 655f 6964 2063 6f6e ).{..node_id con │ │ │ -00069950: 7374 206c 6873 203d 206e 3120 5e20 7265 st lhs = n1 ^ re │ │ │ -00069960: 663b 0a09 6e6f 6465 5f69 6420 636f 6e73 f;..node_id cons │ │ │ -00069970: 7420 7268 7320 3d20 6e32 205e 2072 6566 t rhs = n2 ^ ref │ │ │ -00069980: 3b0a 0972 6574 7572 6e20 6c68 7320 266c ;..return lhs &l │ │ │ -00069990: 743b 2072 6873 3b0a 7d0a 0a2f 2f20 7265 t; rhs;.}..// re │ │ │ -000699a0: 7475 726e 7320 6e20 696e 3a20 325e 6e20 turns n in: 2^n │ │ │ -000699b0: 266c 743b 3d20 6469 7374 616e 6365 286e <= distance(n │ │ │ -000699c0: 312c 206e 3229 2026 6c74 3b20 325e 286e 1, n2) < 2^(n │ │ │ -000699d0: 2b31 290a 2f2f 2075 7365 6675 6c20 666f +1).// useful fo │ │ │ -000699e0: 7220 6669 6e64 696e 6720 6f75 7420 7768 r finding out wh │ │ │ -000699f0: 6963 6820 6275 636b 6574 2061 206e 6f64 ich bucket a nod │ │ │ -00069a00: 6520 6265 6c6f 6e67 7320 746f 0a69 6e74 e belongs to.int │ │ │ -00069a10: 2064 6973 7461 6e63 655f 6578 7028 6e6f distance_exp(no │ │ │ -00069a20: 6465 5f69 6420 636f 6e73 7426 616d 703b de_id const& │ │ │ -00069a30: 206e 312c 206e 6f64 655f 6964 2063 6f6e n1, node_id con │ │ │ -00069a40: 7374 2661 6d70 3b20 6e32 290a 7b0a 3c64 st& n2).{..ret │ │ │ -00069a80: 7572 6e20 7374 643a 3a6d 6178 2831 3539 urn std::max(159 │ │ │ -00069a90: 202d 2064 6973 7461 6e63 6528 6e31 2c20 - distance(n1, │ │ │ -00069aa0: 6e32 292e 636f 756e 745f 6c65 6164 696e n2).count_leadin │ │ │ -00069ab0: 675f 7a65 726f 6573 2829 2c20 3029 3b0a g_zeroes(), 0);. │ │ │ -00069ac0: 3c2f 6469 763e 7d0a 0a69 6e74 206d 696e }..int min │ │ │ -00069ad0: 5f64 6973 7461 6e63 655f 6578 7028 6e6f _distance_exp(no │ │ │ -00069ae0: 6465 5f69 6420 636f 6e73 7426 616d 703b de_id const& │ │ │ -00069af0: 206e 312c 2073 7464 3a3a 7665 6374 6f72 n1, std::vector │ │ │ -00069b00: 266c 743b 6e6f 6465 5f69 6426 6774 3b20 <node_id> │ │ │ -00069b10: 636f 6e73 7426 616d 703b 2069 6473 290a const& ids). │ │ │ -00069b20: 7b0a 0954 4f52 5245 4e54 5f41 5353 4552 {..TORRENT_ASSER │ │ │ -00069b30: 5428 6964 732e 7369 7a65 2829 2026 6774 T(ids.size() > │ │ │ -00069b40: 3b20 3029 3b0a 0a09 696e 7420 6d69 6e20 ; 0);...int min │ │ │ -00069b50: 3d20 3136 303b 202f 2f20 7365 6520 6469 = 160; // see di │ │ │ -00069b60: 7374 616e 6365 5f65 7870 2066 6f72 2074 stance_exp for t │ │ │ -00069b70: 6865 2077 6879 206f 6620 7468 6973 2063 he why of this c │ │ │ -00069b80: 6f6e 7374 616e 740a 0966 6f72 2028 6175 onstant..for (au │ │ │ -00069b90: 746f 2063 6f6e 7374 2661 6d70 3b20 6e6f to const& no │ │ │ -00069ba0: 6465 5f69 6420 3a20 6964 7329 0a09 7b0a de_id : ids)..{. │ │ │ -00069bb0: 0909 6d69 6e20 3d20 7374 643a 3a6d 696e ..min = std::min │ │ │ -00069bc0: 286d 696e 2c20 6469 7374 616e 6365 5f65 (min, distance_e │ │ │ -00069bd0: 7870 286e 312c 206e 6f64 655f 6964 2929 xp(n1, node_id)) │ │ │ -00069be0: 3b0a 097d 0a0a 0972 6574 7572 6e20 6d69 ;..}...return mi │ │ │ -00069bf0: 6e3b 0a7d 0a0a 6e6f 6465 5f69 6420 6765 n;.}..node_id ge │ │ │ -00069c00: 6e65 7261 7465 5f69 645f 696d 706c 2861 nerate_id_impl(a │ │ │ -00069c10: 6464 7265 7373 2063 6f6e 7374 2661 6d70 ddress const& │ │ │ -00069c20: 3b20 6970 5f2c 2073 7464 3a3a 7569 6e74 ; ip_, std::uint │ │ │ -00069c30: 3332 5f74 2072 290a 7b0a 0973 7464 3a3a 32_t r).{..std:: │ │ │ -00069c40: 7569 6e74 385f 742a 2069 7020 3d20 6e75 uint8_t* ip = nu │ │ │ -00069c50: 6c6c 7074 723b 0a0a 0973 7461 7469 6320 llptr;...static │ │ │ -00069c60: 7374 643a 3a75 696e 7438 5f74 2063 6f6e std::uint8_t con │ │ │ -00069c70: 7374 2076 346d 6173 6b5b 5d20 3d20 7b20 st v4mask[] = { │ │ │ -00069c80: 3078 3033 2c20 3078 3066 2c20 3078 3366 0x03, 0x0f, 0x3f │ │ │ -00069c90: 2c20 3078 6666 207d 3b0a 0973 7461 7469 , 0xff };..stati │ │ │ -00069ca0: 6320 7374 643a 3a75 696e 7438 5f74 2063 c std::uint8_t c │ │ │ -00069cb0: 6f6e 7374 2076 366d 6173 6b5b 5d20 3d20 onst v6mask[] = │ │ │ -00069cc0: 7b20 3078 3031 2c20 3078 3033 2c20 3078 { 0x01, 0x03, 0x │ │ │ -00069cd0: 3037 2c20 3078 3066 2c20 3078 3166 2c20 07, 0x0f, 0x1f, │ │ │ -00069ce0: 3078 3366 2c20 3078 3766 2c20 3078 6666 0x3f, 0x7f, 0xff │ │ │ -00069cf0: 207d 3b0a 0973 7464 3a3a 7569 6e74 385f };..std::uint8_ │ │ │ -00069d00: 7420 636f 6e73 742a 206d 6173 6b20 3d20 t const* mask = │ │ │ -00069d10: 6e75 6c6c 7074 723b 0a09 696e 7420 6e75 nullptr;..int nu │ │ │ -00069d20: 6d5f 6f63 7465 7473 203d 2030 3b0a 0a09 m_octets = 0;... │ │ │ -00069d30: 6164 6472 6573 735f 7634 3a3a 6279 7465 address_v4::byte │ │ │ -00069d40: 735f 7479 7065 2062 347b 7d3b 0a09 6164 s_type b4{};..ad │ │ │ -00069d50: 6472 6573 735f 7636 3a3a 6279 7465 735f dress_v6::bytes_ │ │ │ -00069d60: 7479 7065 2062 367b 7d3b 0a09 6966 2028 type b6{};..if ( │ │ │ -00069d70: 6970 5f2e 6973 5f76 3628 2929 0a09 7b0a ip_.is_v6())..{. │ │ │ -00069d80: 0909 6236 203d 2069 705f 2e74 6f5f 7636 ..b6 = ip_.to_v6 │ │ │ -00069d90: 2829 2e74 6f5f 6279 7465 7328 293b 0a09 ().to_bytes();.. │ │ │ -00069da0: 0969 7020 3d20 6236 2e64 6174 6128 293b .ip = b6.data(); │ │ │ -00069db0: 0a3c 2f70 7265 3e3c 2f74 643e 3c2f 7472 .
    relevance  │ │ │ -00069df0: 3b30 3c2f 7464 3e3c 7464 3e3c 6120 6872 ;0../s │ │ │ -00069e20: 7263 2f6b 6164 656d 6c69 612f 7075 745f rc/kademlia/put_ │ │ │ -00069e30: 6461 7461 2e63 7070 3a39 323c 2f61 3e3c data.cpp:92< │ │ │ -00069e40: 2f74 643e 3c74 643e 7768 6174 2069 6620 /td>what if │ │ │ -00069e50: 6f20 6973 206e 6f74 2061 6e20 696e 7374 o is not an inst │ │ │ -00069e60: 616e 6365 206f 6620 7075 745f 6461 7461 ance of put_data │ │ │ -00069e70: 5f6f 6273 6572 7665 723f 2054 6869 7320 _observer? This │ │ │ -00069e80: 6e65 6564 2074 6f20 6265 2072 6564 6573 need to be redes │ │ │ -00069e90: 6967 6e65 6420 666f 7220 6265 7474 6572 igned for better │ │ │ -00069ea0: 2074 7970 6520 7361 6665 7479 2e3c 2f74 type safety.

    what │ │ │ -00069f00: 6966 206f 2069 7320 6e6f 7420 616e 2069 if o is not an i │ │ │ -00069f10: 6e73 7461 6e63 6520 6f66 2070 7574 5f64 nstance of put_d │ │ │ -00069f20: 6174 615f 6f62 7365 7276 6572 3f20 5468 ata_observer? Th │ │ │ -00069f30: 6973 206e 6565 6420 746f 2062 650a 7265 is need to be.re │ │ │ -00069f40: 6465 7369 676e 6564 2066 6f72 2062 6574 designed for bet │ │ │ -00069f50: 7465 7220 7479 7065 2073 6166 6574 792e ter type safety. │ │ │ -00069f60: 3c2f 6832 3e3c 6834 3e2e 2e2f 7372 632f

    ../src/ │ │ │ -00069f70: 6b61 6465 6d6c 6961 2f70 7574 5f64 6174 kademlia/put_dat │ │ │ -00069f80: 612e 6370 703a 3932 3c2f 6834 3e3c 7072 a.cpp:92

    .}.}..voi │ │ │ -00069fd0: 6420 7075 745f 6461 7461 3a3a 646f 6e65 d put_data::done │ │ │ -00069fe0: 2829 0a7b 0a09 6d5f 646f 6e65 203d 2074 ().{..m_done = t │ │ │ -00069ff0: 7275 653b 0a0a 2369 666e 6465 6620 544f rue;..#ifndef TO │ │ │ -0006a000: 5252 454e 545f 4449 5341 424c 455f 4c4f RRENT_DISABLE_LO │ │ │ -0006a010: 4747 494e 470a 0967 6574 5f6e 6f64 6528 GGING..get_node( │ │ │ -0006a020: 292e 6f62 7365 7276 6572 2829 2d26 6774 ).observer()-> │ │ │ -0006a030: 3b6c 6f67 2864 6874 5f6c 6f67 6765 723a ;log(dht_logger: │ │ │ -0006a040: 3a74 7261 7665 7273 616c 2c20 225b 2575 :traversal, "[%u │ │ │ -0006a050: 5d20 2573 2044 4f4e 452c 2072 6573 706f ] %s DONE, respo │ │ │ -0006a060: 6e73 6520 2564 2c20 7469 6d65 6f75 7420 nse %d, timeout │ │ │ -0006a070: 2564 220a 0909 2c20 6964 2829 2c20 6e61 %d"..., id(), na │ │ │ -0006a080: 6d65 2829 2c20 6e75 6d5f 7265 7370 6f6e me(), num_respon │ │ │ -0006a090: 7365 7328 292c 206e 756d 5f74 696d 656f ses(), num_timeo │ │ │ -0006a0a0: 7574 7328 2929 3b0a 2365 6e64 6966 0a0a uts());.#endif.. │ │ │ -0006a0b0: 096d 5f70 7574 5f63 616c 6c62 6163 6b28 .m_put_callback( │ │ │ -0006a0c0: 6d5f 6461 7461 2c20 6e75 6d5f 7265 7370 m_data, num_resp │ │ │ -0006a0d0: 6f6e 7365 7328 2929 3b0a 0974 7261 7665 onses());..trave │ │ │ -0006a0e0: 7273 616c 5f61 6c67 6f72 6974 686d 3a3a rsal_algorithm:: │ │ │ -0006a0f0: 646f 6e65 2829 3b0a 7d0a 0a62 6f6f 6c20 done();.}..bool │ │ │ -0006a100: 7075 745f 6461 7461 3a3a 696e 766f 6b65 put_data::invoke │ │ │ -0006a110: 286f 6273 6572 7665 725f 7074 7220 6f29 (observer_ptr o) │ │ │ -0006a120: 0a7b 0a09 6966 2028 6d5f 646f 6e65 2920 .{..if (m_done) │ │ │ -0006a130: 7265 7475 726e 2066 616c 7365 3b0a 0a3c return false;..< │ │ │ -0006a140: 6469 7620 7374 796c 653d 2262 6163 6b67 div style="backg │ │ │ -0006a150: 726f 756e 643a 2023 6666 6666 3030 2220 round: #ffff00" │ │ │ -0006a160: 7769 6474 683d 2231 3030 2522 3e09 6175 width="100%">.au │ │ │ -0006a170: 746f 2a20 706f 203d 2073 7461 7469 635f to* po = static_ │ │ │ -0006a180: 6361 7374 266c 743b 7075 745f 6461 7461 cast<put_data │ │ │ -0006a190: 5f6f 6273 6572 7665 722a 2667 743b 286f _observer*>(o │ │ │ -0006a1a0: 2e67 6574 2829 293b 0a3c 2f64 6976 3e0a .get());.. │ │ │ -0006a1b0: 0965 6e74 7279 2065 3b0a 0965 5b22 7922 .entry e;..e["y" │ │ │ -0006a1c0: 5d20 3d20 2271 223b 0a09 655b 2271 225d ] = "q";..e["q"] │ │ │ -0006a1d0: 203d 2022 7075 7422 3b0a 0965 6e74 7279 = "put";..entry │ │ │ -0006a1e0: 2661 6d70 3b20 6120 3d20 655b 2261 225d & a = e["a"] │ │ │ -0006a1f0: 3b0a 0961 5b22 7622 5d20 3d20 6d5f 6461 ;..a["v"] = m_da │ │ │ -0006a200: 7461 2e76 616c 7565 2829 3b0a 0961 5b22 ta.value();..a[" │ │ │ -0006a210: 746f 6b65 6e22 5d20 3d20 706f 2d26 6774 token"] = po-> │ │ │ -0006a220: 3b6d 5f74 6f6b 656e 3b0a 0969 6620 286d ;m_token;..if (m │ │ │ -0006a230: 5f64 6174 612e 6973 5f6d 7574 6162 6c65 _data.is_mutable │ │ │ -0006a240: 2829 290a 097b 0a09 0961 5b22 6b22 5d20 ())..{...a["k"] │ │ │ -0006a250: 3d20 6d5f 6461 7461 2e70 6b28 292e 6279 = m_data.pk().by │ │ │ -0006a260: 7465 733b 0a09 0961 5b22 7365 7122 5d20 tes;...a["seq"] │ │ │ -0006a270: 3d20 6d5f 6461 7461 2e73 6571 2829 2e76 = m_data.seq().v │ │ │ -0006a280: 616c 7565 3b0a 0909 615b 2273 6967 225d alue;...a["sig"] │ │ │ -0006a290: 203d 206d 5f64 6174 612e 7369 6728 292e = m_data.sig(). │ │ │ -0006a2a0: 6279 7465 733b 0a09 0969 6620 2821 6d5f bytes;...if (!m_ │ │ │ -0006a2b0: 6461 7461 2e73 616c 7428 292e 656d 7074 data.salt().empt │ │ │ -0006a2c0: 7928 2929 0a09 097b 0a09 0909 615b 2273 y())...{....a["s │ │ │ -0006a2d0: 616c 7422 5d20 3d20 6d5f 6461 7461 2e73 alt"] = m_data.s │ │ │ -0006a2e0: 616c 7428 293b 0a09 097d 0a09 7d0a 0a09 alt();...}..}... │ │ │ -0006a2f0: 6d5f 6e6f 6465 2e73 7461 7473 5f63 6f75 m_node.stats_cou │ │ │ -0006a300: 6e74 6572 7328 292e 696e 635f 7374 6174 nters().inc_stat │ │ │ -0006a310: 735f 636f 756e 7465 7228 636f 756e 7465 s_counter(counte │ │ │ -0006a320: 7273 3a3a 6468 745f 7075 745f 6f75 7429 rs::dht_put_out) │ │ │ -0006a330: 3b0a 0a09 7265 7475 726e 206d 5f6e 6f64 ;...return m_nod │ │ │ -0006a340: 652e 6d5f 7270 632e 696e 766f 6b65 2865 e.m_rpc.invoke(e │ │ │ -0006a350: 2c20 6f2d 2667 743b 7461 7267 6574 5f65 , o->target_e │ │ │ -0006a360: 7028 292c 206f 293b 0a7d 0a0a 7d20 7d20 p(), o);.}..} } │ │ │ -0006a370: 2f2f 206e 616d 6573 7061 6365 206c 6962 // namespace lib │ │ │ -0006a380: 746f 7272 656e 743a 3a64 6874 0a3c 2f70 torrent::dht.

    re │ │ │ -0006a3c0: 6c65 7661 6e63 6526 6e62 7370 3b30 3c2f levance 0../src/k │ │ │ -0006a400: 6164 656d 6c69 612f 726f 7574 696e 675f ademlia/routing_ │ │ │ -0006a410: 7461 626c 652e 6370 703a 3238 393c 2f61 table.cpp:289This i │ │ │ -0006a430: 7320 7465 6d70 6f72 6172 792e 2046 6f72 s temporary. For │ │ │ -0006a440: 206e 6f77 2c20 6f6e 6c79 2072 6570 6f72 now, only repor │ │ │ -0006a450: 7420 7468 6520 6c61 7267 6573 7420 726f t the largest ro │ │ │ -0006a460: 7574 696e 6720 7461 626c 6520 286f 6620 uting table (of │ │ │ -0006a470: 706f 7465 6e74 6961 6c6c 7920 6d75 6c74 potentially mult │ │ │ -0006a480: 6970 6c65 206f 6e65 732c 2066 6f72 206d iple ones, for m │ │ │ -0006a490: 756c 7469 2d68 6f6d 6564 2073 7973 7465 ulti-homed syste │ │ │ -0006a4a0: 6d73 2920 696e 206e 6578 7420 6d61 6a6f ms) in next majo │ │ │ -0006a4b0: 7220 7665 7273 696f 6e2c 2062 7265 616b r version, break │ │ │ -0006a4c0: 2074 6865 2041 4249 2061 6e64 2073 7570 the ABI and sup │ │ │ -0006a4d0: 706f 7274 2072 6570 6f72 7469 6e67 2061 port reporting a │ │ │ -0006a4e0: 6c6c 206f 6620 7468 656d 2069 6e20 7468 ll of them in th │ │ │ -0006a4f0: 6520 6468 745f 7374 6174 735f 616c 6572 e dht_stats_aler │ │ │ -0006a500: 743c 2f74 643e 3c2f 7472 3e3c 7472 2069 t

    T │ │ │ -0006a550: 6869 7320 6973 2074 656d 706f 7261 7279 his is temporary │ │ │ -0006a560: 2e20 466f 7220 6e6f 772c 206f 6e6c 7920 . For now, only │ │ │ -0006a570: 7265 706f 7274 2074 6865 206c 6172 6765 report the large │ │ │ -0006a580: 7374 2072 6f75 7469 6e67 2074 6162 6c65 st routing table │ │ │ -0006a590: 0a28 6f66 2070 6f74 656e 7469 616c 6c79 .(of potentially │ │ │ -0006a5a0: 206d 756c 7469 706c 6520 6f6e 6573 2c20 multiple ones, │ │ │ -0006a5b0: 666f 7220 6d75 6c74 692d 686f 6d65 6420 for multi-homed │ │ │ -0006a5c0: 7379 7374 656d 7329 0a69 6e20 6e65 7874 systems).in next │ │ │ -0006a5d0: 206d 616a 6f72 2076 6572 7369 6f6e 2c20 major version, │ │ │ -0006a5e0: 6272 6561 6b20 7468 6520 4142 4920 616e break the ABI an │ │ │ -0006a5f0: 6420 7375 7070 6f72 7420 7265 706f 7274 d support report │ │ │ -0006a600: 696e 6720 616c 6c20 6f66 2074 6865 6d20 ing all of them │ │ │ -0006a610: 696e 0a74 6865 2064 6874 5f73 7461 7473 in.the dht_stats │ │ │ -0006a620: 5f61 6c65 7274 3c2f 6832 3e3c 6834 3e2e _alert

    . │ │ │ -0006a630: 2e2f 7372 632f 6b61 6465 6d6c 6961 2f72 ./src/kademlia/r │ │ │ -0006a640: 6f75 7469 6e67 5f74 6162 6c65 2e63 7070 outing_table.cpp │ │ │ -0006a650: 3a32 3839 3c2f 6834 3e3c 7072 6520 7374 :289

    ., m_bucket_s
    │ │ │ -0006a6a0: 697a 6528 6275 636b 6574 5f73 697a 6529  ize(bucket_size)
    │ │ │ -0006a6b0: 0a7b 0a09 2f2f 2062 7563 6b65 7420 7369  .{..// bucket si
    │ │ │ -0006a6c0: 7a65 7320 6d75 7374 2062 6520 6120 706f  zes must be a po
    │ │ │ -0006a6d0: 7765 7220 6f66 2032 0a09 544f 5252 454e  wer of 2..TORREN
    │ │ │ -0006a6e0: 545f 4153 5345 5254 5f56 414c 2828 2862  T_ASSERT_VAL(((b
    │ │ │ -0006a6f0: 7563 6b65 745f 7369 7a65 202d 2031 2920  ucket_size - 1) 
    │ │ │ -0006a700: 2661 6d70 3b20 6275 636b 6574 5f73 697a  & bucket_siz
    │ │ │ -0006a710: 6529 203d 3d20 302c 2062 7563 6b65 745f  e) == 0, bucket_
    │ │ │ -0006a720: 7369 7a65 293b 0a09 544f 5252 454e 545f  size);..TORRENT_
    │ │ │ -0006a730: 554e 5553 4544 286c 6f67 293b 0a09 6d5f  UNUSED(log);..m_
    │ │ │ -0006a740: 6275 636b 6574 732e 7265 7365 7276 6528  buckets.reserve(
    │ │ │ -0006a750: 3330 293b 0a7d 0a0a 696e 7420 726f 7574  30);.}..int rout
    │ │ │ -0006a760: 696e 675f 7461 626c 653a 3a62 7563 6b65  ing_table::bucke
    │ │ │ -0006a770: 745f 6c69 6d69 7428 696e 7420 6275 636b  t_limit(int buck
    │ │ │ -0006a780: 6574 2920 636f 6e73 740a 7b0a 0969 6620  et) const.{..if 
    │ │ │ -0006a790: 2821 6d5f 7365 7474 696e 6773 2e67 6574  (!m_settings.get
    │ │ │ -0006a7a0: 5f62 6f6f 6c28 7365 7474 696e 6773 5f70  _bool(settings_p
    │ │ │ -0006a7b0: 6163 6b3a 3a64 6874 5f65 7874 656e 6465  ack::dht_extende
    │ │ │ -0006a7c0: 645f 726f 7574 696e 675f 7461 626c 6529  d_routing_table)
    │ │ │ -0006a7d0: 2920 7265 7475 726e 206d 5f62 7563 6b65  ) return m_bucke
    │ │ │ -0006a7e0: 745f 7369 7a65 3b0a 0a09 7374 6174 6963  t_size;...static
    │ │ │ -0006a7f0: 2063 6f6e 7374 2061 7578 3a3a 6172 7261   const aux::arra
    │ │ │ -0006a800: 7926 6c74 3b69 6e74 2c20 3426 6774 3b20  y<int, 4> 
    │ │ │ -0006a810: 7369 7a65 5f65 7863 6570 7469 6f6e 737b  size_exceptions{
    │ │ │ -0006a820: 7b7b 3136 2c20 382c 2034 2c20 327d 7d7d  {{16, 8, 4, 2}}}
    │ │ │ -0006a830: 3b0a 0969 6620 2862 7563 6b65 7420 266c  ;..if (bucket &l
    │ │ │ -0006a840: 743b 2073 697a 655f 6578 6365 7074 696f  t; size_exceptio
    │ │ │ -0006a850: 6e73 2e65 6e64 5f69 6e64 6578 2829 290a  ns.end_index()).
    │ │ │ -0006a860: 0909 7265 7475 726e 206d 5f62 7563 6b65  ..return m_bucke
    │ │ │ -0006a870: 745f 7369 7a65 202a 2073 697a 655f 6578  t_size * size_ex
    │ │ │ -0006a880: 6365 7074 696f 6e73 5b62 7563 6b65 745d  ceptions[bucket]
    │ │ │ -0006a890: 3b0a 0972 6574 7572 6e20 6d5f 6275 636b  ;..return m_buck
    │ │ │ -0006a8a0: 6574 5f73 697a 653b 0a7d 0a0a 766f 6964  et_size;.}..void
    │ │ │ -0006a8b0: 2072 6f75 7469 6e67 5f74 6162 6c65 3a3a   routing_table::
    │ │ │ -0006a8c0: 7374 6174 7573 2873 7464 3a3a 7665 6374  status(std::vect
    │ │ │ -0006a8d0: 6f72 266c 743b 6468 745f 726f 7574 696e  or<dht_routin
    │ │ │ -0006a8e0: 675f 6275 636b 6574 2667 743b 2661 6d70  g_bucket>&
    │ │ │ -0006a8f0: 3b20 7329 2063 6f6e 7374 0a7b 0a3c 6469  ; s) const.{..if (
    │ │ │ -0006a930: 732e 7369 7a65 2829 2026 6774 3b20 6d5f  s.size() > m_
    │ │ │ -0006a940: 6275 636b 6574 732e 7369 7a65 2829 2920  buckets.size()) 
    │ │ │ -0006a950: 7265 7475 726e 3b0a 3c2f 6469 763e 0973  return;..s
    │ │ │ -0006a960: 2e63 6c65 6172 2829 3b0a 0966 6f72 2028  .clear();..for (
    │ │ │ -0006a970: 6175 746f 2063 6f6e 7374 2661 6d70 3b20  auto const& 
    │ │ │ -0006a980: 6920 3a20 6d5f 6275 636b 6574 7329 0a09  i : m_buckets)..
    │ │ │ -0006a990: 7b0a 0909 6468 745f 726f 7574 696e 675f  {...dht_routing_
    │ │ │ -0006a9a0: 6275 636b 6574 2062 3b0a 0909 622e 6e75  bucket b;...b.nu
    │ │ │ -0006a9b0: 6d5f 6e6f 6465 7320 3d20 696e 7428 692e  m_nodes = int(i.
    │ │ │ -0006a9c0: 6c69 7665 5f6e 6f64 6573 2e73 697a 6528  live_nodes.size(
    │ │ │ -0006a9d0: 2929 3b0a 0909 622e 6e75 6d5f 7265 706c  ));...b.num_repl
    │ │ │ -0006a9e0: 6163 656d 656e 7473 203d 2069 6e74 2869  acements = int(i
    │ │ │ -0006a9f0: 2e72 6570 6c61 6365 6d65 6e74 732e 7369  .replacements.si
    │ │ │ -0006aa00: 7a65 2829 293b 0a09 0973 2e70 7573 685f  ze());...s.push_
    │ │ │ -0006aa10: 6261 636b 2862 293b 0a09 7d0a 7d0a 0a23  back(b);..}.}..#
    │ │ │ -0006aa20: 6966 2054 4f52 5245 4e54 5f41 4249 5f56  if TORRENT_ABI_V
    │ │ │ -0006aa30: 4552 5349 4f4e 203d 3d20 310a 3c2f 7072  ERSION == 1.rel
    │ │ │ -0006aa70: 6576 616e 6365 266e 6273 703b 303c 2f74  evance 0../src/ka
    │ │ │ -0006aab0: 6465 6d6c 6961 2f72 6f75 7469 6e67 5f74  demlia/routing_t
    │ │ │ -0006aac0: 6162 6c65 2e63 7070 3a33 3134 3c2f 613e  able.cpp:314
    │ │ │ -0006aad0: 3c2f 7464 3e3c 7464 3e61 7276 6964 6e20  arvidn 
    │ │ │ -0006aae0: 6e6f 7465 2077 6865 6e20 6974 2773 2061  note when it's a
    │ │ │ -0006aaf0: 6372 6f73 7320 4950 7634 2061 6e64 2049  cross IPv4 and I
    │ │ │ -0006ab00: 5076 362c 2061 6464 696e 6720 2864 6874  Pv6, adding (dht
    │ │ │ -0006ab10: 5f67 6c6f 6261 6c5f 6e6f 6465 7329 2077  _global_nodes) w
    │ │ │ -0006ab20: 6f75 6c64 206d 616b 6520 7365 6e73 652e  ould make sense.
    │ │ │ -0006ab30: 2069 6e20 7468 6520 6675 7475 7265 2074   in the future t
    │ │ │ -0006ab40: 686f 7567 682c 2077 6865 7265 2077 6520  hough, where we 
    │ │ │ -0006ab50: 6d61 7920 6861 7665 206f 6e65 2044 4854  may have one DHT
    │ │ │ -0006ab60: 206e 6f64 6520 7065 7220 6578 7465 726e   node per extern
    │ │ │ -0006ab70: 616c 2069 6e74 6572 6661 6365 2028 7768  al interface (wh
    │ │ │ -0006ab80: 6963 6820 6d61 7920 6265 206d 756c 7469  ich may be multi
    │ │ │ -0006ab90: 706c 6520 6f66 2074 6865 2073 616d 6520  ple of the same 
    │ │ │ -0006aba0: 6164 6472 6573 7320 6661 6d69 6c79 292c  address family),
    │ │ │ -0006abb0: 2074 6865 6e20 6974 2062 6563 6f6d 6573   then it becomes
    │ │ │ -0006abc0: 2061 2062 6974 2074 7269 636b 6965 723c   a bit trickier<
    │ │ │ -0006abd0: 2f74 643e 3c2f 7472 3e3c 7472 2069 643d  /td>

    arv │ │ │ -0006ac20: 6964 6e20 6e6f 7465 0a77 6865 6e20 6974 idn note.when it │ │ │ -0006ac30: 2773 2061 6372 6f73 7320 4950 7634 2061 's across IPv4 a │ │ │ -0006ac40: 6e64 2049 5076 362c 2061 6464 696e 6720 nd IPv6, adding │ │ │ -0006ac50: 2864 6874 5f67 6c6f 6261 6c5f 6e6f 6465 (dht_global_node │ │ │ -0006ac60: 7329 2077 6f75 6c64 0a6d 616b 6520 7365 s) would.make se │ │ │ -0006ac70: 6e73 652e 2069 6e20 7468 6520 6675 7475 nse. in the futu │ │ │ -0006ac80: 7265 2074 686f 7567 682c 2077 6865 7265 re though, where │ │ │ -0006ac90: 2077 6520 6d61 7920 6861 7665 206f 6e65 we may have one │ │ │ -0006aca0: 2044 4854 206e 6f64 650a 7065 7220 6578 DHT node.per ex │ │ │ -0006acb0: 7465 726e 616c 2069 6e74 6572 6661 6365 ternal interface │ │ │ -0006acc0: 2028 7768 6963 6820 6d61 7920 6265 206d (which may be m │ │ │ -0006acd0: 756c 7469 706c 6520 6f66 2074 6865 2073 ultiple of the s │ │ │ -0006ace0: 616d 6520 6164 6472 6573 730a 6661 6d69 ame address.fami │ │ │ -0006acf0: 6c79 292c 2074 6865 6e20 6974 2062 6563 ly), then it bec │ │ │ -0006ad00: 6f6d 6573 2061 2062 6974 2074 7269 636b omes a bit trick │ │ │ -0006ad10: 6965 723c 2f68 323e 3c68 343e 2e2e 2f73 ier

    ../s │ │ │ -0006ad20: 7263 2f6b 6164 656d 6c69 612f 726f 7574 rc/kademlia/rout │ │ │ -0006ad30: 696e 675f 7461 626c 652e 6370 703a 3331 ing_table.cpp:31 │ │ │ -0006ad40: 343c 2f68 343e 3c70 7265 2073 7479 6c65 4

    │ │ │ -0006ad80: 0969 6620 2873 2e73 697a 6528 2920 2667  .if (s.size() &g
    │ │ │ -0006ad90: 743b 206d 5f62 7563 6b65 7473 2e73 697a  t; m_buckets.siz
    │ │ │ -0006ada0: 6528 2929 2072 6574 7572 6e3b 0a09 732e  e()) return;..s.
    │ │ │ -0006adb0: 636c 6561 7228 293b 0a09 666f 7220 2861  clear();..for (a
    │ │ │ -0006adc0: 7574 6f20 636f 6e73 7426 616d 703b 2069  uto const& i
    │ │ │ -0006add0: 203a 206d 5f62 7563 6b65 7473 290a 097b   : m_buckets)..{
    │ │ │ -0006ade0: 0a09 0964 6874 5f72 6f75 7469 6e67 5f62  ...dht_routing_b
    │ │ │ -0006adf0: 7563 6b65 7420 623b 0a09 0962 2e6e 756d  ucket b;...b.num
    │ │ │ -0006ae00: 5f6e 6f64 6573 203d 2069 6e74 2869 2e6c  _nodes = int(i.l
    │ │ │ -0006ae10: 6976 655f 6e6f 6465 732e 7369 7a65 2829  ive_nodes.size()
    │ │ │ -0006ae20: 293b 0a09 0962 2e6e 756d 5f72 6570 6c61  );...b.num_repla
    │ │ │ -0006ae30: 6365 6d65 6e74 7320 3d20 696e 7428 692e  cements = int(i.
    │ │ │ -0006ae40: 7265 706c 6163 656d 656e 7473 2e73 697a  replacements.siz
    │ │ │ -0006ae50: 6528 2929 3b0a 0909 732e 7075 7368 5f62  e());...s.push_b
    │ │ │ -0006ae60: 6163 6b28 6229 3b0a 097d 0a7d 0a0a 2369  ack(b);..}.}..#i
    │ │ │ -0006ae70: 6620 544f 5252 454e 545f 4142 495f 5645  f TORRENT_ABI_VE
    │ │ │ -0006ae80: 5253 494f 4e20 3d3d 2031 0a76 6f69 6420  RSION == 1.void 
    │ │ │ -0006ae90: 726f 7574 696e 675f 7461 626c 653a 3a73  routing_table::s
    │ │ │ -0006aea0: 7461 7475 7328 7365 7373 696f 6e5f 7374  tatus(session_st
    │ │ │ -0006aeb0: 6174 7573 2661 6d70 3b20 7329 2063 6f6e  atus& s) con
    │ │ │ -0006aec0: 7374 0a7b 0a09 696e 7420 6468 745f 6e6f  st.{..int dht_no
    │ │ │ -0006aed0: 6465 733b 0a09 696e 7420 6468 745f 6e6f  des;..int dht_no
    │ │ │ -0006aee0: 6465 5f63 6163 6865 3b0a 0969 6e74 2069  de_cache;..int i
    │ │ │ -0006aef0: 676e 6f72 653b 0a09 7374 643a 3a74 6965  gnore;..std::tie
    │ │ │ -0006af00: 2864 6874 5f6e 6f64 6573 2c20 6468 745f  (dht_nodes, dht_
    │ │ │ -0006af10: 6e6f 6465 5f63 6163 6865 2c20 6967 6e6f  node_cache, igno
    │ │ │ -0006af20: 7265 2920 3d20 7369 7a65 2829 3b0a 0973  re) = size();..s
    │ │ │ -0006af30: 2e64 6874 5f6e 6f64 6573 202b 3d20 6468  .dht_nodes += dh
    │ │ │ -0006af40: 745f 6e6f 6465 733b 0a09 732e 6468 745f  t_nodes;..s.dht_
    │ │ │ -0006af50: 6e6f 6465 5f63 6163 6865 202b 3d20 6468  node_cache += dh
    │ │ │ -0006af60: 745f 6e6f 6465 5f63 6163 6865 3b0a 3c64  t_node_cache;..s.d
    │ │ │ -0006afa0: 6874 5f67 6c6f 6261 6c5f 6e6f 6465 7320  ht_global_nodes 
    │ │ │ -0006afb0: 2b3d 206e 756d 5f67 6c6f 6261 6c5f 6e6f  += num_global_no
    │ │ │ -0006afc0: 6465 7328 293b 0a3c 2f64 6976 3e0a 0966  des();...f
    │ │ │ -0006afd0: 6f72 2028 6175 746f 2063 6f6e 7374 2661  or (auto const&a
    │ │ │ -0006afe0: 6d70 3b20 6920 3a20 6d5f 6275 636b 6574  mp; i : m_bucket
    │ │ │ -0006aff0: 7329 0a09 7b0a 0909 6468 745f 726f 7574  s)..{...dht_rout
    │ │ │ -0006b000: 696e 675f 6275 636b 6574 2062 3b0a 0909  ing_bucket b;...
    │ │ │ -0006b010: 622e 6e75 6d5f 6e6f 6465 7320 3d20 696e  b.num_nodes = in
    │ │ │ -0006b020: 7428 692e 6c69 7665 5f6e 6f64 6573 2e73  t(i.live_nodes.s
    │ │ │ -0006b030: 697a 6528 2929 3b0a 0909 622e 6e75 6d5f  ize());...b.num_
    │ │ │ -0006b040: 7265 706c 6163 656d 656e 7473 203d 2069  replacements = i
    │ │ │ -0006b050: 6e74 2869 2e72 6570 6c61 6365 6d65 6e74  nt(i.replacement
    │ │ │ -0006b060: 732e 7369 7a65 2829 293b 0a23 6966 2054  s.size());.#if T
    │ │ │ -0006b070: 4f52 5245 4e54 5f41 4249 5f56 4552 5349  ORRENT_ABI_VERSI
    │ │ │ -0006b080: 4f4e 203d 3d20 310a 0909 622e 6c61 7374  ON == 1...b.last
    │ │ │ -0006b090: 5f61 6374 6976 6520 3d20 303b 0a23 656e  _active = 0;.#en
    │ │ │ -0006b0a0: 6469 660a 0909 732e 6468 745f 726f 7574  dif...s.dht_rout
    │ │ │ -0006b0b0: 696e 675f 7461 626c 652e 7075 7368 5f62  ing_table.push_b
    │ │ │ -0006b0c0: 6163 6b28 6229 3b0a 097d 0a7d 0a23 656e  ack(b);..}.}.#en
    │ │ │ -0006b0d0: 6469 660a 0a73 7464 3a3a 7475 706c 6526  dif..std::tuple&
    │ │ │ -0006b0e0: 6c74 3b69 6e74 2c20 696e 742c 2069 6e74  lt;int, int, int
    │ │ │ -0006b0f0: 2667 743b 2072 6f75 7469 6e67 5f74 6162  > routing_tab
    │ │ │ -0006b100: 6c65 3a3a 7369 7a65 2829 2063 6f6e 7374  le::size() const
    │ │ │ -0006b110: 0a7b 0a09 696e 7420 6e6f 6465 7320 3d20  .{..int nodes = 
    │ │ │ -0006b120: 303b 0a09 696e 7420 7265 706c 6163 656d  0;..int replacem
    │ │ │ -0006b130: 656e 7473 203d 2030 3b0a 0969 6e74 2063  ents = 0;..int c
    │ │ │ -0006b140: 6f6e 6669 726d 6564 203d 2030 3b0a 0966  onfirmed = 0;..f
    │ │ │ -0006b150: 6f72 2028 6175 746f 2063 6f6e 7374 2661  or (auto const&a
    │ │ │ -0006b160: 6d70 3b20 6920 3a20 6d5f 6275 636b 6574  mp; i : m_bucket
    │ │ │ -0006b170: 7329 0a09 7b0a 0909 6e6f 6465 7320 2b3d  s)..{...nodes +=
    │ │ │ -0006b180: 2069 6e74 2869 2e6c 6976 655f 6e6f 6465   int(i.live_node
    │ │ │ -0006b190: 732e 7369 7a65 2829 293b 0a09 0963 6f6e  s.size());...con
    │ │ │ -0006b1a0: 6669 726d 6564 202b 3d20 7374 6174 6963  firmed += static
    │ │ │ -0006b1b0: 5f63 6173 7426 6c74 3b69 6e74 2667 743b  _cast<int>
    │ │ │ -0006b1c0: 2873 7464 3a3a 636f 756e 745f 6966 2869  (std::count_if(i
    │ │ │ -0006b1d0: 2e6c 6976 655f 6e6f 6465 732e 6265 6769  .live_nodes.begi
    │ │ │ -0006b1e0: 6e28 292c 2069 2e6c 6976 655f 6e6f 6465  n(), i.live_node
    │ │ │ -0006b1f0: 732e 656e 6428 290a 0909 092c 205b 5d28  s.end()...., [](
    │ │ │ -0006b200: 6e6f 6465 5f65 6e74 7279 2063 6f6e 7374  node_entry const
    │ │ │ -0006b210: 2661 6d70 3b20 6b29 207b 2072 6574 7572  & k) { retur
    │ │ │ -0006b220: 6e20 6b2e 636f 6e66 6972 6d65 6428 293b  n k.confirmed();
    │ │ │ -0006b230: 207d 2029 293b 0a0a 0909 7265 706c 6163   } ));....replac
    │ │ │ -0006b240: 656d 656e 7473 202b 3d20 696e 7428 692e  ements += int(i.
    │ │ │ -0006b250: 7265 706c 6163 656d 656e 7473 2e73 697a  replacements.siz
    │ │ │ -0006b260: 6528 2929 3b0a 097d 0a09 7265 7475 726e  e());..}..return
    │ │ │ -0006b270: 2073 7464 3a3a 6d61 6b65 5f74 7570 6c65   std::make_tuple
    │ │ │ -0006b280: 286e 6f64 6573 2c20 7265 706c 6163 656d  (nodes, replacem
    │ │ │ -0006b290: 656e 7473 2c20 636f 6e66 6972 6d65 6429  ents, confirmed)
    │ │ │ -0006b2a0: 3b0a 7d0a 0a3c 2f70 7265 3e3c 2f74 643e  ;.}..
    │ │ │ -0006b2b0: 3c2f 7472 3e3c 7472 2073 7479 6c65 3d22 relevance& │ │ │ -0006b2e0: 6e62 7370 3b30 3c2f 7464 3e3c 7464 3e3c nbsp;0< │ │ │ -0006b2f0: 6120 6872 6566 3d22 6a61 7661 7363 7269 a href="javascri │ │ │ -0006b300: 7074 3a65 7870 616e 6428 3234 3629 223e pt:expand(246)"> │ │ │ -0006b310: 2e2e 2f73 7263 2f6b 6164 656d 6c69 612f ../src/kademlia/ │ │ │ -0006b320: 726f 7574 696e 675f 7461 626c 652e 6370 routing_table.cp │ │ │ -0006b330: 703a 3531 383c 2f61 3e3c 2f74 643e 3c74 p:518this need to t │ │ │ -0006b350: 616b 6520 6275 636b 6574 2022 7072 6566 ake bucket "pref │ │ │ -0006b360: 6978 2220 696e 746f 2061 6363 6f75 6e74 ix" into account │ │ │ -0006b370: 2e20 4974 2073 686f 756c 6420 6265 2075 . It should be u │ │ │ -0006b380: 6e69 6669 6564 2077 6974 6820 6164 645f nified with add_ │ │ │ -0006b390: 6e6f 6465 5f69 6d70 6c28 293c 2f74 643e node_impl() │ │ │ -0006b3a0: 3c2f 7472 3e3c 7472 2069 643d 2232 3436

    this ne │ │ │ -0006b3f0: 6564 2074 6f20 7461 6b65 2062 7563 6b65 ed to take bucke │ │ │ -0006b400: 7420 2270 7265 6669 7822 2069 6e74 6f20 t "prefix" into │ │ │ -0006b410: 6163 636f 756e 742e 2049 7420 7368 6f75 account. It shou │ │ │ -0006b420: 6c64 2062 6520 756e 6966 6965 640a 7769 ld be unified.wi │ │ │ -0006b430: 7468 2061 6464 5f6e 6f64 655f 696d 706c th add_node_impl │ │ │ -0006b440: 2829 3c2f 6832 3e3c 6834 3e2e 2e2f 7372 ()

    ../sr │ │ │ -0006b450: 632f 6b61 6465 6d6c 6961 2f72 6f75 7469 c/kademlia/routi │ │ │ -0006b460: 6e67 5f74 6162 6c65 2e63 7070 3a35 3138 ng_table.cpp:518 │ │ │ -0006b470: 3c2f 6834 3e3c 7072 6520 7374 796c 653d

    {
    │ │ │ -0006b4b0: 0a09 666f 7220 2861 7574 6f20 6920 3d20  ..for (auto i = 
    │ │ │ -0006b4c0: 6d5f 6275 636b 6574 732e 6265 6769 6e28  m_buckets.begin(
    │ │ │ -0006b4d0: 2920 2c20 656e 6428 6d5f 6275 636b 6574  ) , end(m_bucket
    │ │ │ -0006b4e0: 732e 656e 6428 2929 3b20 6920 213d 2065  s.end()); i != e
    │ │ │ -0006b4f0: 6e64 3b20 2b2b 6929 0a09 7b0a 0909 666f  nd; ++i)..{...fo
    │ │ │ -0006b500: 7220 2861 7574 6f20 6a20 3d20 692d 2667  r (auto j = i-&g
    │ │ │ -0006b510: 743b 7265 706c 6163 656d 656e 7473 2e62  t;replacements.b
    │ │ │ -0006b520: 6567 696e 2829 3b20 6a20 213d 2069 2d26  egin(); j != i-&
    │ │ │ -0006b530: 6774 3b72 6570 6c61 6365 6d65 6e74 732e  gt;replacements.
    │ │ │ -0006b540: 656e 6428 293b 202b 2b6a 290a 0909 7b0a  end(); ++j)...{.
    │ │ │ -0006b550: 0909 0969 6620 286a 2d26 6774 3b61 6464  ...if (j->add
    │ │ │ -0006b560: 7228 2920 213d 2065 702e 6164 6472 6573  r() != ep.addres
    │ │ │ -0006b570: 7328 2929 2063 6f6e 7469 6e75 653b 0a09  s()) continue;..
    │ │ │ -0006b580: 0909 6966 2028 6a2d 2667 743b 706f 7274  ..if (j->port
    │ │ │ -0006b590: 2829 2021 3d20 6570 2e70 6f72 7428 2929  () != ep.port())
    │ │ │ -0006b5a0: 2063 6f6e 7469 6e75 653b 0a09 0909 7265   continue;....re
    │ │ │ -0006b5b0: 7475 726e 2073 7464 3a3a 6d61 6b65 5f74  turn std::make_t
    │ │ │ -0006b5c0: 7570 6c65 2826 616d 703b 2a6a 2c20 692c  uple(&*j, i,
    │ │ │ -0006b5d0: 2026 616d 703b 692d 2667 743b 7265 706c   &i->repl
    │ │ │ -0006b5e0: 6163 656d 656e 7473 293b 0a09 097d 0a09  acements);...}..
    │ │ │ -0006b5f0: 0966 6f72 2028 6175 746f 206a 203d 2069  .for (auto j = i
    │ │ │ -0006b600: 2d26 6774 3b6c 6976 655f 6e6f 6465 732e  ->live_nodes.
    │ │ │ -0006b610: 6265 6769 6e28 293b 206a 2021 3d20 692d  begin(); j != i-
    │ │ │ -0006b620: 2667 743b 6c69 7665 5f6e 6f64 6573 2e65  >live_nodes.e
    │ │ │ -0006b630: 6e64 2829 3b20 2b2b 6a29 0a09 097b 0a09  nd(); ++j)...{..
    │ │ │ -0006b640: 0909 6966 2028 6a2d 2667 743b 6164 6472  ..if (j->addr
    │ │ │ -0006b650: 2829 2021 3d20 6570 2e61 6464 7265 7373  () != ep.address
    │ │ │ -0006b660: 2829 2920 636f 6e74 696e 7565 3b0a 0909  ()) continue;...
    │ │ │ -0006b670: 0969 6620 286a 2d26 6774 3b70 6f72 7428  .if (j->port(
    │ │ │ -0006b680: 2920 213d 2065 702e 706f 7274 2829 2920  ) != ep.port()) 
    │ │ │ -0006b690: 636f 6e74 696e 7565 3b0a 0909 0972 6574  continue;....ret
    │ │ │ -0006b6a0: 7572 6e20 7374 643a 3a6d 616b 655f 7475  urn std::make_tu
    │ │ │ -0006b6b0: 706c 6528 2661 6d70 3b2a 6a2c 2069 2c20  ple(&*j, i, 
    │ │ │ -0006b6c0: 2661 6d70 3b69 2d26 6774 3b6c 6976 655f  &i->live_
    │ │ │ -0006b6d0: 6e6f 6465 7329 3b0a 0909 7d0a 097d 0a09  nodes);...}..}..
    │ │ │ -0006b6e0: 7265 7475 726e 2073 7464 3a3a 7475 706c  return std::tupl
    │ │ │ -0006b6f0: 6526 6c74 3b6e 6f64 655f 656e 7472 792a  e<node_entry*
    │ │ │ -0006b700: 2c20 726f 7574 696e 675f 7461 626c 653a  , routing_table:
    │ │ │ -0006b710: 3a74 6162 6c65 5f74 3a3a 6974 6572 6174  :table_t::iterat
    │ │ │ -0006b720: 6f72 2c20 6275 636b 6574 5f74 2a26 6774  or, bucket_t*>
    │ │ │ -0006b730: 3b0a 097b 6e75 6c6c 7074 722c 206d 5f62  ;..{nullptr, m_b
    │ │ │ -0006b740: 7563 6b65 7473 2e65 6e64 2829 2c20 6e75  uckets.end(), nu
    │ │ │ -0006b750: 6c6c 7074 727d 3b0a 7d0a 0a3c 6469 7620  llptr};.}..
    void ro │ │ │ -0006b790: 7574 696e 675f 7461 626c 653a 3a66 696c uting_table::fil │ │ │ -0006b7a0: 6c5f 6672 6f6d 5f72 6570 6c61 6365 6d65 l_from_replaceme │ │ │ -0006b7b0: 6e74 7328 7461 626c 655f 743a 3a69 7465 nts(table_t::ite │ │ │ -0006b7c0: 7261 746f 7220 6275 636b 6574 290a 3c2f rator bucket).{..bucket_t& │ │ │ -0006b7e0: 616d 703b 2062 203d 2062 7563 6b65 742d amp; b = bucket- │ │ │ -0006b7f0: 2667 743b 6c69 7665 5f6e 6f64 6573 3b0a >live_nodes;. │ │ │ -0006b800: 0962 7563 6b65 745f 7426 616d 703b 2072 .bucket_t& r │ │ │ -0006b810: 6220 3d20 6275 636b 6574 2d26 6774 3b72 b = bucket->r │ │ │ -0006b820: 6570 6c61 6365 6d65 6e74 733b 0a09 696e eplacements;..in │ │ │ -0006b830: 7420 636f 6e73 7420 6275 636b 6574 5f73 t const bucket_s │ │ │ -0006b840: 697a 6520 3d20 6275 636b 6574 5f6c 696d ize = bucket_lim │ │ │ -0006b850: 6974 2869 6e74 2873 7464 3a3a 6469 7374 it(int(std::dist │ │ │ -0006b860: 616e 6365 286d 5f62 7563 6b65 7473 2e62 ance(m_buckets.b │ │ │ -0006b870: 6567 696e 2829 2c20 6275 636b 6574 2929 egin(), bucket)) │ │ │ -0006b880: 293b 0a0a 0969 6620 2869 6e74 2862 2e73 );...if (int(b.s │ │ │ -0006b890: 697a 6528 2929 2026 6774 3b3d 2062 7563 ize()) >= buc │ │ │ -0006b8a0: 6b65 745f 7369 7a65 2920 7265 7475 726e ket_size) return │ │ │ -0006b8b0: 3b0a 0a09 2f2f 2073 6f72 7420 6279 2052 ;...// sort by R │ │ │ -0006b8c0: 5454 2066 6972 7374 2c20 746f 2066 696e TT first, to fin │ │ │ -0006b8d0: 6420 7468 6520 6e6f 6465 2077 6974 6820 d the node with │ │ │ -0006b8e0: 7468 6520 6c6f 7765 7374 0a09 2f2f 2052 the lowest..// R │ │ │ -0006b8f0: 5454 2074 6861 7420 6973 2070 696e 6765 TT that is pinge │ │ │ -0006b900: 640a 0973 7464 3a3a 736f 7274 2872 622e d..std::sort(rb. │ │ │ -0006b910: 6265 6769 6e28 292c 2072 622e 656e 6428 begin(), rb.end( │ │ │ -0006b920: 2929 3b0a 0a09 7768 696c 6520 2869 6e74 ));...while (int │ │ │ -0006b930: 2862 2e73 697a 6528 2929 2026 6c74 3b20 (b.size()) < │ │ │ -0006b940: 6275 636b 6574 5f73 697a 6520 2661 6d70 bucket_size & │ │ │ -0006b950: 3b26 616d 703b 2021 7262 2e65 6d70 7479 ;& !rb.empty │ │ │ -0006b960: 2829 290a 097b 0a09 0961 7574 6f20 6a20 ())..{...auto j │ │ │ -0006b970: 3d20 7374 643a 3a66 696e 645f 6966 2872 = std::find_if(r │ │ │ -0006b980: 622e 6265 6769 6e28 292c 2072 622e 656e b.begin(), rb.en │ │ │ -0006b990: 6428 292c 2073 7464 3a3a 6269 6e64 2826 d(), std::bind(& │ │ │ -0006b9a0: 616d 703b 6e6f 6465 5f65 6e74 7279 3a3a amp;node_entry:: │ │ │ -0006b9b0: 7069 6e67 6564 2c20 5f31 2929 3b0a 0909 pinged, _1));... │ │ │ -0006b9c0: 6966 2028 6a20 3d3d 2072 622e 656e 6428 if (j == rb.end( │ │ │ -0006b9d0: 2929 2062 7265 616b 3b0a 0909 622e 7075 )) break;...b.pu │ │ │ -0006b9e0: 7368 5f62 6163 6b28 2a6a 293b 0a09 0972 sh_back(*j);...r │ │ │ -0006b9f0: 622e 6572 6173 6528 6a29 3b0a 097d 0a7d b.erase(j);..}.} │ │ │ -0006ba00: 0a0a 766f 6964 2072 6f75 7469 6e67 5f74 ..void routing_t │ │ │ -0006ba10: 6162 6c65 3a3a 7072 756e 655f 656d 7074 able::prune_empt │ │ │ -0006ba20: 795f 6275 636b 6574 2829 0a7b 0a09 6966 y_bucket().{..if │ │ │ -0006ba30: 2028 6d5f 6275 636b 6574 732e 6261 636b (m_buckets.back │ │ │ -0006ba40: 2829 2e6c 6976 655f 6e6f 6465 732e 656d ().live_nodes.em │ │ │ -0006ba50: 7074 7928 290a 0909 2661 6d70 3b26 616d pty()...&&am │ │ │ -0006ba60: 703b 206d 5f62 7563 6b65 7473 2e62 6163 p; m_buckets.bac │ │ │ -0006ba70: 6b28 292e 7265 706c 6163 656d 656e 7473 k().replacements │ │ │ -0006ba80: 2e65 6d70 7479 2829 290a 097b 0a09 096d .empty())..{...m │ │ │ -0006ba90: 5f62 7563 6b65 7473 2e65 7261 7365 286d _buckets.erase(m │ │ │ -0006baa0: 5f62 7563 6b65 7473 2e65 6e64 2829 202d _buckets.end() - │ │ │ -0006bab0: 2031 293b 0a09 7d0a 7d0a 0a76 6f69 6420 1);..}.}..void │ │ │ -0006bac0: 726f 7574 696e 675f 7461 626c 653a 3a72 routing_table::r │ │ │ -0006bad0: 656d 6f76 655f 6e6f 6465 286e 6f64 655f emove_node(node_ │ │ │ -0006bae0: 656e 7472 792a 206e 2c20 6275 636b 6574 entry* n, bucket │ │ │ -0006baf0: 5f74 2a20 6229 0a3c 2f70 7265 3e3c 2f74 _t* b).
    relevanc │ │ │ -0006bb30: 6526 6e62 7370 3b30 3c2f 7464 3e3c 7464 e 0../src/kademli │ │ │ -0006bb70: 612f 6468 745f 7472 6163 6b65 722e 6370 a/dht_tracker.cp │ │ │ -0006bb80: 703a 3331 373c 2f61 3e3c 2f74 643e 3c74 p:317pick the close │ │ │ -0006bba0: 7374 206e 6f64 6520 7261 7468 6572 2074 st node rather t │ │ │ -0006bbb0: 6861 6e20 7468 6520 6669 7273 743c 2f74 han the first

    pick │ │ │ -0006bc10: 7468 6520 636c 6f73 6573 7420 6e6f 6465 the closest node │ │ │ -0006bc20: 2072 6174 6865 7220 7468 616e 2074 6865 rather than the │ │ │ -0006bc30: 2066 6972 7374 3c2f 6832 3e3c 6834 3e2e first

    . │ │ │ -0006bc40: 2e2f 7372 632f 6b61 6465 6d6c 6961 2f64 ./src/kademlia/d │ │ │ -0006bc50: 6874 5f74 7261 636b 6572 2e63 7070 3a33 ht_tracker.cpp:3 │ │ │ -0006bc60: 3137 3c2f 6834 3e3c 7072 6520 7374 796c 17

    .#ifndef TORREN
    │ │ │ -0006bcb0: 545f 4449 5341 424c 455f 4c4f 4747 494e  T_DISABLE_LOGGIN
    │ │ │ -0006bcc0: 470a 0909 6d5f 6c6f 672d 2667 743b 6c6f  G...m_log->lo
    │ │ │ -0006bcd0: 6728 6468 745f 6c6f 6767 6572 3a3a 7472  g(dht_logger::tr
    │ │ │ -0006bce0: 6163 6b65 722c 2022 2a2a 2a20 6e65 7720  acker, "*** new 
    │ │ │ -0006bcf0: 7772 6974 6520 6b65 792a 2a2a 2025 6420  write key*** %d 
    │ │ │ -0006bd00: 6e6f 6465 7322 0a09 0909 2c20 696e 7428  nodes"...., int(
    │ │ │ -0006bd10: 6d5f 6e6f 6465 732e 7369 7a65 2829 2929  m_nodes.size()))
    │ │ │ -0006bd20: 3b0a 2365 6e64 6966 0a09 7d0a 0a09 766f  ;.#endif..}...vo
    │ │ │ -0006bd30: 6964 2064 6874 5f74 7261 636b 6572 3a3a  id dht_tracker::
    │ │ │ -0006bd40: 7570 6461 7465 5f73 746f 7261 6765 5f6e  update_storage_n
    │ │ │ -0006bd50: 6f64 655f 6964 7328 290a 097b 0a09 0973  ode_ids()..{...s
    │ │ │ -0006bd60: 7464 3a3a 7665 6374 6f72 266c 743b 7368  td::vector<sh
    │ │ │ -0006bd70: 6131 5f68 6173 6826 6774 3b20 6964 733b  a1_hash> ids;
    │ │ │ -0006bd80: 0a09 0966 6f72 2028 6175 746f 2661 6d70  ...for (auto&
    │ │ │ -0006bd90: 3b20 6e20 3a20 6d5f 6e6f 6465 7329 0a09  ; n : m_nodes)..
    │ │ │ -0006bda0: 0909 6964 732e 7075 7368 5f62 6163 6b28  ..ids.push_back(
    │ │ │ -0006bdb0: 6e2e 7365 636f 6e64 2e64 6874 2e6e 6964  n.second.dht.nid
    │ │ │ -0006bdc0: 2829 293b 0a09 096d 5f73 746f 7261 6765  ());...m_storage
    │ │ │ -0006bdd0: 2e75 7064 6174 655f 6e6f 6465 5f69 6473  .update_node_ids
    │ │ │ -0006bde0: 2869 6473 293b 0a09 7d0a 0a09 6e6f 6465  (ids);..}...node
    │ │ │ -0006bdf0: 2a20 6468 745f 7472 6163 6b65 723a 3a67  * dht_tracker::g
    │ │ │ -0006be00: 6574 5f6e 6f64 6528 6e6f 6465 5f69 6420  et_node(node_id 
    │ │ │ -0006be10: 636f 6e73 7426 616d 703b 2069 642c 2073  const& id, s
    │ │ │ -0006be20: 7464 3a3a 7374 7269 6e67 2063 6f6e 7374  td::string const
    │ │ │ -0006be30: 2661 6d70 3b20 6661 6d69 6c79 5f6e 616d  & family_nam
    │ │ │ -0006be40: 6529 0a09 7b0a 0909 544f 5252 454e 545f  e)..{...TORRENT_
    │ │ │ -0006be50: 554e 5553 4544 2869 6429 3b0a 0909 666f  UNUSED(id);...fo
    │ │ │ -0006be60: 7220 2861 7574 6f26 616d 703b 206e 203a  r (auto& n :
    │ │ │ -0006be70: 206d 5f6e 6f64 6573 290a 0909 7b0a 3c64   m_nodes)...{....i
    │ │ │ -0006beb0: 6620 286e 2e73 6563 6f6e 642e 6468 742e  f (n.second.dht.
    │ │ │ -0006bec0: 7072 6f74 6f63 6f6c 5f66 616d 696c 795f  protocol_family_
    │ │ │ -0006bed0: 6e61 6d65 2829 203d 3d20 6661 6d69 6c79  name() == family
    │ │ │ -0006bee0: 5f6e 616d 6529 0a3c 2f64 6976 3e09 0909  _name)....
    │ │ │ -0006bef0: 0972 6574 7572 6e20 2661 6d70 3b6e 2e73  .return &n.s
    │ │ │ -0006bf00: 6563 6f6e 642e 6468 743b 0a09 097d 0a0a  econd.dht;...}..
    │ │ │ -0006bf10: 0909 7265 7475 726e 206e 756c 6c70 7472  ..return nullptr
    │ │ │ -0006bf20: 3b0a 097d 0a0a 0976 6f69 6420 6468 745f  ;..}...void dht_
    │ │ │ -0006bf30: 7472 6163 6b65 723a 3a67 6574 5f70 6565  tracker::get_pee
    │ │ │ -0006bf40: 7273 2873 6861 315f 6861 7368 2063 6f6e  rs(sha1_hash con
    │ │ │ -0006bf50: 7374 2661 6d70 3b20 6968 0a09 092c 2073  st& ih..., s
    │ │ │ -0006bf60: 7464 3a3a 6675 6e63 7469 6f6e 266c 743b  td::function<
    │ │ │ -0006bf70: 766f 6964 2873 7464 3a3a 7665 6374 6f72  void(std::vector
    │ │ │ -0006bf80: 266c 743b 7463 703a 3a65 6e64 706f 696e  <tcp::endpoin
    │ │ │ -0006bf90: 7426 6774 3b20 636f 6e73 7426 616d 703b  t> const&
    │ │ │ -0006bfa0: 2926 6774 3b20 6629 0a09 7b0a 0909 666f  )> f)..{...fo
    │ │ │ -0006bfb0: 7220 2861 7574 6f26 616d 703b 206e 203a  r (auto& n :
    │ │ │ -0006bfc0: 206d 5f6e 6f64 6573 290a 0909 096e 2e73   m_nodes)....n.s
    │ │ │ -0006bfd0: 6563 6f6e 642e 6468 742e 6765 745f 7065  econd.dht.get_pe
    │ │ │ -0006bfe0: 6572 7328 6968 2c20 662c 207b 7d2c 207b  ers(ih, f, {}, {
    │ │ │ -0006bff0: 7d29 3b0a 097d 0a0a 0976 6f69 6420 6468  });..}...void dh
    │ │ │ -0006c000: 745f 7472 6163 6b65 723a 3a61 6e6e 6f75  t_tracker::annou
    │ │ │ -0006c010: 6e63 6528 7368 6131 5f68 6173 6820 636f  nce(sha1_hash co
    │ │ │ -0006c020: 6e73 7426 616d 703b 2069 682c 2069 6e74  nst& ih, int
    │ │ │ -0006c030: 206c 6973 7465 6e5f 706f 7274 0a09 092c   listen_port...,
    │ │ │ -0006c040: 2061 6e6e 6f75 6e63 655f 666c 6167 735f   announce_flags_
    │ │ │ -0006c050: 7420 636f 6e73 7420 666c 6167 730a 0909  t const flags...
    │ │ │ -0006c060: 2c20 7374 643a 3a66 756e 6374 696f 6e26  , std::function&
    │ │ │ -0006c070: 6c74 3b76 6f69 6428 7374 643a 3a76 6563  lt;void(std::vec
    │ │ │ -0006c080: 746f 7226 6c74 3b74 6370 3a3a 656e 6470  tor<tcp::endp
    │ │ │ -0006c090: 6f69 6e74 2667 743b 2063 6f6e 7374 2661  oint> const&a
    │ │ │ -0006c0a0: 6d70 3b29 2667 743b 2066 290a 097b 0a09  mp;)> f)..{..
    │ │ │ -0006c0b0: 0966 6f72 2028 6175 746f 2661 6d70 3b20  .for (auto& 
    │ │ │ -0006c0c0: 6e20 3a20 6d5f 6e6f 6465 7329 0a09 0909  n : m_nodes)....
    │ │ │ -0006c0d0: 6e2e 7365 636f 6e64 2e64 6874 2e61 6e6e  n.second.dht.ann
    │ │ │ -0006c0e0: 6f75 6e63 6528 6968 2c20 6c69 7374 656e  ounce(ih, listen
    │ │ │ -0006c0f0: 5f70 6f72 742c 2066 6c61 6773 2c20 6629  _port, flags, f)
    │ │ │ -0006c100: 3b0a 097d 0a0a 0976 6f69 6420 6468 745f  ;..}...void dht_
    │ │ │ -0006c110: 7472 6163 6b65 723a 3a73 616d 706c 655f  tracker::sample_
    │ │ │ -0006c120: 696e 666f 6861 7368 6573 2875 6470 3a3a  infohashes(udp::
    │ │ │ -0006c130: 656e 6470 6f69 6e74 2063 6f6e 7374 2661  endpoint const&a
    │ │ │ -0006c140: 6d70 3b20 6570 2c20 7368 6131 5f68 6173  mp; ep, sha1_has
    │ │ │ -0006c150: 6820 636f 6e73 7426 616d 703b 2074 6172  h const& tar
    │ │ │ -0006c160: 6765 740a 0909 2c20 7374 643a 3a66 756e  get..., std::fun
    │ │ │ -0006c170: 6374 696f 6e26 6c74 3b76 6f69 6428 6e6f  ction<void(no
    │ │ │ -0006c180: 6465 5f69 640a 0909 092c 2074 696d 655f  de_id...., time_
    │ │ │ -0006c190: 6475 7261 7469 6f6e 0a09 0909 2c20 696e  duration...., in
    │ │ │ -0006c1a0: 742c 2073 7464 3a3a 7665 6374 6f72 266c  t, std::vector&l
    │ │ │ -0006c1b0: 743b 7368 6131 5f68 6173 6826 6774 3b0a  t;sha1_hash>.
    │ │ │ -0006c1c0: 0909 092c 2073 7464 3a3a 7665 6374 6f72  ..., std::vector
    │ │ │ -0006c1d0: 266c 743b 7374 643a 3a70 6169 7226 6c74  <std::pair<
    │ │ │ -0006c1e0: 3b73 6861 315f 6861 7368 2c20 7564 703a  ;sha1_hash, udp:
    │ │ │ -0006c1f0: 3a65 6e64 706f 696e 7426 6774 3b26 6774  :endpoint>>
    │ │ │ -0006c200: 3b29 2667 743b 2066 290a 097b 0a09 0966  ;)> f)..{...f
    │ │ │ -0006c210: 6f72 2028 6175 746f 2661 6d70 3b20 6e20  or (auto& n 
    │ │ │ -0006c220: 3a20 6d5f 6e6f 6465 7329 0a09 097b 0a09  : m_nodes)...{..
    │ │ │ -0006c230: 0909 6966 2028 6570 2e70 726f 746f 636f  ..if (ep.protoco
    │ │ │ -0006c240: 6c28 2920 213d 2028 6e2e 6669 7273 742e  l() != (n.first.
    │ │ │ -0006c250: 6765 745f 6578 7465 726e 616c 5f61 6464  get_external_add
    │ │ │ -0006c260: 7265 7373 2829 2e69 735f 7634 2829 203f  ress().is_v4() ?
    │ │ │ -0006c270: 2075 6470 3a3a 7634 2829 203a 2075 6470   udp::v4() : udp
    │ │ │ -0006c280: 3a3a 7636 2829 2929 0a3c 2f70 7265 3e3c  ::v6())).
    < │ │ │ -0006c290: 2f74 643e 3c2f 7472 3e3c 7472 2073 7479 /td>releva │ │ │ -0006c2c0: 6e63 6526 6e62 7370 3b30 3c2f 7464 3e3c nce 0< │ │ │ -0006c2d0: 7464 3e3c 6120 6872 6566 3d22 6a61 7661 td>../src/kadem │ │ │ -0006c300: 6c69 612f 6e6f 6465 2e63 7070 3a31 3137 lia/node.cpp:117 │ │ │ -0006c310: 373c 2f61 3e3c 2f74 643e 3c74 643e 6b65 7ke │ │ │ -0006c320: 6570 2074 6865 2072 6574 7572 6e65 6420 ep the returned │ │ │ -0006c330: 7661 6c75 6520 746f 2070 6173 7320 6173 value to pass as │ │ │ -0006c340: 2061 206c 696d 6974 2074 6f20 7772 6974 a limit to writ │ │ │ -0006c350: 655f 6e6f 6465 735f 656e 7472 6965 7320 e_nodes_entries │ │ │ -0006c360: 7768 656e 2069 6d70 6c65 6d65 6e74 6564 when implemented │ │ │ -0006c370: 3c2f 7464 3e3c 2f74 723e 3c74 7220 6964

    ke │ │ │ -0006c3c0: 6570 2074 6865 2072 6574 7572 6e65 6420 ep the returned │ │ │ -0006c3d0: 7661 6c75 6520 746f 2070 6173 7320 6173 value to pass as │ │ │ -0006c3e0: 2061 206c 696d 6974 0a74 6f20 7772 6974 a limit.to writ │ │ │ -0006c3f0: 655f 6e6f 6465 735f 656e 7472 6965 7320 e_nodes_entries │ │ │ -0006c400: 7768 656e 2069 6d70 6c65 6d65 6e74 6564 when implemented │ │ │ -0006c410: 3c2f 6832 3e3c 6834 3e2e 2e2f 7372 632f

    ../src/ │ │ │ -0006c420: 6b61 6465 6d6c 6961 2f6e 6f64 652e 6370 kademlia/node.cp │ │ │ -0006c430: 703a 3131 3737 3c2f 6834 3e3c 7072 6520 p:1177

    ..}..}..els
    │ │ │ -0006c480: 6520 6966 2028 7175 6572 7920 3d3d 2022  e if (query == "
    │ │ │ -0006c490: 7361 6d70 6c65 5f69 6e66 6f68 6173 6865  sample_infohashe
    │ │ │ -0006c4a0: 7322 290a 097b 0a09 0973 7461 7469 6320  s")..{...static 
    │ │ │ -0006c4b0: 6b65 795f 6465 7363 5f74 2063 6f6e 7374  key_desc_t const
    │ │ │ -0006c4c0: 206d 7367 5f64 6573 635b 5d20 3d20 7b0a   msg_desc[] = {.
    │ │ │ -0006c4d0: 0909 097b 2274 6172 6765 7422 2c20 6264  ...{"target", bd
    │ │ │ -0006c4e0: 6563 6f64 655f 6e6f 6465 3a3a 7374 7269  ecode_node::stri
    │ │ │ -0006c4f0: 6e67 5f74 2c20 3230 2c20 307d 2c0a 0909  ng_t, 20, 0},...
    │ │ │ -0006c500: 097b 2277 616e 7422 2c20 6264 6563 6f64  .{"want", bdecod
    │ │ │ -0006c510: 655f 6e6f 6465 3a3a 6c69 7374 5f74 2c20  e_node::list_t, 
    │ │ │ -0006c520: 302c 206b 6579 5f64 6573 635f 743a 3a6f  0, key_desc_t::o
    │ │ │ -0006c530: 7074 696f 6e61 6c7d 2c0a 0909 7d3b 0a0a  ptional},...};..
    │ │ │ -0006c540: 0909 6264 6563 6f64 655f 6e6f 6465 206d  ..bdecode_node m
    │ │ │ -0006c550: 7367 5f6b 6579 735b 325d 3b0a 0909 6966  sg_keys[2];...if
    │ │ │ -0006c560: 2028 2176 6572 6966 795f 6d65 7373 6167   (!verify_messag
    │ │ │ -0006c570: 6528 6172 675f 656e 742c 206d 7367 5f64  e(arg_ent, msg_d
    │ │ │ -0006c580: 6573 632c 206d 7367 5f6b 6579 732c 2065  esc, msg_keys, e
    │ │ │ -0006c590: 7272 6f72 5f73 7472 696e 6729 290a 0909  rror_string))...
    │ │ │ -0006c5a0: 7b0a 0909 096d 5f63 6f75 6e74 6572 732e  {....m_counters.
    │ │ │ -0006c5b0: 696e 635f 7374 6174 735f 636f 756e 7465  inc_stats_counte
    │ │ │ -0006c5c0: 7228 636f 756e 7465 7273 3a3a 6468 745f  r(counters::dht_
    │ │ │ -0006c5d0: 696e 7661 6c69 645f 7361 6d70 6c65 5f69  invalid_sample_i
    │ │ │ -0006c5e0: 6e66 6f68 6173 6865 7329 3b0a 0909 0969  nfohashes);....i
    │ │ │ -0006c5f0: 6e63 6f6d 696e 675f 6572 726f 7228 652c  ncoming_error(e,
    │ │ │ -0006c600: 2065 7272 6f72 5f73 7472 696e 6729 3b0a   error_string);.
    │ │ │ -0006c610: 0909 0972 6574 7572 6e3b 0a09 097d 0a0a  ...return;...}..
    │ │ │ -0006c620: 0909 6d5f 636f 756e 7465 7273 2e69 6e63  ..m_counters.inc
    │ │ │ -0006c630: 5f73 7461 7473 5f63 6f75 6e74 6572 2863  _stats_counter(c
    │ │ │ -0006c640: 6f75 6e74 6572 733a 3a64 6874 5f73 616d  ounters::dht_sam
    │ │ │ -0006c650: 706c 655f 696e 666f 6861 7368 6573 5f69  ple_infohashes_i
    │ │ │ -0006c660: 6e29 3b0a 0909 7368 6131 5f68 6173 6820  n);...sha1_hash 
    │ │ │ -0006c670: 636f 6e73 7420 7461 7267 6574 286d 7367  const target(msg
    │ │ │ -0006c680: 5f6b 6579 735b 305d 2e73 7472 696e 675f  _keys[0].string_
    │ │ │ -0006c690: 7074 7228 2929 3b0a 0a3c 6469 7620 7374  ptr());..
    ..m_stora │ │ │ -0006c6d0: 6765 2e67 6574 5f69 6e66 6f68 6173 6865 ge.get_infohashe │ │ │ -0006c6e0: 735f 7361 6d70 6c65 2872 6570 6c79 293b s_sample(reply); │ │ │ -0006c6f0: 0a3c 2f64 6976 3e0a 0909 7772 6974 655f .
    ...write_ │ │ │ -0006c700: 6e6f 6465 735f 656e 7472 6965 7328 7461 nodes_entries(ta │ │ │ -0006c710: 7267 6574 2c20 6d73 675f 6b65 7973 5b31 rget, msg_keys[1 │ │ │ -0006c720: 5d2c 2072 6570 6c79 293b 0a09 7d0a 0965 ], reply);..}..e │ │ │ -0006c730: 6c73 650a 097b 0a09 092f 2f20 6966 2077 lse..{...// if w │ │ │ -0006c740: 6520 646f 6e27 7420 7265 636f 676e 697a e don't recogniz │ │ │ -0006c750: 6520 7468 6520 6d65 7373 6167 6520 6275 e the message bu │ │ │ -0006c760: 7420 7468 6572 6527 7320 610a 0909 2f2f t there's a...// │ │ │ -0006c770: 2027 7461 7267 6574 2720 6f72 2027 696e 'target' or 'in │ │ │ -0006c780: 666f 5f68 6173 6827 2069 6e20 7468 6520 fo_hash' in the │ │ │ -0006c790: 6172 6775 6d65 6e74 732c 2074 7265 6174 arguments, treat │ │ │ -0006c7a0: 2069 740a 0909 2f2f 2061 7320 6669 6e64 it...// as find │ │ │ -0006c7b0: 5f6e 6f64 6520 746f 2062 6520 6675 7475 _node to be futu │ │ │ -0006c7c0: 7265 2063 6f6d 7061 7469 626c 650a 0909 re compatible... │ │ │ -0006c7d0: 6264 6563 6f64 655f 6e6f 6465 2074 6172 bdecode_node tar │ │ │ -0006c7e0: 6765 745f 656e 7420 3d20 6172 675f 656e get_ent = arg_en │ │ │ -0006c7f0: 742e 6469 6374 5f66 696e 645f 7374 7269 t.dict_find_stri │ │ │ -0006c800: 6e67 2822 7461 7267 6574 2229 3b0a 0909 ng("target");... │ │ │ -0006c810: 6966 2028 2174 6172 6765 745f 656e 7420 if (!target_ent │ │ │ -0006c820: 7c7c 2074 6172 6765 745f 656e 742e 7374 || target_ent.st │ │ │ -0006c830: 7269 6e67 5f6c 656e 6774 6828 2920 213d ring_length() != │ │ │ -0006c840: 2032 3029 0a09 097b 0a09 0909 7461 7267 20)...{....targ │ │ │ -0006c850: 6574 5f65 6e74 203d 2061 7267 5f65 6e74 et_ent = arg_ent │ │ │ -0006c860: 2e64 6963 745f 6669 6e64 5f73 7472 696e .dict_find_strin │ │ │ -0006c870: 6728 2269 6e66 6f5f 6861 7368 2229 3b0a g("info_hash");. │ │ │ -0006c880: 0909 0969 6620 2821 7461 7267 6574 5f65 ...if (!target_e │ │ │ -0006c890: 6e74 207c 7c20 7461 7267 6574 5f65 6e74 nt || target_ent │ │ │ -0006c8a0: 2e73 7472 696e 675f 6c65 6e67 7468 2829 .string_length() │ │ │ -0006c8b0: 2021 3d20 3230 290a 0909 097b 0a09 0909 != 20)....{.... │ │ │ -0006c8c0: 0969 6e63 6f6d 696e 675f 6572 726f 7228 .incoming_error( │ │ │ -0006c8d0: 652c 2022 756e 6b6e 6f77 6e20 6d65 7373 e, "unknown mess │ │ │ -0006c8e0: 6167 6522 293b 0a09 0909 0972 6574 7572 age");.....retur │ │ │ -0006c8f0: 6e3b 0a09 0909 7d0a 0909 7d0a 0a09 0973 n;....}...}....s │ │ │ -0006c900: 6861 315f 6861 7368 2063 6f6e 7374 2074 ha1_hash const t │ │ │ -0006c910: 6172 6765 7428 7461 7267 6574 5f65 6e74 arget(target_ent │ │ │ -0006c920: 2e73 7472 696e 675f 7074 7228 2929 3b0a .string_ptr());. │ │ │ -0006c930: 0909 2f2f 2061 6c77 6179 7320 7265 7475 ..// always retu │ │ │ -0006c940: 726e 206e 6f64 6573 2061 7320 7765 6c6c rn nodes as well │ │ │ -0006c950: 2061 7320 7065 6572 730a 0909 7772 6974 as peers...writ │ │ │ -0006c960: 655f 6e6f 6465 735f 656e 7472 6965 7328 e_nodes_entries( │ │ │ -0006c970: 7461 7267 6574 2c20 6172 675f 656e 742e target, arg_ent. │ │ │ -0006c980: 6469 6374 5f66 696e 645f 6c69 7374 2822 dict_find_list(" │ │ │ -0006c990: 7761 6e74 2229 2c20 7265 706c 7929 3b0a want"), reply);. │ │ │ -0006c9a0: 097d 0a7d 0a0a 3c2f 7072 653e 3c2f 7464 .}.}..
    relevance │ │ │ -0006c9e0: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ -0006c9f0: 3c61 2068 7265 663d 226a 6176 6173 6372 ../src/kademlia │ │ │ -0006ca20: 2f6e 6f64 652e 6370 703a 3132 3035 3c2f /node.cpp:1205limit │ │ │ -0006ca40: 206e 756d 6265 7220 6f66 2065 6e74 7269 number of entri │ │ │ -0006ca50: 6573 2069 6e20 7468 6520 7265 7375 6c74 es in the result │ │ │ -0006ca60: 3c2f 7464 3e3c 2f74 723e 3c74 7220 6964

    li │ │ │ -0006cab0: 6d69 7420 6e75 6d62 6572 206f 6620 656e mit number of en │ │ │ -0006cac0: 7472 6965 7320 696e 2074 6865 2072 6573 tries in the res │ │ │ -0006cad0: 756c 743c 2f68 323e 3c68 343e 2e2e 2f73 ult

    ../s │ │ │ -0006cae0: 7263 2f6b 6164 656d 6c69 612f 6e6f 6465 rc/kademlia/node │ │ │ -0006caf0: 2e63 7070 3a31 3230 353c 2f68 343e 3c70 .cpp:1205

    ..// if │ │ │ -0006cb40: 7765 2064 6f6e 2774 2072 6563 6f67 6e69 we don't recogni │ │ │ -0006cb50: 7a65 2074 6865 206d 6573 7361 6765 2062 ze the message b │ │ │ -0006cb60: 7574 2074 6865 7265 2773 2061 0a09 092f ut there's a.../ │ │ │ -0006cb70: 2f20 2774 6172 6765 7427 206f 7220 2769 / 'target' or 'i │ │ │ -0006cb80: 6e66 6f5f 6861 7368 2720 696e 2074 6865 nfo_hash' in the │ │ │ -0006cb90: 2061 7267 756d 656e 7473 2c20 7472 6561 arguments, trea │ │ │ -0006cba0: 7420 6974 0a09 092f 2f20 6173 2066 696e t it...// as fin │ │ │ -0006cbb0: 645f 6e6f 6465 2074 6f20 6265 2066 7574 d_node to be fut │ │ │ -0006cbc0: 7572 6520 636f 6d70 6174 6962 6c65 0a09 ure compatible.. │ │ │ -0006cbd0: 0962 6465 636f 6465 5f6e 6f64 6520 7461 .bdecode_node ta │ │ │ -0006cbe0: 7267 6574 5f65 6e74 203d 2061 7267 5f65 rget_ent = arg_e │ │ │ -0006cbf0: 6e74 2e64 6963 745f 6669 6e64 5f73 7472 nt.dict_find_str │ │ │ -0006cc00: 696e 6728 2274 6172 6765 7422 293b 0a09 ing("target");.. │ │ │ -0006cc10: 0969 6620 2821 7461 7267 6574 5f65 6e74 .if (!target_ent │ │ │ -0006cc20: 207c 7c20 7461 7267 6574 5f65 6e74 2e73 || target_ent.s │ │ │ -0006cc30: 7472 696e 675f 6c65 6e67 7468 2829 2021 tring_length() ! │ │ │ -0006cc40: 3d20 3230 290a 0909 7b0a 0909 0974 6172 = 20)...{....tar │ │ │ -0006cc50: 6765 745f 656e 7420 3d20 6172 675f 656e get_ent = arg_en │ │ │ -0006cc60: 742e 6469 6374 5f66 696e 645f 7374 7269 t.dict_find_stri │ │ │ -0006cc70: 6e67 2822 696e 666f 5f68 6173 6822 293b ng("info_hash"); │ │ │ -0006cc80: 0a09 0909 6966 2028 2174 6172 6765 745f ....if (!target_ │ │ │ -0006cc90: 656e 7420 7c7c 2074 6172 6765 745f 656e ent || target_en │ │ │ -0006cca0: 742e 7374 7269 6e67 5f6c 656e 6774 6828 t.string_length( │ │ │ -0006ccb0: 2920 213d 2032 3029 0a09 0909 7b0a 0909 ) != 20)....{... │ │ │ -0006ccc0: 0909 696e 636f 6d69 6e67 5f65 7272 6f72 ..incoming_error │ │ │ -0006ccd0: 2865 2c20 2275 6e6b 6e6f 776e 206d 6573 (e, "unknown mes │ │ │ -0006cce0: 7361 6765 2229 3b0a 0909 0909 7265 7475 sage");.....retu │ │ │ -0006ccf0: 726e 3b0a 0909 097d 0a09 097d 0a0a 0909 rn;....}...}.... │ │ │ -0006cd00: 7368 6131 5f68 6173 6820 636f 6e73 7420 sha1_hash const │ │ │ -0006cd10: 7461 7267 6574 2874 6172 6765 745f 656e target(target_en │ │ │ -0006cd20: 742e 7374 7269 6e67 5f70 7472 2829 293b t.string_ptr()); │ │ │ -0006cd30: 0a09 092f 2f20 616c 7761 7973 2072 6574 ...// always ret │ │ │ -0006cd40: 7572 6e20 6e6f 6465 7320 6173 2077 656c urn nodes as wel │ │ │ -0006cd50: 6c20 6173 2070 6565 7273 0a09 0977 7269 l as peers...wri │ │ │ -0006cd60: 7465 5f6e 6f64 6573 5f65 6e74 7269 6573 te_nodes_entries │ │ │ -0006cd70: 2874 6172 6765 742c 2061 7267 5f65 6e74 (target, arg_ent │ │ │ -0006cd80: 2e64 6963 745f 6669 6e64 5f6c 6973 7428 .dict_find_list( │ │ │ -0006cd90: 2277 616e 7422 292c 2072 6570 6c79 293b "want"), reply); │ │ │ -0006cda0: 0a09 7d0a 7d0a 0a3c 6469 7620 7374 796c ..}.}..

    void node:: │ │ │ -0006cde0: 7772 6974 655f 6e6f 6465 735f 656e 7472 write_nodes_entr │ │ │ -0006cdf0: 6965 7328 7368 6131 5f68 6173 6820 636f ies(sha1_hash co │ │ │ -0006ce00: 6e73 7426 616d 703b 2069 6e66 6f5f 6861 nst& info_ha │ │ │ -0006ce10: 7368 0a3c 2f64 6976 3e09 2c20 6264 6563 sh.
    ., bdec │ │ │ -0006ce20: 6f64 655f 6e6f 6465 2063 6f6e 7374 2661 ode_node const&a │ │ │ -0006ce30: 6d70 3b20 7761 6e74 2c20 656e 7472 7926 mp; want, entry& │ │ │ -0006ce40: 616d 703b 2072 290a 7b0a 092f 2f20 6966 amp; r).{..// if │ │ │ -0006ce50: 206e 6f20 7761 6e74 7320 656e 7472 7920 no wants entry │ │ │ -0006ce60: 7761 7320 7370 6563 6966 6965 642c 2069 was specified, i │ │ │ -0006ce70: 6e63 6c75 6465 2061 206e 6f64 6573 0a09 nclude a nodes.. │ │ │ -0006ce80: 2f2f 2065 6e74 7279 2062 6173 6564 206f // entry based o │ │ │ -0006ce90: 6e20 7468 6520 7072 6f74 6f63 6f6c 2074 n the protocol t │ │ │ -0006cea0: 6865 2072 6571 7565 7374 2063 616d 6520 he request came │ │ │ -0006ceb0: 696e 2077 6974 680a 0969 6620 2877 616e in with..if (wan │ │ │ -0006cec0: 742e 7479 7065 2829 2021 3d20 6264 6563 t.type() != bdec │ │ │ -0006ced0: 6f64 655f 6e6f 6465 3a3a 6c69 7374 5f74 ode_node::list_t │ │ │ -0006cee0: 290a 097b 0a09 0973 7464 3a3a 7665 6374 )..{...std::vect │ │ │ -0006cef0: 6f72 266c 743b 6e6f 6465 5f65 6e74 7279 or<node_entry │ │ │ -0006cf00: 2667 743b 2063 6f6e 7374 206e 203d 206d > const n = m │ │ │ -0006cf10: 5f74 6162 6c65 2e66 696e 645f 6e6f 6465 _table.find_node │ │ │ -0006cf20: 2869 6e66 6f5f 6861 7368 2c20 7b7d 293b (info_hash, {}); │ │ │ -0006cf30: 0a09 0972 5b70 726f 746f 636f 6c5f 6e6f ...r[protocol_no │ │ │ -0006cf40: 6465 735f 6b65 7928 295d 203d 2077 7269 des_key()] = wri │ │ │ -0006cf50: 7465 5f6e 6f64 6573 5f65 6e74 7279 286e te_nodes_entry(n │ │ │ -0006cf60: 293b 0a09 0972 6574 7572 6e3b 0a09 7d0a );...return;..}. │ │ │ -0006cf70: 0a09 2f2f 2069 6620 7468 6572 6520 6973 ..// if there is │ │ │ -0006cf80: 2061 2077 616e 7473 2065 6e74 7279 2074 a wants entry t │ │ │ -0006cf90: 6865 6e20 7765 206d 6179 206e 6565 6420 hen we may need │ │ │ -0006cfa0: 746f 2072 6561 6368 2069 6e74 6f0a 092f to reach into../ │ │ │ -0006cfb0: 2f20 616e 6f74 6865 7220 6e6f 6465 2773 / another node's │ │ │ -0006cfc0: 2072 6f75 7469 6e67 2074 6162 6c65 2074 routing table t │ │ │ -0006cfd0: 6f20 6765 7420 6e6f 6465 7320 6f66 2074 o get nodes of t │ │ │ -0006cfe0: 6865 2072 6571 7565 7374 6564 2074 7970 he requested typ │ │ │ -0006cff0: 650a 092f 2f20 7765 2075 7365 2061 206d e..// we use a m │ │ │ -0006d000: 6170 206d 6169 6e74 6169 6e65 6420 6279 ap maintained by │ │ │ -0006d010: 2074 6865 206f 776e 696e 6720 6468 745f the owning dht_ │ │ │ -0006d020: 7472 6163 6b65 7220 746f 2066 696e 6420 tracker to find │ │ │ -0006d030: 7468 650a 092f 2f20 6e6f 6465 2061 7373 the..// node ass │ │ │ -0006d040: 6f63 6961 7465 6420 7769 7468 2065 6163 ociated with eac │ │ │ -0006d050: 6820 7374 7269 6e67 2069 6e20 7468 6520 h string in the │ │ │ -0006d060: 7761 6e74 206c 6973 742c 2077 6869 6368 want list, which │ │ │ -0006d070: 206d 6179 0a09 2f2f 2069 6e63 6c75 6465 may..// include │ │ │ -0006d080: 2074 6869 7320 6e6f 6465 0a09 666f 7220 this node..for │ │ │ -0006d090: 2869 6e74 2069 203d 2030 3b20 6920 266c (int i = 0; i &l │ │ │ -0006d0a0: 743b 2077 616e 742e 6c69 7374 5f73 697a t; want.list_siz │ │ │ -0006d0b0: 6528 293b 202b 2b69 290a 097b 0a09 0962 e(); ++i)..{...b │ │ │ -0006d0c0: 6465 636f 6465 5f6e 6f64 6520 7761 6e74 decode_node want │ │ │ -0006d0d0: 6564 203d 2077 616e 742e 6c69 7374 5f61 ed = want.list_a │ │ │ -0006d0e0: 7428 6929 3b0a 0909 6966 2028 7761 6e74 t(i);...if (want │ │ │ -0006d0f0: 6564 2e74 7970 6528 2920 213d 2062 6465 ed.type() != bde │ │ │ -0006d100: 636f 6465 5f6e 6f64 653a 3a73 7472 696e code_node::strin │ │ │ -0006d110: 675f 7429 0a09 0909 636f 6e74 696e 7565 g_t)....continue │ │ │ -0006d120: 3b0a 0909 6e6f 6465 2a20 7761 6e74 6564 ;...node* wanted │ │ │ -0006d130: 5f6e 6f64 6520 3d20 6d5f 6765 745f 666f _node = m_get_fo │ │ │ -0006d140: 7265 6967 6e5f 6e6f 6465 2869 6e66 6f5f reign_node(info_ │ │ │ -0006d150: 6861 7368 2c20 7761 6e74 6564 2e73 7472 hash, wanted.str │ │ │ -0006d160: 696e 675f 7661 6c75 6528 292e 746f 5f73 ing_value().to_s │ │ │ -0006d170: 7472 696e 6728 2929 3b0a 0909 6966 2028 tring());...if ( │ │ │ -0006d180: 2177 616e 7465 645f 6e6f 6465 2920 636f !wanted_node) co │ │ │ -0006d190: 6e74 696e 7565 3b0a 0909 7374 643a 3a76 ntinue;...std::v │ │ │ -0006d1a0: 6563 746f 7226 6c74 3b6e 6f64 655f 656e ector<node_en │ │ │ -0006d1b0: 7472 7926 6774 3b20 636f 6e73 7420 6e20 try> const n │ │ │ -0006d1c0: 3d20 7761 6e74 6564 5f6e 6f64 652d 2667 = wanted_node-&g │ │ │ -0006d1d0: 743b 6d5f 7461 626c 652e 6669 6e64 5f6e t;m_table.find_n │ │ │ -0006d1e0: 6f64 6528 696e 666f 5f68 6173 682c 207b ode(info_hash, { │ │ │ -0006d1f0: 7d29 3b0a 0909 725b 7761 6e74 6564 5f6e });...r[wanted_n │ │ │ -0006d200: 6f64 652d 2667 743b 7072 6f74 6f63 6f6c ode->protocol │ │ │ -0006d210: 5f6e 6f64 6573 5f6b 6579 2829 5d20 3d20 _nodes_key()] = │ │ │ -0006d220: 7772 6974 655f 6e6f 6465 735f 656e 7472 write_nodes_entr │ │ │ -0006d230: 7928 6e29 3b0a 097d 0a7d 0a0a 6e6f 6465 y(n);..}.}..node │ │ │ -0006d240: 3a3a 7072 6f74 6f63 6f6c 5f64 6573 6372 ::protocol_descr │ │ │ -0006d250: 6970 746f 7220 636f 6e73 7426 616d 703b iptor const& │ │ │ -0006d260: 206e 6f64 653a 3a6d 6170 5f70 726f 746f node::map_proto │ │ │ -0006d270: 636f 6c5f 746f 5f64 6573 6372 6970 746f col_to_descripto │ │ │ -0006d280: 7228 7564 7020 636f 6e73 7420 7072 6f74 r(udp const prot │ │ │ -0006d290: 6f63 6f6c 290a 7b0a 3c2f 7072 653e 3c2f ocol).{.
    what if o i │ │ │ +00068f20: 7320 6e6f 7420 616e 2069 6e73 7461 6e63 s not an instanc │ │ │ +00068f30: 6520 6f66 2070 7574 5f64 6174 615f 6f62 e of put_data_ob │ │ │ +00068f40: 7365 7276 6572 3f20 5468 6973 206e 6565 server? This nee │ │ │ +00068f50: 6420 746f 2062 6520 7265 6465 7369 676e d to be redesign │ │ │ +00068f60: 6564 2066 6f72 2062 6574 7465 7220 7479 ed for better ty │ │ │ +00068f70: 7065 2073 6166 6574 792e 3c2f 7464 3e3c pe safety.< │ │ │ +00068f80: 2f74 723e 3c74 7220 6964 3d22 3234 3122 /tr>

    what if │ │ │ +00068fd0: 6f20 6973 206e 6f74 2061 6e20 696e 7374 o is not an inst │ │ │ +00068fe0: 616e 6365 206f 6620 7075 745f 6461 7461 ance of put_data │ │ │ +00068ff0: 5f6f 6273 6572 7665 723f 2054 6869 7320 _observer? This │ │ │ +00069000: 6e65 6564 2074 6f20 6265 0a72 6564 6573 need to be.redes │ │ │ +00069010: 6967 6e65 6420 666f 7220 6265 7474 6572 igned for better │ │ │ +00069020: 2074 7970 6520 7361 6665 7479 2e3c 2f68 type safety.

    ../src/kad │ │ │ +00069040: 656d 6c69 612f 7075 745f 6461 7461 2e63 emlia/put_data.c │ │ │ +00069050: 7070 3a39 323c 2f68 343e 3c70 7265 2073 pp:92

    .}.}..void p
    │ │ │ +000690a0: 7574 5f64 6174 613a 3a64 6f6e 6528 290a  ut_data::done().
    │ │ │ +000690b0: 7b0a 096d 5f64 6f6e 6520 3d20 7472 7565  {..m_done = true
    │ │ │ +000690c0: 3b0a 0a23 6966 6e64 6566 2054 4f52 5245  ;..#ifndef TORRE
    │ │ │ +000690d0: 4e54 5f44 4953 4142 4c45 5f4c 4f47 4749  NT_DISABLE_LOGGI
    │ │ │ +000690e0: 4e47 0a09 6765 745f 6e6f 6465 2829 2e6f  NG..get_node().o
    │ │ │ +000690f0: 6273 6572 7665 7228 292d 2667 743b 6c6f  bserver()->lo
    │ │ │ +00069100: 6728 6468 745f 6c6f 6767 6572 3a3a 7472  g(dht_logger::tr
    │ │ │ +00069110: 6176 6572 7361 6c2c 2022 5b25 755d 2025  aversal, "[%u] %
    │ │ │ +00069120: 7320 444f 4e45 2c20 7265 7370 6f6e 7365  s DONE, response
    │ │ │ +00069130: 2025 642c 2074 696d 656f 7574 2025 6422   %d, timeout %d"
    │ │ │ +00069140: 0a09 092c 2069 6428 292c 206e 616d 6528  ..., id(), name(
    │ │ │ +00069150: 292c 206e 756d 5f72 6573 706f 6e73 6573  ), num_responses
    │ │ │ +00069160: 2829 2c20 6e75 6d5f 7469 6d65 6f75 7473  (), num_timeouts
    │ │ │ +00069170: 2829 293b 0a23 656e 6469 660a 0a09 6d5f  ());.#endif...m_
    │ │ │ +00069180: 7075 745f 6361 6c6c 6261 636b 286d 5f64  put_callback(m_d
    │ │ │ +00069190: 6174 612c 206e 756d 5f72 6573 706f 6e73  ata, num_respons
    │ │ │ +000691a0: 6573 2829 293b 0a09 7472 6176 6572 7361  es());..traversa
    │ │ │ +000691b0: 6c5f 616c 676f 7269 7468 6d3a 3a64 6f6e  l_algorithm::don
    │ │ │ +000691c0: 6528 293b 0a7d 0a0a 626f 6f6c 2070 7574  e();.}..bool put
    │ │ │ +000691d0: 5f64 6174 613a 3a69 6e76 6f6b 6528 6f62  _data::invoke(ob
    │ │ │ +000691e0: 7365 7276 6572 5f70 7472 206f 290a 7b0a  server_ptr o).{.
    │ │ │ +000691f0: 0969 6620 286d 5f64 6f6e 6529 2072 6574  .if (m_done) ret
    │ │ │ +00069200: 7572 6e20 6661 6c73 653b 0a0a 3c64 6976  urn false;..
    .auto* │ │ │ +00069240: 2070 6f20 3d20 7374 6174 6963 5f63 6173 po = static_cas │ │ │ +00069250: 7426 6c74 3b70 7574 5f64 6174 615f 6f62 t<put_data_ob │ │ │ +00069260: 7365 7276 6572 2a26 6774 3b28 6f2e 6765 server*>(o.ge │ │ │ +00069270: 7428 2929 3b0a 3c2f 6469 763e 0a09 656e t());.
    ..en │ │ │ +00069280: 7472 7920 653b 0a09 655b 2279 225d 203d try e;..e["y"] = │ │ │ +00069290: 2022 7122 3b0a 0965 5b22 7122 5d20 3d20 "q";..e["q"] = │ │ │ +000692a0: 2270 7574 223b 0a09 656e 7472 7926 616d "put";..entry&am │ │ │ +000692b0: 703b 2061 203d 2065 5b22 6122 5d3b 0a09 p; a = e["a"];.. │ │ │ +000692c0: 615b 2276 225d 203d 206d 5f64 6174 612e a["v"] = m_data. │ │ │ +000692d0: 7661 6c75 6528 293b 0a09 615b 2274 6f6b value();..a["tok │ │ │ +000692e0: 656e 225d 203d 2070 6f2d 2667 743b 6d5f en"] = po->m_ │ │ │ +000692f0: 746f 6b65 6e3b 0a09 6966 2028 6d5f 6461 token;..if (m_da │ │ │ +00069300: 7461 2e69 735f 6d75 7461 626c 6528 2929 ta.is_mutable()) │ │ │ +00069310: 0a09 7b0a 0909 615b 226b 225d 203d 206d ..{...a["k"] = m │ │ │ +00069320: 5f64 6174 612e 706b 2829 2e62 7974 6573 _data.pk().bytes │ │ │ +00069330: 3b0a 0909 615b 2273 6571 225d 203d 206d ;...a["seq"] = m │ │ │ +00069340: 5f64 6174 612e 7365 7128 292e 7661 6c75 _data.seq().valu │ │ │ +00069350: 653b 0a09 0961 5b22 7369 6722 5d20 3d20 e;...a["sig"] = │ │ │ +00069360: 6d5f 6461 7461 2e73 6967 2829 2e62 7974 m_data.sig().byt │ │ │ +00069370: 6573 3b0a 0909 6966 2028 216d 5f64 6174 es;...if (!m_dat │ │ │ +00069380: 612e 7361 6c74 2829 2e65 6d70 7479 2829 a.salt().empty() │ │ │ +00069390: 290a 0909 7b0a 0909 0961 5b22 7361 6c74 )...{....a["salt │ │ │ +000693a0: 225d 203d 206d 5f64 6174 612e 7361 6c74 "] = m_data.salt │ │ │ +000693b0: 2829 3b0a 0909 7d0a 097d 0a0a 096d 5f6e ();...}..}...m_n │ │ │ +000693c0: 6f64 652e 7374 6174 735f 636f 756e 7465 ode.stats_counte │ │ │ +000693d0: 7273 2829 2e69 6e63 5f73 7461 7473 5f63 rs().inc_stats_c │ │ │ +000693e0: 6f75 6e74 6572 2863 6f75 6e74 6572 733a ounter(counters: │ │ │ +000693f0: 3a64 6874 5f70 7574 5f6f 7574 293b 0a0a :dht_put_out);.. │ │ │ +00069400: 0972 6574 7572 6e20 6d5f 6e6f 6465 2e6d .return m_node.m │ │ │ +00069410: 5f72 7063 2e69 6e76 6f6b 6528 652c 206f _rpc.invoke(e, o │ │ │ +00069420: 2d26 6774 3b74 6172 6765 745f 6570 2829 ->target_ep() │ │ │ +00069430: 2c20 6f29 3b0a 7d0a 0a7d 207d 202f 2f20 , o);.}..} } // │ │ │ +00069440: 6e61 6d65 7370 6163 6520 6c69 6274 6f72 namespace libtor │ │ │ +00069450: 7265 6e74 3a3a 6468 740a 3c2f 7072 653e rent::dht.
    │ │ │ +00069460: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ +00069490: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ +000694a0: 3c74 643e 3c61 2068 7265 663d 226a 6176
    ../src/kade │ │ │ +000694d0: 6d6c 6961 2f64 6874 5f74 7261 636b 6572 mlia/dht_tracker │ │ │ +000694e0: 2e63 7070 3a33 3137 3c2f 613e 3c2f 7464 .cpp:317pick the cl │ │ │ +00069500: 6f73 6573 7420 6e6f 6465 2072 6174 6865 osest node rathe │ │ │ +00069510: 7220 7468 616e 2074 6865 2066 6972 7374 r than the first │ │ │ +00069520: 3c2f 7464 3e3c 2f74 723e 3c74 7220 6964

    pi │ │ │ +00069570: 636b 2074 6865 2063 6c6f 7365 7374 206e ck the closest n │ │ │ +00069580: 6f64 6520 7261 7468 6572 2074 6861 6e20 ode rather than │ │ │ +00069590: 7468 6520 6669 7273 743c 2f68 323e 3c68 the first

    ../src/kademli │ │ │ +000695b0: 612f 6468 745f 7472 6163 6b65 722e 6370 a/dht_tracker.cp │ │ │ +000695c0: 703a 3331 373c 2f68 343e 3c70 7265 2073 p:317
    .#ifndef TOR
    │ │ │ +00069610: 5245 4e54 5f44 4953 4142 4c45 5f4c 4f47  RENT_DISABLE_LOG
    │ │ │ +00069620: 4749 4e47 0a09 096d 5f6c 6f67 2d26 6774  GING...m_log->
    │ │ │ +00069630: 3b6c 6f67 2864 6874 5f6c 6f67 6765 723a  ;log(dht_logger:
    │ │ │ +00069640: 3a74 7261 636b 6572 2c20 222a 2a2a 206e  :tracker, "*** n
    │ │ │ +00069650: 6577 2077 7269 7465 206b 6579 2a2a 2a20  ew write key*** 
    │ │ │ +00069660: 2564 206e 6f64 6573 220a 0909 092c 2069  %d nodes"...., i
    │ │ │ +00069670: 6e74 286d 5f6e 6f64 6573 2e73 697a 6528  nt(m_nodes.size(
    │ │ │ +00069680: 2929 293b 0a23 656e 6469 660a 097d 0a0a  )));.#endif..}..
    │ │ │ +00069690: 0976 6f69 6420 6468 745f 7472 6163 6b65  .void dht_tracke
    │ │ │ +000696a0: 723a 3a75 7064 6174 655f 7374 6f72 6167  r::update_storag
    │ │ │ +000696b0: 655f 6e6f 6465 5f69 6473 2829 0a09 7b0a  e_node_ids()..{.
    │ │ │ +000696c0: 0909 7374 643a 3a76 6563 746f 7226 6c74  ..std::vector<
    │ │ │ +000696d0: 3b73 6861 315f 6861 7368 2667 743b 2069  ;sha1_hash> i
    │ │ │ +000696e0: 6473 3b0a 0909 666f 7220 2861 7574 6f26  ds;...for (auto&
    │ │ │ +000696f0: 616d 703b 206e 203a 206d 5f6e 6f64 6573  amp; n : m_nodes
    │ │ │ +00069700: 290a 0909 0969 6473 2e70 7573 685f 6261  )....ids.push_ba
    │ │ │ +00069710: 636b 286e 2e73 6563 6f6e 642e 6468 742e  ck(n.second.dht.
    │ │ │ +00069720: 6e69 6428 2929 3b0a 0909 6d5f 7374 6f72  nid());...m_stor
    │ │ │ +00069730: 6167 652e 7570 6461 7465 5f6e 6f64 655f  age.update_node_
    │ │ │ +00069740: 6964 7328 6964 7329 3b0a 097d 0a0a 096e  ids(ids);..}...n
    │ │ │ +00069750: 6f64 652a 2064 6874 5f74 7261 636b 6572  ode* dht_tracker
    │ │ │ +00069760: 3a3a 6765 745f 6e6f 6465 286e 6f64 655f  ::get_node(node_
    │ │ │ +00069770: 6964 2063 6f6e 7374 2661 6d70 3b20 6964  id const& id
    │ │ │ +00069780: 2c20 7374 643a 3a73 7472 696e 6720 636f  , std::string co
    │ │ │ +00069790: 6e73 7426 616d 703b 2066 616d 696c 795f  nst& family_
    │ │ │ +000697a0: 6e61 6d65 290a 097b 0a09 0954 4f52 5245  name)..{...TORRE
    │ │ │ +000697b0: 4e54 5f55 4e55 5345 4428 6964 293b 0a09  NT_UNUSED(id);..
    │ │ │ +000697c0: 0966 6f72 2028 6175 746f 2661 6d70 3b20  .for (auto& 
    │ │ │ +000697d0: 6e20 3a20 6d5f 6e6f 6465 7329 0a09 097b  n : m_nodes)...{
    │ │ │ +000697e0: 0a3c 6469 7620 7374 796c 653d 2262 6163  .
    . │ │ │ +00069810: 0909 6966 2028 6e2e 7365 636f 6e64 2e64 ..if (n.second.d │ │ │ +00069820: 6874 2e70 726f 746f 636f 6c5f 6661 6d69 ht.protocol_fami │ │ │ +00069830: 6c79 5f6e 616d 6528 2920 3d3d 2066 616d ly_name() == fam │ │ │ +00069840: 696c 795f 6e61 6d65 290a 3c2f 6469 763e ily_name).
    │ │ │ +00069850: 0909 0909 7265 7475 726e 2026 616d 703b ....return & │ │ │ +00069860: 6e2e 7365 636f 6e64 2e64 6874 3b0a 0909 n.second.dht;... │ │ │ +00069870: 7d0a 0a09 0972 6574 7572 6e20 6e75 6c6c }....return null │ │ │ +00069880: 7074 723b 0a09 7d0a 0a09 766f 6964 2064 ptr;..}...void d │ │ │ +00069890: 6874 5f74 7261 636b 6572 3a3a 6765 745f ht_tracker::get_ │ │ │ +000698a0: 7065 6572 7328 7368 6131 5f68 6173 6820 peers(sha1_hash │ │ │ +000698b0: 636f 6e73 7426 616d 703b 2069 680a 0909 const& ih... │ │ │ +000698c0: 2c20 7374 643a 3a66 756e 6374 696f 6e26 , std::function& │ │ │ +000698d0: 6c74 3b76 6f69 6428 7374 643a 3a76 6563 lt;void(std::vec │ │ │ +000698e0: 746f 7226 6c74 3b74 6370 3a3a 656e 6470 tor<tcp::endp │ │ │ +000698f0: 6f69 6e74 2667 743b 2063 6f6e 7374 2661 oint> const&a │ │ │ +00069900: 6d70 3b29 2667 743b 2066 290a 097b 0a09 mp;)> f)..{.. │ │ │ +00069910: 0966 6f72 2028 6175 746f 2661 6d70 3b20 .for (auto& │ │ │ +00069920: 6e20 3a20 6d5f 6e6f 6465 7329 0a09 0909 n : m_nodes).... │ │ │ +00069930: 6e2e 7365 636f 6e64 2e64 6874 2e67 6574 n.second.dht.get │ │ │ +00069940: 5f70 6565 7273 2869 682c 2066 2c20 7b7d _peers(ih, f, {} │ │ │ +00069950: 2c20 7b7d 293b 0a09 7d0a 0a09 766f 6964 , {});..}...void │ │ │ +00069960: 2064 6874 5f74 7261 636b 6572 3a3a 616e dht_tracker::an │ │ │ +00069970: 6e6f 756e 6365 2873 6861 315f 6861 7368 nounce(sha1_hash │ │ │ +00069980: 2063 6f6e 7374 2661 6d70 3b20 6968 2c20 const& ih, │ │ │ +00069990: 696e 7420 6c69 7374 656e 5f70 6f72 740a int listen_port. │ │ │ +000699a0: 0909 2c20 616e 6e6f 756e 6365 5f66 6c61 .., announce_fla │ │ │ +000699b0: 6773 5f74 2063 6f6e 7374 2066 6c61 6773 gs_t const flags │ │ │ +000699c0: 0a09 092c 2073 7464 3a3a 6675 6e63 7469 ..., std::functi │ │ │ +000699d0: 6f6e 266c 743b 766f 6964 2873 7464 3a3a on<void(std:: │ │ │ +000699e0: 7665 6374 6f72 266c 743b 7463 703a 3a65 vector<tcp::e │ │ │ +000699f0: 6e64 706f 696e 7426 6774 3b20 636f 6e73 ndpoint> cons │ │ │ +00069a00: 7426 616d 703b 2926 6774 3b20 6629 0a09 t&)> f).. │ │ │ +00069a10: 7b0a 0909 666f 7220 2861 7574 6f26 616d {...for (auto&am │ │ │ +00069a20: 703b 206e 203a 206d 5f6e 6f64 6573 290a p; n : m_nodes). │ │ │ +00069a30: 0909 096e 2e73 6563 6f6e 642e 6468 742e ...n.second.dht. │ │ │ +00069a40: 616e 6e6f 756e 6365 2869 682c 206c 6973 announce(ih, lis │ │ │ +00069a50: 7465 6e5f 706f 7274 2c20 666c 6167 732c ten_port, flags, │ │ │ +00069a60: 2066 293b 0a09 7d0a 0a09 766f 6964 2064 f);..}...void d │ │ │ +00069a70: 6874 5f74 7261 636b 6572 3a3a 7361 6d70 ht_tracker::samp │ │ │ +00069a80: 6c65 5f69 6e66 6f68 6173 6865 7328 7564 le_infohashes(ud │ │ │ +00069a90: 703a 3a65 6e64 706f 696e 7420 636f 6e73 p::endpoint cons │ │ │ +00069aa0: 7426 616d 703b 2065 702c 2073 6861 315f t& ep, sha1_ │ │ │ +00069ab0: 6861 7368 2063 6f6e 7374 2661 6d70 3b20 hash const& │ │ │ +00069ac0: 7461 7267 6574 0a09 092c 2073 7464 3a3a target..., std:: │ │ │ +00069ad0: 6675 6e63 7469 6f6e 266c 743b 766f 6964 function<void │ │ │ +00069ae0: 286e 6f64 655f 6964 0a09 0909 2c20 7469 (node_id...., ti │ │ │ +00069af0: 6d65 5f64 7572 6174 696f 6e0a 0909 092c me_duration...., │ │ │ +00069b00: 2069 6e74 2c20 7374 643a 3a76 6563 746f int, std::vecto │ │ │ +00069b10: 7226 6c74 3b73 6861 315f 6861 7368 2667 r<sha1_hash&g │ │ │ +00069b20: 743b 0a09 0909 2c20 7374 643a 3a76 6563 t;...., std::vec │ │ │ +00069b30: 746f 7226 6c74 3b73 7464 3a3a 7061 6972 tor<std::pair │ │ │ +00069b40: 266c 743b 7368 6131 5f68 6173 682c 2075 <sha1_hash, u │ │ │ +00069b50: 6470 3a3a 656e 6470 6f69 6e74 2667 743b dp::endpoint> │ │ │ +00069b60: 2667 743b 2926 6774 3b20 6629 0a09 7b0a >)> f)..{. │ │ │ +00069b70: 0909 666f 7220 2861 7574 6f26 616d 703b ..for (auto& │ │ │ +00069b80: 206e 203a 206d 5f6e 6f64 6573 290a 0909 n : m_nodes)... │ │ │ +00069b90: 7b0a 0909 0969 6620 2865 702e 7072 6f74 {....if (ep.prot │ │ │ +00069ba0: 6f63 6f6c 2829 2021 3d20 286e 2e66 6972 ocol() != (n.fir │ │ │ +00069bb0: 7374 2e67 6574 5f65 7874 6572 6e61 6c5f st.get_external_ │ │ │ +00069bc0: 6164 6472 6573 7328 292e 6973 5f76 3428 address().is_v4( │ │ │ +00069bd0: 2920 3f20 7564 703a 3a76 3428 2920 3a20 ) ? udp::v4() : │ │ │ +00069be0: 7564 703a 3a76 3628 2929 290a 3c2f 7072 udp::v6())).rel │ │ │ +00069c20: 6576 616e 6365 266e 6273 703b 303c 2f74 evance 0../src/ka │ │ │ +00069c60: 6465 6d6c 6961 2f72 6f75 7469 6e67 5f74 demlia/routing_t │ │ │ +00069c70: 6162 6c65 2e63 7070 3a32 3839 3c2f 613e able.cpp:289 │ │ │ +00069c80: 3c2f 7464 3e3c 7464 3e54 6869 7320 6973 This is │ │ │ +00069c90: 2074 656d 706f 7261 7279 2e20 466f 7220 temporary. For │ │ │ +00069ca0: 6e6f 772c 206f 6e6c 7920 7265 706f 7274 now, only report │ │ │ +00069cb0: 2074 6865 206c 6172 6765 7374 2072 6f75 the largest rou │ │ │ +00069cc0: 7469 6e67 2074 6162 6c65 2028 6f66 2070 ting table (of p │ │ │ +00069cd0: 6f74 656e 7469 616c 6c79 206d 756c 7469 otentially multi │ │ │ +00069ce0: 706c 6520 6f6e 6573 2c20 666f 7220 6d75 ple ones, for mu │ │ │ +00069cf0: 6c74 692d 686f 6d65 6420 7379 7374 656d lti-homed system │ │ │ +00069d00: 7329 2069 6e20 6e65 7874 206d 616a 6f72 s) in next major │ │ │ +00069d10: 2076 6572 7369 6f6e 2c20 6272 6561 6b20 version, break │ │ │ +00069d20: 7468 6520 4142 4920 616e 6420 7375 7070 the ABI and supp │ │ │ +00069d30: 6f72 7420 7265 706f 7274 696e 6720 616c ort reporting al │ │ │ +00069d40: 6c20 6f66 2074 6865 6d20 696e 2074 6865 l of them in the │ │ │ +00069d50: 2064 6874 5f73 7461 7473 5f61 6c65 7274 dht_stats_alert │ │ │ +00069d60: 3c2f 7464 3e3c 2f74 723e 3c74 7220 6964

    Th │ │ │ +00069db0: 6973 2069 7320 7465 6d70 6f72 6172 792e is is temporary. │ │ │ +00069dc0: 2046 6f72 206e 6f77 2c20 6f6e 6c79 2072 For now, only r │ │ │ +00069dd0: 6570 6f72 7420 7468 6520 6c61 7267 6573 eport the larges │ │ │ +00069de0: 7420 726f 7574 696e 6720 7461 626c 650a t routing table. │ │ │ +00069df0: 286f 6620 706f 7465 6e74 6961 6c6c 7920 (of potentially │ │ │ +00069e00: 6d75 6c74 6970 6c65 206f 6e65 732c 2066 multiple ones, f │ │ │ +00069e10: 6f72 206d 756c 7469 2d68 6f6d 6564 2073 or multi-homed s │ │ │ +00069e20: 7973 7465 6d73 290a 696e 206e 6578 7420 ystems).in next │ │ │ +00069e30: 6d61 6a6f 7220 7665 7273 696f 6e2c 2062 major version, b │ │ │ +00069e40: 7265 616b 2074 6865 2041 4249 2061 6e64 reak the ABI and │ │ │ +00069e50: 2073 7570 706f 7274 2072 6570 6f72 7469 support reporti │ │ │ +00069e60: 6e67 2061 6c6c 206f 6620 7468 656d 2069 ng all of them i │ │ │ +00069e70: 6e0a 7468 6520 6468 745f 7374 6174 735f n.the dht_stats_ │ │ │ +00069e80: 616c 6572 743c 2f68 323e 3c68 343e 2e2e alert

    .. │ │ │ +00069e90: 2f73 7263 2f6b 6164 656d 6c69 612f 726f /src/kademlia/ro │ │ │ +00069ea0: 7574 696e 675f 7461 626c 652e 6370 703a uting_table.cpp: │ │ │ +00069eb0: 3238 393c 2f68 343e 3c70 7265 2073 7479 289

    ., m_bucket_si
    │ │ │ +00069f00: 7a65 2862 7563 6b65 745f 7369 7a65 290a  ze(bucket_size).
    │ │ │ +00069f10: 7b0a 092f 2f20 6275 636b 6574 2073 697a  {..// bucket siz
    │ │ │ +00069f20: 6573 206d 7573 7420 6265 2061 2070 6f77  es must be a pow
    │ │ │ +00069f30: 6572 206f 6620 320a 0954 4f52 5245 4e54  er of 2..TORRENT
    │ │ │ +00069f40: 5f41 5353 4552 545f 5641 4c28 2828 6275  _ASSERT_VAL(((bu
    │ │ │ +00069f50: 636b 6574 5f73 697a 6520 2d20 3129 2026  cket_size - 1) &
    │ │ │ +00069f60: 616d 703b 2062 7563 6b65 745f 7369 7a65  amp; bucket_size
    │ │ │ +00069f70: 2920 3d3d 2030 2c20 6275 636b 6574 5f73  ) == 0, bucket_s
    │ │ │ +00069f80: 697a 6529 3b0a 0954 4f52 5245 4e54 5f55  ize);..TORRENT_U
    │ │ │ +00069f90: 4e55 5345 4428 6c6f 6729 3b0a 096d 5f62  NUSED(log);..m_b
    │ │ │ +00069fa0: 7563 6b65 7473 2e72 6573 6572 7665 2833  uckets.reserve(3
    │ │ │ +00069fb0: 3029 3b0a 7d0a 0a69 6e74 2072 6f75 7469  0);.}..int routi
    │ │ │ +00069fc0: 6e67 5f74 6162 6c65 3a3a 6275 636b 6574  ng_table::bucket
    │ │ │ +00069fd0: 5f6c 696d 6974 2869 6e74 2062 7563 6b65  _limit(int bucke
    │ │ │ +00069fe0: 7429 2063 6f6e 7374 0a7b 0a09 6966 2028  t) const.{..if (
    │ │ │ +00069ff0: 216d 5f73 6574 7469 6e67 732e 6765 745f  !m_settings.get_
    │ │ │ +0006a000: 626f 6f6c 2873 6574 7469 6e67 735f 7061  bool(settings_pa
    │ │ │ +0006a010: 636b 3a3a 6468 745f 6578 7465 6e64 6564  ck::dht_extended
    │ │ │ +0006a020: 5f72 6f75 7469 6e67 5f74 6162 6c65 2929  _routing_table))
    │ │ │ +0006a030: 2072 6574 7572 6e20 6d5f 6275 636b 6574   return m_bucket
    │ │ │ +0006a040: 5f73 697a 653b 0a0a 0973 7461 7469 6320  _size;...static 
    │ │ │ +0006a050: 636f 6e73 7420 6175 783a 3a61 7272 6179  const aux::array
    │ │ │ +0006a060: 266c 743b 696e 742c 2034 2667 743b 2073  <int, 4> s
    │ │ │ +0006a070: 697a 655f 6578 6365 7074 696f 6e73 7b7b  ize_exceptions{{
    │ │ │ +0006a080: 7b31 362c 2038 2c20 342c 2032 7d7d 7d3b  {16, 8, 4, 2}}};
    │ │ │ +0006a090: 0a09 6966 2028 6275 636b 6574 2026 6c74  ..if (bucket <
    │ │ │ +0006a0a0: 3b20 7369 7a65 5f65 7863 6570 7469 6f6e  ; size_exception
    │ │ │ +0006a0b0: 732e 656e 645f 696e 6465 7828 2929 0a09  s.end_index())..
    │ │ │ +0006a0c0: 0972 6574 7572 6e20 6d5f 6275 636b 6574  .return m_bucket
    │ │ │ +0006a0d0: 5f73 697a 6520 2a20 7369 7a65 5f65 7863  _size * size_exc
    │ │ │ +0006a0e0: 6570 7469 6f6e 735b 6275 636b 6574 5d3b  eptions[bucket];
    │ │ │ +0006a0f0: 0a09 7265 7475 726e 206d 5f62 7563 6b65  ..return m_bucke
    │ │ │ +0006a100: 745f 7369 7a65 3b0a 7d0a 0a76 6f69 6420  t_size;.}..void 
    │ │ │ +0006a110: 726f 7574 696e 675f 7461 626c 653a 3a73  routing_table::s
    │ │ │ +0006a120: 7461 7475 7328 7374 643a 3a76 6563 746f  tatus(std::vecto
    │ │ │ +0006a130: 7226 6c74 3b64 6874 5f72 6f75 7469 6e67  r<dht_routing
    │ │ │ +0006a140: 5f62 7563 6b65 7426 6774 3b26 616d 703b  _bucket>&
    │ │ │ +0006a150: 2073 2920 636f 6e73 740a 7b0a 3c64 6976   s) const.{.
    .if (s │ │ │ +0006a190: 2e73 697a 6528 2920 2667 743b 206d 5f62 .size() > m_b │ │ │ +0006a1a0: 7563 6b65 7473 2e73 697a 6528 2929 2072 uckets.size()) r │ │ │ +0006a1b0: 6574 7572 6e3b 0a3c 2f64 6976 3e09 732e eturn;.
    .s. │ │ │ +0006a1c0: 636c 6561 7228 293b 0a09 666f 7220 2861 clear();..for (a │ │ │ +0006a1d0: 7574 6f20 636f 6e73 7426 616d 703b 2069 uto const& i │ │ │ +0006a1e0: 203a 206d 5f62 7563 6b65 7473 290a 097b : m_buckets)..{ │ │ │ +0006a1f0: 0a09 0964 6874 5f72 6f75 7469 6e67 5f62 ...dht_routing_b │ │ │ +0006a200: 7563 6b65 7420 623b 0a09 0962 2e6e 756d ucket b;...b.num │ │ │ +0006a210: 5f6e 6f64 6573 203d 2069 6e74 2869 2e6c _nodes = int(i.l │ │ │ +0006a220: 6976 655f 6e6f 6465 732e 7369 7a65 2829 ive_nodes.size() │ │ │ +0006a230: 293b 0a09 0962 2e6e 756d 5f72 6570 6c61 );...b.num_repla │ │ │ +0006a240: 6365 6d65 6e74 7320 3d20 696e 7428 692e cements = int(i. │ │ │ +0006a250: 7265 706c 6163 656d 656e 7473 2e73 697a replacements.siz │ │ │ +0006a260: 6528 2929 3b0a 0909 732e 7075 7368 5f62 e());...s.push_b │ │ │ +0006a270: 6163 6b28 6229 3b0a 097d 0a7d 0a0a 2369 ack(b);..}.}..#i │ │ │ +0006a280: 6620 544f 5252 454e 545f 4142 495f 5645 f TORRENT_ABI_VE │ │ │ +0006a290: 5253 494f 4e20 3d3d 2031 0a3c 2f70 7265 RSION == 1.
    rele │ │ │ +0006a2d0: 7661 6e63 6526 6e62 7370 3b30 3c2f 7464 vance 0../src/kad │ │ │ +0006a310: 656d 6c69 612f 726f 7574 696e 675f 7461 emlia/routing_ta │ │ │ +0006a320: 626c 652e 6370 703a 3331 343c 2f61 3e3c ble.cpp:314< │ │ │ +0006a330: 2f74 643e 3c74 643e 6172 7669 646e 206e /td>arvidn n │ │ │ +0006a340: 6f74 6520 7768 656e 2069 7427 7320 6163 ote when it's ac │ │ │ +0006a350: 726f 7373 2049 5076 3420 616e 6420 4950 ross IPv4 and IP │ │ │ +0006a360: 7636 2c20 6164 6469 6e67 2028 6468 745f v6, adding (dht_ │ │ │ +0006a370: 676c 6f62 616c 5f6e 6f64 6573 2920 776f global_nodes) wo │ │ │ +0006a380: 756c 6420 6d61 6b65 2073 656e 7365 2e20 uld make sense. │ │ │ +0006a390: 696e 2074 6865 2066 7574 7572 6520 7468 in the future th │ │ │ +0006a3a0: 6f75 6768 2c20 7768 6572 6520 7765 206d ough, where we m │ │ │ +0006a3b0: 6179 2068 6176 6520 6f6e 6520 4448 5420 ay have one DHT │ │ │ +0006a3c0: 6e6f 6465 2070 6572 2065 7874 6572 6e61 node per externa │ │ │ +0006a3d0: 6c20 696e 7465 7266 6163 6520 2877 6869 l interface (whi │ │ │ +0006a3e0: 6368 206d 6179 2062 6520 6d75 6c74 6970 ch may be multip │ │ │ +0006a3f0: 6c65 206f 6620 7468 6520 7361 6d65 2061 le of the same a │ │ │ +0006a400: 6464 7265 7373 2066 616d 696c 7929 2c20 ddress family), │ │ │ +0006a410: 7468 656e 2069 7420 6265 636f 6d65 7320 then it becomes │ │ │ +0006a420: 6120 6269 7420 7472 6963 6b69 6572 3c2f a bit trickier

    arvi │ │ │ +0006a480: 646e 206e 6f74 650a 7768 656e 2069 7427 dn note.when it' │ │ │ +0006a490: 7320 6163 726f 7373 2049 5076 3420 616e s across IPv4 an │ │ │ +0006a4a0: 6420 4950 7636 2c20 6164 6469 6e67 2028 d IPv6, adding ( │ │ │ +0006a4b0: 6468 745f 676c 6f62 616c 5f6e 6f64 6573 dht_global_nodes │ │ │ +0006a4c0: 2920 776f 756c 640a 6d61 6b65 2073 656e ) would.make sen │ │ │ +0006a4d0: 7365 2e20 696e 2074 6865 2066 7574 7572 se. in the futur │ │ │ +0006a4e0: 6520 7468 6f75 6768 2c20 7768 6572 6520 e though, where │ │ │ +0006a4f0: 7765 206d 6179 2068 6176 6520 6f6e 6520 we may have one │ │ │ +0006a500: 4448 5420 6e6f 6465 0a70 6572 2065 7874 DHT node.per ext │ │ │ +0006a510: 6572 6e61 6c20 696e 7465 7266 6163 6520 ernal interface │ │ │ +0006a520: 2877 6869 6368 206d 6179 2062 6520 6d75 (which may be mu │ │ │ +0006a530: 6c74 6970 6c65 206f 6620 7468 6520 7361 ltiple of the sa │ │ │ +0006a540: 6d65 2061 6464 7265 7373 0a66 616d 696c me address.famil │ │ │ +0006a550: 7929 2c20 7468 656e 2069 7420 6265 636f y), then it beco │ │ │ +0006a560: 6d65 7320 6120 6269 7420 7472 6963 6b69 mes a bit tricki │ │ │ +0006a570: 6572 3c2f 6832 3e3c 6834 3e2e 2e2f 7372 er

    ../sr │ │ │ +0006a580: 632f 6b61 6465 6d6c 6961 2f72 6f75 7469 c/kademlia/routi │ │ │ +0006a590: 6e67 5f74 6162 6c65 2e63 7070 3a33 3134 ng_table.cpp:314 │ │ │ +0006a5a0: 3c2f 6834 3e3c 7072 6520 7374 796c 653d

    .
    │ │ │ +0006a5e0: 6966 2028 732e 7369 7a65 2829 2026 6774  if (s.size() >
    │ │ │ +0006a5f0: 3b20 6d5f 6275 636b 6574 732e 7369 7a65  ; m_buckets.size
    │ │ │ +0006a600: 2829 2920 7265 7475 726e 3b0a 0973 2e63  ()) return;..s.c
    │ │ │ +0006a610: 6c65 6172 2829 3b0a 0966 6f72 2028 6175  lear();..for (au
    │ │ │ +0006a620: 746f 2063 6f6e 7374 2661 6d70 3b20 6920  to const& i 
    │ │ │ +0006a630: 3a20 6d5f 6275 636b 6574 7329 0a09 7b0a  : m_buckets)..{.
    │ │ │ +0006a640: 0909 6468 745f 726f 7574 696e 675f 6275  ..dht_routing_bu
    │ │ │ +0006a650: 636b 6574 2062 3b0a 0909 622e 6e75 6d5f  cket b;...b.num_
    │ │ │ +0006a660: 6e6f 6465 7320 3d20 696e 7428 692e 6c69  nodes = int(i.li
    │ │ │ +0006a670: 7665 5f6e 6f64 6573 2e73 697a 6528 2929  ve_nodes.size())
    │ │ │ +0006a680: 3b0a 0909 622e 6e75 6d5f 7265 706c 6163  ;...b.num_replac
    │ │ │ +0006a690: 656d 656e 7473 203d 2069 6e74 2869 2e72  ements = int(i.r
    │ │ │ +0006a6a0: 6570 6c61 6365 6d65 6e74 732e 7369 7a65  eplacements.size
    │ │ │ +0006a6b0: 2829 293b 0a09 0973 2e70 7573 685f 6261  ());...s.push_ba
    │ │ │ +0006a6c0: 636b 2862 293b 0a09 7d0a 7d0a 0a23 6966  ck(b);..}.}..#if
    │ │ │ +0006a6d0: 2054 4f52 5245 4e54 5f41 4249 5f56 4552   TORRENT_ABI_VER
    │ │ │ +0006a6e0: 5349 4f4e 203d 3d20 310a 766f 6964 2072  SION == 1.void r
    │ │ │ +0006a6f0: 6f75 7469 6e67 5f74 6162 6c65 3a3a 7374  outing_table::st
    │ │ │ +0006a700: 6174 7573 2873 6573 7369 6f6e 5f73 7461  atus(session_sta
    │ │ │ +0006a710: 7475 7326 616d 703b 2073 2920 636f 6e73  tus& s) cons
    │ │ │ +0006a720: 740a 7b0a 0969 6e74 2064 6874 5f6e 6f64  t.{..int dht_nod
    │ │ │ +0006a730: 6573 3b0a 0969 6e74 2064 6874 5f6e 6f64  es;..int dht_nod
    │ │ │ +0006a740: 655f 6361 6368 653b 0a09 696e 7420 6967  e_cache;..int ig
    │ │ │ +0006a750: 6e6f 7265 3b0a 0973 7464 3a3a 7469 6528  nore;..std::tie(
    │ │ │ +0006a760: 6468 745f 6e6f 6465 732c 2064 6874 5f6e  dht_nodes, dht_n
    │ │ │ +0006a770: 6f64 655f 6361 6368 652c 2069 676e 6f72  ode_cache, ignor
    │ │ │ +0006a780: 6529 203d 2073 697a 6528 293b 0a09 732e  e) = size();..s.
    │ │ │ +0006a790: 6468 745f 6e6f 6465 7320 2b3d 2064 6874  dht_nodes += dht
    │ │ │ +0006a7a0: 5f6e 6f64 6573 3b0a 0973 2e64 6874 5f6e  _nodes;..s.dht_n
    │ │ │ +0006a7b0: 6f64 655f 6361 6368 6520 2b3d 2064 6874  ode_cache += dht
    │ │ │ +0006a7c0: 5f6e 6f64 655f 6361 6368 653b 0a3c 6469  _node_cache;..s.dh
    │ │ │ +0006a800: 745f 676c 6f62 616c 5f6e 6f64 6573 202b  t_global_nodes +
    │ │ │ +0006a810: 3d20 6e75 6d5f 676c 6f62 616c 5f6e 6f64  = num_global_nod
    │ │ │ +0006a820: 6573 2829 3b0a 3c2f 6469 763e 0a09 666f  es();...fo
    │ │ │ +0006a830: 7220 2861 7574 6f20 636f 6e73 7426 616d  r (auto const&am
    │ │ │ +0006a840: 703b 2069 203a 206d 5f62 7563 6b65 7473  p; i : m_buckets
    │ │ │ +0006a850: 290a 097b 0a09 0964 6874 5f72 6f75 7469  )..{...dht_routi
    │ │ │ +0006a860: 6e67 5f62 7563 6b65 7420 623b 0a09 0962  ng_bucket b;...b
    │ │ │ +0006a870: 2e6e 756d 5f6e 6f64 6573 203d 2069 6e74  .num_nodes = int
    │ │ │ +0006a880: 2869 2e6c 6976 655f 6e6f 6465 732e 7369  (i.live_nodes.si
    │ │ │ +0006a890: 7a65 2829 293b 0a09 0962 2e6e 756d 5f72  ze());...b.num_r
    │ │ │ +0006a8a0: 6570 6c61 6365 6d65 6e74 7320 3d20 696e  eplacements = in
    │ │ │ +0006a8b0: 7428 692e 7265 706c 6163 656d 656e 7473  t(i.replacements
    │ │ │ +0006a8c0: 2e73 697a 6528 2929 3b0a 2369 6620 544f  .size());.#if TO
    │ │ │ +0006a8d0: 5252 454e 545f 4142 495f 5645 5253 494f  RRENT_ABI_VERSIO
    │ │ │ +0006a8e0: 4e20 3d3d 2031 0a09 0962 2e6c 6173 745f  N == 1...b.last_
    │ │ │ +0006a8f0: 6163 7469 7665 203d 2030 3b0a 2365 6e64  active = 0;.#end
    │ │ │ +0006a900: 6966 0a09 0973 2e64 6874 5f72 6f75 7469  if...s.dht_routi
    │ │ │ +0006a910: 6e67 5f74 6162 6c65 2e70 7573 685f 6261  ng_table.push_ba
    │ │ │ +0006a920: 636b 2862 293b 0a09 7d0a 7d0a 2365 6e64  ck(b);..}.}.#end
    │ │ │ +0006a930: 6966 0a0a 7374 643a 3a74 7570 6c65 266c  if..std::tuple&l
    │ │ │ +0006a940: 743b 696e 742c 2069 6e74 2c20 696e 7426  t;int, int, int&
    │ │ │ +0006a950: 6774 3b20 726f 7574 696e 675f 7461 626c  gt; routing_tabl
    │ │ │ +0006a960: 653a 3a73 697a 6528 2920 636f 6e73 740a  e::size() const.
    │ │ │ +0006a970: 7b0a 0969 6e74 206e 6f64 6573 203d 2030  {..int nodes = 0
    │ │ │ +0006a980: 3b0a 0969 6e74 2072 6570 6c61 6365 6d65  ;..int replaceme
    │ │ │ +0006a990: 6e74 7320 3d20 303b 0a09 696e 7420 636f  nts = 0;..int co
    │ │ │ +0006a9a0: 6e66 6972 6d65 6420 3d20 303b 0a09 666f  nfirmed = 0;..fo
    │ │ │ +0006a9b0: 7220 2861 7574 6f20 636f 6e73 7426 616d  r (auto const&am
    │ │ │ +0006a9c0: 703b 2069 203a 206d 5f62 7563 6b65 7473  p; i : m_buckets
    │ │ │ +0006a9d0: 290a 097b 0a09 096e 6f64 6573 202b 3d20  )..{...nodes += 
    │ │ │ +0006a9e0: 696e 7428 692e 6c69 7665 5f6e 6f64 6573  int(i.live_nodes
    │ │ │ +0006a9f0: 2e73 697a 6528 2929 3b0a 0909 636f 6e66  .size());...conf
    │ │ │ +0006aa00: 6972 6d65 6420 2b3d 2073 7461 7469 635f  irmed += static_
    │ │ │ +0006aa10: 6361 7374 266c 743b 696e 7426 6774 3b28  cast<int>(
    │ │ │ +0006aa20: 7374 643a 3a63 6f75 6e74 5f69 6628 692e  std::count_if(i.
    │ │ │ +0006aa30: 6c69 7665 5f6e 6f64 6573 2e62 6567 696e  live_nodes.begin
    │ │ │ +0006aa40: 2829 2c20 692e 6c69 7665 5f6e 6f64 6573  (), i.live_nodes
    │ │ │ +0006aa50: 2e65 6e64 2829 0a09 0909 2c20 5b5d 286e  .end()...., [](n
    │ │ │ +0006aa60: 6f64 655f 656e 7472 7920 636f 6e73 7426  ode_entry const&
    │ │ │ +0006aa70: 616d 703b 206b 2920 7b20 7265 7475 726e  amp; k) { return
    │ │ │ +0006aa80: 206b 2e63 6f6e 6669 726d 6564 2829 3b20   k.confirmed(); 
    │ │ │ +0006aa90: 7d20 2929 3b0a 0a09 0972 6570 6c61 6365  } ));....replace
    │ │ │ +0006aaa0: 6d65 6e74 7320 2b3d 2069 6e74 2869 2e72  ments += int(i.r
    │ │ │ +0006aab0: 6570 6c61 6365 6d65 6e74 732e 7369 7a65  eplacements.size
    │ │ │ +0006aac0: 2829 293b 0a09 7d0a 0972 6574 7572 6e20  ());..}..return 
    │ │ │ +0006aad0: 7374 643a 3a6d 616b 655f 7475 706c 6528  std::make_tuple(
    │ │ │ +0006aae0: 6e6f 6465 732c 2072 6570 6c61 6365 6d65  nodes, replaceme
    │ │ │ +0006aaf0: 6e74 732c 2063 6f6e 6669 726d 6564 293b  nts, confirmed);
    │ │ │ +0006ab00: 0a7d 0a0a 3c2f 7072 653e 3c2f 7464 3e3c  .}..
    < │ │ │ +0006ab10: 2f74 723e 3c74 7220 7374 796c 653d 2262 /tr>relevance&n │ │ │ +0006ab40: 6273 703b 303c 2f74 643e 3c74 643e 3c61 bsp;0. │ │ │ +0006ab70: 2e2f 7372 632f 6b61 6465 6d6c 6961 2f72 ./src/kademlia/r │ │ │ +0006ab80: 6f75 7469 6e67 5f74 6162 6c65 2e63 7070 outing_table.cpp │ │ │ +0006ab90: 3a35 3138 3c2f 613e 3c2f 7464 3e3c 7464 :518this need to ta │ │ │ +0006abb0: 6b65 2062 7563 6b65 7420 2270 7265 6669 ke bucket "prefi │ │ │ +0006abc0: 7822 2069 6e74 6f20 6163 636f 756e 742e x" into account. │ │ │ +0006abd0: 2049 7420 7368 6f75 6c64 2062 6520 756e It should be un │ │ │ +0006abe0: 6966 6965 6420 7769 7468 2061 6464 5f6e ified with add_n │ │ │ +0006abf0: 6f64 655f 696d 706c 2829 3c2f 7464 3e3c ode_impl()< │ │ │ +0006ac00: 2f74 723e 3c74 7220 6964 3d22 3234 3522 /tr>

    this nee │ │ │ +0006ac50: 6420 746f 2074 616b 6520 6275 636b 6574 d to take bucket │ │ │ +0006ac60: 2022 7072 6566 6978 2220 696e 746f 2061 "prefix" into a │ │ │ +0006ac70: 6363 6f75 6e74 2e20 4974 2073 686f 756c ccount. It shoul │ │ │ +0006ac80: 6420 6265 2075 6e69 6669 6564 0a77 6974 d be unified.wit │ │ │ +0006ac90: 6820 6164 645f 6e6f 6465 5f69 6d70 6c28 h add_node_impl( │ │ │ +0006aca0: 293c 2f68 323e 3c68 343e 2e2e 2f73 7263 )

    ../src │ │ │ +0006acb0: 2f6b 6164 656d 6c69 612f 726f 7574 696e /kademlia/routin │ │ │ +0006acc0: 675f 7461 626c 652e 6370 703a 3531 383c g_table.cpp:518< │ │ │ +0006acd0: 2f68 343e 3c70 7265 2073 7479 6c65 3d22 /h4>
    {.
    │ │ │ +0006ad10: 0966 6f72 2028 6175 746f 2069 203d 206d  .for (auto i = m
    │ │ │ +0006ad20: 5f62 7563 6b65 7473 2e62 6567 696e 2829  _buckets.begin()
    │ │ │ +0006ad30: 202c 2065 6e64 286d 5f62 7563 6b65 7473   , end(m_buckets
    │ │ │ +0006ad40: 2e65 6e64 2829 293b 2069 2021 3d20 656e  .end()); i != en
    │ │ │ +0006ad50: 643b 202b 2b69 290a 097b 0a09 0966 6f72  d; ++i)..{...for
    │ │ │ +0006ad60: 2028 6175 746f 206a 203d 2069 2d26 6774   (auto j = i->
    │ │ │ +0006ad70: 3b72 6570 6c61 6365 6d65 6e74 732e 6265  ;replacements.be
    │ │ │ +0006ad80: 6769 6e28 293b 206a 2021 3d20 692d 2667  gin(); j != i-&g
    │ │ │ +0006ad90: 743b 7265 706c 6163 656d 656e 7473 2e65  t;replacements.e
    │ │ │ +0006ada0: 6e64 2829 3b20 2b2b 6a29 0a09 097b 0a09  nd(); ++j)...{..
    │ │ │ +0006adb0: 0909 6966 2028 6a2d 2667 743b 6164 6472  ..if (j->addr
    │ │ │ +0006adc0: 2829 2021 3d20 6570 2e61 6464 7265 7373  () != ep.address
    │ │ │ +0006add0: 2829 2920 636f 6e74 696e 7565 3b0a 0909  ()) continue;...
    │ │ │ +0006ade0: 0969 6620 286a 2d26 6774 3b70 6f72 7428  .if (j->port(
    │ │ │ +0006adf0: 2920 213d 2065 702e 706f 7274 2829 2920  ) != ep.port()) 
    │ │ │ +0006ae00: 636f 6e74 696e 7565 3b0a 0909 0972 6574  continue;....ret
    │ │ │ +0006ae10: 7572 6e20 7374 643a 3a6d 616b 655f 7475  urn std::make_tu
    │ │ │ +0006ae20: 706c 6528 2661 6d70 3b2a 6a2c 2069 2c20  ple(&*j, i, 
    │ │ │ +0006ae30: 2661 6d70 3b69 2d26 6774 3b72 6570 6c61  &i->repla
    │ │ │ +0006ae40: 6365 6d65 6e74 7329 3b0a 0909 7d0a 0909  cements);...}...
    │ │ │ +0006ae50: 666f 7220 2861 7574 6f20 6a20 3d20 692d  for (auto j = i-
    │ │ │ +0006ae60: 2667 743b 6c69 7665 5f6e 6f64 6573 2e62  >live_nodes.b
    │ │ │ +0006ae70: 6567 696e 2829 3b20 6a20 213d 2069 2d26  egin(); j != i-&
    │ │ │ +0006ae80: 6774 3b6c 6976 655f 6e6f 6465 732e 656e  gt;live_nodes.en
    │ │ │ +0006ae90: 6428 293b 202b 2b6a 290a 0909 7b0a 0909  d(); ++j)...{...
    │ │ │ +0006aea0: 0969 6620 286a 2d26 6774 3b61 6464 7228  .if (j->addr(
    │ │ │ +0006aeb0: 2920 213d 2065 702e 6164 6472 6573 7328  ) != ep.address(
    │ │ │ +0006aec0: 2929 2063 6f6e 7469 6e75 653b 0a09 0909  )) continue;....
    │ │ │ +0006aed0: 6966 2028 6a2d 2667 743b 706f 7274 2829  if (j->port()
    │ │ │ +0006aee0: 2021 3d20 6570 2e70 6f72 7428 2929 2063   != ep.port()) c
    │ │ │ +0006aef0: 6f6e 7469 6e75 653b 0a09 0909 7265 7475  ontinue;....retu
    │ │ │ +0006af00: 726e 2073 7464 3a3a 6d61 6b65 5f74 7570  rn std::make_tup
    │ │ │ +0006af10: 6c65 2826 616d 703b 2a6a 2c20 692c 2026  le(&*j, i, &
    │ │ │ +0006af20: 616d 703b 692d 2667 743b 6c69 7665 5f6e  amp;i->live_n
    │ │ │ +0006af30: 6f64 6573 293b 0a09 097d 0a09 7d0a 0972  odes);...}..}..r
    │ │ │ +0006af40: 6574 7572 6e20 7374 643a 3a74 7570 6c65  eturn std::tuple
    │ │ │ +0006af50: 266c 743b 6e6f 6465 5f65 6e74 7279 2a2c  <node_entry*,
    │ │ │ +0006af60: 2072 6f75 7469 6e67 5f74 6162 6c65 3a3a   routing_table::
    │ │ │ +0006af70: 7461 626c 655f 743a 3a69 7465 7261 746f  table_t::iterato
    │ │ │ +0006af80: 722c 2062 7563 6b65 745f 742a 2667 743b  r, bucket_t*>
    │ │ │ +0006af90: 0a09 7b6e 756c 6c70 7472 2c20 6d5f 6275  ..{nullptr, m_bu
    │ │ │ +0006afa0: 636b 6574 732e 656e 6428 292c 206e 756c  ckets.end(), nul
    │ │ │ +0006afb0: 6c70 7472 7d3b 0a7d 0a0a 3c64 6976 2073  lptr};.}..
    void rou │ │ │ +0006aff0: 7469 6e67 5f74 6162 6c65 3a3a 6669 6c6c ting_table::fill │ │ │ +0006b000: 5f66 726f 6d5f 7265 706c 6163 656d 656e _from_replacemen │ │ │ +0006b010: 7473 2874 6162 6c65 5f74 3a3a 6974 6572 ts(table_t::iter │ │ │ +0006b020: 6174 6f72 2062 7563 6b65 7429 0a3c 2f64 ator bucket).{..bucket_t&a │ │ │ +0006b040: 6d70 3b20 6220 3d20 6275 636b 6574 2d26 mp; b = bucket-& │ │ │ +0006b050: 6774 3b6c 6976 655f 6e6f 6465 733b 0a09 gt;live_nodes;.. │ │ │ +0006b060: 6275 636b 6574 5f74 2661 6d70 3b20 7262 bucket_t& rb │ │ │ +0006b070: 203d 2062 7563 6b65 742d 2667 743b 7265 = bucket->re │ │ │ +0006b080: 706c 6163 656d 656e 7473 3b0a 0969 6e74 placements;..int │ │ │ +0006b090: 2063 6f6e 7374 2062 7563 6b65 745f 7369 const bucket_si │ │ │ +0006b0a0: 7a65 203d 2062 7563 6b65 745f 6c69 6d69 ze = bucket_limi │ │ │ +0006b0b0: 7428 696e 7428 7374 643a 3a64 6973 7461 t(int(std::dista │ │ │ +0006b0c0: 6e63 6528 6d5f 6275 636b 6574 732e 6265 nce(m_buckets.be │ │ │ +0006b0d0: 6769 6e28 292c 2062 7563 6b65 7429 2929 gin(), bucket))) │ │ │ +0006b0e0: 3b0a 0a09 6966 2028 696e 7428 622e 7369 ;...if (int(b.si │ │ │ +0006b0f0: 7a65 2829 2920 2667 743b 3d20 6275 636b ze()) >= buck │ │ │ +0006b100: 6574 5f73 697a 6529 2072 6574 7572 6e3b et_size) return; │ │ │ +0006b110: 0a0a 092f 2f20 736f 7274 2062 7920 5254 ...// sort by RT │ │ │ +0006b120: 5420 6669 7273 742c 2074 6f20 6669 6e64 T first, to find │ │ │ +0006b130: 2074 6865 206e 6f64 6520 7769 7468 2074 the node with t │ │ │ +0006b140: 6865 206c 6f77 6573 740a 092f 2f20 5254 he lowest..// RT │ │ │ +0006b150: 5420 7468 6174 2069 7320 7069 6e67 6564 T that is pinged │ │ │ +0006b160: 0a09 7374 643a 3a73 6f72 7428 7262 2e62 ..std::sort(rb.b │ │ │ +0006b170: 6567 696e 2829 2c20 7262 2e65 6e64 2829 egin(), rb.end() │ │ │ +0006b180: 293b 0a0a 0977 6869 6c65 2028 696e 7428 );...while (int( │ │ │ +0006b190: 622e 7369 7a65 2829 2920 266c 743b 2062 b.size()) < b │ │ │ +0006b1a0: 7563 6b65 745f 7369 7a65 2026 616d 703b ucket_size & │ │ │ +0006b1b0: 2661 6d70 3b20 2172 622e 656d 7074 7928 & !rb.empty( │ │ │ +0006b1c0: 2929 0a09 7b0a 0909 6175 746f 206a 203d ))..{...auto j = │ │ │ +0006b1d0: 2073 7464 3a3a 6669 6e64 5f69 6628 7262 std::find_if(rb │ │ │ +0006b1e0: 2e62 6567 696e 2829 2c20 7262 2e65 6e64 .begin(), rb.end │ │ │ +0006b1f0: 2829 2c20 7374 643a 3a62 696e 6428 2661 (), std::bind(&a │ │ │ +0006b200: 6d70 3b6e 6f64 655f 656e 7472 793a 3a70 mp;node_entry::p │ │ │ +0006b210: 696e 6765 642c 205f 3129 293b 0a09 0969 inged, _1));...i │ │ │ +0006b220: 6620 286a 203d 3d20 7262 2e65 6e64 2829 f (j == rb.end() │ │ │ +0006b230: 2920 6272 6561 6b3b 0a09 0962 2e70 7573 ) break;...b.pus │ │ │ +0006b240: 685f 6261 636b 282a 6a29 3b0a 0909 7262 h_back(*j);...rb │ │ │ +0006b250: 2e65 7261 7365 286a 293b 0a09 7d0a 7d0a .erase(j);..}.}. │ │ │ +0006b260: 0a76 6f69 6420 726f 7574 696e 675f 7461 .void routing_ta │ │ │ +0006b270: 626c 653a 3a70 7275 6e65 5f65 6d70 7479 ble::prune_empty │ │ │ +0006b280: 5f62 7563 6b65 7428 290a 7b0a 0969 6620 _bucket().{..if │ │ │ +0006b290: 286d 5f62 7563 6b65 7473 2e62 6163 6b28 (m_buckets.back( │ │ │ +0006b2a0: 292e 6c69 7665 5f6e 6f64 6573 2e65 6d70 ).live_nodes.emp │ │ │ +0006b2b0: 7479 2829 0a09 0926 616d 703b 2661 6d70 ty()...&& │ │ │ +0006b2c0: 3b20 6d5f 6275 636b 6574 732e 6261 636b ; m_buckets.back │ │ │ +0006b2d0: 2829 2e72 6570 6c61 6365 6d65 6e74 732e ().replacements. │ │ │ +0006b2e0: 656d 7074 7928 2929 0a09 7b0a 0909 6d5f empty())..{...m_ │ │ │ +0006b2f0: 6275 636b 6574 732e 6572 6173 6528 6d5f buckets.erase(m_ │ │ │ +0006b300: 6275 636b 6574 732e 656e 6428 2920 2d20 buckets.end() - │ │ │ +0006b310: 3129 3b0a 097d 0a7d 0a0a 766f 6964 2072 1);..}.}..void r │ │ │ +0006b320: 6f75 7469 6e67 5f74 6162 6c65 3a3a 7265 outing_table::re │ │ │ +0006b330: 6d6f 7665 5f6e 6f64 6528 6e6f 6465 5f65 move_node(node_e │ │ │ +0006b340: 6e74 7279 2a20 6e2c 2062 7563 6b65 745f ntry* n, bucket_ │ │ │ +0006b350: 742a 2062 290a 3c2f 7072 653e 3c2f 7464 t* b).
    relevance │ │ │ +0006b390: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ +0006b3a0: 3c61 2068 7265 663d 226a 6176 6173 6372 ../src/kademlia │ │ │ +0006b3d0: 2f6e 6f64 655f 6964 2e63 7070 3a36 363c /node_id.cpp:66< │ │ │ +0006b3e0: 2f61 3e3c 2f74 643e 3c74 643e 6974 2773 /a>it's │ │ │ +0006b3f0: 2061 206c 6974 746c 6520 6269 7420 7765 a little bit we │ │ │ +0006b400: 6972 6420 746f 2072 6574 7572 6e20 3135 ird to return 15 │ │ │ +0006b410: 3920 2d20 6c65 6164 696e 6720 7a65 726f 9 - leading zero │ │ │ +0006b420: 6573 2e20 4974 2073 686f 756c 6420 7072 es. It should pr │ │ │ +0006b430: 6f62 6162 6c79 2062 6520 3136 3020 2d20 obably be 160 - │ │ │ +0006b440: 6c65 6164 696e 6720 7a65 726f 6573 2c20 leading zeroes, │ │ │ +0006b450: 6275 7420 616c 6c20 6f74 6865 7220 636f but all other co │ │ │ +0006b460: 6465 2069 6e20 6865 7265 2069 7320 7475 de in here is tu │ │ │ +0006b470: 6e65 6420 746f 2074 6869 7320 6578 7065 ned to this expe │ │ │ +0006b480: 6374 6174 696f 6e20 6e6f 772c 2061 6e64 ctation now, and │ │ │ +0006b490: 2069 7420 646f 6573 6e27 7420 7265 616c it doesn't real │ │ │ +0006b4a0: 6c79 206d 6174 7465 7220 286f 7468 6572 ly matter (other │ │ │ +0006b4b0: 2074 6861 6e20 636f 6d70 6c65 7869 7479 than complexity │ │ │ +0006b4c0: 293c 2f74 643e 3c2f 7472 3e3c 7472 2069 )

    i │ │ │ +0006b510: 7427 7320 6120 6c69 7474 6c65 2062 6974 t's a little bit │ │ │ +0006b520: 2077 6569 7264 2074 6f20 7265 7475 726e weird to return │ │ │ +0006b530: 2031 3539 202d 206c 6561 6469 6e67 207a 159 - leading z │ │ │ +0006b540: 6572 6f65 732e 2049 7420 7368 6f75 6c64 eroes. It should │ │ │ +0006b550: 0a70 726f 6261 626c 7920 6265 2031 3630 .probably be 160 │ │ │ +0006b560: 202d 206c 6561 6469 6e67 207a 6572 6f65 - leading zeroe │ │ │ +0006b570: 732c 2062 7574 2061 6c6c 206f 7468 6572 s, but all other │ │ │ +0006b580: 2063 6f64 6520 696e 2068 6572 6520 6973 code in here is │ │ │ +0006b590: 2074 756e 6564 2074 6f0a 7468 6973 2065 tuned to.this e │ │ │ +0006b5a0: 7870 6563 7461 7469 6f6e 206e 6f77 2c20 xpectation now, │ │ │ +0006b5b0: 616e 6420 6974 2064 6f65 736e 2774 2072 and it doesn't r │ │ │ +0006b5c0: 6561 6c6c 7920 6d61 7474 6572 2028 6f74 eally matter (ot │ │ │ +0006b5d0: 6865 7220 7468 616e 2063 6f6d 706c 6578 her than complex │ │ │ +0006b5e0: 6974 7929 3c2f 6832 3e3c 6834 3e2e 2e2f ity)

    ../ │ │ │ +0006b5f0: 7372 632f 6b61 6465 6d6c 6961 2f6e 6f64 src/kademlia/nod │ │ │ +0006b600: 655f 6964 2e63 7070 3a36 363c 2f68 343e e_id.cpp:66

    │ │ │ +0006b610: 3c70 7265 2073 7479 6c65 3d22 6261 636b
    .// re
    │ │ │ +0006b650: 7475 726e 7320 7468 6520 6469 7374 616e  turns the distan
    │ │ │ +0006b660: 6365 2062 6574 7765 656e 2074 6865 2074  ce between the t
    │ │ │ +0006b670: 776f 206e 6f64 6573 0a2f 2f20 7573 696e  wo nodes.// usin
    │ │ │ +0006b680: 6720 7468 6520 6b61 6465 6d6c 6961 2058  g the kademlia X
    │ │ │ +0006b690: 4f52 2d6d 6574 7269 630a 6e6f 6465 5f69  OR-metric.node_i
    │ │ │ +0006b6a0: 6420 6469 7374 616e 6365 286e 6f64 655f  d distance(node_
    │ │ │ +0006b6b0: 6964 2063 6f6e 7374 2661 6d70 3b20 6e31  id const& n1
    │ │ │ +0006b6c0: 2c20 6e6f 6465 5f69 6420 636f 6e73 7426  , node_id const&
    │ │ │ +0006b6d0: 616d 703b 206e 3229 0a7b 0a09 7265 7475  amp; n2).{..retu
    │ │ │ +0006b6e0: 726e 206e 3120 5e20 6e32 3b0a 7d0a 0a2f  rn n1 ^ n2;.}../
    │ │ │ +0006b6f0: 2f20 7265 7475 726e 7320 7472 7565 2069  / returns true i
    │ │ │ +0006b700: 663a 2064 6973 7461 6e63 6528 6e31 2c20  f: distance(n1, 
    │ │ │ +0006b710: 7265 6629 2026 6c74 3b20 6469 7374 616e  ref) < distan
    │ │ │ +0006b720: 6365 286e 322c 2072 6566 290a 626f 6f6c  ce(n2, ref).bool
    │ │ │ +0006b730: 2063 6f6d 7061 7265 5f72 6566 286e 6f64   compare_ref(nod
    │ │ │ +0006b740: 655f 6964 2063 6f6e 7374 2661 6d70 3b20  e_id const& 
    │ │ │ +0006b750: 6e31 2c20 6e6f 6465 5f69 6420 636f 6e73  n1, node_id cons
    │ │ │ +0006b760: 7426 616d 703b 206e 322c 206e 6f64 655f  t& n2, node_
    │ │ │ +0006b770: 6964 2063 6f6e 7374 2661 6d70 3b20 7265  id const& re
    │ │ │ +0006b780: 6629 0a7b 0a09 6e6f 6465 5f69 6420 636f  f).{..node_id co
    │ │ │ +0006b790: 6e73 7420 6c68 7320 3d20 6e31 205e 2072  nst lhs = n1 ^ r
    │ │ │ +0006b7a0: 6566 3b0a 096e 6f64 655f 6964 2063 6f6e  ef;..node_id con
    │ │ │ +0006b7b0: 7374 2072 6873 203d 206e 3220 5e20 7265  st rhs = n2 ^ re
    │ │ │ +0006b7c0: 663b 0a09 7265 7475 726e 206c 6873 2026  f;..return lhs &
    │ │ │ +0006b7d0: 6c74 3b20 7268 733b 0a7d 0a0a 2f2f 2072  lt; rhs;.}..// r
    │ │ │ +0006b7e0: 6574 7572 6e73 206e 2069 6e3a 2032 5e6e  eturns n in: 2^n
    │ │ │ +0006b7f0: 2026 6c74 3b3d 2064 6973 7461 6e63 6528   <= distance(
    │ │ │ +0006b800: 6e31 2c20 6e32 2920 266c 743b 2032 5e28  n1, n2) < 2^(
    │ │ │ +0006b810: 6e2b 3129 0a2f 2f20 7573 6566 756c 2066  n+1).// useful f
    │ │ │ +0006b820: 6f72 2066 696e 6469 6e67 206f 7574 2077  or finding out w
    │ │ │ +0006b830: 6869 6368 2062 7563 6b65 7420 6120 6e6f  hich bucket a no
    │ │ │ +0006b840: 6465 2062 656c 6f6e 6773 2074 6f0a 696e  de belongs to.in
    │ │ │ +0006b850: 7420 6469 7374 616e 6365 5f65 7870 286e  t distance_exp(n
    │ │ │ +0006b860: 6f64 655f 6964 2063 6f6e 7374 2661 6d70  ode_id const&
    │ │ │ +0006b870: 3b20 6e31 2c20 6e6f 6465 5f69 6420 636f  ; n1, node_id co
    │ │ │ +0006b880: 6e73 7426 616d 703b 206e 3229 0a7b 0a3c  nst& n2).{.<
    │ │ │ +0006b890: 6469 7620 7374 796c 653d 2262 6163 6b67  div style="backg
    │ │ │ +0006b8a0: 726f 756e 643a 2023 6666 6666 3030 2220  round: #ffff00" 
    │ │ │ +0006b8b0: 7769 6474 683d 2231 3030 2522 3e09 7265  width="100%">.re
    │ │ │ +0006b8c0: 7475 726e 2073 7464 3a3a 6d61 7828 3135  turn std::max(15
    │ │ │ +0006b8d0: 3920 2d20 6469 7374 616e 6365 286e 312c  9 - distance(n1,
    │ │ │ +0006b8e0: 206e 3229 2e63 6f75 6e74 5f6c 6561 6469   n2).count_leadi
    │ │ │ +0006b8f0: 6e67 5f7a 6572 6f65 7328 292c 2030 293b  ng_zeroes(), 0);
    │ │ │ +0006b900: 0a3c 2f64 6976 3e7d 0a0a 696e 7420 6d69  .}..int mi
    │ │ │ +0006b910: 6e5f 6469 7374 616e 6365 5f65 7870 286e  n_distance_exp(n
    │ │ │ +0006b920: 6f64 655f 6964 2063 6f6e 7374 2661 6d70  ode_id const&
    │ │ │ +0006b930: 3b20 6e31 2c20 7374 643a 3a76 6563 746f  ; n1, std::vecto
    │ │ │ +0006b940: 7226 6c74 3b6e 6f64 655f 6964 2667 743b  r<node_id>
    │ │ │ +0006b950: 2063 6f6e 7374 2661 6d70 3b20 6964 7329   const& ids)
    │ │ │ +0006b960: 0a7b 0a09 544f 5252 454e 545f 4153 5345  .{..TORRENT_ASSE
    │ │ │ +0006b970: 5254 2869 6473 2e73 697a 6528 2920 2667  RT(ids.size() &g
    │ │ │ +0006b980: 743b 2030 293b 0a0a 0969 6e74 206d 696e  t; 0);...int min
    │ │ │ +0006b990: 203d 2031 3630 3b20 2f2f 2073 6565 2064   = 160; // see d
    │ │ │ +0006b9a0: 6973 7461 6e63 655f 6578 7020 666f 7220  istance_exp for 
    │ │ │ +0006b9b0: 7468 6520 7768 7920 6f66 2074 6869 7320  the why of this 
    │ │ │ +0006b9c0: 636f 6e73 7461 6e74 0a09 666f 7220 2861  constant..for (a
    │ │ │ +0006b9d0: 7574 6f20 636f 6e73 7426 616d 703b 206e  uto const& n
    │ │ │ +0006b9e0: 6f64 655f 6964 203a 2069 6473 290a 097b  ode_id : ids)..{
    │ │ │ +0006b9f0: 0a09 096d 696e 203d 2073 7464 3a3a 6d69  ...min = std::mi
    │ │ │ +0006ba00: 6e28 6d69 6e2c 2064 6973 7461 6e63 655f  n(min, distance_
    │ │ │ +0006ba10: 6578 7028 6e31 2c20 6e6f 6465 5f69 6429  exp(n1, node_id)
    │ │ │ +0006ba20: 293b 0a09 7d0a 0a09 7265 7475 726e 206d  );..}...return m
    │ │ │ +0006ba30: 696e 3b0a 7d0a 0a6e 6f64 655f 6964 2067  in;.}..node_id g
    │ │ │ +0006ba40: 656e 6572 6174 655f 6964 5f69 6d70 6c28  enerate_id_impl(
    │ │ │ +0006ba50: 6164 6472 6573 7320 636f 6e73 7426 616d  address const&am
    │ │ │ +0006ba60: 703b 2069 705f 2c20 7374 643a 3a75 696e  p; ip_, std::uin
    │ │ │ +0006ba70: 7433 325f 7420 7229 0a7b 0a09 7374 643a  t32_t r).{..std:
    │ │ │ +0006ba80: 3a75 696e 7438 5f74 2a20 6970 203d 206e  :uint8_t* ip = n
    │ │ │ +0006ba90: 756c 6c70 7472 3b0a 0a09 7374 6174 6963  ullptr;...static
    │ │ │ +0006baa0: 2073 7464 3a3a 7569 6e74 385f 7420 636f   std::uint8_t co
    │ │ │ +0006bab0: 6e73 7420 7634 6d61 736b 5b5d 203d 207b  nst v4mask[] = {
    │ │ │ +0006bac0: 2030 7830 332c 2030 7830 662c 2030 7833   0x03, 0x0f, 0x3
    │ │ │ +0006bad0: 662c 2030 7866 6620 7d3b 0a09 7374 6174  f, 0xff };..stat
    │ │ │ +0006bae0: 6963 2073 7464 3a3a 7569 6e74 385f 7420  ic std::uint8_t 
    │ │ │ +0006baf0: 636f 6e73 7420 7636 6d61 736b 5b5d 203d  const v6mask[] =
    │ │ │ +0006bb00: 207b 2030 7830 312c 2030 7830 332c 2030   { 0x01, 0x03, 0
    │ │ │ +0006bb10: 7830 372c 2030 7830 662c 2030 7831 662c  x07, 0x0f, 0x1f,
    │ │ │ +0006bb20: 2030 7833 662c 2030 7837 662c 2030 7866   0x3f, 0x7f, 0xf
    │ │ │ +0006bb30: 6620 7d3b 0a09 7374 643a 3a75 696e 7438  f };..std::uint8
    │ │ │ +0006bb40: 5f74 2063 6f6e 7374 2a20 6d61 736b 203d  _t const* mask =
    │ │ │ +0006bb50: 206e 756c 6c70 7472 3b0a 0969 6e74 206e   nullptr;..int n
    │ │ │ +0006bb60: 756d 5f6f 6374 6574 7320 3d20 303b 0a0a  um_octets = 0;..
    │ │ │ +0006bb70: 0961 6464 7265 7373 5f76 343a 3a62 7974  .address_v4::byt
    │ │ │ +0006bb80: 6573 5f74 7970 6520 6234 7b7d 3b0a 0961  es_type b4{};..a
    │ │ │ +0006bb90: 6464 7265 7373 5f76 363a 3a62 7974 6573  ddress_v6::bytes
    │ │ │ +0006bba0: 5f74 7970 6520 6236 7b7d 3b0a 0969 6620  _type b6{};..if 
    │ │ │ +0006bbb0: 2869 705f 2e69 735f 7636 2829 290a 097b  (ip_.is_v6())..{
    │ │ │ +0006bbc0: 0a09 0962 3620 3d20 6970 5f2e 746f 5f76  ...b6 = ip_.to_v
    │ │ │ +0006bbd0: 3628 292e 746f 5f62 7974 6573 2829 3b0a  6().to_bytes();.
    │ │ │ +0006bbe0: 0909 6970 203d 2062 362e 6461 7461 2829  ..ip = b6.data()
    │ │ │ +0006bbf0: 3b0a 3c2f 7072 653e 3c2f 7464 3e3c 2f74  ;.
    < │ │ │ +0006bc20: 7464 3e72 656c 6576 616e 6365 266e 6273 td>relevance&nbs │ │ │ +0006bc30: 703b 303c 2f74 643e 3c74 643e 3c61 2068 p;0
    ../ │ │ │ +0006bc60: 7372 632f 6b61 6465 6d6c 6961 2f6e 6f64 src/kademlia/nod │ │ │ +0006bc70: 652e 6370 703a 3131 3737 3c2f 613e 3c2f e.cpp:1177keep the │ │ │ +0006bc90: 7265 7475 726e 6564 2076 616c 7565 2074 returned value t │ │ │ +0006bca0: 6f20 7061 7373 2061 7320 6120 6c69 6d69 o pass as a limi │ │ │ +0006bcb0: 7420 746f 2077 7269 7465 5f6e 6f64 6573 t to write_nodes │ │ │ +0006bcc0: 5f65 6e74 7269 6573 2077 6865 6e20 696d _entries when im │ │ │ +0006bcd0: 706c 656d 656e 7465 643c 2f74 643e 3c2f plemented

    keep the │ │ │ +0006bd30: 7265 7475 726e 6564 2076 616c 7565 2074 returned value t │ │ │ +0006bd40: 6f20 7061 7373 2061 7320 6120 6c69 6d69 o pass as a limi │ │ │ +0006bd50: 740a 746f 2077 7269 7465 5f6e 6f64 6573 t.to write_nodes │ │ │ +0006bd60: 5f65 6e74 7269 6573 2077 6865 6e20 696d _entries when im │ │ │ +0006bd70: 706c 656d 656e 7465 643c 2f68 323e 3c68 plemented

    ../src/kademli │ │ │ +0006bd90: 612f 6e6f 6465 2e63 7070 3a31 3137 373c a/node.cpp:1177< │ │ │ +0006bda0: 2f68 343e 3c70 7265 2073 7479 6c65 3d22 /h4>
    ..
    │ │ │ +0006bde0: 7d0a 097d 0a09 656c 7365 2069 6620 2871  }..}..else if (q
    │ │ │ +0006bdf0: 7565 7279 203d 3d20 2273 616d 706c 655f  uery == "sample_
    │ │ │ +0006be00: 696e 666f 6861 7368 6573 2229 0a09 7b0a  infohashes")..{.
    │ │ │ +0006be10: 0909 7374 6174 6963 206b 6579 5f64 6573  ..static key_des
    │ │ │ +0006be20: 635f 7420 636f 6e73 7420 6d73 675f 6465  c_t const msg_de
    │ │ │ +0006be30: 7363 5b5d 203d 207b 0a09 0909 7b22 7461  sc[] = {....{"ta
    │ │ │ +0006be40: 7267 6574 222c 2062 6465 636f 6465 5f6e  rget", bdecode_n
    │ │ │ +0006be50: 6f64 653a 3a73 7472 696e 675f 742c 2032  ode::string_t, 2
    │ │ │ +0006be60: 302c 2030 7d2c 0a09 0909 7b22 7761 6e74  0, 0},....{"want
    │ │ │ +0006be70: 222c 2062 6465 636f 6465 5f6e 6f64 653a  ", bdecode_node:
    │ │ │ +0006be80: 3a6c 6973 745f 742c 2030 2c20 6b65 795f  :list_t, 0, key_
    │ │ │ +0006be90: 6465 7363 5f74 3a3a 6f70 7469 6f6e 616c  desc_t::optional
    │ │ │ +0006bea0: 7d2c 0a09 097d 3b0a 0a09 0962 6465 636f  },...};....bdeco
    │ │ │ +0006beb0: 6465 5f6e 6f64 6520 6d73 675f 6b65 7973  de_node msg_keys
    │ │ │ +0006bec0: 5b32 5d3b 0a09 0969 6620 2821 7665 7269  [2];...if (!veri
    │ │ │ +0006bed0: 6679 5f6d 6573 7361 6765 2861 7267 5f65  fy_message(arg_e
    │ │ │ +0006bee0: 6e74 2c20 6d73 675f 6465 7363 2c20 6d73  nt, msg_desc, ms
    │ │ │ +0006bef0: 675f 6b65 7973 2c20 6572 726f 725f 7374  g_keys, error_st
    │ │ │ +0006bf00: 7269 6e67 2929 0a09 097b 0a09 0909 6d5f  ring))...{....m_
    │ │ │ +0006bf10: 636f 756e 7465 7273 2e69 6e63 5f73 7461  counters.inc_sta
    │ │ │ +0006bf20: 7473 5f63 6f75 6e74 6572 2863 6f75 6e74  ts_counter(count
    │ │ │ +0006bf30: 6572 733a 3a64 6874 5f69 6e76 616c 6964  ers::dht_invalid
    │ │ │ +0006bf40: 5f73 616d 706c 655f 696e 666f 6861 7368  _sample_infohash
    │ │ │ +0006bf50: 6573 293b 0a09 0909 696e 636f 6d69 6e67  es);....incoming
    │ │ │ +0006bf60: 5f65 7272 6f72 2865 2c20 6572 726f 725f  _error(e, error_
    │ │ │ +0006bf70: 7374 7269 6e67 293b 0a09 0909 7265 7475  string);....retu
    │ │ │ +0006bf80: 726e 3b0a 0909 7d0a 0a09 096d 5f63 6f75  rn;...}....m_cou
    │ │ │ +0006bf90: 6e74 6572 732e 696e 635f 7374 6174 735f  nters.inc_stats_
    │ │ │ +0006bfa0: 636f 756e 7465 7228 636f 756e 7465 7273  counter(counters
    │ │ │ +0006bfb0: 3a3a 6468 745f 7361 6d70 6c65 5f69 6e66  ::dht_sample_inf
    │ │ │ +0006bfc0: 6f68 6173 6865 735f 696e 293b 0a09 0973  ohashes_in);...s
    │ │ │ +0006bfd0: 6861 315f 6861 7368 2063 6f6e 7374 2074  ha1_hash const t
    │ │ │ +0006bfe0: 6172 6765 7428 6d73 675f 6b65 7973 5b30  arget(msg_keys[0
    │ │ │ +0006bff0: 5d2e 7374 7269 6e67 5f70 7472 2829 293b  ].string_ptr());
    │ │ │ +0006c000: 0a0a 3c64 6976 2073 7479 6c65 3d22 6261  ..
    │ │ │ +0006c030: 0909 6d5f 7374 6f72 6167 652e 6765 745f ..m_storage.get_ │ │ │ +0006c040: 696e 666f 6861 7368 6573 5f73 616d 706c infohashes_sampl │ │ │ +0006c050: 6528 7265 706c 7929 3b0a 3c2f 6469 763e e(reply);.
    │ │ │ +0006c060: 0a09 0977 7269 7465 5f6e 6f64 6573 5f65 ...write_nodes_e │ │ │ +0006c070: 6e74 7269 6573 2874 6172 6765 742c 206d ntries(target, m │ │ │ +0006c080: 7367 5f6b 6579 735b 315d 2c20 7265 706c sg_keys[1], repl │ │ │ +0006c090: 7929 3b0a 097d 0a09 656c 7365 0a09 7b0a y);..}..else..{. │ │ │ +0006c0a0: 0909 2f2f 2069 6620 7765 2064 6f6e 2774 ..// if we don't │ │ │ +0006c0b0: 2072 6563 6f67 6e69 7a65 2074 6865 206d recognize the m │ │ │ +0006c0c0: 6573 7361 6765 2062 7574 2074 6865 7265 essage but there │ │ │ +0006c0d0: 2773 2061 0a09 092f 2f20 2774 6172 6765 's a...// 'targe │ │ │ +0006c0e0: 7427 206f 7220 2769 6e66 6f5f 6861 7368 t' or 'info_hash │ │ │ +0006c0f0: 2720 696e 2074 6865 2061 7267 756d 656e ' in the argumen │ │ │ +0006c100: 7473 2c20 7472 6561 7420 6974 0a09 092f ts, treat it.../ │ │ │ +0006c110: 2f20 6173 2066 696e 645f 6e6f 6465 2074 / as find_node t │ │ │ +0006c120: 6f20 6265 2066 7574 7572 6520 636f 6d70 o be future comp │ │ │ +0006c130: 6174 6962 6c65 0a09 0962 6465 636f 6465 atible...bdecode │ │ │ +0006c140: 5f6e 6f64 6520 7461 7267 6574 5f65 6e74 _node target_ent │ │ │ +0006c150: 203d 2061 7267 5f65 6e74 2e64 6963 745f = arg_ent.dict_ │ │ │ +0006c160: 6669 6e64 5f73 7472 696e 6728 2274 6172 find_string("tar │ │ │ +0006c170: 6765 7422 293b 0a09 0969 6620 2821 7461 get");...if (!ta │ │ │ +0006c180: 7267 6574 5f65 6e74 207c 7c20 7461 7267 rget_ent || targ │ │ │ +0006c190: 6574 5f65 6e74 2e73 7472 696e 675f 6c65 et_ent.string_le │ │ │ +0006c1a0: 6e67 7468 2829 2021 3d20 3230 290a 0909 ngth() != 20)... │ │ │ +0006c1b0: 7b0a 0909 0974 6172 6765 745f 656e 7420 {....target_ent │ │ │ +0006c1c0: 3d20 6172 675f 656e 742e 6469 6374 5f66 = arg_ent.dict_f │ │ │ +0006c1d0: 696e 645f 7374 7269 6e67 2822 696e 666f ind_string("info │ │ │ +0006c1e0: 5f68 6173 6822 293b 0a09 0909 6966 2028 _hash");....if ( │ │ │ +0006c1f0: 2174 6172 6765 745f 656e 7420 7c7c 2074 !target_ent || t │ │ │ +0006c200: 6172 6765 745f 656e 742e 7374 7269 6e67 arget_ent.string │ │ │ +0006c210: 5f6c 656e 6774 6828 2920 213d 2032 3029 _length() != 20) │ │ │ +0006c220: 0a09 0909 7b0a 0909 0909 696e 636f 6d69 ....{.....incomi │ │ │ +0006c230: 6e67 5f65 7272 6f72 2865 2c20 2275 6e6b ng_error(e, "unk │ │ │ +0006c240: 6e6f 776e 206d 6573 7361 6765 2229 3b0a nown message");. │ │ │ +0006c250: 0909 0909 7265 7475 726e 3b0a 0909 097d ....return;....} │ │ │ +0006c260: 0a09 097d 0a0a 0909 7368 6131 5f68 6173 ...}....sha1_has │ │ │ +0006c270: 6820 636f 6e73 7420 7461 7267 6574 2874 h const target(t │ │ │ +0006c280: 6172 6765 745f 656e 742e 7374 7269 6e67 arget_ent.string │ │ │ +0006c290: 5f70 7472 2829 293b 0a09 092f 2f20 616c _ptr());...// al │ │ │ +0006c2a0: 7761 7973 2072 6574 7572 6e20 6e6f 6465 ways return node │ │ │ +0006c2b0: 7320 6173 2077 656c 6c20 6173 2070 6565 s as well as pee │ │ │ +0006c2c0: 7273 0a09 0977 7269 7465 5f6e 6f64 6573 rs...write_nodes │ │ │ +0006c2d0: 5f65 6e74 7269 6573 2874 6172 6765 742c _entries(target, │ │ │ +0006c2e0: 2061 7267 5f65 6e74 2e64 6963 745f 6669 arg_ent.dict_fi │ │ │ +0006c2f0: 6e64 5f6c 6973 7428 2277 616e 7422 292c nd_list("want"), │ │ │ +0006c300: 2072 6570 6c79 293b 0a09 7d0a 7d0a 0a3c reply);..}.}..< │ │ │ +0006c310: 2f70 7265 3e3c 2f74 643e 3c2f 7472 3e3c /pre>< │ │ │ +0006c320: 7472 2073 7479 6c65 3d22 6261 636b 6772 tr style="backgr │ │ │ +0006c330: 6f75 6e64 3a20 2363 6363 223e 3c74 643e ound: #ccc"> │ │ │ +0006c340: 7265 6c65 7661 6e63 6526 6e62 7370 3b30 relevance 0 │ │ │ +0006c350: 3c2f 7464 3e3c 7464 3e3c 6120 6872 6566 ../src │ │ │ +0006c380: 2f6b 6164 656d 6c69 612f 6e6f 6465 2e63 /kademlia/node.c │ │ │ +0006c390: 7070 3a31 3230 353c 2f61 3e3c 2f74 643e pp:1205 │ │ │ +0006c3a0: 3c74 643e 6c69 6d69 7420 6e75 6d62 6572 limit number │ │ │ +0006c3b0: 206f 6620 656e 7472 6965 7320 696e 2074 of entries in t │ │ │ +0006c3c0: 6865 2072 6573 756c 743c 2f74 643e 3c2f he result

    limit num │ │ │ +0006c420: 6265 7220 6f66 2065 6e74 7269 6573 2069 ber of entries i │ │ │ +0006c430: 6e20 7468 6520 7265 7375 6c74 3c2f 6832 n the result

    ../src/kade │ │ │ +0006c450: 6d6c 6961 2f6e 6f64 652e 6370 703a 3132 mlia/node.cpp:12 │ │ │ +0006c460: 3035 3c2f 6834 3e3c 7072 6520 7374 796c 05

    ..// if we don'
    │ │ │ +0006c4b0: 7420 7265 636f 676e 697a 6520 7468 6520  t recognize the 
    │ │ │ +0006c4c0: 6d65 7373 6167 6520 6275 7420 7468 6572  message but ther
    │ │ │ +0006c4d0: 6527 7320 610a 0909 2f2f 2027 7461 7267  e's a...// 'targ
    │ │ │ +0006c4e0: 6574 2720 6f72 2027 696e 666f 5f68 6173  et' or 'info_has
    │ │ │ +0006c4f0: 6827 2069 6e20 7468 6520 6172 6775 6d65  h' in the argume
    │ │ │ +0006c500: 6e74 732c 2074 7265 6174 2069 740a 0909  nts, treat it...
    │ │ │ +0006c510: 2f2f 2061 7320 6669 6e64 5f6e 6f64 6520  // as find_node 
    │ │ │ +0006c520: 746f 2062 6520 6675 7475 7265 2063 6f6d  to be future com
    │ │ │ +0006c530: 7061 7469 626c 650a 0909 6264 6563 6f64  patible...bdecod
    │ │ │ +0006c540: 655f 6e6f 6465 2074 6172 6765 745f 656e  e_node target_en
    │ │ │ +0006c550: 7420 3d20 6172 675f 656e 742e 6469 6374  t = arg_ent.dict
    │ │ │ +0006c560: 5f66 696e 645f 7374 7269 6e67 2822 7461  _find_string("ta
    │ │ │ +0006c570: 7267 6574 2229 3b0a 0909 6966 2028 2174  rget");...if (!t
    │ │ │ +0006c580: 6172 6765 745f 656e 7420 7c7c 2074 6172  arget_ent || tar
    │ │ │ +0006c590: 6765 745f 656e 742e 7374 7269 6e67 5f6c  get_ent.string_l
    │ │ │ +0006c5a0: 656e 6774 6828 2920 213d 2032 3029 0a09  ength() != 20)..
    │ │ │ +0006c5b0: 097b 0a09 0909 7461 7267 6574 5f65 6e74  .{....target_ent
    │ │ │ +0006c5c0: 203d 2061 7267 5f65 6e74 2e64 6963 745f   = arg_ent.dict_
    │ │ │ +0006c5d0: 6669 6e64 5f73 7472 696e 6728 2269 6e66  find_string("inf
    │ │ │ +0006c5e0: 6f5f 6861 7368 2229 3b0a 0909 0969 6620  o_hash");....if 
    │ │ │ +0006c5f0: 2821 7461 7267 6574 5f65 6e74 207c 7c20  (!target_ent || 
    │ │ │ +0006c600: 7461 7267 6574 5f65 6e74 2e73 7472 696e  target_ent.strin
    │ │ │ +0006c610: 675f 6c65 6e67 7468 2829 2021 3d20 3230  g_length() != 20
    │ │ │ +0006c620: 290a 0909 097b 0a09 0909 0969 6e63 6f6d  )....{.....incom
    │ │ │ +0006c630: 696e 675f 6572 726f 7228 652c 2022 756e  ing_error(e, "un
    │ │ │ +0006c640: 6b6e 6f77 6e20 6d65 7373 6167 6522 293b  known message");
    │ │ │ +0006c650: 0a09 0909 0972 6574 7572 6e3b 0a09 0909  .....return;....
    │ │ │ +0006c660: 7d0a 0909 7d0a 0a09 0973 6861 315f 6861  }...}....sha1_ha
    │ │ │ +0006c670: 7368 2063 6f6e 7374 2074 6172 6765 7428  sh const target(
    │ │ │ +0006c680: 7461 7267 6574 5f65 6e74 2e73 7472 696e  target_ent.strin
    │ │ │ +0006c690: 675f 7074 7228 2929 3b0a 0909 2f2f 2061  g_ptr());...// a
    │ │ │ +0006c6a0: 6c77 6179 7320 7265 7475 726e 206e 6f64  lways return nod
    │ │ │ +0006c6b0: 6573 2061 7320 7765 6c6c 2061 7320 7065  es as well as pe
    │ │ │ +0006c6c0: 6572 730a 0909 7772 6974 655f 6e6f 6465  ers...write_node
    │ │ │ +0006c6d0: 735f 656e 7472 6965 7328 7461 7267 6574  s_entries(target
    │ │ │ +0006c6e0: 2c20 6172 675f 656e 742e 6469 6374 5f66  , arg_ent.dict_f
    │ │ │ +0006c6f0: 696e 645f 6c69 7374 2822 7761 6e74 2229  ind_list("want")
    │ │ │ +0006c700: 2c20 7265 706c 7929 3b0a 097d 0a7d 0a0a  , reply);..}.}..
    │ │ │ +0006c710: 3c64 6976 2073 7479 6c65 3d22 6261 636b  
    vo │ │ │ +0006c740: 6964 206e 6f64 653a 3a77 7269 7465 5f6e id node::write_n │ │ │ +0006c750: 6f64 6573 5f65 6e74 7269 6573 2873 6861 odes_entries(sha │ │ │ +0006c760: 315f 6861 7368 2063 6f6e 7374 2661 6d70 1_hash const& │ │ │ +0006c770: 3b20 696e 666f 5f68 6173 680a 3c2f 6469 ; info_hash.., bdecode_nod │ │ │ +0006c790: 6520 636f 6e73 7426 616d 703b 2077 616e e const& wan │ │ │ +0006c7a0: 742c 2065 6e74 7279 2661 6d70 3b20 7229 t, entry& r) │ │ │ +0006c7b0: 0a7b 0a09 2f2f 2069 6620 6e6f 2077 616e .{..// if no wan │ │ │ +0006c7c0: 7473 2065 6e74 7279 2077 6173 2073 7065 ts entry was spe │ │ │ +0006c7d0: 6369 6669 6564 2c20 696e 636c 7564 6520 cified, include │ │ │ +0006c7e0: 6120 6e6f 6465 730a 092f 2f20 656e 7472 a nodes..// entr │ │ │ +0006c7f0: 7920 6261 7365 6420 6f6e 2074 6865 2070 y based on the p │ │ │ +0006c800: 726f 746f 636f 6c20 7468 6520 7265 7175 rotocol the requ │ │ │ +0006c810: 6573 7420 6361 6d65 2069 6e20 7769 7468 est came in with │ │ │ +0006c820: 0a09 6966 2028 7761 6e74 2e74 7970 6528 ..if (want.type( │ │ │ +0006c830: 2920 213d 2062 6465 636f 6465 5f6e 6f64 ) != bdecode_nod │ │ │ +0006c840: 653a 3a6c 6973 745f 7429 0a09 7b0a 0909 e::list_t)..{... │ │ │ +0006c850: 7374 643a 3a76 6563 746f 7226 6c74 3b6e std::vector<n │ │ │ +0006c860: 6f64 655f 656e 7472 7926 6774 3b20 636f ode_entry> co │ │ │ +0006c870: 6e73 7420 6e20 3d20 6d5f 7461 626c 652e nst n = m_table. │ │ │ +0006c880: 6669 6e64 5f6e 6f64 6528 696e 666f 5f68 find_node(info_h │ │ │ +0006c890: 6173 682c 207b 7d29 3b0a 0909 725b 7072 ash, {});...r[pr │ │ │ +0006c8a0: 6f74 6f63 6f6c 5f6e 6f64 6573 5f6b 6579 otocol_nodes_key │ │ │ +0006c8b0: 2829 5d20 3d20 7772 6974 655f 6e6f 6465 ()] = write_node │ │ │ +0006c8c0: 735f 656e 7472 7928 6e29 3b0a 0909 7265 s_entry(n);...re │ │ │ +0006c8d0: 7475 726e 3b0a 097d 0a0a 092f 2f20 6966 turn;..}...// if │ │ │ +0006c8e0: 2074 6865 7265 2069 7320 6120 7761 6e74 there is a want │ │ │ +0006c8f0: 7320 656e 7472 7920 7468 656e 2077 6520 s entry then we │ │ │ +0006c900: 6d61 7920 6e65 6564 2074 6f20 7265 6163 may need to reac │ │ │ +0006c910: 6820 696e 746f 0a09 2f2f 2061 6e6f 7468 h into..// anoth │ │ │ +0006c920: 6572 206e 6f64 6527 7320 726f 7574 696e er node's routin │ │ │ +0006c930: 6720 7461 626c 6520 746f 2067 6574 206e g table to get n │ │ │ +0006c940: 6f64 6573 206f 6620 7468 6520 7265 7175 odes of the requ │ │ │ +0006c950: 6573 7465 6420 7479 7065 0a09 2f2f 2077 ested type..// w │ │ │ +0006c960: 6520 7573 6520 6120 6d61 7020 6d61 696e e use a map main │ │ │ +0006c970: 7461 696e 6564 2062 7920 7468 6520 6f77 tained by the ow │ │ │ +0006c980: 6e69 6e67 2064 6874 5f74 7261 636b 6572 ning dht_tracker │ │ │ +0006c990: 2074 6f20 6669 6e64 2074 6865 0a09 2f2f to find the..// │ │ │ +0006c9a0: 206e 6f64 6520 6173 736f 6369 6174 6564 node associated │ │ │ +0006c9b0: 2077 6974 6820 6561 6368 2073 7472 696e with each strin │ │ │ +0006c9c0: 6720 696e 2074 6865 2077 616e 7420 6c69 g in the want li │ │ │ +0006c9d0: 7374 2c20 7768 6963 6820 6d61 790a 092f st, which may../ │ │ │ +0006c9e0: 2f20 696e 636c 7564 6520 7468 6973 206e / include this n │ │ │ +0006c9f0: 6f64 650a 0966 6f72 2028 696e 7420 6920 ode..for (int i │ │ │ +0006ca00: 3d20 303b 2069 2026 6c74 3b20 7761 6e74 = 0; i < want │ │ │ +0006ca10: 2e6c 6973 745f 7369 7a65 2829 3b20 2b2b .list_size(); ++ │ │ │ +0006ca20: 6929 0a09 7b0a 0909 6264 6563 6f64 655f i)..{...bdecode_ │ │ │ +0006ca30: 6e6f 6465 2077 616e 7465 6420 3d20 7761 node wanted = wa │ │ │ +0006ca40: 6e74 2e6c 6973 745f 6174 2869 293b 0a09 nt.list_at(i);.. │ │ │ +0006ca50: 0969 6620 2877 616e 7465 642e 7479 7065 .if (wanted.type │ │ │ +0006ca60: 2829 2021 3d20 6264 6563 6f64 655f 6e6f () != bdecode_no │ │ │ +0006ca70: 6465 3a3a 7374 7269 6e67 5f74 290a 0909 de::string_t)... │ │ │ +0006ca80: 0963 6f6e 7469 6e75 653b 0a09 096e 6f64 .continue;...nod │ │ │ +0006ca90: 652a 2077 616e 7465 645f 6e6f 6465 203d e* wanted_node = │ │ │ +0006caa0: 206d 5f67 6574 5f66 6f72 6569 676e 5f6e m_get_foreign_n │ │ │ +0006cab0: 6f64 6528 696e 666f 5f68 6173 682c 2077 ode(info_hash, w │ │ │ +0006cac0: 616e 7465 642e 7374 7269 6e67 5f76 616c anted.string_val │ │ │ +0006cad0: 7565 2829 2e74 6f5f 7374 7269 6e67 2829 ue().to_string() │ │ │ +0006cae0: 293b 0a09 0969 6620 2821 7761 6e74 6564 );...if (!wanted │ │ │ +0006caf0: 5f6e 6f64 6529 2063 6f6e 7469 6e75 653b _node) continue; │ │ │ +0006cb00: 0a09 0973 7464 3a3a 7665 6374 6f72 266c ...std::vector&l │ │ │ +0006cb10: 743b 6e6f 6465 5f65 6e74 7279 2667 743b t;node_entry> │ │ │ +0006cb20: 2063 6f6e 7374 206e 203d 2077 616e 7465 const n = wante │ │ │ +0006cb30: 645f 6e6f 6465 2d26 6774 3b6d 5f74 6162 d_node->m_tab │ │ │ +0006cb40: 6c65 2e66 696e 645f 6e6f 6465 2869 6e66 le.find_node(inf │ │ │ +0006cb50: 6f5f 6861 7368 2c20 7b7d 293b 0a09 0972 o_hash, {});...r │ │ │ +0006cb60: 5b77 616e 7465 645f 6e6f 6465 2d26 6774 [wanted_node-> │ │ │ +0006cb70: 3b70 726f 746f 636f 6c5f 6e6f 6465 735f ;protocol_nodes_ │ │ │ +0006cb80: 6b65 7928 295d 203d 2077 7269 7465 5f6e key()] = write_n │ │ │ +0006cb90: 6f64 6573 5f65 6e74 7279 286e 293b 0a09 odes_entry(n);.. │ │ │ +0006cba0: 7d0a 7d0a 0a6e 6f64 653a 3a70 726f 746f }.}..node::proto │ │ │ +0006cbb0: 636f 6c5f 6465 7363 7269 7074 6f72 2063 col_descriptor c │ │ │ +0006cbc0: 6f6e 7374 2661 6d70 3b20 6e6f 6465 3a3a onst& node:: │ │ │ +0006cbd0: 6d61 705f 7072 6f74 6f63 6f6c 5f74 6f5f map_protocol_to_ │ │ │ +0006cbe0: 6465 7363 7269 7074 6f72 2875 6470 2063 descriptor(udp c │ │ │ +0006cbf0: 6f6e 7374 2070 726f 746f 636f 6c29 0a7b onst protocol).{ │ │ │ +0006cc00: 0a3c 2f70 7265 3e3c 2f74 643e 3c2f 7472 .
    relevance  │ │ │ +0006cc40: 3b30 3c2f 7464 3e3c 7464 3e3c 6120 6872 ;0../s │ │ │ +0006cc70: 7263 2f6b 6164 656d 6c69 612f 6974 656d rc/kademlia/item │ │ │ +0006cc80: 2e63 7070 3a31 3433 3c2f 613e 3c2f 7464 .cpp:143implement c │ │ │ +0006cca0: 746f 7220 666f 7220 656e 7472 7920 6672 tor for entry fr │ │ │ +0006ccb0: 6f6d 2062 6465 636f 6465 5f6e 6f64 653f om bdecode_node? │ │ │ +0006ccc0: 3c2f 7464 3e3c 2f74 723e 3c74 7220 6964

    im │ │ │ +0006cd10: 706c 656d 656e 7420 6374 6f72 2066 6f72 plement ctor for │ │ │ +0006cd20: 2065 6e74 7279 2066 726f 6d20 6264 6563 entry from bdec │ │ │ +0006cd30: 6f64 655f 6e6f 6465 3f3c 2f68 323e 3c68 ode_node?

    ../src/kademli │ │ │ +0006cd50: 612f 6974 656d 2e63 7070 3a31 3433 3c2f a/item.cpp:143
    ., 
    │ │ │ +0006cda0: 7365 6372 6574 5f6b 6579 2063 6f6e 7374  secret_key const
    │ │ │ +0006cdb0: 2661 6d70 3b20 736b 290a 7b0a 0963 6861  & sk).{..cha
    │ │ │ +0006cdc0: 7220 7374 725b 3132 3030 5d3b 0a09 696e  r str[1200];..in
    │ │ │ +0006cdd0: 7420 636f 6e73 7420 6c65 6e20 3d20 6361  t const len = ca
    │ │ │ +0006cde0: 6e6f 6e69 6361 6c5f 7374 7269 6e67 2876  nonical_string(v
    │ │ │ +0006cdf0: 2c20 7365 712c 2073 616c 742c 2073 7472  , seq, salt, str
    │ │ │ +0006ce00: 293b 0a0a 0972 6574 7572 6e20 6564 3235  );...return ed25
    │ │ │ +0006ce10: 3531 395f 7369 676e 287b 7374 722c 206c  519_sign({str, l
    │ │ │ +0006ce20: 656e 7d2c 2070 6b2c 2073 6b29 3b0a 7d0a  en}, pk, sk);.}.
    │ │ │ +0006ce30: 0a69 7465 6d3a 3a69 7465 6d28 7075 626c  .item::item(publ
    │ │ │ +0006ce40: 6963 5f6b 6579 2063 6f6e 7374 2661 6d70  ic_key const&
    │ │ │ +0006ce50: 3b20 706b 2c20 7370 616e 266c 743b 6368  ; pk, span<ch
    │ │ │ +0006ce60: 6172 2063 6f6e 7374 2667 743b 2073 616c  ar const> sal
    │ │ │ +0006ce70: 7429 0a09 3a20 6d5f 7361 6c74 2873 616c  t)..: m_salt(sal
    │ │ │ +0006ce80: 742e 6461 7461 2829 2c20 7374 6174 6963  t.data(), static
    │ │ │ +0006ce90: 5f63 6173 7426 6c74 3b73 7464 3a3a 7369  _cast<std::si
    │ │ │ +0006cea0: 7a65 5f74 2667 743b 2873 616c 742e 7369  ze_t>(salt.si
    │ │ │ +0006ceb0: 7a65 2829 2929 0a09 2c20 6d5f 706b 2870  ze())).., m_pk(p
    │ │ │ +0006cec0: 6b29 0a09 2c20 6d5f 6d75 7461 626c 6528  k).., m_mutable(
    │ │ │ +0006ced0: 7472 7565 290a 7b7d 0a0a 6974 656d 3a3a  true).{}..item::
    │ │ │ +0006cee0: 6974 656d 2865 6e74 7279 2076 290a 093a  item(entry v)..:
    │ │ │ +0006cef0: 206d 5f76 616c 7565 2873 7464 3a3a 6d6f   m_value(std::mo
    │ │ │ +0006cf00: 7665 2876 2929 0a7b 7d0a 0a69 7465 6d3a  ve(v)).{}..item:
    │ │ │ +0006cf10: 3a69 7465 6d28 6264 6563 6f64 655f 6e6f  :item(bdecode_no
    │ │ │ +0006cf20: 6465 2063 6f6e 7374 2661 6d70 3b20 7629  de const& v)
    │ │ │ +0006cf30: 0a7b 0a3c 6469 7620 7374 796c 653d 2262  .{.
    .m_value = v;.< │ │ │ +0006cf70: 2f64 6976 3e7d 0a0a 6974 656d 3a3a 6974 /div>}..item::it │ │ │ +0006cf80: 656d 2865 6e74 7279 2076 2c20 7370 616e em(entry v, span │ │ │ +0006cf90: 266c 743b 6368 6172 2063 6f6e 7374 2667 <char const&g │ │ │ +0006cfa0: 743b 2073 616c 740a 092c 2073 6571 7565 t; salt.., seque │ │ │ +0006cfb0: 6e63 655f 6e75 6d62 6572 2063 6f6e 7374 nce_number const │ │ │ +0006cfc0: 2073 6571 2c20 7075 626c 6963 5f6b 6579 seq, public_key │ │ │ +0006cfd0: 2063 6f6e 7374 2661 6d70 3b20 706b 2c20 const& pk, │ │ │ +0006cfe0: 7365 6372 6574 5f6b 6579 2063 6f6e 7374 secret_key const │ │ │ +0006cff0: 2661 6d70 3b20 736b 290a 7b0a 0961 7373 & sk).{..ass │ │ │ +0006d000: 6967 6e28 7374 643a 3a6d 6f76 6528 7629 ign(std::move(v) │ │ │ +0006d010: 2c20 7361 6c74 2c20 7365 712c 2070 6b2c , salt, seq, pk, │ │ │ +0006d020: 2073 6b29 3b0a 7d0a 0a76 6f69 6420 6974 sk);.}..void it │ │ │ +0006d030: 656d 3a3a 6173 7369 676e 2865 6e74 7279 em::assign(entry │ │ │ +0006d040: 2076 290a 7b0a 096d 5f6d 7574 6162 6c65 v).{..m_mutable │ │ │ +0006d050: 203d 2066 616c 7365 3b0a 096d 5f76 616c = false;..m_val │ │ │ +0006d060: 7565 203d 2073 7464 3a3a 6d6f 7665 2876 ue = std::move(v │ │ │ +0006d070: 293b 0a7d 0a0a 766f 6964 2069 7465 6d3a );.}..void item: │ │ │ +0006d080: 3a61 7373 6967 6e28 656e 7472 7920 762c :assign(entry v, │ │ │ +0006d090: 2073 7061 6e26 6c74 3b63 6861 7220 636f span<char co │ │ │ +0006d0a0: 6e73 7426 6774 3b20 7361 6c74 0a09 2c20 nst> salt.., │ │ │ +0006d0b0: 7365 7175 656e 6365 5f6e 756d 6265 7220 sequence_number │ │ │ +0006d0c0: 636f 6e73 7420 7365 712c 2070 7562 6c69 const seq, publi │ │ │ +0006d0d0: 635f 6b65 7920 636f 6e73 7426 616d 703b c_key const& │ │ │ +0006d0e0: 2070 6b2c 2073 6563 7265 745f 6b65 7920 pk, secret_key │ │ │ +0006d0f0: 636f 6e73 7426 616d 703b 2073 6b29 0a7b const& sk).{ │ │ │ +0006d100: 0a09 7374 643a 3a61 7272 6179 266c 743b ..std::array< │ │ │ +0006d110: 6368 6172 2c20 3130 3030 2667 743b 2062 char, 1000> b │ │ │ +0006d120: 7566 6665 723b 0a09 696e 7420 636f 6e73 uffer;..int cons │ │ │ +0006d130: 7420 6273 697a 6520 3d20 6265 6e63 6f64 t bsize = bencod │ │ │ +0006d140: 6528 6275 6666 6572 2e62 6567 696e 2829 e(buffer.begin() │ │ │ +0006d150: 2c20 7629 3b0a 0954 4f52 5245 4e54 5f41 , v);..TORRENT_A │ │ │ +0006d160: 5353 4552 5428 6273 697a 6520 266c 743b SSERT(bsize < │ │ │ +0006d170: 3d20 3130 3030 293b 0a09 6d5f 7369 6720 = 1000);..m_sig │ │ │ +0006d180: 3d20 7369 676e 5f6d 7574 6162 6c65 5f69 = sign_mutable_i │ │ │ +0006d190: 7465 6d28 7370 616e 266c 743b 6368 6172 tem(span<char │ │ │ +0006d1a0: 2063 6f6e 7374 2667 743b 2862 7566 6665 const>(buffe │ │ │ +0006d1b0: 7229 2e66 6972 7374 2862 7369 7a65 290a r).first(bsize). │ │ │ +0006d1c0: 0909 2c20 7361 6c74 2c20 7365 712c 2070 .., salt, seq, p │ │ │ +0006d1d0: 6b2c 2073 6b29 3b0a 096d 5f73 616c 742e k, sk);..m_salt. │ │ │ +0006d1e0: 6173 7369 676e 2873 616c 742e 6461 7461 assign(salt.data │ │ │ +0006d1f0: 2829 2c20 7374 6174 6963 5f63 6173 7426 (), static_cast& │ │ │ +0006d200: 6c74 3b73 7464 3a3a 7369 7a65 5f74 2667 lt;std::size_t&g │ │ │ +0006d210: 743b 2873 616c 742e 7369 7a65 2829 2929 t;(salt.size())) │ │ │ +0006d220: 3b0a 096d 5f70 6b20 3d20 706b 3b0a 096d ;..m_pk = pk;..m │ │ │ +0006d230: 5f73 6571 203d 2073 6571 3b0a 096d 5f6d _seq = seq;..m_m │ │ │ +0006d240: 7574 6162 6c65 203d 2074 7275 653b 0a09 utable = true;.. │ │ │ +0006d250: 6d5f 7661 6c75 6520 3d20 7374 643a 3a6d m_value = std::m │ │ │ +0006d260: 6f76 6528 7629 3b0a 7d0a 0a76 6f69 6420 ove(v);.}..void │ │ │ +0006d270: 6974 656d 3a3a 6173 7369 676e 2862 6465 item::assign(bde │ │ │ +0006d280: 636f 6465 5f6e 6f64 6520 636f 6e73 7426 code_node const& │ │ │ +0006d290: 616d 703b 2076 290a 3c2f 7072 653e 3c2f amp; v).
    relevan │ │ │ 0006d2d0: 6365 266e 6273 703b 303c 2f74 643e 3c74 ce 0../include/li │ │ │ -0006d310: 6274 6f72 7265 6e74 2f68 6173 685f 7069 btorrent/hash_pi │ │ │ -0006d320: 636b 6572 2e68 7070 3a31 3535 3c2f 613e cker.hpp:155 │ │ │ -0006d330: 3c2f 7464 3e3c 7464 3e73 7570 706f 7274 support │ │ │ -0006d340: 2062 6174 6368 6564 2061 6464 696e 6720 batched adding │ │ │ -0006d350: 6f66 2062 6c6f 636b 2068 6173 6865 7320 of block hashes │ │ │ -0006d360: 666f 7220 7265 6475 6365 6420 6f76 6572 for reduced over │ │ │ -0006d370: 6865 6164 3f3c 2f74 643e 3c2f 7472 3e3c head?< │ │ │ -0006d380: 7472 2069 643d 2232 3530 2220 7374 796c tr id="250" styl │ │ │ -0006d390: 653d 2264 6973 706c 6179 3a20 6e6f 6e65 e="display: none │ │ │ -0006d3a0: 3b22 2063 6f6c 7370 616e 3d22 3322 3e3c ;" colspan="3">< │ │ │ -0006d3b0: 7464 2063 6f6c 7370 616e 3d22 3322 3e3c td colspan="3">< │ │ │ -0006d3c0: 6832 3e73 7570 706f 7274 2062 6174 6368 h2>support batch │ │ │ -0006d3d0: 6564 2061 6464 696e 6720 6f66 2062 6c6f ed adding of blo │ │ │ -0006d3e0: 636b 2068 6173 6865 7320 666f 7220 7265 ck hashes for re │ │ │ -0006d3f0: 6475 6365 6420 6f76 6572 6865 6164 3f3c duced overhead?< │ │ │ -0006d400: 2f68 323e 3c68 343e 2e2e 2f69 6e63 6c75 /h2>

    ../inclu │ │ │ -0006d410: 6465 2f6c 6962 746f 7272 656e 742f 6861 de/libtorrent/ha │ │ │ -0006d420: 7368 5f70 6963 6b65 722e 6870 703a 3135 sh_picker.hpp:15 │ │ │ -0006d430: 353c 2f68 343e 3c70 7265 2073 7479 6c65 5

    │ │ │ -0006d470: 0909 2f2f 2074 6865 206e 756d 6265 7220  ..// the number 
    │ │ │ -0006d480: 6f66 2068 6173 6865 7320 696e 2074 6865  of hashes in the
    │ │ │ -0006d490: 2072 616e 6765 0a09 0969 6e74 2063 6f75   range...int cou
    │ │ │ -0006d4a0: 6e74 203d 2030 3b0a 0909 696e 7420 7072  nt = 0;...int pr
    │ │ │ -0006d4b0: 6f6f 665f 6c61 7965 7273 203d 2030 3b0a  oof_layers = 0;.
    │ │ │ -0006d4c0: 097d 3b0a 0a09 2f2f 2076 616c 6964 6174  .};...// validat
    │ │ │ -0006d4d0: 6573 2074 6865 2068 6173 685f 7265 7175  es the hash_requ
    │ │ │ -0006d4e0: 6573 742c 2074 6f20 656e 7375 7265 2069  est, to ensure i
    │ │ │ -0006d4f0: 7473 2069 6e76 6172 6961 6e74 2061 7320  ts invariant as 
    │ │ │ -0006d500: 7765 6c6c 2061 7320 6d61 7463 6869 6e67  well as matching
    │ │ │ -0006d510: 0a09 2f2f 2074 6865 2074 6f72 7265 6e74  ..// the torrent
    │ │ │ -0006d520: 2773 2066 696c 655f 7374 6f72 6167 6520  's file_storage 
    │ │ │ -0006d530: 616e 6420 7468 6520 6e75 6d62 6572 206f  and the number o
    │ │ │ -0006d540: 6620 6861 7368 6573 2061 6363 6f6d 7061  f hashes accompa
    │ │ │ -0006d550: 6e79 696e 6720 7468 650a 092f 2f20 7265  nying the..// re
    │ │ │ -0006d560: 7175 6573 740a 0954 4f52 5245 4e54 5f45  quest..TORRENT_E
    │ │ │ -0006d570: 5854 5241 5f45 5850 4f52 540a 0962 6f6f  XTRA_EXPORT..boo
    │ │ │ -0006d580: 6c20 7661 6c69 6461 7465 5f68 6173 685f  l validate_hash_
    │ │ │ -0006d590: 7265 7175 6573 7428 6861 7368 5f72 6571  request(hash_req
    │ │ │ -0006d5a0: 7565 7374 2063 6f6e 7374 2661 6d70 3b20  uest const& 
    │ │ │ -0006d5b0: 6872 2c20 6669 6c65 5f73 746f 7261 6765  hr, file_storage
    │ │ │ -0006d5c0: 2063 6f6e 7374 2661 6d70 3b20 6673 293b   const& fs);
    │ │ │ -0006d5d0: 0a0a 0963 6c61 7373 2054 4f52 5245 4e54  ...class TORRENT
    │ │ │ -0006d5e0: 5f45 5854 5241 5f45 5850 4f52 5420 6861  _EXTRA_EXPORT ha
    │ │ │ -0006d5f0: 7368 5f70 6963 6b65 720a 097b 0a09 7075  sh_picker..{..pu
    │ │ │ -0006d600: 626c 6963 3a0a 0909 6861 7368 5f70 6963  blic:...hash_pic
    │ │ │ -0006d610: 6b65 7228 6669 6c65 5f73 746f 7261 6765  ker(file_storage
    │ │ │ -0006d620: 2063 6f6e 7374 2661 6d70 3b20 6669 6c65   const& file
    │ │ │ -0006d630: 730a 0909 092c 2061 7578 3a3a 7665 6374  s...., aux::vect
    │ │ │ -0006d640: 6f72 266c 743b 6175 783a 3a6d 6572 6b6c  or<aux::merkl
    │ │ │ -0006d650: 655f 7472 6565 2c20 6669 6c65 5f69 6e64  e_tree, file_ind
    │ │ │ -0006d660: 6578 5f74 2667 743b 2661 6d70 3b20 7472  ex_t>& tr
    │ │ │ -0006d670: 6565 7329 3b0a 0a09 0968 6173 685f 7265  ees);....hash_re
    │ │ │ -0006d680: 7175 6573 7420 7069 636b 5f68 6173 6865  quest pick_hashe
    │ │ │ -0006d690: 7328 7479 7065 645f 6269 7466 6965 6c64  s(typed_bitfield
    │ │ │ -0006d6a0: 266c 743b 7069 6563 655f 696e 6465 785f  <piece_index_
    │ │ │ -0006d6b0: 7426 6774 3b20 636f 6e73 7426 616d 703b  t> const&
    │ │ │ -0006d6c0: 2070 6965 6365 7329 3b0a 0a09 0961 6464   pieces);....add
    │ │ │ -0006d6d0: 5f68 6173 6865 735f 7265 7375 6c74 2061  _hashes_result a
    │ │ │ -0006d6e0: 6464 5f68 6173 6865 7328 6861 7368 5f72  dd_hashes(hash_r
    │ │ │ -0006d6f0: 6571 7565 7374 2063 6f6e 7374 2661 6d70  equest const&
    │ │ │ -0006d700: 3b20 7265 712c 2073 7061 6e26 6c74 3b73  ; req, span<s
    │ │ │ -0006d710: 6861 3235 365f 6861 7368 2063 6f6e 7374  ha256_hash const
    │ │ │ -0006d720: 2667 743b 2068 6173 6865 7329 3b0a 3c64  > hashes);...se
    │ │ │ -0006d760: 745f 626c 6f63 6b5f 6861 7368 5f72 6573  t_block_hash_res
    │ │ │ -0006d770: 756c 7420 7365 745f 626c 6f63 6b5f 6861  ult set_block_ha
    │ │ │ -0006d780: 7368 2870 6965 6365 5f69 6e64 6578 5f74  sh(piece_index_t
    │ │ │ -0006d790: 2070 6965 6365 2c20 696e 7420 6f66 6673   piece, int offs
    │ │ │ -0006d7a0: 6574 2c20 7368 6132 3536 5f68 6173 6820  et, sha256_hash 
    │ │ │ -0006d7b0: 636f 6e73 7426 616d 703b 2068 293b 0a3c  const& h);.<
    │ │ │ -0006d7c0: 2f64 6976 3e09 0976 6f69 6420 6861 7368  /div>..void hash
    │ │ │ -0006d7d0: 6573 5f72 656a 6563 7465 6428 6861 7368  es_rejected(hash
    │ │ │ -0006d7e0: 5f72 6571 7565 7374 2063 6f6e 7374 2661  _request const&a
    │ │ │ -0006d7f0: 6d70 3b20 7265 7129 3b0a 0909 766f 6964  mp; req);...void
    │ │ │ -0006d800: 2076 6572 6966 795f 626c 6f63 6b5f 6861   verify_block_ha
    │ │ │ -0006d810: 7368 6573 2870 6965 6365 5f69 6e64 6578  shes(piece_index
    │ │ │ -0006d820: 5f74 2069 6e64 6578 293b 0a0a 0909 2f2f  _t index);....//
    │ │ │ -0006d830: 2064 6f20 7765 206b 6e6f 7720 7468 6520   do we know the 
    │ │ │ -0006d840: 7069 6563 6520 6c61 7965 7220 6861 7368  piece layer hash
    │ │ │ -0006d850: 2066 6f72 2061 2070 6965 6365 0a09 0962   for a piece...b
    │ │ │ -0006d860: 6f6f 6c20 6861 7665 5f68 6173 6828 7069  ool have_hash(pi
    │ │ │ -0006d870: 6563 655f 696e 6465 785f 7420 696e 6465  ece_index_t inde
    │ │ │ -0006d880: 7829 2063 6f6e 7374 3b0a 0909 2f2f 2064  x) const;...// d
    │ │ │ -0006d890: 6f20 7765 206b 6e6f 7720 616c 6c20 7468  o we know all th
    │ │ │ -0006d8a0: 6520 626c 6f63 6b20 6861 7368 6573 2066  e block hashes f
    │ │ │ -0006d8b0: 6f72 2061 2066 696c 653f 0a09 0962 6f6f  or a file?...boo
    │ │ │ -0006d8c0: 6c20 6861 7665 5f61 6c6c 2866 696c 655f  l have_all(file_
    │ │ │ -0006d8d0: 696e 6465 785f 7420 6669 6c65 2920 636f  index_t file) co
    │ │ │ -0006d8e0: 6e73 743b 0a09 0962 6f6f 6c20 6861 7665  nst;...bool have
    │ │ │ -0006d8f0: 5f61 6c6c 2829 2063 6f6e 7374 3b0a 0909  _all() const;...
    │ │ │ -0006d900: 626f 6f6c 2070 6965 6365 5f76 6572 6966  bool piece_verif
    │ │ │ -0006d910: 6965 6428 7069 6563 655f 696e 6465 785f  ied(piece_index_
    │ │ │ -0006d920: 7420 7069 6563 6529 2063 6f6e 7374 3b0a  t piece) const;.
    │ │ │ -0006d930: 0a09 0969 6e74 2070 6965 6365 5f6c 6179  ...int piece_lay
    │ │ │ -0006d940: 6572 2829 2063 6f6e 7374 207b 2072 6574  er() const { ret
    │ │ │ -0006d950: 7572 6e20 6d5f 7069 6563 655f 6c61 7965  urn m_piece_laye
    │ │ │ -0006d960: 723b 207d 0a0a 0970 7269 7661 7465 3a0a  r; }...private:.
    │ │ │ -0006d970: 0909 2f2f 2072 6574 7572 6e73 2074 6865  ..// returns the
    │ │ │ -0006d980: 206e 756d 6265 7220 6f66 2070 726f 6f66   number of proof
    │ │ │ -0006d990: 206c 6179 6572 7320 6e65 6564 6564 2074   layers needed t
    │ │ │ -0006d9a0: 6f20 7665 7269 6679 2074 6865 206e 6f64  o verify the nod
    │ │ │ -0006d9b0: 6527 7320 6861 7368 0a09 0969 6e74 206c  e's hash...int l
    │ │ │ -0006d9c0: 6179 6572 735f 746f 5f76 6572 6966 7928  ayers_to_verify(
    │ │ │ -0006d9d0: 6e6f 6465 5f69 6e64 6578 2069 6478 2920  node_index idx) 
    │ │ │ -0006d9e0: 636f 6e73 743b 0a09 0969 6e74 2066 696c  const;...int fil
    │ │ │ -0006d9f0: 655f 6e75 6d5f 6c61 7965 7273 2866 696c  e_num_layers(fil
    │ │ │ -0006da00: 655f 696e 6465 785f 7420 6964 7829 2063  e_index_t idx) c
    │ │ │ -0006da10: 6f6e 7374 3b0a 0a09 0973 7472 7563 7420  onst;....struct 
    │ │ │ -0006da20: 7069 6563 655f 6861 7368 5f72 6571 7565  piece_hash_reque
    │ │ │ -0006da30: 7374 0a09 097b 0a09 0909 7469 6d65 5f70  st...{....time_p
    │ │ │ -0006da40: 6f69 6e74 206c 6173 745f 7265 7175 6573  oint last_reques
    │ │ │ -0006da50: 7420 3d20 6d69 6e5f 7469 6d65 2829 3b0a  t = min_time();.
    │ │ │ -0006da60: 0909 0969 6e74 206e 756d 5f72 6571 7565  ...int num_reque
    │ │ │ -0006da70: 7374 7320 3d20 303b 0a09 0909 626f 6f6c  sts = 0;....bool
    │ │ │ -0006da80: 2068 6176 6520 3d20 6661 6c73 653b 0a09   have = false;..
    │ │ │ -0006da90: 097d 3b0a 0a09 0973 7472 7563 7420 7072  .};....struct pr
    │ │ │ -0006daa0: 696f 7269 7479 5f62 6c6f 636b 5f72 6571  iority_block_req
    │ │ │ -0006dab0: 7565 7374 0a09 097b 0a09 0909 7072 696f  uest...{....prio
    │ │ │ -0006dac0: 7269 7479 5f62 6c6f 636b 5f72 6571 7565  rity_block_reque
    │ │ │ -0006dad0: 7374 2866 696c 655f 696e 6465 785f 7420  st(file_index_t 
    │ │ │ -0006dae0: 636f 6e73 7420 662c 2069 6e74 2063 6f6e  const f, int con
    │ │ │ -0006daf0: 7374 2062 290a 0909 0909 3a20 6669 6c65  st b).....: file
    │ │ │ -0006db00: 2866 292c 2062 6c6f 636b 2862 2920 7b7d  (f), block(b) {}
    │ │ │ -0006db10: 0a09 0909 6669 6c65 5f69 6e64 6578 5f74  ....file_index_t
    │ │ │ -0006db20: 2066 696c 653b 0a09 0909 696e 7420 626c   file;....int bl
    │ │ │ -0006db30: 6f63 6b3b 0a3c 2f70 7265 3e3c 2f74 643e  ock;.
    │ │ │ -0006db40: 3c2f 7472 3e3c 7472 2073 7479 6c65 3d22 relevance& │ │ │ -0006db70: 6e62 7370 3b30 3c2f 7464 3e3c 7464 3e3c nbsp;0< │ │ │ -0006db80: 6120 6872 6566 3d22 6a61 7661 7363 7269 a href="javascri │ │ │ -0006db90: 7074 3a65 7870 616e 6428 3235 3129 223e pt:expand(251)"> │ │ │ -0006dba0: 2e2e 2f69 6e63 6c75 6465 2f6c 6962 746f ../include/libto │ │ │ -0006dbb0: 7272 656e 742f 746f 7272 656e 745f 696e rrent/torrent_in │ │ │ -0006dbc0: 666f 2e68 7070 3a37 3537 3c2f 613e 3c2f fo.hpp:757change th │ │ │ -0006dbe0: 6520 7479 7065 2074 6f20 7374 643a 3a73 e type to std::s │ │ │ -0006dbf0: 6861 7265 645f 7074 723c 6368 6172 2063 hared_ptr in C++17 i │ │ │ -0006dc10: 7420 6973 2075 7365 6420 6173 2069 6620 t is used as if │ │ │ -0006dc20: 696d 6d75 7461 626c 652c 2069 7420 6361 immutable, it ca │ │ │ -0006dc30: 6e6e 6f74 2062 6520 636f 6e73 7420 666f nnot be const fo │ │ │ -0006dc40: 7220 7465 6368 6e69 6361 6c20 7265 6173 r technical reas │ │ │ -0006dc50: 6f6e 7320 7269 6768 7420 6e6f 772e 3c2f ons right now.

    chan │ │ │ -0006dcb0: 6765 2074 6865 2074 7970 6520 746f 2073 ge the type to s │ │ │ -0006dcc0: 7464 3a3a 7368 6172 6564 5f70 7472 3c63 td::shared_ptr in C+ │ │ │ -0006dce0: 2b31 370a 6974 2069 7320 7573 6564 2061 +17.it is used a │ │ │ -0006dcf0: 7320 6966 2069 6d6d 7574 6162 6c65 2c20 s if immutable, │ │ │ -0006dd00: 6974 2063 616e 6e6f 7420 6265 2063 6f6e it cannot be con │ │ │ -0006dd10: 7374 2066 6f72 2074 6563 686e 6963 616c st for technical │ │ │ -0006dd20: 2072 6561 736f 6e73 0a72 6967 6874 206e reasons.right n │ │ │ -0006dd30: 6f77 2e3c 2f68 323e 3c68 343e 2e2e 2f69 ow.

    ../i │ │ │ -0006dd40: 6e63 6c75 6465 2f6c 6962 746f 7272 656e nclude/libtorren │ │ │ -0006dd50: 742f 746f 7272 656e 745f 696e 666f 2e68 t/torrent_info.h │ │ │ -0006dd60: 7070 3a37 3537 3c2f 6834 3e3c 7072 6520 pp:757

    ...// these
    │ │ │ -0006ddb0: 2061 7265 2074 6865 2063 6f6c 6c65 6374   are the collect
    │ │ │ -0006ddc0: 696f 6e73 2066 726f 6d20 6f75 7473 6964  ions from outsid
    │ │ │ -0006ddd0: 6520 6f66 2074 6865 2069 6e66 6f2d 6469  e of the info-di
    │ │ │ -0006dde0: 6374 2e20 5468 6573 6520 6172 650a 0909  ct. These are...
    │ │ │ -0006ddf0: 2f2f 206f 776e 696e 6720 7374 7269 6e67  // owning string
    │ │ │ -0006de00: 732c 2073 696e 6365 2077 6520 6f6e 6c79  s, since we only
    │ │ │ -0006de10: 206b 6565 7020 7468 6520 696e 666f 2d73   keep the info-s
    │ │ │ -0006de20: 6563 7469 6f6e 2061 726f 756e 642c 2074  ection around, t
    │ │ │ -0006de30: 6865 7365 0a09 092f 2f20 6361 6e6e 6f74  hese...// cannot
    │ │ │ -0006de40: 2062 6520 706f 696e 7465 7273 2069 6e74   be pointers int
    │ │ │ -0006de50: 6f20 7468 6174 2062 7566 6665 722e 0a09  o that buffer...
    │ │ │ -0006de60: 0973 7464 3a3a 7665 6374 6f72 266c 743b  .std::vector<
    │ │ │ -0006de70: 7374 643a 3a73 7472 696e 6726 6774 3b20  std::string> 
    │ │ │ -0006de80: 6d5f 6f77 6e65 645f 636f 6c6c 6563 7469  m_owned_collecti
    │ │ │ -0006de90: 6f6e 733b 0a0a 2369 6620 544f 5252 454e  ons;..#if TORREN
    │ │ │ -0006dea0: 545f 4142 495f 5645 5253 494f 4e20 266c  T_ABI_VERSION &l
    │ │ │ -0006deb0: 743b 3d20 320a 0909 2f2f 2069 6620 7468  t;= 2...// if th
    │ │ │ -0006dec0: 6973 2069 7320 6120 6d65 726b 6c65 2074  is is a merkle t
    │ │ │ -0006ded0: 6f72 7265 6e74 2c20 7468 6973 2069 7320  orrent, this is 
    │ │ │ -0006dee0: 7468 6520 6d65 726b 6c65 0a09 092f 2f20  the merkle...// 
    │ │ │ -0006def0: 7472 6565 2e20 4974 2068 6173 2073 7061  tree. It has spa
    │ │ │ -0006df00: 6365 2066 6f72 206d 6572 6b6c 655f 6e75  ce for merkle_nu
    │ │ │ -0006df10: 6d5f 6e6f 6465 7328 6d65 726b 6c65 5f6e  m_nodes(merkle_n
    │ │ │ -0006df20: 756d 5f6c 6561 6673 286e 756d 5f70 6965  um_leafs(num_pie
    │ │ │ -0006df30: 6365 7329 290a 0909 2f2f 2068 6173 6865  ces))...// hashe
    │ │ │ -0006df40: 730a 0909 6175 783a 3a76 6563 746f 7226  s...aux::vector&
    │ │ │ -0006df50: 6c74 3b73 6861 315f 6861 7368 2667 743b  lt;sha1_hash>
    │ │ │ -0006df60: 206d 5f6d 6572 6b6c 655f 7472 6565 3b0a   m_merkle_tree;.
    │ │ │ -0006df70: 2365 6e64 6966 0a0a 0909 2f2f 2076 3220  #endif....// v2 
    │ │ │ -0006df80: 6d65 726b 6c65 2074 7265 6520 666f 7220  merkle tree for 
    │ │ │ -0006df90: 6561 6368 2066 696c 650a 0909 2f2f 2074  each file...// t
    │ │ │ -0006dfa0: 6865 2061 6374 7561 6c20 6861 7368 2062  he actual hash b
    │ │ │ -0006dfb0: 7566 6665 7273 2061 7265 2061 6c77 6179  uffers are alway
    │ │ │ -0006dfc0: 7320 6469 7669 7369 626c 6520 6279 2033  s divisible by 3
    │ │ │ -0006dfd0: 3220 2873 6861 3235 365f 6861 7368 3a3a  2 (sha256_hash::
    │ │ │ -0006dfe0: 7369 7a65 2829 290a 0909 6175 783a 3a76  size())...aux::v
    │ │ │ -0006dff0: 6563 746f 7226 6c74 3b61 7578 3a3a 7665  ector<aux::ve
    │ │ │ -0006e000: 6374 6f72 266c 743b 6368 6172 2667 743b  ctor<char>
    │ │ │ -0006e010: 2c20 6669 6c65 5f69 6e64 6578 5f74 2667  , file_index_t&g
    │ │ │ -0006e020: 743b 206d 5f70 6965 6365 5f6c 6179 6572  t; m_piece_layer
    │ │ │ -0006e030: 733b 0a0a 0909 2f2f 2074 6869 7320 6973  s;....// this is
    │ │ │ -0006e040: 2061 2063 6f70 7920 6f66 2074 6865 2069   a copy of the i
    │ │ │ -0006e050: 6e66 6f20 7365 6374 696f 6e20 6672 6f6d  nfo section from
    │ │ │ -0006e060: 2074 6865 2074 6f72 7265 6e74 2e0a 0909   the torrent....
    │ │ │ -0006e070: 2f2f 2069 7420 7573 6520 6d61 696e 7461  // it use mainta
    │ │ │ -0006e080: 696e 6564 2069 6e20 7468 6973 2066 6c61  ined in this fla
    │ │ │ -0006e090: 7420 666f 726d 6174 2069 6e20 6f72 6465  t format in orde
    │ │ │ -0006e0a0: 7220 746f 0a09 092f 2f20 6d61 6b65 2069  r to...// make i
    │ │ │ -0006e0b0: 7420 6176 6169 6c61 626c 6520 7468 726f  t available thro
    │ │ │ -0006e0c0: 7567 6820 7468 6520 6d65 7461 6461 7461  ugh the metadata
    │ │ │ -0006e0d0: 2065 7874 656e 7369 6f6e 0a3c 6469 7620   extension.
    ..boost │ │ │ -0006e110: 3a3a 7368 6172 6564 5f61 7272 6179 266c ::shared_array&l │ │ │ -0006e120: 743b 6368 6172 2667 743b 206d 5f69 6e66 t;char> m_inf │ │ │ -0006e130: 6f5f 7365 6374 696f 6e3b 0a3c 2f64 6976 o_section;.
    ...// if a comm │ │ │ -0006e150: 656e 7420 6973 2066 6f75 6e64 2069 6e20 ent is found in │ │ │ -0006e160: 7468 6520 746f 7272 656e 7420 6669 6c65 the torrent file │ │ │ -0006e170: 0a09 092f 2f20 7468 6973 2077 696c 6c20 ...// this will │ │ │ -0006e180: 6265 2073 6574 2074 6f20 7468 6174 2063 be set to that c │ │ │ -0006e190: 6f6d 6d65 6e74 0a09 0973 7464 3a3a 7374 omment...std::st │ │ │ -0006e1a0: 7269 6e67 206d 5f63 6f6d 6d65 6e74 3b0a ring m_comment;. │ │ │ -0006e1b0: 0a09 092f 2f20 616e 206f 7074 696f 6e61 ...// an optiona │ │ │ -0006e1c0: 6c20 7374 7269 6e67 206e 616d 696e 6720 l string naming │ │ │ -0006e1d0: 7468 6520 736f 6674 7761 7265 2075 7365 the software use │ │ │ -0006e1e0: 640a 0909 2f2f 2074 6f20 6372 6561 7465 d...// to create │ │ │ -0006e1f0: 2074 6865 2074 6f72 7265 6e74 2066 696c the torrent fil │ │ │ -0006e200: 650a 0909 7374 643a 3a73 7472 696e 6720 e...std::string │ │ │ -0006e210: 6d5f 6372 6561 7465 645f 6279 3b0a 0a09 m_created_by;... │ │ │ -0006e220: 092f 2f20 7468 6520 696e 666f 2073 6563 .// the info sec │ │ │ -0006e230: 7469 6f6e 2070 6172 7365 642e 2070 6f69 tion parsed. poi │ │ │ -0006e240: 6e74 7320 696e 746f 206d 5f69 6e66 6f5f nts into m_info_ │ │ │ -0006e250: 7365 6374 696f 6e0a 0909 2f2f 2070 6172 section...// par │ │ │ -0006e260: 7365 6420 6c61 7a69 6c79 0a09 096d 7574 sed lazily...mut │ │ │ -0006e270: 6162 6c65 2062 6465 636f 6465 5f6e 6f64 able bdecode_nod │ │ │ -0006e280: 6520 6d5f 696e 666f 5f64 6963 743b 0a0a e m_info_dict;.. │ │ │ -0006e290: 0909 2f2f 2069 6620 6120 6372 6561 7469 ..// if a creati │ │ │ -0006e2a0: 6f6e 2064 6174 6520 6973 2066 6f75 6e64 on date is found │ │ │ -0006e2b0: 2069 6e20 7468 6520 746f 7272 656e 7420 in the torrent │ │ │ -0006e2c0: 6669 6c65 0a09 092f 2f20 7468 6973 2077 file...// this w │ │ │ -0006e2d0: 696c 6c20 6265 2073 6574 2074 6f20 7468 ill be set to th │ │ │ -0006e2e0: 6174 2c20 6f74 6865 7277 6973 6520 6974 at, otherwise it │ │ │ -0006e2f0: 276c 6c20 6265 0a09 092f 2f20 3139 3730 'll be...// 1970 │ │ │ -0006e300: 2c20 4a61 6e20 310a 0909 7374 643a 3a74 , Jan 1...std::t │ │ │ -0006e310: 696d 655f 7420 6d5f 6372 6561 7469 6f6e ime_t m_creation │ │ │ -0006e320: 5f64 6174 6520 3d20 303b 0a0a 0909 2f2f _date = 0;....// │ │ │ -0006e330: 2074 6865 2068 6173 6828 6573 2920 7468 the hash(es) th │ │ │ -0006e340: 6174 2069 6465 6e74 6966 7920 7468 6973 at identify this │ │ │ -0006e350: 2074 6f72 7265 6e74 0a09 0969 6e66 6f5f torrent...info_ │ │ │ -0006e360: 6861 7368 5f74 206d 5f69 6e66 6f5f 6861 hash_t m_info_ha │ │ │ -0006e370: 7368 3b0a 0a09 092f 2f20 7468 6973 2069 sh;....// this i │ │ │ -0006e380: 7320 7468 6520 6f66 6673 6574 2069 6e74 s the offset int │ │ │ -0006e390: 6f20 7468 6520 6d5f 696e 666f 5f73 6563 o the m_info_sec │ │ │ -0006e3a0: 7469 6f6e 2062 7566 6665 7220 746f 2074 tion buffer to t │ │ │ -0006e3b0: 6865 2066 6972 7374 2062 7974 6520 6f66 he first byte of │ │ │ -0006e3c0: 0a09 092f 2f20 7468 6520 6669 7273 7420 ...// the first │ │ │ -0006e3d0: 5348 412d 3120 6861 7368 0a09 0973 7464 SHA-1 hash...std │ │ │ -0006e3e0: 3a3a 696e 7433 325f 7420 6d5f 7069 6563 ::int32_t m_piec │ │ │ -0006e3f0: 655f 6861 7368 6573 203d 2030 3b0a 0a09 e_hashes = 0;... │ │ │ -0006e400: 092f 2f20 7468 6520 6e75 6d62 6572 206f .// the number o │ │ │ -0006e410: 6620 6279 7465 7320 696e 206d 5f69 6e66 f bytes in m_inf │ │ │ -0006e420: 6f5f 7365 6374 696f 6e0a 0909 7374 643a o_section...std: │ │ │ -0006e430: 3a69 6e74 3332 5f74 206d 5f69 6e66 6f5f :int32_t m_info_ │ │ │ -0006e440: 7365 6374 696f 6e5f 7369 7a65 203d 2030 section_size = 0 │ │ │ -0006e450: 3b0a 0a09 092f 2f20 7468 6973 2069 7320 ;....// this is │ │ │ -0006e460: 7573 6564 2077 6865 6e20 6372 6561 7469 used when creati │ │ │ -0006e470: 6e67 2061 2074 6f72 7265 6e74 2e20 4966 ng a torrent. If │ │ │ -0006e480: 2074 6865 7265 2773 0a09 092f 2f20 6f6e there's...// on │ │ │ -0006e490: 6c79 206f 6e65 2066 696c 6520 7468 6572 ly one file ther │ │ │ -0006e4a0: 6520 6172 6520 6361 7365 7320 7768 6572 e are cases wher │ │ │ -0006e4b0: 6520 6974 2773 2069 6d70 6f73 7369 626c e it's impossibl │ │ │ -0006e4c0: 650a 3c2f 7072 653e 3c2f 7464 3e3c 2f74 e.
    < │ │ │ -0006e4f0: 7464 3e72 656c 6576 616e 6365 266e 6273 td>relevance&nbs │ │ │ -0006e500: 703b 303c 2f74 643e 3c74 643e 3c61 2068 p;0../ │ │ │ -0006e530: 696e 636c 7564 652f 6c69 6274 6f72 7265 include/libtorre │ │ │ -0006e540: 6e74 2f73 6f63 6b65 745f 7479 7065 2e68 nt/socket_type.h │ │ │ -0006e550: 7070 3a36 303c 2f61 3e3c 2f74 643e 3c74 pp:60move to aux

    move │ │ │ -0006e5c0: 746f 2061 7578 3c2f 6832 3e3c 6834 3e2e to aux

    . │ │ │ -0006e5d0: 2e2f 696e 636c 7564 652f 6c69 6274 6f72 ./include/libtor │ │ │ -0006e5e0: 7265 6e74 2f73 6f63 6b65 745f 7479 7065 rent/socket_type │ │ │ -0006e5f0: 2e68 7070 3a36 303c 2f68 343e 3c70 7265 .hpp:60

    namespace 
    │ │ │ -0006e640: 6c69 6274 6f72 7265 6e74 207b 0a0a 2f2f  libtorrent {..//
    │ │ │ -0006e650: 2041 2074 7970 6520 6465 7363 7269 6269   A type describi
    │ │ │ -0006e660: 6e67 206b 696e 6473 206f 6620 736f 636b  ng kinds of sock
    │ │ │ -0006e670: 6574 7320 696e 766f 6c76 6564 2069 6e20  ets involved in 
    │ │ │ -0006e680: 7661 7269 6f75 7320 6f70 6572 6174 696f  various operatio
    │ │ │ -0006e690: 6e73 206f 7220 6576 656e 7473 2e0a 656e  ns or events..en
    │ │ │ -0006e6a0: 756d 2063 6c61 7373 2073 6f63 6b65 745f  um class socket_
    │ │ │ -0006e6b0: 7479 7065 5f74 203a 2073 7464 3a3a 7569  type_t : std::ui
    │ │ │ -0006e6c0: 6e74 385f 7420 7b0a 0974 6370 2c0a 0973  nt8_t {..tcp,..s
    │ │ │ -0006e6d0: 6f63 6b73 352c 0a09 6874 7470 2c0a 0975  ocks5,..http,..u
    │ │ │ -0006e6e0: 7470 2c0a 0969 3270 2c0a 0974 6370 5f73  tp,..i2p,..tcp_s
    │ │ │ -0006e6f0: 736c 2c0a 0973 6f63 6b73 355f 7373 6c2c  sl,..socks5_ssl,
    │ │ │ -0006e700: 0a09 6874 7470 5f73 736c 2c0a 0975 7470  ..http_ssl,..utp
    │ │ │ -0006e710: 5f73 736c 2c0a 0a23 6966 2054 4f52 5245  _ssl,..#if TORRE
    │ │ │ -0006e720: 4e54 5f41 4249 5f56 4552 5349 4f4e 2026  NT_ABI_VERSION &
    │ │ │ -0006e730: 6c74 3b3d 2032 0a09 7564 7020 544f 5252  lt;= 2..udp TORR
    │ │ │ -0006e740: 454e 545f 4445 5052 4543 4154 4544 5f45  ENT_DEPRECATED_E
    │ │ │ -0006e750: 4e55 4d20 3d20 7574 702c 0a23 656e 6469  NUM = utp,.#endi
    │ │ │ -0006e760: 660a 7d3b 0a0a 2f2f 2072 6574 7572 6e20  f.};..// return 
    │ │ │ -0006e770: 6120 7368 6f72 7420 6875 6d61 6e20 7265  a short human re
    │ │ │ -0006e780: 6164 6162 6c65 206e 616d 6520 666f 7220  adable name for 
    │ │ │ -0006e790: 7479 7065 7320 6f66 2073 6f63 6b65 740a  types of socket.
    │ │ │ -0006e7a0: 3c64 6976 2073 7479 6c65 3d22 6261 636b  
    ch │ │ │ -0006e7d0: 6172 2063 6f6e 7374 2a20 736f 636b 6574 ar const* socket │ │ │ -0006e7e0: 5f74 7970 655f 6e61 6d65 2873 6f63 6b65 _type_name(socke │ │ │ -0006e7f0: 745f 7479 7065 5f74 293b 0a3c 2f64 6976 t_type_t);.
    .}..#endif.rel │ │ │ -0006e840: 6576 616e 6365 266e 6273 703b 303c 2f74 evance 0../includ │ │ │ -0006e880: 652f 6c69 6274 6f72 7265 6e74 2f70 726f e/libtorrent/pro │ │ │ -0006e890: 7879 5f62 6173 652e 6870 703a 3232 373c xy_base.hpp:227< │ │ │ -0006e8a0: 2f61 3e3c 2f74 643e 3c74 643e 6974 2077 /a>it w │ │ │ -0006e8b0: 6f75 6c64 2062 6520 6e69 6365 2074 6f20 ould be nice to │ │ │ -0006e8c0: 7265 6d65 6d62 6572 2074 6865 2062 696e remember the bin │ │ │ -0006e8d0: 6420 706f 7274 2061 6e64 2062 696e 6420 d port and bind │ │ │ -0006e8e0: 6f6e 6365 2077 6520 6b6e 6f77 2077 6865 once we know whe │ │ │ -0006e8f0: 7265 2074 6865 2070 726f 7879 2069 7320 re the proxy is │ │ │ -0006e900: 6d5f 736f 636b 2e62 696e 6428 656e 6470 m_sock.bind(endp │ │ │ -0006e910: 6f69 6e74 2c20 6563 293b 3c2f 7464 3e3c oint, ec);< │ │ │ -0006e920: 2f74 723e 3c74 7220 6964 3d22 3235 3322 /tr>

    it would │ │ │ -0006e970: 2062 6520 6e69 6365 2074 6f20 7265 6d65 be nice to reme │ │ │ -0006e980: 6d62 6572 2074 6865 2062 696e 6420 706f mber the bind po │ │ │ -0006e990: 7274 2061 6e64 2062 696e 6420 6f6e 6365 rt and bind once │ │ │ -0006e9a0: 2077 6520 6b6e 6f77 2077 6865 7265 2074 we know where t │ │ │ -0006e9b0: 6865 2070 726f 7879 2069 730a 6d5f 736f he proxy is.m_so │ │ │ -0006e9c0: 636b 2e62 696e 6428 656e 6470 6f69 6e74 ck.bind(endpoint │ │ │ -0006e9d0: 2c20 6563 293b 3c2f 6832 3e3c 6834 3e2e , ec);

    . │ │ │ -0006e9e0: 2e2f 696e 636c 7564 652f 6c69 6274 6f72 ./include/libtor │ │ │ -0006e9f0: 7265 6e74 2f70 726f 7879 5f62 6173 652e rent/proxy_base. │ │ │ -0006ea00: 6870 703a 3232 373c 2f68 343e 3c70 7265 hpp:227

    ..TORRENT_
    │ │ │ -0006ea50: 4153 5345 5254 286d 5f6d 6167 6963 203d  ASSERT(m_magic =
    │ │ │ -0006ea60: 3d20 3078 3133 3337 293b 0a09 096d 5f73  = 0x1337);...m_s
    │ │ │ -0006ea70: 6f63 6b2e 6361 6e63 656c 2829 3b0a 097d  ock.cancel();..}
    │ │ │ -0006ea80: 0a0a 0976 6f69 6420 6361 6e63 656c 2865  ...void cancel(e
    │ │ │ -0006ea90: 7272 6f72 5f63 6f64 6526 616d 703b 2065  rror_code& e
    │ │ │ -0006eaa0: 6329 0a09 7b0a 0909 544f 5252 454e 545f  c)..{...TORRENT_
    │ │ │ -0006eab0: 4153 5345 5254 286d 5f6d 6167 6963 203d  ASSERT(m_magic =
    │ │ │ -0006eac0: 3d20 3078 3133 3337 293b 0a09 096d 5f73  = 0x1337);...m_s
    │ │ │ -0006ead0: 6f63 6b2e 6361 6e63 656c 2865 6329 3b0a  ock.cancel(ec);.
    │ │ │ -0006eae0: 097d 0a0a 0976 6f69 6420 6269 6e64 2865  .}...void bind(e
    │ │ │ -0006eaf0: 6e64 706f 696e 745f 7479 7065 2063 6f6e  ndpoint_type con
    │ │ │ -0006eb00: 7374 2661 6d70 3b20 2f2a 2065 6e64 706f  st& /* endpo
    │ │ │ -0006eb10: 696e 7420 2a2f 2c20 6572 726f 725f 636f  int */, error_co
    │ │ │ -0006eb20: 6465 2661 6d70 3b20 2f2a 2065 6320 2a2f  de& /* ec */
    │ │ │ -0006eb30: 290a 097b 0a09 0954 4f52 5245 4e54 5f41  )..{...TORRENT_A
    │ │ │ -0006eb40: 5353 4552 5428 6d5f 6d61 6769 6320 3d3d  SSERT(m_magic ==
    │ │ │ -0006eb50: 2030 7831 3333 3729 3b0a 0909 2f2f 2074   0x1337);...// t
    │ │ │ -0006eb60: 6865 2072 6561 736f 6e20 7768 7920 7765  he reason why we
    │ │ │ -0006eb70: 2069 676e 6f72 6520 6269 6e64 7320 6865   ignore binds he
    │ │ │ -0006eb80: 7265 2069 7320 6265 6361 7573 6520 7765  re is because we
    │ │ │ -0006eb90: 2064 6f6e 2774 0a09 092f 2f20 286e 6563   don't...// (nec
    │ │ │ -0006eba0: 6573 7361 7269 6c79 2920 7965 7420 6b6e  essarily) yet kn
    │ │ │ -0006ebb0: 6f77 2077 6861 7420 6164 6472 6573 7320  ow what address 
    │ │ │ -0006ebc0: 6661 6d69 6c79 2074 6865 2070 726f 7879  family the proxy
    │ │ │ -0006ebd0: 0a09 092f 2f20 7769 6c6c 2072 6573 6f6c  ...// will resol
    │ │ │ -0006ebe0: 7665 2074 6f2c 2061 6e64 2062 696e 6469  ve to, and bindi
    │ │ │ -0006ebf0: 6e67 2074 6f20 7468 6520 7772 6f6e 6720  ng to the wrong 
    │ │ │ -0006ec00: 6f6e 6520 776f 756c 640a 0909 2f2f 2062  one would...// b
    │ │ │ -0006ec10: 7265 616b 206f 7572 2063 6f6e 6e65 6374  reak our connect
    │ │ │ -0006ec20: 696f 6e20 6174 7465 6d70 7420 6c61 7465  ion attempt late
    │ │ │ -0006ec30: 722e 2054 6865 2063 616c 6c65 7220 6865  r. The caller he
    │ │ │ -0006ec40: 7265 0a09 092f 2f20 646f 6573 6e27 7420  re...// doesn't 
    │ │ │ -0006ec50: 6e65 6365 7373 6172 696c 7920 6b6e 6f77  necessarily know
    │ │ │ -0006ec60: 2074 6861 7420 7765 2772 6520 7072 6f78   that we're prox
    │ │ │ -0006ec70: 7969 6e67 2c20 736f 2074 6869 730a 0909  ying, so this...
    │ │ │ -0006ec80: 2f2f 2062 696e 6420 6164 6472 6573 7320  // bind address 
    │ │ │ -0006ec90: 6973 2062 6173 6564 206f 6e20 7468 6520  is based on the 
    │ │ │ -0006eca0: 6669 6e61 6c20 656e 6470 6f69 6e74 2c20  final endpoint, 
    │ │ │ -0006ecb0: 6e6f 7420 7468 650a 0909 2f2f 2070 726f  not the...// pro
    │ │ │ -0006ecc0: 7879 2e0a 3c64 6976 2073 7479 6c65 3d22  xy..
    .}.
    .#ifn │ │ │ -0006ed00: 6465 6620 424f 4f53 545f 4e4f 5f45 5843 def BOOST_NO_EXC │ │ │ -0006ed10: 4550 5449 4f4e 530a 0976 6f69 6420 6f70 EPTIONS..void op │ │ │ -0006ed20: 656e 2870 726f 746f 636f 6c5f 7479 7065 en(protocol_type │ │ │ -0006ed30: 2063 6f6e 7374 2661 6d70 3b29 0a09 7b0a const&)..{. │ │ │ -0006ed40: 0909 544f 5252 454e 545f 4153 5345 5254 ..TORRENT_ASSERT │ │ │ -0006ed50: 286d 5f6d 6167 6963 203d 3d20 3078 3133 (m_magic == 0x13 │ │ │ -0006ed60: 3337 293b 0a2f 2f09 096d 5f73 6f63 6b2e 37);.//..m_sock. │ │ │ -0006ed70: 6f70 656e 2870 293b 0a09 7d0a 2365 6e64 open(p);..}.#end │ │ │ -0006ed80: 6966 0a0a 0976 6f69 6420 6f70 656e 2870 if...void open(p │ │ │ -0006ed90: 726f 746f 636f 6c5f 7479 7065 2063 6f6e rotocol_type con │ │ │ -0006eda0: 7374 2661 6d70 3b2c 2065 7272 6f72 5f63 st&, error_c │ │ │ -0006edb0: 6f64 6526 616d 703b 290a 097b 0a09 0954 ode&)..{...T │ │ │ -0006edc0: 4f52 5245 4e54 5f41 5353 4552 5428 6d5f ORRENT_ASSERT(m_ │ │ │ -0006edd0: 6d61 6769 6320 3d3d 2030 7831 3333 3729 magic == 0x1337) │ │ │ -0006ede0: 3b0a 0909 2f2f 2077 6520 6e65 6564 2074 ;...// we need t │ │ │ -0006edf0: 6f20 6967 6e6f 7265 2074 6869 7320 666f o ignore this fo │ │ │ -0006ee00: 7220 7468 6520 7361 6d65 2072 6561 736f r the same reaso │ │ │ -0006ee10: 6e20 6173 2073 7461 7465 640a 0909 2f2f n as stated...// │ │ │ -0006ee20: 2066 6f72 2069 676e 6f72 696e 6720 6269 for ignoring bi │ │ │ -0006ee30: 6e64 2829 0a2f 2f09 096d 5f73 6f63 6b2e nd().//..m_sock. │ │ │ -0006ee40: 6f70 656e 2870 2c20 6563 293b 0a09 7d0a open(p, ec);..}. │ │ │ -0006ee50: 0a23 6966 6e64 6566 2042 4f4f 5354 5f4e .#ifndef BOOST_N │ │ │ -0006ee60: 4f5f 4558 4345 5054 494f 4e53 0a09 766f O_EXCEPTIONS..vo │ │ │ -0006ee70: 6964 2063 6c6f 7365 2829 0a09 7b0a 0909 id close()..{... │ │ │ -0006ee80: 544f 5252 454e 545f 4153 5345 5254 286d TORRENT_ASSERT(m │ │ │ -0006ee90: 5f6d 6167 6963 203d 3d20 3078 3133 3337 _magic == 0x1337 │ │ │ -0006eea0: 293b 0a09 096d 5f72 656d 6f74 655f 656e );...m_remote_en │ │ │ -0006eeb0: 6470 6f69 6e74 203d 2065 6e64 706f 696e dpoint = endpoin │ │ │ -0006eec0: 745f 7479 7065 2829 3b0a 0909 6d5f 736f t_type();...m_so │ │ │ -0006eed0: 636b 2e63 6c6f 7365 2829 3b0a 0909 6d5f ck.close();...m_ │ │ │ -0006eee0: 7265 736f 6c76 6572 2e63 616e 6365 6c28 resolver.cancel( │ │ │ -0006eef0: 293b 0a09 7d0a 2365 6e64 6966 0a0a 0976 );..}.#endif...v │ │ │ -0006ef00: 6f69 6420 636c 6f73 6528 6572 726f 725f oid close(error_ │ │ │ -0006ef10: 636f 6465 2661 6d70 3b20 6563 290a 097b code& ec)..{ │ │ │ -0006ef20: 0a09 0954 4f52 5245 4e54 5f41 5353 4552 ...TORRENT_ASSER │ │ │ -0006ef30: 5428 6d5f 6d61 6769 6320 3d3d 2030 7831 T(m_magic == 0x1 │ │ │ -0006ef40: 3333 3729 3b0a 3c2f 7072 653e 3c2f 7464 337);.
    relevance │ │ │ -0006ef80: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ -0006ef90: 3c61 2068 7265 663d 226a 6176 6173 6372
    ../include/libt │ │ │ -0006efc0: 6f72 7265 6e74 2f70 6572 666f 726d 616e orrent/performan │ │ │ -0006efd0: 6365 5f63 6f75 6e74 6572 732e 6870 703a ce_counters.hpp: │ │ │ -0006efe0: 3439 313c 2f61 3e3c 2f74 643e 3c74 643e 491 │ │ │ -0006eff0: 736f 6d65 2073 7061 6365 2063 6f75 6c64 some space could │ │ │ -0006f000: 2062 6520 7361 7665 6420 6865 7265 2062 be saved here b │ │ │ -0006f010: 7920 6d61 6b69 6e67 2067 6175 6765 7320 y making gauges │ │ │ -0006f020: 3332 2062 6974 733c 2f74 643e 3c2f 7472 32 bits

    some space │ │ │ -0006f080: 636f 756c 6420 6265 2073 6176 6564 2068 could be saved h │ │ │ -0006f090: 6572 6520 6279 206d 616b 696e 6720 6761 ere by making ga │ │ │ -0006f0a0: 7567 6573 2033 3220 6269 7473 3c2f 6832 uges 32 bits

    ../include/ │ │ │ -0006f0c0: 6c69 6274 6f72 7265 6e74 2f70 6572 666f libtorrent/perfo │ │ │ -0006f0d0: 726d 616e 6365 5f63 6f75 6e74 6572 732e rmance_counters. │ │ │ -0006f0e0: 6870 703a 3439 313c 2f68 343e 3c70 7265 hpp:491

    relevance
    │ │ │ -0006f160: 266e 6273 703b 303c 2f74 643e 3c74 643e   0
    │ │ │ -0006f170: 3c61 2068 7265 663d 226a 6176 6173 6372  ../include/libt
    │ │ │ -0006f1a0: 6f72 7265 6e74 2f70 6572 666f 726d 616e  orrent/performan
    │ │ │ -0006f1b0: 6365 5f63 6f75 6e74 6572 732e 6870 703a  ce_counters.hpp:
    │ │ │ -0006f1c0: 3439 323c 2f61 3e3c 2f74 643e 3c74 643e  492
    │ │ │ -0006f1d0: 7265 7374 6f72 6520 7468 6573 6520 746f  restore these to
    │ │ │ -0006f1e0: 2072 6567 756c 6172 2069 6e74 6567 6572   regular integer
    │ │ │ -0006f1f0: 732e 2049 6e73 7465 6164 2068 6176 6520  s. Instead have 
    │ │ │ -0006f200: 6f6e 6520 636f 7079 206f 6620 7468 6520  one copy of the 
    │ │ │ -0006f210: 636f 756e 7465 7273 2070 6572 2074 6872  counters per thr
    │ │ │ -0006f220: 6561 6420 616e 6420 636f 6c6c 6563 7420  ead and collect 
    │ │ │ -0006f230: 7468 656d 2061 7420 636f 6e76 656e 6965  them at convenie
    │ │ │ -0006f240: 6e74 2073 796e 6368 726f 6e69 7a61 7469  nt synchronizati
    │ │ │ -0006f250: 6f6e 2070 6f69 6e74 733c 2f74 643e 3c2f  on points

    restore t │ │ │ -0006f2b0: 6865 7365 2074 6f20 7265 6775 6c61 7220 hese to regular │ │ │ -0006f2c0: 696e 7465 6765 7273 2e20 496e 7374 6561 integers. Instea │ │ │ -0006f2d0: 6420 6861 7665 206f 6e65 2063 6f70 790a d have one copy. │ │ │ -0006f2e0: 6f66 2074 6865 2063 6f75 6e74 6572 7320 of the counters │ │ │ -0006f2f0: 7065 7220 7468 7265 6164 2061 6e64 2063 per thread and c │ │ │ -0006f300: 6f6c 6c65 6374 2074 6865 6d20 6174 2063 ollect them at c │ │ │ -0006f310: 6f6e 7665 6e69 656e 740a 7379 6e63 6872 onvenient.synchr │ │ │ -0006f320: 6f6e 697a 6174 696f 6e20 706f 696e 7473 onization points │ │ │ -0006f330: 3c2f 6832 3e3c 6834 3e2e 2e2f 696e 636c

    ../incl │ │ │ -0006f340: 7564 652f 6c69 6274 6f72 7265 6e74 2f70 ude/libtorrent/p │ │ │ -0006f350: 6572 666f 726d 616e 6365 5f63 6f75 6e74 erformance_count │ │ │ -0006f360: 6572 732e 6870 703a 3439 323c 2f68 343e ers.hpp:492

    │ │ │ -0006f370: 3c70 7265 2073 7479 6c65 3d22 6261 636b
    #ifdef
    │ │ │ -0006f3b0: 2041 544f 4d49 435f 4c4c 4f4e 475f 4c4f   ATOMIC_LLONG_LO
    │ │ │ -0006f3c0: 434b 5f46 5245 450a 2364 6566 696e 6520  CK_FREE.#define 
    │ │ │ -0006f3d0: 544f 5252 454e 545f 434f 554e 5445 525f  TORRENT_COUNTER_
    │ │ │ -0006f3e0: 4e4f 4558 4345 5054 206e 6f65 7863 6570  NOEXCEPT noexcep
    │ │ │ -0006f3f0: 740a 2365 6c73 650a 2364 6566 696e 6520  t.#else.#define 
    │ │ │ -0006f400: 544f 5252 454e 545f 434f 554e 5445 525f  TORRENT_COUNTER_
    │ │ │ -0006f410: 4e4f 4558 4345 5054 0a23 656e 6469 660a  NOEXCEPT.#endif.
    │ │ │ -0006f420: 0a09 0963 6f75 6e74 6572 7328 2920 544f  ...counters() TO
    │ │ │ -0006f430: 5252 454e 545f 434f 554e 5445 525f 4e4f  RRENT_COUNTER_NO
    │ │ │ -0006f440: 4558 4345 5054 3b0a 0a09 0963 6f75 6e74  EXCEPT;....count
    │ │ │ -0006f450: 6572 7328 636f 756e 7465 7273 2063 6f6e  ers(counters con
    │ │ │ -0006f460: 7374 2661 6d70 3b29 2054 4f52 5245 4e54  st&) TORRENT
    │ │ │ -0006f470: 5f43 4f55 4e54 4552 5f4e 4f45 5843 4550  _COUNTER_NOEXCEP
    │ │ │ -0006f480: 543b 0a09 0963 6f75 6e74 6572 7326 616d  T;...counters&am
    │ │ │ -0006f490: 703b 206f 7065 7261 746f 723d 2863 6f75  p; operator=(cou
    │ │ │ -0006f4a0: 6e74 6572 7320 636f 6e73 7426 616d 703b  nters const&
    │ │ │ -0006f4b0: 2920 2661 6d70 3b20 544f 5252 454e 545f  ) & TORRENT_
    │ │ │ -0006f4c0: 434f 554e 5445 525f 4e4f 4558 4345 5054  COUNTER_NOEXCEPT
    │ │ │ -0006f4d0: 3b0a 0a09 092f 2f20 7265 7475 726e 7320  ;....// returns 
    │ │ │ -0006f4e0: 7468 6520 6e65 7720 7661 6c75 650a 0909  the new value...
    │ │ │ -0006f4f0: 7374 643a 3a69 6e74 3634 5f74 2069 6e63  std::int64_t inc
    │ │ │ -0006f500: 5f73 7461 7473 5f63 6f75 6e74 6572 2869  _stats_counter(i
    │ │ │ -0006f510: 6e74 2063 2c20 7374 643a 3a69 6e74 3634  nt c, std::int64
    │ │ │ -0006f520: 5f74 2076 616c 7565 203d 2031 2920 544f  _t value = 1) TO
    │ │ │ -0006f530: 5252 454e 545f 434f 554e 5445 525f 4e4f  RRENT_COUNTER_NO
    │ │ │ -0006f540: 4558 4345 5054 3b0a 0909 7374 643a 3a69  EXCEPT;...std::i
    │ │ │ -0006f550: 6e74 3634 5f74 206f 7065 7261 746f 725b  nt64_t operator[
    │ │ │ -0006f560: 5d28 696e 7420 6929 2063 6f6e 7374 2054  ](int i) const T
    │ │ │ -0006f570: 4f52 5245 4e54 5f43 4f55 4e54 4552 5f4e  ORRENT_COUNTER_N
    │ │ │ -0006f580: 4f45 5843 4550 543b 0a0a 0909 766f 6964  OEXCEPT;....void
    │ │ │ -0006f590: 2073 6574 5f76 616c 7565 2869 6e74 2063   set_value(int c
    │ │ │ -0006f5a0: 2c20 7374 643a 3a69 6e74 3634 5f74 2076  , std::int64_t v
    │ │ │ -0006f5b0: 616c 7565 2920 544f 5252 454e 545f 434f  alue) TORRENT_CO
    │ │ │ -0006f5c0: 554e 5445 525f 4e4f 4558 4345 5054 3b0a  UNTER_NOEXCEPT;.
    │ │ │ -0006f5d0: 0909 766f 6964 2062 6c65 6e64 5f73 7461  ..void blend_sta
    │ │ │ -0006f5e0: 7473 5f63 6f75 6e74 6572 2869 6e74 2063  ts_counter(int c
    │ │ │ -0006f5f0: 2c20 7374 643a 3a69 6e74 3634 5f74 2076  , std::int64_t v
    │ │ │ -0006f600: 616c 7565 2c20 696e 7420 7261 7469 6f29  alue, int ratio)
    │ │ │ -0006f610: 2054 4f52 5245 4e54 5f43 4f55 4e54 4552   TORRENT_COUNTER
    │ │ │ -0006f620: 5f4e 4f45 5843 4550 543b 0a0a 0970 7269  _NOEXCEPT;...pri
    │ │ │ -0006f630: 7661 7465 3a0a 0a3c 6469 7620 7374 796c  vate:..
    #ifdef ATOM │ │ │ -0006f670: 4943 5f4c 4c4f 4e47 5f4c 4f43 4b5f 4652 IC_LLONG_LOCK_FR │ │ │ -0006f680: 4545 0a3c 2f64 6976 3e09 0961 7578 3a3a EE.
    ..aux:: │ │ │ -0006f690: 6172 7261 7926 6c74 3b73 7464 3a3a 6174 array<std::at │ │ │ -0006f6a0: 6f6d 6963 266c 743b 7374 643a 3a69 6e74 omic<std::int │ │ │ -0006f6b0: 3634 5f74 2667 743b 2c20 6e75 6d5f 636f 64_t>, num_co │ │ │ -0006f6c0: 756e 7465 7273 2667 743b 206d 5f73 7461 unters> m_sta │ │ │ -0006f6d0: 7473 5f63 6f75 6e74 6572 3b0a 2365 6c73 ts_counter;.#els │ │ │ -0006f6e0: 650a 0909 2f2f 2069 6620 7468 6520 6174 e...// if the at │ │ │ -0006f6f0: 6f6d 6963 2074 7970 6520 6973 6e27 7420 omic type isn't │ │ │ -0006f700: 6c6f 636b 2d66 7265 652c 2075 7365 2061 lock-free, use a │ │ │ -0006f710: 2073 696e 676c 6520 6c6f 636b 2069 6e73 single lock ins │ │ │ -0006f720: 7465 6164 2c20 666f 720a 0909 2f2f 2074 tead, for...// t │ │ │ -0006f730: 6865 2077 686f 6c65 2061 7272 6179 0a09 he whole array.. │ │ │ -0006f740: 096d 7574 6162 6c65 2073 7464 3a3a 6d75 .mutable std::mu │ │ │ -0006f750: 7465 7820 6d5f 6d75 7465 783b 0a09 0961 tex m_mutex;...a │ │ │ -0006f760: 7578 3a3a 6172 7261 7926 6c74 3b73 7464 ux::array<std │ │ │ -0006f770: 3a3a 696e 7436 345f 742c 206e 756d 5f63 ::int64_t, num_c │ │ │ -0006f780: 6f75 6e74 6572 7326 6774 3b20 6d5f 7374 ounters> m_st │ │ │ -0006f790: 6174 735f 636f 756e 7465 723b 0a23 656e ats_counter;.#en │ │ │ -0006f7a0: 6469 660a 097d 3b0a 7d0a 0a23 656e 6469 dif..};.}..#endi │ │ │ -0006f7b0: 660a 3c2f 7072 653e 3c2f 7464 3e3c 2f74 f.
    < │ │ │ -0006f7e0: 7464 3e72 656c 6576 616e 6365 266e 6273 td>relevance&nbs │ │ │ -0006f7f0: 703b 303c 2f74 643e 3c74 643e 3c61 2068 p;0../ │ │ │ -0006f820: 696e 636c 7564 652f 6c69 6274 6f72 7265 include/libtorre │ │ │ -0006f830: 6e74 2f75 706e 702e 6870 703a 3136 343c nt/upnp.hpp:164< │ │ │ -0006f840: 2f61 3e3c 2f74 643e 3c74 643e 7375 7070 /a>supp │ │ │ -0006f850: 6f72 7420 7573 696e 6720 7468 6520 7769 ort using the wi │ │ │ -0006f860: 6e64 6f77 7320 4150 4920 666f 7220 5550 ndows API for UP │ │ │ -0006f870: 6e50 206f 7065 7261 7469 6f6e 7320 6173 nP operations as │ │ │ -0006f880: 2077 656c 6c3c 2f74 643e 3c2f 7472 3e3c well< │ │ │ -0006f890: 7472 2069 643d 2232 3536 2220 7374 796c tr id="256" styl │ │ │ -0006f8a0: 653d 2264 6973 706c 6179 3a20 6e6f 6e65 e="display: none │ │ │ -0006f8b0: 3b22 2063 6f6c 7370 616e 3d22 3322 3e3c ;" colspan="3">< │ │ │ -0006f8c0: 7464 2063 6f6c 7370 616e 3d22 3322 3e3c td colspan="3">< │ │ │ -0006f8d0: 6832 3e73 7570 706f 7274 2075 7369 6e67 h2>support using │ │ │ -0006f8e0: 2074 6865 2077 696e 646f 7773 2041 5049 the windows API │ │ │ -0006f8f0: 2066 6f72 2055 506e 5020 6f70 6572 6174 for UPnP operat │ │ │ -0006f900: 696f 6e73 2061 7320 7765 6c6c 3c2f 6832 ions as well

    ../include/ │ │ │ -0006f920: 6c69 6274 6f72 7265 6e74 2f75 706e 702e libtorrent/upnp. │ │ │ -0006f930: 6870 703a 3136 343c 2f68 343e 3c70 7265 hpp:164

    {..bool in
    │ │ │ -0006f980: 5f65 7272 6f72 5f63 6f64 6520 3d20 6661  _error_code = fa
    │ │ │ -0006f990: 6c73 653b 0a09 626f 6f6c 2065 7869 7420  lse;..bool exit 
    │ │ │ -0006f9a0: 3d20 6661 6c73 653b 0a09 696e 7420 6572  = false;..int er
    │ │ │ -0006f9b0: 726f 725f 636f 6465 203d 202d 313b 0a7d  ror_code = -1;.}
    │ │ │ -0006f9c0: 3b0a 0a73 7472 7563 7420 6970 5f61 6464  ;..struct ip_add
    │ │ │ -0006f9d0: 7265 7373 5f70 6172 7365 5f73 7461 7465  ress_parse_state
    │ │ │ -0006f9e0: 3a20 6572 726f 725f 636f 6465 5f70 6172  : error_code_par
    │ │ │ -0006f9f0: 7365 5f73 7461 7465 0a7b 0a09 626f 6f6c  se_state.{..bool
    │ │ │ -0006fa00: 2069 6e5f 6970 5f61 6464 7265 7373 203d   in_ip_address =
    │ │ │ -0006fa10: 2066 616c 7365 3b0a 0973 7464 3a3a 7374   false;..std::st
    │ │ │ -0006fa20: 7269 6e67 2069 705f 6164 6472 6573 733b  ring ip_address;
    │ │ │ -0006fa30: 0a7d 3b0a 0a54 4f52 5245 4e54 5f45 5854  .};..TORRENT_EXT
    │ │ │ -0006fa40: 5241 5f45 5850 4f52 5420 766f 6964 2066  RA_EXPORT void f
    │ │ │ -0006fa50: 696e 645f 636f 6e74 726f 6c5f 7572 6c28  ind_control_url(
    │ │ │ -0006fa60: 696e 7420 7479 7065 2c20 7374 7269 6e67  int type, string
    │ │ │ -0006fa70: 5f76 6965 772c 2070 6172 7365 5f73 7461  _view, parse_sta
    │ │ │ -0006fa80: 7465 2661 6d70 3b20 7374 6174 6529 3b0a  te& state);.
    │ │ │ -0006fa90: 0a54 4f52 5245 4e54 5f45 5854 5241 5f45  .TORRENT_EXTRA_E
    │ │ │ -0006faa0: 5850 4f52 5420 766f 6964 2066 696e 645f  XPORT void find_
    │ │ │ -0006fab0: 6572 726f 725f 636f 6465 2869 6e74 2074  error_code(int t
    │ │ │ -0006fac0: 7970 652c 2073 7472 696e 675f 7669 6577  ype, string_view
    │ │ │ -0006fad0: 2073 7472 696e 670a 092c 2065 7272 6f72   string.., error
    │ │ │ -0006fae0: 5f63 6f64 655f 7061 7273 655f 7374 6174  _code_parse_stat
    │ │ │ -0006faf0: 6526 616d 703b 2073 7461 7465 293b 0a0a  e& state);..
    │ │ │ -0006fb00: 544f 5252 454e 545f 4558 5452 415f 4558  TORRENT_EXTRA_EX
    │ │ │ -0006fb10: 504f 5254 2076 6f69 6420 6669 6e64 5f69  PORT void find_i
    │ │ │ -0006fb20: 705f 6164 6472 6573 7328 696e 7420 7479  p_address(int ty
    │ │ │ -0006fb30: 7065 2c20 7374 7269 6e67 5f76 6965 7720  pe, string_view 
    │ │ │ -0006fb40: 7374 7269 6e67 0a09 2c20 6970 5f61 6464  string.., ip_add
    │ │ │ -0006fb50: 7265 7373 5f70 6172 7365 5f73 7461 7465  ress_parse_state
    │ │ │ -0006fb60: 2661 6d70 3b20 7374 6174 6529 3b0a 0a3c  & state);..<
    │ │ │ -0006fb70: 6469 7620 7374 796c 653d 2262 6163 6b67  div style="backg
    │ │ │ -0006fb80: 726f 756e 643a 2023 6666 6666 3030 2220  round: #ffff00" 
    │ │ │ -0006fb90: 7769 6474 683d 2231 3030 2522 3e73 7472  width="100%">str
    │ │ │ -0006fba0: 7563 7420 544f 5252 454e 545f 4558 5452  uct TORRENT_EXTR
    │ │ │ -0006fbb0: 415f 4558 504f 5254 2075 706e 7020 6669  A_EXPORT upnp fi
    │ │ │ -0006fbc0: 6e61 6c0a 3c2f 6469 763e 093a 2073 7464  nal..: std
    │ │ │ -0006fbd0: 3a3a 656e 6162 6c65 5f73 6861 7265 645f  ::enable_shared_
    │ │ │ -0006fbe0: 6672 6f6d 5f74 6869 7326 6c74 3b75 706e  from_this<upn
    │ │ │ -0006fbf0: 7026 6774 3b0a 092c 2073 696e 676c 655f  p>.., single_
    │ │ │ -0006fc00: 7468 7265 6164 6564 0a7b 0a09 7570 6e70  threaded.{..upnp
    │ │ │ -0006fc10: 2869 6f5f 636f 6e74 6578 7426 616d 703b  (io_context&
    │ │ │ -0006fc20: 2069 6f73 0a09 092c 2061 7578 3a3a 7365   ios..., aux::se
    │ │ │ -0006fc30: 7373 696f 6e5f 7365 7474 696e 6773 2063  ssion_settings c
    │ │ │ -0006fc40: 6f6e 7374 2661 6d70 3b20 7365 7474 696e  onst& settin
    │ │ │ -0006fc50: 6773 0a09 092c 2061 7578 3a3a 706f 7274  gs..., aux::port
    │ │ │ -0006fc60: 6d61 705f 6361 6c6c 6261 636b 2661 6d70  map_callback&
    │ │ │ -0006fc70: 3b20 6362 0a09 092c 2061 6464 7265 7373  ; cb..., address
    │ │ │ -0006fc80: 5f76 3420 6c69 7374 656e 5f61 6464 7265  _v4 listen_addre
    │ │ │ -0006fc90: 7373 0a09 092c 2061 6464 7265 7373 5f76  ss..., address_v
    │ │ │ -0006fca0: 3420 6e65 746d 6173 6b0a 0909 2c20 7374  4 netmask..., st
    │ │ │ -0006fcb0: 643a 3a73 7472 696e 6720 6c69 7374 656e  d::string listen
    │ │ │ -0006fcc0: 5f64 6576 6963 650a 0909 2c20 6175 783a  _device..., aux:
    │ │ │ -0006fcd0: 3a6c 6973 7465 6e5f 736f 636b 6574 5f68  :listen_socket_h
    │ │ │ -0006fce0: 616e 646c 6520 6c73 293b 0a09 7e75 706e  andle ls);..~upn
    │ │ │ -0006fcf0: 7028 293b 0a0a 0976 6f69 6420 7374 6172  p();...void star
    │ │ │ -0006fd00: 7428 293b 0a0a 092f 2f20 4174 7465 6d70  t();...// Attemp
    │ │ │ -0006fd10: 7473 2074 6f20 6164 6420 6120 706f 7274  ts to add a port
    │ │ │ -0006fd20: 206d 6170 7069 6e67 2066 6f72 2074 6865   mapping for the
    │ │ │ -0006fd30: 2073 7065 6369 6669 6564 2070 726f 746f   specified proto
    │ │ │ -0006fd40: 636f 6c2e 2056 616c 6964 2070 726f 746f  col. Valid proto
    │ │ │ -0006fd50: 636f 6c73 2061 7265 0a09 2f2f 2060 6075  cols are..// ``u
    │ │ │ -0006fd60: 706e 703a 3a74 6370 6060 2061 6e64 2060  pnp::tcp`` and `
    │ │ │ -0006fd70: 6075 706e 703a 3a75 6470 6060 2066 6f72  `upnp::udp`` for
    │ │ │ -0006fd80: 2074 6865 2055 506e 5020 636c 6173 7320   the UPnP class 
    │ │ │ -0006fd90: 616e 6420 6060 6e61 7470 6d70 3a3a 7463  and ``natpmp::tc
    │ │ │ -0006fda0: 7060 6020 616e 640a 092f 2f20 6060 6e61  p`` and..// ``na
    │ │ │ -0006fdb0: 7470 6d70 3a3a 7564 7060 6020 666f 7220  tpmp::udp`` for 
    │ │ │ -0006fdc0: 7468 6520 4e41 542d 504d 5020 636c 6173  the NAT-PMP clas
    │ │ │ -0006fdd0: 732e 0a09 2f2f 0a09 2f2f 2060 6065 7874  s...//..// ``ext
    │ │ │ -0006fde0: 6572 6e61 6c5f 706f 7274 6060 2069 7320  ernal_port`` is 
    │ │ │ -0006fdf0: 7468 6520 706f 7274 206f 6e20 7468 6520  the port on the 
    │ │ │ -0006fe00: 6578 7465 726e 616c 2061 6464 7265 7373  external address
    │ │ │ -0006fe10: 2074 6861 7420 7769 6c6c 2062 6520 6d61   that will be ma
    │ │ │ -0006fe20: 7070 6564 2e20 5468 6973 0a09 2f2f 2069  pped. This..// i
    │ │ │ -0006fe30: 7320 6120 6869 6e74 2c20 796f 7520 6172  s a hint, you ar
    │ │ │ -0006fe40: 6520 6e6f 7420 6775 6172 616e 7465 6564  e not guaranteed
    │ │ │ -0006fe50: 2074 6861 7420 7468 6973 2070 6f72 7420   that this port 
    │ │ │ -0006fe60: 7769 6c6c 2062 6520 6176 6169 6c61 626c  will be availabl
    │ │ │ -0006fe70: 652c 2061 6e64 2069 7420 6d61 790a 092f  e, and it may../
    │ │ │ -0006fe80: 2f20 656e 6420 7570 2062 6569 6e67 2073  / end up being s
    │ │ │ -0006fe90: 6f6d 6574 6869 6e67 2065 6c73 652e 2049  omething else. I
    │ │ │ -0006fea0: 6e20 7468 6520 706f 7274 6d61 705f 616c  n the portmap_al
    │ │ │ -0006feb0: 6572 745f 206e 6f74 6966 6963 6174 696f  ert_ notificatio
    │ │ │ -0006fec0: 6e2c 2074 6865 2061 6374 7561 6c0a 092f  n, the actual../
    │ │ │ -0006fed0: 2f20 6578 7465 726e 616c 2070 6f72 7420  / external port 
    │ │ │ -0006fee0: 6973 2072 6570 6f72 7465 642e 0a09 2f2f  is reported...//
    │ │ │ -0006fef0: 0a09 2f2f 2060 606c 6f63 616c 5f70 6f72  ..// ``local_por
    │ │ │ -0006ff00: 7460 6020 6973 2074 6865 2070 6f72 7420  t`` is the port 
    │ │ │ -0006ff10: 696e 2074 6865 206c 6f63 616c 206d 6163  in the local mac
    │ │ │ -0006ff20: 6869 6e65 2074 6861 7420 7468 6520 6d61  hine that the ma
    │ │ │ -0006ff30: 7070 696e 6720 7368 6f75 6c64 2066 6f72  pping should for
    │ │ │ -0006ff40: 7761 7264 0a09 2f2f 2074 6f2e 0a09 2f2f  ward..// to...//
    │ │ │ -0006ff50: 0a09 2f2f 2054 6865 2072 6574 7572 6e20  ..// The return 
    │ │ │ -0006ff60: 7661 6c75 6520 6973 2061 6e20 696e 6465  value is an inde
    │ │ │ -0006ff70: 7820 7468 6174 2069 6465 6e74 6966 6965  x that identifie
    │ │ │ -0006ff80: 7320 7468 6973 2070 6f72 7420 6d61 7070  s this port mapp
    │ │ │ -0006ff90: 696e 672e 2054 6869 7320 6973 2075 7365  ing. This is use
    │ │ │ -0006ffa0: 640a 092f 2f20 746f 2072 6566 6572 2074  d..// to refer t
    │ │ │ -0006ffb0: 6f20 6d61 7070 696e 6773 2074 6861 7420  o mappings that 
    │ │ │ -0006ffc0: 6661 696c 7320 6f72 2073 7563 6365 6564  fails or succeed
    │ │ │ -0006ffd0: 7320 696e 2074 6865 2070 6f72 746d 6170  s in the portmap
    │ │ │ -0006ffe0: 5f65 7272 6f72 5f61 6c65 7274 5f20 616e  _error_alert_ an
    │ │ │ -0006fff0: 640a 092f 2f20 706f 7274 6d61 705f 616c  d..// portmap_al
    │ │ │ -00070000: 6572 745f 2072 6573 7065 6374 6976 656c  ert_ respectivel
    │ │ │ -00070010: 792e 2049 6620 5468 6520 6d61 7070 696e  y. If The mappin
    │ │ │ -00070020: 6720 6661 696c 7320 696d 6d65 6469 6174  g fails immediat
    │ │ │ -00070030: 656c 792c 2074 6865 2072 6574 7572 6e20  ely, the return 
    │ │ │ -00070040: 7661 6c75 650a 092f 2f20 6973 202d 312c  value..// is -1,
    │ │ │ -00070050: 2077 6869 6368 206d 6561 6e73 2066 6169   which means fai
    │ │ │ -00070060: 6c75 7265 2e20 5468 6572 6520 7769 6c6c  lure. There will
    │ │ │ -00070070: 206e 6f74 2062 6520 616e 7920 6572 726f   not be any erro
    │ │ │ -00070080: 7220 616c 6572 7420 6e6f 7469 6669 6361  r alert notifica
    │ │ │ -00070090: 7469 6f6e 2066 6f72 0a3c 2f70 7265 3e3c  tion for.
    < │ │ │ -000700a0: 2f74 643e 3c2f 7472 3e3c 7472 2073 7479 /td>releva │ │ │ -000700d0: 6e63 6526 6e62 7370 3b30 3c2f 7464 3e3c nce 0< │ │ │ -000700e0: 7464 3e3c 6120 6872 6566 3d22 6a61 7661 td>
    ../include/l │ │ │ -00070110: 6962 746f 7272 656e 742f 6964 656e 7469 ibtorrent/identi │ │ │ -00070120: 6679 5f63 6c69 656e 742e 6870 703a 3438 fy_client.hpp:48 │ │ │ -00070130: 3c2f 613e 3c2f 7464 3e3c 7464 3e68 6964 hid │ │ │ -00070140: 6520 7468 6973 2064 6563 6c61 7261 7469 e this declarati │ │ │ -00070150: 6f6e 2077 6865 6e20 6465 7072 6563 6174 on when deprecat │ │ │ -00070160: 6564 2066 756e 6374 696f 6e73 2061 7265 ed functions are │ │ │ -00070170: 2064 6973 6162 6c65 642c 2061 6e64 2072 disabled, and r │ │ │ -00070180: 656d 6f76 6520 6974 7320 696e 7465 726e emove its intern │ │ │ -00070190: 616c 2075 7365 3c2f 7464 3e3c 2f74 723e al use │ │ │ -000701a0: 3c74 7220 6964 3d22 3235 3722 2073 7479 │ │ │ -000701d0: 3c74 6420 636f 6c73 7061 6e3d 2233 223e │ │ │ -000701e0: 3c68 323e 6869 6465 2074 6869 7320 6465

    hide this de │ │ │ -000701f0: 636c 6172 6174 696f 6e20 7768 656e 2064 claration when d │ │ │ -00070200: 6570 7265 6361 7465 6420 6675 6e63 7469 eprecated functi │ │ │ -00070210: 6f6e 7320 6172 6520 6469 7361 626c 6564 ons are disabled │ │ │ -00070220: 2c20 616e 640a 7265 6d6f 7665 2069 7473 , and.remove its │ │ │ -00070230: 2069 6e74 6572 6e61 6c20 7573 653c 2f68 internal use

    ../include │ │ │ -00070250: 2f6c 6962 746f 7272 656e 742f 6964 656e /libtorrent/iden │ │ │ -00070260: 7469 6679 5f63 6c69 656e 742e 6870 703a tify_client.hpp: │ │ │ -00070270: 3438 3c2f 6834 3e3c 7072 6520 7374 796c 48

    CONTRACT, STRIC
    │ │ │ -000702c0: 5420 4c49 4142 494c 4954 592c 204f 5220  T LIABILITY, OR 
    │ │ │ -000702d0: 544f 5254 2028 494e 434c 5544 494e 4720  TORT (INCLUDING 
    │ │ │ -000702e0: 4e45 474c 4947 454e 4345 204f 5220 4f54  NEGLIGENCE OR OT
    │ │ │ -000702f0: 4845 5257 4953 4529 0a41 5249 5349 4e47  HERWISE).ARISING
    │ │ │ -00070300: 2049 4e20 414e 5920 5741 5920 4f55 5420   IN ANY WAY OUT 
    │ │ │ -00070310: 4f46 2054 4845 2055 5345 204f 4620 5448  OF THE USE OF TH
    │ │ │ -00070320: 4953 2053 4f46 5457 4152 452c 2045 5645  IS SOFTWARE, EVE
    │ │ │ -00070330: 4e20 4946 2041 4456 4953 4544 204f 4620  N IF ADVISED OF 
    │ │ │ -00070340: 5448 450a 504f 5353 4942 494c 4954 5920  THE.POSSIBILITY 
    │ │ │ -00070350: 4f46 2053 5543 4820 4441 4d41 4745 2e0a  OF SUCH DAMAGE..
    │ │ │ -00070360: 0a2a 2f0a 0a23 6966 6e64 6566 2054 4f52  .*/..#ifndef TOR
    │ │ │ -00070370: 5245 4e54 5f49 4445 4e54 4946 595f 434c  RENT_IDENTIFY_CL
    │ │ │ -00070380: 4945 4e54 5f48 5050 5f49 4e43 4c55 4445  IENT_HPP_INCLUDE
    │ │ │ -00070390: 440a 2364 6566 696e 6520 544f 5252 454e  D.#define TORREN
    │ │ │ -000703a0: 545f 4944 454e 5449 4659 5f43 4c49 454e  T_IDENTIFY_CLIEN
    │ │ │ -000703b0: 545f 4850 505f 494e 434c 5544 4544 0a0a  T_HPP_INCLUDED..
    │ │ │ -000703c0: 2369 6e63 6c75 6465 2022 6c69 6274 6f72  #include "libtor
    │ │ │ -000703d0: 7265 6e74 2f63 6f6e 6669 672e 6870 7022  rent/config.hpp"
    │ │ │ -000703e0: 0a0a 2369 6620 544f 5252 454e 545f 4142  ..#if TORRENT_AB
    │ │ │ -000703f0: 495f 5645 5253 494f 4e20 3d3d 2031 0a23  I_VERSION == 1.#
    │ │ │ -00070400: 696e 636c 7564 6520 226c 6962 746f 7272  include "libtorr
    │ │ │ -00070410: 656e 742f 6175 785f 2f64 6973 6162 6c65  ent/aux_/disable
    │ │ │ -00070420: 5f77 6172 6e69 6e67 735f 7075 7368 2e68  _warnings_push.h
    │ │ │ -00070430: 7070 220a 2369 6e63 6c75 6465 2026 6c74  pp".#include <
    │ │ │ -00070440: 3b62 6f6f 7374 2f6f 7074 696f 6e61 6c2e  ;boost/optional.
    │ │ │ -00070450: 6870 7026 6774 3b0a 2369 6e63 6c75 6465  hpp>.#include
    │ │ │ -00070460: 2022 6c69 6274 6f72 7265 6e74 2f61 7578   "libtorrent/aux
    │ │ │ -00070470: 5f2f 6469 7361 626c 655f 7761 726e 696e  _/disable_warnin
    │ │ │ -00070480: 6773 5f70 6f70 2e68 7070 220a 2365 6e64  gs_pop.hpp".#end
    │ │ │ -00070490: 6966 0a0a 2369 6e63 6c75 6465 2022 6c69  if..#include "li
    │ │ │ -000704a0: 6274 6f72 7265 6e74 2f70 6565 725f 6964  btorrent/peer_id
    │ │ │ -000704b0: 2e68 7070 220a 2369 6e63 6c75 6465 2022  .hpp".#include "
    │ │ │ -000704c0: 6c69 6274 6f72 7265 6e74 2f66 696e 6765  libtorrent/finge
    │ │ │ -000704d0: 7270 7269 6e74 2e68 7070 220a 0a3c 6469  rprint.hpp"..names
    │ │ │ -00070510: 7061 6365 206c 6962 746f 7272 656e 7420  pace libtorrent 
    │ │ │ -00070520: 7b0a 3c2f 6469 763e 0a6e 616d 6573 7061  {..namespa
    │ │ │ -00070530: 6365 2061 7578 207b 0a0a 0954 4f52 5245  ce aux {...TORRE
    │ │ │ -00070540: 4e54 5f45 5854 5241 5f45 5850 4f52 540a  NT_EXTRA_EXPORT.
    │ │ │ -00070550: 0973 7464 3a3a 7374 7269 6e67 2069 6465  .std::string ide
    │ │ │ -00070560: 6e74 6966 795f 636c 6965 6e74 5f69 6d70  ntify_client_imp
    │ │ │ -00070570: 6c28 636f 6e73 7420 7065 6572 5f69 6426  l(const peer_id&
    │ │ │ -00070580: 616d 703b 2070 293b 0a0a 7d0a 0a09 2f2f  amp; p);..}...//
    │ │ │ -00070590: 2074 6865 7365 2066 756e 6374 696f 6e73   these functions
    │ │ │ -000705a0: 2064 6f6e 2774 2072 6561 6c6c 7920 6e65   don't really ne
    │ │ │ -000705b0: 6564 2074 6f20 6265 2070 7562 6c69 632e  ed to be public.
    │ │ │ -000705c0: 2054 6869 7320 6d65 6368 616e 6973 6d20   This mechanism 
    │ │ │ -000705d0: 6f66 0a09 2f2f 2061 6476 6572 7469 7369  of..// advertisi
    │ │ │ -000705e0: 6e67 2063 6c69 656e 7420 736f 6674 7761  ng client softwa
    │ │ │ -000705f0: 7265 2061 6e64 2076 6572 7369 6f6e 2069  re and version i
    │ │ │ -00070600: 7320 616c 736f 206f 7574 2d64 6174 6564  s also out-dated
    │ │ │ -00070610: 2e0a 0a09 2f2f 2054 6869 7320 6675 6e63  ....// This func
    │ │ │ -00070620: 7469 6f6e 2063 616e 2063 616e 2062 6520  tion can can be 
    │ │ │ -00070630: 7573 6564 2074 6f20 6578 7472 6163 7420  used to extract 
    │ │ │ -00070640: 6120 7374 7269 6e67 2064 6573 6372 6962  a string describ
    │ │ │ -00070650: 696e 6720 6120 636c 6965 6e74 0a09 2f2f  ing a client..//
    │ │ │ -00070660: 2076 6572 7369 6f6e 2066 726f 6d20 6974   version from it
    │ │ │ -00070670: 7320 7065 6572 2d69 642e 2049 7420 7769  s peer-id. It wi
    │ │ │ -00070680: 6c6c 2072 6563 6f67 6e69 7a65 206d 6f73  ll recognize mos
    │ │ │ -00070690: 7420 636c 6965 6e74 7320 7468 6174 2068  t clients that h
    │ │ │ -000706a0: 6176 6520 7468 6973 0a09 2f2f 206b 696e  ave this..// kin
    │ │ │ -000706b0: 6420 6f66 2069 6465 6e74 6966 6963 6174  d of identificat
    │ │ │ -000706c0: 696f 6e20 696e 2074 6865 2070 6565 722d  ion in the peer-
    │ │ │ -000706d0: 6964 2e0a 0954 4f52 5245 4e54 5f44 4550  id...TORRENT_DEP
    │ │ │ -000706e0: 5245 4341 5445 445f 4558 504f 5254 0a09  RECATED_EXPORT..
    │ │ │ -000706f0: 7374 643a 3a73 7472 696e 6720 6964 656e  std::string iden
    │ │ │ -00070700: 7469 6679 5f63 6c69 656e 7428 636f 6e73  tify_client(cons
    │ │ │ -00070710: 7420 7065 6572 5f69 6426 616d 703b 2070  t peer_id& p
    │ │ │ -00070720: 293b 0a0a 2369 6620 544f 5252 454e 545f  );..#if TORRENT_
    │ │ │ -00070730: 4142 495f 5645 5253 494f 4e20 3d3d 2031  ABI_VERSION == 1
    │ │ │ -00070740: 0a0a 2369 6e63 6c75 6465 2022 6c69 6274  ..#include "libt
    │ │ │ -00070750: 6f72 7265 6e74 2f61 7578 5f2f 6469 7361  orrent/aux_/disa
    │ │ │ -00070760: 626c 655f 6465 7072 6563 6174 696f 6e5f  ble_deprecation_
    │ │ │ -00070770: 7761 726e 696e 6773 5f70 7573 682e 6870  warnings_push.hp
    │ │ │ -00070780: 7022 0a0a 092f 2f20 5265 7475 726e 7320  p"...// Returns 
    │ │ │ -00070790: 616e 206f 7074 696f 6e61 6c20 6669 6e67  an optional fing
    │ │ │ -000707a0: 6572 7072 696e 7420 6966 2061 6e79 2063  erprint if any c
    │ │ │ -000707b0: 616e 2062 6520 6964 656e 7469 6669 6564  an be identified
    │ │ │ -000707c0: 2066 726f 6d20 7468 6520 7065 6572 0a09   from the peer..
    │ │ │ -000707d0: 2f2f 2069 642e 2054 6869 7320 6361 6e20  // id. This can 
    │ │ │ -000707e0: 6265 2075 7365 6420 746f 2061 7574 6f6d  be used to autom
    │ │ │ -000707f0: 6174 6520 7468 6520 6964 656e 7469 6669  ate the identifi
    │ │ │ -00070800: 6361 7469 6f6e 206f 6620 636c 6965 6e74  cation of client
    │ │ │ -00070810: 732e 2049 7420 7769 6c6c 0a09 2f2f 206e  s. It will..// n
    │ │ │ -00070820: 6f74 2062 6520 6162 6c65 2074 6f20 6964  ot be able to id
    │ │ │ -00070830: 656e 7469 6679 2070 6565 7273 2077 6974  entify peers wit
    │ │ │ -00070840: 6820 6e6f 6e2d 2073 7461 6e64 6172 6420  h non- standard 
    │ │ │ -00070850: 656e 636f 6469 6e67 732e 204f 6e6c 7920  encodings. Only 
    │ │ │ -00070860: 417a 7572 6575 730a 092f 2f20 7374 796c  Azureus..// styl
    │ │ │ -00070870: 652c 2053 6861 646f 7727 7320 7374 796c  e, Shadow's styl
    │ │ │ -00070880: 6520 616e 6420 4d61 696e 6c69 6e65 2073  e and Mainline s
    │ │ │ -00070890: 7479 6c65 2e0a 0954 4f52 5245 4e54 5f44  tyle...TORRENT_D
    │ │ │ -000708a0: 4550 5245 4341 5445 445f 4558 504f 5254  EPRECATED_EXPORT
    │ │ │ -000708b0: 0a09 626f 6f73 743a 3a6f 7074 696f 6e61  ..boost::optiona
    │ │ │ -000708c0: 6c26 6c74 3b66 696e 6765 7270 7269 6e74  l<fingerprint
    │ │ │ -000708d0: 2667 743b 0a09 0963 6c69 656e 745f 6669  >...client_fi
    │ │ │ -000708e0: 6e67 6572 7072 696e 7428 7065 6572 5f69  ngerprint(peer_i
    │ │ │ -000708f0: 6420 636f 6e73 7426 616d 703b 2070 293b  d const& p);
    │ │ │ -00070900: 0a0a 2369 6e63 6c75 6465 2022 6c69 6274  ..#include "libt
    │ │ │ -00070910: 6f72 7265 6e74 2f61 7578 5f2f 6469 7361  orrent/aux_/disa
    │ │ │ -00070920: 626c 655f 7761 726e 696e 6773 5f70 6f70  ble_warnings_pop
    │ │ │ -00070930: 2e68 7070 220a 3c2f 7072 653e 3c2f 7464  .hpp".
    relevance │ │ │ -00070970: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ -00070980: 3c61 2068 7265 663d 226a 6176 6173 6372 ../include/libt │ │ │ -000709b0: 6f72 7265 6e74 2f69 3270 5f73 7472 6561 orrent/i2p_strea │ │ │ -000709c0: 6d2e 6870 703a 3533 343c 2f61 3e3c 2f74 m.hpp:534make this │ │ │ -000709e0: 6120 7374 7269 6e67 5f76 6965 773c 2f74 a string_view

    make │ │ │ -00070a40: 7468 6973 2061 2073 7472 696e 675f 7669 this a string_vi │ │ │ -00070a50: 6577 3c2f 6832 3e3c 6834 3e2e 2e2f 696e ew

    ../in │ │ │ -00070a60: 636c 7564 652f 6c69 6274 6f72 7265 6e74 clude/libtorrent │ │ │ -00070a70: 2f69 3270 5f73 7472 6561 6d2e 6870 703a /i2p_stream.hpp: │ │ │ -00070a80: 3533 343c 2f68 343e 3c70 7265 2073 7479 534

    ...char tmp[20
    │ │ │ -00070ad0: 5d3b 0a09 0961 7578 3a3a 7261 6e64 6f6d  ];...aux::random
    │ │ │ -00070ae0: 5f62 7974 6573 2874 6d70 293b 0a09 096d  _bytes(tmp);...m
    │ │ │ -00070af0: 5f73 6573 7369 6f6e 5f69 642e 7265 7369  _session_id.resi
    │ │ │ -00070b00: 7a65 2873 697a 656f 6628 746d 7029 2a32  ze(sizeof(tmp)*2
    │ │ │ -00070b10: 293b 0a09 0961 7578 3a3a 746f 5f68 6578  );...aux::to_hex
    │ │ │ -00070b20: 2874 6d70 2c20 2661 6d70 3b6d 5f73 6573  (tmp, &m_ses
    │ │ │ -00070b30: 7369 6f6e 5f69 645b 305d 293b 0a0a 0909  sion_id[0]);....
    │ │ │ -00070b40: 6d5f 7361 6d5f 736f 636b 6574 203d 2073  m_sam_socket = s
    │ │ │ -00070b50: 7464 3a3a 6d61 6b65 5f73 6861 7265 6426  td::make_shared&
    │ │ │ -00070b60: 6c74 3b69 3270 5f73 7472 6561 6d26 6774  lt;i2p_stream>
    │ │ │ -00070b70: 3b28 6d5f 696f 5f73 6572 7669 6365 293b  ;(m_io_service);
    │ │ │ -00070b80: 0a09 096d 5f73 616d 5f73 6f63 6b65 742d  ...m_sam_socket-
    │ │ │ -00070b90: 2667 743b 7365 745f 7072 6f78 7928 6d5f  >set_proxy(m_
    │ │ │ -00070ba0: 686f 7374 6e61 6d65 2c20 6d5f 706f 7274  hostname, m_port
    │ │ │ -00070bb0: 293b 0a09 096d 5f73 616d 5f73 6f63 6b65  );...m_sam_socke
    │ │ │ -00070bc0: 742d 2667 743b 7365 745f 636f 6d6d 616e  t->set_comman
    │ │ │ -00070bd0: 6428 6932 705f 7374 7265 616d 3a3a 636d  d(i2p_stream::cm
    │ │ │ -00070be0: 645f 6372 6561 7465 5f73 6573 7369 6f6e  d_create_session
    │ │ │ -00070bf0: 293b 0a09 096d 5f73 616d 5f73 6f63 6b65  );...m_sam_socke
    │ │ │ -00070c00: 742d 2667 743b 7365 745f 7365 7373 696f  t->set_sessio
    │ │ │ -00070c10: 6e5f 6964 286d 5f73 6573 7369 6f6e 5f69  n_id(m_session_i
    │ │ │ -00070c20: 642e 635f 7374 7228 2929 3b0a 0909 6d5f  d.c_str());...m_
    │ │ │ -00070c30: 7361 6d5f 736f 636b 6574 2d26 6774 3b73  sam_socket->s
    │ │ │ -00070c40: 6574 5f73 6573 7369 6f6e 5f6f 7074 696f  et_session_optio
    │ │ │ -00070c50: 6e73 2873 6573 7369 6f6e 5f6f 7074 696f  ns(session_optio
    │ │ │ -00070c60: 6e73 293b 0a0a 0909 4144 445f 4f55 5453  ns);....ADD_OUTS
    │ │ │ -00070c70: 5441 4e44 494e 475f 4153 594e 4328 2269  TANDING_ASYNC("i
    │ │ │ -00070c80: 3270 5f73 7472 6561 6d3a 3a6f 6e5f 7361  2p_stream::on_sa
    │ │ │ -00070c90: 6d5f 636f 6e6e 6563 7422 293b 0a09 096d  m_connect");...m
    │ │ │ -00070ca0: 5f73 616d 5f73 6f63 6b65 742d 2667 743b  _sam_socket->
    │ │ │ -00070cb0: 6173 796e 635f 636f 6e6e 6563 7428 7463  async_connect(tc
    │ │ │ -00070cc0: 703a 3a65 6e64 706f 696e 7428 292c 2077  p::endpoint(), w
    │ │ │ -00070cd0: 7261 705f 616c 6c6f 6361 746f 7228 0a09  rap_allocator(..
    │ │ │ -00070ce0: 0909 5b74 6869 732c 733d 6d5f 7361 6d5f  ..[this,s=m_sam_
    │ │ │ -00070cf0: 736f 636b 6574 5d28 6572 726f 725f 636f  socket](error_co
    │ │ │ -00070d00: 6465 2063 6f6e 7374 2661 6d70 3b20 6563  de const& ec
    │ │ │ -00070d10: 2c20 4861 6e64 6c65 7220 686e 2920 7b0a  , Handler hn) {.
    │ │ │ -00070d20: 0909 0909 6f6e 5f73 616d 5f63 6f6e 6e65  ....on_sam_conne
    │ │ │ -00070d30: 6374 2865 632c 2073 2c20 7374 643a 3a6d  ct(ec, s, std::m
    │ │ │ -00070d40: 6f76 6528 686e 2929 3b0a 0909 097d 2c20  ove(hn));....}, 
    │ │ │ -00070d50: 7374 643a 3a6d 6f76 6528 6861 6e64 6c65  std::move(handle
    │ │ │ -00070d60: 7229 2929 3b0a 097d 0a09 766f 6964 2063  r)));..}..void c
    │ │ │ -00070d70: 6c6f 7365 2865 7272 6f72 5f63 6f64 6526  lose(error_code&
    │ │ │ -00070d80: 616d 703b 293b 0a0a 3c64 6976 2073 7479  amp;);..
    .char cons │ │ │ -00070dc0: 742a 2073 6573 7369 6f6e 5f69 6428 2920 t* session_id() │ │ │ -00070dd0: 636f 6e73 7420 7b20 7265 7475 726e 206d const { return m │ │ │ -00070de0: 5f73 6573 7369 6f6e 5f69 642e 635f 7374 _session_id.c_st │ │ │ -00070df0: 7228 293b 207d 0a3c 2f64 6976 3e09 7374 r(); }.
    .st │ │ │ -00070e00: 643a 3a73 7472 696e 6720 636f 6e73 7426 d::string const& │ │ │ -00070e10: 616d 703b 206c 6f63 616c 5f65 6e64 706f amp; local_endpo │ │ │ -00070e20: 696e 7428 2920 636f 6e73 7420 7b20 7265 int() const { re │ │ │ -00070e30: 7475 726e 206d 5f69 3270 5f6c 6f63 616c turn m_i2p_local │ │ │ -00070e40: 5f65 6e64 706f 696e 743b 207d 0a0a 0974 _endpoint; }...t │ │ │ -00070e50: 656d 706c 6174 6520 266c 743b 7479 7065 emplate <type │ │ │ -00070e60: 6e61 6d65 2048 616e 646c 6572 2667 743b name Handler> │ │ │ -00070e70: 0a09 766f 6964 2061 7379 6e63 5f6e 616d ..void async_nam │ │ │ -00070e80: 655f 6c6f 6f6b 7570 2863 6861 7220 636f e_lookup(char co │ │ │ -00070e90: 6e73 742a 206e 616d 652c 2048 616e 646c nst* name, Handl │ │ │ -00070ea0: 6572 2068 616e 646c 6572 290a 097b 0a09 er handler)..{.. │ │ │ -00070eb0: 0969 6620 286d 5f73 7461 7465 203d 3d20 .if (m_state == │ │ │ -00070ec0: 7361 6d5f 6964 6c65 2026 616d 703b 2661 sam_idle &&a │ │ │ -00070ed0: 6d70 3b20 6d5f 6e61 6d65 5f6c 6f6f 6b75 mp; m_name_looku │ │ │ -00070ee0: 702e 656d 7074 7928 2920 2661 6d70 3b26 p.empty() && │ │ │ -00070ef0: 616d 703b 2069 735f 6f70 656e 2829 290a amp; is_open()). │ │ │ -00070f00: 0909 0964 6f5f 6e61 6d65 5f6c 6f6f 6b75 ...do_name_looku │ │ │ -00070f10: 7028 6e61 6d65 2c20 7374 643a 3a6d 6f76 p(name, std::mov │ │ │ -00070f20: 6528 6861 6e64 6c65 7229 293b 0a09 0965 e(handler));...e │ │ │ -00070f30: 6c73 650a 0909 096d 5f6e 616d 655f 6c6f lse....m_name_lo │ │ │ -00070f40: 6f6b 7570 2e65 6d70 6c61 6365 5f62 6163 okup.emplace_bac │ │ │ -00070f50: 6b28 7374 643a 3a73 7472 696e 6728 6e61 k(std::string(na │ │ │ -00070f60: 6d65 290a 0909 0909 2c20 7374 643a 3a6d me)....., std::m │ │ │ -00070f70: 6f76 6528 6861 6e64 6c65 7229 293b 0a09 ove(handler));.. │ │ │ -00070f80: 7d0a 0a70 7269 7661 7465 3a0a 0a09 7465 }..private:...te │ │ │ -00070f90: 6d70 6c61 7465 2026 6c74 3b74 7970 656e mplate <typen │ │ │ -00070fa0: 616d 6520 4861 6e64 6c65 7226 6774 3b0a ame Handler>. │ │ │ -00070fb0: 0976 6f69 6420 6f6e 5f73 616d 5f63 6f6e .void on_sam_con │ │ │ -00070fc0: 6e65 6374 2865 7272 6f72 5f63 6f64 6520 nect(error_code │ │ │ -00070fd0: 636f 6e73 7426 616d 703b 2065 632c 2073 const& ec, s │ │ │ -00070fe0: 7464 3a3a 7368 6172 6564 5f70 7472 266c td::shared_ptr&l │ │ │ -00070ff0: 743b 6932 705f 7374 7265 616d 2667 743b t;i2p_stream> │ │ │ -00071000: 2c20 4861 6e64 6c65 7220 6829 0a09 7b0a , Handler h)..{. │ │ │ -00071010: 0909 434f 4d50 4c45 5445 5f41 5359 4e43 ..COMPLETE_ASYNC │ │ │ -00071020: 2822 6932 705f 7374 7265 616d 3a3a 6f6e ("i2p_stream::on │ │ │ -00071030: 5f73 616d 5f63 6f6e 6e65 6374 2229 3b0a _sam_connect");. │ │ │ -00071040: 0909 6d5f 7374 6174 6520 3d20 7361 6d5f ..m_state = sam_ │ │ │ -00071050: 6964 6c65 3b0a 0a09 0969 6620 2865 6329 idle;....if (ec) │ │ │ -00071060: 0a09 097b 0a09 0909 6828 6563 293b 0a09 ...{....h(ec);.. │ │ │ -00071070: 0909 7265 7475 726e 3b0a 0909 7d0a 0a09 ..return;...}... │ │ │ -00071080: 0964 6f5f 6e61 6d65 5f6c 6f6f 6b75 7028 .do_name_lookup( │ │ │ -00071090: 224d 4522 2c20 7772 6170 5f61 6c6c 6f63 "ME", wrap_alloc │ │ │ -000710a0: 6174 6f72 280a 0909 095b 7468 6973 5d28 ator(....[this]( │ │ │ -000710b0: 6572 726f 725f 636f 6465 2063 6f6e 7374 error_code const │ │ │ -000710c0: 2661 6d70 3b20 652c 2063 6861 7220 636f & e, char co │ │ │ -000710d0: 6e73 742a 2064 7374 2c20 4861 6e64 6c65 nst* dst, Handle │ │ │ -000710e0: 7220 686e 2920 7b0a 0909 0909 7365 745f r hn) {.....set_ │ │ │ -000710f0: 6c6f 6361 6c5f 656e 6470 6f69 6e74 2865 local_endpoint(e │ │ │ -00071100: 2c20 6473 742c 2073 7464 3a3a 6d6f 7665 , dst, std::move │ │ │ -00071110: 2868 6e29 293b 0a09 0909 7d2c 2073 7464 (hn));....}, std │ │ │ -00071120: 3a3a 6d6f 7665 2868 2929 293b 0a3c 2f70 ::move(h)));.

    re │ │ │ -00071160: 6c65 7661 6e63 6526 6e62 7370 3b30 3c2f levance 0../inclu │ │ │ -000711a0: 6465 2f6c 6962 746f 7272 656e 742f 7069 de/libtorrent/pi │ │ │ -000711b0: 6563 655f 7069 636b 6572 2e68 7070 3a38 ece_picker.hpp:8 │ │ │ -000711c0: 3233 3c2f 613e 3c2f 7464 3e3c 7464 3e73 23s │ │ │ -000711d0: 686f 756c 6420 7468 6973 2062 6520 616c hould this be al │ │ │ -000711e0: 6c6f 6361 7465 6420 6c61 7a69 6c79 3f3c located lazily?< │ │ │ -000711f0: 2f74 643e 3c2f 7472 3e3c 7472 2069 643d /td>

    sho │ │ │ -00071240: 756c 6420 7468 6973 2062 6520 616c 6c6f uld this be allo │ │ │ -00071250: 6361 7465 6420 6c61 7a69 6c79 3f3c 2f68 cated lazily?

    ../include │ │ │ -00071270: 2f6c 6962 746f 7272 656e 742f 7069 6563 /libtorrent/piec │ │ │ -00071280: 655f 7069 636b 6572 2e68 7070 3a38 3233 e_picker.hpp:823 │ │ │ -00071290: 3c2f 6834 3e3c 7072 6520 7374 796c 653d

    .
    │ │ │ -000712d0: 092f 2f20 646f 776e 6c6f 6164 206c 6973  .// download lis
    │ │ │ -000712e0: 7420 6974 206d 6179 206c 6976 6520 696e  t it may live in
    │ │ │ -000712f0: 206e 6f77 0a09 0973 7464 3a3a 7665 6374   now...std::vect
    │ │ │ -00071300: 6f72 266c 743b 646f 776e 6c6f 6164 696e  or<downloadin
    │ │ │ -00071310: 675f 7069 6563 6526 6774 3b3a 3a69 7465  g_piece>::ite
    │ │ │ -00071320: 7261 746f 7220 7570 6461 7465 5f70 6965  rator update_pie
    │ │ │ -00071330: 6365 5f73 7461 7465 280a 0909 0973 7464  ce_state(....std
    │ │ │ -00071340: 3a3a 7665 6374 6f72 266c 743b 646f 776e  ::vector<down
    │ │ │ -00071350: 6c6f 6164 696e 675f 7069 6563 6526 6774  loading_piece>
    │ │ │ -00071360: 3b3a 3a69 7465 7261 746f 7220 6470 293b  ;::iterator dp);
    │ │ │ -00071370: 0a0a 0970 7269 7661 7465 3a0a 0a23 6966  ...private:..#if
    │ │ │ -00071380: 2054 4f52 5245 4e54 5f55 5345 5f41 5353   TORRENT_USE_ASS
    │ │ │ -00071390: 4552 5453 207c 7c20 544f 5252 454e 545f  ERTS || TORRENT_
    │ │ │ -000713a0: 5553 455f 494e 5641 5249 414e 545f 4348  USE_INVARIANT_CH
    │ │ │ -000713b0: 4543 4b53 0a09 0969 6e64 6578 5f72 616e  ECKS...index_ran
    │ │ │ -000713c0: 6765 266c 743b 646f 776e 6c6f 6164 5f71  ge<download_q
    │ │ │ -000713d0: 7565 7565 5f74 2667 743b 2063 6174 6567  ueue_t> categ
    │ │ │ -000713e0: 6f72 6965 7328 2920 636f 6e73 740a 0909  ories() const...
    │ │ │ -000713f0: 7b20 7265 7475 726e 207b 7b7d 2c20 7069  { return {{}, pi
    │ │ │ -00071400: 6563 655f 7069 636b 6572 3a3a 7069 6563  ece_picker::piec
    │ │ │ -00071410: 655f 706f 733a 3a6e 756d 5f64 6f77 6e6c  e_pos::num_downl
    │ │ │ -00071420: 6f61 645f 6361 7465 676f 7269 6573 7d3b  oad_categories};
    │ │ │ -00071430: 207d 0a23 656e 6469 660a 0a09 092f 2f20   }.#endif....// 
    │ │ │ -00071440: 7468 6520 666f 6c6c 6f77 696e 6720 7665  the following ve
    │ │ │ -00071450: 6374 6f72 7320 6172 6520 6d75 7461 626c  ctors are mutabl
    │ │ │ -00071460: 6520 6265 6361 7573 6520 7468 6579 2073  e because they s
    │ │ │ -00071470: 6f6d 6574 696d 6573 206d 6179 0a09 092f  ometimes may.../
    │ │ │ -00071480: 2f20 6265 2075 7064 6174 6564 206c 617a  / be updated laz
    │ │ │ -00071490: 696c 792c 2074 7269 6767 6572 6564 2062  ily, triggered b
    │ │ │ -000714a0: 7920 636f 6e73 7420 6675 6e63 7469 6f6e  y const function
    │ │ │ -000714b0: 730a 0a09 092f 2f20 7468 6973 206d 6170  s....// this map
    │ │ │ -000714c0: 7320 696e 6469 6365 7320 746f 206e 756d  s indices to num
    │ │ │ -000714d0: 6265 7220 6f66 2070 6565 7273 2074 6861  ber of peers tha
    │ │ │ -000714e0: 7420 6861 7320 7468 6973 2070 6965 6365  t has this piece
    │ │ │ -000714f0: 2061 6e64 0a09 092f 2f20 696e 6465 7820   and...// index 
    │ │ │ -00071500: 696e 746f 2074 6865 206d 5f70 6965 6365  into the m_piece
    │ │ │ -00071510: 5f69 6e66 6f20 7665 6374 6f72 732e 0a09  _info vectors...
    │ │ │ -00071520: 092f 2f20 7069 6563 655f 706f 733a 3a77  .// piece_pos::w
    │ │ │ -00071530: 655f 6861 7665 5f69 6e64 6578 206d 6561  e_have_index mea
    │ │ │ -00071540: 6e73 2074 6861 7420 7765 2068 6176 6520  ns that we have 
    │ │ │ -00071550: 7468 6520 7069 6563 652c 2073 6f20 6974  the piece, so it
    │ │ │ -00071560: 0a09 092f 2f20 646f 6573 6e27 7420 6578  ...// doesn't ex
    │ │ │ -00071570: 6973 7420 696e 2074 6865 2070 6965 6365  ist in the piece
    │ │ │ -00071580: 5f69 6e66 6f20 6275 636b 6574 730a 0909  _info buckets...
    │ │ │ -00071590: 2f2f 2070 6965 6365 7320 7769 7468 2074  // pieces with t
    │ │ │ -000715a0: 6865 2066 696c 7465 7265 6420 666c 6167  he filtered flag
    │ │ │ -000715b0: 2073 6574 2064 6f65 736e 2774 2068 6176   set doesn't hav
    │ │ │ -000715c0: 6520 656e 7472 6965 7320 696e 0a09 092f  e entries in.../
    │ │ │ -000715d0: 2f20 7468 6520 6d5f 7069 6563 655f 696e  / the m_piece_in
    │ │ │ -000715e0: 666f 2062 7563 6b65 7473 2065 6974 6865  fo buckets eithe
    │ │ │ -000715f0: 720a 3c64 6976 2073 7479 6c65 3d22 6261  r.
    │ │ │ -00071620: 0909 6d75 7461 626c 6520 6175 783a 3a76 ..mutable aux::v │ │ │ -00071630: 6563 746f 7226 6c74 3b70 6965 6365 5f70 ector<piece_p │ │ │ -00071640: 6f73 2c20 7069 6563 655f 696e 6465 785f os, piece_index_ │ │ │ -00071650: 7426 6774 3b20 6d5f 7069 6563 655f 6d61 t> m_piece_ma │ │ │ -00071660: 703b 0a3c 2f64 6976 3e0a 0909 2f2f 2074 p;.
    ...// t │ │ │ -00071670: 7261 636b 7320 7468 6520 6e75 6d62 6572 racks the number │ │ │ -00071680: 206f 6620 6279 7465 7320 696e 2061 2073 of bytes in a s │ │ │ -00071690: 7065 6369 6669 6320 7069 6563 6520 7468 pecific piece th │ │ │ -000716a0: 6174 2061 7265 2070 6172 7420 6f66 2061 at are part of a │ │ │ -000716b0: 2070 6164 0a09 092f 2f20 6669 6c65 2e20 pad...// file. │ │ │ -000716c0: 5468 6520 7061 6464 696e 6720 6973 2061 The padding is a │ │ │ -000716d0: 7373 756d 6564 2074 6f20 6265 2061 7420 ssumed to be at │ │ │ -000716e0: 7468 6520 656e 6420 6f66 2074 6865 2070 the end of the p │ │ │ -000716f0: 6965 6365 2c20 616e 6420 7468 650a 0909 iece, and the... │ │ │ -00071700: 2f2f 2062 6c6f 636b 7320 636f 7665 7265 // blocks covere │ │ │ -00071710: 6420 6279 2074 6865 2070 6164 2062 7974 d by the pad byt │ │ │ -00071720: 6573 2061 7265 206e 6f74 2070 6963 6b65 es are not picke │ │ │ -00071730: 6420 6279 2074 6865 2070 6965 6365 2070 d by the piece p │ │ │ -00071740: 6963 6b65 720a 0909 7374 643a 3a75 6e6f icker...std::uno │ │ │ -00071750: 7264 6572 6564 5f6d 6170 266c 743b 7069 rdered_map<pi │ │ │ -00071760: 6563 655f 696e 6465 785f 742c 2069 6e74 ece_index_t, int │ │ │ -00071770: 2667 743b 206d 5f70 6164 735f 696e 5f70 > m_pads_in_p │ │ │ -00071780: 6965 6365 3b0a 0a09 092f 2f20 7768 656e iece;....// when │ │ │ -00071790: 2074 6865 2061 646a 6163 656e 745f 7069 the adjacent_pi │ │ │ -000717a0: 6563 6520 6166 6669 6e69 7479 2069 7320 ece affinity is │ │ │ -000717b0: 656e 6162 6c65 642c 2074 6869 7320 636f enabled, this co │ │ │ -000717c0: 6e74 6169 6e73 2074 6865 206d 6f73 740a ntains the most. │ │ │ -000717d0: 0909 2f2f 2072 6563 656e 7420 2265 7874 ..// recent "ext │ │ │ -000717e0: 656e 7473 2220 6f66 2061 646a 6163 656e ents" of adjacen │ │ │ -000717f0: 7420 7069 6563 6573 2074 6861 7420 6861 t pieces that ha │ │ │ -00071800: 7665 2062 6565 6e20 7265 7175 6573 7465 ve been requeste │ │ │ -00071810: 6420 6672 6f6d 0a09 092f 2f20 7468 6973 d from...// this │ │ │ -00071820: 2069 7320 6d75 7461 626c 6520 6265 6361 is mutable beca │ │ │ -00071830: 7573 6520 6974 2773 2075 7064 6174 6564 use it's updated │ │ │ -00071840: 2062 7920 6675 6e63 7469 6f6e 7320 746f by functions to │ │ │ -00071850: 2070 6963 6b20 7069 6563 6573 2c20 7768 pick pieces, wh │ │ │ -00071860: 6963 680a 0909 2f2f 2061 7265 2063 6f6e ich...// are con │ │ │ -00071870: 7374 2e20 5468 6174 2773 2061 6e20 6566 st. That's an ef │ │ │ -00071880: 6669 6369 656e 7420 706c 6163 6520 746f ficient place to │ │ │ -00071890: 2075 7064 6174 6520 6974 2c20 7369 6e63 update it, sinc │ │ │ -000718a0: 6520 6974 2773 2062 6569 6e67 0a09 092f e it's being.../ │ │ │ -000718b0: 2f20 7472 6176 6572 7365 6420 616c 7265 / traversed alre │ │ │ -000718c0: 6164 792e 0a09 096d 7574 6162 6c65 2073 ady....mutable s │ │ │ -000718d0: 7464 3a3a 7665 6374 6f72 266c 743b 7069 td::vector<pi │ │ │ -000718e0: 6563 655f 6578 7465 6e74 5f74 2667 743b ece_extent_t> │ │ │ -000718f0: 206d 5f72 6563 656e 745f 6578 7465 6e74 m_recent_extent │ │ │ -00071900: 733b 0a0a 0909 2f2f 2074 6865 206e 756d s;....// the num │ │ │ -00071910: 6265 7220 6f66 2062 7974 6573 206f 6620 ber of bytes of │ │ │ -00071920: 7061 6420 6669 6c65 2073 6574 2069 6e20 pad file set in │ │ │ -00071930: 7468 6973 2070 6965 6365 2070 6963 6b65 this piece picke │ │ │ -00071940: 720a 0909 7374 643a 3a69 6e74 3634 5f74 r...std::int64_t │ │ │ -00071950: 206d 5f6e 756d 5f70 6164 5f62 7974 6573 m_num_pad_bytes │ │ │ -00071960: 203d 2030 3b0a 0a09 092f 2f20 7468 6520 = 0;....// the │ │ │ -00071970: 6e75 6d62 6572 206f 6620 7061 6420 626c number of pad bl │ │ │ -00071980: 6f63 6b73 2074 6861 7420 7765 2061 6c72 ocks that we alr │ │ │ -00071990: 6561 6479 2068 6176 650a 0909 7374 643a eady have...std: │ │ │ -000719a0: 3a69 6e74 3634 5f74 206d 5f68 6176 655f :int64_t m_have_ │ │ │ -000719b0: 7061 645f 6279 7465 7320 3d20 303b 0a0a pad_bytes = 0;.. │ │ │ -000719c0: 0909 2f2f 2074 6865 206e 756d 6265 7220 ..// the number │ │ │ -000719d0: 6f66 2070 6164 2062 6c6f 636b 7320 7061 of pad blocks pa │ │ │ -000719e0: 7274 206f 6620 6669 6c74 6572 6564 2070 rt of filtered p │ │ │ -000719f0: 6965 6365 7320 7765 2064 6f6e 2774 2068 ieces we don't h │ │ │ -00071a00: 6176 650a 0909 7374 643a 3a69 6e74 3634 ave...std::int64 │ │ │ -00071a10: 5f74 206d 5f66 696c 7465 7265 645f 7061 _t m_filtered_pa │ │ │ -00071a20: 645f 6279 7465 7320 3d20 303b 0a0a 0909 d_bytes = 0;.... │ │ │ -00071a30: 2f2f 2074 6865 206e 756d 6265 7220 6f66 // the number of │ │ │ -00071a40: 2070 6164 2062 6c6f 636b 7320 7765 2068 pad blocks we h │ │ │ -00071a50: 6176 6520 7468 6174 2061 7265 2061 6c73 ave that are als │ │ │ -00071a60: 6f20 6669 6c74 6572 6564 0a09 0973 7464 o filtered...std │ │ │ -00071a70: 3a3a 696e 7436 345f 7420 6d5f 6861 7665 ::int64_t m_have │ │ │ -00071a80: 5f66 696c 7465 7265 645f 7061 645f 6279 _filtered_pad_by │ │ │ -00071a90: 7465 7320 3d20 303b 0a0a 0909 2f2f 2074 tes = 0;....// t │ │ │ -00071aa0: 6865 206e 756d 6265 7220 6f66 2073 6565 he number of see │ │ │ -00071ab0: 6473 2e20 5468 6573 6520 6172 6520 6e6f ds. These are no │ │ │ -00071ac0: 7420 6164 6465 6420 746f 0a09 092f 2f20 t added to...// │ │ │ -00071ad0: 7468 6520 6176 6169 6c61 6269 6c69 7479 the availability │ │ │ -00071ae0: 2063 6f75 6e74 6572 7320 6f66 2074 6865 counters of the │ │ │ -00071af0: 2070 6965 6365 730a 0909 696e 7420 6d5f pieces...int m_ │ │ │ -00071b00: 7365 6564 7320 3d20 303b 0a0a 0909 2f2f seeds = 0;....// │ │ │ -00071b10: 2074 6869 7320 7665 6374 6f72 2063 6f6e this vector con │ │ │ -00071b20: 7461 696e 7320 616c 6c20 7069 6563 6520 tains all piece │ │ │ -00071b30: 696e 6469 6365 7320 7468 6174 2061 7265 indices that are │ │ │ -00071b40: 2070 6963 6b61 626c 650a 3c2f 7072 653e pickable.
    │ │ │ -00071b50: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ -00071b80: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ -00071b90: 3c74 643e 3c61 2068 7265 663d 226a 6176 ../include/ │ │ │ -00071bc0: 6c69 6274 6f72 7265 6e74 2f70 6965 6365 libtorrent/piece │ │ │ -00071bd0: 5f70 6963 6b65 722e 6870 703a 3839 353c _picker.hpp:895< │ │ │ -00071be0: 2f61 3e3c 2f74 643e 3c74 643e 6974 2077 /a>it w │ │ │ -00071bf0: 6f75 6c64 2062 6520 6d6f 7265 2069 6e74 ould be more int │ │ │ -00071c00: 7569 7469 7665 2074 6f20 6163 636f 756e uitive to accoun │ │ │ -00071c10: 7420 2277 616e 7465 6422 2070 6965 6365 t "wanted" piece │ │ │ -00071c20: 7320 696e 7374 6561 6420 6f66 2066 696c s instead of fil │ │ │ -00071c30: 7465 7265 643c 2f74 643e 3c2f 7472 3e3c tered< │ │ │ -00071c40: 7472 2069 643d 2232 3630 2220 7374 796c tr id="260" styl │ │ │ -00071c50: 653d 2264 6973 706c 6179 3a20 6e6f 6e65 e="display: none │ │ │ -00071c60: 3b22 2063 6f6c 7370 616e 3d22 3322 3e3c ;" colspan="3">< │ │ │ -00071c70: 7464 2063 6f6c 7370 616e 3d22 3322 3e3c td colspan="3">< │ │ │ -00071c80: 6832 3e69 7420 776f 756c 6420 6265 206d h2>it would be m │ │ │ -00071c90: 6f72 6520 696e 7475 6974 6976 6520 746f ore intuitive to │ │ │ -00071ca0: 2061 6363 6f75 6e74 2022 7761 6e74 6564 account "wanted │ │ │ -00071cb0: 2220 7069 6563 6573 0a69 6e73 7465 6164 " pieces.instead │ │ │ -00071cc0: 206f 6620 6669 6c74 6572 6564 3c2f 6832 of filtered

    ../include/ │ │ │ -00071ce0: 6c69 6274 6f72 7265 6e74 2f70 6965 6365 libtorrent/piece │ │ │ -00071cf0: 5f70 6963 6b65 722e 6870 703a 3839 353c _picker.hpp:895< │ │ │ -00071d00: 2f68 343e 3c70 7265 2073 7479 6c65 3d22 /h4>
    ..
    │ │ │ -00071d40: 092f 2f20 7468 6973 2068 6f6c 6473 2074  .// this holds t
    │ │ │ -00071d50: 6865 2069 6e66 6f72 6d61 7469 6f6e 206f  he information o
    │ │ │ -00071d60: 6620 7468 6520 626c 6f63 6b73 2069 6e20  f the blocks in 
    │ │ │ -00071d70: 7061 7274 6961 6c6c 7920 646f 776e 6c6f  partially downlo
    │ │ │ -00071d80: 6164 6564 0a09 092f 2f20 7069 6563 6573  aded...// pieces
    │ │ │ -00071d90: 2e20 7468 6520 646f 776e 6c6f 6164 696e  . the downloadin
    │ │ │ -00071da0: 675f 7069 6563 653a 3a69 6e66 6f20 696e  g_piece::info in
    │ │ │ -00071db0: 6465 7820 706f 696e 7420 696e 746f 2074  dex point into t
    │ │ │ -00071dc0: 6869 7320 7665 6374 6f72 2066 6f72 0a09  his vector for..
    │ │ │ -00071dd0: 092f 2f20 6974 7320 7374 6f72 6167 650a  .// its storage.
    │ │ │ -00071de0: 0909 6175 783a 3a76 6563 746f 7226 6c74  ..aux::vector<
    │ │ │ -00071df0: 3b62 6c6f 636b 5f69 6e66 6f26 6774 3b20  ;block_info> 
    │ │ │ -00071e00: 6d5f 626c 6f63 6b5f 696e 666f 3b0a 0a09  m_block_info;...
    │ │ │ -00071e10: 092f 2f20 7468 6573 6520 6172 6520 626c  .// these are bl
    │ │ │ -00071e20: 6f63 6b20 7261 6e67 6573 2069 6e20 6d5f  ock ranges in m_
    │ │ │ -00071e30: 626c 6f63 6b5f 696e 666f 2074 6861 7420  block_info that 
    │ │ │ -00071e40: 6172 6520 6672 6565 2e20 5468 6520 6e75  are free. The nu
    │ │ │ -00071e50: 6d62 6572 730a 0909 2f2f 2069 6e20 6865  mbers...// in he
    │ │ │ -00071e60: 7265 2c20 7768 656e 206d 756c 7469 706c  re, when multipl
    │ │ │ -00071e70: 6965 6420 6279 2062 6c6f 636b 735f 7065  ied by blocks_pe
    │ │ │ -00071e80: 725f 7069 6563 6520 6973 2074 6865 2069  r_piece is the i
    │ │ │ -00071e90: 6e64 6578 2074 6f20 7468 650a 0909 2f2f  ndex to the...//
    │ │ │ -00071ea0: 2066 6972 7374 2062 6c6f 636b 2069 6e20   first block in 
    │ │ │ -00071eb0: 7468 6520 7261 6e67 6520 7468 6174 2773  the range that's
    │ │ │ -00071ec0: 2066 7265 6520 746f 2075 7365 2062 7920   free to use by 
    │ │ │ -00071ed0: 6120 6e65 7720 646f 776e 6c6f 6164 696e  a new downloadin
    │ │ │ -00071ee0: 675f 7069 6563 652e 0a09 092f 2f20 7468  g_piece....// th
    │ │ │ -00071ef0: 6973 2069 7320 6120 6672 6565 2d6c 6973  is is a free-lis
    │ │ │ -00071f00: 742e 0a09 0973 7464 3a3a 7665 6374 6f72  t....std::vector
    │ │ │ -00071f10: 266c 743b 7374 643a 3a75 696e 7431 365f  <std::uint16_
    │ │ │ -00071f20: 7426 6774 3b20 6d5f 6672 6565 5f62 6c6f  t> m_free_blo
    │ │ │ -00071f30: 636b 5f69 6e66 6f73 3b0a 0a09 0973 7464  ck_infos;....std
    │ │ │ -00071f40: 3a3a 7569 6e74 3136 5f74 206d 5f62 6c6f  ::uint16_t m_blo
    │ │ │ -00071f50: 636b 735f 696e 5f6c 6173 745f 7069 6563  cks_in_last_piec
    │ │ │ -00071f60: 6520 3d20 303b 0a09 0969 6e74 206d 5f70  e = 0;...int m_p
    │ │ │ -00071f70: 6965 6365 5f73 697a 6520 3d20 303b 0a09  iece_size = 0;..
    │ │ │ -00071f80: 0973 7464 3a3a 696e 7436 345f 7420 6d5f  .std::int64_t m_
    │ │ │ -00071f90: 746f 7461 6c5f 7369 7a65 203d 2030 3b0a  total_size = 0;.
    │ │ │ -00071fa0: 0a09 092f 2f20 7468 6520 6e75 6d62 6572  ...// the number
    │ │ │ -00071fb0: 206f 6620 6669 6c74 6572 6564 2070 6965   of filtered pie
    │ │ │ -00071fc0: 6365 7320 7468 6174 2077 6520 646f 6e27  ces that we don'
    │ │ │ -00071fd0: 7420 616c 7265 6164 790a 0909 2f2f 2068  t already...// h
    │ │ │ -00071fe0: 6176 652e 2074 6f74 616c 5f6e 756d 6265  ave. total_numbe
    │ │ │ -00071ff0: 725f 6f66 5f70 6965 6365 7320 2d20 6e75  r_of_pieces - nu
    │ │ │ -00072000: 6d62 6572 5f6f 665f 7069 6563 6573 5f77  mber_of_pieces_w
    │ │ │ -00072010: 655f 6861 7665 0a09 092f 2f20 2d20 6e75  e_have...// - nu
    │ │ │ -00072020: 6d5f 6669 6c74 6572 6564 2069 7320 7375  m_filtered is su
    │ │ │ -00072030: 7070 6f73 6564 2074 6f20 7468 6520 6e75  pposed to the nu
    │ │ │ -00072040: 6d62 6572 206f 6620 7069 6563 6573 0a09  mber of pieces..
    │ │ │ -00072050: 092f 2f20 7765 2073 7469 6c6c 2077 616e  .// we still wan
    │ │ │ -00072060: 7420 746f 2064 6f77 6e6c 6f61 640a 3c64  t to download...in
    │ │ │ -000720a0: 7420 6d5f 6e75 6d5f 6669 6c74 6572 6564  t m_num_filtered
    │ │ │ -000720b0: 203d 2030 3b0a 3c2f 6469 763e 0a09 092f   = 0;..../
    │ │ │ -000720c0: 2f20 7468 6520 6e75 6d62 6572 206f 6620  / the number of 
    │ │ │ -000720d0: 7069 6563 6573 2077 6520 6861 7665 2074  pieces we have t
    │ │ │ -000720e0: 6861 7420 616c 736f 2061 7265 2066 696c  hat also are fil
    │ │ │ -000720f0: 7465 7265 640a 0909 696e 7420 6d5f 6e75  tered...int m_nu
    │ │ │ -00072100: 6d5f 6861 7665 5f66 696c 7465 7265 6420  m_have_filtered 
    │ │ │ -00072110: 3d20 303b 0a0a 0909 2f2f 2077 6520 6861  = 0;....// we ha
    │ │ │ -00072120: 7665 2061 6c6c 2070 6965 6365 7320 696e  ve all pieces in
    │ │ │ -00072130: 2074 6865 2072 616e 6765 205b 302c 206d   the range [0, m
    │ │ │ -00072140: 5f63 7572 736f 7229 0a09 092f 2f20 6d5f  _cursor)...// m_
    │ │ │ -00072150: 6375 7273 6f72 2069 7320 7468 6520 6669  cursor is the fi
    │ │ │ -00072160: 7273 7420 7069 6563 6520 7765 2064 6f6e  rst piece we don
    │ │ │ -00072170: 2774 2068 6176 650a 0909 7069 6563 655f  't have...piece_
    │ │ │ -00072180: 696e 6465 785f 7420 6d5f 6375 7273 6f72  index_t m_cursor
    │ │ │ -00072190: 7b30 7d3b 0a0a 0909 2f2f 2077 6520 6861  {0};....// we ha
    │ │ │ -000721a0: 7665 2061 6c6c 2070 6965 6365 7320 696e  ve all pieces in
    │ │ │ -000721b0: 2074 6865 2072 616e 6765 205b 6d5f 7265   the range [m_re
    │ │ │ -000721c0: 7665 7273 655f 6375 7273 6f72 2c20 656e  verse_cursor, en
    │ │ │ -000721d0: 6429 0a09 092f 2f20 6d5f 7265 7665 7273  d)...// m_revers
    │ │ │ -000721e0: 655f 6375 7273 6f72 2069 7320 7468 6520  e_cursor is the 
    │ │ │ -000721f0: 6669 7273 7420 7069 6563 6520 7768 6572  first piece wher
    │ │ │ -00072200: 6520 7765 2061 6c73 6f20 6861 7665 0a09  e we also have..
    │ │ │ -00072210: 092f 2f20 616c 6c20 7468 6520 7375 6273  .// all the subs
    │ │ │ -00072220: 6571 7565 6e74 2070 6965 6365 730a 0909  equent pieces...
    │ │ │ -00072230: 7069 6563 655f 696e 6465 785f 7420 6d5f  piece_index_t m_
    │ │ │ -00072240: 7265 7665 7273 655f 6375 7273 6f72 7b30  reverse_cursor{0
    │ │ │ -00072250: 7d3b 0a0a 0909 2f2f 2074 6865 206e 756d  };....// the num
    │ │ │ -00072260: 6265 7220 6f66 2070 6965 6365 7320 7765  ber of pieces we
    │ │ │ -00072270: 2068 6176 6520 2869 2e65 2e20 7061 7373   have (i.e. pass
    │ │ │ -00072280: 6564 2068 6173 6820 6368 6563 6b29 2e0a  ed hash check)..
    │ │ │ -00072290: 0909 2f2f 2054 6869 7320 696e 636c 7564  ..// This includ
    │ │ │ -000722a0: 6573 2070 6965 6365 7320 7468 6174 2077  es pieces that w
    │ │ │ -000722b0: 6520 6861 7665 2066 696c 7465 7265 6420  e have filtered 
    │ │ │ -000722c0: 6275 7420 7374 696c 6c20 6861 7665 0a09  but still have..
    │ │ │ -000722d0: 0969 6e74 206d 5f6e 756d 5f68 6176 6520  .int m_num_have 
    │ │ │ -000722e0: 3d20 303b 0a0a 0909 2f2f 2069 6620 7468  = 0;....// if th
    │ │ │ -000722f0: 6973 2069 7320 7365 7420 746f 2074 7275  is is set to tru
    │ │ │ -00072300: 652c 2069 7420 6d65 616e 7320 7570 6461  e, it means upda
    │ │ │ -00072310: 7465 5f70 6965 6365 7328 290a 0909 2f2f  te_pieces()...//
    │ │ │ -00072320: 2068 6173 2074 6f20 6265 2063 616c 6c65   has to be calle
    │ │ │ -00072330: 6420 6265 666f 7265 2061 6363 6573 7369  d before accessi
    │ │ │ -00072340: 6e67 206d 5f70 6965 6365 732e 0a09 096d  ng m_pieces....m
    │ │ │ -00072350: 7574 6162 6c65 2062 6f6f 6c20 6d5f 6469  utable bool m_di
    │ │ │ -00072360: 7274 7920 3d20 6661 6c73 653b 0a09 7075  rty = false;..pu
    │ │ │ -00072370: 626c 6963 3a0a 0a09 0965 6e75 6d20 7b20  blic:....enum { 
    │ │ │ -00072380: 6d61 785f 7069 6563 6573 203d 2028 7374  max_pieces = (st
    │ │ │ -00072390: 643a 3a6e 756d 6572 6963 5f6c 696d 6974  d::numeric_limit
    │ │ │ -000723a0: 7326 6c74 3b69 6e74 2667 743b 3a3a 6d61  s<int>::ma
    │ │ │ -000723b0: 7829 2829 202d 2031 207d 3b0a 0a09 7d3b  x)() - 1 };...};
    │ │ │ -000723c0: 0a7d 0a0a 2365 6e64 6966 202f 2f20 544f  .}..#endif // TO
    │ │ │ -000723d0: 5252 454e 545f 5049 4543 455f 5049 434b  RRENT_PIECE_PICK
    │ │ │ -000723e0: 4552 5f48 5050 5f49 4e43 4c55 4445 440a  ER_HPP_INCLUDED.
    │ │ │ -000723f0: 3c2f 7072 653e 3c2f 7464 3e3c 2f74 723e  
    │ │ │ -00072400: 3c74 7220 7374 796c 653d 2262 6163 6b67 relevance  │ │ │ -00072430: 303c 2f74 643e 3c74 643e 3c61 2068 7265 0
    ../in │ │ │ -00072460: 636c 7564 652f 6c69 6274 6f72 7265 6e74 clude/libtorrent │ │ │ -00072470: 2f70 6565 725f 636f 6e6e 6563 7469 6f6e /peer_connection │ │ │ -00072480: 5f69 6e74 6572 6661 6365 2e68 7070 3a35 _interface.hpp:5 │ │ │ -00072490: 313c 2f61 3e3c 2f74 643e 3c74 643e 6d61 1ma │ │ │ -000724a0: 6b65 2074 6869 7320 696e 7465 7266 6163 ke this interfac │ │ │ -000724b0: 6520 736d 616c 6c65 7221 3c2f 7464 3e3c e smaller!< │ │ │ -000724c0: 2f74 723e 3c74 7220 6964 3d22 3236 3122 /tr>

    make thi │ │ │ -00072510: 7320 696e 7465 7266 6163 6520 736d 616c s interface smal │ │ │ -00072520: 6c65 7221 3c2f 6832 3e3c 6834 3e2e 2e2f ler!

    ../ │ │ │ -00072530: 696e 636c 7564 652f 6c69 6274 6f72 7265 include/libtorre │ │ │ -00072540: 6e74 2f70 6565 725f 636f 6e6e 6563 7469 nt/peer_connecti │ │ │ -00072550: 6f6e 5f69 6e74 6572 6661 6365 2e68 7070 on_interface.hpp │ │ │ -00072560: 3a35 313c 2f68 343e 3c70 7265 2073 7479 :51

    .*/..#ifndef T
    │ │ │ -000725b0: 4f52 5245 4e54 5f50 4545 525f 434f 4e4e  ORRENT_PEER_CONN
    │ │ │ -000725c0: 4543 5449 4f4e 5f49 4e54 4552 4641 4345  ECTION_INTERFACE
    │ │ │ -000725d0: 5f48 5050 0a23 6465 6669 6e65 2054 4f52  _HPP.#define TOR
    │ │ │ -000725e0: 5245 4e54 5f50 4545 525f 434f 4e4e 4543  RENT_PEER_CONNEC
    │ │ │ -000725f0: 5449 4f4e 5f49 4e54 4552 4641 4345 5f48  TION_INTERFACE_H
    │ │ │ -00072600: 5050 0a0a 2369 6e63 6c75 6465 2022 6c69  PP..#include "li
    │ │ │ -00072610: 6274 6f72 7265 6e74 2f66 7764 2e68 7070  btorrent/fwd.hpp
    │ │ │ -00072620: 220a 2369 6e63 6c75 6465 2022 6c69 6274  ".#include "libt
    │ │ │ -00072630: 6f72 7265 6e74 2f73 6f63 6b65 742e 6870  orrent/socket.hp
    │ │ │ -00072640: 7022 0a23 696e 636c 7564 6520 226c 6962  p".#include "lib
    │ │ │ -00072650: 746f 7272 656e 742f 6572 726f 725f 636f  torrent/error_co
    │ │ │ -00072660: 6465 2e68 7070 220a 2369 6e63 6c75 6465  de.hpp".#include
    │ │ │ -00072670: 2022 6c69 6274 6f72 7265 6e74 2f61 6c65   "libtorrent/ale
    │ │ │ -00072680: 7274 5f74 7970 6573 2e68 7070 220a 2369  rt_types.hpp".#i
    │ │ │ -00072690: 6e63 6c75 6465 2022 6c69 6274 6f72 7265  nclude "libtorre
    │ │ │ -000726a0: 6e74 2f6f 7065 7261 7469 6f6e 732e 6870  nt/operations.hp
    │ │ │ -000726b0: 7022 202f 2f20 666f 7220 6f70 6572 6174  p" // for operat
    │ │ │ -000726c0: 696f 6e5f 7420 656e 756d 0a23 696e 636c  ion_t enum.#incl
    │ │ │ -000726d0: 7564 6520 226c 6962 746f 7272 656e 742f  ude "libtorrent/
    │ │ │ -000726e0: 756e 6974 732e 6870 7022 0a0a 6e61 6d65  units.hpp"..name
    │ │ │ -000726f0: 7370 6163 6520 6c69 6274 6f72 7265 6e74  space libtorrent
    │ │ │ -00072700: 207b 0a0a 0973 7472 7563 7420 746f 7272   {...struct torr
    │ │ │ -00072710: 656e 745f 7065 6572 3b0a 0963 6c61 7373  ent_peer;..class
    │ │ │ -00072720: 2073 7461 743b 0a0a 0975 7369 6e67 2064   stat;...using d
    │ │ │ -00072730: 6973 636f 6e6e 6563 745f 7365 7665 7269  isconnect_severi
    │ │ │ -00072740: 7479 5f74 203d 2061 7578 3a3a 7374 726f  ty_t = aux::stro
    │ │ │ -00072750: 6e67 5f74 7970 6564 6566 266c 743b 7374  ng_typedef<st
    │ │ │ -00072760: 643a 3a75 696e 7438 5f74 2c20 7374 7275  d::uint8_t, stru
    │ │ │ -00072770: 6374 2064 6973 636f 6e6e 6563 745f 7365  ct disconnect_se
    │ │ │ -00072780: 7665 7269 7479 5f74 6167 2667 743b 3b0a  verity_tag>;.
    │ │ │ -00072790: 0a3c 6469 7620 7374 796c 653d 2262 6163  .
    . │ │ │ -000727c0: 7374 7275 6374 2054 4f52 5245 4e54 5f45 struct TORRENT_E │ │ │ -000727d0: 5854 5241 5f45 5850 4f52 5420 7065 6572 XTRA_EXPORT peer │ │ │ -000727e0: 5f63 6f6e 6e65 6374 696f 6e5f 696e 7465 _connection_inte │ │ │ -000727f0: 7266 6163 650a 3c2f 6469 763e 097b 0a09 rface.
    .{.. │ │ │ -00072800: 0973 7461 7469 6320 636f 6e73 7465 7870 .static constexp │ │ │ -00072810: 7220 6469 7363 6f6e 6e65 6374 5f73 6576 r disconnect_sev │ │ │ -00072820: 6572 6974 795f 7420 6e6f 726d 616c 7b30 erity_t normal{0 │ │ │ -00072830: 7d3b 0a09 0973 7461 7469 6320 636f 6e73 };...static cons │ │ │ -00072840: 7465 7870 7220 6469 7363 6f6e 6e65 6374 texpr disconnect │ │ │ -00072850: 5f73 6576 6572 6974 795f 7420 6661 696c _severity_t fail │ │ │ -00072860: 7572 657b 317d 3b0a 0909 7374 6174 6963 ure{1};...static │ │ │ -00072870: 2063 6f6e 7374 6578 7072 2064 6973 636f constexpr disco │ │ │ -00072880: 6e6e 6563 745f 7365 7665 7269 7479 5f74 nnect_severity_t │ │ │ -00072890: 2070 6565 725f 6572 726f 727b 327d 3b0a peer_error{2};. │ │ │ -000728a0: 0a23 6966 2054 4f52 5245 4e54 5f55 5345 .#if TORRENT_USE │ │ │ -000728b0: 5f49 3250 0a09 0976 6972 7475 616c 2073 _I2P...virtual s │ │ │ -000728c0: 7464 3a3a 7374 7269 6e67 2063 6f6e 7374 td::string const │ │ │ -000728d0: 2661 6d70 3b20 6465 7374 696e 6174 696f & destinatio │ │ │ -000728e0: 6e28 2920 636f 6e73 7420 3d20 303b 0a09 n() const = 0;.. │ │ │ -000728f0: 0976 6972 7475 616c 2073 7464 3a3a 7374 .virtual std::st │ │ │ -00072900: 7269 6e67 2063 6f6e 7374 2661 6d70 3b20 ring const& │ │ │ -00072910: 6c6f 6361 6c5f 6932 705f 656e 6470 6f69 local_i2p_endpoi │ │ │ -00072920: 6e74 2829 2063 6f6e 7374 203d 2030 3b0a nt() const = 0;. │ │ │ -00072930: 2365 6e64 6966 0a09 0976 6972 7475 616c #endif...virtual │ │ │ -00072940: 2074 6370 3a3a 656e 6470 6f69 6e74 2063 tcp::endpoint c │ │ │ -00072950: 6f6e 7374 2661 6d70 3b20 7265 6d6f 7465 onst& remote │ │ │ -00072960: 2829 2063 6f6e 7374 203d 2030 3b0a 0909 () const = 0;... │ │ │ -00072970: 7669 7274 7561 6c20 7463 703a 3a65 6e64 virtual tcp::end │ │ │ -00072980: 706f 696e 7420 6c6f 6361 6c5f 656e 6470 point local_endp │ │ │ -00072990: 6f69 6e74 2829 2063 6f6e 7374 203d 2030 oint() const = 0 │ │ │ -000729a0: 3b0a 0909 7669 7274 7561 6c20 766f 6964 ;...virtual void │ │ │ -000729b0: 2064 6973 636f 6e6e 6563 7428 6572 726f disconnect(erro │ │ │ -000729c0: 725f 636f 6465 2063 6f6e 7374 2661 6d70 r_code const& │ │ │ -000729d0: 3b20 6563 0a09 0909 2c20 6f70 6572 6174 ; ec...., operat │ │ │ -000729e0: 696f 6e5f 7420 6f70 2c20 6469 7363 6f6e ion_t op, discon │ │ │ -000729f0: 6e65 6374 5f73 6576 6572 6974 795f 7420 nect_severity_t │ │ │ -00072a00: 3d20 7065 6572 5f63 6f6e 6e65 6374 696f = peer_connectio │ │ │ -00072a10: 6e5f 696e 7465 7266 6163 653a 3a6e 6f72 n_interface::nor │ │ │ -00072a20: 6d61 6c29 203d 2030 3b0a 0909 7669 7274 mal) = 0;...virt │ │ │ -00072a30: 7561 6c20 7065 6572 5f69 6420 636f 6e73 ual peer_id cons │ │ │ -00072a40: 7426 616d 703b 2070 6964 2829 2063 6f6e t& pid() con │ │ │ -00072a50: 7374 203d 2030 3b0a 0909 7669 7274 7561 st = 0;...virtua │ │ │ -00072a60: 6c20 7065 6572 5f69 6420 6f75 725f 7069 l peer_id our_pi │ │ │ -00072a70: 6428 2920 636f 6e73 7420 3d20 303b 0a09 d() const = 0;.. │ │ │ -00072a80: 0976 6972 7475 616c 2076 6f69 6420 7365 .virtual void se │ │ │ -00072a90: 745f 686f 6c65 7075 6e63 685f 6d6f 6465 t_holepunch_mode │ │ │ -00072aa0: 2829 203d 2030 3b0a 0909 7669 7274 7561 () = 0;...virtua │ │ │ -00072ab0: 6c20 746f 7272 656e 745f 7065 6572 2a20 l torrent_peer* │ │ │ -00072ac0: 7065 6572 5f69 6e66 6f5f 7374 7275 6374 peer_info_struct │ │ │ -00072ad0: 2829 2063 6f6e 7374 203d 2030 3b0a 0909 () const = 0;... │ │ │ -00072ae0: 7669 7274 7561 6c20 766f 6964 2073 6574 virtual void set │ │ │ -00072af0: 5f70 6565 725f 696e 666f 2874 6f72 7265 _peer_info(torre │ │ │ -00072b00: 6e74 5f70 6565 722a 2070 6929 203d 2030 nt_peer* pi) = 0 │ │ │ -00072b10: 3b0a 0909 7669 7274 7561 6c20 626f 6f6c ;...virtual bool │ │ │ -00072b20: 2069 735f 6f75 7467 6f69 6e67 2829 2063 is_outgoing() c │ │ │ -00072b30: 6f6e 7374 203d 2030 3b0a 0909 7669 7274 onst = 0;...virt │ │ │ -00072b40: 7561 6c20 766f 6964 2061 6464 5f73 7461 ual void add_sta │ │ │ -00072b50: 7428 7374 643a 3a69 6e74 3634 5f74 2064 t(std::int64_t d │ │ │ -00072b60: 6f77 6e6c 6f61 6465 642c 2073 7464 3a3a ownloaded, std:: │ │ │ -00072b70: 696e 7436 345f 7420 7570 6c6f 6164 6564 int64_t uploaded │ │ │ -00072b80: 2920 3d20 303b 0a09 0976 6972 7475 616c ) = 0;...virtual │ │ │ -00072b90: 2062 6f6f 6c20 6661 7374 5f72 6563 6f6e bool fast_recon │ │ │ -00072ba0: 6e65 6374 2829 2063 6f6e 7374 203d 2030 nect() const = 0 │ │ │ -00072bb0: 3b0a 0909 7669 7274 7561 6c20 626f 6f6c ;...virtual bool │ │ │ -00072bc0: 2069 735f 6368 6f6b 6564 2829 2063 6f6e is_choked() con │ │ │ -00072bd0: 7374 203d 2030 3b0a 0909 7669 7274 7561 st = 0;...virtua │ │ │ -00072be0: 6c20 626f 6f6c 2066 6169 6c65 6428 2920 l bool failed() │ │ │ -00072bf0: 636f 6e73 7420 3d20 303b 0a09 0976 6972 const = 0;...vir │ │ │ -00072c00: 7475 616c 2073 7461 7420 636f 6e73 7426 tual stat const& │ │ │ -00072c10: 616d 703b 2073 7461 7469 7374 6963 7328 amp; statistics( │ │ │ -00072c20: 2920 636f 6e73 7420 3d20 303b 0a09 0976 ) const = 0;...v │ │ │ -00072c30: 6972 7475 616c 2076 6f69 6420 6765 745f irtual void get_ │ │ │ -00072c40: 7065 6572 5f69 6e66 6f28 7065 6572 5f69 peer_info(peer_i │ │ │ -00072c50: 6e66 6f26 616d 703b 2070 2920 636f 6e73 nfo& p) cons │ │ │ -00072c60: 7420 3d20 303b 0a23 6966 6e64 6566 2054 t = 0;.#ifndef T │ │ │ -00072c70: 4f52 5245 4e54 5f44 4953 4142 4c45 5f4c ORRENT_DISABLE_L │ │ │ -00072c80: 4f47 4749 4e47 0a09 0976 6972 7475 616c OGGING...virtual │ │ │ -00072c90: 2062 6f6f 6c20 7368 6f75 6c64 5f6c 6f67 bool should_log │ │ │ -00072ca0: 2870 6565 725f 6c6f 675f 616c 6572 743a (peer_log_alert: │ │ │ -00072cb0: 3a64 6972 6563 7469 6f6e 5f74 2064 6972 :direction_t dir │ │ │ -00072cc0: 6563 7469 6f6e 2920 636f 6e73 7420 3d20 ection) const = │ │ │ -00072cd0: 303b 0a09 0976 6972 7475 616c 2076 6f69 0;...virtual voi │ │ │ -00072ce0: 6420 7065 6572 5f6c 6f67 2870 6565 725f d peer_log(peer_ │ │ │ -00072cf0: 6c6f 675f 616c 6572 743a 3a64 6972 6563 log_alert::direc │ │ │ -00072d00: 7469 6f6e 5f74 2064 6972 6563 7469 6f6e tion_t direction │ │ │ -00072d10: 0a09 0909 2c20 6368 6172 2063 6f6e 7374 ...., char const │ │ │ -00072d20: 2a20 6576 656e 742c 2063 6861 7220 636f * event, char co │ │ │ -00072d30: 6e73 742a 2066 6d74 203d 2022 222c 202e nst* fmt = "", . │ │ │ -00072d40: 2e2e 2920 636f 6e73 7420 6e6f 6578 6365 ..) const noexce │ │ │ -00072d50: 7074 2054 4f52 5245 4e54 5f46 4f52 4d41 pt TORRENT_FORMA │ │ │ -00072d60: 5428 342c 3529 203d 2030 3b0a 2365 6e64 T(4,5) = 0;.#end │ │ │ -00072d70: 6966 0a3c 2f70 7265 3e3c 2f74 643e 3c2f if.
    │ │ │ -00072da0: 3c74 643e 7265 6c65 7661 6e63 6526 6e62 relevance&nb │ │ │ -00072db0: 7370 3b30 3c2f 7464 3e3c 7464 3e3c 6120 sp;0.. │ │ │ -00072de0: 2f69 6e63 6c75 6465 2f6c 6962 746f 7272 /include/libtorr │ │ │ -00072df0: 656e 742f 736f 636b 7335 5f73 7472 6561 ent/socks5_strea │ │ │ -00072e00: 6d2e 6870 703a 3139 393c 2f61 3e3c 2f74 m.hpp:199we could b │ │ │ -00072e20: 696e 6420 7468 6520 736f 636b 6574 2068 ind the socket h │ │ │ -00072e30: 6572 652c 2073 696e 6365 2077 6520 6b6e ere, since we kn │ │ │ -00072e40: 6f77 2077 6861 7420 7468 6520 7461 7267 ow what the targ │ │ │ -00072e50: 6574 2065 6e64 706f 696e 7420 6973 206f et endpoint is o │ │ │ -00072e60: 6620 7468 6520 7072 6f78 793c 2f74 643e f the proxy │ │ │ -00072e70: 3c2f 7472 3e3c 7472 2069 643d 2232 3632

    we coul │ │ │ -00072ec0: 6420 6269 6e64 2074 6865 2073 6f63 6b65 d bind the socke │ │ │ -00072ed0: 7420 6865 7265 2c20 7369 6e63 6520 7765 t here, since we │ │ │ -00072ee0: 206b 6e6f 7720 7768 6174 2074 6865 0a74 know what the.t │ │ │ -00072ef0: 6172 6765 7420 656e 6470 6f69 6e74 2069 arget endpoint i │ │ │ -00072f00: 7320 6f66 2074 6865 2070 726f 7879 3c2f s of the proxy

    ../includ │ │ │ -00072f20: 652f 6c69 6274 6f72 7265 6e74 2f73 6f63 e/libtorrent/soc │ │ │ -00072f30: 6b73 355f 7374 7265 616d 2e68 7070 3a31 ks5_stream.hpp:1 │ │ │ -00072f40: 3939 3c2f 6834 3e3c 7072 6520 7374 796c 99

    ...}, std::move
    │ │ │ -00072f90: 2868 616e 646c 6572 2929 293b 0a09 7d0a  (handler)));..}.
    │ │ │ -00072fa0: 0a70 7269 7661 7465 3a0a 0a09 7465 6d70  .private:...temp
    │ │ │ -00072fb0: 6c61 7465 2026 6c74 3b74 7970 656e 616d  late <typenam
    │ │ │ -00072fc0: 6520 4861 6e64 6c65 7226 6774 3b0a 0976  e Handler>..v
    │ │ │ -00072fd0: 6f69 6420 6e61 6d65 5f6c 6f6f 6b75 7028  oid name_lookup(
    │ │ │ -00072fe0: 6572 726f 725f 636f 6465 2063 6f6e 7374  error_code const
    │ │ │ -00072ff0: 2661 6d70 3b20 652c 2074 6370 3a3a 7265  & e, tcp::re
    │ │ │ -00073000: 736f 6c76 6572 3a3a 7265 7375 6c74 735f  solver::results_
    │ │ │ -00073010: 7479 7065 2069 7073 0a09 092c 2048 616e  type ips..., Han
    │ │ │ -00073020: 646c 6572 2068 290a 097b 0a09 0943 4f4d  dler h)..{...COM
    │ │ │ -00073030: 504c 4554 455f 4153 594e 4328 2273 6f63  PLETE_ASYNC("soc
    │ │ │ -00073040: 6b73 355f 7374 7265 616d 3a3a 6e61 6d65  ks5_stream::name
    │ │ │ -00073050: 5f6c 6f6f 6b75 7022 293b 0a09 0969 6620  _lookup");...if 
    │ │ │ -00073060: 2868 616e 646c 655f 6572 726f 7228 652c  (handle_error(e,
    │ │ │ -00073070: 2073 7464 3a3a 6d6f 7665 2868 2929 2920   std::move(h))) 
    │ │ │ -00073080: 7265 7475 726e 3b0a 0a09 0961 7574 6f20  return;....auto 
    │ │ │ -00073090: 6920 3d20 6970 732e 6265 6769 6e28 293b  i = ips.begin();
    │ │ │ -000730a0: 0a09 0969 6620 2821 6d5f 736f 636b 2e69  ...if (!m_sock.i
    │ │ │ -000730b0: 735f 6f70 656e 2829 290a 0909 7b0a 0909  s_open())...{...
    │ │ │ -000730c0: 0965 7272 6f72 5f63 6f64 6520 6563 3b0a  .error_code ec;.
    │ │ │ -000730d0: 0909 096d 5f73 6f63 6b2e 6f70 656e 2869  ...m_sock.open(i
    │ │ │ -000730e0: 2d26 6774 3b65 6e64 706f 696e 7428 292e  ->endpoint().
    │ │ │ -000730f0: 7072 6f74 6f63 6f6c 2829 2c20 6563 293b  protocol(), ec);
    │ │ │ -00073100: 0a09 0909 6966 2028 6861 6e64 6c65 5f65  ....if (handle_e
    │ │ │ -00073110: 7272 6f72 2865 632c 2073 7464 3a3a 6d6f  rror(ec, std::mo
    │ │ │ -00073120: 7665 2868 2929 2920 7265 7475 726e 3b0a  ve(h))) return;.
    │ │ │ -00073130: 0909 7d0a 0a3c 6469 7620 7374 796c 653d  ..}..
    ..ADD_OUTSTAN │ │ │ -00073170: 4449 4e47 5f41 5359 4e43 2822 736f 636b DING_ASYNC("sock │ │ │ -00073180: 7335 5f73 7472 6561 6d3a 3a63 6f6e 6e65 s5_stream::conne │ │ │ -00073190: 6374 6564 2229 3b0a 3c2f 6469 763e 0909 cted");.
    .. │ │ │ -000731a0: 6d5f 736f 636b 2e61 7379 6e63 5f63 6f6e m_sock.async_con │ │ │ -000731b0: 6e65 6374 2869 2d26 6774 3b65 6e64 706f nect(i->endpo │ │ │ -000731c0: 696e 7428 292c 2077 7261 705f 616c 6c6f int(), wrap_allo │ │ │ -000731d0: 6361 746f 7228 0a09 0909 5b74 6869 735d cator(....[this] │ │ │ -000731e0: 2865 7272 6f72 5f63 6f64 6520 636f 6e73 (error_code cons │ │ │ -000731f0: 7426 616d 703b 2065 632c 2048 616e 646c t& ec, Handl │ │ │ -00073200: 6572 2068 6e29 0a09 0909 7b20 636f 6e6e er hn)....{ conn │ │ │ -00073210: 6563 7465 6428 6563 2c20 7374 643a 3a6d ected(ec, std::m │ │ │ -00073220: 6f76 6528 686e 2929 3b20 7d2c 2073 7464 ove(hn)); }, std │ │ │ -00073230: 3a3a 6d6f 7665 2868 2929 293b 0a09 7d0a ::move(h)));..}. │ │ │ -00073240: 0a09 7465 6d70 6c61 7465 2026 6c74 3b74 ..template <t │ │ │ -00073250: 7970 656e 616d 6520 4861 6e64 6c65 7226 ypename Handler& │ │ │ -00073260: 6774 3b0a 0976 6f69 6420 636f 6e6e 6563 gt;..void connec │ │ │ -00073270: 7465 6428 6572 726f 725f 636f 6465 2063 ted(error_code c │ │ │ -00073280: 6f6e 7374 2661 6d70 3b20 652c 2048 616e onst& e, Han │ │ │ -00073290: 646c 6572 2068 290a 097b 0a09 0943 4f4d dler h)..{...COM │ │ │ -000732a0: 504c 4554 455f 4153 594e 4328 2273 6f63 PLETE_ASYNC("soc │ │ │ -000732b0: 6b73 355f 7374 7265 616d 3a3a 636f 6e6e ks5_stream::conn │ │ │ -000732c0: 6563 7465 6422 293b 0a09 0969 6620 2868 ected");...if (h │ │ │ -000732d0: 616e 646c 655f 6572 726f 7228 652c 2073 andle_error(e, s │ │ │ -000732e0: 7464 3a3a 6d6f 7665 2868 2929 2920 7265 td::move(h))) re │ │ │ -000732f0: 7475 726e 3b0a 0a09 0975 7369 6e67 206e turn;....using n │ │ │ -00073300: 616d 6573 7061 6365 206c 6962 746f 7272 amespace libtorr │ │ │ -00073310: 656e 743a 3a61 7578 3b0a 0909 6966 2028 ent::aux;...if ( │ │ │ -00073320: 6d5f 7665 7273 696f 6e20 3d3d 2035 290a m_version == 5). │ │ │ -00073330: 0909 7b0a 0909 092f 2f20 7365 6e64 2053 ..{....// send S │ │ │ -00073340: 4f43 4b53 3520 6175 7468 656e 7469 6361 OCKS5 authentica │ │ │ -00073350: 7469 6f6e 206d 6574 686f 6473 0a09 0909 tion methods.... │ │ │ -00073360: 6d5f 6275 6666 6572 2e72 6573 697a 6528 m_buffer.resize( │ │ │ -00073370: 6d5f 7573 6572 2e65 6d70 7479 2829 3f33 m_user.empty()?3 │ │ │ -00073380: 3a34 293b 0a09 0909 6368 6172 2a20 7020 :4);....char* p │ │ │ -00073390: 3d20 2661 6d70 3b6d 5f62 7566 6665 725b = &m_buffer[ │ │ │ -000733a0: 305d 3b0a 0909 0977 7269 7465 5f75 696e 0];....write_uin │ │ │ -000733b0: 7438 2835 2c20 7029 3b20 2f2f 2053 4f43 t8(5, p); // SOC │ │ │ -000733c0: 4b53 2056 4552 5349 4f4e 2035 0a09 0909 KS VERSION 5.... │ │ │ -000733d0: 6966 2028 6d5f 7573 6572 2e65 6d70 7479 if (m_user.empty │ │ │ -000733e0: 2829 290a 0909 097b 0a09 0909 0977 7269 ())....{.....wri │ │ │ -000733f0: 7465 5f75 696e 7438 2831 2c20 7029 3b20 te_uint8(1, p); │ │ │ -00073400: 2f2f 2031 2061 7574 6865 6e74 6963 6174 // 1 authenticat │ │ │ -00073410: 696f 6e20 6d65 7468 6f64 2028 6e6f 2061 ion method (no a │ │ │ -00073420: 7574 6829 0a09 0909 0977 7269 7465 5f75 uth).....write_u │ │ │ -00073430: 696e 7438 2830 2c20 7029 3b20 2f2f 206e int8(0, p); // n │ │ │ -00073440: 6f20 6175 7468 656e 7469 6361 7469 6f6e o authentication │ │ │ -00073450: 0a09 0909 7d0a 0909 0965 6c73 650a 0909 ....}....else... │ │ │ -00073460: 097b 0a09 0909 0977 7269 7465 5f75 696e .{.....write_uin │ │ │ -00073470: 7438 2832 2c20 7029 3b20 2f2f 2032 2061 t8(2, p); // 2 a │ │ │ -00073480: 7574 6865 6e74 6963 6174 696f 6e20 6d65 uthentication me │ │ │ -00073490: 7468 6f64 730a 0909 0909 7772 6974 655f thods.....write_ │ │ │ -000734a0: 7569 6e74 3828 302c 2070 293b 202f 2f20 uint8(0, p); // │ │ │ -000734b0: 6e6f 2061 7574 6865 6e74 6963 6174 696f no authenticatio │ │ │ -000734c0: 6e0a 0909 0909 7772 6974 655f 7569 6e74 n.....write_uint │ │ │ -000734d0: 3828 322c 2070 293b 202f 2f20 7573 6572 8(2, p); // user │ │ │ -000734e0: 6e61 6d65 2f70 6173 7377 6f72 640a 0909 name/password... │ │ │ -000734f0: 097d 0a09 0909 4144 445f 4f55 5453 5441 .}....ADD_OUTSTA │ │ │ -00073500: 4e44 494e 475f 4153 594e 4328 2273 6f63 NDING_ASYNC("soc │ │ │ -00073510: 6b73 355f 7374 7265 616d 3a3a 6861 6e64 ks5_stream::hand │ │ │ -00073520: 7368 616b 6531 2229 3b0a 3c2f 7072 653e shake1");.
    │ │ │ -00073530: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ -00073560: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ -00073570: 3c74 643e 3c61 2068 7265 663d 226a 6176 ../include/ │ │ │ -000735a0: 6c69 6274 6f72 7265 6e74 2f74 6f72 7265 libtorrent/torre │ │ │ -000735b0: 6e74 2e68 7070 3a32 3831 3c2f 613e 3c2f nt.hpp:281make this │ │ │ -000735d0: 2061 2072 6177 2070 6f69 6e74 6572 2e20 a raw pointer. │ │ │ -000735e0: 7065 7268 6170 7320 6b65 6570 2074 6865 perhaps keep the │ │ │ -000735f0: 2073 6861 7265 645f 7074 7220 6172 6f75 shared_ptr arou │ │ │ -00073600: 6e64 2066 7572 7468 6572 2064 6f77 6e20 nd further down │ │ │ -00073610: 7468 6520 6f62 6a65 6374 2074 6f20 6d61 the object to ma │ │ │ -00073620: 696e 7461 696e 2061 6e20 6f77 6e65 723c intain an owner< │ │ │ -00073630: 2f74 643e 3c2f 7472 3e3c 7472 2069 643d /td>

    mak │ │ │ -00073680: 6520 7468 6973 2061 2072 6177 2070 6f69 e this a raw poi │ │ │ -00073690: 6e74 6572 2e20 7065 7268 6170 7320 6b65 nter. perhaps ke │ │ │ -000736a0: 6570 2074 6865 2073 6861 7265 645f 7074 ep the shared_pt │ │ │ -000736b0: 720a 6172 6f75 6e64 2066 7572 7468 6572 r.around further │ │ │ -000736c0: 2064 6f77 6e20 7468 6520 6f62 6a65 6374 down the object │ │ │ -000736d0: 2074 6f20 6d61 696e 7461 696e 2061 6e20 to maintain an │ │ │ -000736e0: 6f77 6e65 723c 2f68 323e 3c68 343e 2e2e owner

    .. │ │ │ -000736f0: 2f69 6e63 6c75 6465 2f6c 6962 746f 7272 /include/libtorr │ │ │ -00073700: 656e 742f 746f 7272 656e 742e 6870 703a ent/torrent.hpp: │ │ │ -00073710: 3238 313c 2f68 343e 3c70 7265 2073 7479 281

    #endif..};...s
    │ │ │ -00073760: 7472 7563 7420 544f 5252 454e 545f 4558  truct TORRENT_EX
    │ │ │ -00073770: 5452 415f 4558 504f 5254 2074 6f72 7265  TRA_EXPORT torre
    │ │ │ -00073780: 6e74 5f68 6f74 5f6d 656d 6265 7273 0a09  nt_hot_members..
    │ │ │ -00073790: 7b0a 0909 746f 7272 656e 745f 686f 745f  {...torrent_hot_
    │ │ │ -000737a0: 6d65 6d62 6572 7328 6175 783a 3a73 6573  members(aux::ses
    │ │ │ -000737b0: 7369 6f6e 5f69 6e74 6572 6661 6365 2661  sion_interface&a
    │ │ │ -000737c0: 6d70 3b20 7365 730a 0909 092c 2061 6464  mp; ses...., add
    │ │ │ -000737d0: 5f74 6f72 7265 6e74 5f70 6172 616d 7320  _torrent_params 
    │ │ │ -000737e0: 636f 6e73 7426 616d 703b 2070 2c20 626f  const& p, bo
    │ │ │ -000737f0: 6f6c 2073 6573 7369 6f6e 5f70 6175 7365  ol session_pause
    │ │ │ -00073800: 6429 3b0a 0a09 7072 6f74 6563 7465 643a  d);...protected:
    │ │ │ -00073810: 0a09 092f 2f20 7468 6520 7069 6563 6520  ...// the piece 
    │ │ │ -00073820: 7069 636b 6572 2e20 5468 6973 2069 7320  picker. This is 
    │ │ │ -00073830: 616c 6c6f 6361 7465 6420 6c61 7a69 6c79  allocated lazily
    │ │ │ -00073840: 2e20 5768 656e 2077 6520 646f 6e27 740a  . When we don't.
    │ │ │ -00073850: 0909 2f2f 2068 6176 6520 616e 7974 6869  ..// have anythi
    │ │ │ -00073860: 6e67 2069 6e20 7468 6520 746f 7272 656e  ng in the torren
    │ │ │ -00073870: 7420 2866 6f72 2069 6e73 7461 6e63 652c  t (for instance,
    │ │ │ -00073880: 2069 6620 6974 2068 6173 6e27 740a 0909   if it hasn't...
    │ │ │ -00073890: 2f2f 2062 6565 6e20 7374 6172 7465 6420  // been started 
    │ │ │ -000738a0: 7965 7429 206f 7220 6966 2077 6520 6861  yet) or if we ha
    │ │ │ -000738b0: 7665 2065 7665 7279 7468 696e 672c 2074  ve everything, t
    │ │ │ -000738c0: 6865 7265 2069 7320 6e6f 0a09 092f 2f20  here is no...// 
    │ │ │ -000738d0: 7069 636b 6572 2e20 4974 2773 2061 6c6c  picker. It's all
    │ │ │ -000738e0: 6f63 6174 6564 206f 6e2d 6465 6d61 6e64  ocated on-demand
    │ │ │ -000738f0: 2074 6865 2066 6972 7374 2074 696d 6520   the first time 
    │ │ │ -00073900: 7765 206e 6565 640a 0909 2f2f 2069 7420  we need...// it 
    │ │ │ -00073910: 696e 2074 6f72 7265 6e74 3a3a 6e65 6564  in torrent::need
    │ │ │ -00073920: 5f70 6963 6b65 7228 292e 2049 6e20 6f72  _picker(). In or
    │ │ │ -00073930: 6465 7220 746f 2074 656c 6c20 7468 650a  der to tell the.
    │ │ │ -00073940: 0909 2f2f 2064 6966 6665 7265 6e63 6520  ..// difference 
    │ │ │ -00073950: 6265 7477 6565 6e20 6861 7669 6e67 2065  between having e
    │ │ │ -00073960: 7665 7279 7468 696e 6720 616e 6420 6e6f  verything and no
    │ │ │ -00073970: 7468 696e 6720 696e 0a09 092f 2f20 7468  thing in...// th
    │ │ │ -00073980: 6520 6361 7365 2074 6865 7265 2069 7320  e case there is 
    │ │ │ -00073990: 6e6f 2070 6965 6365 2070 6963 6b65 722c  no piece picker,
    │ │ │ -000739a0: 2073 6565 206d 5f68 6176 655f 616c 6c2e   see m_have_all.
    │ │ │ -000739b0: 0a09 0973 7464 3a3a 756e 6971 7565 5f70  ...std::unique_p
    │ │ │ -000739c0: 7472 266c 743b 7069 6563 655f 7069 636b  tr<piece_pick
    │ │ │ -000739d0: 6572 2667 743b 206d 5f70 6963 6b65 723b  er> m_picker;
    │ │ │ -000739e0: 0a0a 0909 7374 643a 3a75 6e69 7175 655f  ....std::unique_
    │ │ │ -000739f0: 7074 7226 6c74 3b68 6173 685f 7069 636b  ptr<hash_pick
    │ │ │ -00073a00: 6572 2667 743b 206d 5f68 6173 685f 7069  er> m_hash_pi
    │ │ │ -00073a10: 636b 6572 3b0a 0a3c 6469 7620 7374 796c  cker;..
    ..std::shar │ │ │ -00073a50: 6564 5f70 7472 266c 743b 746f 7272 656e ed_ptr<torren │ │ │ -00073a60: 745f 696e 666f 2667 743b 206d 5f74 6f72 t_info> m_tor │ │ │ -00073a70: 7265 6e74 5f66 696c 653b 0a3c 2f64 6976 rent_file;.
    ...// This is t │ │ │ -00073a90: 6865 2073 756d 206f 6620 616c 6c20 6e6f he sum of all no │ │ │ -00073aa0: 6e2d 7061 6420 6669 6c65 2073 697a 6573 n-pad file sizes │ │ │ -00073ab0: 2e20 496e 2074 6865 206e 6578 7420 6d61 . In the next ma │ │ │ -00073ac0: 6a6f 7220 7665 7273 696f 6e0a 0909 2f2f jor version...// │ │ │ -00073ad0: 2074 6869 7320 6973 2073 746f 7265 6420 this is stored │ │ │ -00073ae0: 696e 2066 696c 655f 7374 6f72 6167 6520 in file_storage │ │ │ -00073af0: 616e 6420 6e6f 206c 6f6e 6765 7220 6e65 and no longer ne │ │ │ -00073b00: 6564 2074 6f20 6265 206b 6570 7420 6865 ed to be kept he │ │ │ -00073b10: 7265 2e0a 0909 7374 643a 3a69 6e74 3634 re....std::int64 │ │ │ -00073b20: 5f74 206d 5f73 697a 655f 6f6e 5f64 6973 _t m_size_on_dis │ │ │ -00073b30: 6b20 3d20 303b 0a0a 0909 2f2f 2061 2062 k = 0;....// a b │ │ │ -00073b40: 6163 6b20 7265 6665 7265 6e63 6520 746f ack reference to │ │ │ -00073b50: 2074 6865 2073 6573 7369 6f6e 0a09 092f the session.../ │ │ │ -00073b60: 2f20 7468 6973 2074 6f72 7265 6e74 2062 / this torrent b │ │ │ -00073b70: 656c 6f6e 6773 2074 6f2e 0a09 0961 7578 elongs to....aux │ │ │ -00073b80: 3a3a 7365 7373 696f 6e5f 696e 7465 7266 ::session_interf │ │ │ -00073b90: 6163 6526 616d 703b 206d 5f73 6573 3b0a ace& m_ses;. │ │ │ -00073ba0: 0a09 092f 2f20 7468 6973 2076 6563 746f ...// this vecto │ │ │ -00073bb0: 7220 6973 2073 6f72 7465 6420 6174 2061 r is sorted at a │ │ │ -00073bc0: 6c6c 2074 696d 6573 2c20 6279 2074 6865 ll times, by the │ │ │ -00073bd0: 2070 6f69 6e74 6572 2076 616c 7565 2e0a pointer value.. │ │ │ -00073be0: 0909 2f2f 2075 7365 2073 6f72 7465 645f ..// use sorted_ │ │ │ -00073bf0: 696e 7365 7274 2829 2061 6e64 2073 6f72 insert() and sor │ │ │ -00073c00: 7465 645f 6669 6e64 2829 206f 6e20 6974 ted_find() on it │ │ │ -00073c10: 2e20 5468 6520 474e 5520 5354 4c0a 0909 . The GNU STL... │ │ │ -00073c20: 2f2f 2069 6d70 6c65 6d65 6e74 6174 696f // implementatio │ │ │ -00073c30: 6e20 6f6e 2044 6172 7769 6e20 7573 6573 n on Darwin uses │ │ │ -00073c40: 2073 6967 6e69 6669 6361 6e74 6c79 206c significantly l │ │ │ -00073c50: 6573 7320 6d65 6d6f 7279 2074 6f0a 0909 ess memory to... │ │ │ -00073c60: 2f2f 2072 6570 7265 7365 6e74 2061 2076 // represent a v │ │ │ -00073c70: 6563 746f 7220 7468 616e 2061 2073 6574 ector than a set │ │ │ -00073c80: 2c20 616e 6420 7468 6973 2073 6574 2069 , and this set i │ │ │ -00073c90: 7320 7479 7069 6361 6c6c 790a 0909 2f2f s typically...// │ │ │ -00073ca0: 2072 656c 6174 6976 656c 7920 736d 616c relatively smal │ │ │ -00073cb0: 6c2c 2061 6e64 2069 7427 7320 6368 6561 l, and it's chea │ │ │ -00073cc0: 7020 746f 2063 6f70 7920 706f 696e 7465 p to copy pointe │ │ │ -00073cd0: 7273 2e0a 0909 6175 783a 3a76 6563 746f rs....aux::vecto │ │ │ -00073ce0: 7226 6c74 3b70 6565 725f 636f 6e6e 6563 r<peer_connec │ │ │ -00073cf0: 7469 6f6e 2a26 6774 3b20 6d5f 636f 6e6e tion*> m_conn │ │ │ -00073d00: 6563 7469 6f6e 733b 0a0a 0909 2f2f 2074 ections;....// t │ │ │ -00073d10: 6865 2073 6372 6170 6520 6461 7461 2066 he scrape data f │ │ │ -00073d20: 726f 6d20 7468 6520 7472 6163 6b65 7220 rom the tracker │ │ │ -00073d30: 7265 7370 6f6e 7365 2c20 7468 6973 0a09 response, this.. │ │ │ -00073d40: 092f 2f20 6973 206f 7074 696f 6e61 6c20 .// is optional │ │ │ -00073d50: 616e 6420 6d61 7920 6265 2030 7866 6666 and may be 0xfff │ │ │ -00073d60: 6666 660a 0909 7374 643a 3a75 696e 7433 fff...std::uint3 │ │ │ -00073d70: 325f 7420 6d5f 636f 6d70 6c65 7465 3a32 2_t m_complete:2 │ │ │ -00073d80: 343b 0a0a 0909 2f2f 2073 6574 2074 6f20 4;....// set to │ │ │ -00073d90: 7472 7565 2077 6865 6e20 7468 6973 2074 true when this t │ │ │ -00073da0: 6f72 7265 6e74 206d 6179 206e 6f74 2064 orrent may not d │ │ │ -00073db0: 6f77 6e6c 6f61 6420 616e 7974 6869 6e67 ownload anything │ │ │ -00073dc0: 0a09 0962 6f6f 6c20 6d5f 7570 6c6f 6164 ...bool m_upload │ │ │ -00073dd0: 5f6d 6f64 653a 313b 0a0a 0909 2f2f 2074 _mode:1;....// t │ │ │ -00073de0: 6869 7320 6973 2073 6574 2074 6f20 6661 his is set to fa │ │ │ -00073df0: 6c73 6520 6173 206c 6f6e 6720 6173 2074 lse as long as t │ │ │ -00073e00: 6865 2063 6f6e 6e65 6374 696f 6e73 0a09 he connections.. │ │ │ -00073e10: 092f 2f20 6f66 2074 6869 7320 746f 7272 .// of this torr │ │ │ -00073e20: 656e 7420 6861 7665 6e27 7420 6265 656e ent haven't been │ │ │ -00073e30: 2069 6e69 7469 616c 697a 6564 2e20 4966 initialized. If │ │ │ -00073e40: 2077 650a 0909 2f2f 2068 6176 6520 6d65 we...// have me │ │ │ -00073e50: 7461 6461 7461 2066 726f 6d20 7468 6520 tadata from the │ │ │ -00073e60: 7374 6172 742c 2063 6f6e 6e65 6374 696f start, connectio │ │ │ -00073e70: 6e73 2061 7265 0a09 092f 2f20 696e 6974 ns are...// init │ │ │ -00073e80: 6961 6c69 7a65 6420 696d 6d65 6469 6174 ialized immediat │ │ │ -00073e90: 656c 792c 2069 6620 7765 2064 6964 6e27 ely, if we didn' │ │ │ -00073ea0: 7420 6861 7665 206d 6574 6164 6174 612c t have metadata, │ │ │ -00073eb0: 0a09 092f 2f20 7468 6579 2061 7265 2069 ...// they are i │ │ │ -00073ec0: 6e69 7469 616c 697a 6564 2072 6967 6874 nitialized right │ │ │ -00073ed0: 2061 6674 6572 2066 696c 6573 5f63 6865 after files_che │ │ │ -00073ee0: 636b 6564 2829 2e0a 0909 2f2f 2076 616c cked()....// val │ │ │ -00073ef0: 6964 5f72 6573 756d 655f 6461 7461 2829 id_resume_data() │ │ │ -00073f00: 2077 696c 6c20 7265 7475 726e 2066 616c will return fal │ │ │ -00073f10: 7365 2061 7320 6c6f 6e67 2061 730a 0909 se as long as... │ │ │ -00073f20: 2f2f 2074 6865 2063 6f6e 6e65 6374 696f // the connectio │ │ │ -00073f30: 6e73 2061 7265 6e27 7420 696e 6974 6961 ns aren't initia │ │ │ -00073f40: 6c69 7a65 642c 2074 6f20 6176 6f69 640a lized, to avoid. │ │ │ -00073f50: 3c2f 7072 653e 3c2f 7464 3e3c 2f74 723e
    │ │ │ -00073f60: 3c74 7220 7374 796c 653d 2262 6163 6b67 relevance  │ │ │ -00073f90: 303c 2f74 643e 3c74 643e 3c61 2068 7265 0../in │ │ │ -00073fc0: 636c 7564 652f 6c69 6274 6f72 7265 6e74 clude/libtorrent │ │ │ -00073fd0: 2f74 6f72 7265 6e74 2e68 7070 3a34 3634 /torrent.hpp:464 │ │ │ -00073fe0: 3c2f 613e 3c2f 7464 3e3c 7464 3e6d 616b mak │ │ │ -00073ff0: 6520 6772 6163 6566 756c 2070 6175 7365 e graceful pause │ │ │ -00074000: 2061 6c73 6f20 6669 6e69 7368 2061 6c6c also finish all │ │ │ -00074010: 2073 656e 6469 6e67 2062 6c6f 636b 7320 sending blocks │ │ │ -00074020: 6265 666f 7265 2064 6973 636f 6e6e 6563 before disconnec │ │ │ -00074030: 7469 6e67 3c2f 7464 3e3c 2f74 723e 3c74 tingmake graceful │ │ │ -00074090: 7061 7573 6520 616c 736f 2066 696e 6973 pause also finis │ │ │ -000740a0: 6820 616c 6c20 7365 6e64 696e 6720 626c h all sending bl │ │ │ -000740b0: 6f63 6b73 0a62 6566 6f72 6520 6469 7363 ocks.before disc │ │ │ -000740c0: 6f6e 6e65 6374 696e 673c 2f68 323e 3c68 onnecting../include/lib │ │ │ -000740e0: 746f 7272 656e 742f 746f 7272 656e 742e torrent/torrent. │ │ │ -000740f0: 6870 703a 3436 343c 2f68 343e 3c70 7265 hpp:464
    ...void on
    │ │ │ -00074140: 5f72 6573 756d 655f 6461 7461 5f63 6865  _resume_data_che
    │ │ │ -00074150: 636b 6564 2873 7461 7475 735f 7420 7374  cked(status_t st
    │ │ │ -00074160: 6174 7573 2c20 7374 6f72 6167 655f 6572  atus, storage_er
    │ │ │ -00074170: 726f 7220 636f 6e73 7426 616d 703b 2065  ror const& e
    │ │ │ -00074180: 7272 6f72 293b 0a09 0976 6f69 6420 6f6e  rror);...void on
    │ │ │ -00074190: 5f66 6f72 6365 5f72 6563 6865 636b 2873  _force_recheck(s
    │ │ │ -000741a0: 7461 7475 735f 7420 7374 6174 7573 2c20  tatus_t status, 
    │ │ │ -000741b0: 7374 6f72 6167 655f 6572 726f 7220 636f  storage_error co
    │ │ │ -000741c0: 6e73 7426 616d 703b 2065 7272 6f72 293b  nst& error);
    │ │ │ -000741d0: 0a09 0976 6f69 6420 6f6e 5f70 6965 6365  ...void on_piece
    │ │ │ -000741e0: 5f68 6173 6865 6428 6175 783a 3a76 6563  _hashed(aux::vec
    │ │ │ -000741f0: 746f 7226 6c74 3b73 6861 3235 365f 6861  tor<sha256_ha
    │ │ │ -00074200: 7368 2667 743b 2062 6c6f 636b 5f68 6173  sh> block_has
    │ │ │ -00074210: 6865 730a 0909 092c 2070 6965 6365 5f69  hes...., piece_i
    │ │ │ -00074220: 6e64 6578 5f74 2070 6965 6365 2c20 7368  ndex_t piece, sh
    │ │ │ -00074230: 6131 5f68 6173 6820 636f 6e73 7426 616d  a1_hash const&am
    │ │ │ -00074240: 703b 2070 6965 6365 5f68 6173 680a 0909  p; piece_hash...
    │ │ │ -00074250: 092c 2073 746f 7261 6765 5f65 7272 6f72  ., storage_error
    │ │ │ -00074260: 2063 6f6e 7374 2661 6d70 3b20 6572 726f   const& erro
    │ │ │ -00074270: 7229 3b0a 0909 766f 6964 2066 696c 6573  r);...void files
    │ │ │ -00074280: 5f63 6865 636b 6564 2829 3b0a 0909 766f  _checked();...vo
    │ │ │ -00074290: 6964 2073 7461 7274 5f63 6865 636b 696e  id start_checkin
    │ │ │ -000742a0: 6728 293b 0a0a 0909 766f 6964 2073 7461  g();....void sta
    │ │ │ -000742b0: 7274 5f61 6e6e 6f75 6e63 696e 6728 293b  rt_announcing();
    │ │ │ -000742c0: 0a09 0976 6f69 6420 7374 6f70 5f61 6e6e  ...void stop_ann
    │ │ │ -000742d0: 6f75 6e63 696e 6728 293b 0a0a 0909 766f  ouncing();....vo
    │ │ │ -000742e0: 6964 2073 656e 645f 7570 6c6f 6164 5f6f  id send_upload_o
    │ │ │ -000742f0: 6e6c 7928 293b 0a0a 2369 666e 6465 6620  nly();..#ifndef 
    │ │ │ -00074300: 544f 5252 454e 545f 4449 5341 424c 455f  TORRENT_DISABLE_
    │ │ │ -00074310: 5348 4152 455f 4d4f 4445 0a09 0976 6f69  SHARE_MODE...voi
    │ │ │ -00074320: 6420 7365 6e64 5f73 6861 7265 5f6d 6f64  d send_share_mod
    │ │ │ -00074330: 6528 293b 0a09 0976 6f69 6420 7365 745f  e();...void set_
    │ │ │ -00074340: 7368 6172 655f 6d6f 6465 2862 6f6f 6c20  share_mode(bool 
    │ │ │ -00074350: 7329 3b0a 0909 626f 6f6c 2073 6861 7265  s);...bool share
    │ │ │ -00074360: 5f6d 6f64 6528 2920 636f 6e73 7420 7b20  _mode() const { 
    │ │ │ -00074370: 7265 7475 726e 206d 5f73 6861 7265 5f6d  return m_share_m
    │ │ │ -00074380: 6f64 653b 207d 0a23 656e 6469 660a 0a3c  ode; }.#endif..<
    │ │ │ -00074390: 6469 7620 7374 796c 653d 2262 6163 6b67  div style="backg
    │ │ │ -000743a0: 726f 756e 643a 2023 6666 6666 3030 2220  round: #ffff00" 
    │ │ │ -000743b0: 7769 6474 683d 2231 3030 2522 3e09 0962  width="100%">..b
    │ │ │ -000743c0: 6f6f 6c20 6772 6163 6566 756c 5f70 6175  ool graceful_pau
    │ │ │ -000743d0: 7365 2829 2063 6f6e 7374 207b 2072 6574  se() const { ret
    │ │ │ -000743e0: 7572 6e20 6d5f 6772 6163 6566 756c 5f70  urn m_graceful_p
    │ │ │ -000743f0: 6175 7365 5f6d 6f64 653b 207d 0a3c 2f64  ause_mode; }....torrent_fl
    │ │ │ -00074410: 6167 735f 7420 666c 6167 7328 2920 636f  ags_t flags() co
    │ │ │ -00074420: 6e73 743b 0a09 0976 6f69 6420 7365 745f  nst;...void set_
    │ │ │ -00074430: 666c 6167 7328 746f 7272 656e 745f 666c  flags(torrent_fl
    │ │ │ -00074440: 6167 735f 7420 666c 6167 732c 2074 6f72  ags_t flags, tor
    │ │ │ -00074450: 7265 6e74 5f66 6c61 6773 5f74 206d 6173  rent_flags_t mas
    │ │ │ -00074460: 6b29 3b0a 0a09 0976 6f69 6420 7365 745f  k);....void set_
    │ │ │ -00074470: 7570 6c6f 6164 5f6d 6f64 6528 626f 6f6c  upload_mode(bool
    │ │ │ -00074480: 2062 293b 0a09 0962 6f6f 6c20 7570 6c6f   b);...bool uplo
    │ │ │ -00074490: 6164 5f6d 6f64 6528 2920 636f 6e73 7420  ad_mode() const 
    │ │ │ -000744a0: 7b20 7265 7475 726e 206d 5f75 706c 6f61  { return m_uploa
    │ │ │ -000744b0: 645f 6d6f 6465 207c 7c20 6d5f 6772 6163  d_mode || m_grac
    │ │ │ -000744c0: 6566 756c 5f70 6175 7365 5f6d 6f64 653b  eful_pause_mode;
    │ │ │ -000744d0: 207d 0a09 0962 6f6f 6c20 6973 5f75 706c   }...bool is_upl
    │ │ │ -000744e0: 6f61 645f 6f6e 6c79 2829 2063 6f6e 7374  oad_only() const
    │ │ │ -000744f0: 207b 2072 6574 7572 6e20 6973 5f66 696e   { return is_fin
    │ │ │ -00074500: 6973 6865 6428 2920 7c7c 2075 706c 6f61  ished() || uploa
    │ │ │ -00074510: 645f 6d6f 6465 2829 3b20 7d0a 0a09 0969  d_mode(); }....i
    │ │ │ -00074520: 6e74 2073 6565 645f 7261 6e6b 2861 7578  nt seed_rank(aux
    │ │ │ -00074530: 3a3a 7365 7373 696f 6e5f 7365 7474 696e  ::session_settin
    │ │ │ -00074540: 6773 2063 6f6e 7374 2661 6d70 3b20 7329  gs const& s)
    │ │ │ -00074550: 2063 6f6e 7374 3b0a 0a09 0976 6f69 6420   const;....void 
    │ │ │ -00074560: 6164 645f 7069 6563 6528 7069 6563 655f  add_piece(piece_
    │ │ │ -00074570: 696e 6465 785f 7420 7069 6563 652c 2063  index_t piece, c
    │ │ │ -00074580: 6861 7220 636f 6e73 742a 2064 6174 612c  har const* data,
    │ │ │ -00074590: 2061 6464 5f70 6965 6365 5f66 6c61 6773   add_piece_flags
    │ │ │ -000745a0: 5f74 2066 6c61 6773 293b 0a09 0976 6f69  _t flags);...voi
    │ │ │ -000745b0: 6420 6164 645f 7069 6563 655f 6173 796e  d add_piece_asyn
    │ │ │ -000745c0: 6328 7069 6563 655f 696e 6465 785f 7420  c(piece_index_t 
    │ │ │ -000745d0: 7069 6563 652c 2073 7464 3a3a 7665 6374  piece, std::vect
    │ │ │ -000745e0: 6f72 266c 743b 6368 6172 2667 743b 2064  or<char> d
    │ │ │ -000745f0: 6174 612c 2061 6464 5f70 6965 6365 5f66  ata, add_piece_f
    │ │ │ -00074600: 6c61 6773 5f74 2066 6c61 6773 293b 0a09  lags_t flags);..
    │ │ │ -00074610: 0976 6f69 6420 6f6e 5f64 6973 6b5f 7772  .void on_disk_wr
    │ │ │ -00074620: 6974 655f 636f 6d70 6c65 7465 2873 746f  ite_complete(sto
    │ │ │ -00074630: 7261 6765 5f65 7272 6f72 2063 6f6e 7374  rage_error const
    │ │ │ -00074640: 2661 6d70 3b20 6572 726f 720a 0909 092c  & error....,
    │ │ │ -00074650: 2070 6565 725f 7265 7175 6573 7420 636f   peer_request co
    │ │ │ -00074660: 6e73 7426 616d 703b 2070 293b 0a0a 0909  nst& p);....
    │ │ │ -00074670: 766f 6964 2073 6574 5f70 726f 6772 6573  void set_progres
    │ │ │ -00074680: 735f 7070 6d28 696e 7420 7029 207b 206d  s_ppm(int p) { m
    │ │ │ -00074690: 5f70 726f 6772 6573 735f 7070 6d20 3d20  _progress_ppm = 
    │ │ │ -000746a0: 7374 643a 3a75 696e 7433 325f 7428 7029  std::uint32_t(p)
    │ │ │ -000746b0: 3b20 7d0a 0909 7374 7275 6374 2072 6561  ; }...struct rea
    │ │ │ -000746c0: 645f 7069 6563 655f 7374 7275 6374 0a09  d_piece_struct..
    │ │ │ -000746d0: 097b 0a09 0909 626f 6f73 743a 3a73 6861  .{....boost::sha
    │ │ │ -000746e0: 7265 645f 6172 7261 7926 6c74 3b63 6861  red_array<cha
    │ │ │ -000746f0: 7226 6774 3b20 7069 6563 655f 6461 7461  r> piece_data
    │ │ │ -00074700: 3b0a 0909 0969 6e74 2062 6c6f 636b 735f  ;....int blocks_
    │ │ │ -00074710: 6c65 6674 3b0a 0909 0962 6f6f 6c20 6661  left;....bool fa
    │ │ │ -00074720: 696c 3b0a 0909 0965 7272 6f72 5f63 6f64  il;....error_cod
    │ │ │ -00074730: 6520 6572 726f 723b 0a09 097d 3b0a 0909  e error;...};...
    │ │ │ -00074740: 766f 6964 2072 6561 645f 7069 6563 6528  void read_piece(
    │ │ │ -00074750: 7069 6563 655f 696e 6465 785f 7429 3b0a  piece_index_t);.
    │ │ │ -00074760: 0909 766f 6964 206f 6e5f 6469 736b 5f72  ..void on_disk_r
    │ │ │ -00074770: 6561 645f 636f 6d70 6c65 7465 2864 6973  ead_complete(dis
    │ │ │ -00074780: 6b5f 6275 6666 6572 5f68 6f6c 6465 722c  k_buffer_holder,
    │ │ │ -00074790: 2073 746f 7261 6765 5f65 7272 6f72 2063   storage_error c
    │ │ │ -000747a0: 6f6e 7374 2661 6d70 3b0a 0909 092c 2070  onst&...., p
    │ │ │ -000747b0: 6565 725f 7265 7175 6573 7420 636f 6e73  eer_request cons
    │ │ │ -000747c0: 7426 616d 703b 2c20 7374 643a 3a73 6861  t&, std::sha
    │ │ │ -000747d0: 7265 645f 7074 7226 6c74 3b72 6561 645f  red_ptr<read_
    │ │ │ -000747e0: 7069 6563 655f 7374 7275 6374 2667 743b  piece_struct>
    │ │ │ -000747f0: 293b 0a0a 0909 7374 6f72 6167 655f 6d6f  );....storage_mo
    │ │ │ -00074800: 6465 5f74 2073 746f 7261 6765 5f6d 6f64  de_t storage_mod
    │ │ │ -00074810: 6528 2920 636f 6e73 743b 0a0a 0909 2f2f  e() const;....//
    │ │ │ -00074820: 2074 6869 7320 7769 6c6c 2066 6c61 6720   this will flag 
    │ │ │ -00074830: 7468 6520 746f 7272 656e 7420 6173 2061  the torrent as a
    │ │ │ -00074840: 626f 7274 6564 2e20 5468 6520 6d61 696e  borted. The main
    │ │ │ -00074850: 0a3c 2f70 7265 3e3c 2f74 643e 3c2f 7472  .
    relevance  │ │ │ -00074890: 3b30 3c2f 7464 3e3c 7464 3e3c 6120 6872 ;0../i │ │ │ -000748c0: 6e63 6c75 6465 2f6c 6962 746f 7272 656e nclude/libtorren │ │ │ -000748d0: 742f 746f 7272 656e 742e 6870 703a 3630 t/torrent.hpp:60 │ │ │ -000748e0: 323c 2f61 3e3c 2f74 643e 3c74 643e 6d61 2ma │ │ │ -000748f0: 6b65 2074 6869 7320 666c 6167 2061 2063 ke this flag a c │ │ │ -00074900: 6f6d 6269 6e61 7469 6f6e 206f 6620 7468 ombination of th │ │ │ -00074910: 6520 6f74 6865 7220 6f6e 6573 3c2f 7464 e other ones

    make t │ │ │ -00074970: 6869 7320 666c 6167 2061 2063 6f6d 6269 his flag a combi │ │ │ -00074980: 6e61 7469 6f6e 0a6f 6620 7468 6520 6f74 nation.of the ot │ │ │ -00074990: 6865 7220 6f6e 6573 3c2f 6832 3e3c 6834 her ones

    ../include/libt │ │ │ -000749b0: 6f72 7265 6e74 2f74 6f72 7265 6e74 2e68 orrent/torrent.h │ │ │ -000749c0: 7070 3a36 3032 3c2f 6834 3e3c 7072 6520 pp:602

    ..void do_p
    │ │ │ -00074a10: 6175 7365 2862 6f6f 6c20 7761 735f 7061  ause(bool was_pa
    │ │ │ -00074a20: 7573 6564 203d 2066 616c 7365 293b 0a09  used = false);..
    │ │ │ -00074a30: 0976 6f69 6420 646f 5f72 6573 756d 6528  .void do_resume(
    │ │ │ -00074a40: 293b 0a0a 0909 7365 636f 6e64 7333 3220  );....seconds32 
    │ │ │ -00074a50: 6669 6e69 7368 6564 5f74 696d 6528 2920  finished_time() 
    │ │ │ -00074a60: 636f 6e73 743b 0a09 0973 6563 6f6e 6473  const;...seconds
    │ │ │ -00074a70: 3332 2061 6374 6976 655f 7469 6d65 2829  32 active_time()
    │ │ │ -00074a80: 2063 6f6e 7374 3b0a 0909 7365 636f 6e64   const;...second
    │ │ │ -00074a90: 7333 3220 7365 6564 696e 675f 7469 6d65  s32 seeding_time
    │ │ │ -00074aa0: 2829 2063 6f6e 7374 3b0a 0909 7365 636f  () const;...seco
    │ │ │ -00074ab0: 6e64 7333 3220 7570 6c6f 6164 5f6d 6f64  nds32 upload_mod
    │ │ │ -00074ac0: 655f 7469 6d65 2829 2063 6f6e 7374 3b0a  e_time() const;.
    │ │ │ -00074ad0: 0a09 0962 6f6f 6c20 6973 5f70 6175 7365  ...bool is_pause
    │ │ │ -00074ae0: 6428 2920 636f 6e73 743b 0a09 0962 6f6f  d() const;...boo
    │ │ │ -00074af0: 6c20 6973 5f74 6f72 7265 6e74 5f70 6175  l is_torrent_pau
    │ │ │ -00074b00: 7365 6428 2920 636f 6e73 7420 7b20 7265  sed() const { re
    │ │ │ -00074b10: 7475 726e 206d 5f70 6175 7365 643b 207d  turn m_paused; }
    │ │ │ -00074b20: 0a09 0976 6f69 6420 666f 7263 655f 7265  ...void force_re
    │ │ │ -00074b30: 6368 6563 6b28 293b 0a09 0976 6f69 6420  check();...void 
    │ │ │ -00074b40: 7361 7665 5f72 6573 756d 655f 6461 7461  save_resume_data
    │ │ │ -00074b50: 2872 6573 756d 655f 6461 7461 5f66 6c61  (resume_data_fla
    │ │ │ -00074b60: 6773 5f74 2066 6c61 6773 293b 0a0a 0909  gs_t flags);....
    │ │ │ -00074b70: 626f 6f6c 206e 6565 645f 7361 7665 5f72  bool need_save_r
    │ │ │ -00074b80: 6573 756d 655f 6461 7461 2872 6573 756d  esume_data(resum
    │ │ │ -00074b90: 655f 6461 7461 5f66 6c61 6773 5f74 2066  e_data_flags_t f
    │ │ │ -00074ba0: 6c61 6773 2920 636f 6e73 740a 0909 7b0a  lags) const...{.
    │ │ │ -00074bb0: 0909 0972 6574 7572 6e20 626f 6f6c 286d  ...return bool(m
    │ │ │ -00074bc0: 5f6e 6565 645f 7361 7665 5f72 6573 756d  _need_save_resum
    │ │ │ -00074bd0: 655f 6461 7461 2026 616d 703b 2066 6c61  e_data & fla
    │ │ │ -00074be0: 6773 293b 0a09 097d 0a0a 0909 766f 6964  gs);...}....void
    │ │ │ -00074bf0: 2073 6574 5f6e 6565 645f 7361 7665 5f72   set_need_save_r
    │ │ │ -00074c00: 6573 756d 6528 7265 7375 6d65 5f64 6174  esume(resume_dat
    │ │ │ -00074c10: 615f 666c 6167 735f 7420 636f 6e73 7420  a_flags_t const 
    │ │ │ -00074c20: 666c 6167 290a 0909 7b0a 3c64 6976 2073  flag)...{.
    ...m_nee │ │ │ -00074c60: 645f 7361 7665 5f72 6573 756d 655f 6461 d_save_resume_da │ │ │ -00074c70: 7461 207c 3d20 746f 7272 656e 745f 6861 ta |= torrent_ha │ │ │ -00074c80: 6e64 6c65 3a3a 6f6e 6c79 5f69 665f 6d6f ndle::only_if_mo │ │ │ -00074c90: 6469 6669 6564 3b0a 3c2f 6469 763e 0a09 dified;.
    .. │ │ │ -00074ca0: 0909 6966 2028 6d5f 6e65 6564 5f73 6176 ..if (m_need_sav │ │ │ -00074cb0: 655f 7265 7375 6d65 5f64 6174 6120 2661 e_resume_data &a │ │ │ -00074cc0: 6d70 3b20 666c 6167 2920 7265 7475 726e mp; flag) return │ │ │ -00074cd0: 3b0a 0909 096d 5f6e 6565 645f 7361 7665 ;....m_need_save │ │ │ -00074ce0: 5f72 6573 756d 655f 6461 7461 207c 3d20 _resume_data |= │ │ │ -00074cf0: 666c 6167 3b0a 0909 0973 7461 7465 5f75 flag;....state_u │ │ │ -00074d00: 7064 6174 6564 2829 3b0a 0909 7d0a 0a09 pdated();...}... │ │ │ -00074d10: 0961 6464 5f74 6f72 7265 6e74 5f70 6172 .add_torrent_par │ │ │ -00074d20: 616d 7320 6765 745f 7265 7375 6d65 5f64 ams get_resume_d │ │ │ -00074d30: 6174 6128 7265 7375 6d65 5f64 6174 615f ata(resume_data_ │ │ │ -00074d40: 666c 6167 735f 7420 666c 6167 7329 2063 flags_t flags) c │ │ │ -00074d50: 6f6e 7374 3b0a 0a09 0962 6f6f 6c20 6973 onst;....bool is │ │ │ -00074d60: 5f61 7574 6f5f 6d61 6e61 6765 6428 2920 _auto_managed() │ │ │ -00074d70: 636f 6e73 7420 7b20 7265 7475 726e 206d const { return m │ │ │ -00074d80: 5f61 7574 6f5f 6d61 6e61 6765 643b 207d _auto_managed; } │ │ │ -00074d90: 0a09 0976 6f69 6420 6175 746f 5f6d 616e ...void auto_man │ │ │ -00074da0: 6167 6564 2862 6f6f 6c20 6129 3b0a 0a09 aged(bool a);... │ │ │ -00074db0: 0962 6f6f 6c20 7368 6f75 6c64 5f63 6865 .bool should_che │ │ │ -00074dc0: 636b 5f66 696c 6573 2829 2063 6f6e 7374 ck_files() const │ │ │ -00074dd0: 3b0a 0a09 0962 6f6f 6c20 6465 6c65 7465 ;....bool delete │ │ │ -00074de0: 5f66 696c 6573 2872 656d 6f76 655f 666c _files(remove_fl │ │ │ -00074df0: 6167 735f 7420 6f70 7469 6f6e 7329 3b0a ags_t options);. │ │ │ -00074e00: 0909 766f 6964 2070 6565 7273 5f65 7261 ..void peers_era │ │ │ -00074e10: 7365 6428 7374 643a 3a76 6563 746f 7226 sed(std::vector& │ │ │ -00074e20: 6c74 3b74 6f72 7265 6e74 5f70 6565 722a lt;torrent_peer* │ │ │ -00074e30: 2667 743b 2063 6f6e 7374 2661 6d70 3b20 > const& │ │ │ -00074e40: 7065 6572 7329 3b0a 0a23 6966 2054 4f52 peers);..#if TOR │ │ │ -00074e50: 5245 4e54 5f41 4249 5f56 4552 5349 4f4e RENT_ABI_VERSION │ │ │ -00074e60: 203d 3d20 310a 2369 6620 2154 4f52 5245 == 1.#if !TORRE │ │ │ -00074e70: 4e54 5f4e 4f5f 4650 550a 0909 766f 6964 NT_NO_FPU...void │ │ │ -00074e80: 2066 696c 655f 7072 6f67 7265 7373 5f66 file_progress_f │ │ │ -00074e90: 6c6f 6174 2861 7578 3a3a 7665 6374 6f72 loat(aux::vector │ │ │ -00074ea0: 266c 743b 666c 6f61 742c 2066 696c 655f <float, file_ │ │ │ -00074eb0: 696e 6465 785f 7426 6774 3b26 616d 703b index_t>& │ │ │ -00074ec0: 2066 7029 3b0a 2365 6e64 6966 0a23 656e fp);.#endif.#en │ │ │ -00074ed0: 6469 6620 2f2f 2054 4f52 5245 4e54 5f41 dif // TORRENT_A │ │ │ -00074ee0: 4249 5f56 4552 5349 4f4e 0a0a 0909 766f BI_VERSION....vo │ │ │ -00074ef0: 6964 2070 6f73 745f 7069 6563 655f 6176 id post_piece_av │ │ │ -00074f00: 6169 6c61 6269 6c69 7479 2829 3b0a 0909 ailability();... │ │ │ -00074f10: 766f 6964 2070 6965 6365 5f61 7661 696c void piece_avail │ │ │ -00074f20: 6162 696c 6974 7928 6175 783a 3a76 6563 ability(aux::vec │ │ │ -00074f30: 746f 7226 6c74 3b69 6e74 2c20 7069 6563 tor<int, piec │ │ │ -00074f40: 655f 696e 6465 785f 7426 6774 3b26 616d e_index_t>&am │ │ │ -00074f50: 703b 2061 7661 696c 2920 636f 6e73 743b p; avail) const; │ │ │ -00074f60: 0a0a 0909 766f 6964 2073 6574 5f70 6965 ....void set_pie │ │ │ -00074f70: 6365 5f70 7269 6f72 6974 7928 7069 6563 ce_priority(piec │ │ │ -00074f80: 655f 696e 6465 785f 7420 696e 6465 782c e_index_t index, │ │ │ -00074f90: 2064 6f77 6e6c 6f61 645f 7072 696f 7269 download_priori │ │ │ -00074fa0: 7479 5f74 2070 7269 6f72 6974 7929 3b0a ty_t priority);. │ │ │ -00074fb0: 0909 646f 776e 6c6f 6164 5f70 7269 6f72 ..download_prior │ │ │ -00074fc0: 6974 795f 7420 7069 6563 655f 7072 696f ity_t piece_prio │ │ │ -00074fd0: 7269 7479 2870 6965 6365 5f69 6e64 6578 rity(piece_index │ │ │ -00074fe0: 5f74 2069 6e64 6578 2920 636f 6e73 743b _t index) const; │ │ │ -00074ff0: 0a0a 0909 766f 6964 2070 7269 6f72 6974 ....void priorit │ │ │ -00075000: 697a 655f 7069 6563 6573 2861 7578 3a3a ize_pieces(aux:: │ │ │ -00075010: 7665 6374 6f72 266c 743b 646f 776e 6c6f vector<downlo │ │ │ -00075020: 6164 5f70 7269 6f72 6974 795f 742c 2070 ad_priority_t, p │ │ │ -00075030: 6965 6365 5f69 6e64 6578 5f74 2667 743b iece_index_t> │ │ │ -00075040: 2063 6f6e 7374 2661 6d70 3b20 7069 6563 const& piec │ │ │ -00075050: 6573 293b 0a09 0976 6f69 6420 7072 696f es);...void prio │ │ │ -00075060: 7269 7469 7a65 5f70 6965 6365 5f6c 6973 ritize_piece_lis │ │ │ -00075070: 7428 7374 643a 3a76 6563 746f 7226 6c74 t(std::vector< │ │ │ -00075080: 3b73 7464 3a3a 7061 6972 266c 743b 7069 ;std::pair<pi │ │ │ -00075090: 6563 655f 696e 6465 785f 742c 2064 6f77 ece_index_t, dow │ │ │ -000750a0: 6e6c 6f61 645f 7072 696f 7269 7479 5f74 nload_priority_t │ │ │ -000750b0: 2667 743b 2667 743b 2063 6f6e 7374 2661 >> const&a │ │ │ -000750c0: 6d70 3b20 7069 6563 6573 293b 0a3c 2f70 mp; pieces);.

    re │ │ │ -00075100: 6c65 7661 6e63 6526 6e62 7370 3b30 3c2f levance 0../inclu │ │ │ -00075140: 6465 2f6c 6962 746f 7272 656e 742f 746f de/libtorrent/to │ │ │ -00075150: 7272 656e 742e 6870 703a 3133 3933 3c2f rrent.hpp:1393this │ │ │ -00075170: 7761 7374 6573 2035 2062 6974 7320 7065 wastes 5 bits pe │ │ │ -00075180: 7220 6669 6c65 3c2f 7464 3e3c 2f74 723e r file │ │ │ -00075190: 3c74 7220 6964 3d22 3236 3622 2073 7479 │ │ │ -000751c0: 3c74 6420 636f 6c73 7061 6e3d 2233 223e │ │ │ -000751d0: 3c68 323e 7468 6973 2077 6173 7465 7320

    this wastes │ │ │ -000751e0: 3520 6269 7473 2070 6572 2066 696c 653c 5 bits per file< │ │ │ -000751f0: 2f68 323e 3c68 343e 2e2e 2f69 6e63 6c75 /h2>

    ../inclu │ │ │ -00075200: 6465 2f6c 6962 746f 7272 656e 742f 746f de/libtorrent/to │ │ │ -00075210: 7272 656e 742e 6870 703a 3133 3933 3c2f rrent.hpp:1393
    #if
    │ │ │ -00075260: 6e64 6566 2054 4f52 5245 4e54 5f44 4953  ndef TORRENT_DIS
    │ │ │ -00075270: 4142 4c45 5f45 5854 454e 5349 4f4e 530a  ABLE_EXTENSIONS.
    │ │ │ -00075280: 0909 7374 643a 3a6c 6973 7426 6c74 3b73  ..std::list<s
    │ │ │ -00075290: 7464 3a3a 7368 6172 6564 5f70 7472 266c  td::shared_ptr&l
    │ │ │ -000752a0: 743b 746f 7272 656e 745f 706c 7567 696e  t;torrent_plugin
    │ │ │ -000752b0: 2667 743b 2667 743b 206d 5f65 7874 656e  >> m_exten
    │ │ │ -000752c0: 7369 6f6e 733b 0a23 656e 6469 660a 0a09  sions;.#endif...
    │ │ │ -000752d0: 092f 2f20 7573 6564 2066 6f72 2074 7261  .// used for tra
    │ │ │ -000752e0: 636b 6572 2061 6e6e 6f75 6e63 6573 0a09  cker announces..
    │ │ │ -000752f0: 0964 6561 646c 696e 655f 7469 6d65 7220  .deadline_timer 
    │ │ │ -00075300: 6d5f 7472 6163 6b65 725f 7469 6d65 723b  m_tracker_timer;
    │ │ │ -00075310: 0a0a 0909 2f2f 2075 7365 6420 746f 2064  ....// used to d
    │ │ │ -00075320: 6574 6563 7420 7768 656e 2077 6520 6172  etect when we ar
    │ │ │ -00075330: 6520 6163 7469 7665 206f 7220 696e 6163  e active or inac
    │ │ │ -00075340: 7469 7665 2066 6f72 206c 6f6e 6720 656e  tive for long en
    │ │ │ -00075350: 6f75 6768 0a09 092f 2f20 746f 2074 7269  ough...// to tri
    │ │ │ -00075360: 6767 6572 2074 6865 2061 7574 6f2d 6d61  gger the auto-ma
    │ │ │ -00075370: 6e61 6765 206c 6f67 6963 0a09 0964 6561  nage logic...dea
    │ │ │ -00075380: 646c 696e 655f 7469 6d65 7220 6d5f 696e  dline_timer m_in
    │ │ │ -00075390: 6163 7469 7669 7479 5f74 696d 6572 3b0a  activity_timer;.
    │ │ │ -000753a0: 0a09 092f 2f20 7468 6973 2069 7320 7468  ...// this is th
    │ │ │ -000753b0: 6520 7570 6c6f 6164 2061 6e64 2064 6f77  e upload and dow
    │ │ │ -000753c0: 6e6c 6f61 6420 7374 6174 6973 7469 6373  nload statistics
    │ │ │ -000753d0: 2066 6f72 2074 6865 2077 686f 6c65 2074   for the whole t
    │ │ │ -000753e0: 6f72 7265 6e74 2e0a 0909 2f2f 2069 7427  orrent....// it'
    │ │ │ -000753f0: 7320 7570 6461 7465 6420 6672 6f6d 2061  s updated from a
    │ │ │ -00075400: 6c6c 2069 7473 2070 6565 7273 206f 6e63  ll its peers onc
    │ │ │ -00075410: 6520 6576 6572 7920 7365 636f 6e64 2e0a  e every second..
    │ │ │ -00075420: 0909 6c69 6274 6f72 7265 6e74 3a3a 7374  ..libtorrent::st
    │ │ │ -00075430: 6174 206d 5f73 7461 743b 0a0a 0909 2f2f  at m_stat;....//
    │ │ │ -00075440: 202d 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d   ---------------
    │ │ │ -00075450: 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 0a0a  --------------..
    │ │ │ -00075460: 0909 2f2f 2074 6869 7320 7665 6374 6f72  ..// this vector
    │ │ │ -00075470: 2069 7320 616c 6c6f 6361 7465 6420 6c61   is allocated la
    │ │ │ -00075480: 7a69 6c79 2e20 4966 206e 6f20 6669 6c65  zily. If no file
    │ │ │ -00075490: 2070 7269 6f72 6974 6965 7320 6172 650a   priorities are.
    │ │ │ -000754a0: 0909 2f2f 2065 7665 7220 6368 616e 6765  ..// ever change
    │ │ │ -000754b0: 642c 2074 6869 7320 7265 6d61 696e 7320  d, this remains 
    │ │ │ -000754c0: 656d 7074 792e 2041 6e79 2075 6e61 6c6c  empty. Any unall
    │ │ │ -000754d0: 6f63 6174 6564 2073 6c6f 740a 0909 2f2f  ocated slot...//
    │ │ │ -000754e0: 2069 6d70 6c69 6369 746c 7920 6d65 616e   implicitly mean
    │ │ │ -000754f0: 7320 7468 6520 6669 6c65 2068 6173 2070  s the file has p
    │ │ │ -00075500: 7269 6f72 6974 7920 342e 0a3c 6469 7620  riority 4..
    ..aux:: │ │ │ -00075540: 7665 6374 6f72 266c 743b 646f 776e 6c6f vector<downlo │ │ │ -00075550: 6164 5f70 7269 6f72 6974 795f 742c 2066 ad_priority_t, f │ │ │ -00075560: 696c 655f 696e 6465 785f 7426 6774 3b20 ile_index_t> │ │ │ -00075570: 6d5f 6669 6c65 5f70 7269 6f72 6974 793b m_file_priority; │ │ │ -00075580: 0a3c 2f64 6976 3e0a 0909 2f2f 2061 6e79 .
    ...// any │ │ │ -00075590: 2066 696c 6520 7072 696f 7269 7479 2075 file priority u │ │ │ -000755a0: 7064 6174 6573 2061 7474 656d 7074 6564 pdates attempted │ │ │ -000755b0: 2077 6869 6c65 2061 6e6f 7468 6572 2066 while another f │ │ │ -000755c0: 696c 6520 7072 696f 7269 7479 2075 7064 ile priority upd │ │ │ -000755d0: 6174 650a 0909 2f2f 2069 7320 696e 2d70 ate...// is in-p │ │ │ -000755e0: 726f 6772 6573 732f 6f75 7473 7461 6e64 rogress/outstand │ │ │ -000755f0: 696e 6720 7769 7468 2074 6865 2064 6973 ing with the dis │ │ │ -00075600: 6b20 492f 4f20 7468 7265 6164 2c20 6172 k I/O thread, ar │ │ │ -00075610: 6520 7175 6575 6564 2075 7020 696e 0a09 e queued up in.. │ │ │ -00075620: 092f 2f20 7468 6973 2064 6963 7469 6f6e .// this diction │ │ │ -00075630: 6172 792e 204f 6e63 6520 7468 6520 6f75 ary. Once the ou │ │ │ -00075640: 7473 7461 6e64 696e 6720 7570 6461 7465 tstanding update │ │ │ -00075650: 2063 6f6d 6573 2062 6163 6b2c 2061 6c6c comes back, all │ │ │ -00075660: 206f 6620 7468 6573 650a 0909 2f2f 2061 of these...// a │ │ │ -00075670: 7265 2061 7070 6c69 6564 2069 6e20 6f6e re applied in on │ │ │ -00075680: 6520 6261 7463 680a 0909 7374 643a 3a6d e batch...std::m │ │ │ -00075690: 6170 266c 743b 6669 6c65 5f69 6e64 6578 ap<file_index │ │ │ -000756a0: 5f74 2c20 646f 776e 6c6f 6164 5f70 7269 _t, download_pri │ │ │ -000756b0: 6f72 6974 795f 7426 6774 3b20 6d5f 6465 ority_t> m_de │ │ │ -000756c0: 6665 7272 6564 5f66 696c 655f 7072 696f ferred_file_prio │ │ │ -000756d0: 7269 7469 6573 3b0a 0a09 092f 2f20 7468 rities;....// th │ │ │ -000756e0: 6973 206f 626a 6563 7420 6973 2075 7365 is object is use │ │ │ -000756f0: 6420 746f 2074 7261 636b 2064 6f77 6e6c d to track downl │ │ │ -00075700: 6f61 6420 7072 6f67 7265 7373 206f 6620 oad progress of │ │ │ -00075710: 696e 6469 7669 6475 616c 2066 696c 6573 individual files │ │ │ -00075720: 0a09 0961 7578 3a3a 6669 6c65 5f70 726f ...aux::file_pro │ │ │ -00075730: 6772 6573 7320 6d5f 6669 6c65 5f70 726f gress m_file_pro │ │ │ -00075740: 6772 6573 733b 0a0a 0909 2f2f 2061 2071 gress;....// a q │ │ │ -00075750: 7565 7565 206f 6620 7468 6520 6d6f 7374 ueue of the most │ │ │ -00075760: 2072 6563 656e 7420 6c6f 772d 6176 6169 recent low-avai │ │ │ -00075770: 6c61 6269 6c69 7479 2070 6965 6365 7320 lability pieces │ │ │ -00075780: 7765 2061 6363 6573 7365 6420 6f6e 2064 we accessed on d │ │ │ -00075790: 6973 6b2e 0a09 092f 2f20 5468 6573 6520 isk....// These │ │ │ -000757a0: 6172 6520 676f 6f64 2063 616e 6469 6461 are good candida │ │ │ -000757b0: 7465 7320 666f 7220 7375 6767 6573 7469 tes for suggesti │ │ │ -000757c0: 6e67 206f 7468 6572 2070 6565 7273 2074 ng other peers t │ │ │ -000757d0: 6f20 7265 7175 6573 7420 6672 6f6d 0a09 o request from.. │ │ │ -000757e0: 092f 2f20 7573 2e0a 0909 6175 783a 3a73 .// us....aux::s │ │ │ -000757f0: 7567 6765 7374 5f70 6965 6365 206d 5f73 uggest_piece m_s │ │ │ -00075800: 7567 6765 7374 5f70 6965 6365 733b 0a0a uggest_pieces;.. │ │ │ -00075810: 0909 6175 783a 3a76 6563 746f 7226 6c74 ..aux::vector< │ │ │ -00075820: 3b61 7578 3a3a 616e 6e6f 756e 6365 5f65 ;aux::announce_e │ │ │ -00075830: 6e74 7279 2667 743b 206d 5f74 7261 636b ntry> m_track │ │ │ -00075840: 6572 733b 0a0a 2369 666e 6465 6620 544f ers;..#ifndef TO │ │ │ -00075850: 5252 454e 545f 4449 5341 424c 455f 5354 RRENT_DISABLE_ST │ │ │ -00075860: 5245 414d 494e 470a 0909 2f2f 2074 6869 REAMING...// thi │ │ │ -00075870: 7320 6c69 7374 2069 7320 736f 7274 6564 s list is sorted │ │ │ -00075880: 2062 7920 7469 6d65 5f63 7269 7469 6361 by time_critica │ │ │ -00075890: 6c5f 7069 6563 653a 3a64 6561 646c 696e l_piece::deadlin │ │ │ -000758a0: 650a 0909 7374 643a 3a76 6563 746f 7226 e...std::vector& │ │ │ -000758b0: 6c74 3b74 696d 655f 6372 6974 6963 616c lt;time_critical │ │ │ -000758c0: 5f70 6965 6365 2667 743b 206d 5f74 696d _piece> m_tim │ │ │ -000758d0: 655f 6372 6974 6963 616c 5f70 6965 6365 e_critical_piece │ │ │ -000758e0: 733b 0a23 656e 6469 660a 0a09 0973 7464 s;.#endif....std │ │ │ -000758f0: 3a3a 7374 7269 6e67 206d 5f74 7261 636b ::string m_track │ │ │ -00075900: 6572 6964 3b0a 2369 6620 544f 5252 454e erid;.#if TORREN │ │ │ -00075910: 545f 4142 495f 5645 5253 494f 4e20 3d3d T_ABI_VERSION == │ │ │ -00075920: 2031 0a09 092f 2f20 6465 7072 6563 6174 1...// deprecat │ │ │ -00075930: 6564 2069 6e20 312e 310a 0909 7374 643a ed in 1.1...std: │ │ │ -00075940: 3a73 7472 696e 6720 6d5f 7573 6572 6e61 :string m_userna │ │ │ -00075950: 6d65 3b0a 0909 7374 643a 3a73 7472 696e me;...std::strin │ │ │ -00075960: 6720 6d5f 7061 7373 776f 7264 3b0a 2365 g m_password;.#e │ │ │ -00075970: 6e64 6966 0a0a 0909 7374 643a 3a73 7472 ndif....std::str │ │ │ -00075980: 696e 6720 6d5f 7361 7665 5f70 6174 683b ing m_save_path; │ │ │ -00075990: 0a3c 2f70 7265 3e3c 2f74 643e 3c2f 7472 .
    relevance  │ │ │ -000759d0: 3b30 3c2f 7464 3e3c 7464 3e3c 6120 6872 ;0
    ../i │ │ │ -00075a00: 6e63 6c75 6465 2f6c 6962 746f 7272 656e nclude/libtorren │ │ │ -00075a10: 742f 746f 7272 656e 742e 6870 703a 3137 t/torrent.hpp:17 │ │ │ -00075a20: 3039 3c2f 613e 3c2f 7464 3e3c 7464 3e74 09t │ │ │ -00075a30: 6869 7320 6d65 6d62 6572 2063 616e 2070 his member can p │ │ │ -00075a40: 726f 6261 626c 7920 6265 2072 656d 6f76 robably be remov │ │ │ -00075a50: 6564 3c2f 7464 3e3c 2f74 723e 3c74 7220 ed

    │ │ │ -00075aa0: 7468 6973 206d 656d 6265 7220 6361 6e20 this member can │ │ │ -00075ab0: 7072 6f62 6162 6c79 2062 6520 7265 6d6f probably be remo │ │ │ -00075ac0: 7665 643c 2f68 323e 3c68 343e 2e2e 2f69 ved

    ../i │ │ │ -00075ad0: 6e63 6c75 6465 2f6c 6962 746f 7272 656e nclude/libtorren │ │ │ -00075ae0: 742f 746f 7272 656e 742e 6870 703a 3137 t/torrent.hpp:17 │ │ │ -00075af0: 3039 3c2f 6834 3e3c 7072 6520 7374 796c 09

    ..unsigned int 
    │ │ │ -00075b40: 6d5f 6e75 6d5f 7570 6c6f 6164 733a 3234  m_num_uploads:24
    │ │ │ -00075b50: 3b0a 0a09 092f 2f20 3420 756e 7573 6564  ;....// 4 unused
    │ │ │ -00075b60: 2062 6974 730a 0a09 092f 2f20 7768 656e   bits....// when
    │ │ │ -00075b70: 2074 6869 7320 6973 2074 7275 652c 2074   this is true, t
    │ │ │ -00075b80: 6869 7320 746f 7272 656e 7420 7375 7070  his torrent supp
    │ │ │ -00075b90: 6f72 7473 2070 6565 7220 6578 6368 616e  orts peer exchan
    │ │ │ -00075ba0: 6765 0a09 0962 6f6f 6c20 6d5f 656e 6162  ge...bool m_enab
    │ │ │ -00075bb0: 6c65 5f70 6578 3a31 3b0a 0a09 092f 2f20  le_pex:1;....// 
    │ │ │ -00075bc0: 7365 7420 746f 2074 7275 6520 6966 2074  set to true if t
    │ │ │ -00075bd0: 6865 2073 6573 7369 6f6e 2049 5020 6669  he session IP fi
    │ │ │ -00075be0: 6c74 6572 2061 7070 6c69 6573 2074 6f20  lter applies to 
    │ │ │ -00075bf0: 7468 6973 0a09 092f 2f20 746f 7272 656e  this...// torren
    │ │ │ -00075c00: 7420 6f72 206e 6f74 2e20 4465 6661 756c  t or not. Defaul
    │ │ │ -00075c10: 7473 2074 6f20 7472 7565 2e0a 0909 626f  ts to true....bo
    │ │ │ -00075c20: 6f6c 206d 5f61 7070 6c79 5f69 705f 6669  ol m_apply_ip_fi
    │ │ │ -00075c30: 6c74 6572 3a31 3b0a 0a09 092f 2f20 7468  lter:1;....// th
    │ │ │ -00075c40: 6973 2069 7320 7472 7565 2077 6865 6e20  is is true when 
    │ │ │ -00075c50: 6f75 7220 6566 6665 6374 6976 6520 696e  our effective in
    │ │ │ -00075c60: 6163 7469 7665 2073 7461 7465 2069 7320  active state is 
    │ │ │ -00075c70: 6469 6666 6572 656e 7420 6672 6f6d 206f  different from o
    │ │ │ -00075c80: 7572 0a09 092f 2f20 6163 7475 616c 2069  ur...// actual i
    │ │ │ -00075c90: 6e61 6374 6976 6520 7374 6174 652e 2057  nactive state. W
    │ │ │ -00075ca0: 6865 6e65 7665 7220 7468 6973 2073 7461  henever this sta
    │ │ │ -00075cb0: 7465 2063 6861 6e67 6573 2c20 7468 6572  te changes, ther
    │ │ │ -00075cc0: 6520 6973 2061 0a09 092f 2f20 7175 6172  e is a...// quar
    │ │ │ -00075cd0: 616e 7469 6e65 2070 6572 696f 6420 756e  antine period un
    │ │ │ -00075ce0: 7469 6c20 7765 2063 6861 6e67 6520 7468  til we change th
    │ │ │ -00075cf0: 6520 6566 6665 6374 6976 6520 7374 6174  e effective stat
    │ │ │ -00075d00: 652e 2054 6869 7320 6973 2074 6f20 6176  e. This is to av
    │ │ │ -00075d10: 6f69 640a 0909 2f2f 2066 6c61 7070 696e  oid...// flappin
    │ │ │ -00075d20: 672e 2049 6620 7468 6520 7374 6174 6520  g. If the state 
    │ │ │ -00075d30: 6368 616e 6765 7320 6261 636b 2064 7572  changes back dur
    │ │ │ -00075d40: 696e 6720 7468 6973 2070 6572 696f 642c  ing this period,
    │ │ │ -00075d50: 2077 6520 6361 6e63 656c 2074 6865 0a09   we cancel the..
    │ │ │ -00075d60: 092f 2f20 7175 6172 616e 7469 6e65 0a09  .// quarantine..
    │ │ │ -00075d70: 0962 6f6f 6c20 6d5f 7065 6e64 696e 675f  .bool m_pending_
    │ │ │ -00075d80: 6163 7469 7665 5f63 6861 6e67 653a 313b  active_change:1;
    │ │ │ -00075d90: 0a0a 0909 2f2f 2074 6869 7320 6973 2073  ....// this is s
    │ │ │ -00075da0: 6574 2074 6f20 7472 7565 2069 6620 616c  et to true if al
    │ │ │ -00075db0: 6c20 7069 6563 6520 6c61 7965 7273 2077  l piece layers w
    │ │ │ -00075dc0: 6572 6520 7375 6363 6573 7366 756c 6c79  ere successfully
    │ │ │ -00075dd0: 206c 6f61 6465 6420 616e 640a 0909 2f2f   loaded and...//
    │ │ │ -00075de0: 2076 616c 6964 6174 6564 2e20 4f6e 6c79   validated. Only
    │ │ │ -00075df0: 2066 6f72 2076 3220 746f 7272 656e 7473   for v2 torrents
    │ │ │ -00075e00: 0a3c 6469 7620 7374 796c 653d 2262 6163  .
    . │ │ │ -00075e30: 0962 6f6f 6c20 6d5f 7632 5f70 6965 6365 .bool m_v2_piece │ │ │ -00075e40: 5f6c 6179 6572 735f 7661 6c69 6461 7465 _layers_validate │ │ │ -00075e50: 643a 313b 0a3c 2f64 6976 3e0a 2f2f 202d d:1;.
    .// - │ │ │ -00075e60: 2d2d 2d0a 0a09 092f 2f20 7468 6973 2069 ---....// this i │ │ │ -00075e70: 7320 7365 7420 746f 2074 6865 2063 6f6e s set to the con │ │ │ -00075e80: 6e65 6374 2062 6f6f 7374 2071 756f 7461 nect boost quota │ │ │ -00075e90: 2066 6f72 2074 6869 7320 746f 7272 656e for this torren │ │ │ -00075ea0: 742e 0a09 092f 2f20 4166 7465 7220 6861 t....// After ha │ │ │ -00075eb0: 7669 6e67 2072 6563 6569 7665 6420 7468 ving received th │ │ │ -00075ec0: 6973 206d 616e 7920 7072 696f 7269 7479 is many priority │ │ │ -00075ed0: 2070 6565 7220 636f 6e6e 6563 7469 6f6e peer connection │ │ │ -00075ee0: 2061 7474 656d 7074 732c 2069 740a 0909 attempts, it... │ │ │ -00075ef0: 2f2f 2066 616c 6c73 2062 6163 6b20 6f6e // falls back on │ │ │ -00075f00: 746f 2074 6865 2073 7465 6164 7920 7374 to the steady st │ │ │ -00075f10: 6174 6520 7065 6572 2063 6f6e 6e65 6374 ate peer connect │ │ │ -00075f20: 696f 6e20 6c6f 6769 632c 2064 7269 7665 ion logic, drive │ │ │ -00075f30: 6e20 6279 2074 6865 0a09 092f 2f20 7365 n by the...// se │ │ │ -00075f40: 7373 696f 6e20 7469 636b 2e20 4561 6368 ssion tick. Each │ │ │ -00075f50: 2074 7261 636b 6572 2072 6573 706f 6e73 tracker respons │ │ │ -00075f60: 652c 2061 7320 6c6f 6e67 2061 7320 7468 e, as long as th │ │ │ -00075f70: 6973 2069 7320 6e6f 6e2d 7a65 726f 2c20 is is non-zero, │ │ │ -00075f80: 7769 6c6c 0a09 092f 2f20 6174 7465 6d70 will...// attemp │ │ │ -00075f90: 7420 746f 2063 6f6e 6e65 6374 2074 6f20 t to connect to │ │ │ -00075fa0: 7065 6572 7320 696d 6d65 6469 6174 656c peers immediatel │ │ │ -00075fb0: 7920 616e 6420 6465 6372 656d 656e 7420 y and decrement │ │ │ -00075fc0: 7468 6520 636f 756e 7465 722e 0a09 092f the counter..../ │ │ │ -00075fd0: 2f20 5765 2067 6976 6520 746f 7272 656e / We give torren │ │ │ -00075fe0: 7473 2061 2063 6f6e 6e65 6374 2062 6f6f ts a connect boo │ │ │ -00075ff0: 7374 2077 6865 6e20 7468 6579 2061 7265 st when they are │ │ │ -00076000: 2066 6972 7374 2061 6464 6564 2061 6e64 first added and │ │ │ -00076010: 2074 6865 6e0a 0909 2f2f 2065 7665 7279 then...// every │ │ │ -00076020: 2074 696d 6520 7468 6579 2072 6573 756d time they resum │ │ │ -00076030: 6520 6672 6f6d 2062 6569 6e67 2070 6175 e from being pau │ │ │ -00076040: 7365 642e 0a09 0973 7464 3a3a 7569 6e74 sed....std::uint │ │ │ -00076050: 385f 7420 6d5f 636f 6e6e 6563 745f 626f 8_t m_connect_bo │ │ │ -00076060: 6f73 745f 636f 756e 7465 723b 0a0a 2f2f ost_counter;..// │ │ │ -00076070: 202d 2d2d 2d0a 0a09 092f 2f20 7468 6520 ----....// the │ │ │ -00076080: 7363 7261 7065 2064 6174 6120 6672 6f6d scrape data from │ │ │ -00076090: 2074 6865 2074 7261 636b 6572 2072 6573 the tracker res │ │ │ -000760a0: 706f 6e73 652c 2074 6869 730a 0909 2f2f ponse, this...// │ │ │ -000760b0: 2069 7320 6f70 7469 6f6e 616c 2061 6e64 is optional and │ │ │ -000760c0: 206d 6179 2062 6520 3078 6666 6666 6666 may be 0xffffff │ │ │ -000760d0: 0a09 0973 7464 3a3a 7569 6e74 3332 5f74 ...std::uint32_t │ │ │ -000760e0: 206d 5f69 6e63 6f6d 706c 6574 653a 3234 m_incomplete:24 │ │ │ -000760f0: 3b0a 0a09 092f 2f20 7472 7565 2077 6865 ;....// true whe │ │ │ -00076100: 6e20 7468 6520 746f 7272 656e 7420 7368 n the torrent sh │ │ │ -00076110: 6f75 6c64 2061 6e6e 6f75 6e63 6520 746f ould announce to │ │ │ -00076120: 0a09 092f 2f20 7468 6520 4448 540a 0909 ...// the DHT... │ │ │ -00076130: 626f 6f6c 206d 5f61 6e6e 6f75 6e63 655f bool m_announce_ │ │ │ -00076140: 746f 5f64 6874 3a31 3b0a 0a09 092f 2f20 to_dht:1;....// │ │ │ -00076150: 6576 656e 2069 6620 7765 2772 6520 6e6f even if we're no │ │ │ -00076160: 7420 6275 696c 7420 746f 2073 7570 706f t built to suppo │ │ │ -00076170: 7274 2053 534c 2074 6f72 7265 6e74 732c rt SSL torrents, │ │ │ -00076180: 0a09 092f 2f20 7265 6d65 6d62 6572 2074 ...// remember t │ │ │ -00076190: 6861 7420 7468 6973 2069 7320 616e 2053 hat this is an S │ │ │ -000761a0: 534c 2074 6f72 7265 6e74 2c20 736f 2074 SL torrent, so t │ │ │ -000761b0: 6861 7420 7765 2064 6f6e 2774 0a09 092f hat we don't.../ │ │ │ -000761c0: 2f20 6163 6369 6465 6e74 616c 6c79 2073 / accidentally s │ │ │ -000761d0: 7461 7274 2073 6565 6469 6e67 2069 7420 tart seeding it │ │ │ -000761e0: 7769 7468 6f75 7420 616e 7920 6175 7468 without any auth │ │ │ -000761f0: 656e 7469 6361 7469 6f6e 2e0a 0909 626f entication....bo │ │ │ -00076200: 6f6c 206d 5f73 736c 5f74 6f72 7265 6e74 ol m_ssl_torrent │ │ │ -00076210: 3a31 3b0a 0a09 092f 2f20 7468 6973 2069 :1;....// this i │ │ │ -00076220: 7320 7365 7420 746f 2074 7275 6520 6966 s set to true if │ │ │ -00076230: 2077 6527 7265 2074 7279 696e 6720 746f we're trying to │ │ │ -00076240: 2064 656c 6574 6520 7468 650a 0909 2f2f delete the...// │ │ │ -00076250: 2066 696c 6573 2062 656c 6f6e 6769 6e67 files belonging │ │ │ -00076260: 2074 6f20 6974 2e20 5768 656e 2073 6574 to it. When set │ │ │ -00076270: 2c20 646f 6e27 7420 7772 6974 6520 616e , don't write an │ │ │ -00076280: 790a 0909 2f2f 206d 6f72 6520 626c 6f63 y...// more bloc │ │ │ -00076290: 6b73 2074 6f20 6469 736b 210a 3c2f 7072 ks to disk!.rel │ │ │ -000762d0: 6576 616e 6365 266e 6273 703b 303c 2f74 evance 0../includ │ │ │ -00076310: 652f 6c69 6274 6f72 7265 6e74 2f61 6e6e e/libtorrent/ann │ │ │ -00076320: 6f75 6e63 655f 656e 7472 792e 6870 703a ounce_entry.hpp: │ │ │ -00076330: 3736 3c2f 613e 3c2f 7464 3e3c 7464 3e69 76i │ │ │ -00076340: 6e63 6c75 6465 2074 6865 206e 756d 6265 nclude the numbe │ │ │ -00076350: 7220 6f66 2070 6565 7273 2072 6563 6569 r of peers recei │ │ │ -00076360: 7665 6420 6672 6f6d 2074 6869 7320 7472 ved from this tr │ │ │ -00076370: 6163 6b65 722c 2061 7420 6c61 7374 2061 acker, at last a │ │ │ -00076380: 6e6e 6f75 6e63 653c 2f74 643e 3c2f 7472 nnounce

    include the │ │ │ -000763e0: 206e 756d 6265 7220 6f66 2070 6565 7273 number of peers │ │ │ -000763f0: 2072 6563 6569 7665 6420 6672 6f6d 2074 received from t │ │ │ -00076400: 6869 7320 7472 6163 6b65 722c 2061 7420 his tracker, at │ │ │ -00076410: 6c61 7374 0a61 6e6e 6f75 6e63 653c 2f68 last.announce

    ../include │ │ │ -00076430: 2f6c 6962 746f 7272 656e 742f 616e 6e6f /libtorrent/anno │ │ │ -00076440: 756e 6365 5f65 6e74 7279 2e68 7070 3a37 unce_entry.hpp:7 │ │ │ -00076450: 363c 2f68 343e 3c70 7265 2073 7479 6c65 6

    │ │ │ -00076490: 0a09 7374 7275 6374 2054 4f52 5245 4e54  ..struct TORRENT
    │ │ │ -000764a0: 5f45 5850 4f52 5420 616e 6e6f 756e 6365  _EXPORT announce
    │ │ │ -000764b0: 5f69 6e66 6f68 6173 680a 097b 0a09 092f  _infohash..{.../
    │ │ │ -000764c0: 2f20 696e 7465 726e 616c 0a09 0954 4f52  / internal...TOR
    │ │ │ -000764d0: 5245 4e54 5f55 4e45 5850 4f52 5420 616e  RENT_UNEXPORT an
    │ │ │ -000764e0: 6e6f 756e 6365 5f69 6e66 6f68 6173 6828  nounce_infohash(
    │ │ │ -000764f0: 293b 0a0a 0909 2f2f 2069 6620 7468 6973  );....// if this
    │ │ │ -00076500: 2074 7261 636b 6572 2068 6173 2072 6574   tracker has ret
    │ │ │ -00076510: 7572 6e65 6420 616e 2065 7272 6f72 206f  urned an error o
    │ │ │ -00076520: 7220 7761 726e 696e 6720 6d65 7373 6167  r warning messag
    │ │ │ -00076530: 650a 0909 2f2f 2074 6861 7420 6d65 7373  e...// that mess
    │ │ │ -00076540: 6167 6520 6973 2073 746f 7265 6420 6865  age is stored he
    │ │ │ -00076550: 7265 0a09 0973 7464 3a3a 7374 7269 6e67  re...std::string
    │ │ │ -00076560: 206d 6573 7361 6765 3b0a 0a09 092f 2f20   message;....// 
    │ │ │ -00076570: 6966 2074 6869 7320 7472 6163 6b65 7220  if this tracker 
    │ │ │ -00076580: 6661 696c 6564 2074 6865 206c 6173 7420  failed the last 
    │ │ │ -00076590: 7469 6d65 2069 7420 7761 7320 636f 6e74  time it was cont
    │ │ │ -000765a0: 6163 7465 640a 0909 2f2f 2074 6869 7320  acted...// this 
    │ │ │ -000765b0: 6572 726f 7220 636f 6465 2073 7065 6369  error code speci
    │ │ │ -000765c0: 6669 6573 2077 6861 7420 6572 726f 7220  fies what error 
    │ │ │ -000765d0: 6f63 6375 7272 6564 0a09 0965 7272 6f72  occurred...error
    │ │ │ -000765e0: 5f63 6f64 6520 6c61 7374 5f65 7272 6f72  _code last_error
    │ │ │ -000765f0: 3b0a 0a09 092f 2f20 7468 6520 7469 6d65  ;....// the time
    │ │ │ -00076600: 206f 6620 6e65 7874 2074 7261 636b 6572   of next tracker
    │ │ │ -00076610: 2061 6e6e 6f75 6e63 650a 0909 7469 6d65   announce...time
    │ │ │ -00076620: 5f70 6f69 6e74 3332 206e 6578 745f 616e  _point32 next_an
    │ │ │ -00076630: 6e6f 756e 6365 203d 2028 7469 6d65 5f70  nounce = (time_p
    │ │ │ -00076640: 6f69 6e74 3332 3a3a 6d69 6e29 2829 3b0a  oint32::min)();.
    │ │ │ -00076650: 0a09 092f 2f20 6e6f 2061 6e6e 6f75 6e63  ...// no announc
    │ │ │ -00076660: 6573 2062 6566 6f72 6520 7468 6973 2074  es before this t
    │ │ │ -00076670: 696d 650a 0909 7469 6d65 5f70 6f69 6e74  ime...time_point
    │ │ │ -00076680: 3332 206d 696e 5f61 6e6e 6f75 6e63 6520  32 min_announce 
    │ │ │ -00076690: 3d20 2874 696d 655f 706f 696e 7433 323a  = (time_point32:
    │ │ │ -000766a0: 3a6d 696e 2928 293b 0a0a 3c64 6976 2073  :min)();..
    .
    . │ │ │ -000766e0: 092f 2f20 7468 6573 6520 6172 6520 6569 .// these are ei │ │ │ -000766f0: 7468 6572 202d 3120 6f72 2074 6865 2073 ther -1 or the s │ │ │ -00076700: 6372 6170 6520 696e 666f 726d 6174 696f crape informatio │ │ │ -00076710: 6e20 7468 6973 2074 7261 636b 6572 206c n this tracker l │ │ │ -00076720: 6173 740a 0909 2f2f 2072 6573 706f 6e64 ast...// respond │ │ │ -00076730: 6564 2077 6974 682e 202a 696e 636f 6d70 ed with. *incomp │ │ │ -00076740: 6c65 7465 2a20 6973 2074 6865 2063 7572 lete* is the cur │ │ │ -00076750: 7265 6e74 206e 756d 6265 7220 6f66 2064 rent number of d │ │ │ -00076760: 6f77 6e6c 6f61 6465 7273 2069 6e0a 0909 ownloaders in... │ │ │ -00076770: 2f2f 2074 6865 2073 7761 726d 2c20 2a63 // the swarm, *c │ │ │ -00076780: 6f6d 706c 6574 652a 2069 7320 7468 6520 omplete* is the │ │ │ -00076790: 6375 7272 656e 7420 6e75 6d62 6572 206f current number o │ │ │ -000767a0: 6620 7365 6564 7320 696e 2074 6865 2073 f seeds in the s │ │ │ -000767b0: 7761 726d 2061 6e64 0a09 092f 2f20 2a64 warm and...// *d │ │ │ -000767c0: 6f77 6e6c 6f61 6465 642a 2069 7320 7468 ownloaded* is th │ │ │ -000767d0: 6520 6375 6d75 6c61 7469 7665 206e 756d e cumulative num │ │ │ -000767e0: 6265 7220 6f66 2063 6f6d 706c 6574 6564 ber of completed │ │ │ -000767f0: 2064 6f77 6e6c 6f61 6473 206f 6620 7468 downloads of th │ │ │ -00076800: 6973 0a09 092f 2f20 746f 7272 656e 742c is...// torrent, │ │ │ -00076810: 2073 696e 6365 2074 6865 2062 6567 696e since the begin │ │ │ -00076820: 6e69 6e67 206f 6620 7469 6d65 2028 6672 ning of time (fr │ │ │ -00076830: 6f6d 2074 6869 7320 7472 6163 6b65 7227 om this tracker' │ │ │ -00076840: 7320 706f 696e 7420 6f66 0a09 092f 2f20 s point of...// │ │ │ -00076850: 7669 6577 292e 0a0a 0909 2f2f 2069 6620 view).....// if │ │ │ -00076860: 7468 6973 2074 7261 636b 6572 2068 6173 this tracker has │ │ │ -00076870: 2072 6574 7572 6e65 6420 7363 7261 7065 returned scrape │ │ │ -00076880: 2064 6174 612c 2074 6865 7365 2066 6965 data, these fie │ │ │ -00076890: 6c64 7320 6172 6520 6669 6c6c 6564 2069 lds are filled i │ │ │ -000768a0: 6e0a 0909 2f2f 2077 6974 6820 7661 6c69 n...// with vali │ │ │ -000768b0: 6420 6e75 6d62 6572 732e 204f 7468 6572 d numbers. Other │ │ │ -000768c0: 7769 7365 2074 6865 7920 6172 6520 7365 wise they are se │ │ │ -000768d0: 7420 746f 202d 312e 2060 6069 6e63 6f6d t to -1. ``incom │ │ │ -000768e0: 706c 6574 6560 6020 636f 756e 7473 0a09 plete`` counts.. │ │ │ -000768f0: 092f 2f20 7468 6520 6e75 6d62 6572 206f .// the number o │ │ │ -00076900: 6620 6375 7272 656e 7420 646f 776e 6c6f f current downlo │ │ │ -00076910: 6164 6572 732e 2060 6063 6f6d 706c 6574 aders. ``complet │ │ │ -00076920: 6560 6020 636f 756e 7473 2074 6865 206e e`` counts the n │ │ │ -00076930: 756d 6265 7220 6f66 0a09 092f 2f20 6375 umber of...// cu │ │ │ -00076940: 7272 656e 7420 7065 6572 7320 636f 6d70 rrent peers comp │ │ │ -00076950: 6c65 7465 6420 7468 6520 646f 776e 6c6f leted the downlo │ │ │ -00076960: 6164 2c20 6f72 2022 7365 6564 7322 2e20 ad, or "seeds". │ │ │ -00076970: 6060 646f 776e 6c6f 6164 6564 6060 2069 ``downloaded`` i │ │ │ -00076980: 7320 7468 650a 0909 2f2f 2063 756d 756c s the...// cumul │ │ │ -00076990: 6174 6976 6520 6e75 6d62 6572 206f 6620 ative number of │ │ │ -000769a0: 636f 6d70 6c65 7465 6420 646f 776e 6c6f completed downlo │ │ │ -000769b0: 6164 732e 0a09 0969 6e74 2073 6372 6170 ads....int scrap │ │ │ -000769c0: 655f 696e 636f 6d70 6c65 7465 203d 202d e_incomplete = - │ │ │ -000769d0: 313b 0a09 0969 6e74 2073 6372 6170 655f 1;...int scrape_ │ │ │ -000769e0: 636f 6d70 6c65 7465 203d 202d 313b 0a09 complete = -1;.. │ │ │ -000769f0: 0969 6e74 2073 6372 6170 655f 646f 776e .int scrape_down │ │ │ -00076a00: 6c6f 6164 6564 203d 202d 313b 0a0a 0909 loaded = -1;.... │ │ │ -00076a10: 2f2f 2074 6865 206e 756d 6265 7220 6f66 // the number of │ │ │ -00076a20: 2074 696d 6573 2069 6e20 6120 726f 7720 times in a row │ │ │ -00076a30: 7765 2068 6176 6520 6661 696c 6564 2074 we have failed t │ │ │ -00076a40: 6f20 616e 6e6f 756e 6365 2074 6f20 7468 o announce to th │ │ │ -00076a50: 6973 0a09 092f 2f20 7472 6163 6b65 722e is...// tracker. │ │ │ -00076a60: 0a09 0973 7464 3a3a 7569 6e74 385f 7420 ...std::uint8_t │ │ │ -00076a70: 6661 696c 7320 3a20 373b 0a0a 0909 2f2f fails : 7;....// │ │ │ -00076a80: 2074 7275 6520 7768 696c 6520 7765 2772 true while we'r │ │ │ -00076a90: 6520 7761 6974 696e 6720 666f 7220 6120 e waiting for a │ │ │ -00076aa0: 7265 7370 6f6e 7365 2066 726f 6d20 7468 response from th │ │ │ -00076ab0: 6520 7472 6163 6b65 722e 0a09 0962 6f6f e tracker....boo │ │ │ -00076ac0: 6c20 7570 6461 7469 6e67 203a 2031 3b0a l updating : 1;. │ │ │ -00076ad0: 0a09 092f 2f20 7365 7420 746f 2074 7275 ...// set to tru │ │ │ -00076ae0: 6520 7768 656e 2077 6520 6765 7420 6120 e when we get a │ │ │ -00076af0: 7661 6c69 6420 7265 7370 6f6e 7365 2066 valid response f │ │ │ -00076b00: 726f 6d20 616e 2061 6e6e 6f75 6e63 650a rom an announce. │ │ │ -00076b10: 0909 2f2f 2077 6974 6820 6576 656e 743d ..// with event= │ │ │ -00076b20: 7374 6172 7465 642e 2049 6620 6974 2069 started. If it i │ │ │ -00076b30: 7320 7365 742c 2077 6520 776f 6e27 7420 s set, we won't │ │ │ -00076b40: 7365 6e64 2073 7461 7274 2069 6e20 7468 send start in th │ │ │ -00076b50: 6520 7375 6273 6571 7565 6e74 0a09 092f e subsequent.../ │ │ │ -00076b60: 2f20 616e 6e6f 756e 6365 732e 0a09 0962 / announces....b │ │ │ -00076b70: 6f6f 6c20 7374 6172 745f 7365 6e74 203a ool start_sent : │ │ │ -00076b80: 2031 3b0a 0a09 092f 2f20 7365 7420 746f 1;....// set to │ │ │ -00076b90: 2074 7275 6520 7768 656e 2077 6520 7365 true when we se │ │ │ -00076ba0: 6e64 2061 2065 7665 6e74 3d63 6f6d 706c nd a event=compl │ │ │ -00076bb0: 6574 6564 2e0a 0909 626f 6f6c 2063 6f6d eted....bool com │ │ │ -00076bc0: 706c 6574 655f 7365 6e74 203a 2031 3b0a plete_sent : 1;. │ │ │ -00076bd0: 3c2f 7072 653e 3c2f 7464 3e3c 2f74 723e
    │ │ │ -00076be0: 3c74 7220 7374 796c 653d 2262 6163 6b67 relevance  │ │ │ -00076c10: 303c 2f74 643e 3c74 643e 3c61 2068 7265 0../in │ │ │ -00076c40: 636c 7564 652f 6c69 6274 6f72 7265 6e74 clude/libtorrent │ │ │ -00076c50: 2f73 7472 696e 675f 7669 6577 2e68 7070 /string_view.hpp │ │ │ -00076c60: 3a34 303c 2f61 3e3c 2f74 643e 3c74 643e :40 │ │ │ -00076c70: 7265 706c 6163 6520 7468 6973 2062 7920 replace this by │ │ │ -00076c80: 7468 6520 7374 616e 6461 7264 2073 7472 the standard str │ │ │ -00076c90: 696e 675f 7669 6577 2069 6e20 432b 2b31 ing_view in C++1 │ │ │ -00076ca0: 373c 2f74 643e 3c2f 7472 3e3c 7472 2069 7

    r │ │ │ -00076cf0: 6570 6c61 6365 2074 6869 7320 6279 2074 eplace this by t │ │ │ -00076d00: 6865 2073 7461 6e64 6172 6420 7374 7269 he standard stri │ │ │ -00076d10: 6e67 5f76 6965 7720 696e 2043 2b2b 3137 ng_view in C++17 │ │ │ -00076d20: 3c2f 6832 3e3c 6834 3e2e 2e2f 696e 636c

    ../incl │ │ │ -00076d30: 7564 652f 6c69 6274 6f72 7265 6e74 2f73 ude/libtorrent/s │ │ │ -00076d40: 7472 696e 675f 7669 6577 2e68 7070 3a34 tring_view.hpp:4 │ │ │ -00076d50: 303c 2f68 343e 3c70 7265 2073 7479 6c65 0

    │ │ │ -00076d90: 414e 4420 414e 5920 4558 5052 4553 5320  AND ANY EXPRESS 
    │ │ │ -00076da0: 4f52 2049 4d50 4c49 4544 2057 4152 5241  OR IMPLIED WARRA
    │ │ │ -00076db0: 4e54 4945 532c 2049 4e43 4c55 4449 4e47  NTIES, INCLUDING
    │ │ │ -00076dc0: 2c20 4255 5420 4e4f 5420 4c49 4d49 5445  , BUT NOT LIMITE
    │ │ │ -00076dd0: 4420 544f 2c20 5448 450a 494d 504c 4945  D TO, THE.IMPLIE
    │ │ │ -00076de0: 4420 5741 5252 414e 5449 4553 204f 4620  D WARRANTIES OF 
    │ │ │ -00076df0: 4d45 5243 4841 4e54 4142 494c 4954 5920  MERCHANTABILITY 
    │ │ │ -00076e00: 414e 4420 4649 544e 4553 5320 464f 5220  AND FITNESS FOR 
    │ │ │ -00076e10: 4120 5041 5254 4943 554c 4152 2050 5552  A PARTICULAR PUR
    │ │ │ -00076e20: 504f 5345 0a41 5245 2044 4953 434c 4149  POSE.ARE DISCLAI
    │ │ │ -00076e30: 4d45 442e 2049 4e20 4e4f 2045 5645 4e54  MED. IN NO EVENT
    │ │ │ -00076e40: 2053 4841 4c4c 2054 4845 2043 4f50 5952   SHALL THE COPYR
    │ │ │ -00076e50: 4947 4854 204f 574e 4552 204f 5220 434f  IGHT OWNER OR CO
    │ │ │ -00076e60: 4e54 5249 4255 544f 5253 2042 450a 4c49  NTRIBUTORS BE.LI
    │ │ │ -00076e70: 4142 4c45 2046 4f52 2041 4e59 2044 4952  ABLE FOR ANY DIR
    │ │ │ -00076e80: 4543 542c 2049 4e44 4952 4543 542c 2049  ECT, INDIRECT, I
    │ │ │ -00076e90: 4e43 4944 454e 5441 4c2c 2053 5045 4349  NCIDENTAL, SPECI
    │ │ │ -00076ea0: 414c 2c20 4558 454d 504c 4152 592c 204f  AL, EXEMPLARY, O
    │ │ │ -00076eb0: 520a 434f 4e53 4551 5545 4e54 4941 4c20  R.CONSEQUENTIAL 
    │ │ │ -00076ec0: 4441 4d41 4745 5320 2849 4e43 4c55 4449  DAMAGES (INCLUDI
    │ │ │ -00076ed0: 4e47 2c20 4255 5420 4e4f 5420 4c49 4d49  NG, BUT NOT LIMI
    │ │ │ -00076ee0: 5445 4420 544f 2c20 5052 4f43 5552 454d  TED TO, PROCUREM
    │ │ │ -00076ef0: 454e 5420 4f46 0a53 5542 5354 4954 5554  ENT OF.SUBSTITUT
    │ │ │ -00076f00: 4520 474f 4f44 5320 4f52 2053 4552 5649  E GOODS OR SERVI
    │ │ │ -00076f10: 4345 533b 204c 4f53 5320 4f46 2055 5345  CES; LOSS OF USE
    │ │ │ -00076f20: 2c20 4441 5441 2c20 4f52 2050 524f 4649  , DATA, OR PROFI
    │ │ │ -00076f30: 5453 3b20 4f52 2042 5553 494e 4553 530a  TS; OR BUSINESS.
    │ │ │ -00076f40: 494e 5445 5252 5550 5449 4f4e 2920 484f  INTERRUPTION) HO
    │ │ │ -00076f50: 5745 5645 5220 4341 5553 4544 2041 4e44  WEVER CAUSED AND
    │ │ │ -00076f60: 204f 4e20 414e 5920 5448 454f 5259 204f   ON ANY THEORY O
    │ │ │ -00076f70: 4620 4c49 4142 494c 4954 592c 2057 4845  F LIABILITY, WHE
    │ │ │ -00076f80: 5448 4552 2049 4e0a 434f 4e54 5241 4354  THER IN.CONTRACT
    │ │ │ -00076f90: 2c20 5354 5249 4354 204c 4941 4249 4c49  , STRICT LIABILI
    │ │ │ -00076fa0: 5459 2c20 4f52 2054 4f52 5420 2849 4e43  TY, OR TORT (INC
    │ │ │ -00076fb0: 4c55 4449 4e47 204e 4547 4c49 4745 4e43  LUDING NEGLIGENC
    │ │ │ -00076fc0: 4520 4f52 204f 5448 4552 5749 5345 290a  E OR OTHERWISE).
    │ │ │ -00076fd0: 4152 4953 494e 4720 494e 2041 4e59 2057  ARISING IN ANY W
    │ │ │ -00076fe0: 4159 204f 5554 204f 4620 5448 4520 5553  AY OUT OF THE US
    │ │ │ -00076ff0: 4520 4f46 2054 4849 5320 534f 4654 5741  E OF THIS SOFTWA
    │ │ │ -00077000: 5245 2c20 4556 454e 2049 4620 4144 5649  RE, EVEN IF ADVI
    │ │ │ -00077010: 5345 4420 4f46 2054 4845 0a50 4f53 5349  SED OF THE.POSSI
    │ │ │ -00077020: 4249 4c49 5459 204f 4620 5355 4348 2044  BILITY OF SUCH D
    │ │ │ -00077030: 414d 4147 452e 0a0a 2a2f 0a0a 2369 666e  AMAGE...*/..#ifn
    │ │ │ -00077040: 6465 6620 544f 5252 454e 545f 5354 5249  def TORRENT_STRI
    │ │ │ -00077050: 4e47 5f56 4945 575f 4850 505f 494e 434c  NG_VIEW_HPP_INCL
    │ │ │ -00077060: 5544 4544 0a23 6465 6669 6e65 2054 4f52  UDED.#define TOR
    │ │ │ -00077070: 5245 4e54 5f53 5452 494e 475f 5649 4557  RENT_STRING_VIEW
    │ │ │ -00077080: 5f48 5050 5f49 4e43 4c55 4445 440a 0a23  _HPP_INCLUDED..#
    │ │ │ -00077090: 696e 636c 7564 6520 266c 743b 626f 6f73  include <boos
    │ │ │ -000770a0: 742f 7665 7273 696f 6e2e 6870 7026 6774  t/version.hpp>
    │ │ │ -000770b0: 3b0a 0a23 696e 636c 7564 6520 226c 6962  ;..#include "lib
    │ │ │ -000770c0: 746f 7272 656e 742f 6175 785f 2f64 6973  torrent/aux_/dis
    │ │ │ -000770d0: 6162 6c65 5f77 6172 6e69 6e67 735f 7075  able_warnings_pu
    │ │ │ -000770e0: 7368 2e68 7070 220a 0a3c 6469 7620 7374  sh.hpp"..
    .
    #i │ │ │ -00077120: 6620 424f 4f53 545f 5645 5253 494f 4e20 f BOOST_VERSION │ │ │ -00077130: 266c 743b 2031 3036 3130 300a 2369 6e63 < 106100.#inc │ │ │ -00077140: 6c75 6465 2026 6c74 3b62 6f6f 7374 2f75 lude <boost/u │ │ │ -00077150: 7469 6c69 7479 2f73 7472 696e 675f 7265 tility/string_re │ │ │ -00077160: 662e 6870 7026 6774 3b0a 2369 6e63 6c75 f.hpp>.#inclu │ │ │ -00077170: 6465 2026 6c74 3b63 7374 7269 6e67 2667 de <cstring&g │ │ │ -00077180: 743b 202f 2f20 666f 7220 7374 7263 6872 t; // for strchr │ │ │ -00077190: 0a6e 616d 6573 7061 6365 206c 6962 746f .namespace libto │ │ │ -000771a0: 7272 656e 7420 7b0a 0a75 7369 6e67 2073 rrent {..using s │ │ │ -000771b0: 7472 696e 675f 7669 6577 203d 2062 6f6f tring_view = boo │ │ │ -000771c0: 7374 3a3a 7374 7269 6e67 5f72 6566 3b0a st::string_ref;. │ │ │ -000771d0: 7573 696e 6720 7773 7472 696e 675f 7669 using wstring_vi │ │ │ -000771e0: 6577 203d 2062 6f6f 7374 3a3a 7773 7472 ew = boost::wstr │ │ │ -000771f0: 696e 675f 7265 663b 0a0a 2f2f 2069 6e74 ing_ref;..// int │ │ │ -00077200: 6572 6e61 6c0a 696e 6c69 6e65 2073 7472 ernal.inline str │ │ │ -00077210: 696e 675f 7669 6577 3a3a 7369 7a65 5f74 ing_view::size_t │ │ │ -00077220: 7970 6520 6669 6e64 5f66 6972 7374 5f6f ype find_first_o │ │ │ -00077230: 6628 7374 7269 6e67 5f76 6965 7720 636f f(string_view co │ │ │ -00077240: 6e73 7420 762c 2063 6861 7220 636f 6e73 nst v, char cons │ │ │ -00077250: 7420 630a 092c 2073 7472 696e 675f 7669 t c.., string_vi │ │ │ -00077260: 6577 3a3a 7369 7a65 5f74 7970 6520 706f ew::size_type po │ │ │ -00077270: 7329 0a7b 0a09 7768 696c 6520 2870 6f73 s).{..while (pos │ │ │ -00077280: 2026 6c74 3b20 762e 7369 7a65 2829 290a < v.size()). │ │ │ -00077290: 097b 0a09 0969 6620 2876 5b70 6f73 5d20 .{...if (v[pos] │ │ │ -000772a0: 3d3d 2063 2920 7265 7475 726e 2070 6f73 == c) return pos │ │ │ -000772b0: 3b0a 0909 2b2b 706f 733b 0a09 7d0a 0972 ;...++pos;..}..r │ │ │ -000772c0: 6574 7572 6e20 7374 7269 6e67 5f76 6965 eturn string_vie │ │ │ -000772d0: 773a 3a6e 706f 733b 0a7d 0a0a 2f2f 2069 w::npos;.}..// i │ │ │ -000772e0: 6e74 6572 6e61 6c0a 696e 6c69 6e65 2073 nternal.inline s │ │ │ -000772f0: 7472 696e 675f 7669 6577 3a3a 7369 7a65 tring_view::size │ │ │ -00077300: 5f74 7970 6520 6669 6e64 5f66 6972 7374 _type find_first │ │ │ -00077310: 5f6f 6628 7374 7269 6e67 5f76 6965 7720 _of(string_view │ │ │ -00077320: 636f 6e73 7420 762c 2063 6861 7220 636f const v, char co │ │ │ -00077330: 6e73 742a 2063 0a09 2c20 7374 7269 6e67 nst* c.., string │ │ │ -00077340: 5f76 6965 773a 3a73 697a 655f 7479 7065 _view::size_type │ │ │ -00077350: 2070 6f73 290a 7b0a 0977 6869 6c65 2028 pos).{..while ( │ │ │ -00077360: 706f 7320 266c 743b 2076 2e73 697a 6528 pos < v.size( │ │ │ -00077370: 2929 0a09 7b0a 0909 6966 2028 7374 643a ))..{...if (std: │ │ │ -00077380: 3a73 7472 6368 7228 632c 2076 5b70 6f73 :strchr(c, v[pos │ │ │ -00077390: 5d29 2021 3d20 6e75 6c6c 7074 7229 2072 ]) != nullptr) r │ │ │ -000773a0: 6574 7572 6e20 706f 733b 0a09 092b 2b70 eturn pos;...++p │ │ │ -000773b0: 6f73 3b0a 097d 0a09 7265 7475 726e 2073 os;..}..return s │ │ │ -000773c0: 7472 696e 675f 7669 6577 3a3a 6e70 6f73 tring_view::npos │ │ │ -000773d0: 3b0a 3c2f 7072 653e 3c2f 7464 3e3c 2f74 ;.
    < │ │ │ -00077400: 7464 3e72 656c 6576 616e 6365 266e 6273 td>relevance&nbs │ │ │ -00077410: 703b 303c 2f74 643e 3c74 643e 3c61 2068 p;0../ │ │ │ -00077440: 696e 636c 7564 652f 6c69 6274 6f72 7265 include/libtorre │ │ │ -00077450: 6e74 2f70 6565 725f 636f 6e6e 6563 7469 nt/peer_connecti │ │ │ -00077460: 6f6e 2e68 7070 3a32 3138 3c2f 613e 3c2f on.hpp:218make this │ │ │ -00077480: 2061 2072 6177 2070 6f69 6e74 6572 2028 a raw pointer ( │ │ │ -00077490: 746f 2073 6176 6520 7369 7a65 2069 6e20 to save size in │ │ │ -000774a0: 7468 6520 6669 7273 7420 6361 6368 6520 the first cache │ │ │ -000774b0: 6c69 6e65 2920 616e 6420 6d61 6b65 2074 line) and make t │ │ │ -000774c0: 6865 2063 6f6e 7374 7275 6374 6f72 2074 he constructor t │ │ │ -000774d0: 616b 6520 6120 7261 7720 706f 696e 7465 ake a raw pointe │ │ │ -000774e0: 722e 2074 6f72 7265 6e74 206f 626a 6563 r. torrent objec │ │ │ -000774f0: 7473 2073 686f 756c 6420 616c 7761 7973 ts should always │ │ │ -00077500: 206f 7574 6c69 7665 2074 6865 6972 2070 outlive their p │ │ │ -00077510: 6565 7273 3c2f 7464 3e3c 2f74 723e 3c74 eersmake this a ra │ │ │ -00077570: 7720 706f 696e 7465 7220 2874 6f20 7361 w pointer (to sa │ │ │ -00077580: 7665 2073 697a 6520 696e 0a74 6865 2066 ve size in.the f │ │ │ -00077590: 6972 7374 2063 6163 6865 206c 696e 6529 irst cache line) │ │ │ -000775a0: 2061 6e64 206d 616b 6520 7468 6520 636f and make the co │ │ │ -000775b0: 6e73 7472 7563 746f 720a 7461 6b65 2061 nstructor.take a │ │ │ -000775c0: 2072 6177 2070 6f69 6e74 6572 2e20 746f raw pointer. to │ │ │ -000775d0: 7272 656e 7420 6f62 6a65 6374 7320 7368 rrent objects sh │ │ │ -000775e0: 6f75 6c64 2061 6c77 6179 730a 6f75 746c ould always.outl │ │ │ -000775f0: 6976 6520 7468 6569 7220 7065 6572 733c ive their peers< │ │ │ -00077600: 2f68 323e 3c68 343e 2e2e 2f69 6e63 6c75 /h2>

    ../inclu │ │ │ -00077610: 6465 2f6c 6962 746f 7272 656e 742f 7065 de/libtorrent/pe │ │ │ -00077620: 6572 5f63 6f6e 6e65 6374 696f 6e2e 6870 er_connection.hp │ │ │ -00077630: 703a 3231 383c 2f68 343e 3c70 7265 2073 p:218

    ..., m_snubb
    │ │ │ -00077680: 6564 2866 616c 7365 290a 0909 092c 206d  ed(false)...., m
    │ │ │ -00077690: 5f69 6e74 6572 6573 7469 6e67 2866 616c  _interesting(fal
    │ │ │ -000776a0: 7365 290a 0909 092c 206d 5f63 686f 6b65  se)...., m_choke
    │ │ │ -000776b0: 6428 7472 7565 290a 0909 092c 206d 5f69  d(true)...., m_i
    │ │ │ -000776c0: 676e 6f72 655f 7374 6174 7328 6661 6c73  gnore_stats(fals
    │ │ │ -000776d0: 6529 0a09 097b 7d0a 0a09 092f 2f20 6578  e)...{}....// ex
    │ │ │ -000776e0: 706c 6963 6974 6c79 2064 6973 616c 6c6f  plicitly disallo
    │ │ │ -000776f0: 7720 6173 7369 676e 6d65 6e74 2c20 746f  w assignment, to
    │ │ │ -00077700: 2073 696c 656e 6365 206d 7376 6320 7761   silence msvc wa
    │ │ │ -00077710: 726e 696e 670a 0909 7065 6572 5f63 6f6e  rning...peer_con
    │ │ │ -00077720: 6e65 6374 696f 6e5f 686f 745f 6d65 6d62  nection_hot_memb
    │ │ │ -00077730: 6572 7326 616d 703b 206f 7065 7261 746f  ers& operato
    │ │ │ -00077740: 723d 2870 6565 725f 636f 6e6e 6563 7469  r=(peer_connecti
    │ │ │ -00077750: 6f6e 5f68 6f74 5f6d 656d 6265 7273 2063  on_hot_members c
    │ │ │ -00077760: 6f6e 7374 2661 6d70 3b29 203d 2064 656c  onst&) = del
    │ │ │ -00077770: 6574 653b 0a0a 0970 726f 7465 6374 6564  ete;...protected
    │ │ │ -00077780: 3a0a 0a09 092f 2f20 7468 6520 7069 6563  :....// the piec
    │ │ │ -00077790: 6573 2074 6865 206f 7468 6572 2065 6e64  es the other end
    │ │ │ -000777a0: 2068 6176 650a 0909 7479 7065 645f 6269   have...typed_bi
    │ │ │ -000777b0: 7466 6965 6c64 266c 743b 7069 6563 655f  tfield<piece_
    │ │ │ -000777c0: 696e 6465 785f 7426 6774 3b20 6d5f 6861  index_t> m_ha
    │ │ │ -000777d0: 7665 5f70 6965 6365 3b0a 0a09 092f 2f20  ve_piece;....// 
    │ │ │ -000777e0: 7468 6973 2069 7320 7468 6520 746f 7272  this is the torr
    │ │ │ -000777f0: 656e 7420 7468 6973 2063 6f6e 6e65 6374  ent this connect
    │ │ │ -00077800: 696f 6e20 6973 0a09 092f 2f20 6173 736f  ion is...// asso
    │ │ │ -00077810: 6369 6174 6564 2077 6974 682e 2049 6620  ciated with. If 
    │ │ │ -00077820: 7468 6520 636f 6e6e 6563 7469 6f6e 2069  the connection i
    │ │ │ -00077830: 7320 616e 0a09 092f 2f20 696e 636f 6d69  s an...// incomi
    │ │ │ -00077840: 6e67 2063 6f6e 6e65 6374 696f 6e2c 2074  ng connection, t
    │ │ │ -00077850: 6869 7320 6973 2073 6574 2074 6f20 7a65  his is set to ze
    │ │ │ -00077860: 726f 0a09 092f 2f20 756e 7469 6c20 7468  ro...// until th
    │ │ │ -00077870: 6520 696e 666f 5f68 6173 6820 6973 2072  e info_hash is r
    │ │ │ -00077880: 6563 6569 7665 642e 2054 6865 6e20 6974  eceived. Then it
    │ │ │ -00077890: 2773 0a09 092f 2f20 7365 7420 746f 2074  's...// set to t
    │ │ │ -000778a0: 6865 2074 6f72 7265 6e74 2069 7420 6265  he torrent it be
    │ │ │ -000778b0: 6c6f 6e67 7320 746f 2e0a 0a3c 6469 7620  longs to...
    ..std:: │ │ │ -000778f0: 7765 616b 5f70 7472 266c 743b 746f 7272 weak_ptr<torr │ │ │ -00077900: 656e 7426 6774 3b20 6d5f 746f 7272 656e ent> m_torren │ │ │ -00077910: 743b 0a3c 2f64 6976 3e0a 0970 7562 6c69 t;.
    ..publi │ │ │ -00077920: 633a 0a0a 0909 2f2f 2061 2062 6163 6b20 c:....// a back │ │ │ -00077930: 7265 6665 7265 6e63 6520 746f 2074 6865 reference to the │ │ │ -00077940: 2073 6573 7369 6f6e 0a09 092f 2f20 7468 session...// th │ │ │ -00077950: 6520 7065 6572 2062 656c 6f6e 6773 2074 e peer belongs t │ │ │ -00077960: 6f2e 0a09 0961 7578 3a3a 7365 7373 696f o....aux::sessio │ │ │ -00077970: 6e5f 696e 7465 7266 6163 6526 616d 703b n_interface& │ │ │ -00077980: 206d 5f73 6573 3b0a 0a09 092f 2f20 7365 m_ses;....// se │ │ │ -00077990: 7474 696e 6773 2074 6861 7420 6170 706c ttings that appl │ │ │ -000779a0: 7920 746f 2074 6869 7320 7065 6572 0a09 y to this peer.. │ │ │ -000779b0: 0961 7578 3a3a 7365 7373 696f 6e5f 7365 .aux::session_se │ │ │ -000779c0: 7474 696e 6773 2063 6f6e 7374 2661 6d70 ttings const& │ │ │ -000779d0: 3b20 6d5f 7365 7474 696e 6773 3b0a 0a09 ; m_settings;... │ │ │ -000779e0: 7072 6f74 6563 7465 643a 0a0a 0909 2f2f protected:....// │ │ │ -000779f0: 2074 6869 7320 6973 2074 7275 6520 6966 this is true if │ │ │ -00077a00: 2074 6869 7320 636f 6e6e 6563 7469 6f6e this connection │ │ │ -00077a10: 2068 6173 2062 6565 6e20 6164 6465 640a has been added. │ │ │ -00077a20: 0909 2f2f 2074 6f20 7468 6520 6c69 7374 ..// to the list │ │ │ -00077a30: 206f 6620 636f 6e6e 6563 7469 6f6e 7320 of connections │ │ │ -00077a40: 7468 6174 2077 696c 6c20 6265 2063 6c6f that will be clo │ │ │ -00077a50: 7365 642e 0a09 0962 6f6f 6c20 6d5f 6469 sed....bool m_di │ │ │ -00077a60: 7363 6f6e 6e65 6374 696e 673a 313b 0a0a sconnecting:1;.. │ │ │ -00077a70: 0909 2f2f 2074 6869 7320 6973 2074 7275 ..// this is tru │ │ │ -00077a80: 6520 756e 7469 6c20 7468 6973 2073 6f63 e until this soc │ │ │ -00077a90: 6b65 7420 6861 7320 6265 636f 6d65 0a09 ket has become.. │ │ │ -00077aa0: 092f 2f20 7772 6974 6162 6c65 2066 6f72 .// writable for │ │ │ -00077ab0: 2074 6865 2066 6972 7374 2074 696d 6520 the first time │ │ │ -00077ac0: 2869 2e65 2e20 7468 650a 0909 2f2f 2063 (i.e. the...// c │ │ │ -00077ad0: 6f6e 6e65 6374 696f 6e20 636f 6d70 6c65 onnection comple │ │ │ -00077ae0: 7465 6429 2e20 5768 696c 6520 636f 6e6e ted). While conn │ │ │ -00077af0: 6563 7469 6e67 0a09 092f 2f20 7468 6520 ecting...// the │ │ │ -00077b00: 7469 6d65 6f75 7420 7769 6c6c 206e 6f74 timeout will not │ │ │ -00077b10: 2062 6520 7472 6967 6765 7265 642e 2054 be triggered. T │ │ │ -00077b20: 6869 7320 6973 0a09 092f 2f20 6265 6361 his is...// beca │ │ │ -00077b30: 7573 6520 7769 6e64 6f77 7320 5850 2053 use windows XP S │ │ │ -00077b40: 5032 206d 6179 2064 656c 6179 2063 6f6e P2 may delay con │ │ │ -00077b50: 6e65 6374 696f 6e0a 0909 2f2f 2061 7474 nection...// att │ │ │ -00077b60: 656d 7074 732c 2077 6869 6368 206d 6561 empts, which mea │ │ │ -00077b70: 6e73 2074 6861 7420 7468 6520 636f 6e6e ns that the conn │ │ │ -00077b80: 6563 7469 6f6e 0a09 092f 2f20 6d61 7920 ection...// may │ │ │ -00077b90: 6e6f 7420 6576 656e 2068 6176 6520 6265 not even have be │ │ │ -00077ba0: 656e 2061 7474 656d 7074 6564 2077 6865 en attempted whe │ │ │ -00077bb0: 6e20 7468 650a 0909 2f2f 2074 696d 6520 n the...// time │ │ │ -00077bc0: 6f75 7420 6973 2072 6561 6368 6564 2e0a out is reached.. │ │ │ -00077bd0: 0909 626f 6f6c 206d 5f63 6f6e 6e65 6374 ..bool m_connect │ │ │ -00077be0: 696e 673a 313b 0a0a 0909 2f2f 2074 6869 ing:1;....// thi │ │ │ -00077bf0: 7320 6973 2073 6574 2074 6f20 7472 7565 s is set to true │ │ │ -00077c00: 2069 6620 7468 6520 6c61 7374 2074 696d if the last tim │ │ │ -00077c10: 6520 7765 2074 7269 6564 2074 6f0a 0909 e we tried to... │ │ │ -00077c20: 2f2f 2070 6963 6b20 6120 7069 6563 6520 // pick a piece │ │ │ -00077c30: 746f 2064 6f77 6e6c 6f61 642c 2077 6520 to download, we │ │ │ -00077c40: 636f 756c 6420 6f6e 6c79 2066 696e 640a could only find. │ │ │ -00077c50: 0909 2f2f 2062 6c6f 636b 7320 7468 6174 ..// blocks that │ │ │ -00077c60: 2077 6572 6520 616c 7265 6164 7920 7265 were already re │ │ │ -00077c70: 7175 6573 7465 6420 6672 6f6d 206f 7468 quested from oth │ │ │ -00077c80: 6572 0a09 092f 2f20 7065 6572 732e 2049 er...// peers. I │ │ │ -00077c90: 6e20 7468 6973 2063 6173 652c 2077 6520 n this case, we │ │ │ -00077ca0: 7368 6f75 6c64 206e 6f74 2074 7279 2074 should not try t │ │ │ -00077cb0: 6f20 7069 636b 0a3c 2f70 7265 3e3c 2f74 o pick.
    relevanc │ │ │ -00077cf0: 6526 6e62 7370 3b30 3c2f 7464 3e3c 7464 e 0../include/lib │ │ │ -00077d30: 746f 7272 656e 742f 7065 6572 5f63 6f6e torrent/peer_con │ │ │ -00077d40: 6e65 6374 696f 6e2e 6870 703a 3130 3236 nection.hpp:1026 │ │ │ -00077d50: 3c2f 613e 3c2f 7464 3e3c 7464 3e66 6163 fac │ │ │ -00077d60: 746f 7220 7468 6973 206f 7574 2069 6e74 tor this out int │ │ │ -00077d70: 6f20 6974 7320 6f77 6e20 636c 6173 7320 o its own class │ │ │ -00077d80: 7769 7468 2061 2076 6972 7475 616c 2069 with a virtual i │ │ │ -00077d90: 6e74 6572 6661 6365 2074 6f72 7265 6e74 nterface torrent │ │ │ -00077da0: 2061 6e64 2073 6573 7369 6f6e 2073 686f and session sho │ │ │ -00077db0: 756c 6420 696d 706c 656d 656e 7420 7468 uld implement th │ │ │ -00077dc0: 6973 2069 6e74 6572 6661 6365 3c2f 7464 is interface

    factor │ │ │ -00077e20: 2074 6869 7320 6f75 7420 696e 746f 2069 this out into i │ │ │ -00077e30: 7473 206f 776e 2063 6c61 7373 2077 6974 ts own class wit │ │ │ -00077e40: 6820 6120 7669 7274 7561 6c20 696e 7465 h a virtual inte │ │ │ -00077e50: 7266 6163 650a 746f 7272 656e 7420 616e rface.torrent an │ │ │ -00077e60: 6420 7365 7373 696f 6e20 7368 6f75 6c64 d session should │ │ │ -00077e70: 2069 6d70 6c65 6d65 6e74 2074 6869 7320 implement this │ │ │ -00077e80: 696e 7465 7266 6163 653c 2f68 323e 3c68 interface

    ../include/lib │ │ │ -00077ea0: 746f 7272 656e 742f 7065 6572 5f63 6f6e torrent/peer_con │ │ │ -00077eb0: 6e65 6374 696f 6e2e 6870 703a 3130 3236 nection.hpp:1026 │ │ │ -00077ec0: 3c2f 6834 3e3c 7072 6520 7374 796c 653d
    .
    │ │ │ -00077f00: 0909 2f2f 2074 6865 206c 6f63 616c 2065  ..// the local e
    │ │ │ -00077f10: 6e64 706f 696e 7420 666f 7220 7468 6973  ndpoint for this
    │ │ │ -00077f20: 2070 6565 722c 2069 2e65 2e20 6f75 7220   peer, i.e. our 
    │ │ │ -00077f30: 6164 6472 6573 730a 0909 2f2f 2061 6e64  address...// and
    │ │ │ -00077f40: 206f 7572 2070 6f72 742e 2049 6620 7468   our port. If th
    │ │ │ -00077f50: 6973 2069 7320 7365 7420 666f 7220 6f75  is is set for ou
    │ │ │ -00077f60: 7467 6f69 6e67 2063 6f6e 6e65 6374 696f  tgoing connectio
    │ │ │ -00077f70: 6e73 0a09 092f 2f20 6265 666f 7265 2074  ns...// before t
    │ │ │ -00077f80: 6865 2063 6f6e 6e65 6374 696f 6e20 636f  he connection co
    │ │ │ -00077f90: 6d70 6c65 7465 732c 2069 7420 6d65 616e  mpletes, it mean
    │ │ │ -00077fa0: 7320 7765 2077 616e 7420 746f 0a09 092f  s we want to.../
    │ │ │ -00077fb0: 2f20 666f 7263 6520 7468 6520 636f 6e6e  / force the conn
    │ │ │ -00077fc0: 6563 7469 6f6e 2074 6f20 6265 2062 6f75  ection to be bou
    │ │ │ -00077fd0: 6e64 2074 6f20 7468 6520 7370 6563 6966  nd to the specif
    │ │ │ -00077fe0: 6965 6420 696e 7465 7266 6163 652e 0a09  ied interface...
    │ │ │ -00077ff0: 092f 2f20 6966 2069 7420 656e 6473 2075  .// if it ends u
    │ │ │ -00078000: 7020 6265 696e 6720 626f 756e 6420 746f  p being bound to
    │ │ │ -00078010: 2061 2064 6966 6665 7265 6e74 206c 6f63   a different loc
    │ │ │ -00078020: 616c 2049 502c 2074 6865 2063 6f6e 6e65  al IP, the conne
    │ │ │ -00078030: 6374 696f 6e0a 0909 2f2f 2069 7320 636c  ction...// is cl
    │ │ │ -00078040: 6f73 6564 2e0a 0909 7463 703a 3a65 6e64  osed....tcp::end
    │ │ │ -00078050: 706f 696e 7420 6d5f 6c6f 6361 6c3b 0a0a  point m_local;..
    │ │ │ -00078060: 0909 2f2f 2072 656d 6f74 6520 7065 6572  ..// remote peer
    │ │ │ -00078070: 2773 2069 640a 0909 7065 6572 5f69 6420  's id...peer_id 
    │ │ │ -00078080: 6d5f 7065 6572 5f69 643b 0a0a 0970 726f  m_peer_id;...pro
    │ │ │ -00078090: 7465 6374 6564 3a0a 0a09 0974 656d 706c  tected:....templ
    │ │ │ -000780a0: 6174 6520 266c 743b 7479 7065 6e61 6d65  ate <typename
    │ │ │ -000780b0: 2046 756e 2c20 7479 7065 6e61 6d65 2e2e   Fun, typename..
    │ │ │ -000780c0: 2e20 4172 6773 2667 743b 0a09 0976 6f69  . Args>...voi
    │ │ │ -000780d0: 6420 7772 6170 2846 756e 2066 2c20 4172  d wrap(Fun f, Ar
    │ │ │ -000780e0: 6773 2661 6d70 3b26 616d 703b 2e2e 2e20  gs&&... 
    │ │ │ -000780f0: 6129 3b0a 0a09 092f 2f20 7374 6174 6973  a);....// statis
    │ │ │ -00078100: 7469 6373 2061 626f 7574 2075 706c 6f61  tics about uploa
    │ │ │ -00078110: 6420 616e 6420 646f 776e 6c6f 6164 2073  d and download s
    │ │ │ -00078120: 7065 6564 730a 0909 2f2f 2061 6e64 2074  peeds...// and t
    │ │ │ -00078130: 6f74 616c 2061 6d6f 756e 7420 6f66 2075  otal amount of u
    │ │ │ -00078140: 706c 6f61 6473 2061 6e64 2064 6f77 6e6c  ploads and downl
    │ │ │ -00078150: 6f61 6473 2066 6f72 0a09 092f 2f20 7468  oads for...// th
    │ │ │ -00078160: 6973 2070 6565 720a 3c64 6976 2073 7479  is peer.
    ..stat m_s │ │ │ -000781a0: 7461 7469 7374 6963 733b 0a3c 2f64 6976 tatistics;.
    ...// the numbe │ │ │ -000781c0: 7220 6f66 206f 7574 7374 616e 6469 6e67 r of outstanding │ │ │ -000781d0: 2062 7974 6573 2065 7870 6563 7465 640a bytes expected. │ │ │ -000781e0: 0909 2f2f 2074 6f20 6265 2072 6563 6569 ..// to be recei │ │ │ -000781f0: 7665 6420 6279 2065 7874 656e 7369 6f6e ved by extension │ │ │ -00078200: 730a 0909 696e 7420 6d5f 6578 7465 6e73 s...int m_extens │ │ │ -00078210: 696f 6e5f 6f75 7473 7461 6e64 696e 675f ion_outstanding_ │ │ │ -00078220: 6279 7465 7320 3d20 303b 0a0a 0909 2f2f bytes = 0;....// │ │ │ -00078230: 2074 6865 206e 756d 6265 7220 6f66 2074 the number of t │ │ │ -00078240: 696d 6520 6372 6974 6963 616c 2072 6571 ime critical req │ │ │ -00078250: 7565 7374 730a 0909 2f2f 2071 7565 7565 uests...// queue │ │ │ -00078260: 6420 7570 2069 6e20 7468 6520 6d5f 7265 d up in the m_re │ │ │ -00078270: 7175 6573 745f 7175 6575 6520 7468 6174 quest_queue that │ │ │ -00078280: 0a09 092f 2f20 736f 6f6e 2077 696c 6c20 ...// soon will │ │ │ -00078290: 6265 2063 6f6d 6d69 7474 6564 2074 6f20 be committed to │ │ │ -000782a0: 7468 6520 646f 776e 6c6f 6164 0a09 092f the download.../ │ │ │ -000782b0: 2f20 7175 6575 652e 2054 6869 7320 6973 / queue. This is │ │ │ -000782c0: 2069 6e63 6c75 6465 6420 696e 2064 6f77 included in dow │ │ │ -000782d0: 6e6c 6f61 645f 7175 6575 655f 7469 6d65 nload_queue_time │ │ │ -000782e0: 2829 0a09 092f 2f20 736f 2074 6861 7420 ()...// so that │ │ │ -000782f0: 6974 2063 616e 2062 6520 7573 6564 2077 it can be used w │ │ │ -00078300: 6869 6c65 2061 6464 696e 6720 6d6f 7265 hile adding more │ │ │ -00078310: 0a09 092f 2f20 7265 7175 6573 7473 2061 ...// requests a │ │ │ -00078320: 6e64 2074 616b 6520 7468 6520 7072 6576 nd take the prev │ │ │ -00078330: 696f 7573 2072 6571 7565 7374 730a 0909 ious requests... │ │ │ -00078340: 2f2f 2069 6e74 6f20 6163 636f 756e 7420 // into account │ │ │ -00078350: 7769 7468 6f75 7420 7375 626d 6974 7469 without submitti │ │ │ -00078360: 6e67 2069 7420 616c 6c0a 0909 2f2f 2069 ng it all...// i │ │ │ -00078370: 6d6d 6564 6961 7465 6c79 0a09 0973 7464 mmediately...std │ │ │ -00078380: 3a3a 7569 6e74 3136 5f74 206d 5f71 7565 ::uint16_t m_que │ │ │ -00078390: 7565 645f 7469 6d65 5f63 7269 7469 6361 ued_time_critica │ │ │ -000783a0: 6c20 3d20 303b 0a0a 0909 2f2f 2074 6865 l = 0;....// the │ │ │ -000783b0: 206e 756d 6265 7220 6f66 2062 7974 6573 number of bytes │ │ │ -000783c0: 2077 6520 6172 6520 6375 7272 656e 746c we are currentl │ │ │ -000783d0: 7920 7265 6164 696e 670a 0909 2f2f 2066 y reading...// f │ │ │ -000783e0: 726f 6d20 6469 736b 2c20 7468 6174 2077 rom disk, that w │ │ │ -000783f0: 696c 6c20 6265 2061 6464 6564 2074 6f20 ill be added to │ │ │ -00078400: 7468 6520 7365 6e64 0a09 092f 2f20 6275 the send...// bu │ │ │ -00078410: 6666 6572 2061 7320 736f 6f6e 2061 7320 ffer as soon as │ │ │ -00078420: 7468 6579 2063 6f6d 706c 6574 650a 0909 they complete... │ │ │ -00078430: 696e 7420 6d5f 7265 6164 696e 675f 6279 int m_reading_by │ │ │ -00078440: 7465 7320 3d20 303b 0a0a 0909 2f2f 206f tes = 0;....// o │ │ │ -00078450: 7074 696f 6e73 2075 7365 6420 666f 7220 ptions used for │ │ │ -00078460: 7468 6520 7069 6563 6520 7069 636b 6572 the piece picker │ │ │ -00078470: 2e20 5468 6573 6520 666c 6167 7320 7769 . These flags wi │ │ │ -00078480: 6c6c 0a09 092f 2f20 6265 2061 7567 6d65 ll...// be augme │ │ │ -00078490: 6e74 6564 2077 6974 6820 666c 6167 7320 nted with flags │ │ │ -000784a0: 636f 6e74 726f 6c6c 6564 2062 7920 6f74 controlled by ot │ │ │ -000784b0: 6865 7220 7365 7474 696e 6773 0a09 092f her settings.../ │ │ │ -000784c0: 2f20 6c69 6b65 2073 6571 7565 6e74 6961 / like sequentia │ │ │ -000784d0: 6c20 646f 776e 6c6f 6164 2065 7463 2e20 l download etc. │ │ │ -000784e0: 5468 6573 6520 6172 6520 6865 7265 2074 These are here t │ │ │ -000784f0: 6f0a 0909 2f2f 206c 6574 2070 6c75 6769 o...// let plugi │ │ │ -00078500: 6e73 2063 6f6e 7472 6f6c 2066 6c61 6773 ns control flags │ │ │ -00078510: 2074 6861 7420 7368 6f75 6c64 2061 6c77 that should alw │ │ │ -00078520: 6179 7320 6265 2073 6574 0a09 0970 6963 ays be set...pic │ │ │ -00078530: 6b65 725f 6f70 7469 6f6e 735f 7420 6d5f ker_options_t m_ │ │ │ -00078540: 7069 636b 6572 5f6f 7074 696f 6e73 7b7d picker_options{} │ │ │ -00078550: 3b0a 0a09 092f 2f20 7468 6520 6e75 6d62 ;....// the numb │ │ │ -00078560: 6572 206f 6620 696e 7661 6c69 6420 7069 er of invalid pi │ │ │ -00078570: 6563 652d 7265 7175 6573 7473 0a09 092f ece-requests.../ │ │ │ -00078580: 2f20 7765 2068 6176 6520 676f 7420 6672 / we have got fr │ │ │ -00078590: 6f6d 2074 6869 7320 7065 6572 2e20 4966 om this peer. If │ │ │ -000785a0: 2074 6865 2072 6571 7565 7374 0a09 092f the request.../ │ │ │ -000785b0: 2f20 7175 6575 6520 6765 7473 2065 6d70 / queue gets emp │ │ │ -000785c0: 7479 2c20 616e 6420 7468 6572 6520 6861 ty, and there ha │ │ │ -000785d0: 7665 2062 6565 6e0a 0909 2f2f 2069 6e76 ve been...// inv │ │ │ -000785e0: 616c 6964 2072 6571 7565 7374 732c 2077 alid requests, w │ │ │ -000785f0: 6520 6361 6e20 6173 7375 6d65 2074 6865 e can assume the │ │ │ +0006d310: 6274 6f72 7265 6e74 2f61 6e6e 6f75 6e63 btorrent/announc │ │ │ +0006d320: 655f 656e 7472 792e 6870 703a 3736 3c2f e_entry.hpp:76inclu │ │ │ +0006d340: 6465 2074 6865 206e 756d 6265 7220 6f66 de the number of │ │ │ +0006d350: 2070 6565 7273 2072 6563 6569 7665 6420 peers received │ │ │ +0006d360: 6672 6f6d 2074 6869 7320 7472 6163 6b65 from this tracke │ │ │ +0006d370: 722c 2061 7420 6c61 7374 2061 6e6e 6f75 r, at last annou │ │ │ +0006d380: 6e63 653c 2f74 643e 3c2f 7472 3e3c 7472 nce

    include the num │ │ │ +0006d3e0: 6265 7220 6f66 2070 6565 7273 2072 6563 ber of peers rec │ │ │ +0006d3f0: 6569 7665 6420 6672 6f6d 2074 6869 7320 eived from this │ │ │ +0006d400: 7472 6163 6b65 722c 2061 7420 6c61 7374 tracker, at last │ │ │ +0006d410: 0a61 6e6e 6f75 6e63 653c 2f68 323e 3c68 .announce

    ../include/lib │ │ │ +0006d430: 746f 7272 656e 742f 616e 6e6f 756e 6365 torrent/announce │ │ │ +0006d440: 5f65 6e74 7279 2e68 7070 3a37 363c 2f68 _entry.hpp:76
    ..st
    │ │ │ +0006d490: 7275 6374 2054 4f52 5245 4e54 5f45 5850  ruct TORRENT_EXP
    │ │ │ +0006d4a0: 4f52 5420 616e 6e6f 756e 6365 5f69 6e66  ORT announce_inf
    │ │ │ +0006d4b0: 6f68 6173 680a 097b 0a09 092f 2f20 696e  ohash..{...// in
    │ │ │ +0006d4c0: 7465 726e 616c 0a09 0954 4f52 5245 4e54  ternal...TORRENT
    │ │ │ +0006d4d0: 5f55 4e45 5850 4f52 5420 616e 6e6f 756e  _UNEXPORT announ
    │ │ │ +0006d4e0: 6365 5f69 6e66 6f68 6173 6828 293b 0a0a  ce_infohash();..
    │ │ │ +0006d4f0: 0909 2f2f 2069 6620 7468 6973 2074 7261  ..// if this tra
    │ │ │ +0006d500: 636b 6572 2068 6173 2072 6574 7572 6e65  cker has returne
    │ │ │ +0006d510: 6420 616e 2065 7272 6f72 206f 7220 7761  d an error or wa
    │ │ │ +0006d520: 726e 696e 6720 6d65 7373 6167 650a 0909  rning message...
    │ │ │ +0006d530: 2f2f 2074 6861 7420 6d65 7373 6167 6520  // that message 
    │ │ │ +0006d540: 6973 2073 746f 7265 6420 6865 7265 0a09  is stored here..
    │ │ │ +0006d550: 0973 7464 3a3a 7374 7269 6e67 206d 6573  .std::string mes
    │ │ │ +0006d560: 7361 6765 3b0a 0a09 092f 2f20 6966 2074  sage;....// if t
    │ │ │ +0006d570: 6869 7320 7472 6163 6b65 7220 6661 696c  his tracker fail
    │ │ │ +0006d580: 6564 2074 6865 206c 6173 7420 7469 6d65  ed the last time
    │ │ │ +0006d590: 2069 7420 7761 7320 636f 6e74 6163 7465   it was contacte
    │ │ │ +0006d5a0: 640a 0909 2f2f 2074 6869 7320 6572 726f  d...// this erro
    │ │ │ +0006d5b0: 7220 636f 6465 2073 7065 6369 6669 6573  r code specifies
    │ │ │ +0006d5c0: 2077 6861 7420 6572 726f 7220 6f63 6375   what error occu
    │ │ │ +0006d5d0: 7272 6564 0a09 0965 7272 6f72 5f63 6f64  rred...error_cod
    │ │ │ +0006d5e0: 6520 6c61 7374 5f65 7272 6f72 3b0a 0a09  e last_error;...
    │ │ │ +0006d5f0: 092f 2f20 7468 6520 7469 6d65 206f 6620  .// the time of 
    │ │ │ +0006d600: 6e65 7874 2074 7261 636b 6572 2061 6e6e  next tracker ann
    │ │ │ +0006d610: 6f75 6e63 650a 0909 7469 6d65 5f70 6f69  ounce...time_poi
    │ │ │ +0006d620: 6e74 3332 206e 6578 745f 616e 6e6f 756e  nt32 next_announ
    │ │ │ +0006d630: 6365 203d 2028 7469 6d65 5f70 6f69 6e74  ce = (time_point
    │ │ │ +0006d640: 3332 3a3a 6d69 6e29 2829 3b0a 0a09 092f  32::min)();..../
    │ │ │ +0006d650: 2f20 6e6f 2061 6e6e 6f75 6e63 6573 2062  / no announces b
    │ │ │ +0006d660: 6566 6f72 6520 7468 6973 2074 696d 650a  efore this time.
    │ │ │ +0006d670: 0909 7469 6d65 5f70 6f69 6e74 3332 206d  ..time_point32 m
    │ │ │ +0006d680: 696e 5f61 6e6e 6f75 6e63 6520 3d20 2874  in_announce = (t
    │ │ │ +0006d690: 696d 655f 706f 696e 7433 323a 3a6d 696e  ime_point32::min
    │ │ │ +0006d6a0: 2928 293b 0a0a 3c64 6976 2073 7479 6c65  )();..
    .
    ..// │ │ │ +0006d6e0: 7468 6573 6520 6172 6520 6569 7468 6572 these are either │ │ │ +0006d6f0: 202d 3120 6f72 2074 6865 2073 6372 6170 -1 or the scrap │ │ │ +0006d700: 6520 696e 666f 726d 6174 696f 6e20 7468 e information th │ │ │ +0006d710: 6973 2074 7261 636b 6572 206c 6173 740a is tracker last. │ │ │ +0006d720: 0909 2f2f 2072 6573 706f 6e64 6564 2077 ..// responded w │ │ │ +0006d730: 6974 682e 202a 696e 636f 6d70 6c65 7465 ith. *incomplete │ │ │ +0006d740: 2a20 6973 2074 6865 2063 7572 7265 6e74 * is the current │ │ │ +0006d750: 206e 756d 6265 7220 6f66 2064 6f77 6e6c number of downl │ │ │ +0006d760: 6f61 6465 7273 2069 6e0a 0909 2f2f 2074 oaders in...// t │ │ │ +0006d770: 6865 2073 7761 726d 2c20 2a63 6f6d 706c he swarm, *compl │ │ │ +0006d780: 6574 652a 2069 7320 7468 6520 6375 7272 ete* is the curr │ │ │ +0006d790: 656e 7420 6e75 6d62 6572 206f 6620 7365 ent number of se │ │ │ +0006d7a0: 6564 7320 696e 2074 6865 2073 7761 726d eds in the swarm │ │ │ +0006d7b0: 2061 6e64 0a09 092f 2f20 2a64 6f77 6e6c and...// *downl │ │ │ +0006d7c0: 6f61 6465 642a 2069 7320 7468 6520 6375 oaded* is the cu │ │ │ +0006d7d0: 6d75 6c61 7469 7665 206e 756d 6265 7220 mulative number │ │ │ +0006d7e0: 6f66 2063 6f6d 706c 6574 6564 2064 6f77 of completed dow │ │ │ +0006d7f0: 6e6c 6f61 6473 206f 6620 7468 6973 0a09 nloads of this.. │ │ │ +0006d800: 092f 2f20 746f 7272 656e 742c 2073 696e .// torrent, sin │ │ │ +0006d810: 6365 2074 6865 2062 6567 696e 6e69 6e67 ce the beginning │ │ │ +0006d820: 206f 6620 7469 6d65 2028 6672 6f6d 2074 of time (from t │ │ │ +0006d830: 6869 7320 7472 6163 6b65 7227 7320 706f his tracker's po │ │ │ +0006d840: 696e 7420 6f66 0a09 092f 2f20 7669 6577 int of...// view │ │ │ +0006d850: 292e 0a0a 0909 2f2f 2069 6620 7468 6973 ).....// if this │ │ │ +0006d860: 2074 7261 636b 6572 2068 6173 2072 6574 tracker has ret │ │ │ +0006d870: 7572 6e65 6420 7363 7261 7065 2064 6174 urned scrape dat │ │ │ +0006d880: 612c 2074 6865 7365 2066 6965 6c64 7320 a, these fields │ │ │ +0006d890: 6172 6520 6669 6c6c 6564 2069 6e0a 0909 are filled in... │ │ │ +0006d8a0: 2f2f 2077 6974 6820 7661 6c69 6420 6e75 // with valid nu │ │ │ +0006d8b0: 6d62 6572 732e 204f 7468 6572 7769 7365 mbers. Otherwise │ │ │ +0006d8c0: 2074 6865 7920 6172 6520 7365 7420 746f they are set to │ │ │ +0006d8d0: 202d 312e 2060 6069 6e63 6f6d 706c 6574 -1. ``incomplet │ │ │ +0006d8e0: 6560 6020 636f 756e 7473 0a09 092f 2f20 e`` counts...// │ │ │ +0006d8f0: 7468 6520 6e75 6d62 6572 206f 6620 6375 the number of cu │ │ │ +0006d900: 7272 656e 7420 646f 776e 6c6f 6164 6572 rrent downloader │ │ │ +0006d910: 732e 2060 6063 6f6d 706c 6574 6560 6020 s. ``complete`` │ │ │ +0006d920: 636f 756e 7473 2074 6865 206e 756d 6265 counts the numbe │ │ │ +0006d930: 7220 6f66 0a09 092f 2f20 6375 7272 656e r of...// curren │ │ │ +0006d940: 7420 7065 6572 7320 636f 6d70 6c65 7465 t peers complete │ │ │ +0006d950: 6420 7468 6520 646f 776e 6c6f 6164 2c20 d the download, │ │ │ +0006d960: 6f72 2022 7365 6564 7322 2e20 6060 646f or "seeds". ``do │ │ │ +0006d970: 776e 6c6f 6164 6564 6060 2069 7320 7468 wnloaded`` is th │ │ │ +0006d980: 650a 0909 2f2f 2063 756d 756c 6174 6976 e...// cumulativ │ │ │ +0006d990: 6520 6e75 6d62 6572 206f 6620 636f 6d70 e number of comp │ │ │ +0006d9a0: 6c65 7465 6420 646f 776e 6c6f 6164 732e leted downloads. │ │ │ +0006d9b0: 0a09 0969 6e74 2073 6372 6170 655f 696e ...int scrape_in │ │ │ +0006d9c0: 636f 6d70 6c65 7465 203d 202d 313b 0a09 complete = -1;.. │ │ │ +0006d9d0: 0969 6e74 2073 6372 6170 655f 636f 6d70 .int scrape_comp │ │ │ +0006d9e0: 6c65 7465 203d 202d 313b 0a09 0969 6e74 lete = -1;...int │ │ │ +0006d9f0: 2073 6372 6170 655f 646f 776e 6c6f 6164 scrape_download │ │ │ +0006da00: 6564 203d 202d 313b 0a0a 0909 2f2f 2074 ed = -1;....// t │ │ │ +0006da10: 6865 206e 756d 6265 7220 6f66 2074 696d he number of tim │ │ │ +0006da20: 6573 2069 6e20 6120 726f 7720 7765 2068 es in a row we h │ │ │ +0006da30: 6176 6520 6661 696c 6564 2074 6f20 616e ave failed to an │ │ │ +0006da40: 6e6f 756e 6365 2074 6f20 7468 6973 0a09 nounce to this.. │ │ │ +0006da50: 092f 2f20 7472 6163 6b65 722e 0a09 0973 .// tracker....s │ │ │ +0006da60: 7464 3a3a 7569 6e74 385f 7420 6661 696c td::uint8_t fail │ │ │ +0006da70: 7320 3a20 373b 0a0a 0909 2f2f 2074 7275 s : 7;....// tru │ │ │ +0006da80: 6520 7768 696c 6520 7765 2772 6520 7761 e while we're wa │ │ │ +0006da90: 6974 696e 6720 666f 7220 6120 7265 7370 iting for a resp │ │ │ +0006daa0: 6f6e 7365 2066 726f 6d20 7468 6520 7472 onse from the tr │ │ │ +0006dab0: 6163 6b65 722e 0a09 0962 6f6f 6c20 7570 acker....bool up │ │ │ +0006dac0: 6461 7469 6e67 203a 2031 3b0a 0a09 092f dating : 1;..../ │ │ │ +0006dad0: 2f20 7365 7420 746f 2074 7275 6520 7768 / set to true wh │ │ │ +0006dae0: 656e 2077 6520 6765 7420 6120 7661 6c69 en we get a vali │ │ │ +0006daf0: 6420 7265 7370 6f6e 7365 2066 726f 6d20 d response from │ │ │ +0006db00: 616e 2061 6e6e 6f75 6e63 650a 0909 2f2f an announce...// │ │ │ +0006db10: 2077 6974 6820 6576 656e 743d 7374 6172 with event=star │ │ │ +0006db20: 7465 642e 2049 6620 6974 2069 7320 7365 ted. If it is se │ │ │ +0006db30: 742c 2077 6520 776f 6e27 7420 7365 6e64 t, we won't send │ │ │ +0006db40: 2073 7461 7274 2069 6e20 7468 6520 7375 start in the su │ │ │ +0006db50: 6273 6571 7565 6e74 0a09 092f 2f20 616e bsequent...// an │ │ │ +0006db60: 6e6f 756e 6365 732e 0a09 0962 6f6f 6c20 nounces....bool │ │ │ +0006db70: 7374 6172 745f 7365 6e74 203a 2031 3b0a start_sent : 1;. │ │ │ +0006db80: 0a09 092f 2f20 7365 7420 746f 2074 7275 ...// set to tru │ │ │ +0006db90: 6520 7768 656e 2077 6520 7365 6e64 2061 e when we send a │ │ │ +0006dba0: 2065 7665 6e74 3d63 6f6d 706c 6574 6564 event=completed │ │ │ +0006dbb0: 2e0a 0909 626f 6f6c 2063 6f6d 706c 6574 ....bool complet │ │ │ +0006dbc0: 655f 7365 6e74 203a 2031 3b0a 3c2f 7072 e_sent : 1;.rel │ │ │ +0006dc00: 6576 616e 6365 266e 6273 703b 303c 2f74 evance 0../includ │ │ │ +0006dc40: 652f 6c69 6274 6f72 7265 6e74 2f70 726f e/libtorrent/pro │ │ │ +0006dc50: 7879 5f62 6173 652e 6870 703a 3232 373c xy_base.hpp:227< │ │ │ +0006dc60: 2f61 3e3c 2f74 643e 3c74 643e 6974 2077 /a>it w │ │ │ +0006dc70: 6f75 6c64 2062 6520 6e69 6365 2074 6f20 ould be nice to │ │ │ +0006dc80: 7265 6d65 6d62 6572 2074 6865 2062 696e remember the bin │ │ │ +0006dc90: 6420 706f 7274 2061 6e64 2062 696e 6420 d port and bind │ │ │ +0006dca0: 6f6e 6365 2077 6520 6b6e 6f77 2077 6865 once we know whe │ │ │ +0006dcb0: 7265 2074 6865 2070 726f 7879 2069 7320 re the proxy is │ │ │ +0006dcc0: 6d5f 736f 636b 2e62 696e 6428 656e 6470 m_sock.bind(endp │ │ │ +0006dcd0: 6f69 6e74 2c20 6563 293b 3c2f 7464 3e3c oint, ec);< │ │ │ +0006dce0: 2f74 723e 3c74 7220 6964 3d22 3235 3122 /tr>

    it would │ │ │ +0006dd30: 2062 6520 6e69 6365 2074 6f20 7265 6d65 be nice to reme │ │ │ +0006dd40: 6d62 6572 2074 6865 2062 696e 6420 706f mber the bind po │ │ │ +0006dd50: 7274 2061 6e64 2062 696e 6420 6f6e 6365 rt and bind once │ │ │ +0006dd60: 2077 6520 6b6e 6f77 2077 6865 7265 2074 we know where t │ │ │ +0006dd70: 6865 2070 726f 7879 2069 730a 6d5f 736f he proxy is.m_so │ │ │ +0006dd80: 636b 2e62 696e 6428 656e 6470 6f69 6e74 ck.bind(endpoint │ │ │ +0006dd90: 2c20 6563 293b 3c2f 6832 3e3c 6834 3e2e , ec);

    . │ │ │ +0006dda0: 2e2f 696e 636c 7564 652f 6c69 6274 6f72 ./include/libtor │ │ │ +0006ddb0: 7265 6e74 2f70 726f 7879 5f62 6173 652e rent/proxy_base. │ │ │ +0006ddc0: 6870 703a 3232 373c 2f68 343e 3c70 7265 hpp:227

    ..TORRENT_
    │ │ │ +0006de10: 4153 5345 5254 286d 5f6d 6167 6963 203d  ASSERT(m_magic =
    │ │ │ +0006de20: 3d20 3078 3133 3337 293b 0a09 096d 5f73  = 0x1337);...m_s
    │ │ │ +0006de30: 6f63 6b2e 6361 6e63 656c 2829 3b0a 097d  ock.cancel();..}
    │ │ │ +0006de40: 0a0a 0976 6f69 6420 6361 6e63 656c 2865  ...void cancel(e
    │ │ │ +0006de50: 7272 6f72 5f63 6f64 6526 616d 703b 2065  rror_code& e
    │ │ │ +0006de60: 6329 0a09 7b0a 0909 544f 5252 454e 545f  c)..{...TORRENT_
    │ │ │ +0006de70: 4153 5345 5254 286d 5f6d 6167 6963 203d  ASSERT(m_magic =
    │ │ │ +0006de80: 3d20 3078 3133 3337 293b 0a09 096d 5f73  = 0x1337);...m_s
    │ │ │ +0006de90: 6f63 6b2e 6361 6e63 656c 2865 6329 3b0a  ock.cancel(ec);.
    │ │ │ +0006dea0: 097d 0a0a 0976 6f69 6420 6269 6e64 2865  .}...void bind(e
    │ │ │ +0006deb0: 6e64 706f 696e 745f 7479 7065 2063 6f6e  ndpoint_type con
    │ │ │ +0006dec0: 7374 2661 6d70 3b20 2f2a 2065 6e64 706f  st& /* endpo
    │ │ │ +0006ded0: 696e 7420 2a2f 2c20 6572 726f 725f 636f  int */, error_co
    │ │ │ +0006dee0: 6465 2661 6d70 3b20 2f2a 2065 6320 2a2f  de& /* ec */
    │ │ │ +0006def0: 290a 097b 0a09 0954 4f52 5245 4e54 5f41  )..{...TORRENT_A
    │ │ │ +0006df00: 5353 4552 5428 6d5f 6d61 6769 6320 3d3d  SSERT(m_magic ==
    │ │ │ +0006df10: 2030 7831 3333 3729 3b0a 0909 2f2f 2074   0x1337);...// t
    │ │ │ +0006df20: 6865 2072 6561 736f 6e20 7768 7920 7765  he reason why we
    │ │ │ +0006df30: 2069 676e 6f72 6520 6269 6e64 7320 6865   ignore binds he
    │ │ │ +0006df40: 7265 2069 7320 6265 6361 7573 6520 7765  re is because we
    │ │ │ +0006df50: 2064 6f6e 2774 0a09 092f 2f20 286e 6563   don't...// (nec
    │ │ │ +0006df60: 6573 7361 7269 6c79 2920 7965 7420 6b6e  essarily) yet kn
    │ │ │ +0006df70: 6f77 2077 6861 7420 6164 6472 6573 7320  ow what address 
    │ │ │ +0006df80: 6661 6d69 6c79 2074 6865 2070 726f 7879  family the proxy
    │ │ │ +0006df90: 0a09 092f 2f20 7769 6c6c 2072 6573 6f6c  ...// will resol
    │ │ │ +0006dfa0: 7665 2074 6f2c 2061 6e64 2062 696e 6469  ve to, and bindi
    │ │ │ +0006dfb0: 6e67 2074 6f20 7468 6520 7772 6f6e 6720  ng to the wrong 
    │ │ │ +0006dfc0: 6f6e 6520 776f 756c 640a 0909 2f2f 2062  one would...// b
    │ │ │ +0006dfd0: 7265 616b 206f 7572 2063 6f6e 6e65 6374  reak our connect
    │ │ │ +0006dfe0: 696f 6e20 6174 7465 6d70 7420 6c61 7465  ion attempt late
    │ │ │ +0006dff0: 722e 2054 6865 2063 616c 6c65 7220 6865  r. The caller he
    │ │ │ +0006e000: 7265 0a09 092f 2f20 646f 6573 6e27 7420  re...// doesn't 
    │ │ │ +0006e010: 6e65 6365 7373 6172 696c 7920 6b6e 6f77  necessarily know
    │ │ │ +0006e020: 2074 6861 7420 7765 2772 6520 7072 6f78   that we're prox
    │ │ │ +0006e030: 7969 6e67 2c20 736f 2074 6869 730a 0909  ying, so this...
    │ │ │ +0006e040: 2f2f 2062 696e 6420 6164 6472 6573 7320  // bind address 
    │ │ │ +0006e050: 6973 2062 6173 6564 206f 6e20 7468 6520  is based on the 
    │ │ │ +0006e060: 6669 6e61 6c20 656e 6470 6f69 6e74 2c20  final endpoint, 
    │ │ │ +0006e070: 6e6f 7420 7468 650a 0909 2f2f 2070 726f  not the...// pro
    │ │ │ +0006e080: 7879 2e0a 3c64 6976 2073 7479 6c65 3d22  xy..
    .}.
    .#ifn │ │ │ +0006e0c0: 6465 6620 424f 4f53 545f 4e4f 5f45 5843 def BOOST_NO_EXC │ │ │ +0006e0d0: 4550 5449 4f4e 530a 0976 6f69 6420 6f70 EPTIONS..void op │ │ │ +0006e0e0: 656e 2870 726f 746f 636f 6c5f 7479 7065 en(protocol_type │ │ │ +0006e0f0: 2063 6f6e 7374 2661 6d70 3b29 0a09 7b0a const&)..{. │ │ │ +0006e100: 0909 544f 5252 454e 545f 4153 5345 5254 ..TORRENT_ASSERT │ │ │ +0006e110: 286d 5f6d 6167 6963 203d 3d20 3078 3133 (m_magic == 0x13 │ │ │ +0006e120: 3337 293b 0a2f 2f09 096d 5f73 6f63 6b2e 37);.//..m_sock. │ │ │ +0006e130: 6f70 656e 2870 293b 0a09 7d0a 2365 6e64 open(p);..}.#end │ │ │ +0006e140: 6966 0a0a 0976 6f69 6420 6f70 656e 2870 if...void open(p │ │ │ +0006e150: 726f 746f 636f 6c5f 7479 7065 2063 6f6e rotocol_type con │ │ │ +0006e160: 7374 2661 6d70 3b2c 2065 7272 6f72 5f63 st&, error_c │ │ │ +0006e170: 6f64 6526 616d 703b 290a 097b 0a09 0954 ode&)..{...T │ │ │ +0006e180: 4f52 5245 4e54 5f41 5353 4552 5428 6d5f ORRENT_ASSERT(m_ │ │ │ +0006e190: 6d61 6769 6320 3d3d 2030 7831 3333 3729 magic == 0x1337) │ │ │ +0006e1a0: 3b0a 0909 2f2f 2077 6520 6e65 6564 2074 ;...// we need t │ │ │ +0006e1b0: 6f20 6967 6e6f 7265 2074 6869 7320 666f o ignore this fo │ │ │ +0006e1c0: 7220 7468 6520 7361 6d65 2072 6561 736f r the same reaso │ │ │ +0006e1d0: 6e20 6173 2073 7461 7465 640a 0909 2f2f n as stated...// │ │ │ +0006e1e0: 2066 6f72 2069 676e 6f72 696e 6720 6269 for ignoring bi │ │ │ +0006e1f0: 6e64 2829 0a2f 2f09 096d 5f73 6f63 6b2e nd().//..m_sock. │ │ │ +0006e200: 6f70 656e 2870 2c20 6563 293b 0a09 7d0a open(p, ec);..}. │ │ │ +0006e210: 0a23 6966 6e64 6566 2042 4f4f 5354 5f4e .#ifndef BOOST_N │ │ │ +0006e220: 4f5f 4558 4345 5054 494f 4e53 0a09 766f O_EXCEPTIONS..vo │ │ │ +0006e230: 6964 2063 6c6f 7365 2829 0a09 7b0a 0909 id close()..{... │ │ │ +0006e240: 544f 5252 454e 545f 4153 5345 5254 286d TORRENT_ASSERT(m │ │ │ +0006e250: 5f6d 6167 6963 203d 3d20 3078 3133 3337 _magic == 0x1337 │ │ │ +0006e260: 293b 0a09 096d 5f72 656d 6f74 655f 656e );...m_remote_en │ │ │ +0006e270: 6470 6f69 6e74 203d 2065 6e64 706f 696e dpoint = endpoin │ │ │ +0006e280: 745f 7479 7065 2829 3b0a 0909 6d5f 736f t_type();...m_so │ │ │ +0006e290: 636b 2e63 6c6f 7365 2829 3b0a 0909 6d5f ck.close();...m_ │ │ │ +0006e2a0: 7265 736f 6c76 6572 2e63 616e 6365 6c28 resolver.cancel( │ │ │ +0006e2b0: 293b 0a09 7d0a 2365 6e64 6966 0a0a 0976 );..}.#endif...v │ │ │ +0006e2c0: 6f69 6420 636c 6f73 6528 6572 726f 725f oid close(error_ │ │ │ +0006e2d0: 636f 6465 2661 6d70 3b20 6563 290a 097b code& ec)..{ │ │ │ +0006e2e0: 0a09 0954 4f52 5245 4e54 5f41 5353 4552 ...TORRENT_ASSER │ │ │ +0006e2f0: 5428 6d5f 6d61 6769 6320 3d3d 2030 7831 T(m_magic == 0x1 │ │ │ +0006e300: 3333 3729 3b0a 3c2f 7072 653e 3c2f 7464 337);.
    relevance │ │ │ +0006e340: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ +0006e350: 3c61 2068 7265 663d 226a 6176 6173 6372
    ../include/libt │ │ │ +0006e380: 6f72 7265 6e74 2f70 6565 725f 636f 6e6e orrent/peer_conn │ │ │ +0006e390: 6563 7469 6f6e 2e68 7070 3a32 3138 3c2f ection.hpp:218make │ │ │ +0006e3b0: 7468 6973 2061 2072 6177 2070 6f69 6e74 this a raw point │ │ │ +0006e3c0: 6572 2028 746f 2073 6176 6520 7369 7a65 er (to save size │ │ │ +0006e3d0: 2069 6e20 7468 6520 6669 7273 7420 6361 in the first ca │ │ │ +0006e3e0: 6368 6520 6c69 6e65 2920 616e 6420 6d61 che line) and ma │ │ │ +0006e3f0: 6b65 2074 6865 2063 6f6e 7374 7275 6374 ke the construct │ │ │ +0006e400: 6f72 2074 616b 6520 6120 7261 7720 706f or take a raw po │ │ │ +0006e410: 696e 7465 722e 2074 6f72 7265 6e74 206f inter. torrent o │ │ │ +0006e420: 626a 6563 7473 2073 686f 756c 6420 616c bjects should al │ │ │ +0006e430: 7761 7973 206f 7574 6c69 7665 2074 6865 ways outlive the │ │ │ +0006e440: 6972 2070 6565 7273 3c2f 7464 3e3c 2f74 ir peers

    make this │ │ │ +0006e4a0: 6120 7261 7720 706f 696e 7465 7220 2874 a raw pointer (t │ │ │ +0006e4b0: 6f20 7361 7665 2073 697a 6520 696e 0a74 o save size in.t │ │ │ +0006e4c0: 6865 2066 6972 7374 2063 6163 6865 206c he first cache l │ │ │ +0006e4d0: 696e 6529 2061 6e64 206d 616b 6520 7468 ine) and make th │ │ │ +0006e4e0: 6520 636f 6e73 7472 7563 746f 720a 7461 e constructor.ta │ │ │ +0006e4f0: 6b65 2061 2072 6177 2070 6f69 6e74 6572 ke a raw pointer │ │ │ +0006e500: 2e20 746f 7272 656e 7420 6f62 6a65 6374 . torrent object │ │ │ +0006e510: 7320 7368 6f75 6c64 2061 6c77 6179 730a s should always. │ │ │ +0006e520: 6f75 746c 6976 6520 7468 6569 7220 7065 outlive their pe │ │ │ +0006e530: 6572 733c 2f68 323e 3c68 343e 2e2e 2f69 ers

    ../i │ │ │ +0006e540: 6e63 6c75 6465 2f6c 6962 746f 7272 656e nclude/libtorren │ │ │ +0006e550: 742f 7065 6572 5f63 6f6e 6e65 6374 696f t/peer_connectio │ │ │ +0006e560: 6e2e 6870 703a 3231 383c 2f68 343e 3c70 n.hpp:218

    ..., m_s │ │ │ +0006e5b0: 6e75 6262 6564 2866 616c 7365 290a 0909 nubbed(false)... │ │ │ +0006e5c0: 092c 206d 5f69 6e74 6572 6573 7469 6e67 ., m_interesting │ │ │ +0006e5d0: 2866 616c 7365 290a 0909 092c 206d 5f63 (false)...., m_c │ │ │ +0006e5e0: 686f 6b65 6428 7472 7565 290a 0909 092c hoked(true)...., │ │ │ +0006e5f0: 206d 5f69 676e 6f72 655f 7374 6174 7328 m_ignore_stats( │ │ │ +0006e600: 6661 6c73 6529 0a09 097b 7d0a 0a09 092f false)...{}..../ │ │ │ +0006e610: 2f20 6578 706c 6963 6974 6c79 2064 6973 / explicitly dis │ │ │ +0006e620: 616c 6c6f 7720 6173 7369 676e 6d65 6e74 allow assignment │ │ │ +0006e630: 2c20 746f 2073 696c 656e 6365 206d 7376 , to silence msv │ │ │ +0006e640: 6320 7761 726e 696e 670a 0909 7065 6572 c warning...peer │ │ │ +0006e650: 5f63 6f6e 6e65 6374 696f 6e5f 686f 745f _connection_hot_ │ │ │ +0006e660: 6d65 6d62 6572 7326 616d 703b 206f 7065 members& ope │ │ │ +0006e670: 7261 746f 723d 2870 6565 725f 636f 6e6e rator=(peer_conn │ │ │ +0006e680: 6563 7469 6f6e 5f68 6f74 5f6d 656d 6265 ection_hot_membe │ │ │ +0006e690: 7273 2063 6f6e 7374 2661 6d70 3b29 203d rs const&) = │ │ │ +0006e6a0: 2064 656c 6574 653b 0a0a 0970 726f 7465 delete;...prote │ │ │ +0006e6b0: 6374 6564 3a0a 0a09 092f 2f20 7468 6520 cted:....// the │ │ │ +0006e6c0: 7069 6563 6573 2074 6865 206f 7468 6572 pieces the other │ │ │ +0006e6d0: 2065 6e64 2068 6176 650a 0909 7479 7065 end have...type │ │ │ +0006e6e0: 645f 6269 7466 6965 6c64 266c 743b 7069 d_bitfield<pi │ │ │ +0006e6f0: 6563 655f 696e 6465 785f 7426 6774 3b20 ece_index_t> │ │ │ +0006e700: 6d5f 6861 7665 5f70 6965 6365 3b0a 0a09 m_have_piece;... │ │ │ +0006e710: 092f 2f20 7468 6973 2069 7320 7468 6520 .// this is the │ │ │ +0006e720: 746f 7272 656e 7420 7468 6973 2063 6f6e torrent this con │ │ │ +0006e730: 6e65 6374 696f 6e20 6973 0a09 092f 2f20 nection is...// │ │ │ +0006e740: 6173 736f 6369 6174 6564 2077 6974 682e associated with. │ │ │ +0006e750: 2049 6620 7468 6520 636f 6e6e 6563 7469 If the connecti │ │ │ +0006e760: 6f6e 2069 7320 616e 0a09 092f 2f20 696e on is an...// in │ │ │ +0006e770: 636f 6d69 6e67 2063 6f6e 6e65 6374 696f coming connectio │ │ │ +0006e780: 6e2c 2074 6869 7320 6973 2073 6574 2074 n, this is set t │ │ │ +0006e790: 6f20 7a65 726f 0a09 092f 2f20 756e 7469 o zero...// unti │ │ │ +0006e7a0: 6c20 7468 6520 696e 666f 5f68 6173 6820 l the info_hash │ │ │ +0006e7b0: 6973 2072 6563 6569 7665 642e 2054 6865 is received. The │ │ │ +0006e7c0: 6e20 6974 2773 0a09 092f 2f20 7365 7420 n it's...// set │ │ │ +0006e7d0: 746f 2074 6865 2074 6f72 7265 6e74 2069 to the torrent i │ │ │ +0006e7e0: 7420 6265 6c6f 6e67 7320 746f 2e0a 0a3c t belongs to...< │ │ │ +0006e7f0: 6469 7620 7374 796c 653d 2262 6163 6b67 div style="backg │ │ │ +0006e800: 726f 756e 643a 2023 6666 6666 3030 2220 round: #ffff00" │ │ │ +0006e810: 7769 6474 683d 2231 3030 2522 3e09 0973 width="100%">..s │ │ │ +0006e820: 7464 3a3a 7765 616b 5f70 7472 266c 743b td::weak_ptr< │ │ │ +0006e830: 746f 7272 656e 7426 6774 3b20 6d5f 746f torrent> m_to │ │ │ +0006e840: 7272 656e 743b 0a3c 2f64 6976 3e0a 0970 rrent;...p │ │ │ +0006e850: 7562 6c69 633a 0a0a 0909 2f2f 2061 2062 ublic:....// a b │ │ │ +0006e860: 6163 6b20 7265 6665 7265 6e63 6520 746f ack reference to │ │ │ +0006e870: 2074 6865 2073 6573 7369 6f6e 0a09 092f the session.../ │ │ │ +0006e880: 2f20 7468 6520 7065 6572 2062 656c 6f6e / the peer belon │ │ │ +0006e890: 6773 2074 6f2e 0a09 0961 7578 3a3a 7365 gs to....aux::se │ │ │ +0006e8a0: 7373 696f 6e5f 696e 7465 7266 6163 6526 ssion_interface& │ │ │ +0006e8b0: 616d 703b 206d 5f73 6573 3b0a 0a09 092f amp; m_ses;..../ │ │ │ +0006e8c0: 2f20 7365 7474 696e 6773 2074 6861 7420 / settings that │ │ │ +0006e8d0: 6170 706c 7920 746f 2074 6869 7320 7065 apply to this pe │ │ │ +0006e8e0: 6572 0a09 0961 7578 3a3a 7365 7373 696f er...aux::sessio │ │ │ +0006e8f0: 6e5f 7365 7474 696e 6773 2063 6f6e 7374 n_settings const │ │ │ +0006e900: 2661 6d70 3b20 6d5f 7365 7474 696e 6773 & m_settings │ │ │ +0006e910: 3b0a 0a09 7072 6f74 6563 7465 643a 0a0a ;...protected:.. │ │ │ +0006e920: 0909 2f2f 2074 6869 7320 6973 2074 7275 ..// this is tru │ │ │ +0006e930: 6520 6966 2074 6869 7320 636f 6e6e 6563 e if this connec │ │ │ +0006e940: 7469 6f6e 2068 6173 2062 6565 6e20 6164 tion has been ad │ │ │ +0006e950: 6465 640a 0909 2f2f 2074 6f20 7468 6520 ded...// to the │ │ │ +0006e960: 6c69 7374 206f 6620 636f 6e6e 6563 7469 list of connecti │ │ │ +0006e970: 6f6e 7320 7468 6174 2077 696c 6c20 6265 ons that will be │ │ │ +0006e980: 2063 6c6f 7365 642e 0a09 0962 6f6f 6c20 closed....bool │ │ │ +0006e990: 6d5f 6469 7363 6f6e 6e65 6374 696e 673a m_disconnecting: │ │ │ +0006e9a0: 313b 0a0a 0909 2f2f 2074 6869 7320 6973 1;....// this is │ │ │ +0006e9b0: 2074 7275 6520 756e 7469 6c20 7468 6973 true until this │ │ │ +0006e9c0: 2073 6f63 6b65 7420 6861 7320 6265 636f socket has beco │ │ │ +0006e9d0: 6d65 0a09 092f 2f20 7772 6974 6162 6c65 me...// writable │ │ │ +0006e9e0: 2066 6f72 2074 6865 2066 6972 7374 2074 for the first t │ │ │ +0006e9f0: 696d 6520 2869 2e65 2e20 7468 650a 0909 ime (i.e. the... │ │ │ +0006ea00: 2f2f 2063 6f6e 6e65 6374 696f 6e20 636f // connection co │ │ │ +0006ea10: 6d70 6c65 7465 6429 2e20 5768 696c 6520 mpleted). While │ │ │ +0006ea20: 636f 6e6e 6563 7469 6e67 0a09 092f 2f20 connecting...// │ │ │ +0006ea30: 7468 6520 7469 6d65 6f75 7420 7769 6c6c the timeout will │ │ │ +0006ea40: 206e 6f74 2062 6520 7472 6967 6765 7265 not be triggere │ │ │ +0006ea50: 642e 2054 6869 7320 6973 0a09 092f 2f20 d. This is...// │ │ │ +0006ea60: 6265 6361 7573 6520 7769 6e64 6f77 7320 because windows │ │ │ +0006ea70: 5850 2053 5032 206d 6179 2064 656c 6179 XP SP2 may delay │ │ │ +0006ea80: 2063 6f6e 6e65 6374 696f 6e0a 0909 2f2f connection...// │ │ │ +0006ea90: 2061 7474 656d 7074 732c 2077 6869 6368 attempts, which │ │ │ +0006eaa0: 206d 6561 6e73 2074 6861 7420 7468 6520 means that the │ │ │ +0006eab0: 636f 6e6e 6563 7469 6f6e 0a09 092f 2f20 connection...// │ │ │ +0006eac0: 6d61 7920 6e6f 7420 6576 656e 2068 6176 may not even hav │ │ │ +0006ead0: 6520 6265 656e 2061 7474 656d 7074 6564 e been attempted │ │ │ +0006eae0: 2077 6865 6e20 7468 650a 0909 2f2f 2074 when the...// t │ │ │ +0006eaf0: 696d 6520 6f75 7420 6973 2072 6561 6368 ime out is reach │ │ │ +0006eb00: 6564 2e0a 0909 626f 6f6c 206d 5f63 6f6e ed....bool m_con │ │ │ +0006eb10: 6e65 6374 696e 673a 313b 0a0a 0909 2f2f necting:1;....// │ │ │ +0006eb20: 2074 6869 7320 6973 2073 6574 2074 6f20 this is set to │ │ │ +0006eb30: 7472 7565 2069 6620 7468 6520 6c61 7374 true if the last │ │ │ +0006eb40: 2074 696d 6520 7765 2074 7269 6564 2074 time we tried t │ │ │ +0006eb50: 6f0a 0909 2f2f 2070 6963 6b20 6120 7069 o...// pick a pi │ │ │ +0006eb60: 6563 6520 746f 2064 6f77 6e6c 6f61 642c ece to download, │ │ │ +0006eb70: 2077 6520 636f 756c 6420 6f6e 6c79 2066 we could only f │ │ │ +0006eb80: 696e 640a 0909 2f2f 2062 6c6f 636b 7320 ind...// blocks │ │ │ +0006eb90: 7468 6174 2077 6572 6520 616c 7265 6164 that were alread │ │ │ +0006eba0: 7920 7265 7175 6573 7465 6420 6672 6f6d y requested from │ │ │ +0006ebb0: 206f 7468 6572 0a09 092f 2f20 7065 6572 other...// peer │ │ │ +0006ebc0: 732e 2049 6e20 7468 6973 2063 6173 652c s. In this case, │ │ │ +0006ebd0: 2077 6520 7368 6f75 6c64 206e 6f74 2074 we should not t │ │ │ +0006ebe0: 7279 2074 6f20 7069 636b 0a3c 2f70 7265 ry to pick.

    rele │ │ │ +0006ec20: 7661 6e63 6526 6e62 7370 3b30 3c2f 7464 vance 0../include │ │ │ +0006ec60: 2f6c 6962 746f 7272 656e 742f 7065 6572 /libtorrent/peer │ │ │ +0006ec70: 5f63 6f6e 6e65 6374 696f 6e2e 6870 703a _connection.hpp: │ │ │ +0006ec80: 3130 3236 3c2f 613e 3c2f 7464 3e3c 7464 1026factor this out │ │ │ +0006eca0: 2069 6e74 6f20 6974 7320 6f77 6e20 636c into its own cl │ │ │ +0006ecb0: 6173 7320 7769 7468 2061 2076 6972 7475 ass with a virtu │ │ │ +0006ecc0: 616c 2069 6e74 6572 6661 6365 2074 6f72 al interface tor │ │ │ +0006ecd0: 7265 6e74 2061 6e64 2073 6573 7369 6f6e rent and session │ │ │ +0006ece0: 2073 686f 756c 6420 696d 706c 656d 656e should implemen │ │ │ +0006ecf0: 7420 7468 6973 2069 6e74 6572 6661 6365 t this interface │ │ │ +0006ed00: 3c2f 7464 3e3c 2f74 723e 3c74 7220 6964

    fa │ │ │ +0006ed50: 6374 6f72 2074 6869 7320 6f75 7420 696e ctor this out in │ │ │ +0006ed60: 746f 2069 7473 206f 776e 2063 6c61 7373 to its own class │ │ │ +0006ed70: 2077 6974 6820 6120 7669 7274 7561 6c20 with a virtual │ │ │ +0006ed80: 696e 7465 7266 6163 650a 746f 7272 656e interface.torren │ │ │ +0006ed90: 7420 616e 6420 7365 7373 696f 6e20 7368 t and session sh │ │ │ +0006eda0: 6f75 6c64 2069 6d70 6c65 6d65 6e74 2074 ould implement t │ │ │ +0006edb0: 6869 7320 696e 7465 7266 6163 653c 2f68 his interface

    ../include │ │ │ +0006edd0: 2f6c 6962 746f 7272 656e 742f 7065 6572 /libtorrent/peer │ │ │ +0006ede0: 5f63 6f6e 6e65 6374 696f 6e2e 6870 703a _connection.hpp: │ │ │ +0006edf0: 3130 3236 3c2f 6834 3e3c 7072 6520 7374 1026

    ...// the loc
    │ │ │ +0006ee40: 616c 2065 6e64 706f 696e 7420 666f 7220  al endpoint for 
    │ │ │ +0006ee50: 7468 6973 2070 6565 722c 2069 2e65 2e20  this peer, i.e. 
    │ │ │ +0006ee60: 6f75 7220 6164 6472 6573 730a 0909 2f2f  our address...//
    │ │ │ +0006ee70: 2061 6e64 206f 7572 2070 6f72 742e 2049   and our port. I
    │ │ │ +0006ee80: 6620 7468 6973 2069 7320 7365 7420 666f  f this is set fo
    │ │ │ +0006ee90: 7220 6f75 7467 6f69 6e67 2063 6f6e 6e65  r outgoing conne
    │ │ │ +0006eea0: 6374 696f 6e73 0a09 092f 2f20 6265 666f  ctions...// befo
    │ │ │ +0006eeb0: 7265 2074 6865 2063 6f6e 6e65 6374 696f  re the connectio
    │ │ │ +0006eec0: 6e20 636f 6d70 6c65 7465 732c 2069 7420  n completes, it 
    │ │ │ +0006eed0: 6d65 616e 7320 7765 2077 616e 7420 746f  means we want to
    │ │ │ +0006eee0: 0a09 092f 2f20 666f 7263 6520 7468 6520  ...// force the 
    │ │ │ +0006eef0: 636f 6e6e 6563 7469 6f6e 2074 6f20 6265  connection to be
    │ │ │ +0006ef00: 2062 6f75 6e64 2074 6f20 7468 6520 7370   bound to the sp
    │ │ │ +0006ef10: 6563 6966 6965 6420 696e 7465 7266 6163  ecified interfac
    │ │ │ +0006ef20: 652e 0a09 092f 2f20 6966 2069 7420 656e  e....// if it en
    │ │ │ +0006ef30: 6473 2075 7020 6265 696e 6720 626f 756e  ds up being boun
    │ │ │ +0006ef40: 6420 746f 2061 2064 6966 6665 7265 6e74  d to a different
    │ │ │ +0006ef50: 206c 6f63 616c 2049 502c 2074 6865 2063   local IP, the c
    │ │ │ +0006ef60: 6f6e 6e65 6374 696f 6e0a 0909 2f2f 2069  onnection...// i
    │ │ │ +0006ef70: 7320 636c 6f73 6564 2e0a 0909 7463 703a  s closed....tcp:
    │ │ │ +0006ef80: 3a65 6e64 706f 696e 7420 6d5f 6c6f 6361  :endpoint m_loca
    │ │ │ +0006ef90: 6c3b 0a0a 0909 2f2f 2072 656d 6f74 6520  l;....// remote 
    │ │ │ +0006efa0: 7065 6572 2773 2069 640a 0909 7065 6572  peer's id...peer
    │ │ │ +0006efb0: 5f69 6420 6d5f 7065 6572 5f69 643b 0a0a  _id m_peer_id;..
    │ │ │ +0006efc0: 0970 726f 7465 6374 6564 3a0a 0a09 0974  .protected:....t
    │ │ │ +0006efd0: 656d 706c 6174 6520 266c 743b 7479 7065  emplate <type
    │ │ │ +0006efe0: 6e61 6d65 2046 756e 2c20 7479 7065 6e61  name Fun, typena
    │ │ │ +0006eff0: 6d65 2e2e 2e20 4172 6773 2667 743b 0a09  me... Args>..
    │ │ │ +0006f000: 0976 6f69 6420 7772 6170 2846 756e 2066  .void wrap(Fun f
    │ │ │ +0006f010: 2c20 4172 6773 2661 6d70 3b26 616d 703b  , Args&&
    │ │ │ +0006f020: 2e2e 2e20 6129 3b0a 0a09 092f 2f20 7374  ... a);....// st
    │ │ │ +0006f030: 6174 6973 7469 6373 2061 626f 7574 2075  atistics about u
    │ │ │ +0006f040: 706c 6f61 6420 616e 6420 646f 776e 6c6f  pload and downlo
    │ │ │ +0006f050: 6164 2073 7065 6564 730a 0909 2f2f 2061  ad speeds...// a
    │ │ │ +0006f060: 6e64 2074 6f74 616c 2061 6d6f 756e 7420  nd total amount 
    │ │ │ +0006f070: 6f66 2075 706c 6f61 6473 2061 6e64 2064  of uploads and d
    │ │ │ +0006f080: 6f77 6e6c 6f61 6473 2066 6f72 0a09 092f  ownloads for.../
    │ │ │ +0006f090: 2f20 7468 6973 2070 6565 720a 3c64 6976  / this peer.
    ..stat │ │ │ +0006f0d0: 206d 5f73 7461 7469 7374 6963 733b 0a3c m_statistics;.< │ │ │ +0006f0e0: 2f64 6976 3e0a 0909 2f2f 2074 6865 206e /div>...// the n │ │ │ +0006f0f0: 756d 6265 7220 6f66 206f 7574 7374 616e umber of outstan │ │ │ +0006f100: 6469 6e67 2062 7974 6573 2065 7870 6563 ding bytes expec │ │ │ +0006f110: 7465 640a 0909 2f2f 2074 6f20 6265 2072 ted...// to be r │ │ │ +0006f120: 6563 6569 7665 6420 6279 2065 7874 656e eceived by exten │ │ │ +0006f130: 7369 6f6e 730a 0909 696e 7420 6d5f 6578 sions...int m_ex │ │ │ +0006f140: 7465 6e73 696f 6e5f 6f75 7473 7461 6e64 tension_outstand │ │ │ +0006f150: 696e 675f 6279 7465 7320 3d20 303b 0a0a ing_bytes = 0;.. │ │ │ +0006f160: 0909 2f2f 2074 6865 206e 756d 6265 7220 ..// the number │ │ │ +0006f170: 6f66 2074 696d 6520 6372 6974 6963 616c of time critical │ │ │ +0006f180: 2072 6571 7565 7374 730a 0909 2f2f 2071 requests...// q │ │ │ +0006f190: 7565 7565 6420 7570 2069 6e20 7468 6520 ueued up in the │ │ │ +0006f1a0: 6d5f 7265 7175 6573 745f 7175 6575 6520 m_request_queue │ │ │ +0006f1b0: 7468 6174 0a09 092f 2f20 736f 6f6e 2077 that...// soon w │ │ │ +0006f1c0: 696c 6c20 6265 2063 6f6d 6d69 7474 6564 ill be committed │ │ │ +0006f1d0: 2074 6f20 7468 6520 646f 776e 6c6f 6164 to the download │ │ │ +0006f1e0: 0a09 092f 2f20 7175 6575 652e 2054 6869 ...// queue. Thi │ │ │ +0006f1f0: 7320 6973 2069 6e63 6c75 6465 6420 696e s is included in │ │ │ +0006f200: 2064 6f77 6e6c 6f61 645f 7175 6575 655f download_queue_ │ │ │ +0006f210: 7469 6d65 2829 0a09 092f 2f20 736f 2074 time()...// so t │ │ │ +0006f220: 6861 7420 6974 2063 616e 2062 6520 7573 hat it can be us │ │ │ +0006f230: 6564 2077 6869 6c65 2061 6464 696e 6720 ed while adding │ │ │ +0006f240: 6d6f 7265 0a09 092f 2f20 7265 7175 6573 more...// reques │ │ │ +0006f250: 7473 2061 6e64 2074 616b 6520 7468 6520 ts and take the │ │ │ +0006f260: 7072 6576 696f 7573 2072 6571 7565 7374 previous request │ │ │ +0006f270: 730a 0909 2f2f 2069 6e74 6f20 6163 636f s...// into acco │ │ │ +0006f280: 756e 7420 7769 7468 6f75 7420 7375 626d unt without subm │ │ │ +0006f290: 6974 7469 6e67 2069 7420 616c 6c0a 0909 itting it all... │ │ │ +0006f2a0: 2f2f 2069 6d6d 6564 6961 7465 6c79 0a09 // immediately.. │ │ │ +0006f2b0: 0973 7464 3a3a 7569 6e74 3136 5f74 206d .std::uint16_t m │ │ │ +0006f2c0: 5f71 7565 7565 645f 7469 6d65 5f63 7269 _queued_time_cri │ │ │ +0006f2d0: 7469 6361 6c20 3d20 303b 0a0a 0909 2f2f tical = 0;....// │ │ │ +0006f2e0: 2074 6865 206e 756d 6265 7220 6f66 2062 the number of b │ │ │ +0006f2f0: 7974 6573 2077 6520 6172 6520 6375 7272 ytes we are curr │ │ │ +0006f300: 656e 746c 7920 7265 6164 696e 670a 0909 ently reading... │ │ │ +0006f310: 2f2f 2066 726f 6d20 6469 736b 2c20 7468 // from disk, th │ │ │ +0006f320: 6174 2077 696c 6c20 6265 2061 6464 6564 at will be added │ │ │ +0006f330: 2074 6f20 7468 6520 7365 6e64 0a09 092f to the send.../ │ │ │ +0006f340: 2f20 6275 6666 6572 2061 7320 736f 6f6e / buffer as soon │ │ │ +0006f350: 2061 7320 7468 6579 2063 6f6d 706c 6574 as they complet │ │ │ +0006f360: 650a 0909 696e 7420 6d5f 7265 6164 696e e...int m_readin │ │ │ +0006f370: 675f 6279 7465 7320 3d20 303b 0a0a 0909 g_bytes = 0;.... │ │ │ +0006f380: 2f2f 206f 7074 696f 6e73 2075 7365 6420 // options used │ │ │ +0006f390: 666f 7220 7468 6520 7069 6563 6520 7069 for the piece pi │ │ │ +0006f3a0: 636b 6572 2e20 5468 6573 6520 666c 6167 cker. These flag │ │ │ +0006f3b0: 7320 7769 6c6c 0a09 092f 2f20 6265 2061 s will...// be a │ │ │ +0006f3c0: 7567 6d65 6e74 6564 2077 6974 6820 666c ugmented with fl │ │ │ +0006f3d0: 6167 7320 636f 6e74 726f 6c6c 6564 2062 ags controlled b │ │ │ +0006f3e0: 7920 6f74 6865 7220 7365 7474 696e 6773 y other settings │ │ │ +0006f3f0: 0a09 092f 2f20 6c69 6b65 2073 6571 7565 ...// like seque │ │ │ +0006f400: 6e74 6961 6c20 646f 776e 6c6f 6164 2065 ntial download e │ │ │ +0006f410: 7463 2e20 5468 6573 6520 6172 6520 6865 tc. These are he │ │ │ +0006f420: 7265 2074 6f0a 0909 2f2f 206c 6574 2070 re to...// let p │ │ │ +0006f430: 6c75 6769 6e73 2063 6f6e 7472 6f6c 2066 lugins control f │ │ │ +0006f440: 6c61 6773 2074 6861 7420 7368 6f75 6c64 lags that should │ │ │ +0006f450: 2061 6c77 6179 7320 6265 2073 6574 0a09 always be set.. │ │ │ +0006f460: 0970 6963 6b65 725f 6f70 7469 6f6e 735f .picker_options_ │ │ │ +0006f470: 7420 6d5f 7069 636b 6572 5f6f 7074 696f t m_picker_optio │ │ │ +0006f480: 6e73 7b7d 3b0a 0a09 092f 2f20 7468 6520 ns{};....// the │ │ │ +0006f490: 6e75 6d62 6572 206f 6620 696e 7661 6c69 number of invali │ │ │ +0006f4a0: 6420 7069 6563 652d 7265 7175 6573 7473 d piece-requests │ │ │ +0006f4b0: 0a09 092f 2f20 7765 2068 6176 6520 676f ...// we have go │ │ │ +0006f4c0: 7420 6672 6f6d 2074 6869 7320 7065 6572 t from this peer │ │ │ +0006f4d0: 2e20 4966 2074 6865 2072 6571 7565 7374 . If the request │ │ │ +0006f4e0: 0a09 092f 2f20 7175 6575 6520 6765 7473 ...// queue gets │ │ │ +0006f4f0: 2065 6d70 7479 2c20 616e 6420 7468 6572 empty, and ther │ │ │ +0006f500: 6520 6861 7665 2062 6565 6e0a 0909 2f2f e have been...// │ │ │ +0006f510: 2069 6e76 616c 6964 2072 6571 7565 7374 invalid request │ │ │ +0006f520: 732c 2077 6520 6361 6e20 6173 7375 6d65 s, we can assume │ │ │ +0006f530: 2074 6865 0a3c 2f70 7265 3e3c 2f74 643e the.
    │ │ │ +0006f540: 3c2f 7472 3e3c 7472 2073 7479 6c65 3d22 relevance& │ │ │ +0006f570: 6e62 7370 3b30 3c2f 7464 3e3c 7464 3e3c nbsp;0< │ │ │ +0006f580: 6120 6872 6566 3d22 6a61 7661 7363 7269 a href="javascri │ │ │ +0006f590: 7074 3a65 7870 616e 6428 3235 3429 223e pt:expand(254)"> │ │ │ +0006f5a0: 2e2e 2f69 6e63 6c75 6465 2f6c 6962 746f ../include/libto │ │ │ +0006f5b0: 7272 656e 742f 746f 7272 656e 745f 696e rrent/torrent_in │ │ │ +0006f5c0: 666f 2e68 7070 3a37 3537 3c2f 613e 3c2f fo.hpp:757change th │ │ │ +0006f5e0: 6520 7479 7065 2074 6f20 7374 643a 3a73 e type to std::s │ │ │ +0006f5f0: 6861 7265 645f 7074 723c 6368 6172 2063 hared_ptr in C++17 i │ │ │ +0006f610: 7420 6973 2075 7365 6420 6173 2069 6620 t is used as if │ │ │ +0006f620: 696d 6d75 7461 626c 652c 2069 7420 6361 immutable, it ca │ │ │ +0006f630: 6e6e 6f74 2062 6520 636f 6e73 7420 666f nnot be const fo │ │ │ +0006f640: 7220 7465 6368 6e69 6361 6c20 7265 6173 r technical reas │ │ │ +0006f650: 6f6e 7320 7269 6768 7420 6e6f 772e 3c2f ons right now.

    chan │ │ │ +0006f6b0: 6765 2074 6865 2074 7970 6520 746f 2073 ge the type to s │ │ │ +0006f6c0: 7464 3a3a 7368 6172 6564 5f70 7472 3c63 td::shared_ptr in C+ │ │ │ +0006f6e0: 2b31 370a 6974 2069 7320 7573 6564 2061 +17.it is used a │ │ │ +0006f6f0: 7320 6966 2069 6d6d 7574 6162 6c65 2c20 s if immutable, │ │ │ +0006f700: 6974 2063 616e 6e6f 7420 6265 2063 6f6e it cannot be con │ │ │ +0006f710: 7374 2066 6f72 2074 6563 686e 6963 616c st for technical │ │ │ +0006f720: 2072 6561 736f 6e73 0a72 6967 6874 206e reasons.right n │ │ │ +0006f730: 6f77 2e3c 2f68 323e 3c68 343e 2e2e 2f69 ow.

    ../i │ │ │ +0006f740: 6e63 6c75 6465 2f6c 6962 746f 7272 656e nclude/libtorren │ │ │ +0006f750: 742f 746f 7272 656e 745f 696e 666f 2e68 t/torrent_info.h │ │ │ +0006f760: 7070 3a37 3537 3c2f 6834 3e3c 7072 6520 pp:757

    ...// these
    │ │ │ +0006f7b0: 2061 7265 2074 6865 2063 6f6c 6c65 6374   are the collect
    │ │ │ +0006f7c0: 696f 6e73 2066 726f 6d20 6f75 7473 6964  ions from outsid
    │ │ │ +0006f7d0: 6520 6f66 2074 6865 2069 6e66 6f2d 6469  e of the info-di
    │ │ │ +0006f7e0: 6374 2e20 5468 6573 6520 6172 650a 0909  ct. These are...
    │ │ │ +0006f7f0: 2f2f 206f 776e 696e 6720 7374 7269 6e67  // owning string
    │ │ │ +0006f800: 732c 2073 696e 6365 2077 6520 6f6e 6c79  s, since we only
    │ │ │ +0006f810: 206b 6565 7020 7468 6520 696e 666f 2d73   keep the info-s
    │ │ │ +0006f820: 6563 7469 6f6e 2061 726f 756e 642c 2074  ection around, t
    │ │ │ +0006f830: 6865 7365 0a09 092f 2f20 6361 6e6e 6f74  hese...// cannot
    │ │ │ +0006f840: 2062 6520 706f 696e 7465 7273 2069 6e74   be pointers int
    │ │ │ +0006f850: 6f20 7468 6174 2062 7566 6665 722e 0a09  o that buffer...
    │ │ │ +0006f860: 0973 7464 3a3a 7665 6374 6f72 266c 743b  .std::vector<
    │ │ │ +0006f870: 7374 643a 3a73 7472 696e 6726 6774 3b20  std::string> 
    │ │ │ +0006f880: 6d5f 6f77 6e65 645f 636f 6c6c 6563 7469  m_owned_collecti
    │ │ │ +0006f890: 6f6e 733b 0a0a 2369 6620 544f 5252 454e  ons;..#if TORREN
    │ │ │ +0006f8a0: 545f 4142 495f 5645 5253 494f 4e20 266c  T_ABI_VERSION &l
    │ │ │ +0006f8b0: 743b 3d20 320a 0909 2f2f 2069 6620 7468  t;= 2...// if th
    │ │ │ +0006f8c0: 6973 2069 7320 6120 6d65 726b 6c65 2074  is is a merkle t
    │ │ │ +0006f8d0: 6f72 7265 6e74 2c20 7468 6973 2069 7320  orrent, this is 
    │ │ │ +0006f8e0: 7468 6520 6d65 726b 6c65 0a09 092f 2f20  the merkle...// 
    │ │ │ +0006f8f0: 7472 6565 2e20 4974 2068 6173 2073 7061  tree. It has spa
    │ │ │ +0006f900: 6365 2066 6f72 206d 6572 6b6c 655f 6e75  ce for merkle_nu
    │ │ │ +0006f910: 6d5f 6e6f 6465 7328 6d65 726b 6c65 5f6e  m_nodes(merkle_n
    │ │ │ +0006f920: 756d 5f6c 6561 6673 286e 756d 5f70 6965  um_leafs(num_pie
    │ │ │ +0006f930: 6365 7329 290a 0909 2f2f 2068 6173 6865  ces))...// hashe
    │ │ │ +0006f940: 730a 0909 6175 783a 3a76 6563 746f 7226  s...aux::vector&
    │ │ │ +0006f950: 6c74 3b73 6861 315f 6861 7368 2667 743b  lt;sha1_hash>
    │ │ │ +0006f960: 206d 5f6d 6572 6b6c 655f 7472 6565 3b0a   m_merkle_tree;.
    │ │ │ +0006f970: 2365 6e64 6966 0a0a 0909 2f2f 2076 3220  #endif....// v2 
    │ │ │ +0006f980: 6d65 726b 6c65 2074 7265 6520 666f 7220  merkle tree for 
    │ │ │ +0006f990: 6561 6368 2066 696c 650a 0909 2f2f 2074  each file...// t
    │ │ │ +0006f9a0: 6865 2061 6374 7561 6c20 6861 7368 2062  he actual hash b
    │ │ │ +0006f9b0: 7566 6665 7273 2061 7265 2061 6c77 6179  uffers are alway
    │ │ │ +0006f9c0: 7320 6469 7669 7369 626c 6520 6279 2033  s divisible by 3
    │ │ │ +0006f9d0: 3220 2873 6861 3235 365f 6861 7368 3a3a  2 (sha256_hash::
    │ │ │ +0006f9e0: 7369 7a65 2829 290a 0909 6175 783a 3a76  size())...aux::v
    │ │ │ +0006f9f0: 6563 746f 7226 6c74 3b61 7578 3a3a 7665  ector<aux::ve
    │ │ │ +0006fa00: 6374 6f72 266c 743b 6368 6172 2667 743b  ctor<char>
    │ │ │ +0006fa10: 2c20 6669 6c65 5f69 6e64 6578 5f74 2667  , file_index_t&g
    │ │ │ +0006fa20: 743b 206d 5f70 6965 6365 5f6c 6179 6572  t; m_piece_layer
    │ │ │ +0006fa30: 733b 0a0a 0909 2f2f 2074 6869 7320 6973  s;....// this is
    │ │ │ +0006fa40: 2061 2063 6f70 7920 6f66 2074 6865 2069   a copy of the i
    │ │ │ +0006fa50: 6e66 6f20 7365 6374 696f 6e20 6672 6f6d  nfo section from
    │ │ │ +0006fa60: 2074 6865 2074 6f72 7265 6e74 2e0a 0909   the torrent....
    │ │ │ +0006fa70: 2f2f 2069 7420 7573 6520 6d61 696e 7461  // it use mainta
    │ │ │ +0006fa80: 696e 6564 2069 6e20 7468 6973 2066 6c61  ined in this fla
    │ │ │ +0006fa90: 7420 666f 726d 6174 2069 6e20 6f72 6465  t format in orde
    │ │ │ +0006faa0: 7220 746f 0a09 092f 2f20 6d61 6b65 2069  r to...// make i
    │ │ │ +0006fab0: 7420 6176 6169 6c61 626c 6520 7468 726f  t available thro
    │ │ │ +0006fac0: 7567 6820 7468 6520 6d65 7461 6461 7461  ugh the metadata
    │ │ │ +0006fad0: 2065 7874 656e 7369 6f6e 0a3c 6469 7620   extension.
    ..boost │ │ │ +0006fb10: 3a3a 7368 6172 6564 5f61 7272 6179 266c ::shared_array&l │ │ │ +0006fb20: 743b 6368 6172 2667 743b 206d 5f69 6e66 t;char> m_inf │ │ │ +0006fb30: 6f5f 7365 6374 696f 6e3b 0a3c 2f64 6976 o_section;.
    ...// if a comm │ │ │ +0006fb50: 656e 7420 6973 2066 6f75 6e64 2069 6e20 ent is found in │ │ │ +0006fb60: 7468 6520 746f 7272 656e 7420 6669 6c65 the torrent file │ │ │ +0006fb70: 0a09 092f 2f20 7468 6973 2077 696c 6c20 ...// this will │ │ │ +0006fb80: 6265 2073 6574 2074 6f20 7468 6174 2063 be set to that c │ │ │ +0006fb90: 6f6d 6d65 6e74 0a09 0973 7464 3a3a 7374 omment...std::st │ │ │ +0006fba0: 7269 6e67 206d 5f63 6f6d 6d65 6e74 3b0a ring m_comment;. │ │ │ +0006fbb0: 0a09 092f 2f20 616e 206f 7074 696f 6e61 ...// an optiona │ │ │ +0006fbc0: 6c20 7374 7269 6e67 206e 616d 696e 6720 l string naming │ │ │ +0006fbd0: 7468 6520 736f 6674 7761 7265 2075 7365 the software use │ │ │ +0006fbe0: 640a 0909 2f2f 2074 6f20 6372 6561 7465 d...// to create │ │ │ +0006fbf0: 2074 6865 2074 6f72 7265 6e74 2066 696c the torrent fil │ │ │ +0006fc00: 650a 0909 7374 643a 3a73 7472 696e 6720 e...std::string │ │ │ +0006fc10: 6d5f 6372 6561 7465 645f 6279 3b0a 0a09 m_created_by;... │ │ │ +0006fc20: 092f 2f20 7468 6520 696e 666f 2073 6563 .// the info sec │ │ │ +0006fc30: 7469 6f6e 2070 6172 7365 642e 2070 6f69 tion parsed. poi │ │ │ +0006fc40: 6e74 7320 696e 746f 206d 5f69 6e66 6f5f nts into m_info_ │ │ │ +0006fc50: 7365 6374 696f 6e0a 0909 2f2f 2070 6172 section...// par │ │ │ +0006fc60: 7365 6420 6c61 7a69 6c79 0a09 096d 7574 sed lazily...mut │ │ │ +0006fc70: 6162 6c65 2062 6465 636f 6465 5f6e 6f64 able bdecode_nod │ │ │ +0006fc80: 6520 6d5f 696e 666f 5f64 6963 743b 0a0a e m_info_dict;.. │ │ │ +0006fc90: 0909 2f2f 2069 6620 6120 6372 6561 7469 ..// if a creati │ │ │ +0006fca0: 6f6e 2064 6174 6520 6973 2066 6f75 6e64 on date is found │ │ │ +0006fcb0: 2069 6e20 7468 6520 746f 7272 656e 7420 in the torrent │ │ │ +0006fcc0: 6669 6c65 0a09 092f 2f20 7468 6973 2077 file...// this w │ │ │ +0006fcd0: 696c 6c20 6265 2073 6574 2074 6f20 7468 ill be set to th │ │ │ +0006fce0: 6174 2c20 6f74 6865 7277 6973 6520 6974 at, otherwise it │ │ │ +0006fcf0: 276c 6c20 6265 0a09 092f 2f20 3139 3730 'll be...// 1970 │ │ │ +0006fd00: 2c20 4a61 6e20 310a 0909 7374 643a 3a74 , Jan 1...std::t │ │ │ +0006fd10: 696d 655f 7420 6d5f 6372 6561 7469 6f6e ime_t m_creation │ │ │ +0006fd20: 5f64 6174 6520 3d20 303b 0a0a 0909 2f2f _date = 0;....// │ │ │ +0006fd30: 2074 6865 2068 6173 6828 6573 2920 7468 the hash(es) th │ │ │ +0006fd40: 6174 2069 6465 6e74 6966 7920 7468 6973 at identify this │ │ │ +0006fd50: 2074 6f72 7265 6e74 0a09 0969 6e66 6f5f torrent...info_ │ │ │ +0006fd60: 6861 7368 5f74 206d 5f69 6e66 6f5f 6861 hash_t m_info_ha │ │ │ +0006fd70: 7368 3b0a 0a09 092f 2f20 7468 6973 2069 sh;....// this i │ │ │ +0006fd80: 7320 7468 6520 6f66 6673 6574 2069 6e74 s the offset int │ │ │ +0006fd90: 6f20 7468 6520 6d5f 696e 666f 5f73 6563 o the m_info_sec │ │ │ +0006fda0: 7469 6f6e 2062 7566 6665 7220 746f 2074 tion buffer to t │ │ │ +0006fdb0: 6865 2066 6972 7374 2062 7974 6520 6f66 he first byte of │ │ │ +0006fdc0: 0a09 092f 2f20 7468 6520 6669 7273 7420 ...// the first │ │ │ +0006fdd0: 5348 412d 3120 6861 7368 0a09 0973 7464 SHA-1 hash...std │ │ │ +0006fde0: 3a3a 696e 7433 325f 7420 6d5f 7069 6563 ::int32_t m_piec │ │ │ +0006fdf0: 655f 6861 7368 6573 203d 2030 3b0a 0a09 e_hashes = 0;... │ │ │ +0006fe00: 092f 2f20 7468 6520 6e75 6d62 6572 206f .// the number o │ │ │ +0006fe10: 6620 6279 7465 7320 696e 206d 5f69 6e66 f bytes in m_inf │ │ │ +0006fe20: 6f5f 7365 6374 696f 6e0a 0909 7374 643a o_section...std: │ │ │ +0006fe30: 3a69 6e74 3332 5f74 206d 5f69 6e66 6f5f :int32_t m_info_ │ │ │ +0006fe40: 7365 6374 696f 6e5f 7369 7a65 203d 2030 section_size = 0 │ │ │ +0006fe50: 3b0a 0a09 092f 2f20 7468 6973 2069 7320 ;....// this is │ │ │ +0006fe60: 7573 6564 2077 6865 6e20 6372 6561 7469 used when creati │ │ │ +0006fe70: 6e67 2061 2074 6f72 7265 6e74 2e20 4966 ng a torrent. If │ │ │ +0006fe80: 2074 6865 7265 2773 0a09 092f 2f20 6f6e there's...// on │ │ │ +0006fe90: 6c79 206f 6e65 2066 696c 6520 7468 6572 ly one file ther │ │ │ +0006fea0: 6520 6172 6520 6361 7365 7320 7768 6572 e are cases wher │ │ │ +0006feb0: 6520 6974 2773 2069 6d70 6f73 7369 626c e it's impossibl │ │ │ +0006fec0: 650a 3c2f 7072 653e 3c2f 7464 3e3c 2f74 e.
    < │ │ │ +0006fef0: 7464 3e72 656c 6576 616e 6365 266e 6273 td>relevance&nbs │ │ │ +0006ff00: 703b 303c 2f74 643e 3c74 643e 3c61 2068 p;0../ │ │ │ +0006ff30: 696e 636c 7564 652f 6c69 6274 6f72 7265 include/libtorre │ │ │ +0006ff40: 6e74 2f70 6572 666f 726d 616e 6365 5f63 nt/performance_c │ │ │ +0006ff50: 6f75 6e74 6572 732e 6870 703a 3439 313c ounters.hpp:491< │ │ │ +0006ff60: 2f61 3e3c 2f74 643e 3c74 643e 736f 6d65 /a>some │ │ │ +0006ff70: 2073 7061 6365 2063 6f75 6c64 2062 6520 space could be │ │ │ +0006ff80: 7361 7665 6420 6865 7265 2062 7920 6d61 saved here by ma │ │ │ +0006ff90: 6b69 6e67 2067 6175 6765 7320 3332 2062 king gauges 32 b │ │ │ +0006ffa0: 6974 733c 2f74 643e 3c2f 7472 3e3c 7472 its

    some space coul │ │ │ +00070000: 6420 6265 2073 6176 6564 2068 6572 6520 d be saved here │ │ │ +00070010: 6279 206d 616b 696e 6720 6761 7567 6573 by making gauges │ │ │ +00070020: 2033 3220 6269 7473 3c2f 6832 3e3c 6834 32 bits

    ../include/libt │ │ │ +00070040: 6f72 7265 6e74 2f70 6572 666f 726d 616e orrent/performan │ │ │ +00070050: 6365 5f63 6f75 6e74 6572 732e 6870 703a ce_counters.hpp: │ │ │ +00070060: 3439 313c 2f68 343e 3c70 7265 2073 7479 491

    <
    │ │ │ +000700d0: 7464 3e72 656c 6576 616e 6365 266e 6273  td>relevance&nbs
    │ │ │ +000700e0: 703b 303c 2f74 643e 3c74 643e 3c61 2068  p;0
    ../ │ │ │ +00070110: 696e 636c 7564 652f 6c69 6274 6f72 7265 include/libtorre │ │ │ +00070120: 6e74 2f70 6572 666f 726d 616e 6365 5f63 nt/performance_c │ │ │ +00070130: 6f75 6e74 6572 732e 6870 703a 3439 323c ounters.hpp:492< │ │ │ +00070140: 2f61 3e3c 2f74 643e 3c74 643e 7265 7374 /a>rest │ │ │ +00070150: 6f72 6520 7468 6573 6520 746f 2072 6567 ore these to reg │ │ │ +00070160: 756c 6172 2069 6e74 6567 6572 732e 2049 ular integers. I │ │ │ +00070170: 6e73 7465 6164 2068 6176 6520 6f6e 6520 nstead have one │ │ │ +00070180: 636f 7079 206f 6620 7468 6520 636f 756e copy of the coun │ │ │ +00070190: 7465 7273 2070 6572 2074 6872 6561 6420 ters per thread │ │ │ +000701a0: 616e 6420 636f 6c6c 6563 7420 7468 656d and collect them │ │ │ +000701b0: 2061 7420 636f 6e76 656e 6965 6e74 2073 at convenient s │ │ │ +000701c0: 796e 6368 726f 6e69 7a61 7469 6f6e 2070 ynchronization p │ │ │ +000701d0: 6f69 6e74 733c 2f74 643e 3c2f 7472 3e3c oints< │ │ │ +000701e0: 7472 2069 643d 2232 3536 2220 7374 796c tr id="256" styl │ │ │ +000701f0: 653d 2264 6973 706c 6179 3a20 6e6f 6e65 e="display: none │ │ │ +00070200: 3b22 2063 6f6c 7370 616e 3d22 3322 3e3c ;" colspan="3">< │ │ │ +00070210: 7464 2063 6f6c 7370 616e 3d22 3322 3e3c td colspan="3">< │ │ │ +00070220: 6832 3e72 6573 746f 7265 2074 6865 7365 h2>restore these │ │ │ +00070230: 2074 6f20 7265 6775 6c61 7220 696e 7465 to regular inte │ │ │ +00070240: 6765 7273 2e20 496e 7374 6561 6420 6861 gers. Instead ha │ │ │ +00070250: 7665 206f 6e65 2063 6f70 790a 6f66 2074 ve one copy.of t │ │ │ +00070260: 6865 2063 6f75 6e74 6572 7320 7065 7220 he counters per │ │ │ +00070270: 7468 7265 6164 2061 6e64 2063 6f6c 6c65 thread and colle │ │ │ +00070280: 6374 2074 6865 6d20 6174 2063 6f6e 7665 ct them at conve │ │ │ +00070290: 6e69 656e 740a 7379 6e63 6872 6f6e 697a nient.synchroniz │ │ │ +000702a0: 6174 696f 6e20 706f 696e 7473 3c2f 6832 ation points

    ../include/ │ │ │ +000702c0: 6c69 6274 6f72 7265 6e74 2f70 6572 666f libtorrent/perfo │ │ │ +000702d0: 726d 616e 6365 5f63 6f75 6e74 6572 732e rmance_counters. │ │ │ +000702e0: 6870 703a 3439 323c 2f68 343e 3c70 7265 hpp:492

    #ifdef ATO
    │ │ │ +00070330: 4d49 435f 4c4c 4f4e 475f 4c4f 434b 5f46  MIC_LLONG_LOCK_F
    │ │ │ +00070340: 5245 450a 2364 6566 696e 6520 544f 5252  REE.#define TORR
    │ │ │ +00070350: 454e 545f 434f 554e 5445 525f 4e4f 4558  ENT_COUNTER_NOEX
    │ │ │ +00070360: 4345 5054 206e 6f65 7863 6570 740a 2365  CEPT noexcept.#e
    │ │ │ +00070370: 6c73 650a 2364 6566 696e 6520 544f 5252  lse.#define TORR
    │ │ │ +00070380: 454e 545f 434f 554e 5445 525f 4e4f 4558  ENT_COUNTER_NOEX
    │ │ │ +00070390: 4345 5054 0a23 656e 6469 660a 0a09 0963  CEPT.#endif....c
    │ │ │ +000703a0: 6f75 6e74 6572 7328 2920 544f 5252 454e  ounters() TORREN
    │ │ │ +000703b0: 545f 434f 554e 5445 525f 4e4f 4558 4345  T_COUNTER_NOEXCE
    │ │ │ +000703c0: 5054 3b0a 0a09 0963 6f75 6e74 6572 7328  PT;....counters(
    │ │ │ +000703d0: 636f 756e 7465 7273 2063 6f6e 7374 2661  counters const&a
    │ │ │ +000703e0: 6d70 3b29 2054 4f52 5245 4e54 5f43 4f55  mp;) TORRENT_COU
    │ │ │ +000703f0: 4e54 4552 5f4e 4f45 5843 4550 543b 0a09  NTER_NOEXCEPT;..
    │ │ │ +00070400: 0963 6f75 6e74 6572 7326 616d 703b 206f  .counters& o
    │ │ │ +00070410: 7065 7261 746f 723d 2863 6f75 6e74 6572  perator=(counter
    │ │ │ +00070420: 7320 636f 6e73 7426 616d 703b 2920 2661  s const&) &a
    │ │ │ +00070430: 6d70 3b20 544f 5252 454e 545f 434f 554e  mp; TORRENT_COUN
    │ │ │ +00070440: 5445 525f 4e4f 4558 4345 5054 3b0a 0a09  TER_NOEXCEPT;...
    │ │ │ +00070450: 092f 2f20 7265 7475 726e 7320 7468 6520  .// returns the 
    │ │ │ +00070460: 6e65 7720 7661 6c75 650a 0909 7374 643a  new value...std:
    │ │ │ +00070470: 3a69 6e74 3634 5f74 2069 6e63 5f73 7461  :int64_t inc_sta
    │ │ │ +00070480: 7473 5f63 6f75 6e74 6572 2869 6e74 2063  ts_counter(int c
    │ │ │ +00070490: 2c20 7374 643a 3a69 6e74 3634 5f74 2076  , std::int64_t v
    │ │ │ +000704a0: 616c 7565 203d 2031 2920 544f 5252 454e  alue = 1) TORREN
    │ │ │ +000704b0: 545f 434f 554e 5445 525f 4e4f 4558 4345  T_COUNTER_NOEXCE
    │ │ │ +000704c0: 5054 3b0a 0909 7374 643a 3a69 6e74 3634  PT;...std::int64
    │ │ │ +000704d0: 5f74 206f 7065 7261 746f 725b 5d28 696e  _t operator[](in
    │ │ │ +000704e0: 7420 6929 2063 6f6e 7374 2054 4f52 5245  t i) const TORRE
    │ │ │ +000704f0: 4e54 5f43 4f55 4e54 4552 5f4e 4f45 5843  NT_COUNTER_NOEXC
    │ │ │ +00070500: 4550 543b 0a0a 0909 766f 6964 2073 6574  EPT;....void set
    │ │ │ +00070510: 5f76 616c 7565 2869 6e74 2063 2c20 7374  _value(int c, st
    │ │ │ +00070520: 643a 3a69 6e74 3634 5f74 2076 616c 7565  d::int64_t value
    │ │ │ +00070530: 2920 544f 5252 454e 545f 434f 554e 5445  ) TORRENT_COUNTE
    │ │ │ +00070540: 525f 4e4f 4558 4345 5054 3b0a 0909 766f  R_NOEXCEPT;...vo
    │ │ │ +00070550: 6964 2062 6c65 6e64 5f73 7461 7473 5f63  id blend_stats_c
    │ │ │ +00070560: 6f75 6e74 6572 2869 6e74 2063 2c20 7374  ounter(int c, st
    │ │ │ +00070570: 643a 3a69 6e74 3634 5f74 2076 616c 7565  d::int64_t value
    │ │ │ +00070580: 2c20 696e 7420 7261 7469 6f29 2054 4f52  , int ratio) TOR
    │ │ │ +00070590: 5245 4e54 5f43 4f55 4e54 4552 5f4e 4f45  RENT_COUNTER_NOE
    │ │ │ +000705a0: 5843 4550 543b 0a0a 0970 7269 7661 7465  XCEPT;...private
    │ │ │ +000705b0: 3a0a 0a3c 6469 7620 7374 796c 653d 2262  :..
    #ifdef ATOMIC_L │ │ │ +000705f0: 4c4f 4e47 5f4c 4f43 4b5f 4652 4545 0a3c LONG_LOCK_FREE.< │ │ │ +00070600: 2f64 6976 3e09 0961 7578 3a3a 6172 7261 /div>..aux::arra │ │ │ +00070610: 7926 6c74 3b73 7464 3a3a 6174 6f6d 6963 y<std::atomic │ │ │ +00070620: 266c 743b 7374 643a 3a69 6e74 3634 5f74 <std::int64_t │ │ │ +00070630: 2667 743b 2c20 6e75 6d5f 636f 756e 7465 >, num_counte │ │ │ +00070640: 7273 2667 743b 206d 5f73 7461 7473 5f63 rs> m_stats_c │ │ │ +00070650: 6f75 6e74 6572 3b0a 2365 6c73 650a 0909 ounter;.#else... │ │ │ +00070660: 2f2f 2069 6620 7468 6520 6174 6f6d 6963 // if the atomic │ │ │ +00070670: 2074 7970 6520 6973 6e27 7420 6c6f 636b type isn't lock │ │ │ +00070680: 2d66 7265 652c 2075 7365 2061 2073 696e -free, use a sin │ │ │ +00070690: 676c 6520 6c6f 636b 2069 6e73 7465 6164 gle lock instead │ │ │ +000706a0: 2c20 666f 720a 0909 2f2f 2074 6865 2077 , for...// the w │ │ │ +000706b0: 686f 6c65 2061 7272 6179 0a09 096d 7574 hole array...mut │ │ │ +000706c0: 6162 6c65 2073 7464 3a3a 6d75 7465 7820 able std::mutex │ │ │ +000706d0: 6d5f 6d75 7465 783b 0a09 0961 7578 3a3a m_mutex;...aux:: │ │ │ +000706e0: 6172 7261 7926 6c74 3b73 7464 3a3a 696e array<std::in │ │ │ +000706f0: 7436 345f 742c 206e 756d 5f63 6f75 6e74 t64_t, num_count │ │ │ +00070700: 6572 7326 6774 3b20 6d5f 7374 6174 735f ers> m_stats_ │ │ │ +00070710: 636f 756e 7465 723b 0a23 656e 6469 660a counter;.#endif. │ │ │ +00070720: 097d 3b0a 7d0a 0a23 656e 6469 660a 3c2f .};.}..#endif.r │ │ │ +00070760: 656c 6576 616e 6365 266e 6273 703b 303c elevance 0< │ │ │ +00070770: 2f74 643e 3c74 643e 3c61 2068 7265 663d /td>../incl │ │ │ +000707a0: 7564 652f 6c69 6274 6f72 7265 6e74 2f75 ude/libtorrent/u │ │ │ +000707b0: 706e 702e 6870 703a 3136 343c 2f61 3e3c pnp.hpp:164< │ │ │ +000707c0: 2f74 643e 3c74 643e 7375 7070 6f72 7420 /td>support │ │ │ +000707d0: 7573 696e 6720 7468 6520 7769 6e64 6f77 using the window │ │ │ +000707e0: 7320 4150 4920 666f 7220 5550 6e50 206f s API for UPnP o │ │ │ +000707f0: 7065 7261 7469 6f6e 7320 6173 2077 656c perations as wel │ │ │ +00070800: 6c3c 2f74 643e 3c2f 7472 3e3c 7472 2069 l

    s │ │ │ +00070850: 7570 706f 7274 2075 7369 6e67 2074 6865 upport using the │ │ │ +00070860: 2077 696e 646f 7773 2041 5049 2066 6f72 windows API for │ │ │ +00070870: 2055 506e 5020 6f70 6572 6174 696f 6e73 UPnP operations │ │ │ +00070880: 2061 7320 7765 6c6c 3c2f 6832 3e3c 6834 as well

    ../include/libt │ │ │ +000708a0: 6f72 7265 6e74 2f75 706e 702e 6870 703a orrent/upnp.hpp: │ │ │ +000708b0: 3136 343c 2f68 343e 3c70 7265 2073 7479 164

    {..bool in_err
    │ │ │ +00070900: 6f72 5f63 6f64 6520 3d20 6661 6c73 653b  or_code = false;
    │ │ │ +00070910: 0a09 626f 6f6c 2065 7869 7420 3d20 6661  ..bool exit = fa
    │ │ │ +00070920: 6c73 653b 0a09 696e 7420 6572 726f 725f  lse;..int error_
    │ │ │ +00070930: 636f 6465 203d 202d 313b 0a7d 3b0a 0a73  code = -1;.};..s
    │ │ │ +00070940: 7472 7563 7420 6970 5f61 6464 7265 7373  truct ip_address
    │ │ │ +00070950: 5f70 6172 7365 5f73 7461 7465 3a20 6572  _parse_state: er
    │ │ │ +00070960: 726f 725f 636f 6465 5f70 6172 7365 5f73  ror_code_parse_s
    │ │ │ +00070970: 7461 7465 0a7b 0a09 626f 6f6c 2069 6e5f  tate.{..bool in_
    │ │ │ +00070980: 6970 5f61 6464 7265 7373 203d 2066 616c  ip_address = fal
    │ │ │ +00070990: 7365 3b0a 0973 7464 3a3a 7374 7269 6e67  se;..std::string
    │ │ │ +000709a0: 2069 705f 6164 6472 6573 733b 0a7d 3b0a   ip_address;.};.
    │ │ │ +000709b0: 0a54 4f52 5245 4e54 5f45 5854 5241 5f45  .TORRENT_EXTRA_E
    │ │ │ +000709c0: 5850 4f52 5420 766f 6964 2066 696e 645f  XPORT void find_
    │ │ │ +000709d0: 636f 6e74 726f 6c5f 7572 6c28 696e 7420  control_url(int 
    │ │ │ +000709e0: 7479 7065 2c20 7374 7269 6e67 5f76 6965  type, string_vie
    │ │ │ +000709f0: 772c 2070 6172 7365 5f73 7461 7465 2661  w, parse_state&a
    │ │ │ +00070a00: 6d70 3b20 7374 6174 6529 3b0a 0a54 4f52  mp; state);..TOR
    │ │ │ +00070a10: 5245 4e54 5f45 5854 5241 5f45 5850 4f52  RENT_EXTRA_EXPOR
    │ │ │ +00070a20: 5420 766f 6964 2066 696e 645f 6572 726f  T void find_erro
    │ │ │ +00070a30: 725f 636f 6465 2869 6e74 2074 7970 652c  r_code(int type,
    │ │ │ +00070a40: 2073 7472 696e 675f 7669 6577 2073 7472   string_view str
    │ │ │ +00070a50: 696e 670a 092c 2065 7272 6f72 5f63 6f64  ing.., error_cod
    │ │ │ +00070a60: 655f 7061 7273 655f 7374 6174 6526 616d  e_parse_state&am
    │ │ │ +00070a70: 703b 2073 7461 7465 293b 0a0a 544f 5252  p; state);..TORR
    │ │ │ +00070a80: 454e 545f 4558 5452 415f 4558 504f 5254  ENT_EXTRA_EXPORT
    │ │ │ +00070a90: 2076 6f69 6420 6669 6e64 5f69 705f 6164   void find_ip_ad
    │ │ │ +00070aa0: 6472 6573 7328 696e 7420 7479 7065 2c20  dress(int type, 
    │ │ │ +00070ab0: 7374 7269 6e67 5f76 6965 7720 7374 7269  string_view stri
    │ │ │ +00070ac0: 6e67 0a09 2c20 6970 5f61 6464 7265 7373  ng.., ip_address
    │ │ │ +00070ad0: 5f70 6172 7365 5f73 7461 7465 2661 6d70  _parse_state&
    │ │ │ +00070ae0: 3b20 7374 6174 6529 3b0a 0a3c 6469 7620  ; state);..
    struct │ │ │ +00070b20: 544f 5252 454e 545f 4558 5452 415f 4558 TORRENT_EXTRA_EX │ │ │ +00070b30: 504f 5254 2075 706e 7020 6669 6e61 6c0a PORT upnp final. │ │ │ +00070b40: 3c2f 6469 763e 093a 2073 7464 3a3a 656e
    .: std::en │ │ │ +00070b50: 6162 6c65 5f73 6861 7265 645f 6672 6f6d able_shared_from │ │ │ +00070b60: 5f74 6869 7326 6c74 3b75 706e 7026 6774 _this<upnp> │ │ │ +00070b70: 3b0a 092c 2073 696e 676c 655f 7468 7265 ;.., single_thre │ │ │ +00070b80: 6164 6564 0a7b 0a09 7570 6e70 2869 6f5f aded.{..upnp(io_ │ │ │ +00070b90: 636f 6e74 6578 7426 616d 703b 2069 6f73 context& ios │ │ │ +00070ba0: 0a09 092c 2061 7578 3a3a 7365 7373 696f ..., aux::sessio │ │ │ +00070bb0: 6e5f 7365 7474 696e 6773 2063 6f6e 7374 n_settings const │ │ │ +00070bc0: 2661 6d70 3b20 7365 7474 696e 6773 0a09 & settings.. │ │ │ +00070bd0: 092c 2061 7578 3a3a 706f 7274 6d61 705f ., aux::portmap_ │ │ │ +00070be0: 6361 6c6c 6261 636b 2661 6d70 3b20 6362 callback& cb │ │ │ +00070bf0: 0a09 092c 2061 6464 7265 7373 5f76 3420 ..., address_v4 │ │ │ +00070c00: 6c69 7374 656e 5f61 6464 7265 7373 0a09 listen_address.. │ │ │ +00070c10: 092c 2061 6464 7265 7373 5f76 3420 6e65 ., address_v4 ne │ │ │ +00070c20: 746d 6173 6b0a 0909 2c20 7374 643a 3a73 tmask..., std::s │ │ │ +00070c30: 7472 696e 6720 6c69 7374 656e 5f64 6576 tring listen_dev │ │ │ +00070c40: 6963 650a 0909 2c20 6175 783a 3a6c 6973 ice..., aux::lis │ │ │ +00070c50: 7465 6e5f 736f 636b 6574 5f68 616e 646c ten_socket_handl │ │ │ +00070c60: 6520 6c73 293b 0a09 7e75 706e 7028 293b e ls);..~upnp(); │ │ │ +00070c70: 0a0a 0976 6f69 6420 7374 6172 7428 293b ...void start(); │ │ │ +00070c80: 0a0a 092f 2f20 4174 7465 6d70 7473 2074 ...// Attempts t │ │ │ +00070c90: 6f20 6164 6420 6120 706f 7274 206d 6170 o add a port map │ │ │ +00070ca0: 7069 6e67 2066 6f72 2074 6865 2073 7065 ping for the spe │ │ │ +00070cb0: 6369 6669 6564 2070 726f 746f 636f 6c2e cified protocol. │ │ │ +00070cc0: 2056 616c 6964 2070 726f 746f 636f 6c73 Valid protocols │ │ │ +00070cd0: 2061 7265 0a09 2f2f 2060 6075 706e 703a are..// ``upnp: │ │ │ +00070ce0: 3a74 6370 6060 2061 6e64 2060 6075 706e :tcp`` and ``upn │ │ │ +00070cf0: 703a 3a75 6470 6060 2066 6f72 2074 6865 p::udp`` for the │ │ │ +00070d00: 2055 506e 5020 636c 6173 7320 616e 6420 UPnP class and │ │ │ +00070d10: 6060 6e61 7470 6d70 3a3a 7463 7060 6020 ``natpmp::tcp`` │ │ │ +00070d20: 616e 640a 092f 2f20 6060 6e61 7470 6d70 and..// ``natpmp │ │ │ +00070d30: 3a3a 7564 7060 6020 666f 7220 7468 6520 ::udp`` for the │ │ │ +00070d40: 4e41 542d 504d 5020 636c 6173 732e 0a09 NAT-PMP class... │ │ │ +00070d50: 2f2f 0a09 2f2f 2060 6065 7874 6572 6e61 //..// ``externa │ │ │ +00070d60: 6c5f 706f 7274 6060 2069 7320 7468 6520 l_port`` is the │ │ │ +00070d70: 706f 7274 206f 6e20 7468 6520 6578 7465 port on the exte │ │ │ +00070d80: 726e 616c 2061 6464 7265 7373 2074 6861 rnal address tha │ │ │ +00070d90: 7420 7769 6c6c 2062 6520 6d61 7070 6564 t will be mapped │ │ │ +00070da0: 2e20 5468 6973 0a09 2f2f 2069 7320 6120 . This..// is a │ │ │ +00070db0: 6869 6e74 2c20 796f 7520 6172 6520 6e6f hint, you are no │ │ │ +00070dc0: 7420 6775 6172 616e 7465 6564 2074 6861 t guaranteed tha │ │ │ +00070dd0: 7420 7468 6973 2070 6f72 7420 7769 6c6c t this port will │ │ │ +00070de0: 2062 6520 6176 6169 6c61 626c 652c 2061 be available, a │ │ │ +00070df0: 6e64 2069 7420 6d61 790a 092f 2f20 656e nd it may..// en │ │ │ +00070e00: 6420 7570 2062 6569 6e67 2073 6f6d 6574 d up being somet │ │ │ +00070e10: 6869 6e67 2065 6c73 652e 2049 6e20 7468 hing else. In th │ │ │ +00070e20: 6520 706f 7274 6d61 705f 616c 6572 745f e portmap_alert_ │ │ │ +00070e30: 206e 6f74 6966 6963 6174 696f 6e2c 2074 notification, t │ │ │ +00070e40: 6865 2061 6374 7561 6c0a 092f 2f20 6578 he actual..// ex │ │ │ +00070e50: 7465 726e 616c 2070 6f72 7420 6973 2072 ternal port is r │ │ │ +00070e60: 6570 6f72 7465 642e 0a09 2f2f 0a09 2f2f eported...//..// │ │ │ +00070e70: 2060 606c 6f63 616c 5f70 6f72 7460 6020 ``local_port`` │ │ │ +00070e80: 6973 2074 6865 2070 6f72 7420 696e 2074 is the port in t │ │ │ +00070e90: 6865 206c 6f63 616c 206d 6163 6869 6e65 he local machine │ │ │ +00070ea0: 2074 6861 7420 7468 6520 6d61 7070 696e that the mappin │ │ │ +00070eb0: 6720 7368 6f75 6c64 2066 6f72 7761 7264 g should forward │ │ │ +00070ec0: 0a09 2f2f 2074 6f2e 0a09 2f2f 0a09 2f2f ..// to...//..// │ │ │ +00070ed0: 2054 6865 2072 6574 7572 6e20 7661 6c75 The return valu │ │ │ +00070ee0: 6520 6973 2061 6e20 696e 6465 7820 7468 e is an index th │ │ │ +00070ef0: 6174 2069 6465 6e74 6966 6965 7320 7468 at identifies th │ │ │ +00070f00: 6973 2070 6f72 7420 6d61 7070 696e 672e is port mapping. │ │ │ +00070f10: 2054 6869 7320 6973 2075 7365 640a 092f This is used../ │ │ │ +00070f20: 2f20 746f 2072 6566 6572 2074 6f20 6d61 / to refer to ma │ │ │ +00070f30: 7070 696e 6773 2074 6861 7420 6661 696c ppings that fail │ │ │ +00070f40: 7320 6f72 2073 7563 6365 6564 7320 696e s or succeeds in │ │ │ +00070f50: 2074 6865 2070 6f72 746d 6170 5f65 7272 the portmap_err │ │ │ +00070f60: 6f72 5f61 6c65 7274 5f20 616e 640a 092f or_alert_ and../ │ │ │ +00070f70: 2f20 706f 7274 6d61 705f 616c 6572 745f / portmap_alert_ │ │ │ +00070f80: 2072 6573 7065 6374 6976 656c 792e 2049 respectively. I │ │ │ +00070f90: 6620 5468 6520 6d61 7070 696e 6720 6661 f The mapping fa │ │ │ +00070fa0: 696c 7320 696d 6d65 6469 6174 656c 792c ils immediately, │ │ │ +00070fb0: 2074 6865 2072 6574 7572 6e20 7661 6c75 the return valu │ │ │ +00070fc0: 650a 092f 2f20 6973 202d 312c 2077 6869 e..// is -1, whi │ │ │ +00070fd0: 6368 206d 6561 6e73 2066 6169 6c75 7265 ch means failure │ │ │ +00070fe0: 2e20 5468 6572 6520 7769 6c6c 206e 6f74 . There will not │ │ │ +00070ff0: 2062 6520 616e 7920 6572 726f 7220 616c be any error al │ │ │ +00071000: 6572 7420 6e6f 7469 6669 6361 7469 6f6e ert notification │ │ │ +00071010: 2066 6f72 0a3c 2f70 7265 3e3c 2f74 643e for.
    │ │ │ +00071020: 3c2f 7472 3e3c 7472 2073 7479 6c65 3d22 relevance& │ │ │ +00071050: 6e62 7370 3b30 3c2f 7464 3e3c 7464 3e3c nbsp;0< │ │ │ +00071060: 6120 6872 6566 3d22 6a61 7661 7363 7269 a href="javascri │ │ │ +00071070: 7074 3a65 7870 616e 6428 3235 3829 223e pt:expand(258)"> │ │ │ +00071080: 2e2e 2f69 6e63 6c75 6465 2f6c 6962 746f ../include/libto │ │ │ +00071090: 7272 656e 742f 736f 636b 7335 5f73 7472 rrent/socks5_str │ │ │ +000710a0: 6561 6d2e 6870 703a 3139 393c 2f61 3e3c eam.hpp:199< │ │ │ +000710b0: 2f74 643e 3c74 643e 7765 2063 6f75 6c64 /td>we could │ │ │ +000710c0: 2062 696e 6420 7468 6520 736f 636b 6574 bind the socket │ │ │ +000710d0: 2068 6572 652c 2073 696e 6365 2077 6520 here, since we │ │ │ +000710e0: 6b6e 6f77 2077 6861 7420 7468 6520 7461 know what the ta │ │ │ +000710f0: 7267 6574 2065 6e64 706f 696e 7420 6973 rget endpoint is │ │ │ +00071100: 206f 6620 7468 6520 7072 6f78 793c 2f74 of the proxy

    we co │ │ │ +00071160: 756c 6420 6269 6e64 2074 6865 2073 6f63 uld bind the soc │ │ │ +00071170: 6b65 7420 6865 7265 2c20 7369 6e63 6520 ket here, since │ │ │ +00071180: 7765 206b 6e6f 7720 7768 6174 2074 6865 we know what the │ │ │ +00071190: 0a74 6172 6765 7420 656e 6470 6f69 6e74 .target endpoint │ │ │ +000711a0: 2069 7320 6f66 2074 6865 2070 726f 7879 is of the proxy │ │ │ +000711b0: 3c2f 6832 3e3c 6834 3e2e 2e2f 696e 636c

    ../incl │ │ │ +000711c0: 7564 652f 6c69 6274 6f72 7265 6e74 2f73 ude/libtorrent/s │ │ │ +000711d0: 6f63 6b73 355f 7374 7265 616d 2e68 7070 ocks5_stream.hpp │ │ │ +000711e0: 3a31 3939 3c2f 6834 3e3c 7072 6520 7374 :199

    ...}, std::mo
    │ │ │ +00071230: 7665 2868 616e 646c 6572 2929 293b 0a09  ve(handler)));..
    │ │ │ +00071240: 7d0a 0a70 7269 7661 7465 3a0a 0a09 7465  }..private:...te
    │ │ │ +00071250: 6d70 6c61 7465 2026 6c74 3b74 7970 656e  mplate <typen
    │ │ │ +00071260: 616d 6520 4861 6e64 6c65 7226 6774 3b0a  ame Handler>.
    │ │ │ +00071270: 0976 6f69 6420 6e61 6d65 5f6c 6f6f 6b75  .void name_looku
    │ │ │ +00071280: 7028 6572 726f 725f 636f 6465 2063 6f6e  p(error_code con
    │ │ │ +00071290: 7374 2661 6d70 3b20 652c 2074 6370 3a3a  st& e, tcp::
    │ │ │ +000712a0: 7265 736f 6c76 6572 3a3a 7265 7375 6c74  resolver::result
    │ │ │ +000712b0: 735f 7479 7065 2069 7073 0a09 092c 2048  s_type ips..., H
    │ │ │ +000712c0: 616e 646c 6572 2068 290a 097b 0a09 0943  andler h)..{...C
    │ │ │ +000712d0: 4f4d 504c 4554 455f 4153 594e 4328 2273  OMPLETE_ASYNC("s
    │ │ │ +000712e0: 6f63 6b73 355f 7374 7265 616d 3a3a 6e61  ocks5_stream::na
    │ │ │ +000712f0: 6d65 5f6c 6f6f 6b75 7022 293b 0a09 0969  me_lookup");...i
    │ │ │ +00071300: 6620 2868 616e 646c 655f 6572 726f 7228  f (handle_error(
    │ │ │ +00071310: 652c 2073 7464 3a3a 6d6f 7665 2868 2929  e, std::move(h))
    │ │ │ +00071320: 2920 7265 7475 726e 3b0a 0a09 0961 7574  ) return;....aut
    │ │ │ +00071330: 6f20 6920 3d20 6970 732e 6265 6769 6e28  o i = ips.begin(
    │ │ │ +00071340: 293b 0a09 0969 6620 2821 6d5f 736f 636b  );...if (!m_sock
    │ │ │ +00071350: 2e69 735f 6f70 656e 2829 290a 0909 7b0a  .is_open())...{.
    │ │ │ +00071360: 0909 0965 7272 6f72 5f63 6f64 6520 6563  ...error_code ec
    │ │ │ +00071370: 3b0a 0909 096d 5f73 6f63 6b2e 6f70 656e  ;....m_sock.open
    │ │ │ +00071380: 2869 2d26 6774 3b65 6e64 706f 696e 7428  (i->endpoint(
    │ │ │ +00071390: 292e 7072 6f74 6f63 6f6c 2829 2c20 6563  ).protocol(), ec
    │ │ │ +000713a0: 293b 0a09 0909 6966 2028 6861 6e64 6c65  );....if (handle
    │ │ │ +000713b0: 5f65 7272 6f72 2865 632c 2073 7464 3a3a  _error(ec, std::
    │ │ │ +000713c0: 6d6f 7665 2868 2929 2920 7265 7475 726e  move(h))) return
    │ │ │ +000713d0: 3b0a 0909 7d0a 0a3c 6469 7620 7374 796c  ;...}..
    ..ADD_OUTST │ │ │ +00071410: 414e 4449 4e47 5f41 5359 4e43 2822 736f ANDING_ASYNC("so │ │ │ +00071420: 636b 7335 5f73 7472 6561 6d3a 3a63 6f6e cks5_stream::con │ │ │ +00071430: 6e65 6374 6564 2229 3b0a 3c2f 6469 763e nected");.
    │ │ │ +00071440: 0909 6d5f 736f 636b 2e61 7379 6e63 5f63 ..m_sock.async_c │ │ │ +00071450: 6f6e 6e65 6374 2869 2d26 6774 3b65 6e64 onnect(i->end │ │ │ +00071460: 706f 696e 7428 292c 2077 7261 705f 616c point(), wrap_al │ │ │ +00071470: 6c6f 6361 746f 7228 0a09 0909 5b74 6869 locator(....[thi │ │ │ +00071480: 735d 2865 7272 6f72 5f63 6f64 6520 636f s](error_code co │ │ │ +00071490: 6e73 7426 616d 703b 2065 632c 2048 616e nst& ec, Han │ │ │ +000714a0: 646c 6572 2068 6e29 0a09 0909 7b20 636f dler hn)....{ co │ │ │ +000714b0: 6e6e 6563 7465 6428 6563 2c20 7374 643a nnected(ec, std: │ │ │ +000714c0: 3a6d 6f76 6528 686e 2929 3b20 7d2c 2073 :move(hn)); }, s │ │ │ +000714d0: 7464 3a3a 6d6f 7665 2868 2929 293b 0a09 td::move(h)));.. │ │ │ +000714e0: 7d0a 0a09 7465 6d70 6c61 7465 2026 6c74 }...template < │ │ │ +000714f0: 3b74 7970 656e 616d 6520 4861 6e64 6c65 ;typename Handle │ │ │ +00071500: 7226 6774 3b0a 0976 6f69 6420 636f 6e6e r>..void conn │ │ │ +00071510: 6563 7465 6428 6572 726f 725f 636f 6465 ected(error_code │ │ │ +00071520: 2063 6f6e 7374 2661 6d70 3b20 652c 2048 const& e, H │ │ │ +00071530: 616e 646c 6572 2068 290a 097b 0a09 0943 andler h)..{...C │ │ │ +00071540: 4f4d 504c 4554 455f 4153 594e 4328 2273 OMPLETE_ASYNC("s │ │ │ +00071550: 6f63 6b73 355f 7374 7265 616d 3a3a 636f ocks5_stream::co │ │ │ +00071560: 6e6e 6563 7465 6422 293b 0a09 0969 6620 nnected");...if │ │ │ +00071570: 2868 616e 646c 655f 6572 726f 7228 652c (handle_error(e, │ │ │ +00071580: 2073 7464 3a3a 6d6f 7665 2868 2929 2920 std::move(h))) │ │ │ +00071590: 7265 7475 726e 3b0a 0a09 0975 7369 6e67 return;....using │ │ │ +000715a0: 206e 616d 6573 7061 6365 206c 6962 746f namespace libto │ │ │ +000715b0: 7272 656e 743a 3a61 7578 3b0a 0909 6966 rrent::aux;...if │ │ │ +000715c0: 2028 6d5f 7665 7273 696f 6e20 3d3d 2035 (m_version == 5 │ │ │ +000715d0: 290a 0909 7b0a 0909 092f 2f20 7365 6e64 )...{....// send │ │ │ +000715e0: 2053 4f43 4b53 3520 6175 7468 656e 7469 SOCKS5 authenti │ │ │ +000715f0: 6361 7469 6f6e 206d 6574 686f 6473 0a09 cation methods.. │ │ │ +00071600: 0909 6d5f 6275 6666 6572 2e72 6573 697a ..m_buffer.resiz │ │ │ +00071610: 6528 6d5f 7573 6572 2e65 6d70 7479 2829 e(m_user.empty() │ │ │ +00071620: 3f33 3a34 293b 0a09 0909 6368 6172 2a20 ?3:4);....char* │ │ │ +00071630: 7020 3d20 2661 6d70 3b6d 5f62 7566 6665 p = &m_buffe │ │ │ +00071640: 725b 305d 3b0a 0909 0977 7269 7465 5f75 r[0];....write_u │ │ │ +00071650: 696e 7438 2835 2c20 7029 3b20 2f2f 2053 int8(5, p); // S │ │ │ +00071660: 4f43 4b53 2056 4552 5349 4f4e 2035 0a09 OCKS VERSION 5.. │ │ │ +00071670: 0909 6966 2028 6d5f 7573 6572 2e65 6d70 ..if (m_user.emp │ │ │ +00071680: 7479 2829 290a 0909 097b 0a09 0909 0977 ty())....{.....w │ │ │ +00071690: 7269 7465 5f75 696e 7438 2831 2c20 7029 rite_uint8(1, p) │ │ │ +000716a0: 3b20 2f2f 2031 2061 7574 6865 6e74 6963 ; // 1 authentic │ │ │ +000716b0: 6174 696f 6e20 6d65 7468 6f64 2028 6e6f ation method (no │ │ │ +000716c0: 2061 7574 6829 0a09 0909 0977 7269 7465 auth).....write │ │ │ +000716d0: 5f75 696e 7438 2830 2c20 7029 3b20 2f2f _uint8(0, p); // │ │ │ +000716e0: 206e 6f20 6175 7468 656e 7469 6361 7469 no authenticati │ │ │ +000716f0: 6f6e 0a09 0909 7d0a 0909 0965 6c73 650a on....}....else. │ │ │ +00071700: 0909 097b 0a09 0909 0977 7269 7465 5f75 ...{.....write_u │ │ │ +00071710: 696e 7438 2832 2c20 7029 3b20 2f2f 2032 int8(2, p); // 2 │ │ │ +00071720: 2061 7574 6865 6e74 6963 6174 696f 6e20 authentication │ │ │ +00071730: 6d65 7468 6f64 730a 0909 0909 7772 6974 methods.....writ │ │ │ +00071740: 655f 7569 6e74 3828 302c 2070 293b 202f e_uint8(0, p); / │ │ │ +00071750: 2f20 6e6f 2061 7574 6865 6e74 6963 6174 / no authenticat │ │ │ +00071760: 696f 6e0a 0909 0909 7772 6974 655f 7569 ion.....write_ui │ │ │ +00071770: 6e74 3828 322c 2070 293b 202f 2f20 7573 nt8(2, p); // us │ │ │ +00071780: 6572 6e61 6d65 2f70 6173 7377 6f72 640a ername/password. │ │ │ +00071790: 0909 097d 0a09 0909 4144 445f 4f55 5453 ...}....ADD_OUTS │ │ │ +000717a0: 5441 4e44 494e 475f 4153 594e 4328 2273 TANDING_ASYNC("s │ │ │ +000717b0: 6f63 6b73 355f 7374 7265 616d 3a3a 6861 ocks5_stream::ha │ │ │ +000717c0: 6e64 7368 616b 6531 2229 3b0a 3c2f 7072 ndshake1");.rel │ │ │ +00071800: 6576 616e 6365 266e 6273 703b 303c 2f74 evance 0../includ │ │ │ +00071840: 652f 6c69 6274 6f72 7265 6e74 2f69 3270 e/libtorrent/i2p │ │ │ +00071850: 5f73 7472 6561 6d2e 6870 703a 3533 343c _stream.hpp:534< │ │ │ +00071860: 2f61 3e3c 2f74 643e 3c74 643e 6d61 6b65 /a>make │ │ │ +00071870: 2074 6869 7320 6120 7374 7269 6e67 5f76 this a string_v │ │ │ +00071880: 6965 773c 2f74 643e 3c2f 7472 3e3c 7472 iew

    make this a str │ │ │ +000718e0: 696e 675f 7669 6577 3c2f 6832 3e3c 6834 ing_view

    ../include/libt │ │ │ +00071900: 6f72 7265 6e74 2f69 3270 5f73 7472 6561 orrent/i2p_strea │ │ │ +00071910: 6d2e 6870 703a 3533 343c 2f68 343e 3c70 m.hpp:534

    ...char │ │ │ +00071960: 746d 705b 3230 5d3b 0a09 0961 7578 3a3a tmp[20];...aux:: │ │ │ +00071970: 7261 6e64 6f6d 5f62 7974 6573 2874 6d70 random_bytes(tmp │ │ │ +00071980: 293b 0a09 096d 5f73 6573 7369 6f6e 5f69 );...m_session_i │ │ │ +00071990: 642e 7265 7369 7a65 2873 697a 656f 6628 d.resize(sizeof( │ │ │ +000719a0: 746d 7029 2a32 293b 0a09 0961 7578 3a3a tmp)*2);...aux:: │ │ │ +000719b0: 746f 5f68 6578 2874 6d70 2c20 2661 6d70 to_hex(tmp, & │ │ │ +000719c0: 3b6d 5f73 6573 7369 6f6e 5f69 645b 305d ;m_session_id[0] │ │ │ +000719d0: 293b 0a0a 0909 6d5f 7361 6d5f 736f 636b );....m_sam_sock │ │ │ +000719e0: 6574 203d 2073 7464 3a3a 6d61 6b65 5f73 et = std::make_s │ │ │ +000719f0: 6861 7265 6426 6c74 3b69 3270 5f73 7472 hared<i2p_str │ │ │ +00071a00: 6561 6d26 6774 3b28 6d5f 696f 5f73 6572 eam>(m_io_ser │ │ │ +00071a10: 7669 6365 293b 0a09 096d 5f73 616d 5f73 vice);...m_sam_s │ │ │ +00071a20: 6f63 6b65 742d 2667 743b 7365 745f 7072 ocket->set_pr │ │ │ +00071a30: 6f78 7928 6d5f 686f 7374 6e61 6d65 2c20 oxy(m_hostname, │ │ │ +00071a40: 6d5f 706f 7274 293b 0a09 096d 5f73 616d m_port);...m_sam │ │ │ +00071a50: 5f73 6f63 6b65 742d 2667 743b 7365 745f _socket->set_ │ │ │ +00071a60: 636f 6d6d 616e 6428 6932 705f 7374 7265 command(i2p_stre │ │ │ +00071a70: 616d 3a3a 636d 645f 6372 6561 7465 5f73 am::cmd_create_s │ │ │ +00071a80: 6573 7369 6f6e 293b 0a09 096d 5f73 616d ession);...m_sam │ │ │ +00071a90: 5f73 6f63 6b65 742d 2667 743b 7365 745f _socket->set_ │ │ │ +00071aa0: 7365 7373 696f 6e5f 6964 286d 5f73 6573 session_id(m_ses │ │ │ +00071ab0: 7369 6f6e 5f69 642e 635f 7374 7228 2929 sion_id.c_str()) │ │ │ +00071ac0: 3b0a 0909 6d5f 7361 6d5f 736f 636b 6574 ;...m_sam_socket │ │ │ +00071ad0: 2d26 6774 3b73 6574 5f73 6573 7369 6f6e ->set_session │ │ │ +00071ae0: 5f6f 7074 696f 6e73 2873 6573 7369 6f6e _options(session │ │ │ +00071af0: 5f6f 7074 696f 6e73 293b 0a0a 0909 4144 _options);....AD │ │ │ +00071b00: 445f 4f55 5453 5441 4e44 494e 475f 4153 D_OUTSTANDING_AS │ │ │ +00071b10: 594e 4328 2269 3270 5f73 7472 6561 6d3a YNC("i2p_stream: │ │ │ +00071b20: 3a6f 6e5f 7361 6d5f 636f 6e6e 6563 7422 :on_sam_connect" │ │ │ +00071b30: 293b 0a09 096d 5f73 616d 5f73 6f63 6b65 );...m_sam_socke │ │ │ +00071b40: 742d 2667 743b 6173 796e 635f 636f 6e6e t->async_conn │ │ │ +00071b50: 6563 7428 7463 703a 3a65 6e64 706f 696e ect(tcp::endpoin │ │ │ +00071b60: 7428 292c 2077 7261 705f 616c 6c6f 6361 t(), wrap_alloca │ │ │ +00071b70: 746f 7228 0a09 0909 5b74 6869 732c 733d tor(....[this,s= │ │ │ +00071b80: 6d5f 7361 6d5f 736f 636b 6574 5d28 6572 m_sam_socket](er │ │ │ +00071b90: 726f 725f 636f 6465 2063 6f6e 7374 2661 ror_code const&a │ │ │ +00071ba0: 6d70 3b20 6563 2c20 4861 6e64 6c65 7220 mp; ec, Handler │ │ │ +00071bb0: 686e 2920 7b0a 0909 0909 6f6e 5f73 616d hn) {.....on_sam │ │ │ +00071bc0: 5f63 6f6e 6e65 6374 2865 632c 2073 2c20 _connect(ec, s, │ │ │ +00071bd0: 7374 643a 3a6d 6f76 6528 686e 2929 3b0a std::move(hn));. │ │ │ +00071be0: 0909 097d 2c20 7374 643a 3a6d 6f76 6528 ...}, std::move( │ │ │ +00071bf0: 6861 6e64 6c65 7229 2929 3b0a 097d 0a09 handler)));..}.. │ │ │ +00071c00: 766f 6964 2063 6c6f 7365 2865 7272 6f72 void close(error │ │ │ +00071c10: 5f63 6f64 6526 616d 703b 293b 0a0a 3c64 _code&);...cha │ │ │ +00071c50: 7220 636f 6e73 742a 2073 6573 7369 6f6e r const* session │ │ │ +00071c60: 5f69 6428 2920 636f 6e73 7420 7b20 7265 _id() const { re │ │ │ +00071c70: 7475 726e 206d 5f73 6573 7369 6f6e 5f69 turn m_session_i │ │ │ +00071c80: 642e 635f 7374 7228 293b 207d 0a3c 2f64 d.c_str(); }..std::string │ │ │ +00071ca0: 636f 6e73 7426 616d 703b 206c 6f63 616c const& local │ │ │ +00071cb0: 5f65 6e64 706f 696e 7428 2920 636f 6e73 _endpoint() cons │ │ │ +00071cc0: 7420 7b20 7265 7475 726e 206d 5f69 3270 t { return m_i2p │ │ │ +00071cd0: 5f6c 6f63 616c 5f65 6e64 706f 696e 743b _local_endpoint; │ │ │ +00071ce0: 207d 0a0a 0974 656d 706c 6174 6520 266c }...template &l │ │ │ +00071cf0: 743b 7479 7065 6e61 6d65 2048 616e 646c t;typename Handl │ │ │ +00071d00: 6572 2667 743b 0a09 766f 6964 2061 7379 er>..void asy │ │ │ +00071d10: 6e63 5f6e 616d 655f 6c6f 6f6b 7570 2863 nc_name_lookup(c │ │ │ +00071d20: 6861 7220 636f 6e73 742a 206e 616d 652c har const* name, │ │ │ +00071d30: 2048 616e 646c 6572 2068 616e 646c 6572 Handler handler │ │ │ +00071d40: 290a 097b 0a09 0969 6620 286d 5f73 7461 )..{...if (m_sta │ │ │ +00071d50: 7465 203d 3d20 7361 6d5f 6964 6c65 2026 te == sam_idle & │ │ │ +00071d60: 616d 703b 2661 6d70 3b20 6d5f 6e61 6d65 amp;& m_name │ │ │ +00071d70: 5f6c 6f6f 6b75 702e 656d 7074 7928 2920 _lookup.empty() │ │ │ +00071d80: 2661 6d70 3b26 616d 703b 2069 735f 6f70 && is_op │ │ │ +00071d90: 656e 2829 290a 0909 0964 6f5f 6e61 6d65 en())....do_name │ │ │ +00071da0: 5f6c 6f6f 6b75 7028 6e61 6d65 2c20 7374 _lookup(name, st │ │ │ +00071db0: 643a 3a6d 6f76 6528 6861 6e64 6c65 7229 d::move(handler) │ │ │ +00071dc0: 293b 0a09 0965 6c73 650a 0909 096d 5f6e );...else....m_n │ │ │ +00071dd0: 616d 655f 6c6f 6f6b 7570 2e65 6d70 6c61 ame_lookup.empla │ │ │ +00071de0: 6365 5f62 6163 6b28 7374 643a 3a73 7472 ce_back(std::str │ │ │ +00071df0: 696e 6728 6e61 6d65 290a 0909 0909 2c20 ing(name)....., │ │ │ +00071e00: 7374 643a 3a6d 6f76 6528 6861 6e64 6c65 std::move(handle │ │ │ +00071e10: 7229 293b 0a09 7d0a 0a70 7269 7661 7465 r));..}..private │ │ │ +00071e20: 3a0a 0a09 7465 6d70 6c61 7465 2026 6c74 :...template < │ │ │ +00071e30: 3b74 7970 656e 616d 6520 4861 6e64 6c65 ;typename Handle │ │ │ +00071e40: 7226 6774 3b0a 0976 6f69 6420 6f6e 5f73 r>..void on_s │ │ │ +00071e50: 616d 5f63 6f6e 6e65 6374 2865 7272 6f72 am_connect(error │ │ │ +00071e60: 5f63 6f64 6520 636f 6e73 7426 616d 703b _code const& │ │ │ +00071e70: 2065 632c 2073 7464 3a3a 7368 6172 6564 ec, std::shared │ │ │ +00071e80: 5f70 7472 266c 743b 6932 705f 7374 7265 _ptr<i2p_stre │ │ │ +00071e90: 616d 2667 743b 2c20 4861 6e64 6c65 7220 am>, Handler │ │ │ +00071ea0: 6829 0a09 7b0a 0909 434f 4d50 4c45 5445 h)..{...COMPLETE │ │ │ +00071eb0: 5f41 5359 4e43 2822 6932 705f 7374 7265 _ASYNC("i2p_stre │ │ │ +00071ec0: 616d 3a3a 6f6e 5f73 616d 5f63 6f6e 6e65 am::on_sam_conne │ │ │ +00071ed0: 6374 2229 3b0a 0909 6d5f 7374 6174 6520 ct");...m_state │ │ │ +00071ee0: 3d20 7361 6d5f 6964 6c65 3b0a 0a09 0969 = sam_idle;....i │ │ │ +00071ef0: 6620 2865 6329 0a09 097b 0a09 0909 6828 f (ec)...{....h( │ │ │ +00071f00: 6563 293b 0a09 0909 7265 7475 726e 3b0a ec);....return;. │ │ │ +00071f10: 0909 7d0a 0a09 0964 6f5f 6e61 6d65 5f6c ..}....do_name_l │ │ │ +00071f20: 6f6f 6b75 7028 224d 4522 2c20 7772 6170 ookup("ME", wrap │ │ │ +00071f30: 5f61 6c6c 6f63 6174 6f72 280a 0909 095b _allocator(....[ │ │ │ +00071f40: 7468 6973 5d28 6572 726f 725f 636f 6465 this](error_code │ │ │ +00071f50: 2063 6f6e 7374 2661 6d70 3b20 652c 2063 const& e, c │ │ │ +00071f60: 6861 7220 636f 6e73 742a 2064 7374 2c20 har const* dst, │ │ │ +00071f70: 4861 6e64 6c65 7220 686e 2920 7b0a 0909 Handler hn) {... │ │ │ +00071f80: 0909 7365 745f 6c6f 6361 6c5f 656e 6470 ..set_local_endp │ │ │ +00071f90: 6f69 6e74 2865 2c20 6473 742c 2073 7464 oint(e, dst, std │ │ │ +00071fa0: 3a3a 6d6f 7665 2868 6e29 293b 0a09 0909 ::move(hn));.... │ │ │ +00071fb0: 7d2c 2073 7464 3a3a 6d6f 7665 2868 2929 }, std::move(h)) │ │ │ +00071fc0: 293b 0a3c 2f70 7265 3e3c 2f74 643e 3c2f );.

    │ │ │ +00071ff0: 3c74 643e 7265 6c65 7661 6e63 6526 6e62 relevance&nb │ │ │ +00072000: 7370 3b30 3c2f 7464 3e3c 7464 3e3c 6120 sp;0.. │ │ │ +00072030: 2f69 6e63 6c75 6465 2f6c 6962 746f 7272 /include/libtorr │ │ │ +00072040: 656e 742f 7374 7269 6e67 5f76 6965 772e ent/string_view. │ │ │ +00072050: 6870 703a 3430 3c2f 613e 3c2f 7464 3e3c hpp:40< │ │ │ +00072060: 7464 3e72 6570 6c61 6365 2074 6869 7320 td>replace this │ │ │ +00072070: 6279 2074 6865 2073 7461 6e64 6172 6420 by the standard │ │ │ +00072080: 7374 7269 6e67 5f76 6965 7720 696e 2043 string_view in C │ │ │ +00072090: 2b2b 3137 3c2f 7464 3e3c 2f74 723e 3c74 ++17replace this b │ │ │ +000720f0: 7920 7468 6520 7374 616e 6461 7264 2073 y the standard s │ │ │ +00072100: 7472 696e 675f 7669 6577 2069 6e20 432b tring_view in C+ │ │ │ +00072110: 2b31 373c 2f68 323e 3c68 343e 2e2e 2f69 +17

    ../i │ │ │ +00072120: 6e63 6c75 6465 2f6c 6962 746f 7272 656e nclude/libtorren │ │ │ +00072130: 742f 7374 7269 6e67 5f76 6965 772e 6870 t/string_view.hp │ │ │ +00072140: 703a 3430 3c2f 6834 3e3c 7072 6520 7374 p:40

    AND ANY EXPRE
    │ │ │ +00072190: 5353 204f 5220 494d 504c 4945 4420 5741  SS OR IMPLIED WA
    │ │ │ +000721a0: 5252 414e 5449 4553 2c20 494e 434c 5544  RRANTIES, INCLUD
    │ │ │ +000721b0: 494e 472c 2042 5554 204e 4f54 204c 494d  ING, BUT NOT LIM
    │ │ │ +000721c0: 4954 4544 2054 4f2c 2054 4845 0a49 4d50  ITED TO, THE.IMP
    │ │ │ +000721d0: 4c49 4544 2057 4152 5241 4e54 4945 5320  LIED WARRANTIES 
    │ │ │ +000721e0: 4f46 204d 4552 4348 414e 5441 4249 4c49  OF MERCHANTABILI
    │ │ │ +000721f0: 5459 2041 4e44 2046 4954 4e45 5353 2046  TY AND FITNESS F
    │ │ │ +00072200: 4f52 2041 2050 4152 5449 4355 4c41 5220  OR A PARTICULAR 
    │ │ │ +00072210: 5055 5250 4f53 450a 4152 4520 4449 5343  PURPOSE.ARE DISC
    │ │ │ +00072220: 4c41 494d 4544 2e20 494e 204e 4f20 4556  LAIMED. IN NO EV
    │ │ │ +00072230: 454e 5420 5348 414c 4c20 5448 4520 434f  ENT SHALL THE CO
    │ │ │ +00072240: 5059 5249 4748 5420 4f57 4e45 5220 4f52  PYRIGHT OWNER OR
    │ │ │ +00072250: 2043 4f4e 5452 4942 5554 4f52 5320 4245   CONTRIBUTORS BE
    │ │ │ +00072260: 0a4c 4941 424c 4520 464f 5220 414e 5920  .LIABLE FOR ANY 
    │ │ │ +00072270: 4449 5245 4354 2c20 494e 4449 5245 4354  DIRECT, INDIRECT
    │ │ │ +00072280: 2c20 494e 4349 4445 4e54 414c 2c20 5350  , INCIDENTAL, SP
    │ │ │ +00072290: 4543 4941 4c2c 2045 5845 4d50 4c41 5259  ECIAL, EXEMPLARY
    │ │ │ +000722a0: 2c20 4f52 0a43 4f4e 5345 5155 454e 5449  , OR.CONSEQUENTI
    │ │ │ +000722b0: 414c 2044 414d 4147 4553 2028 494e 434c  AL DAMAGES (INCL
    │ │ │ +000722c0: 5544 494e 472c 2042 5554 204e 4f54 204c  UDING, BUT NOT L
    │ │ │ +000722d0: 494d 4954 4544 2054 4f2c 2050 524f 4355  IMITED TO, PROCU
    │ │ │ +000722e0: 5245 4d45 4e54 204f 460a 5355 4253 5449  REMENT OF.SUBSTI
    │ │ │ +000722f0: 5455 5445 2047 4f4f 4453 204f 5220 5345  TUTE GOODS OR SE
    │ │ │ +00072300: 5256 4943 4553 3b20 4c4f 5353 204f 4620  RVICES; LOSS OF 
    │ │ │ +00072310: 5553 452c 2044 4154 412c 204f 5220 5052  USE, DATA, OR PR
    │ │ │ +00072320: 4f46 4954 533b 204f 5220 4255 5349 4e45  OFITS; OR BUSINE
    │ │ │ +00072330: 5353 0a49 4e54 4552 5255 5054 494f 4e29  SS.INTERRUPTION)
    │ │ │ +00072340: 2048 4f57 4556 4552 2043 4155 5345 4420   HOWEVER CAUSED 
    │ │ │ +00072350: 414e 4420 4f4e 2041 4e59 2054 4845 4f52  AND ON ANY THEOR
    │ │ │ +00072360: 5920 4f46 204c 4941 4249 4c49 5459 2c20  Y OF LIABILITY, 
    │ │ │ +00072370: 5748 4554 4845 5220 494e 0a43 4f4e 5452  WHETHER IN.CONTR
    │ │ │ +00072380: 4143 542c 2053 5452 4943 5420 4c49 4142  ACT, STRICT LIAB
    │ │ │ +00072390: 494c 4954 592c 204f 5220 544f 5254 2028  ILITY, OR TORT (
    │ │ │ +000723a0: 494e 434c 5544 494e 4720 4e45 474c 4947  INCLUDING NEGLIG
    │ │ │ +000723b0: 454e 4345 204f 5220 4f54 4845 5257 4953  ENCE OR OTHERWIS
    │ │ │ +000723c0: 4529 0a41 5249 5349 4e47 2049 4e20 414e  E).ARISING IN AN
    │ │ │ +000723d0: 5920 5741 5920 4f55 5420 4f46 2054 4845  Y WAY OUT OF THE
    │ │ │ +000723e0: 2055 5345 204f 4620 5448 4953 2053 4f46   USE OF THIS SOF
    │ │ │ +000723f0: 5457 4152 452c 2045 5645 4e20 4946 2041  TWARE, EVEN IF A
    │ │ │ +00072400: 4456 4953 4544 204f 4620 5448 450a 504f  DVISED OF THE.PO
    │ │ │ +00072410: 5353 4942 494c 4954 5920 4f46 2053 5543  SSIBILITY OF SUC
    │ │ │ +00072420: 4820 4441 4d41 4745 2e0a 0a2a 2f0a 0a23  H DAMAGE...*/..#
    │ │ │ +00072430: 6966 6e64 6566 2054 4f52 5245 4e54 5f53  ifndef TORRENT_S
    │ │ │ +00072440: 5452 494e 475f 5649 4557 5f48 5050 5f49  TRING_VIEW_HPP_I
    │ │ │ +00072450: 4e43 4c55 4445 440a 2364 6566 696e 6520  NCLUDED.#define 
    │ │ │ +00072460: 544f 5252 454e 545f 5354 5249 4e47 5f56  TORRENT_STRING_V
    │ │ │ +00072470: 4945 575f 4850 505f 494e 434c 5544 4544  IEW_HPP_INCLUDED
    │ │ │ +00072480: 0a0a 2369 6e63 6c75 6465 2026 6c74 3b62  ..#include <b
    │ │ │ +00072490: 6f6f 7374 2f76 6572 7369 6f6e 2e68 7070  oost/version.hpp
    │ │ │ +000724a0: 2667 743b 0a0a 2369 6e63 6c75 6465 2022  >..#include "
    │ │ │ +000724b0: 6c69 6274 6f72 7265 6e74 2f61 7578 5f2f  libtorrent/aux_/
    │ │ │ +000724c0: 6469 7361 626c 655f 7761 726e 696e 6773  disable_warnings
    │ │ │ +000724d0: 5f70 7573 682e 6870 7022 0a0a 3c64 6976  _push.hpp"..
    .
    #if BOOST_VERSI │ │ │ +00072520: 4f4e 2026 6c74 3b20 3130 3631 3030 0a23 ON < 106100.# │ │ │ +00072530: 696e 636c 7564 6520 266c 743b 626f 6f73 include <boos │ │ │ +00072540: 742f 7574 696c 6974 792f 7374 7269 6e67 t/utility/string │ │ │ +00072550: 5f72 6566 2e68 7070 2667 743b 0a23 696e _ref.hpp>.#in │ │ │ +00072560: 636c 7564 6520 266c 743b 6373 7472 696e clude <cstrin │ │ │ +00072570: 6726 6774 3b20 2f2f 2066 6f72 2073 7472 g> // for str │ │ │ +00072580: 6368 720a 6e61 6d65 7370 6163 6520 6c69 chr.namespace li │ │ │ +00072590: 6274 6f72 7265 6e74 207b 0a0a 7573 696e btorrent {..usin │ │ │ +000725a0: 6720 7374 7269 6e67 5f76 6965 7720 3d20 g string_view = │ │ │ +000725b0: 626f 6f73 743a 3a73 7472 696e 675f 7265 boost::string_re │ │ │ +000725c0: 663b 0a75 7369 6e67 2077 7374 7269 6e67 f;.using wstring │ │ │ +000725d0: 5f76 6965 7720 3d20 626f 6f73 743a 3a77 _view = boost::w │ │ │ +000725e0: 7374 7269 6e67 5f72 6566 3b0a 0a2f 2f20 string_ref;..// │ │ │ +000725f0: 696e 7465 726e 616c 0a69 6e6c 696e 6520 internal.inline │ │ │ +00072600: 7374 7269 6e67 5f76 6965 773a 3a73 697a string_view::siz │ │ │ +00072610: 655f 7479 7065 2066 696e 645f 6669 7273 e_type find_firs │ │ │ +00072620: 745f 6f66 2873 7472 696e 675f 7669 6577 t_of(string_view │ │ │ +00072630: 2063 6f6e 7374 2076 2c20 6368 6172 2063 const v, char c │ │ │ +00072640: 6f6e 7374 2063 0a09 2c20 7374 7269 6e67 onst c.., string │ │ │ +00072650: 5f76 6965 773a 3a73 697a 655f 7479 7065 _view::size_type │ │ │ +00072660: 2070 6f73 290a 7b0a 0977 6869 6c65 2028 pos).{..while ( │ │ │ +00072670: 706f 7320 266c 743b 2076 2e73 697a 6528 pos < v.size( │ │ │ +00072680: 2929 0a09 7b0a 0909 6966 2028 765b 706f ))..{...if (v[po │ │ │ +00072690: 735d 203d 3d20 6329 2072 6574 7572 6e20 s] == c) return │ │ │ +000726a0: 706f 733b 0a09 092b 2b70 6f73 3b0a 097d pos;...++pos;..} │ │ │ +000726b0: 0a09 7265 7475 726e 2073 7472 696e 675f ..return string_ │ │ │ +000726c0: 7669 6577 3a3a 6e70 6f73 3b0a 7d0a 0a2f view::npos;.}../ │ │ │ +000726d0: 2f20 696e 7465 726e 616c 0a69 6e6c 696e / internal.inlin │ │ │ +000726e0: 6520 7374 7269 6e67 5f76 6965 773a 3a73 e string_view::s │ │ │ +000726f0: 697a 655f 7479 7065 2066 696e 645f 6669 ize_type find_fi │ │ │ +00072700: 7273 745f 6f66 2873 7472 696e 675f 7669 rst_of(string_vi │ │ │ +00072710: 6577 2063 6f6e 7374 2076 2c20 6368 6172 ew const v, char │ │ │ +00072720: 2063 6f6e 7374 2a20 630a 092c 2073 7472 const* c.., str │ │ │ +00072730: 696e 675f 7669 6577 3a3a 7369 7a65 5f74 ing_view::size_t │ │ │ +00072740: 7970 6520 706f 7329 0a7b 0a09 7768 696c ype pos).{..whil │ │ │ +00072750: 6520 2870 6f73 2026 6c74 3b20 762e 7369 e (pos < v.si │ │ │ +00072760: 7a65 2829 290a 097b 0a09 0969 6620 2873 ze())..{...if (s │ │ │ +00072770: 7464 3a3a 7374 7263 6872 2863 2c20 765b td::strchr(c, v[ │ │ │ +00072780: 706f 735d 2920 213d 206e 756c 6c70 7472 pos]) != nullptr │ │ │ +00072790: 2920 7265 7475 726e 2070 6f73 3b0a 0909 ) return pos;... │ │ │ +000727a0: 2b2b 706f 733b 0a09 7d0a 0972 6574 7572 ++pos;..}..retur │ │ │ +000727b0: 6e20 7374 7269 6e67 5f76 6965 773a 3a6e n string_view::n │ │ │ +000727c0: 706f 733b 0a3c 2f70 7265 3e3c 2f74 643e pos;.
    │ │ │ +000727d0: 3c2f 7472 3e3c 7472 2073 7479 6c65 3d22 relevance& │ │ │ +00072800: 6e62 7370 3b30 3c2f 7464 3e3c 7464 3e3c nbsp;0< │ │ │ +00072810: 6120 6872 6566 3d22 6a61 7661 7363 7269 a href="javascri │ │ │ +00072820: 7074 3a65 7870 616e 6428 3236 3129 223e pt:expand(261)"> │ │ │ +00072830: 2e2e 2f69 6e63 6c75 6465 2f6c 6962 746f ../include/libto │ │ │ +00072840: 7272 656e 742f 7065 6572 5f63 6f6e 6e65 rrent/peer_conne │ │ │ +00072850: 6374 696f 6e5f 696e 7465 7266 6163 652e ction_interface. │ │ │ +00072860: 6870 703a 3531 3c2f 613e 3c2f 7464 3e3c hpp:51< │ │ │ +00072870: 7464 3e6d 616b 6520 7468 6973 2069 6e74 td>make this int │ │ │ +00072880: 6572 6661 6365 2073 6d61 6c6c 6572 213c erface smaller!< │ │ │ +00072890: 2f74 643e 3c2f 7472 3e3c 7472 2069 643d /td>

    mak │ │ │ +000728e0: 6520 7468 6973 2069 6e74 6572 6661 6365 e this interface │ │ │ +000728f0: 2073 6d61 6c6c 6572 213c 2f68 323e 3c68 smaller!

    ../include/lib │ │ │ +00072910: 746f 7272 656e 742f 7065 6572 5f63 6f6e torrent/peer_con │ │ │ +00072920: 6e65 6374 696f 6e5f 696e 7465 7266 6163 nection_interfac │ │ │ +00072930: 652e 6870 703a 3531 3c2f 6834 3e3c 7072 e.hpp:51.*/..#ifn │ │ │ +00072980: 6465 6620 544f 5252 454e 545f 5045 4552 def TORRENT_PEER │ │ │ +00072990: 5f43 4f4e 4e45 4354 494f 4e5f 494e 5445 _CONNECTION_INTE │ │ │ +000729a0: 5246 4143 455f 4850 500a 2364 6566 696e RFACE_HPP.#defin │ │ │ +000729b0: 6520 544f 5252 454e 545f 5045 4552 5f43 e TORRENT_PEER_C │ │ │ +000729c0: 4f4e 4e45 4354 494f 4e5f 494e 5445 5246 ONNECTION_INTERF │ │ │ +000729d0: 4143 455f 4850 500a 0a23 696e 636c 7564 ACE_HPP..#includ │ │ │ +000729e0: 6520 226c 6962 746f 7272 656e 742f 6677 e "libtorrent/fw │ │ │ +000729f0: 642e 6870 7022 0a23 696e 636c 7564 6520 d.hpp".#include │ │ │ +00072a00: 226c 6962 746f 7272 656e 742f 736f 636b "libtorrent/sock │ │ │ +00072a10: 6574 2e68 7070 220a 2369 6e63 6c75 6465 et.hpp".#include │ │ │ +00072a20: 2022 6c69 6274 6f72 7265 6e74 2f65 7272 "libtorrent/err │ │ │ +00072a30: 6f72 5f63 6f64 652e 6870 7022 0a23 696e or_code.hpp".#in │ │ │ +00072a40: 636c 7564 6520 226c 6962 746f 7272 656e clude "libtorren │ │ │ +00072a50: 742f 616c 6572 745f 7479 7065 732e 6870 t/alert_types.hp │ │ │ +00072a60: 7022 0a23 696e 636c 7564 6520 226c 6962 p".#include "lib │ │ │ +00072a70: 746f 7272 656e 742f 6f70 6572 6174 696f torrent/operatio │ │ │ +00072a80: 6e73 2e68 7070 2220 2f2f 2066 6f72 206f ns.hpp" // for o │ │ │ +00072a90: 7065 7261 7469 6f6e 5f74 2065 6e75 6d0a peration_t enum. │ │ │ +00072aa0: 2369 6e63 6c75 6465 2022 6c69 6274 6f72 #include "libtor │ │ │ +00072ab0: 7265 6e74 2f75 6e69 7473 2e68 7070 220a rent/units.hpp". │ │ │ +00072ac0: 0a6e 616d 6573 7061 6365 206c 6962 746f .namespace libto │ │ │ +00072ad0: 7272 656e 7420 7b0a 0a09 7374 7275 6374 rrent {...struct │ │ │ +00072ae0: 2074 6f72 7265 6e74 5f70 6565 723b 0a09 torrent_peer;.. │ │ │ +00072af0: 636c 6173 7320 7374 6174 3b0a 0a09 7573 class stat;...us │ │ │ +00072b00: 696e 6720 6469 7363 6f6e 6e65 6374 5f73 ing disconnect_s │ │ │ +00072b10: 6576 6572 6974 795f 7420 3d20 6175 783a everity_t = aux: │ │ │ +00072b20: 3a73 7472 6f6e 675f 7479 7065 6465 6626 :strong_typedef& │ │ │ +00072b30: 6c74 3b73 7464 3a3a 7569 6e74 385f 742c lt;std::uint8_t, │ │ │ +00072b40: 2073 7472 7563 7420 6469 7363 6f6e 6e65 struct disconne │ │ │ +00072b50: 6374 5f73 6576 6572 6974 795f 7461 6726 ct_severity_tag& │ │ │ +00072b60: 6774 3b3b 0a0a 3c64 6976 2073 7479 6c65 gt;;..
    .struct TORR │ │ │ +00072ba0: 454e 545f 4558 5452 415f 4558 504f 5254 ENT_EXTRA_EXPORT │ │ │ +00072bb0: 2070 6565 725f 636f 6e6e 6563 7469 6f6e peer_connection │ │ │ +00072bc0: 5f69 6e74 6572 6661 6365 0a3c 2f64 6976 _interface.
    .{...static con │ │ │ +00072be0: 7374 6578 7072 2064 6973 636f 6e6e 6563 stexpr disconnec │ │ │ +00072bf0: 745f 7365 7665 7269 7479 5f74 206e 6f72 t_severity_t nor │ │ │ +00072c00: 6d61 6c7b 307d 3b0a 0909 7374 6174 6963 mal{0};...static │ │ │ +00072c10: 2063 6f6e 7374 6578 7072 2064 6973 636f constexpr disco │ │ │ +00072c20: 6e6e 6563 745f 7365 7665 7269 7479 5f74 nnect_severity_t │ │ │ +00072c30: 2066 6169 6c75 7265 7b31 7d3b 0a09 0973 failure{1};...s │ │ │ +00072c40: 7461 7469 6320 636f 6e73 7465 7870 7220 tatic constexpr │ │ │ +00072c50: 6469 7363 6f6e 6e65 6374 5f73 6576 6572 disconnect_sever │ │ │ +00072c60: 6974 795f 7420 7065 6572 5f65 7272 6f72 ity_t peer_error │ │ │ +00072c70: 7b32 7d3b 0a0a 2369 6620 544f 5252 454e {2};..#if TORREN │ │ │ +00072c80: 545f 5553 455f 4932 500a 0909 7669 7274 T_USE_I2P...virt │ │ │ +00072c90: 7561 6c20 7374 643a 3a73 7472 696e 6720 ual std::string │ │ │ +00072ca0: 636f 6e73 7426 616d 703b 2064 6573 7469 const& desti │ │ │ +00072cb0: 6e61 7469 6f6e 2829 2063 6f6e 7374 203d nation() const = │ │ │ +00072cc0: 2030 3b0a 0909 7669 7274 7561 6c20 7374 0;...virtual st │ │ │ +00072cd0: 643a 3a73 7472 696e 6720 636f 6e73 7426 d::string const& │ │ │ +00072ce0: 616d 703b 206c 6f63 616c 5f69 3270 5f65 amp; local_i2p_e │ │ │ +00072cf0: 6e64 706f 696e 7428 2920 636f 6e73 7420 ndpoint() const │ │ │ +00072d00: 3d20 303b 0a23 656e 6469 660a 0909 7669 = 0;.#endif...vi │ │ │ +00072d10: 7274 7561 6c20 7463 703a 3a65 6e64 706f rtual tcp::endpo │ │ │ +00072d20: 696e 7420 636f 6e73 7426 616d 703b 2072 int const& r │ │ │ +00072d30: 656d 6f74 6528 2920 636f 6e73 7420 3d20 emote() const = │ │ │ +00072d40: 303b 0a09 0976 6972 7475 616c 2074 6370 0;...virtual tcp │ │ │ +00072d50: 3a3a 656e 6470 6f69 6e74 206c 6f63 616c ::endpoint local │ │ │ +00072d60: 5f65 6e64 706f 696e 7428 2920 636f 6e73 _endpoint() cons │ │ │ +00072d70: 7420 3d20 303b 0a09 0976 6972 7475 616c t = 0;...virtual │ │ │ +00072d80: 2076 6f69 6420 6469 7363 6f6e 6e65 6374 void disconnect │ │ │ +00072d90: 2865 7272 6f72 5f63 6f64 6520 636f 6e73 (error_code cons │ │ │ +00072da0: 7426 616d 703b 2065 630a 0909 092c 206f t& ec...., o │ │ │ +00072db0: 7065 7261 7469 6f6e 5f74 206f 702c 2064 peration_t op, d │ │ │ +00072dc0: 6973 636f 6e6e 6563 745f 7365 7665 7269 isconnect_severi │ │ │ +00072dd0: 7479 5f74 203d 2070 6565 725f 636f 6e6e ty_t = peer_conn │ │ │ +00072de0: 6563 7469 6f6e 5f69 6e74 6572 6661 6365 ection_interface │ │ │ +00072df0: 3a3a 6e6f 726d 616c 2920 3d20 303b 0a09 ::normal) = 0;.. │ │ │ +00072e00: 0976 6972 7475 616c 2070 6565 725f 6964 .virtual peer_id │ │ │ +00072e10: 2063 6f6e 7374 2661 6d70 3b20 7069 6428 const& pid( │ │ │ +00072e20: 2920 636f 6e73 7420 3d20 303b 0a09 0976 ) const = 0;...v │ │ │ +00072e30: 6972 7475 616c 2070 6565 725f 6964 206f irtual peer_id o │ │ │ +00072e40: 7572 5f70 6964 2829 2063 6f6e 7374 203d ur_pid() const = │ │ │ +00072e50: 2030 3b0a 0909 7669 7274 7561 6c20 766f 0;...virtual vo │ │ │ +00072e60: 6964 2073 6574 5f68 6f6c 6570 756e 6368 id set_holepunch │ │ │ +00072e70: 5f6d 6f64 6528 2920 3d20 303b 0a09 0976 _mode() = 0;...v │ │ │ +00072e80: 6972 7475 616c 2074 6f72 7265 6e74 5f70 irtual torrent_p │ │ │ +00072e90: 6565 722a 2070 6565 725f 696e 666f 5f73 eer* peer_info_s │ │ │ +00072ea0: 7472 7563 7428 2920 636f 6e73 7420 3d20 truct() const = │ │ │ +00072eb0: 303b 0a09 0976 6972 7475 616c 2076 6f69 0;...virtual voi │ │ │ +00072ec0: 6420 7365 745f 7065 6572 5f69 6e66 6f28 d set_peer_info( │ │ │ +00072ed0: 746f 7272 656e 745f 7065 6572 2a20 7069 torrent_peer* pi │ │ │ +00072ee0: 2920 3d20 303b 0a09 0976 6972 7475 616c ) = 0;...virtual │ │ │ +00072ef0: 2062 6f6f 6c20 6973 5f6f 7574 676f 696e bool is_outgoin │ │ │ +00072f00: 6728 2920 636f 6e73 7420 3d20 303b 0a09 g() const = 0;.. │ │ │ +00072f10: 0976 6972 7475 616c 2076 6f69 6420 6164 .virtual void ad │ │ │ +00072f20: 645f 7374 6174 2873 7464 3a3a 696e 7436 d_stat(std::int6 │ │ │ +00072f30: 345f 7420 646f 776e 6c6f 6164 6564 2c20 4_t downloaded, │ │ │ +00072f40: 7374 643a 3a69 6e74 3634 5f74 2075 706c std::int64_t upl │ │ │ +00072f50: 6f61 6465 6429 203d 2030 3b0a 0909 7669 oaded) = 0;...vi │ │ │ +00072f60: 7274 7561 6c20 626f 6f6c 2066 6173 745f rtual bool fast_ │ │ │ +00072f70: 7265 636f 6e6e 6563 7428 2920 636f 6e73 reconnect() cons │ │ │ +00072f80: 7420 3d20 303b 0a09 0976 6972 7475 616c t = 0;...virtual │ │ │ +00072f90: 2062 6f6f 6c20 6973 5f63 686f 6b65 6428 bool is_choked( │ │ │ +00072fa0: 2920 636f 6e73 7420 3d20 303b 0a09 0976 ) const = 0;...v │ │ │ +00072fb0: 6972 7475 616c 2062 6f6f 6c20 6661 696c irtual bool fail │ │ │ +00072fc0: 6564 2829 2063 6f6e 7374 203d 2030 3b0a ed() const = 0;. │ │ │ +00072fd0: 0909 7669 7274 7561 6c20 7374 6174 2063 ..virtual stat c │ │ │ +00072fe0: 6f6e 7374 2661 6d70 3b20 7374 6174 6973 onst& statis │ │ │ +00072ff0: 7469 6373 2829 2063 6f6e 7374 203d 2030 tics() const = 0 │ │ │ +00073000: 3b0a 0909 7669 7274 7561 6c20 766f 6964 ;...virtual void │ │ │ +00073010: 2067 6574 5f70 6565 725f 696e 666f 2870 get_peer_info(p │ │ │ +00073020: 6565 725f 696e 666f 2661 6d70 3b20 7029 eer_info& p) │ │ │ +00073030: 2063 6f6e 7374 203d 2030 3b0a 2369 666e const = 0;.#ifn │ │ │ +00073040: 6465 6620 544f 5252 454e 545f 4449 5341 def TORRENT_DISA │ │ │ +00073050: 424c 455f 4c4f 4747 494e 470a 0909 7669 BLE_LOGGING...vi │ │ │ +00073060: 7274 7561 6c20 626f 6f6c 2073 686f 756c rtual bool shoul │ │ │ +00073070: 645f 6c6f 6728 7065 6572 5f6c 6f67 5f61 d_log(peer_log_a │ │ │ +00073080: 6c65 7274 3a3a 6469 7265 6374 696f 6e5f lert::direction_ │ │ │ +00073090: 7420 6469 7265 6374 696f 6e29 2063 6f6e t direction) con │ │ │ +000730a0: 7374 203d 2030 3b0a 0909 7669 7274 7561 st = 0;...virtua │ │ │ +000730b0: 6c20 766f 6964 2070 6565 725f 6c6f 6728 l void peer_log( │ │ │ +000730c0: 7065 6572 5f6c 6f67 5f61 6c65 7274 3a3a peer_log_alert:: │ │ │ +000730d0: 6469 7265 6374 696f 6e5f 7420 6469 7265 direction_t dire │ │ │ +000730e0: 6374 696f 6e0a 0909 092c 2063 6861 7220 ction...., char │ │ │ +000730f0: 636f 6e73 742a 2065 7665 6e74 2c20 6368 const* event, ch │ │ │ +00073100: 6172 2063 6f6e 7374 2a20 666d 7420 3d20 ar const* fmt = │ │ │ +00073110: 2222 2c20 2e2e 2e29 2063 6f6e 7374 206e "", ...) const n │ │ │ +00073120: 6f65 7863 6570 7420 544f 5252 454e 545f oexcept TORRENT_ │ │ │ +00073130: 464f 524d 4154 2834 2c35 2920 3d20 303b FORMAT(4,5) = 0; │ │ │ +00073140: 0a23 656e 6469 660a 3c2f 7072 653e 3c2f .#endif.
    relevan │ │ │ +00073180: 6365 266e 6273 703b 303c 2f74 643e 3c74 ce 0../include/li │ │ │ +000731c0: 6274 6f72 7265 6e74 2f74 6f72 7265 6e74 btorrent/torrent │ │ │ +000731d0: 2e68 7070 3a32 3831 3c2f 613e 3c2f 7464 .hpp:281make this a │ │ │ +000731f0: 2072 6177 2070 6f69 6e74 6572 2e20 7065 raw pointer. pe │ │ │ +00073200: 7268 6170 7320 6b65 6570 2074 6865 2073 rhaps keep the s │ │ │ +00073210: 6861 7265 645f 7074 7220 6172 6f75 6e64 hared_ptr around │ │ │ +00073220: 2066 7572 7468 6572 2064 6f77 6e20 7468 further down th │ │ │ +00073230: 6520 6f62 6a65 6374 2074 6f20 6d61 696e e object to main │ │ │ +00073240: 7461 696e 2061 6e20 6f77 6e65 723c 2f74 tain an owner

    make │ │ │ +000732a0: 7468 6973 2061 2072 6177 2070 6f69 6e74 this a raw point │ │ │ +000732b0: 6572 2e20 7065 7268 6170 7320 6b65 6570 er. perhaps keep │ │ │ +000732c0: 2074 6865 2073 6861 7265 645f 7074 720a the shared_ptr. │ │ │ +000732d0: 6172 6f75 6e64 2066 7572 7468 6572 2064 around further d │ │ │ +000732e0: 6f77 6e20 7468 6520 6f62 6a65 6374 2074 own the object t │ │ │ +000732f0: 6f20 6d61 696e 7461 696e 2061 6e20 6f77 o maintain an ow │ │ │ +00073300: 6e65 723c 2f68 323e 3c68 343e 2e2e 2f69 ner

    ../i │ │ │ +00073310: 6e63 6c75 6465 2f6c 6962 746f 7272 656e nclude/libtorren │ │ │ +00073320: 742f 746f 7272 656e 742e 6870 703a 3238 t/torrent.hpp:28 │ │ │ +00073330: 313c 2f68 343e 3c70 7265 2073 7479 6c65 1

    │ │ │ +00073370: 2365 6e64 6966 0a09 7d3b 0a0a 0973 7472  #endif..};...str
    │ │ │ +00073380: 7563 7420 544f 5252 454e 545f 4558 5452  uct TORRENT_EXTR
    │ │ │ +00073390: 415f 4558 504f 5254 2074 6f72 7265 6e74  A_EXPORT torrent
    │ │ │ +000733a0: 5f68 6f74 5f6d 656d 6265 7273 0a09 7b0a  _hot_members..{.
    │ │ │ +000733b0: 0909 746f 7272 656e 745f 686f 745f 6d65  ..torrent_hot_me
    │ │ │ +000733c0: 6d62 6572 7328 6175 783a 3a73 6573 7369  mbers(aux::sessi
    │ │ │ +000733d0: 6f6e 5f69 6e74 6572 6661 6365 2661 6d70  on_interface&
    │ │ │ +000733e0: 3b20 7365 730a 0909 092c 2061 6464 5f74  ; ses...., add_t
    │ │ │ +000733f0: 6f72 7265 6e74 5f70 6172 616d 7320 636f  orrent_params co
    │ │ │ +00073400: 6e73 7426 616d 703b 2070 2c20 626f 6f6c  nst& p, bool
    │ │ │ +00073410: 2073 6573 7369 6f6e 5f70 6175 7365 6429   session_paused)
    │ │ │ +00073420: 3b0a 0a09 7072 6f74 6563 7465 643a 0a09  ;...protected:..
    │ │ │ +00073430: 092f 2f20 7468 6520 7069 6563 6520 7069  .// the piece pi
    │ │ │ +00073440: 636b 6572 2e20 5468 6973 2069 7320 616c  cker. This is al
    │ │ │ +00073450: 6c6f 6361 7465 6420 6c61 7a69 6c79 2e20  located lazily. 
    │ │ │ +00073460: 5768 656e 2077 6520 646f 6e27 740a 0909  When we don't...
    │ │ │ +00073470: 2f2f 2068 6176 6520 616e 7974 6869 6e67  // have anything
    │ │ │ +00073480: 2069 6e20 7468 6520 746f 7272 656e 7420   in the torrent 
    │ │ │ +00073490: 2866 6f72 2069 6e73 7461 6e63 652c 2069  (for instance, i
    │ │ │ +000734a0: 6620 6974 2068 6173 6e27 740a 0909 2f2f  f it hasn't...//
    │ │ │ +000734b0: 2062 6565 6e20 7374 6172 7465 6420 7965   been started ye
    │ │ │ +000734c0: 7429 206f 7220 6966 2077 6520 6861 7665  t) or if we have
    │ │ │ +000734d0: 2065 7665 7279 7468 696e 672c 2074 6865   everything, the
    │ │ │ +000734e0: 7265 2069 7320 6e6f 0a09 092f 2f20 7069  re is no...// pi
    │ │ │ +000734f0: 636b 6572 2e20 4974 2773 2061 6c6c 6f63  cker. It's alloc
    │ │ │ +00073500: 6174 6564 206f 6e2d 6465 6d61 6e64 2074  ated on-demand t
    │ │ │ +00073510: 6865 2066 6972 7374 2074 696d 6520 7765  he first time we
    │ │ │ +00073520: 206e 6565 640a 0909 2f2f 2069 7420 696e   need...// it in
    │ │ │ +00073530: 2074 6f72 7265 6e74 3a3a 6e65 6564 5f70   torrent::need_p
    │ │ │ +00073540: 6963 6b65 7228 292e 2049 6e20 6f72 6465  icker(). In orde
    │ │ │ +00073550: 7220 746f 2074 656c 6c20 7468 650a 0909  r to tell the...
    │ │ │ +00073560: 2f2f 2064 6966 6665 7265 6e63 6520 6265  // difference be
    │ │ │ +00073570: 7477 6565 6e20 6861 7669 6e67 2065 7665  tween having eve
    │ │ │ +00073580: 7279 7468 696e 6720 616e 6420 6e6f 7468  rything and noth
    │ │ │ +00073590: 696e 6720 696e 0a09 092f 2f20 7468 6520  ing in...// the 
    │ │ │ +000735a0: 6361 7365 2074 6865 7265 2069 7320 6e6f  case there is no
    │ │ │ +000735b0: 2070 6965 6365 2070 6963 6b65 722c 2073   piece picker, s
    │ │ │ +000735c0: 6565 206d 5f68 6176 655f 616c 6c2e 0a09  ee m_have_all...
    │ │ │ +000735d0: 0973 7464 3a3a 756e 6971 7565 5f70 7472  .std::unique_ptr
    │ │ │ +000735e0: 266c 743b 7069 6563 655f 7069 636b 6572  <piece_picker
    │ │ │ +000735f0: 2667 743b 206d 5f70 6963 6b65 723b 0a0a  > m_picker;..
    │ │ │ +00073600: 0909 7374 643a 3a75 6e69 7175 655f 7074  ..std::unique_pt
    │ │ │ +00073610: 7226 6c74 3b68 6173 685f 7069 636b 6572  r<hash_picker
    │ │ │ +00073620: 2667 743b 206d 5f68 6173 685f 7069 636b  > m_hash_pick
    │ │ │ +00073630: 6572 3b0a 0a3c 6469 7620 7374 796c 653d  er;..
    ..std::shared │ │ │ +00073670: 5f70 7472 266c 743b 746f 7272 656e 745f _ptr<torrent_ │ │ │ +00073680: 696e 666f 2667 743b 206d 5f74 6f72 7265 info> m_torre │ │ │ +00073690: 6e74 5f66 696c 653b 0a3c 2f64 6976 3e0a nt_file;.
    . │ │ │ +000736a0: 0909 2f2f 2054 6869 7320 6973 2074 6865 ..// This is the │ │ │ +000736b0: 2073 756d 206f 6620 616c 6c20 6e6f 6e2d sum of all non- │ │ │ +000736c0: 7061 6420 6669 6c65 2073 697a 6573 2e20 pad file sizes. │ │ │ +000736d0: 496e 2074 6865 206e 6578 7420 6d61 6a6f In the next majo │ │ │ +000736e0: 7220 7665 7273 696f 6e0a 0909 2f2f 2074 r version...// t │ │ │ +000736f0: 6869 7320 6973 2073 746f 7265 6420 696e his is stored in │ │ │ +00073700: 2066 696c 655f 7374 6f72 6167 6520 616e file_storage an │ │ │ +00073710: 6420 6e6f 206c 6f6e 6765 7220 6e65 6564 d no longer need │ │ │ +00073720: 2074 6f20 6265 206b 6570 7420 6865 7265 to be kept here │ │ │ +00073730: 2e0a 0909 7374 643a 3a69 6e74 3634 5f74 ....std::int64_t │ │ │ +00073740: 206d 5f73 697a 655f 6f6e 5f64 6973 6b20 m_size_on_disk │ │ │ +00073750: 3d20 303b 0a0a 0909 2f2f 2061 2062 6163 = 0;....// a bac │ │ │ +00073760: 6b20 7265 6665 7265 6e63 6520 746f 2074 k reference to t │ │ │ +00073770: 6865 2073 6573 7369 6f6e 0a09 092f 2f20 he session...// │ │ │ +00073780: 7468 6973 2074 6f72 7265 6e74 2062 656c this torrent bel │ │ │ +00073790: 6f6e 6773 2074 6f2e 0a09 0961 7578 3a3a ongs to....aux:: │ │ │ +000737a0: 7365 7373 696f 6e5f 696e 7465 7266 6163 session_interfac │ │ │ +000737b0: 6526 616d 703b 206d 5f73 6573 3b0a 0a09 e& m_ses;... │ │ │ +000737c0: 092f 2f20 7468 6973 2076 6563 746f 7220 .// this vector │ │ │ +000737d0: 6973 2073 6f72 7465 6420 6174 2061 6c6c is sorted at all │ │ │ +000737e0: 2074 696d 6573 2c20 6279 2074 6865 2070 times, by the p │ │ │ +000737f0: 6f69 6e74 6572 2076 616c 7565 2e0a 0909 ointer value.... │ │ │ +00073800: 2f2f 2075 7365 2073 6f72 7465 645f 696e // use sorted_in │ │ │ +00073810: 7365 7274 2829 2061 6e64 2073 6f72 7465 sert() and sorte │ │ │ +00073820: 645f 6669 6e64 2829 206f 6e20 6974 2e20 d_find() on it. │ │ │ +00073830: 5468 6520 474e 5520 5354 4c0a 0909 2f2f The GNU STL...// │ │ │ +00073840: 2069 6d70 6c65 6d65 6e74 6174 696f 6e20 implementation │ │ │ +00073850: 6f6e 2044 6172 7769 6e20 7573 6573 2073 on Darwin uses s │ │ │ +00073860: 6967 6e69 6669 6361 6e74 6c79 206c 6573 ignificantly les │ │ │ +00073870: 7320 6d65 6d6f 7279 2074 6f0a 0909 2f2f s memory to...// │ │ │ +00073880: 2072 6570 7265 7365 6e74 2061 2076 6563 represent a vec │ │ │ +00073890: 746f 7220 7468 616e 2061 2073 6574 2c20 tor than a set, │ │ │ +000738a0: 616e 6420 7468 6973 2073 6574 2069 7320 and this set is │ │ │ +000738b0: 7479 7069 6361 6c6c 790a 0909 2f2f 2072 typically...// r │ │ │ +000738c0: 656c 6174 6976 656c 7920 736d 616c 6c2c elatively small, │ │ │ +000738d0: 2061 6e64 2069 7427 7320 6368 6561 7020 and it's cheap │ │ │ +000738e0: 746f 2063 6f70 7920 706f 696e 7465 7273 to copy pointers │ │ │ +000738f0: 2e0a 0909 6175 783a 3a76 6563 746f 7226 ....aux::vector& │ │ │ +00073900: 6c74 3b70 6565 725f 636f 6e6e 6563 7469 lt;peer_connecti │ │ │ +00073910: 6f6e 2a26 6774 3b20 6d5f 636f 6e6e 6563 on*> m_connec │ │ │ +00073920: 7469 6f6e 733b 0a0a 0909 2f2f 2074 6865 tions;....// the │ │ │ +00073930: 2073 6372 6170 6520 6461 7461 2066 726f scrape data fro │ │ │ +00073940: 6d20 7468 6520 7472 6163 6b65 7220 7265 m the tracker re │ │ │ +00073950: 7370 6f6e 7365 2c20 7468 6973 0a09 092f sponse, this.../ │ │ │ +00073960: 2f20 6973 206f 7074 696f 6e61 6c20 616e / is optional an │ │ │ +00073970: 6420 6d61 7920 6265 2030 7866 6666 6666 d may be 0xfffff │ │ │ +00073980: 660a 0909 7374 643a 3a75 696e 7433 325f f...std::uint32_ │ │ │ +00073990: 7420 6d5f 636f 6d70 6c65 7465 3a32 343b t m_complete:24; │ │ │ +000739a0: 0a0a 0909 2f2f 2073 6574 2074 6f20 7472 ....// set to tr │ │ │ +000739b0: 7565 2077 6865 6e20 7468 6973 2074 6f72 ue when this tor │ │ │ +000739c0: 7265 6e74 206d 6179 206e 6f74 2064 6f77 rent may not dow │ │ │ +000739d0: 6e6c 6f61 6420 616e 7974 6869 6e67 0a09 nload anything.. │ │ │ +000739e0: 0962 6f6f 6c20 6d5f 7570 6c6f 6164 5f6d .bool m_upload_m │ │ │ +000739f0: 6f64 653a 313b 0a0a 0909 2f2f 2074 6869 ode:1;....// thi │ │ │ +00073a00: 7320 6973 2073 6574 2074 6f20 6661 6c73 s is set to fals │ │ │ +00073a10: 6520 6173 206c 6f6e 6720 6173 2074 6865 e as long as the │ │ │ +00073a20: 2063 6f6e 6e65 6374 696f 6e73 0a09 092f connections.../ │ │ │ +00073a30: 2f20 6f66 2074 6869 7320 746f 7272 656e / of this torren │ │ │ +00073a40: 7420 6861 7665 6e27 7420 6265 656e 2069 t haven't been i │ │ │ +00073a50: 6e69 7469 616c 697a 6564 2e20 4966 2077 nitialized. If w │ │ │ +00073a60: 650a 0909 2f2f 2068 6176 6520 6d65 7461 e...// have meta │ │ │ +00073a70: 6461 7461 2066 726f 6d20 7468 6520 7374 data from the st │ │ │ +00073a80: 6172 742c 2063 6f6e 6e65 6374 696f 6e73 art, connections │ │ │ +00073a90: 2061 7265 0a09 092f 2f20 696e 6974 6961 are...// initia │ │ │ +00073aa0: 6c69 7a65 6420 696d 6d65 6469 6174 656c lized immediatel │ │ │ +00073ab0: 792c 2069 6620 7765 2064 6964 6e27 7420 y, if we didn't │ │ │ +00073ac0: 6861 7665 206d 6574 6164 6174 612c 0a09 have metadata,.. │ │ │ +00073ad0: 092f 2f20 7468 6579 2061 7265 2069 6e69 .// they are ini │ │ │ +00073ae0: 7469 616c 697a 6564 2072 6967 6874 2061 tialized right a │ │ │ +00073af0: 6674 6572 2066 696c 6573 5f63 6865 636b fter files_check │ │ │ +00073b00: 6564 2829 2e0a 0909 2f2f 2076 616c 6964 ed()....// valid │ │ │ +00073b10: 5f72 6573 756d 655f 6461 7461 2829 2077 _resume_data() w │ │ │ +00073b20: 696c 6c20 7265 7475 726e 2066 616c 7365 ill return false │ │ │ +00073b30: 2061 7320 6c6f 6e67 2061 730a 0909 2f2f as long as...// │ │ │ +00073b40: 2074 6865 2063 6f6e 6e65 6374 696f 6e73 the connections │ │ │ +00073b50: 2061 7265 6e27 7420 696e 6974 6961 6c69 aren't initiali │ │ │ +00073b60: 7a65 642c 2074 6f20 6176 6f69 640a 3c2f zed, to avoid.r │ │ │ +00073ba0: 656c 6576 616e 6365 266e 6273 703b 303c elevance 0< │ │ │ +00073bb0: 2f74 643e 3c74 643e 3c61 2068 7265 663d /td>../incl │ │ │ +00073be0: 7564 652f 6c69 6274 6f72 7265 6e74 2f74 ude/libtorrent/t │ │ │ +00073bf0: 6f72 7265 6e74 2e68 7070 3a34 3634 3c2f orrent.hpp:464make │ │ │ +00073c10: 6772 6163 6566 756c 2070 6175 7365 2061 graceful pause a │ │ │ +00073c20: 6c73 6f20 6669 6e69 7368 2061 6c6c 2073 lso finish all s │ │ │ +00073c30: 656e 6469 6e67 2062 6c6f 636b 7320 6265 ending blocks be │ │ │ +00073c40: 666f 7265 2064 6973 636f 6e6e 6563 7469 fore disconnecti │ │ │ +00073c50: 6e67 3c2f 7464 3e3c 2f74 723e 3c74 7220 ng

    │ │ │ +00073ca0: 6d61 6b65 2067 7261 6365 6675 6c20 7061 make graceful pa │ │ │ +00073cb0: 7573 6520 616c 736f 2066 696e 6973 6820 use also finish │ │ │ +00073cc0: 616c 6c20 7365 6e64 696e 6720 626c 6f63 all sending bloc │ │ │ +00073cd0: 6b73 0a62 6566 6f72 6520 6469 7363 6f6e ks.before discon │ │ │ +00073ce0: 6e65 6374 696e 673c 2f68 323e 3c68 343e necting

    │ │ │ +00073cf0: 2e2e 2f69 6e63 6c75 6465 2f6c 6962 746f ../include/libto │ │ │ +00073d00: 7272 656e 742f 746f 7272 656e 742e 6870 rrent/torrent.hp │ │ │ +00073d10: 703a 3436 343c 2f68 343e 3c70 7265 2073 p:464

    ...void on_r
    │ │ │ +00073d60: 6573 756d 655f 6461 7461 5f63 6865 636b  esume_data_check
    │ │ │ +00073d70: 6564 2873 7461 7475 735f 7420 7374 6174  ed(status_t stat
    │ │ │ +00073d80: 7573 2c20 7374 6f72 6167 655f 6572 726f  us, storage_erro
    │ │ │ +00073d90: 7220 636f 6e73 7426 616d 703b 2065 7272  r const& err
    │ │ │ +00073da0: 6f72 293b 0a09 0976 6f69 6420 6f6e 5f66  or);...void on_f
    │ │ │ +00073db0: 6f72 6365 5f72 6563 6865 636b 2873 7461  orce_recheck(sta
    │ │ │ +00073dc0: 7475 735f 7420 7374 6174 7573 2c20 7374  tus_t status, st
    │ │ │ +00073dd0: 6f72 6167 655f 6572 726f 7220 636f 6e73  orage_error cons
    │ │ │ +00073de0: 7426 616d 703b 2065 7272 6f72 293b 0a09  t& error);..
    │ │ │ +00073df0: 0976 6f69 6420 6f6e 5f70 6965 6365 5f68  .void on_piece_h
    │ │ │ +00073e00: 6173 6865 6428 6175 783a 3a76 6563 746f  ashed(aux::vecto
    │ │ │ +00073e10: 7226 6c74 3b73 6861 3235 365f 6861 7368  r<sha256_hash
    │ │ │ +00073e20: 2667 743b 2062 6c6f 636b 5f68 6173 6865  > block_hashe
    │ │ │ +00073e30: 730a 0909 092c 2070 6965 6365 5f69 6e64  s...., piece_ind
    │ │ │ +00073e40: 6578 5f74 2070 6965 6365 2c20 7368 6131  ex_t piece, sha1
    │ │ │ +00073e50: 5f68 6173 6820 636f 6e73 7426 616d 703b  _hash const&
    │ │ │ +00073e60: 2070 6965 6365 5f68 6173 680a 0909 092c   piece_hash....,
    │ │ │ +00073e70: 2073 746f 7261 6765 5f65 7272 6f72 2063   storage_error c
    │ │ │ +00073e80: 6f6e 7374 2661 6d70 3b20 6572 726f 7229  onst& error)
    │ │ │ +00073e90: 3b0a 0909 766f 6964 2066 696c 6573 5f63  ;...void files_c
    │ │ │ +00073ea0: 6865 636b 6564 2829 3b0a 0909 766f 6964  hecked();...void
    │ │ │ +00073eb0: 2073 7461 7274 5f63 6865 636b 696e 6728   start_checking(
    │ │ │ +00073ec0: 293b 0a0a 0909 766f 6964 2073 7461 7274  );....void start
    │ │ │ +00073ed0: 5f61 6e6e 6f75 6e63 696e 6728 293b 0a09  _announcing();..
    │ │ │ +00073ee0: 0976 6f69 6420 7374 6f70 5f61 6e6e 6f75  .void stop_annou
    │ │ │ +00073ef0: 6e63 696e 6728 293b 0a0a 0909 766f 6964  ncing();....void
    │ │ │ +00073f00: 2073 656e 645f 7570 6c6f 6164 5f6f 6e6c   send_upload_onl
    │ │ │ +00073f10: 7928 293b 0a0a 2369 666e 6465 6620 544f  y();..#ifndef TO
    │ │ │ +00073f20: 5252 454e 545f 4449 5341 424c 455f 5348  RRENT_DISABLE_SH
    │ │ │ +00073f30: 4152 455f 4d4f 4445 0a09 0976 6f69 6420  ARE_MODE...void 
    │ │ │ +00073f40: 7365 6e64 5f73 6861 7265 5f6d 6f64 6528  send_share_mode(
    │ │ │ +00073f50: 293b 0a09 0976 6f69 6420 7365 745f 7368  );...void set_sh
    │ │ │ +00073f60: 6172 655f 6d6f 6465 2862 6f6f 6c20 7329  are_mode(bool s)
    │ │ │ +00073f70: 3b0a 0909 626f 6f6c 2073 6861 7265 5f6d  ;...bool share_m
    │ │ │ +00073f80: 6f64 6528 2920 636f 6e73 7420 7b20 7265  ode() const { re
    │ │ │ +00073f90: 7475 726e 206d 5f73 6861 7265 5f6d 6f64  turn m_share_mod
    │ │ │ +00073fa0: 653b 207d 0a23 656e 6469 660a 0a3c 6469  e; }.#endif....boo
    │ │ │ +00073fe0: 6c20 6772 6163 6566 756c 5f70 6175 7365  l graceful_pause
    │ │ │ +00073ff0: 2829 2063 6f6e 7374 207b 2072 6574 7572  () const { retur
    │ │ │ +00074000: 6e20 6d5f 6772 6163 6566 756c 5f70 6175  n m_graceful_pau
    │ │ │ +00074010: 7365 5f6d 6f64 653b 207d 0a3c 2f64 6976  se_mode; }....torrent_flag
    │ │ │ +00074030: 735f 7420 666c 6167 7328 2920 636f 6e73  s_t flags() cons
    │ │ │ +00074040: 743b 0a09 0976 6f69 6420 7365 745f 666c  t;...void set_fl
    │ │ │ +00074050: 6167 7328 746f 7272 656e 745f 666c 6167  ags(torrent_flag
    │ │ │ +00074060: 735f 7420 666c 6167 732c 2074 6f72 7265  s_t flags, torre
    │ │ │ +00074070: 6e74 5f66 6c61 6773 5f74 206d 6173 6b29  nt_flags_t mask)
    │ │ │ +00074080: 3b0a 0a09 0976 6f69 6420 7365 745f 7570  ;....void set_up
    │ │ │ +00074090: 6c6f 6164 5f6d 6f64 6528 626f 6f6c 2062  load_mode(bool b
    │ │ │ +000740a0: 293b 0a09 0962 6f6f 6c20 7570 6c6f 6164  );...bool upload
    │ │ │ +000740b0: 5f6d 6f64 6528 2920 636f 6e73 7420 7b20  _mode() const { 
    │ │ │ +000740c0: 7265 7475 726e 206d 5f75 706c 6f61 645f  return m_upload_
    │ │ │ +000740d0: 6d6f 6465 207c 7c20 6d5f 6772 6163 6566  mode || m_gracef
    │ │ │ +000740e0: 756c 5f70 6175 7365 5f6d 6f64 653b 207d  ul_pause_mode; }
    │ │ │ +000740f0: 0a09 0962 6f6f 6c20 6973 5f75 706c 6f61  ...bool is_uploa
    │ │ │ +00074100: 645f 6f6e 6c79 2829 2063 6f6e 7374 207b  d_only() const {
    │ │ │ +00074110: 2072 6574 7572 6e20 6973 5f66 696e 6973   return is_finis
    │ │ │ +00074120: 6865 6428 2920 7c7c 2075 706c 6f61 645f  hed() || upload_
    │ │ │ +00074130: 6d6f 6465 2829 3b20 7d0a 0a09 0969 6e74  mode(); }....int
    │ │ │ +00074140: 2073 6565 645f 7261 6e6b 2861 7578 3a3a   seed_rank(aux::
    │ │ │ +00074150: 7365 7373 696f 6e5f 7365 7474 696e 6773  session_settings
    │ │ │ +00074160: 2063 6f6e 7374 2661 6d70 3b20 7329 2063   const& s) c
    │ │ │ +00074170: 6f6e 7374 3b0a 0a09 0976 6f69 6420 6164  onst;....void ad
    │ │ │ +00074180: 645f 7069 6563 6528 7069 6563 655f 696e  d_piece(piece_in
    │ │ │ +00074190: 6465 785f 7420 7069 6563 652c 2063 6861  dex_t piece, cha
    │ │ │ +000741a0: 7220 636f 6e73 742a 2064 6174 612c 2061  r const* data, a
    │ │ │ +000741b0: 6464 5f70 6965 6365 5f66 6c61 6773 5f74  dd_piece_flags_t
    │ │ │ +000741c0: 2066 6c61 6773 293b 0a09 0976 6f69 6420   flags);...void 
    │ │ │ +000741d0: 6164 645f 7069 6563 655f 6173 796e 6328  add_piece_async(
    │ │ │ +000741e0: 7069 6563 655f 696e 6465 785f 7420 7069  piece_index_t pi
    │ │ │ +000741f0: 6563 652c 2073 7464 3a3a 7665 6374 6f72  ece, std::vector
    │ │ │ +00074200: 266c 743b 6368 6172 2667 743b 2064 6174  <char> dat
    │ │ │ +00074210: 612c 2061 6464 5f70 6965 6365 5f66 6c61  a, add_piece_fla
    │ │ │ +00074220: 6773 5f74 2066 6c61 6773 293b 0a09 0976  gs_t flags);...v
    │ │ │ +00074230: 6f69 6420 6f6e 5f64 6973 6b5f 7772 6974  oid on_disk_writ
    │ │ │ +00074240: 655f 636f 6d70 6c65 7465 2873 746f 7261  e_complete(stora
    │ │ │ +00074250: 6765 5f65 7272 6f72 2063 6f6e 7374 2661  ge_error const&a
    │ │ │ +00074260: 6d70 3b20 6572 726f 720a 0909 092c 2070  mp; error...., p
    │ │ │ +00074270: 6565 725f 7265 7175 6573 7420 636f 6e73  eer_request cons
    │ │ │ +00074280: 7426 616d 703b 2070 293b 0a0a 0909 766f  t& p);....vo
    │ │ │ +00074290: 6964 2073 6574 5f70 726f 6772 6573 735f  id set_progress_
    │ │ │ +000742a0: 7070 6d28 696e 7420 7029 207b 206d 5f70  ppm(int p) { m_p
    │ │ │ +000742b0: 726f 6772 6573 735f 7070 6d20 3d20 7374  rogress_ppm = st
    │ │ │ +000742c0: 643a 3a75 696e 7433 325f 7428 7029 3b20  d::uint32_t(p); 
    │ │ │ +000742d0: 7d0a 0909 7374 7275 6374 2072 6561 645f  }...struct read_
    │ │ │ +000742e0: 7069 6563 655f 7374 7275 6374 0a09 097b  piece_struct...{
    │ │ │ +000742f0: 0a09 0909 626f 6f73 743a 3a73 6861 7265  ....boost::share
    │ │ │ +00074300: 645f 6172 7261 7926 6c74 3b63 6861 7226  d_array<char&
    │ │ │ +00074310: 6774 3b20 7069 6563 655f 6461 7461 3b0a  gt; piece_data;.
    │ │ │ +00074320: 0909 0969 6e74 2062 6c6f 636b 735f 6c65  ...int blocks_le
    │ │ │ +00074330: 6674 3b0a 0909 0962 6f6f 6c20 6661 696c  ft;....bool fail
    │ │ │ +00074340: 3b0a 0909 0965 7272 6f72 5f63 6f64 6520  ;....error_code 
    │ │ │ +00074350: 6572 726f 723b 0a09 097d 3b0a 0909 766f  error;...};...vo
    │ │ │ +00074360: 6964 2072 6561 645f 7069 6563 6528 7069  id read_piece(pi
    │ │ │ +00074370: 6563 655f 696e 6465 785f 7429 3b0a 0909  ece_index_t);...
    │ │ │ +00074380: 766f 6964 206f 6e5f 6469 736b 5f72 6561  void on_disk_rea
    │ │ │ +00074390: 645f 636f 6d70 6c65 7465 2864 6973 6b5f  d_complete(disk_
    │ │ │ +000743a0: 6275 6666 6572 5f68 6f6c 6465 722c 2073  buffer_holder, s
    │ │ │ +000743b0: 746f 7261 6765 5f65 7272 6f72 2063 6f6e  torage_error con
    │ │ │ +000743c0: 7374 2661 6d70 3b0a 0909 092c 2070 6565  st&...., pee
    │ │ │ +000743d0: 725f 7265 7175 6573 7420 636f 6e73 7426  r_request const&
    │ │ │ +000743e0: 616d 703b 2c20 7374 643a 3a73 6861 7265  amp;, std::share
    │ │ │ +000743f0: 645f 7074 7226 6c74 3b72 6561 645f 7069  d_ptr<read_pi
    │ │ │ +00074400: 6563 655f 7374 7275 6374 2667 743b 293b  ece_struct>);
    │ │ │ +00074410: 0a0a 0909 7374 6f72 6167 655f 6d6f 6465  ....storage_mode
    │ │ │ +00074420: 5f74 2073 746f 7261 6765 5f6d 6f64 6528  _t storage_mode(
    │ │ │ +00074430: 2920 636f 6e73 743b 0a0a 0909 2f2f 2074  ) const;....// t
    │ │ │ +00074440: 6869 7320 7769 6c6c 2066 6c61 6720 7468  his will flag th
    │ │ │ +00074450: 6520 746f 7272 656e 7420 6173 2061 626f  e torrent as abo
    │ │ │ +00074460: 7274 6564 2e20 5468 6520 6d61 696e 0a3c  rted. The main.<
    │ │ │ +00074470: 2f70 7265 3e3c 2f74 643e 3c2f 7472 3e3c  /pre><
    │ │ │ +00074480: 7472 2073 7479 6c65 3d22 6261 636b 6772  tr style="backgr
    │ │ │ +00074490: 6f75 6e64 3a20 2363 6363 223e 3c74 643e  ound: #ccc">
    │ │ │ +000744a0: 7265 6c65 7661 6e63 6526 6e62 7370 3b30  relevance 0
    │ │ │ +000744b0: 3c2f 7464 3e3c 7464 3e3c 6120 6872 6566  ../inc
    │ │ │ +000744e0: 6c75 6465 2f6c 6962 746f 7272 656e 742f  lude/libtorrent/
    │ │ │ +000744f0: 746f 7272 656e 742e 6870 703a 3630 323c  torrent.hpp:602<
    │ │ │ +00074500: 2f61 3e3c 2f74 643e 3c74 643e 6d61 6b65  /a>make
    │ │ │ +00074510: 2074 6869 7320 666c 6167 2061 2063 6f6d   this flag a com
    │ │ │ +00074520: 6269 6e61 7469 6f6e 206f 6620 7468 6520  bination of the 
    │ │ │ +00074530: 6f74 6865 7220 6f6e 6573 3c2f 7464 3e3c  other ones<
    │ │ │ +00074540: 2f74 723e 3c74 7220 6964 3d22 3236 3422  /tr>

    make thi │ │ │ +00074590: 7320 666c 6167 2061 2063 6f6d 6269 6e61 s flag a combina │ │ │ +000745a0: 7469 6f6e 0a6f 6620 7468 6520 6f74 6865 tion.of the othe │ │ │ +000745b0: 7220 6f6e 6573 3c2f 6832 3e3c 6834 3e2e r ones

    . │ │ │ +000745c0: 2e2f 696e 636c 7564 652f 6c69 6274 6f72 ./include/libtor │ │ │ +000745d0: 7265 6e74 2f74 6f72 7265 6e74 2e68 7070 rent/torrent.hpp │ │ │ +000745e0: 3a36 3032 3c2f 6834 3e3c 7072 6520 7374 :602

    ..void do_pau
    │ │ │ +00074630: 7365 2862 6f6f 6c20 7761 735f 7061 7573  se(bool was_paus
    │ │ │ +00074640: 6564 203d 2066 616c 7365 293b 0a09 0976  ed = false);...v
    │ │ │ +00074650: 6f69 6420 646f 5f72 6573 756d 6528 293b  oid do_resume();
    │ │ │ +00074660: 0a0a 0909 7365 636f 6e64 7333 3220 6669  ....seconds32 fi
    │ │ │ +00074670: 6e69 7368 6564 5f74 696d 6528 2920 636f  nished_time() co
    │ │ │ +00074680: 6e73 743b 0a09 0973 6563 6f6e 6473 3332  nst;...seconds32
    │ │ │ +00074690: 2061 6374 6976 655f 7469 6d65 2829 2063   active_time() c
    │ │ │ +000746a0: 6f6e 7374 3b0a 0909 7365 636f 6e64 7333  onst;...seconds3
    │ │ │ +000746b0: 3220 7365 6564 696e 675f 7469 6d65 2829  2 seeding_time()
    │ │ │ +000746c0: 2063 6f6e 7374 3b0a 0909 7365 636f 6e64   const;...second
    │ │ │ +000746d0: 7333 3220 7570 6c6f 6164 5f6d 6f64 655f  s32 upload_mode_
    │ │ │ +000746e0: 7469 6d65 2829 2063 6f6e 7374 3b0a 0a09  time() const;...
    │ │ │ +000746f0: 0962 6f6f 6c20 6973 5f70 6175 7365 6428  .bool is_paused(
    │ │ │ +00074700: 2920 636f 6e73 743b 0a09 0962 6f6f 6c20  ) const;...bool 
    │ │ │ +00074710: 6973 5f74 6f72 7265 6e74 5f70 6175 7365  is_torrent_pause
    │ │ │ +00074720: 6428 2920 636f 6e73 7420 7b20 7265 7475  d() const { retu
    │ │ │ +00074730: 726e 206d 5f70 6175 7365 643b 207d 0a09  rn m_paused; }..
    │ │ │ +00074740: 0976 6f69 6420 666f 7263 655f 7265 6368  .void force_rech
    │ │ │ +00074750: 6563 6b28 293b 0a09 0976 6f69 6420 7361  eck();...void sa
    │ │ │ +00074760: 7665 5f72 6573 756d 655f 6461 7461 2872  ve_resume_data(r
    │ │ │ +00074770: 6573 756d 655f 6461 7461 5f66 6c61 6773  esume_data_flags
    │ │ │ +00074780: 5f74 2066 6c61 6773 293b 0a0a 0909 626f  _t flags);....bo
    │ │ │ +00074790: 6f6c 206e 6565 645f 7361 7665 5f72 6573  ol need_save_res
    │ │ │ +000747a0: 756d 655f 6461 7461 2872 6573 756d 655f  ume_data(resume_
    │ │ │ +000747b0: 6461 7461 5f66 6c61 6773 5f74 2066 6c61  data_flags_t fla
    │ │ │ +000747c0: 6773 2920 636f 6e73 740a 0909 7b0a 0909  gs) const...{...
    │ │ │ +000747d0: 0972 6574 7572 6e20 626f 6f6c 286d 5f6e  .return bool(m_n
    │ │ │ +000747e0: 6565 645f 7361 7665 5f72 6573 756d 655f  eed_save_resume_
    │ │ │ +000747f0: 6461 7461 2026 616d 703b 2066 6c61 6773  data & flags
    │ │ │ +00074800: 293b 0a09 097d 0a0a 0909 766f 6964 2073  );...}....void s
    │ │ │ +00074810: 6574 5f6e 6565 645f 7361 7665 5f72 6573  et_need_save_res
    │ │ │ +00074820: 756d 6528 7265 7375 6d65 5f64 6174 615f  ume(resume_data_
    │ │ │ +00074830: 666c 6167 735f 7420 636f 6e73 7420 666c  flags_t const fl
    │ │ │ +00074840: 6167 290a 0909 7b0a 3c64 6976 2073 7479  ag)...{.
    ...m_need_ │ │ │ +00074880: 7361 7665 5f72 6573 756d 655f 6461 7461 save_resume_data │ │ │ +00074890: 207c 3d20 746f 7272 656e 745f 6861 6e64 |= torrent_hand │ │ │ +000748a0: 6c65 3a3a 6f6e 6c79 5f69 665f 6d6f 6469 le::only_if_modi │ │ │ +000748b0: 6669 6564 3b0a 3c2f 6469 763e 0a09 0909 fied;.
    .... │ │ │ +000748c0: 6966 2028 6d5f 6e65 6564 5f73 6176 655f if (m_need_save_ │ │ │ +000748d0: 7265 7375 6d65 5f64 6174 6120 2661 6d70 resume_data & │ │ │ +000748e0: 3b20 666c 6167 2920 7265 7475 726e 3b0a ; flag) return;. │ │ │ +000748f0: 0909 096d 5f6e 6565 645f 7361 7665 5f72 ...m_need_save_r │ │ │ +00074900: 6573 756d 655f 6461 7461 207c 3d20 666c esume_data |= fl │ │ │ +00074910: 6167 3b0a 0909 0973 7461 7465 5f75 7064 ag;....state_upd │ │ │ +00074920: 6174 6564 2829 3b0a 0909 7d0a 0a09 0961 ated();...}....a │ │ │ +00074930: 6464 5f74 6f72 7265 6e74 5f70 6172 616d dd_torrent_param │ │ │ +00074940: 7320 6765 745f 7265 7375 6d65 5f64 6174 s get_resume_dat │ │ │ +00074950: 6128 7265 7375 6d65 5f64 6174 615f 666c a(resume_data_fl │ │ │ +00074960: 6167 735f 7420 666c 6167 7329 2063 6f6e ags_t flags) con │ │ │ +00074970: 7374 3b0a 0a09 0962 6f6f 6c20 6973 5f61 st;....bool is_a │ │ │ +00074980: 7574 6f5f 6d61 6e61 6765 6428 2920 636f uto_managed() co │ │ │ +00074990: 6e73 7420 7b20 7265 7475 726e 206d 5f61 nst { return m_a │ │ │ +000749a0: 7574 6f5f 6d61 6e61 6765 643b 207d 0a09 uto_managed; }.. │ │ │ +000749b0: 0976 6f69 6420 6175 746f 5f6d 616e 6167 .void auto_manag │ │ │ +000749c0: 6564 2862 6f6f 6c20 6129 3b0a 0a09 0962 ed(bool a);....b │ │ │ +000749d0: 6f6f 6c20 7368 6f75 6c64 5f63 6865 636b ool should_check │ │ │ +000749e0: 5f66 696c 6573 2829 2063 6f6e 7374 3b0a _files() const;. │ │ │ +000749f0: 0a09 0962 6f6f 6c20 6465 6c65 7465 5f66 ...bool delete_f │ │ │ +00074a00: 696c 6573 2872 656d 6f76 655f 666c 6167 iles(remove_flag │ │ │ +00074a10: 735f 7420 6f70 7469 6f6e 7329 3b0a 0909 s_t options);... │ │ │ +00074a20: 766f 6964 2070 6565 7273 5f65 7261 7365 void peers_erase │ │ │ +00074a30: 6428 7374 643a 3a76 6563 746f 7226 6c74 d(std::vector< │ │ │ +00074a40: 3b74 6f72 7265 6e74 5f70 6565 722a 2667 ;torrent_peer*&g │ │ │ +00074a50: 743b 2063 6f6e 7374 2661 6d70 3b20 7065 t; const& pe │ │ │ +00074a60: 6572 7329 3b0a 0a23 6966 2054 4f52 5245 ers);..#if TORRE │ │ │ +00074a70: 4e54 5f41 4249 5f56 4552 5349 4f4e 203d NT_ABI_VERSION = │ │ │ +00074a80: 3d20 310a 2369 6620 2154 4f52 5245 4e54 = 1.#if !TORRENT │ │ │ +00074a90: 5f4e 4f5f 4650 550a 0909 766f 6964 2066 _NO_FPU...void f │ │ │ +00074aa0: 696c 655f 7072 6f67 7265 7373 5f66 6c6f ile_progress_flo │ │ │ +00074ab0: 6174 2861 7578 3a3a 7665 6374 6f72 266c at(aux::vector&l │ │ │ +00074ac0: 743b 666c 6f61 742c 2066 696c 655f 696e t;float, file_in │ │ │ +00074ad0: 6465 785f 7426 6774 3b26 616d 703b 2066 dex_t>& f │ │ │ +00074ae0: 7029 3b0a 2365 6e64 6966 0a23 656e 6469 p);.#endif.#endi │ │ │ +00074af0: 6620 2f2f 2054 4f52 5245 4e54 5f41 4249 f // TORRENT_ABI │ │ │ +00074b00: 5f56 4552 5349 4f4e 0a0a 0909 766f 6964 _VERSION....void │ │ │ +00074b10: 2070 6f73 745f 7069 6563 655f 6176 6169 post_piece_avai │ │ │ +00074b20: 6c61 6269 6c69 7479 2829 3b0a 0909 766f lability();...vo │ │ │ +00074b30: 6964 2070 6965 6365 5f61 7661 696c 6162 id piece_availab │ │ │ +00074b40: 696c 6974 7928 6175 783a 3a76 6563 746f ility(aux::vecto │ │ │ +00074b50: 7226 6c74 3b69 6e74 2c20 7069 6563 655f r<int, piece_ │ │ │ +00074b60: 696e 6465 785f 7426 6774 3b26 616d 703b index_t>& │ │ │ +00074b70: 2061 7661 696c 2920 636f 6e73 743b 0a0a avail) const;.. │ │ │ +00074b80: 0909 766f 6964 2073 6574 5f70 6965 6365 ..void set_piece │ │ │ +00074b90: 5f70 7269 6f72 6974 7928 7069 6563 655f _priority(piece_ │ │ │ +00074ba0: 696e 6465 785f 7420 696e 6465 782c 2064 index_t index, d │ │ │ +00074bb0: 6f77 6e6c 6f61 645f 7072 696f 7269 7479 ownload_priority │ │ │ +00074bc0: 5f74 2070 7269 6f72 6974 7929 3b0a 0909 _t priority);... │ │ │ +00074bd0: 646f 776e 6c6f 6164 5f70 7269 6f72 6974 download_priorit │ │ │ +00074be0: 795f 7420 7069 6563 655f 7072 696f 7269 y_t piece_priori │ │ │ +00074bf0: 7479 2870 6965 6365 5f69 6e64 6578 5f74 ty(piece_index_t │ │ │ +00074c00: 2069 6e64 6578 2920 636f 6e73 743b 0a0a index) const;.. │ │ │ +00074c10: 0909 766f 6964 2070 7269 6f72 6974 697a ..void prioritiz │ │ │ +00074c20: 655f 7069 6563 6573 2861 7578 3a3a 7665 e_pieces(aux::ve │ │ │ +00074c30: 6374 6f72 266c 743b 646f 776e 6c6f 6164 ctor<download │ │ │ +00074c40: 5f70 7269 6f72 6974 795f 742c 2070 6965 _priority_t, pie │ │ │ +00074c50: 6365 5f69 6e64 6578 5f74 2667 743b 2063 ce_index_t> c │ │ │ +00074c60: 6f6e 7374 2661 6d70 3b20 7069 6563 6573 onst& pieces │ │ │ +00074c70: 293b 0a09 0976 6f69 6420 7072 696f 7269 );...void priori │ │ │ +00074c80: 7469 7a65 5f70 6965 6365 5f6c 6973 7428 tize_piece_list( │ │ │ +00074c90: 7374 643a 3a76 6563 746f 7226 6c74 3b73 std::vector<s │ │ │ +00074ca0: 7464 3a3a 7061 6972 266c 743b 7069 6563 td::pair<piec │ │ │ +00074cb0: 655f 696e 6465 785f 742c 2064 6f77 6e6c e_index_t, downl │ │ │ +00074cc0: 6f61 645f 7072 696f 7269 7479 5f74 2667 oad_priority_t&g │ │ │ +00074cd0: 743b 2667 743b 2063 6f6e 7374 2661 6d70 t;> const& │ │ │ +00074ce0: 3b20 7069 6563 6573 293b 0a3c 2f70 7265 ; pieces);.
    rele │ │ │ +00074d20: 7661 6e63 6526 6e62 7370 3b30 3c2f 7464 vance 0
    ../include │ │ │ +00074d60: 2f6c 6962 746f 7272 656e 742f 746f 7272 /libtorrent/torr │ │ │ +00074d70: 656e 742e 6870 703a 3133 3933 3c2f 613e ent.hpp:1393 │ │ │ +00074d80: 3c2f 7464 3e3c 7464 3e74 6869 7320 7761 this wa │ │ │ +00074d90: 7374 6573 2035 2062 6974 7320 7065 7220 stes 5 bits per │ │ │ +00074da0: 6669 6c65 3c2f 7464 3e3c 2f74 723e 3c74 filethis wastes 5 │ │ │ +00074e00: 6269 7473 2070 6572 2066 696c 653c 2f68 bits per file

    ../include │ │ │ +00074e20: 2f6c 6962 746f 7272 656e 742f 746f 7272 /libtorrent/torr │ │ │ +00074e30: 656e 742e 6870 703a 3133 3933 3c2f 6834 ent.hpp:1393

    #ifnd
    │ │ │ +00074e80: 6566 2054 4f52 5245 4e54 5f44 4953 4142  ef TORRENT_DISAB
    │ │ │ +00074e90: 4c45 5f45 5854 454e 5349 4f4e 530a 0909  LE_EXTENSIONS...
    │ │ │ +00074ea0: 7374 643a 3a6c 6973 7426 6c74 3b73 7464  std::list<std
    │ │ │ +00074eb0: 3a3a 7368 6172 6564 5f70 7472 266c 743b  ::shared_ptr<
    │ │ │ +00074ec0: 746f 7272 656e 745f 706c 7567 696e 2667  torrent_plugin&g
    │ │ │ +00074ed0: 743b 2667 743b 206d 5f65 7874 656e 7369  t;> m_extensi
    │ │ │ +00074ee0: 6f6e 733b 0a23 656e 6469 660a 0a09 092f  ons;.#endif..../
    │ │ │ +00074ef0: 2f20 7573 6564 2066 6f72 2074 7261 636b  / used for track
    │ │ │ +00074f00: 6572 2061 6e6e 6f75 6e63 6573 0a09 0964  er announces...d
    │ │ │ +00074f10: 6561 646c 696e 655f 7469 6d65 7220 6d5f  eadline_timer m_
    │ │ │ +00074f20: 7472 6163 6b65 725f 7469 6d65 723b 0a0a  tracker_timer;..
    │ │ │ +00074f30: 0909 2f2f 2075 7365 6420 746f 2064 6574  ..// used to det
    │ │ │ +00074f40: 6563 7420 7768 656e 2077 6520 6172 6520  ect when we are 
    │ │ │ +00074f50: 6163 7469 7665 206f 7220 696e 6163 7469  active or inacti
    │ │ │ +00074f60: 7665 2066 6f72 206c 6f6e 6720 656e 6f75  ve for long enou
    │ │ │ +00074f70: 6768 0a09 092f 2f20 746f 2074 7269 6767  gh...// to trigg
    │ │ │ +00074f80: 6572 2074 6865 2061 7574 6f2d 6d61 6e61  er the auto-mana
    │ │ │ +00074f90: 6765 206c 6f67 6963 0a09 0964 6561 646c  ge logic...deadl
    │ │ │ +00074fa0: 696e 655f 7469 6d65 7220 6d5f 696e 6163  ine_timer m_inac
    │ │ │ +00074fb0: 7469 7669 7479 5f74 696d 6572 3b0a 0a09  tivity_timer;...
    │ │ │ +00074fc0: 092f 2f20 7468 6973 2069 7320 7468 6520  .// this is the 
    │ │ │ +00074fd0: 7570 6c6f 6164 2061 6e64 2064 6f77 6e6c  upload and downl
    │ │ │ +00074fe0: 6f61 6420 7374 6174 6973 7469 6373 2066  oad statistics f
    │ │ │ +00074ff0: 6f72 2074 6865 2077 686f 6c65 2074 6f72  or the whole tor
    │ │ │ +00075000: 7265 6e74 2e0a 0909 2f2f 2069 7427 7320  rent....// it's 
    │ │ │ +00075010: 7570 6461 7465 6420 6672 6f6d 2061 6c6c  updated from all
    │ │ │ +00075020: 2069 7473 2070 6565 7273 206f 6e63 6520   its peers once 
    │ │ │ +00075030: 6576 6572 7920 7365 636f 6e64 2e0a 0909  every second....
    │ │ │ +00075040: 6c69 6274 6f72 7265 6e74 3a3a 7374 6174  libtorrent::stat
    │ │ │ +00075050: 206d 5f73 7461 743b 0a0a 0909 2f2f 202d   m_stat;....// -
    │ │ │ +00075060: 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d  ----------------
    │ │ │ +00075070: 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 0a0a 0909  ------------....
    │ │ │ +00075080: 2f2f 2074 6869 7320 7665 6374 6f72 2069  // this vector i
    │ │ │ +00075090: 7320 616c 6c6f 6361 7465 6420 6c61 7a69  s allocated lazi
    │ │ │ +000750a0: 6c79 2e20 4966 206e 6f20 6669 6c65 2070  ly. If no file p
    │ │ │ +000750b0: 7269 6f72 6974 6965 7320 6172 650a 0909  riorities are...
    │ │ │ +000750c0: 2f2f 2065 7665 7220 6368 616e 6765 642c  // ever changed,
    │ │ │ +000750d0: 2074 6869 7320 7265 6d61 696e 7320 656d   this remains em
    │ │ │ +000750e0: 7074 792e 2041 6e79 2075 6e61 6c6c 6f63  pty. Any unalloc
    │ │ │ +000750f0: 6174 6564 2073 6c6f 740a 0909 2f2f 2069  ated slot...// i
    │ │ │ +00075100: 6d70 6c69 6369 746c 7920 6d65 616e 7320  mplicitly means 
    │ │ │ +00075110: 7468 6520 6669 6c65 2068 6173 2070 7269  the file has pri
    │ │ │ +00075120: 6f72 6974 7920 342e 0a3c 6469 7620 7374  ority 4..
    ..aux::ve │ │ │ +00075160: 6374 6f72 266c 743b 646f 776e 6c6f 6164 ctor<download │ │ │ +00075170: 5f70 7269 6f72 6974 795f 742c 2066 696c _priority_t, fil │ │ │ +00075180: 655f 696e 6465 785f 7426 6774 3b20 6d5f e_index_t> m_ │ │ │ +00075190: 6669 6c65 5f70 7269 6f72 6974 793b 0a3c file_priority;.< │ │ │ +000751a0: 2f64 6976 3e0a 0909 2f2f 2061 6e79 2066 /div>...// any f │ │ │ +000751b0: 696c 6520 7072 696f 7269 7479 2075 7064 ile priority upd │ │ │ +000751c0: 6174 6573 2061 7474 656d 7074 6564 2077 ates attempted w │ │ │ +000751d0: 6869 6c65 2061 6e6f 7468 6572 2066 696c hile another fil │ │ │ +000751e0: 6520 7072 696f 7269 7479 2075 7064 6174 e priority updat │ │ │ +000751f0: 650a 0909 2f2f 2069 7320 696e 2d70 726f e...// is in-pro │ │ │ +00075200: 6772 6573 732f 6f75 7473 7461 6e64 696e gress/outstandin │ │ │ +00075210: 6720 7769 7468 2074 6865 2064 6973 6b20 g with the disk │ │ │ +00075220: 492f 4f20 7468 7265 6164 2c20 6172 6520 I/O thread, are │ │ │ +00075230: 7175 6575 6564 2075 7020 696e 0a09 092f queued up in.../ │ │ │ +00075240: 2f20 7468 6973 2064 6963 7469 6f6e 6172 / this dictionar │ │ │ +00075250: 792e 204f 6e63 6520 7468 6520 6f75 7473 y. Once the outs │ │ │ +00075260: 7461 6e64 696e 6720 7570 6461 7465 2063 tanding update c │ │ │ +00075270: 6f6d 6573 2062 6163 6b2c 2061 6c6c 206f omes back, all o │ │ │ +00075280: 6620 7468 6573 650a 0909 2f2f 2061 7265 f these...// are │ │ │ +00075290: 2061 7070 6c69 6564 2069 6e20 6f6e 6520 applied in one │ │ │ +000752a0: 6261 7463 680a 0909 7374 643a 3a6d 6170 batch...std::map │ │ │ +000752b0: 266c 743b 6669 6c65 5f69 6e64 6578 5f74 <file_index_t │ │ │ +000752c0: 2c20 646f 776e 6c6f 6164 5f70 7269 6f72 , download_prior │ │ │ +000752d0: 6974 795f 7426 6774 3b20 6d5f 6465 6665 ity_t> m_defe │ │ │ +000752e0: 7272 6564 5f66 696c 655f 7072 696f 7269 rred_file_priori │ │ │ +000752f0: 7469 6573 3b0a 0a09 092f 2f20 7468 6973 ties;....// this │ │ │ +00075300: 206f 626a 6563 7420 6973 2075 7365 6420 object is used │ │ │ +00075310: 746f 2074 7261 636b 2064 6f77 6e6c 6f61 to track downloa │ │ │ +00075320: 6420 7072 6f67 7265 7373 206f 6620 696e d progress of in │ │ │ +00075330: 6469 7669 6475 616c 2066 696c 6573 0a09 dividual files.. │ │ │ +00075340: 0961 7578 3a3a 6669 6c65 5f70 726f 6772 .aux::file_progr │ │ │ +00075350: 6573 7320 6d5f 6669 6c65 5f70 726f 6772 ess m_file_progr │ │ │ +00075360: 6573 733b 0a0a 0909 2f2f 2061 2071 7565 ess;....// a que │ │ │ +00075370: 7565 206f 6620 7468 6520 6d6f 7374 2072 ue of the most r │ │ │ +00075380: 6563 656e 7420 6c6f 772d 6176 6169 6c61 ecent low-availa │ │ │ +00075390: 6269 6c69 7479 2070 6965 6365 7320 7765 bility pieces we │ │ │ +000753a0: 2061 6363 6573 7365 6420 6f6e 2064 6973 accessed on dis │ │ │ +000753b0: 6b2e 0a09 092f 2f20 5468 6573 6520 6172 k....// These ar │ │ │ +000753c0: 6520 676f 6f64 2063 616e 6469 6461 7465 e good candidate │ │ │ +000753d0: 7320 666f 7220 7375 6767 6573 7469 6e67 s for suggesting │ │ │ +000753e0: 206f 7468 6572 2070 6565 7273 2074 6f20 other peers to │ │ │ +000753f0: 7265 7175 6573 7420 6672 6f6d 0a09 092f request from.../ │ │ │ +00075400: 2f20 7573 2e0a 0909 6175 783a 3a73 7567 / us....aux::sug │ │ │ +00075410: 6765 7374 5f70 6965 6365 206d 5f73 7567 gest_piece m_sug │ │ │ +00075420: 6765 7374 5f70 6965 6365 733b 0a0a 0909 gest_pieces;.... │ │ │ +00075430: 6175 783a 3a76 6563 746f 7226 6c74 3b61 aux::vector<a │ │ │ +00075440: 7578 3a3a 616e 6e6f 756e 6365 5f65 6e74 ux::announce_ent │ │ │ +00075450: 7279 2667 743b 206d 5f74 7261 636b 6572 ry> m_tracker │ │ │ +00075460: 733b 0a0a 2369 666e 6465 6620 544f 5252 s;..#ifndef TORR │ │ │ +00075470: 454e 545f 4449 5341 424c 455f 5354 5245 ENT_DISABLE_STRE │ │ │ +00075480: 414d 494e 470a 0909 2f2f 2074 6869 7320 AMING...// this │ │ │ +00075490: 6c69 7374 2069 7320 736f 7274 6564 2062 list is sorted b │ │ │ +000754a0: 7920 7469 6d65 5f63 7269 7469 6361 6c5f y time_critical_ │ │ │ +000754b0: 7069 6563 653a 3a64 6561 646c 696e 650a piece::deadline. │ │ │ +000754c0: 0909 7374 643a 3a76 6563 746f 7226 6c74 ..std::vector< │ │ │ +000754d0: 3b74 696d 655f 6372 6974 6963 616c 5f70 ;time_critical_p │ │ │ +000754e0: 6965 6365 2667 743b 206d 5f74 696d 655f iece> m_time_ │ │ │ +000754f0: 6372 6974 6963 616c 5f70 6965 6365 733b critical_pieces; │ │ │ +00075500: 0a23 656e 6469 660a 0a09 0973 7464 3a3a .#endif....std:: │ │ │ +00075510: 7374 7269 6e67 206d 5f74 7261 636b 6572 string m_tracker │ │ │ +00075520: 6964 3b0a 2369 6620 544f 5252 454e 545f id;.#if TORRENT_ │ │ │ +00075530: 4142 495f 5645 5253 494f 4e20 3d3d 2031 ABI_VERSION == 1 │ │ │ +00075540: 0a09 092f 2f20 6465 7072 6563 6174 6564 ...// deprecated │ │ │ +00075550: 2069 6e20 312e 310a 0909 7374 643a 3a73 in 1.1...std::s │ │ │ +00075560: 7472 696e 6720 6d5f 7573 6572 6e61 6d65 tring m_username │ │ │ +00075570: 3b0a 0909 7374 643a 3a73 7472 696e 6720 ;...std::string │ │ │ +00075580: 6d5f 7061 7373 776f 7264 3b0a 2365 6e64 m_password;.#end │ │ │ +00075590: 6966 0a0a 0909 7374 643a 3a73 7472 696e if....std::strin │ │ │ +000755a0: 6720 6d5f 7361 7665 5f70 6174 683b 0a3c g m_save_path;.< │ │ │ +000755b0: 2f70 7265 3e3c 2f74 643e 3c2f 7472 3e3c /pre>< │ │ │ +000755c0: 7472 2073 7479 6c65 3d22 6261 636b 6772 tr style="backgr │ │ │ +000755d0: 6f75 6e64 3a20 2363 6363 223e 3c74 643e ound: #ccc"> │ │ │ +000755e0: 7265 6c65 7661 6e63 6526 6e62 7370 3b30 relevance 0 │ │ │ +000755f0: 3c2f 7464 3e3c 7464 3e3c 6120 6872 6566 ../inc │ │ │ +00075620: 6c75 6465 2f6c 6962 746f 7272 656e 742f lude/libtorrent/ │ │ │ +00075630: 746f 7272 656e 742e 6870 703a 3137 3039 torrent.hpp:1709 │ │ │ +00075640: 3c2f 613e 3c2f 7464 3e3c 7464 3e74 6869 thi │ │ │ +00075650: 7320 6d65 6d62 6572 2063 616e 2070 726f s member can pro │ │ │ +00075660: 6261 626c 7920 6265 2072 656d 6f76 6564 bably be removed │ │ │ +00075670: 3c2f 7464 3e3c 2f74 723e 3c74 7220 6964

    th │ │ │ +000756c0: 6973 206d 656d 6265 7220 6361 6e20 7072 is member can pr │ │ │ +000756d0: 6f62 6162 6c79 2062 6520 7265 6d6f 7665 obably be remove │ │ │ +000756e0: 643c 2f68 323e 3c68 343e 2e2e 2f69 6e63 d

    ../inc │ │ │ +000756f0: 6c75 6465 2f6c 6962 746f 7272 656e 742f lude/libtorrent/ │ │ │ +00075700: 746f 7272 656e 742e 6870 703a 3137 3039 torrent.hpp:1709 │ │ │ +00075710: 3c2f 6834 3e3c 7072 6520 7374 796c 653d

    .
    │ │ │ +00075750: 0975 6e73 6967 6e65 6420 696e 7420 6d5f  .unsigned int m_
    │ │ │ +00075760: 6e75 6d5f 7570 6c6f 6164 733a 3234 3b0a  num_uploads:24;.
    │ │ │ +00075770: 0a09 092f 2f20 3420 756e 7573 6564 2062  ...// 4 unused b
    │ │ │ +00075780: 6974 730a 0a09 092f 2f20 7768 656e 2074  its....// when t
    │ │ │ +00075790: 6869 7320 6973 2074 7275 652c 2074 6869  his is true, thi
    │ │ │ +000757a0: 7320 746f 7272 656e 7420 7375 7070 6f72  s torrent suppor
    │ │ │ +000757b0: 7473 2070 6565 7220 6578 6368 616e 6765  ts peer exchange
    │ │ │ +000757c0: 0a09 0962 6f6f 6c20 6d5f 656e 6162 6c65  ...bool m_enable
    │ │ │ +000757d0: 5f70 6578 3a31 3b0a 0a09 092f 2f20 7365  _pex:1;....// se
    │ │ │ +000757e0: 7420 746f 2074 7275 6520 6966 2074 6865  t to true if the
    │ │ │ +000757f0: 2073 6573 7369 6f6e 2049 5020 6669 6c74   session IP filt
    │ │ │ +00075800: 6572 2061 7070 6c69 6573 2074 6f20 7468  er applies to th
    │ │ │ +00075810: 6973 0a09 092f 2f20 746f 7272 656e 7420  is...// torrent 
    │ │ │ +00075820: 6f72 206e 6f74 2e20 4465 6661 756c 7473  or not. Defaults
    │ │ │ +00075830: 2074 6f20 7472 7565 2e0a 0909 626f 6f6c   to true....bool
    │ │ │ +00075840: 206d 5f61 7070 6c79 5f69 705f 6669 6c74   m_apply_ip_filt
    │ │ │ +00075850: 6572 3a31 3b0a 0a09 092f 2f20 7468 6973  er:1;....// this
    │ │ │ +00075860: 2069 7320 7472 7565 2077 6865 6e20 6f75   is true when ou
    │ │ │ +00075870: 7220 6566 6665 6374 6976 6520 696e 6163  r effective inac
    │ │ │ +00075880: 7469 7665 2073 7461 7465 2069 7320 6469  tive state is di
    │ │ │ +00075890: 6666 6572 656e 7420 6672 6f6d 206f 7572  fferent from our
    │ │ │ +000758a0: 0a09 092f 2f20 6163 7475 616c 2069 6e61  ...// actual ina
    │ │ │ +000758b0: 6374 6976 6520 7374 6174 652e 2057 6865  ctive state. Whe
    │ │ │ +000758c0: 6e65 7665 7220 7468 6973 2073 7461 7465  never this state
    │ │ │ +000758d0: 2063 6861 6e67 6573 2c20 7468 6572 6520   changes, there 
    │ │ │ +000758e0: 6973 2061 0a09 092f 2f20 7175 6172 616e  is a...// quaran
    │ │ │ +000758f0: 7469 6e65 2070 6572 696f 6420 756e 7469  tine period unti
    │ │ │ +00075900: 6c20 7765 2063 6861 6e67 6520 7468 6520  l we change the 
    │ │ │ +00075910: 6566 6665 6374 6976 6520 7374 6174 652e  effective state.
    │ │ │ +00075920: 2054 6869 7320 6973 2074 6f20 6176 6f69   This is to avoi
    │ │ │ +00075930: 640a 0909 2f2f 2066 6c61 7070 696e 672e  d...// flapping.
    │ │ │ +00075940: 2049 6620 7468 6520 7374 6174 6520 6368   If the state ch
    │ │ │ +00075950: 616e 6765 7320 6261 636b 2064 7572 696e  anges back durin
    │ │ │ +00075960: 6720 7468 6973 2070 6572 696f 642c 2077  g this period, w
    │ │ │ +00075970: 6520 6361 6e63 656c 2074 6865 0a09 092f  e cancel the.../
    │ │ │ +00075980: 2f20 7175 6172 616e 7469 6e65 0a09 0962  / quarantine...b
    │ │ │ +00075990: 6f6f 6c20 6d5f 7065 6e64 696e 675f 6163  ool m_pending_ac
    │ │ │ +000759a0: 7469 7665 5f63 6861 6e67 653a 313b 0a0a  tive_change:1;..
    │ │ │ +000759b0: 0909 2f2f 2074 6869 7320 6973 2073 6574  ..// this is set
    │ │ │ +000759c0: 2074 6f20 7472 7565 2069 6620 616c 6c20   to true if all 
    │ │ │ +000759d0: 7069 6563 6520 6c61 7965 7273 2077 6572  piece layers wer
    │ │ │ +000759e0: 6520 7375 6363 6573 7366 756c 6c79 206c  e successfully l
    │ │ │ +000759f0: 6f61 6465 6420 616e 640a 0909 2f2f 2076  oaded and...// v
    │ │ │ +00075a00: 616c 6964 6174 6564 2e20 4f6e 6c79 2066  alidated. Only f
    │ │ │ +00075a10: 6f72 2076 3220 746f 7272 656e 7473 0a3c  or v2 torrents.<
    │ │ │ +00075a20: 6469 7620 7374 796c 653d 2262 6163 6b67  div style="backg
    │ │ │ +00075a30: 726f 756e 643a 2023 6666 6666 3030 2220  round: #ffff00" 
    │ │ │ +00075a40: 7769 6474 683d 2231 3030 2522 3e09 0962  width="100%">..b
    │ │ │ +00075a50: 6f6f 6c20 6d5f 7632 5f70 6965 6365 5f6c  ool m_v2_piece_l
    │ │ │ +00075a60: 6179 6572 735f 7661 6c69 6461 7465 643a  ayers_validated:
    │ │ │ +00075a70: 313b 0a3c 2f64 6976 3e0a 2f2f 202d 2d2d  1;.
    .// --- │ │ │ +00075a80: 2d0a 0a09 092f 2f20 7468 6973 2069 7320 -....// this is │ │ │ +00075a90: 7365 7420 746f 2074 6865 2063 6f6e 6e65 set to the conne │ │ │ +00075aa0: 6374 2062 6f6f 7374 2071 756f 7461 2066 ct boost quota f │ │ │ +00075ab0: 6f72 2074 6869 7320 746f 7272 656e 742e or this torrent. │ │ │ +00075ac0: 0a09 092f 2f20 4166 7465 7220 6861 7669 ...// After havi │ │ │ +00075ad0: 6e67 2072 6563 6569 7665 6420 7468 6973 ng received this │ │ │ +00075ae0: 206d 616e 7920 7072 696f 7269 7479 2070 many priority p │ │ │ +00075af0: 6565 7220 636f 6e6e 6563 7469 6f6e 2061 eer connection a │ │ │ +00075b00: 7474 656d 7074 732c 2069 740a 0909 2f2f ttempts, it...// │ │ │ +00075b10: 2066 616c 6c73 2062 6163 6b20 6f6e 746f falls back onto │ │ │ +00075b20: 2074 6865 2073 7465 6164 7920 7374 6174 the steady stat │ │ │ +00075b30: 6520 7065 6572 2063 6f6e 6e65 6374 696f e peer connectio │ │ │ +00075b40: 6e20 6c6f 6769 632c 2064 7269 7665 6e20 n logic, driven │ │ │ +00075b50: 6279 2074 6865 0a09 092f 2f20 7365 7373 by the...// sess │ │ │ +00075b60: 696f 6e20 7469 636b 2e20 4561 6368 2074 ion tick. Each t │ │ │ +00075b70: 7261 636b 6572 2072 6573 706f 6e73 652c racker response, │ │ │ +00075b80: 2061 7320 6c6f 6e67 2061 7320 7468 6973 as long as this │ │ │ +00075b90: 2069 7320 6e6f 6e2d 7a65 726f 2c20 7769 is non-zero, wi │ │ │ +00075ba0: 6c6c 0a09 092f 2f20 6174 7465 6d70 7420 ll...// attempt │ │ │ +00075bb0: 746f 2063 6f6e 6e65 6374 2074 6f20 7065 to connect to pe │ │ │ +00075bc0: 6572 7320 696d 6d65 6469 6174 656c 7920 ers immediately │ │ │ +00075bd0: 616e 6420 6465 6372 656d 656e 7420 7468 and decrement th │ │ │ +00075be0: 6520 636f 756e 7465 722e 0a09 092f 2f20 e counter....// │ │ │ +00075bf0: 5765 2067 6976 6520 746f 7272 656e 7473 We give torrents │ │ │ +00075c00: 2061 2063 6f6e 6e65 6374 2062 6f6f 7374 a connect boost │ │ │ +00075c10: 2077 6865 6e20 7468 6579 2061 7265 2066 when they are f │ │ │ +00075c20: 6972 7374 2061 6464 6564 2061 6e64 2074 irst added and t │ │ │ +00075c30: 6865 6e0a 0909 2f2f 2065 7665 7279 2074 hen...// every t │ │ │ +00075c40: 696d 6520 7468 6579 2072 6573 756d 6520 ime they resume │ │ │ +00075c50: 6672 6f6d 2062 6569 6e67 2070 6175 7365 from being pause │ │ │ +00075c60: 642e 0a09 0973 7464 3a3a 7569 6e74 385f d....std::uint8_ │ │ │ +00075c70: 7420 6d5f 636f 6e6e 6563 745f 626f 6f73 t m_connect_boos │ │ │ +00075c80: 745f 636f 756e 7465 723b 0a0a 2f2f 202d t_counter;..// - │ │ │ +00075c90: 2d2d 2d0a 0a09 092f 2f20 7468 6520 7363 ---....// the sc │ │ │ +00075ca0: 7261 7065 2064 6174 6120 6672 6f6d 2074 rape data from t │ │ │ +00075cb0: 6865 2074 7261 636b 6572 2072 6573 706f he tracker respo │ │ │ +00075cc0: 6e73 652c 2074 6869 730a 0909 2f2f 2069 nse, this...// i │ │ │ +00075cd0: 7320 6f70 7469 6f6e 616c 2061 6e64 206d s optional and m │ │ │ +00075ce0: 6179 2062 6520 3078 6666 6666 6666 0a09 ay be 0xffffff.. │ │ │ +00075cf0: 0973 7464 3a3a 7569 6e74 3332 5f74 206d .std::uint32_t m │ │ │ +00075d00: 5f69 6e63 6f6d 706c 6574 653a 3234 3b0a _incomplete:24;. │ │ │ +00075d10: 0a09 092f 2f20 7472 7565 2077 6865 6e20 ...// true when │ │ │ +00075d20: 7468 6520 746f 7272 656e 7420 7368 6f75 the torrent shou │ │ │ +00075d30: 6c64 2061 6e6e 6f75 6e63 6520 746f 0a09 ld announce to.. │ │ │ +00075d40: 092f 2f20 7468 6520 4448 540a 0909 626f .// the DHT...bo │ │ │ +00075d50: 6f6c 206d 5f61 6e6e 6f75 6e63 655f 746f ol m_announce_to │ │ │ +00075d60: 5f64 6874 3a31 3b0a 0a09 092f 2f20 6576 _dht:1;....// ev │ │ │ +00075d70: 656e 2069 6620 7765 2772 6520 6e6f 7420 en if we're not │ │ │ +00075d80: 6275 696c 7420 746f 2073 7570 706f 7274 built to support │ │ │ +00075d90: 2053 534c 2074 6f72 7265 6e74 732c 0a09 SSL torrents,.. │ │ │ +00075da0: 092f 2f20 7265 6d65 6d62 6572 2074 6861 .// remember tha │ │ │ +00075db0: 7420 7468 6973 2069 7320 616e 2053 534c t this is an SSL │ │ │ +00075dc0: 2074 6f72 7265 6e74 2c20 736f 2074 6861 torrent, so tha │ │ │ +00075dd0: 7420 7765 2064 6f6e 2774 0a09 092f 2f20 t we don't...// │ │ │ +00075de0: 6163 6369 6465 6e74 616c 6c79 2073 7461 accidentally sta │ │ │ +00075df0: 7274 2073 6565 6469 6e67 2069 7420 7769 rt seeding it wi │ │ │ +00075e00: 7468 6f75 7420 616e 7920 6175 7468 656e thout any authen │ │ │ +00075e10: 7469 6361 7469 6f6e 2e0a 0909 626f 6f6c tication....bool │ │ │ +00075e20: 206d 5f73 736c 5f74 6f72 7265 6e74 3a31 m_ssl_torrent:1 │ │ │ +00075e30: 3b0a 0a09 092f 2f20 7468 6973 2069 7320 ;....// this is │ │ │ +00075e40: 7365 7420 746f 2074 7275 6520 6966 2077 set to true if w │ │ │ +00075e50: 6527 7265 2074 7279 696e 6720 746f 2064 e're trying to d │ │ │ +00075e60: 656c 6574 6520 7468 650a 0909 2f2f 2066 elete the...// f │ │ │ +00075e70: 696c 6573 2062 656c 6f6e 6769 6e67 2074 iles belonging t │ │ │ +00075e80: 6f20 6974 2e20 5768 656e 2073 6574 2c20 o it. When set, │ │ │ +00075e90: 646f 6e27 7420 7772 6974 6520 616e 790a don't write any. │ │ │ +00075ea0: 0909 2f2f 206d 6f72 6520 626c 6f63 6b73 ..// more blocks │ │ │ +00075eb0: 2074 6f20 6469 736b 210a 3c2f 7072 653e to disk!.
    │ │ │ +00075ec0: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ +00075ef0: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ +00075f00: 3c74 643e 3c61 2068 7265 663d 226a 6176 ../include/ │ │ │ +00075f30: 6c69 6274 6f72 7265 6e74 2f70 6965 6365 libtorrent/piece │ │ │ +00075f40: 5f70 6963 6b65 722e 6870 703a 3832 333c _picker.hpp:823< │ │ │ +00075f50: 2f61 3e3c 2f74 643e 3c74 643e 7368 6f75 /a>shou │ │ │ +00075f60: 6c64 2074 6869 7320 6265 2061 6c6c 6f63 ld this be alloc │ │ │ +00075f70: 6174 6564 206c 617a 696c 793f 3c2f 7464 ated lazily?

    should │ │ │ +00075fd0: 2074 6869 7320 6265 2061 6c6c 6f63 6174 this be allocat │ │ │ +00075fe0: 6564 206c 617a 696c 793f 3c2f 6832 3e3c ed lazily?

    < │ │ │ +00075ff0: 6834 3e2e 2e2f 696e 636c 7564 652f 6c69 h4>../include/li │ │ │ +00076000: 6274 6f72 7265 6e74 2f70 6965 6365 5f70 btorrent/piece_p │ │ │ +00076010: 6963 6b65 722e 6870 703a 3832 333c 2f68 icker.hpp:823
    ..//
    │ │ │ +00076060: 2064 6f77 6e6c 6f61 6420 6c69 7374 2069   download list i
    │ │ │ +00076070: 7420 6d61 7920 6c69 7665 2069 6e20 6e6f  t may live in no
    │ │ │ +00076080: 770a 0909 7374 643a 3a76 6563 746f 7226  w...std::vector&
    │ │ │ +00076090: 6c74 3b64 6f77 6e6c 6f61 6469 6e67 5f70  lt;downloading_p
    │ │ │ +000760a0: 6965 6365 2667 743b 3a3a 6974 6572 6174  iece>::iterat
    │ │ │ +000760b0: 6f72 2075 7064 6174 655f 7069 6563 655f  or update_piece_
    │ │ │ +000760c0: 7374 6174 6528 0a09 0909 7374 643a 3a76  state(....std::v
    │ │ │ +000760d0: 6563 746f 7226 6c74 3b64 6f77 6e6c 6f61  ector<downloa
    │ │ │ +000760e0: 6469 6e67 5f70 6965 6365 2667 743b 3a3a  ding_piece>::
    │ │ │ +000760f0: 6974 6572 6174 6f72 2064 7029 3b0a 0a09  iterator dp);...
    │ │ │ +00076100: 7072 6976 6174 653a 0a0a 2369 6620 544f  private:..#if TO
    │ │ │ +00076110: 5252 454e 545f 5553 455f 4153 5345 5254  RRENT_USE_ASSERT
    │ │ │ +00076120: 5320 7c7c 2054 4f52 5245 4e54 5f55 5345  S || TORRENT_USE
    │ │ │ +00076130: 5f49 4e56 4152 4941 4e54 5f43 4845 434b  _INVARIANT_CHECK
    │ │ │ +00076140: 530a 0909 696e 6465 785f 7261 6e67 6526  S...index_range&
    │ │ │ +00076150: 6c74 3b64 6f77 6e6c 6f61 645f 7175 6575  lt;download_queu
    │ │ │ +00076160: 655f 7426 6774 3b20 6361 7465 676f 7269  e_t> categori
    │ │ │ +00076170: 6573 2829 2063 6f6e 7374 0a09 097b 2072  es() const...{ r
    │ │ │ +00076180: 6574 7572 6e20 7b7b 7d2c 2070 6965 6365  eturn {{}, piece
    │ │ │ +00076190: 5f70 6963 6b65 723a 3a70 6965 6365 5f70  _picker::piece_p
    │ │ │ +000761a0: 6f73 3a3a 6e75 6d5f 646f 776e 6c6f 6164  os::num_download
    │ │ │ +000761b0: 5f63 6174 6567 6f72 6965 737d 3b20 7d0a  _categories}; }.
    │ │ │ +000761c0: 2365 6e64 6966 0a0a 0909 2f2f 2074 6865  #endif....// the
    │ │ │ +000761d0: 2066 6f6c 6c6f 7769 6e67 2076 6563 746f   following vecto
    │ │ │ +000761e0: 7273 2061 7265 206d 7574 6162 6c65 2062  rs are mutable b
    │ │ │ +000761f0: 6563 6175 7365 2074 6865 7920 736f 6d65  ecause they some
    │ │ │ +00076200: 7469 6d65 7320 6d61 790a 0909 2f2f 2062  times may...// b
    │ │ │ +00076210: 6520 7570 6461 7465 6420 6c61 7a69 6c79  e updated lazily
    │ │ │ +00076220: 2c20 7472 6967 6765 7265 6420 6279 2063  , triggered by c
    │ │ │ +00076230: 6f6e 7374 2066 756e 6374 696f 6e73 0a0a  onst functions..
    │ │ │ +00076240: 0909 2f2f 2074 6869 7320 6d61 7073 2069  ..// this maps i
    │ │ │ +00076250: 6e64 6963 6573 2074 6f20 6e75 6d62 6572  ndices to number
    │ │ │ +00076260: 206f 6620 7065 6572 7320 7468 6174 2068   of peers that h
    │ │ │ +00076270: 6173 2074 6869 7320 7069 6563 6520 616e  as this piece an
    │ │ │ +00076280: 640a 0909 2f2f 2069 6e64 6578 2069 6e74  d...// index int
    │ │ │ +00076290: 6f20 7468 6520 6d5f 7069 6563 655f 696e  o the m_piece_in
    │ │ │ +000762a0: 666f 2076 6563 746f 7273 2e0a 0909 2f2f  fo vectors....//
    │ │ │ +000762b0: 2070 6965 6365 5f70 6f73 3a3a 7765 5f68   piece_pos::we_h
    │ │ │ +000762c0: 6176 655f 696e 6465 7820 6d65 616e 7320  ave_index means 
    │ │ │ +000762d0: 7468 6174 2077 6520 6861 7665 2074 6865  that we have the
    │ │ │ +000762e0: 2070 6965 6365 2c20 736f 2069 740a 0909   piece, so it...
    │ │ │ +000762f0: 2f2f 2064 6f65 736e 2774 2065 7869 7374  // doesn't exist
    │ │ │ +00076300: 2069 6e20 7468 6520 7069 6563 655f 696e   in the piece_in
    │ │ │ +00076310: 666f 2062 7563 6b65 7473 0a09 092f 2f20  fo buckets...// 
    │ │ │ +00076320: 7069 6563 6573 2077 6974 6820 7468 6520  pieces with the 
    │ │ │ +00076330: 6669 6c74 6572 6564 2066 6c61 6720 7365  filtered flag se
    │ │ │ +00076340: 7420 646f 6573 6e27 7420 6861 7665 2065  t doesn't have e
    │ │ │ +00076350: 6e74 7269 6573 2069 6e0a 0909 2f2f 2074  ntries in...// t
    │ │ │ +00076360: 6865 206d 5f70 6965 6365 5f69 6e66 6f20  he m_piece_info 
    │ │ │ +00076370: 6275 636b 6574 7320 6569 7468 6572 0a3c  buckets either.<
    │ │ │ +00076380: 6469 7620 7374 796c 653d 2262 6163 6b67  div style="backg
    │ │ │ +00076390: 726f 756e 643a 2023 6666 6666 3030 2220  round: #ffff00" 
    │ │ │ +000763a0: 7769 6474 683d 2231 3030 2522 3e09 096d  width="100%">..m
    │ │ │ +000763b0: 7574 6162 6c65 2061 7578 3a3a 7665 6374  utable aux::vect
    │ │ │ +000763c0: 6f72 266c 743b 7069 6563 655f 706f 732c  or<piece_pos,
    │ │ │ +000763d0: 2070 6965 6365 5f69 6e64 6578 5f74 2667   piece_index_t&g
    │ │ │ +000763e0: 743b 206d 5f70 6965 6365 5f6d 6170 3b0a  t; m_piece_map;.
    │ │ │ +000763f0: 3c2f 6469 763e 0a09 092f 2f20 7472 6163  ...// trac
    │ │ │ +00076400: 6b73 2074 6865 206e 756d 6265 7220 6f66  ks the number of
    │ │ │ +00076410: 2062 7974 6573 2069 6e20 6120 7370 6563   bytes in a spec
    │ │ │ +00076420: 6966 6963 2070 6965 6365 2074 6861 7420  ific piece that 
    │ │ │ +00076430: 6172 6520 7061 7274 206f 6620 6120 7061  are part of a pa
    │ │ │ +00076440: 640a 0909 2f2f 2066 696c 652e 2054 6865  d...// file. The
    │ │ │ +00076450: 2070 6164 6469 6e67 2069 7320 6173 7375   padding is assu
    │ │ │ +00076460: 6d65 6420 746f 2062 6520 6174 2074 6865  med to be at the
    │ │ │ +00076470: 2065 6e64 206f 6620 7468 6520 7069 6563   end of the piec
    │ │ │ +00076480: 652c 2061 6e64 2074 6865 0a09 092f 2f20  e, and the...// 
    │ │ │ +00076490: 626c 6f63 6b73 2063 6f76 6572 6564 2062  blocks covered b
    │ │ │ +000764a0: 7920 7468 6520 7061 6420 6279 7465 7320  y the pad bytes 
    │ │ │ +000764b0: 6172 6520 6e6f 7420 7069 636b 6564 2062  are not picked b
    │ │ │ +000764c0: 7920 7468 6520 7069 6563 6520 7069 636b  y the piece pick
    │ │ │ +000764d0: 6572 0a09 0973 7464 3a3a 756e 6f72 6465  er...std::unorde
    │ │ │ +000764e0: 7265 645f 6d61 7026 6c74 3b70 6965 6365  red_map<piece
    │ │ │ +000764f0: 5f69 6e64 6578 5f74 2c20 696e 7426 6774  _index_t, int>
    │ │ │ +00076500: 3b20 6d5f 7061 6473 5f69 6e5f 7069 6563  ; m_pads_in_piec
    │ │ │ +00076510: 653b 0a0a 0909 2f2f 2077 6865 6e20 7468  e;....// when th
    │ │ │ +00076520: 6520 6164 6a61 6365 6e74 5f70 6965 6365  e adjacent_piece
    │ │ │ +00076530: 2061 6666 696e 6974 7920 6973 2065 6e61   affinity is ena
    │ │ │ +00076540: 626c 6564 2c20 7468 6973 2063 6f6e 7461  bled, this conta
    │ │ │ +00076550: 696e 7320 7468 6520 6d6f 7374 0a09 092f  ins the most.../
    │ │ │ +00076560: 2f20 7265 6365 6e74 2022 6578 7465 6e74  / recent "extent
    │ │ │ +00076570: 7322 206f 6620 6164 6a61 6365 6e74 2070  s" of adjacent p
    │ │ │ +00076580: 6965 6365 7320 7468 6174 2068 6176 6520  ieces that have 
    │ │ │ +00076590: 6265 656e 2072 6571 7565 7374 6564 2066  been requested f
    │ │ │ +000765a0: 726f 6d0a 0909 2f2f 2074 6869 7320 6973  rom...// this is
    │ │ │ +000765b0: 206d 7574 6162 6c65 2062 6563 6175 7365   mutable because
    │ │ │ +000765c0: 2069 7427 7320 7570 6461 7465 6420 6279   it's updated by
    │ │ │ +000765d0: 2066 756e 6374 696f 6e73 2074 6f20 7069   functions to pi
    │ │ │ +000765e0: 636b 2070 6965 6365 732c 2077 6869 6368  ck pieces, which
    │ │ │ +000765f0: 0a09 092f 2f20 6172 6520 636f 6e73 742e  ...// are const.
    │ │ │ +00076600: 2054 6861 7427 7320 616e 2065 6666 6963   That's an effic
    │ │ │ +00076610: 6965 6e74 2070 6c61 6365 2074 6f20 7570  ient place to up
    │ │ │ +00076620: 6461 7465 2069 742c 2073 696e 6365 2069  date it, since i
    │ │ │ +00076630: 7427 7320 6265 696e 670a 0909 2f2f 2074  t's being...// t
    │ │ │ +00076640: 7261 7665 7273 6564 2061 6c72 6561 6479  raversed already
    │ │ │ +00076650: 2e0a 0909 6d75 7461 626c 6520 7374 643a  ....mutable std:
    │ │ │ +00076660: 3a76 6563 746f 7226 6c74 3b70 6965 6365  :vector<piece
    │ │ │ +00076670: 5f65 7874 656e 745f 7426 6774 3b20 6d5f  _extent_t> m_
    │ │ │ +00076680: 7265 6365 6e74 5f65 7874 656e 7473 3b0a  recent_extents;.
    │ │ │ +00076690: 0a09 092f 2f20 7468 6520 6e75 6d62 6572  ...// the number
    │ │ │ +000766a0: 206f 6620 6279 7465 7320 6f66 2070 6164   of bytes of pad
    │ │ │ +000766b0: 2066 696c 6520 7365 7420 696e 2074 6869   file set in thi
    │ │ │ +000766c0: 7320 7069 6563 6520 7069 636b 6572 0a09  s piece picker..
    │ │ │ +000766d0: 0973 7464 3a3a 696e 7436 345f 7420 6d5f  .std::int64_t m_
    │ │ │ +000766e0: 6e75 6d5f 7061 645f 6279 7465 7320 3d20  num_pad_bytes = 
    │ │ │ +000766f0: 303b 0a0a 0909 2f2f 2074 6865 206e 756d  0;....// the num
    │ │ │ +00076700: 6265 7220 6f66 2070 6164 2062 6c6f 636b  ber of pad block
    │ │ │ +00076710: 7320 7468 6174 2077 6520 616c 7265 6164  s that we alread
    │ │ │ +00076720: 7920 6861 7665 0a09 0973 7464 3a3a 696e  y have...std::in
    │ │ │ +00076730: 7436 345f 7420 6d5f 6861 7665 5f70 6164  t64_t m_have_pad
    │ │ │ +00076740: 5f62 7974 6573 203d 2030 3b0a 0a09 092f  _bytes = 0;..../
    │ │ │ +00076750: 2f20 7468 6520 6e75 6d62 6572 206f 6620  / the number of 
    │ │ │ +00076760: 7061 6420 626c 6f63 6b73 2070 6172 7420  pad blocks part 
    │ │ │ +00076770: 6f66 2066 696c 7465 7265 6420 7069 6563  of filtered piec
    │ │ │ +00076780: 6573 2077 6520 646f 6e27 7420 6861 7665  es we don't have
    │ │ │ +00076790: 0a09 0973 7464 3a3a 696e 7436 345f 7420  ...std::int64_t 
    │ │ │ +000767a0: 6d5f 6669 6c74 6572 6564 5f70 6164 5f62  m_filtered_pad_b
    │ │ │ +000767b0: 7974 6573 203d 2030 3b0a 0a09 092f 2f20  ytes = 0;....// 
    │ │ │ +000767c0: 7468 6520 6e75 6d62 6572 206f 6620 7061  the number of pa
    │ │ │ +000767d0: 6420 626c 6f63 6b73 2077 6520 6861 7665  d blocks we have
    │ │ │ +000767e0: 2074 6861 7420 6172 6520 616c 736f 2066   that are also f
    │ │ │ +000767f0: 696c 7465 7265 640a 0909 7374 643a 3a69  iltered...std::i
    │ │ │ +00076800: 6e74 3634 5f74 206d 5f68 6176 655f 6669  nt64_t m_have_fi
    │ │ │ +00076810: 6c74 6572 6564 5f70 6164 5f62 7974 6573  ltered_pad_bytes
    │ │ │ +00076820: 203d 2030 3b0a 0a09 092f 2f20 7468 6520   = 0;....// the 
    │ │ │ +00076830: 6e75 6d62 6572 206f 6620 7365 6564 732e  number of seeds.
    │ │ │ +00076840: 2054 6865 7365 2061 7265 206e 6f74 2061   These are not a
    │ │ │ +00076850: 6464 6564 2074 6f0a 0909 2f2f 2074 6865  dded to...// the
    │ │ │ +00076860: 2061 7661 696c 6162 696c 6974 7920 636f   availability co
    │ │ │ +00076870: 756e 7465 7273 206f 6620 7468 6520 7069  unters of the pi
    │ │ │ +00076880: 6563 6573 0a09 0969 6e74 206d 5f73 6565  eces...int m_see
    │ │ │ +00076890: 6473 203d 2030 3b0a 0a09 092f 2f20 7468  ds = 0;....// th
    │ │ │ +000768a0: 6973 2076 6563 746f 7220 636f 6e74 6169  is vector contai
    │ │ │ +000768b0: 6e73 2061 6c6c 2070 6965 6365 2069 6e64  ns all piece ind
    │ │ │ +000768c0: 6963 6573 2074 6861 7420 6172 6520 7069  ices that are pi
    │ │ │ +000768d0: 636b 6162 6c65 0a3c 2f70 7265 3e3c 2f74  ckable.
    relevanc │ │ │ +00076910: 6526 6e62 7370 3b30 3c2f 7464 3e3c 7464 e 0../include/lib │ │ │ +00076950: 746f 7272 656e 742f 7069 6563 655f 7069 torrent/piece_pi │ │ │ +00076960: 636b 6572 2e68 7070 3a38 3935 3c2f 613e cker.hpp:895 │ │ │ +00076970: 3c2f 7464 3e3c 7464 3e69 7420 776f 756c it woul │ │ │ +00076980: 6420 6265 206d 6f72 6520 696e 7475 6974 d be more intuit │ │ │ +00076990: 6976 6520 746f 2061 6363 6f75 6e74 2022 ive to account " │ │ │ +000769a0: 7761 6e74 6564 2220 7069 6563 6573 2069 wanted" pieces i │ │ │ +000769b0: 6e73 7465 6164 206f 6620 6669 6c74 6572 nstead of filter │ │ │ +000769c0: 6564 3c2f 7464 3e3c 2f74 723e 3c74 7220 ed

    │ │ │ +00076a10: 6974 2077 6f75 6c64 2062 6520 6d6f 7265 it would be more │ │ │ +00076a20: 2069 6e74 7569 7469 7665 2074 6f20 6163 intuitive to ac │ │ │ +00076a30: 636f 756e 7420 2277 616e 7465 6422 2070 count "wanted" p │ │ │ +00076a40: 6965 6365 730a 696e 7374 6561 6420 6f66 ieces.instead of │ │ │ +00076a50: 2066 696c 7465 7265 643c 2f68 323e 3c68 filtered

    ../include/lib │ │ │ +00076a70: 746f 7272 656e 742f 7069 6563 655f 7069 torrent/piece_pi │ │ │ +00076a80: 636b 6572 2e68 7070 3a38 3935 3c2f 6834 cker.hpp:895
    ...//
    │ │ │ +00076ad0: 2074 6869 7320 686f 6c64 7320 7468 6520   this holds the 
    │ │ │ +00076ae0: 696e 666f 726d 6174 696f 6e20 6f66 2074  information of t
    │ │ │ +00076af0: 6865 2062 6c6f 636b 7320 696e 2070 6172  he blocks in par
    │ │ │ +00076b00: 7469 616c 6c79 2064 6f77 6e6c 6f61 6465  tially downloade
    │ │ │ +00076b10: 640a 0909 2f2f 2070 6965 6365 732e 2074  d...// pieces. t
    │ │ │ +00076b20: 6865 2064 6f77 6e6c 6f61 6469 6e67 5f70  he downloading_p
    │ │ │ +00076b30: 6965 6365 3a3a 696e 666f 2069 6e64 6578  iece::info index
    │ │ │ +00076b40: 2070 6f69 6e74 2069 6e74 6f20 7468 6973   point into this
    │ │ │ +00076b50: 2076 6563 746f 7220 666f 720a 0909 2f2f   vector for...//
    │ │ │ +00076b60: 2069 7473 2073 746f 7261 6765 0a09 0961   its storage...a
    │ │ │ +00076b70: 7578 3a3a 7665 6374 6f72 266c 743b 626c  ux::vector<bl
    │ │ │ +00076b80: 6f63 6b5f 696e 666f 2667 743b 206d 5f62  ock_info> m_b
    │ │ │ +00076b90: 6c6f 636b 5f69 6e66 6f3b 0a0a 0909 2f2f  lock_info;....//
    │ │ │ +00076ba0: 2074 6865 7365 2061 7265 2062 6c6f 636b   these are block
    │ │ │ +00076bb0: 2072 616e 6765 7320 696e 206d 5f62 6c6f   ranges in m_blo
    │ │ │ +00076bc0: 636b 5f69 6e66 6f20 7468 6174 2061 7265  ck_info that are
    │ │ │ +00076bd0: 2066 7265 652e 2054 6865 206e 756d 6265   free. The numbe
    │ │ │ +00076be0: 7273 0a09 092f 2f20 696e 2068 6572 652c  rs...// in here,
    │ │ │ +00076bf0: 2077 6865 6e20 6d75 6c74 6970 6c69 6564   when multiplied
    │ │ │ +00076c00: 2062 7920 626c 6f63 6b73 5f70 6572 5f70   by blocks_per_p
    │ │ │ +00076c10: 6965 6365 2069 7320 7468 6520 696e 6465  iece is the inde
    │ │ │ +00076c20: 7820 746f 2074 6865 0a09 092f 2f20 6669  x to the...// fi
    │ │ │ +00076c30: 7273 7420 626c 6f63 6b20 696e 2074 6865  rst block in the
    │ │ │ +00076c40: 2072 616e 6765 2074 6861 7427 7320 6672   range that's fr
    │ │ │ +00076c50: 6565 2074 6f20 7573 6520 6279 2061 206e  ee to use by a n
    │ │ │ +00076c60: 6577 2064 6f77 6e6c 6f61 6469 6e67 5f70  ew downloading_p
    │ │ │ +00076c70: 6965 6365 2e0a 0909 2f2f 2074 6869 7320  iece....// this 
    │ │ │ +00076c80: 6973 2061 2066 7265 652d 6c69 7374 2e0a  is a free-list..
    │ │ │ +00076c90: 0909 7374 643a 3a76 6563 746f 7226 6c74  ..std::vector<
    │ │ │ +00076ca0: 3b73 7464 3a3a 7569 6e74 3136 5f74 2667  ;std::uint16_t&g
    │ │ │ +00076cb0: 743b 206d 5f66 7265 655f 626c 6f63 6b5f  t; m_free_block_
    │ │ │ +00076cc0: 696e 666f 733b 0a0a 0909 7374 643a 3a75  infos;....std::u
    │ │ │ +00076cd0: 696e 7431 365f 7420 6d5f 626c 6f63 6b73  int16_t m_blocks
    │ │ │ +00076ce0: 5f69 6e5f 6c61 7374 5f70 6965 6365 203d  _in_last_piece =
    │ │ │ +00076cf0: 2030 3b0a 0909 696e 7420 6d5f 7069 6563   0;...int m_piec
    │ │ │ +00076d00: 655f 7369 7a65 203d 2030 3b0a 0909 7374  e_size = 0;...st
    │ │ │ +00076d10: 643a 3a69 6e74 3634 5f74 206d 5f74 6f74  d::int64_t m_tot
    │ │ │ +00076d20: 616c 5f73 697a 6520 3d20 303b 0a0a 0909  al_size = 0;....
    │ │ │ +00076d30: 2f2f 2074 6865 206e 756d 6265 7220 6f66  // the number of
    │ │ │ +00076d40: 2066 696c 7465 7265 6420 7069 6563 6573   filtered pieces
    │ │ │ +00076d50: 2074 6861 7420 7765 2064 6f6e 2774 2061   that we don't a
    │ │ │ +00076d60: 6c72 6561 6479 0a09 092f 2f20 6861 7665  lready...// have
    │ │ │ +00076d70: 2e20 746f 7461 6c5f 6e75 6d62 6572 5f6f  . total_number_o
    │ │ │ +00076d80: 665f 7069 6563 6573 202d 206e 756d 6265  f_pieces - numbe
    │ │ │ +00076d90: 725f 6f66 5f70 6965 6365 735f 7765 5f68  r_of_pieces_we_h
    │ │ │ +00076da0: 6176 650a 0909 2f2f 202d 206e 756d 5f66  ave...// - num_f
    │ │ │ +00076db0: 696c 7465 7265 6420 6973 2073 7570 706f  iltered is suppo
    │ │ │ +00076dc0: 7365 6420 746f 2074 6865 206e 756d 6265  sed to the numbe
    │ │ │ +00076dd0: 7220 6f66 2070 6965 6365 730a 0909 2f2f  r of pieces...//
    │ │ │ +00076de0: 2077 6520 7374 696c 6c20 7761 6e74 2074   we still want t
    │ │ │ +00076df0: 6f20 646f 776e 6c6f 6164 0a3c 6469 7620  o download.
    ..int m │ │ │ +00076e30: 5f6e 756d 5f66 696c 7465 7265 6420 3d20 _num_filtered = │ │ │ +00076e40: 303b 0a3c 2f64 6976 3e0a 0909 2f2f 2074 0;.
    ...// t │ │ │ +00076e50: 6865 206e 756d 6265 7220 6f66 2070 6965 he number of pie │ │ │ +00076e60: 6365 7320 7765 2068 6176 6520 7468 6174 ces we have that │ │ │ +00076e70: 2061 6c73 6f20 6172 6520 6669 6c74 6572 also are filter │ │ │ +00076e80: 6564 0a09 0969 6e74 206d 5f6e 756d 5f68 ed...int m_num_h │ │ │ +00076e90: 6176 655f 6669 6c74 6572 6564 203d 2030 ave_filtered = 0 │ │ │ +00076ea0: 3b0a 0a09 092f 2f20 7765 2068 6176 6520 ;....// we have │ │ │ +00076eb0: 616c 6c20 7069 6563 6573 2069 6e20 7468 all pieces in th │ │ │ +00076ec0: 6520 7261 6e67 6520 5b30 2c20 6d5f 6375 e range [0, m_cu │ │ │ +00076ed0: 7273 6f72 290a 0909 2f2f 206d 5f63 7572 rsor)...// m_cur │ │ │ +00076ee0: 736f 7220 6973 2074 6865 2066 6972 7374 sor is the first │ │ │ +00076ef0: 2070 6965 6365 2077 6520 646f 6e27 7420 piece we don't │ │ │ +00076f00: 6861 7665 0a09 0970 6965 6365 5f69 6e64 have...piece_ind │ │ │ +00076f10: 6578 5f74 206d 5f63 7572 736f 727b 307d ex_t m_cursor{0} │ │ │ +00076f20: 3b0a 0a09 092f 2f20 7765 2068 6176 6520 ;....// we have │ │ │ +00076f30: 616c 6c20 7069 6563 6573 2069 6e20 7468 all pieces in th │ │ │ +00076f40: 6520 7261 6e67 6520 5b6d 5f72 6576 6572 e range [m_rever │ │ │ +00076f50: 7365 5f63 7572 736f 722c 2065 6e64 290a se_cursor, end). │ │ │ +00076f60: 0909 2f2f 206d 5f72 6576 6572 7365 5f63 ..// m_reverse_c │ │ │ +00076f70: 7572 736f 7220 6973 2074 6865 2066 6972 ursor is the fir │ │ │ +00076f80: 7374 2070 6965 6365 2077 6865 7265 2077 st piece where w │ │ │ +00076f90: 6520 616c 736f 2068 6176 650a 0909 2f2f e also have...// │ │ │ +00076fa0: 2061 6c6c 2074 6865 2073 7562 7365 7175 all the subsequ │ │ │ +00076fb0: 656e 7420 7069 6563 6573 0a09 0970 6965 ent pieces...pie │ │ │ +00076fc0: 6365 5f69 6e64 6578 5f74 206d 5f72 6576 ce_index_t m_rev │ │ │ +00076fd0: 6572 7365 5f63 7572 736f 727b 307d 3b0a erse_cursor{0};. │ │ │ +00076fe0: 0a09 092f 2f20 7468 6520 6e75 6d62 6572 ...// the number │ │ │ +00076ff0: 206f 6620 7069 6563 6573 2077 6520 6861 of pieces we ha │ │ │ +00077000: 7665 2028 692e 652e 2070 6173 7365 6420 ve (i.e. passed │ │ │ +00077010: 6861 7368 2063 6865 636b 292e 0a09 092f hash check)..../ │ │ │ +00077020: 2f20 5468 6973 2069 6e63 6c75 6465 7320 / This includes │ │ │ +00077030: 7069 6563 6573 2074 6861 7420 7765 2068 pieces that we h │ │ │ +00077040: 6176 6520 6669 6c74 6572 6564 2062 7574 ave filtered but │ │ │ +00077050: 2073 7469 6c6c 2068 6176 650a 0909 696e still have...in │ │ │ +00077060: 7420 6d5f 6e75 6d5f 6861 7665 203d 2030 t m_num_have = 0 │ │ │ +00077070: 3b0a 0a09 092f 2f20 6966 2074 6869 7320 ;....// if this │ │ │ +00077080: 6973 2073 6574 2074 6f20 7472 7565 2c20 is set to true, │ │ │ +00077090: 6974 206d 6561 6e73 2075 7064 6174 655f it means update_ │ │ │ +000770a0: 7069 6563 6573 2829 0a09 092f 2f20 6861 pieces()...// ha │ │ │ +000770b0: 7320 746f 2062 6520 6361 6c6c 6564 2062 s to be called b │ │ │ +000770c0: 6566 6f72 6520 6163 6365 7373 696e 6720 efore accessing │ │ │ +000770d0: 6d5f 7069 6563 6573 2e0a 0909 6d75 7461 m_pieces....muta │ │ │ +000770e0: 626c 6520 626f 6f6c 206d 5f64 6972 7479 ble bool m_dirty │ │ │ +000770f0: 203d 2066 616c 7365 3b0a 0970 7562 6c69 = false;..publi │ │ │ +00077100: 633a 0a0a 0909 656e 756d 207b 206d 6178 c:....enum { max │ │ │ +00077110: 5f70 6965 6365 7320 3d20 2873 7464 3a3a _pieces = (std:: │ │ │ +00077120: 6e75 6d65 7269 635f 6c69 6d69 7473 266c numeric_limits&l │ │ │ +00077130: 743b 696e 7426 6774 3b3a 3a6d 6178 2928 t;int>::max)( │ │ │ +00077140: 2920 2d20 3120 7d3b 0a0a 097d 3b0a 7d0a ) - 1 };...};.}. │ │ │ +00077150: 0a23 656e 6469 6620 2f2f 2054 4f52 5245 .#endif // TORRE │ │ │ +00077160: 4e54 5f50 4945 4345 5f50 4943 4b45 525f NT_PIECE_PICKER_ │ │ │ +00077170: 4850 505f 494e 434c 5544 4544 0a3c 2f70 HPP_INCLUDED.

    re │ │ │ +000771b0: 6c65 7661 6e63 6526 6e62 7370 3b30 3c2f levance 0../inclu │ │ │ +000771f0: 6465 2f6c 6962 746f 7272 656e 742f 736f de/libtorrent/so │ │ │ +00077200: 636b 6574 5f74 7970 652e 6870 703a 3630 cket_type.hpp:60 │ │ │ +00077210: 3c2f 613e 3c2f 7464 3e3c 7464 3e6d 6f76 mov │ │ │ +00077220: 6520 746f 2061 7578 3c2f 7464 3e3c 2f74 e to aux

    move to au │ │ │ +00077280: 783c 2f68 323e 3c68 343e 2e2e 2f69 6e63 x

    ../inc │ │ │ +00077290: 6c75 6465 2f6c 6962 746f 7272 656e 742f lude/libtorrent/ │ │ │ +000772a0: 736f 636b 6574 5f74 7970 652e 6870 703a socket_type.hpp: │ │ │ +000772b0: 3630 3c2f 6834 3e3c 7072 6520 7374 796c 60

    namespace libto
    │ │ │ +00077300: 7272 656e 7420 7b0a 0a2f 2f20 4120 7479  rrent {..// A ty
    │ │ │ +00077310: 7065 2064 6573 6372 6962 696e 6720 6b69  pe describing ki
    │ │ │ +00077320: 6e64 7320 6f66 2073 6f63 6b65 7473 2069  nds of sockets i
    │ │ │ +00077330: 6e76 6f6c 7665 6420 696e 2076 6172 696f  nvolved in vario
    │ │ │ +00077340: 7573 206f 7065 7261 7469 6f6e 7320 6f72  us operations or
    │ │ │ +00077350: 2065 7665 6e74 732e 0a65 6e75 6d20 636c   events..enum cl
    │ │ │ +00077360: 6173 7320 736f 636b 6574 5f74 7970 655f  ass socket_type_
    │ │ │ +00077370: 7420 3a20 7374 643a 3a75 696e 7438 5f74  t : std::uint8_t
    │ │ │ +00077380: 207b 0a09 7463 702c 0a09 736f 636b 7335   {..tcp,..socks5
    │ │ │ +00077390: 2c0a 0968 7474 702c 0a09 7574 702c 0a09  ,..http,..utp,..
    │ │ │ +000773a0: 6932 702c 0a09 7463 705f 7373 6c2c 0a09  i2p,..tcp_ssl,..
    │ │ │ +000773b0: 736f 636b 7335 5f73 736c 2c0a 0968 7474  socks5_ssl,..htt
    │ │ │ +000773c0: 705f 7373 6c2c 0a09 7574 705f 7373 6c2c  p_ssl,..utp_ssl,
    │ │ │ +000773d0: 0a0a 2369 6620 544f 5252 454e 545f 4142  ..#if TORRENT_AB
    │ │ │ +000773e0: 495f 5645 5253 494f 4e20 266c 743b 3d20  I_VERSION <= 
    │ │ │ +000773f0: 320a 0975 6470 2054 4f52 5245 4e54 5f44  2..udp TORRENT_D
    │ │ │ +00077400: 4550 5245 4341 5445 445f 454e 554d 203d  EPRECATED_ENUM =
    │ │ │ +00077410: 2075 7470 2c0a 2365 6e64 6966 0a7d 3b0a   utp,.#endif.};.
    │ │ │ +00077420: 0a2f 2f20 7265 7475 726e 2061 2073 686f  .// return a sho
    │ │ │ +00077430: 7274 2068 756d 616e 2072 6561 6461 626c  rt human readabl
    │ │ │ +00077440: 6520 6e61 6d65 2066 6f72 2074 7970 6573  e name for types
    │ │ │ +00077450: 206f 6620 736f 636b 6574 0a3c 6469 7620   of socket.
    char co │ │ │ +00077490: 6e73 742a 2073 6f63 6b65 745f 7479 7065 nst* socket_type │ │ │ +000774a0: 5f6e 616d 6528 736f 636b 6574 5f74 7970 _name(socket_typ │ │ │ +000774b0: 655f 7429 3b0a 3c2f 6469 763e 0a7d 0a0a e_t);.
    .}.. │ │ │ +000774c0: 2365 6e64 6966 0a3c 2f70 7265 3e3c 2f74 #endif.
    relevanc │ │ │ +00077500: 6526 6e62 7370 3b30 3c2f 7464 3e3c 7464 e 0../include/lib │ │ │ +00077540: 746f 7272 656e 742f 6964 656e 7469 6679 torrent/identify │ │ │ +00077550: 5f63 6c69 656e 742e 6870 703a 3438 3c2f _client.hpp:48hide │ │ │ +00077570: 7468 6973 2064 6563 6c61 7261 7469 6f6e this declaration │ │ │ +00077580: 2077 6865 6e20 6465 7072 6563 6174 6564 when deprecated │ │ │ +00077590: 2066 756e 6374 696f 6e73 2061 7265 2064 functions are d │ │ │ +000775a0: 6973 6162 6c65 642c 2061 6e64 2072 656d isabled, and rem │ │ │ +000775b0: 6f76 6520 6974 7320 696e 7465 726e 616c ove its internal │ │ │ +000775c0: 2075 7365 3c2f 7464 3e3c 2f74 723e 3c74 usehide this decl │ │ │ +00077620: 6172 6174 696f 6e20 7768 656e 2064 6570 aration when dep │ │ │ +00077630: 7265 6361 7465 6420 6675 6e63 7469 6f6e recated function │ │ │ +00077640: 7320 6172 6520 6469 7361 626c 6564 2c20 s are disabled, │ │ │ +00077650: 616e 640a 7265 6d6f 7665 2069 7473 2069 and.remove its i │ │ │ +00077660: 6e74 6572 6e61 6c20 7573 653c 2f68 323e nternal use │ │ │ +00077670: 3c68 343e 2e2e 2f69 6e63 6c75 6465 2f6c

    ../include/l │ │ │ +00077680: 6962 746f 7272 656e 742f 6964 656e 7469 ibtorrent/identi │ │ │ +00077690: 6679 5f63 6c69 656e 742e 6870 703a 3438 fy_client.hpp:48 │ │ │ +000776a0: 3c2f 6834 3e3c 7072 6520 7374 796c 653d

    C
    │ │ │ +000776e0: 4f4e 5452 4143 542c 2053 5452 4943 5420  ONTRACT, STRICT 
    │ │ │ +000776f0: 4c49 4142 494c 4954 592c 204f 5220 544f  LIABILITY, OR TO
    │ │ │ +00077700: 5254 2028 494e 434c 5544 494e 4720 4e45  RT (INCLUDING NE
    │ │ │ +00077710: 474c 4947 454e 4345 204f 5220 4f54 4845  GLIGENCE OR OTHE
    │ │ │ +00077720: 5257 4953 4529 0a41 5249 5349 4e47 2049  RWISE).ARISING I
    │ │ │ +00077730: 4e20 414e 5920 5741 5920 4f55 5420 4f46  N ANY WAY OUT OF
    │ │ │ +00077740: 2054 4845 2055 5345 204f 4620 5448 4953   THE USE OF THIS
    │ │ │ +00077750: 2053 4f46 5457 4152 452c 2045 5645 4e20   SOFTWARE, EVEN 
    │ │ │ +00077760: 4946 2041 4456 4953 4544 204f 4620 5448  IF ADVISED OF TH
    │ │ │ +00077770: 450a 504f 5353 4942 494c 4954 5920 4f46  E.POSSIBILITY OF
    │ │ │ +00077780: 2053 5543 4820 4441 4d41 4745 2e0a 0a2a   SUCH DAMAGE...*
    │ │ │ +00077790: 2f0a 0a23 6966 6e64 6566 2054 4f52 5245  /..#ifndef TORRE
    │ │ │ +000777a0: 4e54 5f49 4445 4e54 4946 595f 434c 4945  NT_IDENTIFY_CLIE
    │ │ │ +000777b0: 4e54 5f48 5050 5f49 4e43 4c55 4445 440a  NT_HPP_INCLUDED.
    │ │ │ +000777c0: 2364 6566 696e 6520 544f 5252 454e 545f  #define TORRENT_
    │ │ │ +000777d0: 4944 454e 5449 4659 5f43 4c49 454e 545f  IDENTIFY_CLIENT_
    │ │ │ +000777e0: 4850 505f 494e 434c 5544 4544 0a0a 2369  HPP_INCLUDED..#i
    │ │ │ +000777f0: 6e63 6c75 6465 2022 6c69 6274 6f72 7265  nclude "libtorre
    │ │ │ +00077800: 6e74 2f63 6f6e 6669 672e 6870 7022 0a0a  nt/config.hpp"..
    │ │ │ +00077810: 2369 6620 544f 5252 454e 545f 4142 495f  #if TORRENT_ABI_
    │ │ │ +00077820: 5645 5253 494f 4e20 3d3d 2031 0a23 696e  VERSION == 1.#in
    │ │ │ +00077830: 636c 7564 6520 226c 6962 746f 7272 656e  clude "libtorren
    │ │ │ +00077840: 742f 6175 785f 2f64 6973 6162 6c65 5f77  t/aux_/disable_w
    │ │ │ +00077850: 6172 6e69 6e67 735f 7075 7368 2e68 7070  arnings_push.hpp
    │ │ │ +00077860: 220a 2369 6e63 6c75 6465 2026 6c74 3b62  ".#include <b
    │ │ │ +00077870: 6f6f 7374 2f6f 7074 696f 6e61 6c2e 6870  oost/optional.hp
    │ │ │ +00077880: 7026 6774 3b0a 2369 6e63 6c75 6465 2022  p>.#include "
    │ │ │ +00077890: 6c69 6274 6f72 7265 6e74 2f61 7578 5f2f  libtorrent/aux_/
    │ │ │ +000778a0: 6469 7361 626c 655f 7761 726e 696e 6773  disable_warnings
    │ │ │ +000778b0: 5f70 6f70 2e68 7070 220a 2365 6e64 6966  _pop.hpp".#endif
    │ │ │ +000778c0: 0a0a 2369 6e63 6c75 6465 2022 6c69 6274  ..#include "libt
    │ │ │ +000778d0: 6f72 7265 6e74 2f70 6565 725f 6964 2e68  orrent/peer_id.h
    │ │ │ +000778e0: 7070 220a 2369 6e63 6c75 6465 2022 6c69  pp".#include "li
    │ │ │ +000778f0: 6274 6f72 7265 6e74 2f66 696e 6765 7270  btorrent/fingerp
    │ │ │ +00077900: 7269 6e74 2e68 7070 220a 0a3c 6469 7620  rint.hpp"..
    namespa │ │ │ +00077940: 6365 206c 6962 746f 7272 656e 7420 7b0a ce libtorrent {. │ │ │ +00077950: 3c2f 6469 763e 0a6e 616d 6573 7061 6365
    .namespace │ │ │ +00077960: 2061 7578 207b 0a0a 0954 4f52 5245 4e54 aux {...TORRENT │ │ │ +00077970: 5f45 5854 5241 5f45 5850 4f52 540a 0973 _EXTRA_EXPORT..s │ │ │ +00077980: 7464 3a3a 7374 7269 6e67 2069 6465 6e74 td::string ident │ │ │ +00077990: 6966 795f 636c 6965 6e74 5f69 6d70 6c28 ify_client_impl( │ │ │ +000779a0: 636f 6e73 7420 7065 6572 5f69 6426 616d const peer_id&am │ │ │ +000779b0: 703b 2070 293b 0a0a 7d0a 0a09 2f2f 2074 p; p);..}...// t │ │ │ +000779c0: 6865 7365 2066 756e 6374 696f 6e73 2064 hese functions d │ │ │ +000779d0: 6f6e 2774 2072 6561 6c6c 7920 6e65 6564 on't really need │ │ │ +000779e0: 2074 6f20 6265 2070 7562 6c69 632e 2054 to be public. T │ │ │ +000779f0: 6869 7320 6d65 6368 616e 6973 6d20 6f66 his mechanism of │ │ │ +00077a00: 0a09 2f2f 2061 6476 6572 7469 7369 6e67 ..// advertising │ │ │ +00077a10: 2063 6c69 656e 7420 736f 6674 7761 7265 client software │ │ │ +00077a20: 2061 6e64 2076 6572 7369 6f6e 2069 7320 and version is │ │ │ +00077a30: 616c 736f 206f 7574 2d64 6174 6564 2e0a also out-dated.. │ │ │ +00077a40: 0a09 2f2f 2054 6869 7320 6675 6e63 7469 ..// This functi │ │ │ +00077a50: 6f6e 2063 616e 2063 616e 2062 6520 7573 on can can be us │ │ │ +00077a60: 6564 2074 6f20 6578 7472 6163 7420 6120 ed to extract a │ │ │ +00077a70: 7374 7269 6e67 2064 6573 6372 6962 696e string describin │ │ │ +00077a80: 6720 6120 636c 6965 6e74 0a09 2f2f 2076 g a client..// v │ │ │ +00077a90: 6572 7369 6f6e 2066 726f 6d20 6974 7320 ersion from its │ │ │ +00077aa0: 7065 6572 2d69 642e 2049 7420 7769 6c6c peer-id. It will │ │ │ +00077ab0: 2072 6563 6f67 6e69 7a65 206d 6f73 7420 recognize most │ │ │ +00077ac0: 636c 6965 6e74 7320 7468 6174 2068 6176 clients that hav │ │ │ +00077ad0: 6520 7468 6973 0a09 2f2f 206b 696e 6420 e this..// kind │ │ │ +00077ae0: 6f66 2069 6465 6e74 6966 6963 6174 696f of identificatio │ │ │ +00077af0: 6e20 696e 2074 6865 2070 6565 722d 6964 n in the peer-id │ │ │ +00077b00: 2e0a 0954 4f52 5245 4e54 5f44 4550 5245 ...TORRENT_DEPRE │ │ │ +00077b10: 4341 5445 445f 4558 504f 5254 0a09 7374 CATED_EXPORT..st │ │ │ +00077b20: 643a 3a73 7472 696e 6720 6964 656e 7469 d::string identi │ │ │ +00077b30: 6679 5f63 6c69 656e 7428 636f 6e73 7420 fy_client(const │ │ │ +00077b40: 7065 6572 5f69 6426 616d 703b 2070 293b peer_id& p); │ │ │ +00077b50: 0a0a 2369 6620 544f 5252 454e 545f 4142 ..#if TORRENT_AB │ │ │ +00077b60: 495f 5645 5253 494f 4e20 3d3d 2031 0a0a I_VERSION == 1.. │ │ │ +00077b70: 2369 6e63 6c75 6465 2022 6c69 6274 6f72 #include "libtor │ │ │ +00077b80: 7265 6e74 2f61 7578 5f2f 6469 7361 626c rent/aux_/disabl │ │ │ +00077b90: 655f 6465 7072 6563 6174 696f 6e5f 7761 e_deprecation_wa │ │ │ +00077ba0: 726e 696e 6773 5f70 7573 682e 6870 7022 rnings_push.hpp" │ │ │ +00077bb0: 0a0a 092f 2f20 5265 7475 726e 7320 616e ...// Returns an │ │ │ +00077bc0: 206f 7074 696f 6e61 6c20 6669 6e67 6572 optional finger │ │ │ +00077bd0: 7072 696e 7420 6966 2061 6e79 2063 616e print if any can │ │ │ +00077be0: 2062 6520 6964 656e 7469 6669 6564 2066 be identified f │ │ │ +00077bf0: 726f 6d20 7468 6520 7065 6572 0a09 2f2f rom the peer..// │ │ │ +00077c00: 2069 642e 2054 6869 7320 6361 6e20 6265 id. This can be │ │ │ +00077c10: 2075 7365 6420 746f 2061 7574 6f6d 6174 used to automat │ │ │ +00077c20: 6520 7468 6520 6964 656e 7469 6669 6361 e the identifica │ │ │ +00077c30: 7469 6f6e 206f 6620 636c 6965 6e74 732e tion of clients. │ │ │ +00077c40: 2049 7420 7769 6c6c 0a09 2f2f 206e 6f74 It will..// not │ │ │ +00077c50: 2062 6520 6162 6c65 2074 6f20 6964 656e be able to iden │ │ │ +00077c60: 7469 6679 2070 6565 7273 2077 6974 6820 tify peers with │ │ │ +00077c70: 6e6f 6e2d 2073 7461 6e64 6172 6420 656e non- standard en │ │ │ +00077c80: 636f 6469 6e67 732e 204f 6e6c 7920 417a codings. Only Az │ │ │ +00077c90: 7572 6575 730a 092f 2f20 7374 796c 652c ureus..// style, │ │ │ +00077ca0: 2053 6861 646f 7727 7320 7374 796c 6520 Shadow's style │ │ │ +00077cb0: 616e 6420 4d61 696e 6c69 6e65 2073 7479 and Mainline sty │ │ │ +00077cc0: 6c65 2e0a 0954 4f52 5245 4e54 5f44 4550 le...TORRENT_DEP │ │ │ +00077cd0: 5245 4341 5445 445f 4558 504f 5254 0a09 RECATED_EXPORT.. │ │ │ +00077ce0: 626f 6f73 743a 3a6f 7074 696f 6e61 6c26 boost::optional& │ │ │ +00077cf0: 6c74 3b66 696e 6765 7270 7269 6e74 2667 lt;fingerprint&g │ │ │ +00077d00: 743b 0a09 0963 6c69 656e 745f 6669 6e67 t;...client_fing │ │ │ +00077d10: 6572 7072 696e 7428 7065 6572 5f69 6420 erprint(peer_id │ │ │ +00077d20: 636f 6e73 7426 616d 703b 2070 293b 0a0a const& p);.. │ │ │ +00077d30: 2369 6e63 6c75 6465 2022 6c69 6274 6f72 #include "libtor │ │ │ +00077d40: 7265 6e74 2f61 7578 5f2f 6469 7361 626c rent/aux_/disabl │ │ │ +00077d50: 655f 7761 726e 696e 6773 5f70 6f70 2e68 e_warnings_pop.h │ │ │ +00077d60: 7070 220a 3c2f 7072 653e 3c2f 7464 3e3c pp".
    < │ │ │ +00077d70: 2f74 723e 3c74 7220 7374 796c 653d 2262 /tr>relevance&n │ │ │ +00077da0: 6273 703b 303c 2f74 643e 3c74 643e 3c61 bsp;0
    . │ │ │ +00077dd0: 2e2f 696e 636c 7564 652f 6c69 6274 6f72 ./include/libtor │ │ │ +00077de0: 7265 6e74 2f68 6173 685f 7069 636b 6572 rent/hash_picker │ │ │ +00077df0: 2e68 7070 3a31 3535 3c2f 613e 3c2f 7464 .hpp:155support bat │ │ │ +00077e10: 6368 6564 2061 6464 696e 6720 6f66 2062 ched adding of b │ │ │ +00077e20: 6c6f 636b 2068 6173 6865 7320 666f 7220 lock hashes for │ │ │ +00077e30: 7265 6475 6365 6420 6f76 6572 6865 6164 reduced overhead │ │ │ +00077e40: 3f3c 2f74 643e 3c2f 7472 3e3c 7472 2069 ?

    s │ │ │ +00077e90: 7570 706f 7274 2062 6174 6368 6564 2061 upport batched a │ │ │ +00077ea0: 6464 696e 6720 6f66 2062 6c6f 636b 2068 dding of block h │ │ │ +00077eb0: 6173 6865 7320 666f 7220 7265 6475 6365 ashes for reduce │ │ │ +00077ec0: 6420 6f76 6572 6865 6164 3f3c 2f68 323e d overhead?

    │ │ │ +00077ed0: 3c68 343e 2e2e 2f69 6e63 6c75 6465 2f6c

    ../include/l │ │ │ +00077ee0: 6962 746f 7272 656e 742f 6861 7368 5f70 ibtorrent/hash_p │ │ │ +00077ef0: 6963 6b65 722e 6870 703a 3135 353c 2f68 icker.hpp:155
    ..//
    │ │ │ +00077f40: 2074 6865 206e 756d 6265 7220 6f66 2068   the number of h
    │ │ │ +00077f50: 6173 6865 7320 696e 2074 6865 2072 616e  ashes in the ran
    │ │ │ +00077f60: 6765 0a09 0969 6e74 2063 6f75 6e74 203d  ge...int count =
    │ │ │ +00077f70: 2030 3b0a 0909 696e 7420 7072 6f6f 665f   0;...int proof_
    │ │ │ +00077f80: 6c61 7965 7273 203d 2030 3b0a 097d 3b0a  layers = 0;..};.
    │ │ │ +00077f90: 0a09 2f2f 2076 616c 6964 6174 6573 2074  ..// validates t
    │ │ │ +00077fa0: 6865 2068 6173 685f 7265 7175 6573 742c  he hash_request,
    │ │ │ +00077fb0: 2074 6f20 656e 7375 7265 2069 7473 2069   to ensure its i
    │ │ │ +00077fc0: 6e76 6172 6961 6e74 2061 7320 7765 6c6c  nvariant as well
    │ │ │ +00077fd0: 2061 7320 6d61 7463 6869 6e67 0a09 2f2f   as matching..//
    │ │ │ +00077fe0: 2074 6865 2074 6f72 7265 6e74 2773 2066   the torrent's f
    │ │ │ +00077ff0: 696c 655f 7374 6f72 6167 6520 616e 6420  ile_storage and 
    │ │ │ +00078000: 7468 6520 6e75 6d62 6572 206f 6620 6861  the number of ha
    │ │ │ +00078010: 7368 6573 2061 6363 6f6d 7061 6e79 696e  shes accompanyin
    │ │ │ +00078020: 6720 7468 650a 092f 2f20 7265 7175 6573  g the..// reques
    │ │ │ +00078030: 740a 0954 4f52 5245 4e54 5f45 5854 5241  t..TORRENT_EXTRA
    │ │ │ +00078040: 5f45 5850 4f52 540a 0962 6f6f 6c20 7661  _EXPORT..bool va
    │ │ │ +00078050: 6c69 6461 7465 5f68 6173 685f 7265 7175  lidate_hash_requ
    │ │ │ +00078060: 6573 7428 6861 7368 5f72 6571 7565 7374  est(hash_request
    │ │ │ +00078070: 2063 6f6e 7374 2661 6d70 3b20 6872 2c20   const& hr, 
    │ │ │ +00078080: 6669 6c65 5f73 746f 7261 6765 2063 6f6e  file_storage con
    │ │ │ +00078090: 7374 2661 6d70 3b20 6673 293b 0a0a 0963  st& fs);...c
    │ │ │ +000780a0: 6c61 7373 2054 4f52 5245 4e54 5f45 5854  lass TORRENT_EXT
    │ │ │ +000780b0: 5241 5f45 5850 4f52 5420 6861 7368 5f70  RA_EXPORT hash_p
    │ │ │ +000780c0: 6963 6b65 720a 097b 0a09 7075 626c 6963  icker..{..public
    │ │ │ +000780d0: 3a0a 0909 6861 7368 5f70 6963 6b65 7228  :...hash_picker(
    │ │ │ +000780e0: 6669 6c65 5f73 746f 7261 6765 2063 6f6e  file_storage con
    │ │ │ +000780f0: 7374 2661 6d70 3b20 6669 6c65 730a 0909  st& files...
    │ │ │ +00078100: 092c 2061 7578 3a3a 7665 6374 6f72 266c  ., aux::vector&l
    │ │ │ +00078110: 743b 6175 783a 3a6d 6572 6b6c 655f 7472  t;aux::merkle_tr
    │ │ │ +00078120: 6565 2c20 6669 6c65 5f69 6e64 6578 5f74  ee, file_index_t
    │ │ │ +00078130: 2667 743b 2661 6d70 3b20 7472 6565 7329  >& trees)
    │ │ │ +00078140: 3b0a 0a09 0968 6173 685f 7265 7175 6573  ;....hash_reques
    │ │ │ +00078150: 7420 7069 636b 5f68 6173 6865 7328 7479  t pick_hashes(ty
    │ │ │ +00078160: 7065 645f 6269 7466 6965 6c64 266c 743b  ped_bitfield<
    │ │ │ +00078170: 7069 6563 655f 696e 6465 785f 7426 6774  piece_index_t>
    │ │ │ +00078180: 3b20 636f 6e73 7426 616d 703b 2070 6965  ; const& pie
    │ │ │ +00078190: 6365 7329 3b0a 0a09 0961 6464 5f68 6173  ces);....add_has
    │ │ │ +000781a0: 6865 735f 7265 7375 6c74 2061 6464 5f68  hes_result add_h
    │ │ │ +000781b0: 6173 6865 7328 6861 7368 5f72 6571 7565  ashes(hash_reque
    │ │ │ +000781c0: 7374 2063 6f6e 7374 2661 6d70 3b20 7265  st const& re
    │ │ │ +000781d0: 712c 2073 7061 6e26 6c74 3b73 6861 3235  q, span<sha25
    │ │ │ +000781e0: 365f 6861 7368 2063 6f6e 7374 2667 743b  6_hash const>
    │ │ │ +000781f0: 2068 6173 6865 7329 3b0a 3c64 6976 2073   hashes);.
    ..set_bl │ │ │ +00078230: 6f63 6b5f 6861 7368 5f72 6573 756c 7420 ock_hash_result │ │ │ +00078240: 7365 745f 626c 6f63 6b5f 6861 7368 2870 set_block_hash(p │ │ │ +00078250: 6965 6365 5f69 6e64 6578 5f74 2070 6965 iece_index_t pie │ │ │ +00078260: 6365 2c20 696e 7420 6f66 6673 6574 2c20 ce, int offset, │ │ │ +00078270: 7368 6132 3536 5f68 6173 6820 636f 6e73 sha256_hash cons │ │ │ +00078280: 7426 616d 703b 2068 293b 0a3c 2f64 6976 t& h);.
    ..void hashes_r │ │ │ +000782a0: 656a 6563 7465 6428 6861 7368 5f72 6571 ejected(hash_req │ │ │ +000782b0: 7565 7374 2063 6f6e 7374 2661 6d70 3b20 uest const& │ │ │ +000782c0: 7265 7129 3b0a 0909 766f 6964 2076 6572 req);...void ver │ │ │ +000782d0: 6966 795f 626c 6f63 6b5f 6861 7368 6573 ify_block_hashes │ │ │ +000782e0: 2870 6965 6365 5f69 6e64 6578 5f74 2069 (piece_index_t i │ │ │ +000782f0: 6e64 6578 293b 0a0a 0909 2f2f 2064 6f20 ndex);....// do │ │ │ +00078300: 7765 206b 6e6f 7720 7468 6520 7069 6563 we know the piec │ │ │ +00078310: 6520 6c61 7965 7220 6861 7368 2066 6f72 e layer hash for │ │ │ +00078320: 2061 2070 6965 6365 0a09 0962 6f6f 6c20 a piece...bool │ │ │ +00078330: 6861 7665 5f68 6173 6828 7069 6563 655f have_hash(piece_ │ │ │ +00078340: 696e 6465 785f 7420 696e 6465 7829 2063 index_t index) c │ │ │ +00078350: 6f6e 7374 3b0a 0909 2f2f 2064 6f20 7765 onst;...// do we │ │ │ +00078360: 206b 6e6f 7720 616c 6c20 7468 6520 626c know all the bl │ │ │ +00078370: 6f63 6b20 6861 7368 6573 2066 6f72 2061 ock hashes for a │ │ │ +00078380: 2066 696c 653f 0a09 0962 6f6f 6c20 6861 file?...bool ha │ │ │ +00078390: 7665 5f61 6c6c 2866 696c 655f 696e 6465 ve_all(file_inde │ │ │ +000783a0: 785f 7420 6669 6c65 2920 636f 6e73 743b x_t file) const; │ │ │ +000783b0: 0a09 0962 6f6f 6c20 6861 7665 5f61 6c6c ...bool have_all │ │ │ +000783c0: 2829 2063 6f6e 7374 3b0a 0909 626f 6f6c () const;...bool │ │ │ +000783d0: 2070 6965 6365 5f76 6572 6966 6965 6428 piece_verified( │ │ │ +000783e0: 7069 6563 655f 696e 6465 785f 7420 7069 piece_index_t pi │ │ │ +000783f0: 6563 6529 2063 6f6e 7374 3b0a 0a09 0969 ece) const;....i │ │ │ +00078400: 6e74 2070 6965 6365 5f6c 6179 6572 2829 nt piece_layer() │ │ │ +00078410: 2063 6f6e 7374 207b 2072 6574 7572 6e20 const { return │ │ │ +00078420: 6d5f 7069 6563 655f 6c61 7965 723b 207d m_piece_layer; } │ │ │ +00078430: 0a0a 0970 7269 7661 7465 3a0a 0909 2f2f ...private:...// │ │ │ +00078440: 2072 6574 7572 6e73 2074 6865 206e 756d returns the num │ │ │ +00078450: 6265 7220 6f66 2070 726f 6f66 206c 6179 ber of proof lay │ │ │ +00078460: 6572 7320 6e65 6564 6564 2074 6f20 7665 ers needed to ve │ │ │ +00078470: 7269 6679 2074 6865 206e 6f64 6527 7320 rify the node's │ │ │ +00078480: 6861 7368 0a09 0969 6e74 206c 6179 6572 hash...int layer │ │ │ +00078490: 735f 746f 5f76 6572 6966 7928 6e6f 6465 s_to_verify(node │ │ │ +000784a0: 5f69 6e64 6578 2069 6478 2920 636f 6e73 _index idx) cons │ │ │ +000784b0: 743b 0a09 0969 6e74 2066 696c 655f 6e75 t;...int file_nu │ │ │ +000784c0: 6d5f 6c61 7965 7273 2866 696c 655f 696e m_layers(file_in │ │ │ +000784d0: 6465 785f 7420 6964 7829 2063 6f6e 7374 dex_t idx) const │ │ │ +000784e0: 3b0a 0a09 0973 7472 7563 7420 7069 6563 ;....struct piec │ │ │ +000784f0: 655f 6861 7368 5f72 6571 7565 7374 0a09 e_hash_request.. │ │ │ +00078500: 097b 0a09 0909 7469 6d65 5f70 6f69 6e74 .{....time_point │ │ │ +00078510: 206c 6173 745f 7265 7175 6573 7420 3d20 last_request = │ │ │ +00078520: 6d69 6e5f 7469 6d65 2829 3b0a 0909 0969 min_time();....i │ │ │ +00078530: 6e74 206e 756d 5f72 6571 7565 7374 7320 nt num_requests │ │ │ +00078540: 3d20 303b 0a09 0909 626f 6f6c 2068 6176 = 0;....bool hav │ │ │ +00078550: 6520 3d20 6661 6c73 653b 0a09 097d 3b0a e = false;...};. │ │ │ +00078560: 0a09 0973 7472 7563 7420 7072 696f 7269 ...struct priori │ │ │ +00078570: 7479 5f62 6c6f 636b 5f72 6571 7565 7374 ty_block_request │ │ │ +00078580: 0a09 097b 0a09 0909 7072 696f 7269 7479 ...{....priority │ │ │ +00078590: 5f62 6c6f 636b 5f72 6571 7565 7374 2866 _block_request(f │ │ │ +000785a0: 696c 655f 696e 6465 785f 7420 636f 6e73 ile_index_t cons │ │ │ +000785b0: 7420 662c 2069 6e74 2063 6f6e 7374 2062 t f, int const b │ │ │ +000785c0: 290a 0909 0909 3a20 6669 6c65 2866 292c ).....: file(f), │ │ │ +000785d0: 2062 6c6f 636b 2862 2920 7b7d 0a09 0909 block(b) {}.... │ │ │ +000785e0: 6669 6c65 5f69 6e64 6578 5f74 2066 696c file_index_t fil │ │ │ +000785f0: 653b 0a09 0909 696e 7420 626c 6f63 6b3b e;....int block; │ │ │ 00078600: 0a3c 2f70 7265 3e3c 2f74 643e 3c2f 7472 .
    relevance  │ │ │ 00078640: 3b30 3c2f 7464 3e3c 7464 3e3c 6120 6872 ;0../i │ │ │ @@ -31056,1557 +31056,1557 @@ │ │ │ 000794f0: 2f74 723e 3c74 7220 7374 796c 653d 2262 /tr>relevance&n │ │ │ 00079520: 6273 703b 303c 2f74 643e 3c74 643e 3c61 bsp;0. │ │ │ 00079550: 2e2f 696e 636c 7564 652f 6c69 6274 6f72 ./include/libtor │ │ │ -00079560: 7265 6e74 2f61 7578 5f2f 7365 7373 696f rent/aux_/sessio │ │ │ -00079570: 6e5f 696d 706c 2e68 7070 3a32 3635 3c2f n_impl.hpp:265make │ │ │ -00079590: 7468 6573 6520 6469 7265 6374 206d 656d these direct mem │ │ │ -000795a0: 6265 7273 2061 6e64 2067 656e 6572 6174 bers and generat │ │ │ -000795b0: 6520 7368 6172 6564 5f70 7472 7320 746f e shared_ptrs to │ │ │ -000795c0: 2074 6865 6d20 7768 6963 6820 616c 6961 them which alia │ │ │ -000795d0: 7320 7468 6520 6c69 7374 656e 5f73 6f63 s the listen_soc │ │ │ -000795e0: 6b65 745f 7420 7368 6172 6564 5f70 7472 ket_t shared_ptr │ │ │ -000795f0: 3c2f 7464 3e3c 2f74 723e 3c74 7220 6964

    ma │ │ │ -00079640: 6b65 2074 6865 7365 2064 6972 6563 7420 ke these direct │ │ │ -00079650: 6d65 6d62 6572 7320 616e 6420 6765 6e65 members and gene │ │ │ -00079660: 7261 7465 2073 6861 7265 645f 7074 7273 rate shared_ptrs │ │ │ -00079670: 2074 6f20 7468 656d 0a77 6869 6368 2061 to them.which a │ │ │ -00079680: 6c69 6173 2074 6865 206c 6973 7465 6e5f lias the listen_ │ │ │ -00079690: 736f 636b 6574 5f74 2073 6861 7265 645f socket_t shared_ │ │ │ -000796a0: 7074 723c 2f68 323e 3c68 343e 2e2e 2f69 ptr

    ../i │ │ │ -000796b0: 6e63 6c75 6465 2f6c 6962 746f 7272 656e nclude/libtorren │ │ │ -000796c0: 742f 6175 785f 2f73 6573 7369 6f6e 5f69 t/aux_/session_i │ │ │ -000796d0: 6d70 6c2e 6870 703a 3236 353c 2f68 343e mpl.hpp:265

    │ │ │ -000796e0: 3c70 7265 2073 7479 6c65 3d22 6261 636b
    ...if 
    │ │ │ -00079720: 2875 6470 5f73 6f63 6b29 2072 6574 7572  (udp_sock) retur
    │ │ │ -00079730: 6e20 7564 705f 736f 636b 2d26 6774 3b73  n udp_sock->s
    │ │ │ -00079740: 6f63 6b2e 6c6f 6361 6c5f 706f 7274 2829  ock.local_port()
    │ │ │ -00079750: 3b0a 0909 0972 6574 7572 6e20 303b 0a09  ;....return 0;..
    │ │ │ -00079760: 097d 0a0a 0909 2f2f 2030 2069 7320 6e61  .}....// 0 is na
    │ │ │ -00079770: 7470 6d70 2031 2069 7320 7570 6e70 0a09  tpmp 1 is upnp..
    │ │ │ -00079780: 092f 2f20 7468 6520 6f72 6465 7220 6f66  .// the order of
    │ │ │ -00079790: 2074 6865 7365 2061 7272 6179 7320 6465   these arrays de
    │ │ │ -000797a0: 7465 726d 696e 6573 2074 6865 2070 7269  termines the pri
    │ │ │ -000797b0: 6f72 6974 7920 696e 0a09 092f 2f20 7768  ority in...// wh
    │ │ │ -000797c0: 6963 6820 7468 6569 7220 706f 7274 7320  ich their ports 
    │ │ │ -000797d0: 7769 6c6c 2062 6520 616e 6e6f 756e 6365  will be announce
    │ │ │ -000797e0: 6420 746f 2070 6565 7273 0a09 0961 7578  d to peers...aux
    │ │ │ -000797f0: 3a3a 6172 7261 7926 6c74 3b6c 6973 7465  ::array<liste
    │ │ │ -00079800: 6e5f 706f 7274 5f6d 6170 7069 6e67 2c20  n_port_mapping, 
    │ │ │ -00079810: 322c 2070 6f72 746d 6170 5f74 7261 6e73  2, portmap_trans
    │ │ │ -00079820: 706f 7274 2667 743b 2074 6370 5f70 6f72  port> tcp_por
    │ │ │ -00079830: 745f 6d61 7070 696e 673b 0a09 0961 7578  t_mapping;...aux
    │ │ │ -00079840: 3a3a 6172 7261 7926 6c74 3b6c 6973 7465  ::array<liste
    │ │ │ -00079850: 6e5f 706f 7274 5f6d 6170 7069 6e67 2c20  n_port_mapping, 
    │ │ │ -00079860: 322c 2070 6f72 746d 6170 5f74 7261 6e73  2, portmap_trans
    │ │ │ -00079870: 706f 7274 2667 743b 2075 6470 5f70 6f72  port> udp_por
    │ │ │ -00079880: 745f 6d61 7070 696e 673b 0a0a 0909 2f2f  t_mapping;....//
    │ │ │ -00079890: 2069 6e64 6963 6174 6573 2077 6865 7468   indicates wheth
    │ │ │ -000798a0: 6572 2074 6869 7320 6973 2061 6e20 5353  er this is an SS
    │ │ │ -000798b0: 4c20 6c69 7374 656e 2073 6f63 6b65 7420  L listen socket 
    │ │ │ -000798c0: 6f72 206e 6f74 0a09 0974 7261 6e73 706f  or not...transpo
    │ │ │ -000798d0: 7274 2073 736c 203d 2074 7261 6e73 706f  rt ssl = transpo
    │ │ │ -000798e0: 7274 3a3a 706c 6169 6e74 6578 743b 0a0a  rt::plaintext;..
    │ │ │ -000798f0: 0909 6c69 7374 656e 5f73 6f63 6b65 745f  ..listen_socket_
    │ │ │ -00079900: 666c 6167 735f 7420 666c 6167 7320 3d20  flags_t flags = 
    │ │ │ -00079910: 6163 6365 7074 5f69 6e63 6f6d 696e 673b  accept_incoming;
    │ │ │ -00079920: 0a0a 0909 2f2f 2074 6865 2061 6374 7561  ....// the actua
    │ │ │ -00079930: 6c20 736f 636b 6574 7320 2854 4350 206c  l sockets (TCP l
    │ │ │ -00079940: 6973 7465 6e20 736f 636b 6574 2061 6e64  isten socket and
    │ │ │ -00079950: 2055 4450 2073 6f63 6b65 7429 0a09 092f   UDP socket).../
    │ │ │ -00079960: 2f20 416e 2065 6e74 7279 2064 6f65 7320  / An entry does 
    │ │ │ -00079970: 6e6f 7420 6e65 6365 7373 6172 696c 7920  not necessarily 
    │ │ │ -00079980: 6861 7665 2061 2055 4450 206f 7220 5443  have a UDP or TC
    │ │ │ -00079990: 5020 736f 636b 6574 2e20 4f6e 6520 6f66  P socket. One of
    │ │ │ -000799a0: 2074 6865 7365 0a09 092f 2f20 706f 696e   these...// poin
    │ │ │ -000799b0: 7465 7273 206d 6179 2062 6520 6e75 6c6c  ters may be null
    │ │ │ -000799c0: 7074 7221 0a09 092f 2f20 5468 6573 6520  ptr!...// These 
    │ │ │ -000799d0: 6d75 7374 2062 6520 7368 6172 6564 5f70  must be shared_p
    │ │ │ -000799e0: 7472 2074 6f20 6176 6f69 6420 6120 6461  tr to avoid a da
    │ │ │ -000799f0: 6e67 6c69 6e67 2072 6566 6572 656e 6365  ngling reference
    │ │ │ -00079a00: 2069 6620 616e 0a09 092f 2f20 696e 636f   if an...// inco
    │ │ │ -00079a10: 6d69 6e67 2070 6163 6b65 7420 6973 2069  ming packet is i
    │ │ │ -00079a20: 6e20 7468 6520 6576 656e 7420 7175 6575  n the event queu
    │ │ │ -00079a30: 6520 7768 656e 2074 6865 2073 6f63 6b65  e when the socke
    │ │ │ -00079a40: 7420 6973 2065 7261 7365 640a 3c64 6976  t is erased.
    ..std: │ │ │ -00079a80: 3a73 6861 7265 645f 7074 7226 6c74 3b74 :shared_ptr<t │ │ │ -00079a90: 6370 3a3a 6163 6365 7074 6f72 2667 743b cp::acceptor> │ │ │ -00079aa0: 2073 6f63 6b3b 0a3c 2f64 6976 3e09 0973 sock;.
    ..s │ │ │ -00079ab0: 7464 3a3a 7368 6172 6564 5f70 7472 266c td::shared_ptr&l │ │ │ -00079ac0: 743b 6175 783a 3a73 6573 7369 6f6e 5f75 t;aux::session_u │ │ │ -00079ad0: 6470 5f73 6f63 6b65 7426 6774 3b20 7564 dp_socket> ud │ │ │ -00079ae0: 705f 736f 636b 3b0a 0a09 092f 2f20 7369 p_sock;....// si │ │ │ -00079af0: 6e63 6520 7564 7020 7061 636b 6574 7320 nce udp packets │ │ │ -00079b00: 6172 6520 6578 7065 6374 6564 2074 6f20 are expected to │ │ │ -00079b10: 6265 2064 6973 7061 7463 6865 6420 6672 be dispatched fr │ │ │ -00079b20: 6571 7565 6e74 6c79 2c20 7468 6973 2073 equently, this s │ │ │ -00079b30: 6176 6573 0a09 092f 2f20 7469 6d65 206f aves...// time o │ │ │ -00079b40: 6e20 6861 6e64 6c65 7220 616c 6c6f 6361 n handler alloca │ │ │ -00079b50: 7469 6f6e 2065 7665 7279 2074 696d 6520 tion every time │ │ │ -00079b60: 7765 2072 6561 6420 6167 6169 6e2e 0a09 we read again... │ │ │ -00079b70: 0961 7578 3a3a 6861 6e64 6c65 725f 7374 .aux::handler_st │ │ │ -00079b80: 6f72 6167 6526 6c74 3b61 7578 3a3a 7564 orage<aux::ud │ │ │ -00079b90: 705f 6861 6e64 6c65 725f 6d61 785f 7369 p_handler_max_si │ │ │ -00079ba0: 7a65 2c20 6175 783a 3a75 6470 5f68 616e ze, aux::udp_han │ │ │ -00079bb0: 646c 6572 2667 743b 2075 6470 5f68 616e dler> udp_han │ │ │ -00079bc0: 646c 6572 5f73 746f 7261 6765 3b0a 0a09 dler_storage;... │ │ │ -00079bd0: 0973 7464 3a3a 7368 6172 6564 5f70 7472 .std::shared_ptr │ │ │ -00079be0: 266c 743b 6e61 7470 6d70 2667 743b 206e <natpmp> n │ │ │ -00079bf0: 6174 706d 705f 6d61 7070 6572 3b0a 0909 atpmp_mapper;... │ │ │ -00079c00: 7374 643a 3a73 6861 7265 645f 7074 7226 std::shared_ptr& │ │ │ -00079c10: 6c74 3b75 706e 7026 6774 3b20 7570 6e70 lt;upnp> upnp │ │ │ -00079c20: 5f6d 6170 7065 723b 0a0a 0909 7374 643a _mapper;....std: │ │ │ -00079c30: 3a73 6861 7265 645f 7074 7226 6c74 3b73 :shared_ptr<s │ │ │ -00079c40: 7472 7563 7420 6c73 6426 6774 3b20 6c73 truct lsd> ls │ │ │ -00079c50: 643b 0a0a 0909 2f2f 2073 6574 2074 6f20 d;....// set to │ │ │ -00079c60: 7472 7565 2077 6865 6e20 7765 2072 6563 true when we rec │ │ │ -00079c70: 6569 7665 2061 6e20 696e 636f 6d69 6e67 eive an incoming │ │ │ -00079c80: 2063 6f6e 6e65 6374 696f 6e20 6672 6f6d connection from │ │ │ -00079c90: 2074 6869 7320 6c69 7374 656e 0a09 092f this listen.../ │ │ │ -00079ca0: 2f20 736f 636b 6574 0a09 0962 6f6f 6c20 / socket...bool │ │ │ -00079cb0: 696e 636f 6d69 6e67 5f63 6f6e 6e65 6374 incoming_connect │ │ │ -00079cc0: 696f 6e20 3d20 6661 6c73 653b 0a09 7d3b ion = false;..}; │ │ │ -00079cd0: 0a0a 0909 7374 7275 6374 2054 4f52 5245 ....struct TORRE │ │ │ -00079ce0: 4e54 5f45 5854 5241 5f45 5850 4f52 5420 NT_EXTRA_EXPORT │ │ │ -00079cf0: 6c69 7374 656e 5f65 6e64 706f 696e 745f listen_endpoint_ │ │ │ -00079d00: 740a 0909 7b0a 0909 096c 6973 7465 6e5f t...{....listen_ │ │ │ -00079d10: 656e 6470 6f69 6e74 5f74 2861 6464 7265 endpoint_t(addre │ │ │ -00079d20: 7373 2063 6f6e 7374 2661 6d70 3b20 6164 ss const& ad │ │ │ -00079d30: 722c 2069 6e74 2070 2c20 7374 643a 3a73 r, int p, std::s │ │ │ -00079d40: 7472 696e 6720 6465 762c 2074 7261 6e73 tring dev, trans │ │ │ -00079d50: 706f 7274 2073 0a09 0909 092c 206c 6973 port s....., lis │ │ │ -00079d60: 7465 6e5f 736f 636b 6574 5f66 6c61 6773 ten_socket_flags │ │ │ -00079d70: 5f74 2066 2c20 6164 6472 6573 7320 636f _t f, address co │ │ │ -00079d80: 6e73 7426 616d 703b 206e 6d61 736b 203d nst& nmask = │ │ │ -00079d90: 2061 6464 7265 7373 7b7d 290a 0909 0909 address{})..... │ │ │ -00079da0: 3a20 6164 6472 2861 6472 292c 206e 6574 : addr(adr), net │ │ │ -00079db0: 6d61 736b 286e 6d61 736b 292c 2070 6f72 mask(nmask), por │ │ │ -00079dc0: 7428 7029 2c20 6465 7669 6365 2873 7464 t(p), device(std │ │ │ -00079dd0: 3a3a 6d6f 7665 2864 6576 2929 2c20 7373 ::move(dev)), ss │ │ │ -00079de0: 6c28 7329 2c20 666c 6167 7328 6629 207b l(s), flags(f) { │ │ │ -00079df0: 7d0a 0a09 0909 626f 6f6c 206f 7065 7261 }.....bool opera │ │ │ -00079e00: 746f 723d 3d28 6c69 7374 656e 5f65 6e64 tor==(listen_end │ │ │ -00079e10: 706f 696e 745f 7420 636f 6e73 7426 616d point_t const&am │ │ │ -00079e20: 703b 206f 2920 636f 6e73 740a 0909 097b p; o) const....{ │ │ │ -00079e30: 0a09 0909 0972 6574 7572 6e20 6164 6472 .....return addr │ │ │ -00079e40: 203d 3d20 6f2e 6164 6472 0a09 0909 0909 == o.addr...... │ │ │ -00079e50: 2661 6d70 3b26 616d 703b 2070 6f72 7420 && port │ │ │ -00079e60: 3d3d 206f 2e70 6f72 740a 0909 0909 0926 == o.port......& │ │ │ -00079e70: 616d 703b 2661 6d70 3b20 6465 7669 6365 amp;& device │ │ │ -00079e80: 203d 3d20 6f2e 6465 7669 6365 0a09 0909 == o.device.... │ │ │ -00079e90: 0909 2661 6d70 3b26 616d 703b 2073 736c ..&& ssl │ │ │ -00079ea0: 203d 3d20 6f2e 7373 6c0a 0909 0909 0926 == o.ssl......& │ │ │ -00079eb0: 616d 703b 2661 6d70 3b20 666c 6167 7320 amp;& flags │ │ │ -00079ec0: 3d3d 206f 2e66 6c61 6773 3b0a 0909 097d == o.flags;....} │ │ │ -00079ed0: 0a3c 2f70 7265 3e3c 2f74 643e 3c2f 7472 .
    relevance  │ │ │ -00079f10: 3b30 3c2f 7464 3e3c 7464 3e3c 6120 6872 ;0
    ../i │ │ │ -00079f40: 6e63 6c75 6465 2f6c 6962 746f 7272 656e nclude/libtorren │ │ │ -00079f50: 742f 6175 785f 2f73 6573 7369 6f6e 5f69 t/aux_/session_i │ │ │ -00079f60: 6d70 6c2e 6870 703a 3130 3930 3c2f 613e mpl.hpp:1090 │ │ │ -00079f70: 3c2f 7464 3e3c 7464 3e72 6570 6c61 6365 replace │ │ │ -00079f80: 2074 6869 7320 6279 2061 2070 726f 7065 this by a prope │ │ │ -00079f90: 7220 6173 696f 2074 696d 6572 3c2f 7464 r asio timer

    replac │ │ │ -00079ff0: 6520 7468 6973 2062 7920 6120 7072 6f70 e this by a prop │ │ │ -0007a000: 6572 2061 7369 6f20 7469 6d65 723c 2f68 er asio timer

    ../include │ │ │ -0007a020: 2f6c 6962 746f 7272 656e 742f 6175 785f /libtorrent/aux_ │ │ │ -0007a030: 2f73 6573 7369 6f6e 5f69 6d70 6c2e 6870 /session_impl.hp │ │ │ -0007a040: 703a 3130 3930 3c2f 6834 3e3c 7072 6520 p:1090

    #ifdef TORR
    │ │ │ -0007a090: 454e 545f 5353 4c5f 5045 4552 530a 0909  ENT_SSL_PEERS...
    │ │ │ -0007a0a0: 0976 6f69 6420 6f6e 5f69 6e63 6f6d 696e  .void on_incomin
    │ │ │ -0007a0b0: 675f 7574 705f 7373 6c28 736f 636b 6574  g_utp_ssl(socket
    │ │ │ -0007a0c0: 5f74 7970 6520 7329 3b0a 0909 0976 6f69  _type s);....voi
    │ │ │ -0007a0d0: 6420 7373 6c5f 6861 6e64 7368 616b 6528  d ssl_handshake(
    │ │ │ -0007a0e0: 6572 726f 725f 636f 6465 2063 6f6e 7374  error_code const
    │ │ │ -0007a0f0: 2661 6d70 3b20 6563 2c20 736f 636b 6574  & ec, socket
    │ │ │ -0007a100: 5f74 7970 652a 2073 293b 0a23 656e 6469  _type* s);.#endi
    │ │ │ -0007a110: 660a 0a09 0909 2f2f 2072 6f75 6e64 2d72  f.....// round-r
    │ │ │ -0007a120: 6f62 696e 2069 6e64 6578 2069 6e74 6f20  obin index into 
    │ │ │ -0007a130: 6d5f 6f75 7467 6f69 6e67 5f69 6e74 6572  m_outgoing_inter
    │ │ │ -0007a140: 6661 6365 730a 0909 096d 7574 6162 6c65  faces....mutable
    │ │ │ -0007a150: 2073 7464 3a3a 7569 6e74 385f 7420 6d5f   std::uint8_t m_
    │ │ │ -0007a160: 696e 7465 7266 6163 655f 696e 6465 7820  interface_index 
    │ │ │ -0007a170: 3d20 303b 0a0a 0909 0973 7464 3a3a 7368  = 0;.....std::sh
    │ │ │ -0007a180: 6172 6564 5f70 7472 266c 743b 6c69 7374  ared_ptr<list
    │ │ │ -0007a190: 656e 5f73 6f63 6b65 745f 7426 6774 3b20  en_socket_t> 
    │ │ │ -0007a1a0: 7365 7475 705f 6c69 7374 656e 6572 280a  setup_listener(.
    │ │ │ -0007a1b0: 0909 0909 6c69 7374 656e 5f65 6e64 706f  ....listen_endpo
    │ │ │ -0007a1c0: 696e 745f 7420 636f 6e73 7426 616d 703b  int_t const&
    │ │ │ -0007a1d0: 206c 6570 2c20 6572 726f 725f 636f 6465   lep, error_code
    │ │ │ -0007a1e0: 2661 6d70 3b20 6563 293b 0a0a 2369 666e  & ec);..#ifn
    │ │ │ -0007a1f0: 6465 6620 544f 5252 454e 545f 4449 5341  def TORRENT_DISA
    │ │ │ -0007a200: 424c 455f 4448 540a 0909 0964 6874 3a3a  BLE_DHT....dht::
    │ │ │ -0007a210: 6468 745f 7374 6174 6520 6d5f 6468 745f  dht_state m_dht_
    │ │ │ -0007a220: 7374 6174 653b 0a23 656e 6469 660a 0a09  state;.#endif...
    │ │ │ -0007a230: 0909 2f2f 2074 6869 7320 6973 2069 6e69  ..// this is ini
    │ │ │ -0007a240: 7469 616c 697a 6564 2074 6f20 7468 6520  tialized to the 
    │ │ │ -0007a250: 756e 6368 6f6b 655f 696e 7465 7276 616c  unchoke_interval
    │ │ │ -0007a260: 0a09 0909 2f2f 2073 6573 7369 6f6e 5f73  ....// session_s
    │ │ │ -0007a270: 6574 7469 6e67 2061 6e64 2064 6563 7265  etting and decre
    │ │ │ -0007a280: 6173 6564 2065 7665 7279 2073 6563 6f6e  ased every secon
    │ │ │ -0007a290: 642e 0a09 0909 2f2f 2077 6865 6e20 6974  d.....// when it
    │ │ │ -0007a2a0: 2072 6561 6368 6573 207a 6572 6f2c 2069   reaches zero, i
    │ │ │ -0007a2b0: 7420 6973 2072 6573 6574 2074 6f20 7468  t is reset to th
    │ │ │ -0007a2c0: 650a 0909 092f 2f20 756e 6368 6f6b 655f  e....// unchoke_
    │ │ │ -0007a2d0: 696e 7465 7276 616c 2061 6e64 2074 6865  interval and the
    │ │ │ -0007a2e0: 2075 6e63 686f 6b65 2073 6574 2069 730a   unchoke set is.
    │ │ │ -0007a2f0: 0909 092f 2f20 7265 636f 6d70 7574 6564  ...// recomputed
    │ │ │ -0007a300: 2e0a 3c64 6976 2073 7479 6c65 3d22 6261  ..
    │ │ │ -0007a330: 0909 0969 6e74 206d 5f75 6e63 686f 6b65 ...int m_unchoke │ │ │ -0007a340: 5f74 696d 655f 7363 616c 6572 203d 2030 _time_scaler = 0 │ │ │ -0007a350: 3b0a 3c2f 6469 763e 0a09 0909 2f2f 2074 ;.
    ....// t │ │ │ -0007a360: 6869 7320 6973 2075 7365 6420 746f 2064 his is used to d │ │ │ -0007a370: 6563 6964 6520 7768 656e 2074 6f20 7265 ecide when to re │ │ │ -0007a380: 6361 6c63 756c 6174 6520 7768 6963 680a calculate which. │ │ │ -0007a390: 0909 092f 2f20 746f 7272 656e 7473 2074 ...// torrents t │ │ │ -0007a3a0: 6f20 6b65 6570 2071 7565 7565 6420 616e o keep queued an │ │ │ -0007a3b0: 6420 7768 6963 6820 746f 2061 6374 6976 d which to activ │ │ │ -0007a3c0: 6174 650a 3c2f 7072 653e 3c2f 7464 3e3c ate.
    < │ │ │ -0007a3d0: 2f74 723e 3c74 7220 7374 796c 653d 2262 /tr>relevance&n │ │ │ -0007a400: 6273 703b 303c 2f74 643e 3c74 643e 3c61 bsp;0. │ │ │ -0007a430: 2e2f 696e 636c 7564 652f 6c69 6274 6f72 ./include/libtor │ │ │ -0007a440: 7265 6e74 2f61 7578 5f2f 7365 7373 696f rent/aux_/sessio │ │ │ -0007a450: 6e5f 696d 706c 2e68 7070 3a31 3039 353c n_impl.hpp:1095< │ │ │ -0007a460: 2f61 3e3c 2f74 643e 3c74 643e 7265 706c /a>repl │ │ │ -0007a470: 6163 6520 7468 6973 2062 7920 6120 7072 ace this by a pr │ │ │ -0007a480: 6f70 6572 2061 7369 6f20 7469 6d65 723c oper asio timer< │ │ │ -0007a490: 2f74 643e 3c2f 7472 3e3c 7472 2069 643d /td>

    rep │ │ │ -0007a4e0: 6c61 6365 2074 6869 7320 6279 2061 2070 lace this by a p │ │ │ -0007a4f0: 726f 7065 7220 6173 696f 2074 696d 6572 roper asio timer │ │ │ -0007a500: 3c2f 6832 3e3c 6834 3e2e 2e2f 696e 636c

    ../incl │ │ │ -0007a510: 7564 652f 6c69 6274 6f72 7265 6e74 2f61 ude/libtorrent/a │ │ │ -0007a520: 7578 5f2f 7365 7373 696f 6e5f 696d 706c ux_/session_impl │ │ │ -0007a530: 2e68 7070 3a31 3039 353c 2f68 343e 3c70 .hpp:1095

    ....// r │ │ │ -0007a580: 6f75 6e64 2d72 6f62 696e 2069 6e64 6578 ound-robin index │ │ │ -0007a590: 2069 6e74 6f20 6d5f 6f75 7467 6f69 6e67 into m_outgoing │ │ │ -0007a5a0: 5f69 6e74 6572 6661 6365 730a 0909 096d _interfaces....m │ │ │ -0007a5b0: 7574 6162 6c65 2073 7464 3a3a 7569 6e74 utable std::uint │ │ │ -0007a5c0: 385f 7420 6d5f 696e 7465 7266 6163 655f 8_t m_interface_ │ │ │ -0007a5d0: 696e 6465 7820 3d20 303b 0a0a 0909 0973 index = 0;.....s │ │ │ -0007a5e0: 7464 3a3a 7368 6172 6564 5f70 7472 266c td::shared_ptr&l │ │ │ -0007a5f0: 743b 6c69 7374 656e 5f73 6f63 6b65 745f t;listen_socket_ │ │ │ -0007a600: 7426 6774 3b20 7365 7475 705f 6c69 7374 t> setup_list │ │ │ -0007a610: 656e 6572 280a 0909 0909 6c69 7374 656e ener(.....listen │ │ │ -0007a620: 5f65 6e64 706f 696e 745f 7420 636f 6e73 _endpoint_t cons │ │ │ -0007a630: 7426 616d 703b 206c 6570 2c20 6572 726f t& lep, erro │ │ │ -0007a640: 725f 636f 6465 2661 6d70 3b20 6563 293b r_code& ec); │ │ │ -0007a650: 0a0a 2369 666e 6465 6620 544f 5252 454e ..#ifndef TORREN │ │ │ -0007a660: 545f 4449 5341 424c 455f 4448 540a 0909 T_DISABLE_DHT... │ │ │ -0007a670: 0964 6874 3a3a 6468 745f 7374 6174 6520 .dht::dht_state │ │ │ -0007a680: 6d5f 6468 745f 7374 6174 653b 0a23 656e m_dht_state;.#en │ │ │ -0007a690: 6469 660a 0a09 0909 2f2f 2074 6869 7320 dif.....// this │ │ │ -0007a6a0: 6973 2069 6e69 7469 616c 697a 6564 2074 is initialized t │ │ │ -0007a6b0: 6f20 7468 6520 756e 6368 6f6b 655f 696e o the unchoke_in │ │ │ -0007a6c0: 7465 7276 616c 0a09 0909 2f2f 2073 6573 terval....// ses │ │ │ -0007a6d0: 7369 6f6e 5f73 6574 7469 6e67 2061 6e64 sion_setting and │ │ │ -0007a6e0: 2064 6563 7265 6173 6564 2065 7665 7279 decreased every │ │ │ -0007a6f0: 2073 6563 6f6e 642e 0a09 0909 2f2f 2077 second.....// w │ │ │ -0007a700: 6865 6e20 6974 2072 6561 6368 6573 207a hen it reaches z │ │ │ -0007a710: 6572 6f2c 2069 7420 6973 2072 6573 6574 ero, it is reset │ │ │ -0007a720: 2074 6f20 7468 650a 0909 092f 2f20 756e to the....// un │ │ │ -0007a730: 6368 6f6b 655f 696e 7465 7276 616c 2061 choke_interval a │ │ │ -0007a740: 6e64 2074 6865 2075 6e63 686f 6b65 2073 nd the unchoke s │ │ │ -0007a750: 6574 2069 730a 0909 092f 2f20 7265 636f et is....// reco │ │ │ -0007a760: 6d70 7574 6564 2e0a 0909 0969 6e74 206d mputed.....int m │ │ │ -0007a770: 5f75 6e63 686f 6b65 5f74 696d 655f 7363 _unchoke_time_sc │ │ │ -0007a780: 616c 6572 203d 2030 3b0a 0a09 0909 2f2f aler = 0;.....// │ │ │ -0007a790: 2074 6869 7320 6973 2075 7365 6420 746f this is used to │ │ │ -0007a7a0: 2064 6563 6964 6520 7768 656e 2074 6f20 decide when to │ │ │ -0007a7b0: 7265 6361 6c63 756c 6174 6520 7768 6963 recalculate whic │ │ │ -0007a7c0: 680a 0909 092f 2f20 746f 7272 656e 7473 h....// torrents │ │ │ -0007a7d0: 2074 6f20 6b65 6570 2071 7565 7565 6420 to keep queued │ │ │ -0007a7e0: 616e 6420 7768 6963 6820 746f 2061 6374 and which to act │ │ │ -0007a7f0: 6976 6174 650a 3c64 6976 2073 7479 6c65 ivate.

    ...int m_aut │ │ │ -0007a830: 6f5f 6d61 6e61 6765 5f74 696d 655f 7363 o_manage_time_sc │ │ │ -0007a840: 616c 6572 203d 2030 3b0a 3c2f 6469 763e aler = 0;.
    │ │ │ -0007a850: 0a09 0909 2f2f 2077 6f72 6b73 206c 696b ....// works lik │ │ │ -0007a860: 6520 756e 6368 6f6b 655f 7469 6d65 5f73 e unchoke_time_s │ │ │ -0007a870: 6361 6c65 7220 6275 7420 6974 0a09 0909 caler but it.... │ │ │ -0007a880: 2f2f 2069 7320 6f6e 6c79 2064 6563 7265 // is only decre │ │ │ -0007a890: 6173 6564 2077 6865 6e20 7468 6520 756e ased when the un │ │ │ -0007a8a0: 6368 6f6b 6520 7365 740a 0909 092f 2f20 choke set....// │ │ │ -0007a8b0: 6973 2072 6563 6f6d 7075 7465 642c 2061 is recomputed, a │ │ │ -0007a8c0: 6e64 2077 6865 6e20 6974 2072 6561 6368 nd when it reach │ │ │ -0007a8d0: 6573 207a 6572 6f2c 0a09 0909 2f2f 2074 es zero,....// t │ │ │ -0007a8e0: 6865 206f 7074 696d 6973 7469 6320 756e he optimistic un │ │ │ -0007a8f0: 6368 6f6b 6520 6973 206d 6f76 6564 2074 choke is moved t │ │ │ -0007a900: 6f20 616e 6f74 6865 7220 7065 6572 2e0a o another peer.. │ │ │ -0007a910: 3c2f 7072 653e 3c2f 7464 3e3c 2f74 723e

    │ │ │ -0007a920: 3c74 7220 7374 796c 653d 2262 6163 6b67 relevance  │ │ │ -0007a950: 303c 2f74 643e 3c74 643e 3c61 2068 7265 0../in │ │ │ -0007a980: 636c 7564 652f 6c69 6274 6f72 7265 6e74 clude/libtorrent │ │ │ -0007a990: 2f61 7578 5f2f 7365 7373 696f 6e5f 696d /aux_/session_im │ │ │ -0007a9a0: 706c 2e68 7070 3a31 3130 323c 2f61 3e3c pl.hpp:1102< │ │ │ -0007a9b0: 2f74 643e 3c74 643e 7265 706c 6163 6520 /td>replace │ │ │ -0007a9c0: 7468 6973 2062 7920 6120 7072 6f70 6572 this by a proper │ │ │ -0007a9d0: 2061 7369 6f20 7469 6d65 723c 2f74 643e asio timer │ │ │ -0007a9e0: 3c2f 7472 3e3c 7472 2069 643d 2232 3737

    replace │ │ │ -0007aa30: 2074 6869 7320 6279 2061 2070 726f 7065 this by a prope │ │ │ -0007aa40: 7220 6173 696f 2074 696d 6572 3c2f 6832 r asio timer

    ../include/ │ │ │ -0007aa60: 6c69 6274 6f72 7265 6e74 2f61 7578 5f2f libtorrent/aux_/ │ │ │ -0007aa70: 7365 7373 696f 6e5f 696d 706c 2e68 7070 session_impl.hpp │ │ │ -0007aa80: 3a31 3130 323c 2f68 343e 3c70 7265 2073 :1102

    .#ifndef TOR
    │ │ │ -0007aad0: 5245 4e54 5f44 4953 4142 4c45 5f44 4854  RENT_DISABLE_DHT
    │ │ │ -0007aae0: 0a09 0909 6468 743a 3a64 6874 5f73 7461  ....dht::dht_sta
    │ │ │ -0007aaf0: 7465 206d 5f64 6874 5f73 7461 7465 3b0a  te m_dht_state;.
    │ │ │ -0007ab00: 2365 6e64 6966 0a0a 0909 092f 2f20 7468  #endif.....// th
    │ │ │ -0007ab10: 6973 2069 7320 696e 6974 6961 6c69 7a65  is is initialize
    │ │ │ -0007ab20: 6420 746f 2074 6865 2075 6e63 686f 6b65  d to the unchoke
    │ │ │ -0007ab30: 5f69 6e74 6572 7661 6c0a 0909 092f 2f20  _interval....// 
    │ │ │ -0007ab40: 7365 7373 696f 6e5f 7365 7474 696e 6720  session_setting 
    │ │ │ -0007ab50: 616e 6420 6465 6372 6561 7365 6420 6576  and decreased ev
    │ │ │ -0007ab60: 6572 7920 7365 636f 6e64 2e0a 0909 092f  ery second...../
    │ │ │ -0007ab70: 2f20 7768 656e 2069 7420 7265 6163 6865  / when it reache
    │ │ │ -0007ab80: 7320 7a65 726f 2c20 6974 2069 7320 7265  s zero, it is re
    │ │ │ -0007ab90: 7365 7420 746f 2074 6865 0a09 0909 2f2f  set to the....//
    │ │ │ -0007aba0: 2075 6e63 686f 6b65 5f69 6e74 6572 7661   unchoke_interva
    │ │ │ -0007abb0: 6c20 616e 6420 7468 6520 756e 6368 6f6b  l and the unchok
    │ │ │ -0007abc0: 6520 7365 7420 6973 0a09 0909 2f2f 2072  e set is....// r
    │ │ │ -0007abd0: 6563 6f6d 7075 7465 642e 0a09 0909 696e  ecomputed.....in
    │ │ │ -0007abe0: 7420 6d5f 756e 6368 6f6b 655f 7469 6d65  t m_unchoke_time
    │ │ │ -0007abf0: 5f73 6361 6c65 7220 3d20 303b 0a0a 0909  _scaler = 0;....
    │ │ │ -0007ac00: 092f 2f20 7468 6973 2069 7320 7573 6564  .// this is used
    │ │ │ -0007ac10: 2074 6f20 6465 6369 6465 2077 6865 6e20   to decide when 
    │ │ │ -0007ac20: 746f 2072 6563 616c 6375 6c61 7465 2077  to recalculate w
    │ │ │ -0007ac30: 6869 6368 0a09 0909 2f2f 2074 6f72 7265  hich....// torre
    │ │ │ -0007ac40: 6e74 7320 746f 206b 6565 7020 7175 6575  nts to keep queu
    │ │ │ -0007ac50: 6564 2061 6e64 2077 6869 6368 2074 6f20  ed and which to 
    │ │ │ -0007ac60: 6163 7469 7661 7465 0a09 0909 696e 7420  activate....int 
    │ │ │ -0007ac70: 6d5f 6175 746f 5f6d 616e 6167 655f 7469  m_auto_manage_ti
    │ │ │ -0007ac80: 6d65 5f73 6361 6c65 7220 3d20 303b 0a0a  me_scaler = 0;..
    │ │ │ -0007ac90: 0909 092f 2f20 776f 726b 7320 6c69 6b65  ...// works like
    │ │ │ -0007aca0: 2075 6e63 686f 6b65 5f74 696d 655f 7363   unchoke_time_sc
    │ │ │ -0007acb0: 616c 6572 2062 7574 2069 740a 0909 092f  aler but it..../
    │ │ │ -0007acc0: 2f20 6973 206f 6e6c 7920 6465 6372 6561  / is only decrea
    │ │ │ -0007acd0: 7365 6420 7768 656e 2074 6865 2075 6e63  sed when the unc
    │ │ │ -0007ace0: 686f 6b65 2073 6574 0a09 0909 2f2f 2069  hoke set....// i
    │ │ │ -0007acf0: 7320 7265 636f 6d70 7574 6564 2c20 616e  s recomputed, an
    │ │ │ -0007ad00: 6420 7768 656e 2069 7420 7265 6163 6865  d when it reache
    │ │ │ -0007ad10: 7320 7a65 726f 2c0a 0909 092f 2f20 7468  s zero,....// th
    │ │ │ -0007ad20: 6520 6f70 7469 6d69 7374 6963 2075 6e63  e optimistic unc
    │ │ │ -0007ad30: 686f 6b65 2069 7320 6d6f 7665 6420 746f  hoke is moved to
    │ │ │ -0007ad40: 2061 6e6f 7468 6572 2070 6565 722e 0a3c   another peer..<
    │ │ │ -0007ad50: 6469 7620 7374 796c 653d 2262 6163 6b67  div style="backg
    │ │ │ -0007ad60: 726f 756e 643a 2023 6666 6666 3030 2220  round: #ffff00" 
    │ │ │ -0007ad70: 7769 6474 683d 2231 3030 2522 3e09 0909  width="100%">...
    │ │ │ -0007ad80: 696e 7420 6d5f 6f70 7469 6d69 7374 6963  int m_optimistic
    │ │ │ -0007ad90: 5f75 6e63 686f 6b65 5f74 696d 655f 7363  _unchoke_time_sc
    │ │ │ -0007ada0: 616c 6572 203d 2030 3b0a 3c2f 6469 763e  aler = 0;.
    │ │ │ -0007adb0: 0a09 0909 2f2f 2077 6f72 6b73 206c 696b  ....// works lik
    │ │ │ -0007adc0: 6520 756e 6368 6f6b 655f 7469 6d65 5f73  e unchoke_time_s
    │ │ │ -0007add0: 6361 6c65 722e 2045 6163 6820 7469 6d65  caler. Each time
    │ │ │ -0007ade0: 0a09 0909 2f2f 2069 7420 7265 6163 6865  ....// it reache
    │ │ │ -0007adf0: 7320 302c 2061 6e64 2061 6c6c 2074 6865  s 0, and all the
    │ │ │ -0007ae00: 2063 6f6e 6e65 6374 696f 6e73 2061 7265   connections are
    │ │ │ -0007ae10: 0a09 0909 2f2f 2075 7365 642c 2074 6865  ....// used, the
    │ │ │ -0007ae20: 2077 6f72 7374 2063 6f6e 6e65 6374 696f   worst connectio
    │ │ │ -0007ae30: 6e20 7769 6c6c 2062 6520 6469 7363 6f6e  n will be discon
    │ │ │ -0007ae40: 6e65 6374 6564 0a09 0909 2f2f 2066 726f  nected....// fro
    │ │ │ -0007ae50: 6d20 7468 6520 746f 7272 656e 7420 7769  m the torrent wi
    │ │ │ -0007ae60: 7468 2074 6865 206d 6f73 7420 7065 6572  th the most peer
    │ │ │ -0007ae70: 730a 0909 0969 6e74 206d 5f64 6973 636f  s....int m_disco
    │ │ │ -0007ae80: 6e6e 6563 745f 7469 6d65 5f73 6361 6c65  nnect_time_scale
    │ │ │ -0007ae90: 7220 3d20 3930 3b0a 0a09 0909 2f2f 2077  r = 90;.....// w
    │ │ │ -0007aea0: 6865 6e20 7468 6973 2073 6361 6c65 7220  hen this scaler 
    │ │ │ -0007aeb0: 7265 6163 6865 7320 7a65 726f 2c20 6974  reaches zero, it
    │ │ │ -0007aec0: 2077 696c 6c0a 0909 092f 2f20 7363 7261   will....// scra
    │ │ │ -0007aed0: 7065 206f 6e65 206f 6620 7468 6520 6175  pe one of the au
    │ │ │ -0007aee0: 746f 206d 616e 6167 6564 2c20 7061 7573  to managed, paus
    │ │ │ -0007aef0: 6564 2c0a 0909 092f 2f20 746f 7272 656e  ed,....// torren
    │ │ │ -0007af00: 7473 2e0a 0909 0969 6e74 206d 5f61 7574  ts.....int m_aut
    │ │ │ -0007af10: 6f5f 7363 7261 7065 5f74 696d 655f 7363  o_scrape_time_sc
    │ │ │ -0007af20: 616c 6572 203d 2031 3830 3b0a 0a09 0909  aler = 180;.....
    │ │ │ -0007af30: 2f2f 2073 7461 7469 7374 6963 7320 6761  // statistics ga
    │ │ │ -0007af40: 7468 6572 6564 2066 726f 6d20 616c 6c20  thered from all 
    │ │ │ -0007af50: 746f 7272 656e 7473 2e0a 0909 0973 7461  torrents.....sta
    │ │ │ -0007af60: 7420 6d5f 7374 6174 3b0a 0a09 0909 2f2f  t m_stat;.....//
    │ │ │ -0007af70: 2069 6d70 6c65 6d65 6e74 7320 7365 7373   implements sess
    │ │ │ -0007af80: 696f 6e5f 696e 7465 7266 6163 650a 0909  ion_interface...
    │ │ │ -0007af90: 0976 6f69 6420 7365 6e74 5f62 7974 6573  .void sent_bytes
    │ │ │ -0007afa0: 2869 6e74 2062 7974 6573 5f70 6179 6c6f  (int bytes_paylo
    │ │ │ -0007afb0: 6164 2c20 696e 7420 6279 7465 735f 7072  ad, int bytes_pr
    │ │ │ -0007afc0: 6f74 6f63 6f6c 2920 6f76 6572 7269 6465  otocol) override
    │ │ │ -0007afd0: 3b0a 0909 0976 6f69 6420 7265 6365 6976  ;....void receiv
    │ │ │ -0007afe0: 6564 5f62 7974 6573 2869 6e74 2062 7974  ed_bytes(int byt
    │ │ │ -0007aff0: 6573 5f70 6179 6c6f 6164 2c20 696e 7420  es_payload, int 
    │ │ │ -0007b000: 6279 7465 735f 7072 6f74 6f63 6f6c 2920  bytes_protocol) 
    │ │ │ -0007b010: 6f76 6572 7269 6465 3b0a 0909 0976 6f69  override;....voi
    │ │ │ -0007b020: 6420 7472 616e 6369 6576 655f 6970 5f70  d trancieve_ip_p
    │ │ │ -0007b030: 6163 6b65 7428 696e 7420 6279 7465 732c  acket(int bytes,
    │ │ │ -0007b040: 2062 6f6f 6c20 6970 7636 2920 6f76 6572   bool ipv6) over
    │ │ │ -0007b050: 7269 6465 3b0a 0909 0976 6f69 6420 7365  ride;....void se
    │ │ │ -0007b060: 6e74 5f73 796e 2862 6f6f 6c20 6970 7636  nt_syn(bool ipv6
    │ │ │ -0007b070: 2920 6f76 6572 7269 6465 3b0a 0909 0976  ) override;....v
    │ │ │ -0007b080: 6f69 6420 7265 6365 6976 6564 5f73 796e  oid received_syn
    │ │ │ -0007b090: 6163 6b28 626f 6f6c 2069 7076 3629 206f  ack(bool ipv6) o
    │ │ │ -0007b0a0: 7665 7272 6964 653b 0a0a 2369 6620 544f  verride;..#if TO
    │ │ │ -0007b0b0: 5252 454e 545f 4142 495f 5645 5253 494f  RRENT_ABI_VERSIO
    │ │ │ -0007b0c0: 4e20 3d3d 2031 0a09 0909 696e 7420 6d5f  N == 1....int m_
    │ │ │ -0007b0d0: 7065 616b 5f75 705f 7261 7465 203d 2030  peak_up_rate = 0
    │ │ │ -0007b0e0: 3b0a 2365 6e64 6966 0a0a 0909 0976 6f69  ;.#endif.....voi
    │ │ │ -0007b0f0: 6420 6f6e 5f74 6963 6b28 6572 726f 725f  d on_tick(error_
    │ │ │ -0007b100: 636f 6465 2063 6f6e 7374 2661 6d70 3b20  code const& 
    │ │ │ -0007b110: 6529 3b0a 0a09 0909 766f 6964 2074 7279  e);.....void try
    │ │ │ -0007b120: 5f63 6f6e 6e65 6374 5f6d 6f72 655f 7065  _connect_more_pe
    │ │ │ -0007b130: 6572 7328 293b 0a09 0909 766f 6964 2061  ers();....void a
    │ │ │ -0007b140: 7574 6f5f 6d61 6e61 6765 5f63 6865 636b  uto_manage_check
    │ │ │ -0007b150: 696e 675f 746f 7272 656e 7473 2873 7464  ing_torrents(std
    │ │ │ -0007b160: 3a3a 7665 6374 6f72 266c 743b 746f 7272  ::vector<torr
    │ │ │ -0007b170: 656e 742a 2667 743b 2661 6d70 3b20 6c69  ent*>& li
    │ │ │ -0007b180: 7374 0a3c 2f70 7265 3e3c 2f74 643e 3c2f  st.
    │ │ │ -0007b1b0: 3c74 643e 7265 6c65 7661 6e63 6526 6e62 relevance&nb │ │ │ -0007b1c0: 7370 3b30 3c2f 7464 3e3c 7464 3e3c 6120 sp;0.. │ │ │ -0007b1f0: 2f69 6e63 6c75 6465 2f6c 6962 746f 7272 /include/libtorr │ │ │ -0007b200: 656e 742f 6175 785f 2f61 6c6c 6f63 6174 ent/aux_/allocat │ │ │ -0007b210: 696e 675f 6861 6e64 6c65 722e 6870 703a ing_handler.hpp: │ │ │ -0007b220: 3331 363c 2f61 3e3c 2f74 643e 3c74 643e 316 │ │ │ -0007b230: 696e 2043 2b2b 3137 2c20 4861 6e64 6c65 in C++17, Handle │ │ │ -0007b240: 7220 616e 6420 5374 6f72 6167 6520 636f r and Storage co │ │ │ -0007b250: 756c 6420 6a75 7374 2075 7365 2022 6175 uld just use "au │ │ │ -0007b260: 746f 223c 2f74 643e 3c2f 7472 3e3c 7472 to"

    in C++17, Handl │ │ │ -0007b2c0: 6572 2061 6e64 2053 746f 7261 6765 2063 er and Storage c │ │ │ -0007b2d0: 6f75 6c64 206a 7573 7420 7573 6520 2261 ould just use "a │ │ │ -0007b2e0: 7574 6f22 3c2f 6832 3e3c 6834 3e2e 2e2f uto"

    ../ │ │ │ -0007b2f0: 696e 636c 7564 652f 6c69 6274 6f72 7265 include/libtorre │ │ │ -0007b300: 6e74 2f61 7578 5f2f 616c 6c6f 6361 7469 nt/aux_/allocati │ │ │ -0007b310: 6e67 5f68 616e 646c 6572 2e68 7070 3a33 ng_handler.hpp:3 │ │ │ -0007b320: 3136 3c2f 6834 3e3c 7072 6520 7374 796c 16

    ..private:....H
    │ │ │ -0007b370: 616e 646c 6572 2068 616e 646c 6572 3b0a  andler handler;.
    │ │ │ -0007b380: 0909 6861 6e64 6c65 725f 7374 6f72 6167  ..handler_storag
    │ │ │ -0007b390: 6526 6c74 3b53 697a 652c 204e 616d 6526  e<Size, Name&
    │ │ │ -0007b3a0: 6774 3b2a 2073 746f 7261 6765 3b0a 2369  gt;* storage;.#i
    │ │ │ -0007b3b0: 666e 6465 6620 424f 4f53 545f 4e4f 5f45  fndef BOOST_NO_E
    │ │ │ -0007b3c0: 5843 4550 5449 4f4e 530a 0909 6572 726f  XCEPTIONS...erro
    │ │ │ -0007b3d0: 725f 6861 6e64 6c65 725f 696e 7465 7266  r_handler_interf
    │ │ │ -0007b3e0: 6163 652a 2065 7272 6f72 5f68 616e 646c  ace* error_handl
    │ │ │ -0007b3f0: 6572 3b0a 2365 6e64 6966 0a09 7d3b 0a0a  er;.#endif..};..
    │ │ │ -0007b400: 0974 656d 706c 6174 6520 266c 743b 636c  .template <cl
    │ │ │ -0007b410: 6173 7320 4861 6e64 6c65 722c 2073 697a  ass Handler, siz
    │ │ │ -0007b420: 655f 7420 5369 7a65 2c20 4861 6e64 6c65  e_t Size, Handle
    │ │ │ -0007b430: 724e 616d 6520 4e61 6d65 2667 743b 0a09  rName Name>..
    │ │ │ -0007b440: 6175 783a 3a61 6c6c 6f63 6174 696e 675f  aux::allocating_
    │ │ │ -0007b450: 6861 6e64 6c65 7226 6c74 3b48 616e 646c  handler<Handl
    │ │ │ -0007b460: 6572 2c20 5369 7a65 2c20 4e61 6d65 2667  er, Size, Name&g
    │ │ │ -0007b470: 743b 0a09 6d61 6b65 5f68 616e 646c 6572  t;..make_handler
    │ │ │ -0007b480: 2848 616e 646c 6572 2068 616e 646c 6572  (Handler handler
    │ │ │ -0007b490: 0a09 092c 2068 616e 646c 6572 5f73 746f  ..., handler_sto
    │ │ │ -0007b4a0: 7261 6765 266c 743b 5369 7a65 2c20 4e61  rage<Size, Na
    │ │ │ -0007b4b0: 6d65 2667 743b 2661 6d70 3b20 7374 6f72  me>& stor
    │ │ │ -0007b4c0: 6167 650a 0909 2c20 6572 726f 725f 6861  age..., error_ha
    │ │ │ -0007b4d0: 6e64 6c65 725f 696e 7465 7266 6163 6526  ndler_interface&
    │ │ │ -0007b4e0: 616d 703b 2065 7272 5f68 616e 646c 6572  amp; err_handler
    │ │ │ -0007b4f0: 290a 097b 0a09 0972 6574 7572 6e20 6175  )..{...return au
    │ │ │ -0007b500: 783a 3a61 6c6c 6f63 6174 696e 675f 6861  x::allocating_ha
    │ │ │ -0007b510: 6e64 6c65 7226 6c74 3b48 616e 646c 6572  ndler<Handler
    │ │ │ -0007b520: 2c20 5369 7a65 2c20 4e61 6d65 2667 743b  , Size, Name>
    │ │ │ -0007b530: 280a 0909 0973 7464 3a3a 666f 7277 6172  (....std::forwar
    │ │ │ -0007b540: 6426 6c74 3b48 616e 646c 6572 2667 743b  d<Handler>
    │ │ │ -0007b550: 2868 616e 646c 6572 292c 2026 616d 703b  (handler), &
    │ │ │ -0007b560: 7374 6f72 6167 652c 2026 616d 703b 6572  storage, &er
    │ │ │ -0007b570: 725f 6861 6e64 6c65 7229 3b0a 097d 0a0a  r_handler);..}..
    │ │ │ -0007b580: 3c64 6976 2073 7479 6c65 3d22 6261 636b  
    .t │ │ │ -0007b5b0: 656d 706c 6174 6520 266c 743b 7479 7065 emplate <type │ │ │ -0007b5c0: 6e61 6d65 2054 0a3c 2f64 6976 3e09 092c name T.
    .., │ │ │ -0007b5d0: 2074 7970 656e 616d 6520 4861 6e64 6c65 typename Handle │ │ │ -0007b5e0: 7254 7970 650a 0909 2c20 4861 6e64 6c65 rType..., Handle │ │ │ -0007b5f0: 7254 7970 6520 4861 6e64 6c65 720a 0909 rType Handler... │ │ │ -0007b600: 2c20 766f 6964 2028 543a 3a2a 4572 726f , void (T::*Erro │ │ │ -0007b610: 7248 616e 646c 6572 2928 6572 726f 725f rHandler)(error_ │ │ │ -0007b620: 636f 6465 2063 6f6e 7374 2661 6d70 3b29 code const&) │ │ │ -0007b630: 0a09 092c 2076 6f69 6420 2854 3a3a 2a45 ..., void (T::*E │ │ │ -0007b640: 7863 6570 7448 616e 646c 6572 2928 7374 xceptHandler)(st │ │ │ -0007b650: 643a 3a65 7863 6570 7469 6f6e 2063 6f6e d::exception con │ │ │ -0007b660: 7374 2661 6d70 3b29 0a09 092c 2074 7970 st&)..., typ │ │ │ -0007b670: 656e 616d 6520 5374 6f72 6167 6554 7970 ename StorageTyp │ │ │ -0007b680: 650a 0909 2c20 5374 6f72 6167 6554 7970 e..., StorageTyp │ │ │ -0007b690: 6520 543a 3a2a 2053 746f 7261 6765 2667 e T::* Storage&g │ │ │ -0007b6a0: 743b 0a09 7374 7275 6374 2068 616e 646c t;..struct handl │ │ │ -0007b6b0: 6572 0a09 7b0a 0909 6578 706c 6963 6974 er..{...explicit │ │ │ -0007b6c0: 2068 616e 646c 6572 2873 7464 3a3a 7368 handler(std::sh │ │ │ -0007b6d0: 6172 6564 5f70 7472 266c 743b 5426 6774 ared_ptr<T> │ │ │ -0007b6e0: 3b20 7029 203a 2070 7472 5f28 7374 643a ; p) : ptr_(std: │ │ │ -0007b6f0: 3a6d 6f76 6528 7029 2920 7b7d 0a0a 0909 :move(p)) {}.... │ │ │ -0007b700: 7374 643a 3a73 6861 7265 645f 7074 7226 std::shared_ptr& │ │ │ -0007b710: 6c74 3b54 2667 743b 2070 7472 5f3b 0a0a lt;T> ptr_;.. │ │ │ -0007b720: 0909 7465 6d70 6c61 7465 2026 6c74 3b63 ..template <c │ │ │ -0007b730: 6c61 7373 2e2e 2e20 4126 6774 3b0a 0909 lass... A>... │ │ │ -0007b740: 766f 6964 206f 7065 7261 746f 7228 2928 void operator()( │ │ │ -0007b750: 4126 616d 703b 2661 6d70 3b2e 2e2e 2061 A&&... a │ │ │ -0007b760: 290a 0909 7b0a 2369 6664 6566 2042 4f4f )...{.#ifdef BOO │ │ │ -0007b770: 5354 5f4e 4f5f 4558 4345 5054 494f 4e53 ST_NO_EXCEPTIONS │ │ │ -0007b780: 0a09 0909 2870 7472 5f2e 6765 7428 292d ....(ptr_.get()- │ │ │ -0007b790: 2667 743b 2a48 616e 646c 6572 2928 7374 >*Handler)(st │ │ │ -0007b7a0: 643a 3a66 6f72 7761 7264 266c 743b 4126 d::forward<A& │ │ │ -0007b7b0: 6774 3b28 6129 2e2e 2e29 3b0a 2365 6c73 gt;(a)...);.#els │ │ │ -0007b7c0: 650a 0909 0974 7279 0a09 0909 7b0a 0909 e....try....{... │ │ │ -0007b7d0: 0909 2870 7472 5f2e 6765 7428 292d 2667 ..(ptr_.get()-&g │ │ │ -0007b7e0: 743b 2a48 616e 646c 6572 2928 7374 643a t;*Handler)(std: │ │ │ -0007b7f0: 3a66 6f72 7761 7264 266c 743b 4126 6774 :forward<A> │ │ │ -0007b800: 3b28 6129 2e2e 2e29 3b0a 0909 097d 0a09 ;(a)...);....}.. │ │ │ -0007b810: 0909 6361 7463 6820 2873 7973 7465 6d5f ..catch (system_ │ │ │ -0007b820: 6572 726f 7220 636f 6e73 7426 616d 703b error const& │ │ │ -0007b830: 2065 290a 0909 097b 0a09 0909 0928 7074 e)....{.....(pt │ │ │ -0007b840: 725f 2e67 6574 2829 2d26 6774 3b2a 4572 r_.get()->*Er │ │ │ -0007b850: 726f 7248 616e 646c 6572 2928 652e 636f rorHandler)(e.co │ │ │ -0007b860: 6465 2829 293b 0a09 0909 7d0a 0909 0963 de());....}....c │ │ │ -0007b870: 6174 6368 2028 7374 643a 3a65 7863 6570 atch (std::excep │ │ │ -0007b880: 7469 6f6e 2063 6f6e 7374 2661 6d70 3b20 tion const& │ │ │ -0007b890: 6529 0a09 0909 7b0a 0909 0909 2870 7472 e)....{.....(ptr │ │ │ -0007b8a0: 5f2e 6765 7428 292d 2667 743b 2a45 7863 _.get()->*Exc │ │ │ -0007b8b0: 6570 7448 616e 646c 6572 2928 6529 3b0a eptHandler)(e);. │ │ │ -0007b8c0: 0909 097d 0a3c 2f70 7265 3e3c 2f74 643e ...}.
    │ │ │ -0007b8d0: 3c2f 7472 3e3c 7472 2073 7479 6c65 3d22 relevance& │ │ │ -0007b900: 6e62 7370 3b30 3c2f 7464 3e3c 7464 3e3c nbsp;0< │ │ │ -0007b910: 6120 6872 6566 3d22 6a61 7661 7363 7269 a href="javascri │ │ │ -0007b920: 7074 3a65 7870 616e 6428 3237 3929 223e pt:expand(279)"> │ │ │ -0007b930: 2e2e 2f69 6e63 6c75 6465 2f6c 6962 746f ../include/libto │ │ │ -0007b940: 7272 656e 742f 6175 785f 2f6d 6572 6b6c rrent/aux_/merkl │ │ │ -0007b950: 655f 7472 6565 2e68 7070 3a38 353c 2f61 e_tree.hpp:85remove │ │ │ -0007b970: 2074 6869 7320 636f 6e73 7472 7563 746f this constructo │ │ │ -0007b980: 722e 2044 6f6e 2774 2073 7570 706f 7274 r. Don't support │ │ │ -0007b990: 2022 756e 696e 6974 6961 6c69 7a65 6422 "uninitialized" │ │ │ -0007b9a0: 2074 7265 6573 2e20 5468 6973 2061 6c73 trees. This als │ │ │ -0007b9b0: 6f20 7265 7175 6972 6573 206e 6f74 2063 o requires not c │ │ │ -0007b9c0: 6f6e 7374 7275 6374 696e 6720 7468 6573 onstructing thes │ │ │ -0007b9d0: 6520 666f 7220 7061 642d 6669 6c65 7320 e for pad-files │ │ │ -0007b9e0: 616e 6420 736d 616c 6c20 6669 6c65 7320 and small files │ │ │ -0007b9f0: 6173 2077 656c 6c2e 2053 6f2c 2061 2073 as well. So, a s │ │ │ -0007ba00: 7061 7273 6520 6861 7368 206c 6973 7420 parse hash list │ │ │ -0007ba10: 696e 2074 6f72 7265 6e74 5f69 6e66 6f3c in torrent_info< │ │ │ -0007ba20: 2f74 643e 3c2f 7472 3e3c 7472 2069 643d /td>

    rem │ │ │ -0007ba70: 6f76 6520 7468 6973 2063 6f6e 7374 7275 ove this constru │ │ │ -0007ba80: 6374 6f72 2e20 446f 6e27 7420 7375 7070 ctor. Don't supp │ │ │ -0007ba90: 6f72 7420 2275 6e69 6e69 7469 616c 697a ort "uninitializ │ │ │ -0007baa0: 6564 2220 7472 6565 732e 2054 6869 730a ed" trees. This. │ │ │ -0007bab0: 616c 736f 2072 6571 7569 7265 7320 6e6f also requires no │ │ │ -0007bac0: 7420 636f 6e73 7472 7563 7469 6e67 2074 t constructing t │ │ │ -0007bad0: 6865 7365 2066 6f72 2070 6164 2d66 696c hese for pad-fil │ │ │ -0007bae0: 6573 2061 6e64 2073 6d61 6c6c 2066 696c es and small fil │ │ │ -0007baf0: 6573 2061 730a 7765 6c6c 2e20 536f 2c20 es as.well. So, │ │ │ -0007bb00: 6120 7370 6172 7365 2068 6173 6820 6c69 a sparse hash li │ │ │ -0007bb10: 7374 2069 6e20 746f 7272 656e 745f 696e st in torrent_in │ │ │ -0007bb20: 666f 3c2f 6832 3e3c 6834 3e2e 2e2f 696e fo

    ../in │ │ │ -0007bb30: 636c 7564 652f 6c69 6274 6f72 7265 6e74 clude/libtorrent │ │ │ -0007bb40: 2f61 7578 5f2f 6d65 726b 6c65 5f74 7265 /aux_/merkle_tre │ │ │ -0007bb50: 652e 6870 703a 3835 3c2f 6834 3e3c 7072 e.hpp:85

    // The in │ │ │ -0007bba0: 7661 7269 616e 7420 6f66 2074 6865 2074 variant of the t │ │ │ -0007bbb0: 7265 6520 6973 2074 6861 7420 616c 6c20 ree is that all │ │ │ -0007bbc0: 696e 7465 7269 6f72 206e 6f64 6573 2028 interior nodes ( │ │ │ -0007bbd0: 692e 652e 2061 6c6c 2062 7574 2074 6865 i.e. all but the │ │ │ -0007bbe0: 2076 6572 790a 2f2f 2062 6f74 746f 6d20 very.// bottom │ │ │ -0007bbf0: 6c65 6166 206e 6f64 6573 2c20 7265 7072 leaf nodes, repr │ │ │ -0007bc00: 6573 656e 7469 6e67 2062 6c6f 636b 2068 esenting block h │ │ │ -0007bc10: 6173 6865 7329 2061 7265 2065 6974 6865 ashes) are eithe │ │ │ -0007bc20: 7220 7365 7420 616e 6420 7661 6c69 642c r set and valid, │ │ │ -0007bc30: 206f 720a 2f2f 2063 6c65 6172 2e20 4e6f or.// clear. No │ │ │ -0007bc40: 2069 6e76 616c 6964 2068 6173 6865 7320 invalid hashes │ │ │ -0007bc50: 6172 6520 616c 6c6f 7765 642c 2061 6e64 are allowed, and │ │ │ -0007bc60: 2074 6865 7920 6361 6e20 6f6e 6c79 2062 they can only b │ │ │ -0007bc70: 6520 6164 6465 6420 6279 2061 6c73 6f0a e added by also. │ │ │ -0007bc80: 2f2f 2070 726f 7669 6469 6e67 2070 726f // providing pro │ │ │ -0007bc90: 6f66 206f 6620 6265 696e 6720 7661 6c69 of of being vali │ │ │ -0007bca0: 642e 0a0a 2f2f 2054 6865 206c 6561 6620 d...// The leaf │ │ │ -0007bcb0: 626c 6f63 6b73 206f 6e20 7468 6520 6f74 blocks on the ot │ │ │ -0007bcc0: 6865 7220 6861 6e64 2c20 4d41 5920 6265 her hand, MAY be │ │ │ -0007bcd0: 2069 6e76 616c 6964 2e20 466f 7220 696e invalid. For in │ │ │ -0007bce0: 7374 616e 6365 2c20 7768 656e 2061 6464 stance, when add │ │ │ -0007bcf0: 696e 670a 2f2f 2061 206d 6167 6e65 7420 ing.// a magnet │ │ │ -0007bd00: 6c69 6e6b 2066 6f72 2061 2074 6f72 7265 link for a torre │ │ │ -0007bd10: 6e74 2074 6861 7420 7765 2061 6c72 6561 nt that we alrea │ │ │ -0007bd20: 6479 2068 6176 6520 6669 6c65 7320 666f dy have files fo │ │ │ -0007bd30: 722e 204f 6e63 6520 7765 2068 6176 6520 r. Once we have │ │ │ -0007bd40: 7468 650a 2f2f 206d 6574 6164 6174 612c the.// metadata, │ │ │ -0007bd50: 2077 6520 6861 7665 2066 696c 6573 206f we have files o │ │ │ -0007bd60: 6e20 6469 736b 2062 7574 206e 6f20 6861 n disk but no ha │ │ │ -0007bd70: 7368 6573 2e20 5765 2077 6f6e 2774 206b shes. We won't k │ │ │ -0007bd80: 6e6f 7720 7768 6574 6865 7220 7468 6520 now whether the │ │ │ -0007bd90: 6461 7461 0a2f 2f20 6f6e 2064 6973 6b20 data.// on disk │ │ │ -0007bda0: 6973 2076 616c 6964 206f 7220 6e6f 742c is valid or not, │ │ │ -0007bdb0: 2075 6e74 696c 2077 6527 7665 2064 6f77 until we've dow │ │ │ -0007bdc0: 6e6c 6f61 6465 6420 7468 6520 6861 7368 nloaded the hash │ │ │ -0007bdd0: 6573 2074 6f20 7661 6c69 6461 7465 2074 es to validate t │ │ │ -0007bde0: 6865 6d2e 0a0a 2f2f 2049 6465 6120 666f hem...// Idea fo │ │ │ -0007bdf0: 7220 6675 7475 7265 2073 7061 6365 206f r future space o │ │ │ -0007be00: 7074 696d 697a 6174 696f 6e3a 0a2f 2f20 ptimization:.// │ │ │ -0007be10: 7768 696c 6520 646f 776e 6c6f 6164 696e while downloadin │ │ │ -0007be20: 672c 2077 6520 6e65 6564 2074 6f20 7374 g, we need to st │ │ │ -0007be30: 6f72 6520 696e 7465 7269 6f72 206e 6f64 ore interior nod │ │ │ -0007be40: 6573 206f 6620 7468 6973 2074 7265 652e es of this tree. │ │ │ -0007be50: 2048 6f77 6576 6572 2c20 7765 0a2f 2f20 However, we.// │ │ │ -0007be60: 646f 6e27 7420 6e65 6564 2074 6f20 7374 don't need to st │ │ │ -0007be70: 6f72 6520 7468 6520 7061 6464 696e 672e ore the padding. │ │ │ -0007be80: 2061 2053 4841 2d32 3536 2069 7320 3332 a SHA-256 is 32 │ │ │ -0007be90: 2062 7974 6573 2e20 496e 7374 6561 6420 bytes. Instead │ │ │ -0007bea0: 6f66 2073 746f 7269 6e67 0a2f 2f20 7468 of storing.// th │ │ │ -0007beb0: 6520 6675 6c6c 2028 7061 6464 6564 2920 e full (padded) │ │ │ -0007bec0: 7472 6565 206f 6620 5348 412d 3235 3620 tree of SHA-256 │ │ │ -0007bed0: 6861 7368 6573 2c20 7374 6f72 6520 7468 hashes, store th │ │ │ -0007bee0: 6520 6675 6c6c 2074 7265 6520 6f66 2033 e full tree of 3 │ │ │ -0007bef0: 3220 6269 740a 2f2f 2073 6967 6e65 6420 2 bit.// signed │ │ │ -0007bf00: 696e 7465 6765 7273 2c20 6265 696e 6720 integers, being │ │ │ -0007bf10: 696e 6469 6365 7320 696e 746f 2074 6865 indices into the │ │ │ -0007bf20: 2061 6374 7561 6c20 7374 6f72 6167 6520 actual storage │ │ │ -0007bf30: 666f 7220 7468 6520 7472 6565 2e20 5765 for the tree. We │ │ │ -0007bf40: 2063 6f75 6c64 0a2f 2f20 6576 656e 2067 could.// even g │ │ │ -0007bf50: 726f 7720 7468 6520 7374 6f72 6167 6520 row the storage │ │ │ -0007bf60: 6c61 7a69 6c79 2e20 496e 7374 6561 6420 lazily. Instead │ │ │ -0007bf70: 6f66 2073 746f 7269 6e67 2074 6865 2070 of storing the p │ │ │ -0007bf80: 6164 6469 6e67 2068 6173 6865 732c 2075 adding hashes, u │ │ │ -0007bf90: 7365 0a2f 2f20 6e65 6761 7469 7665 2069 se.// negative i │ │ │ -0007bfa0: 6e64 6963 6573 2074 6f20 7265 6665 7220 ndices to refer │ │ │ -0007bfb0: 746f 2066 6978 6564 2053 4841 2d32 3536 to fixed SHA-256 │ │ │ -0007bfc0: 2830 292c 2061 6e64 2053 4841 2d32 3536 (0), and SHA-256 │ │ │ -0007bfd0: 2853 4841 2d32 3536 2830 2929 2061 6e64 (SHA-256(0)) and │ │ │ -0007bfe0: 2073 6f0a 2f2f 206f 6e0a 7374 7275 6374 so.// on.struct │ │ │ -0007bff0: 2054 4f52 5245 4e54 5f45 5854 5241 5f45 TORRENT_EXTRA_E │ │ │ -0007c000: 5850 4f52 5420 6d65 726b 6c65 5f74 7265 XPORT merkle_tre │ │ │ -0007c010: 650a 7b0a 3c64 6976 2073 7479 6c65 3d22 e.{.
    .merkle_tree() │ │ │ -0007c050: 203d 2064 6566 6175 6c74 3b0a 3c2f 6469 = default;..merkle_tree(i │ │ │ -0007c070: 6e74 206e 756d 5f62 6c6f 636b 732c 2069 nt num_blocks, i │ │ │ -0007c080: 6e74 2062 6c6f 636b 735f 7065 725f 7069 nt blocks_per_pi │ │ │ -0007c090: 6563 652c 2063 6861 7220 636f 6e73 742a ece, char const* │ │ │ -0007c0a0: 2072 293b 0a0a 0973 6861 3235 365f 6861 r);...sha256_ha │ │ │ -0007c0b0: 7368 2072 6f6f 7428 2920 636f 6e73 743b sh root() const; │ │ │ -0007c0c0: 0a0a 0976 6f69 6420 6c6f 6164 5f74 7265 ...void load_tre │ │ │ -0007c0d0: 6528 7370 616e 266c 743b 7368 6132 3536 e(span<sha256 │ │ │ -0007c0e0: 5f68 6173 6820 636f 6e73 7426 6774 3b20 _hash const> │ │ │ -0007c0f0: 742c 2073 7464 3a3a 7665 6374 6f72 266c t, std::vector&l │ │ │ -0007c100: 743b 626f 6f6c 2667 743b 2063 6f6e 7374 t;bool> const │ │ │ -0007c110: 2661 6d70 3b20 7665 7269 6669 6564 293b & verified); │ │ │ -0007c120: 0a09 766f 6964 206c 6f61 645f 7370 6172 ..void load_spar │ │ │ -0007c130: 7365 5f74 7265 6528 7370 616e 266c 743b se_tree(span< │ │ │ -0007c140: 7368 6132 3536 5f68 6173 6820 636f 6e73 sha256_hash cons │ │ │ -0007c150: 7426 6774 3b20 742c 2073 7464 3a3a 7665 t> t, std::ve │ │ │ -0007c160: 6374 6f72 266c 743b 626f 6f6c 2667 743b ctor<bool> │ │ │ -0007c170: 2063 6f6e 7374 2661 6d70 3b20 6d61 736b const& mask │ │ │ -0007c180: 0a09 092c 2073 7464 3a3a 7665 6374 6f72 ..., std::vector │ │ │ -0007c190: 266c 743b 626f 6f6c 2667 743b 2063 6f6e <bool> con │ │ │ -0007c1a0: 7374 2661 6d70 3b20 7665 7269 6669 6564 st& verified │ │ │ -0007c1b0: 293b 0a09 766f 6964 206c 6f61 645f 7665 );..void load_ve │ │ │ -0007c1c0: 7269 6669 6564 5f62 6974 7328 7374 643a rified_bits(std: │ │ │ -0007c1d0: 3a76 6563 746f 7226 6c74 3b62 6f6f 6c26 :vector<bool& │ │ │ -0007c1e0: 6774 3b20 636f 6e73 7426 616d 703b 2076 gt; const& v │ │ │ -0007c1f0: 6572 6966 6965 6429 3b0a 0a09 7374 643a erified);...std: │ │ │ -0007c200: 3a73 697a 655f 7420 7369 7a65 2829 2063 :size_t size() c │ │ │ -0007c210: 6f6e 7374 3b0a 0969 6e74 2065 6e64 5f69 onst;..int end_i │ │ │ -0007c220: 6e64 6578 2829 2063 6f6e 7374 207b 2072 ndex() const { r │ │ │ -0007c230: 6574 7572 6e20 696e 7428 7369 7a65 2829 eturn int(size() │ │ │ -0007c240: 293b 207d 0a0a 0962 6f6f 6c20 6861 735f ); }...bool has_ │ │ │ -0007c250: 6e6f 6465 2869 6e74 2069 6478 2920 636f node(int idx) co │ │ │ -0007c260: 6e73 743b 0a0a 0962 6f6f 6c20 636f 6d70 nst;...bool comp │ │ │ -0007c270: 6172 655f 6e6f 6465 2869 6e74 2069 6478 are_node(int idx │ │ │ -0007c280: 2c20 7368 6132 3536 5f68 6173 6820 636f , sha256_hash co │ │ │ -0007c290: 6e73 7426 616d 703b 2068 2920 636f 6e73 nst& h) cons │ │ │ -0007c2a0: 743b 0a0a 0973 6861 3235 365f 6861 7368 t;...sha256_hash │ │ │ -0007c2b0: 206f 7065 7261 746f 725b 5d28 696e 7420 operator[](int │ │ │ -0007c2c0: 6964 7829 2063 6f6e 7374 3b0a 0a09 7374 idx) const;...st │ │ │ -0007c2d0: 643a 3a76 6563 746f 7226 6c74 3b73 6861 d::vector<sha │ │ │ -0007c2e0: 3235 365f 6861 7368 2667 743b 2062 7569 256_hash> bui │ │ │ -0007c2f0: 6c64 5f76 6563 746f 7228 2920 636f 6e73 ld_vector() cons │ │ │ -0007c300: 743b 0a09 7374 643a 3a70 6169 7226 6c74 t;..std::pair< │ │ │ -0007c310: 3b73 7464 3a3a 7665 6374 6f72 266c 743b ;std::vector< │ │ │ -0007c320: 7368 6132 3536 5f68 6173 6826 6774 3b2c sha256_hash>, │ │ │ -0007c330: 2061 7578 3a3a 7665 6374 6f72 266c 743b aux::vector< │ │ │ -0007c340: 626f 6f6c 2667 743b 2667 743b 2062 7569 bool>> bui │ │ │ -0007c350: 6c64 5f73 7061 7273 655f 7665 6374 6f72 ld_sparse_vector │ │ │ -0007c360: 2829 2063 6f6e 7374 3b0a 0a09 2f2f 2067 () const;...// g │ │ │ -0007c370: 6574 2062 6974 7320 696e 6469 6361 7469 et bits indicati │ │ │ -0007c380: 6e67 2069 6620 6561 6368 206c 6561 6620 ng if each leaf │ │ │ -0007c390: 6861 7368 2069 7320 7665 7269 6669 6564 hash is verified │ │ │ -0007c3a0: 0a09 7374 643a 3a76 6563 746f 7226 6c74 ..std::vector< │ │ │ -0007c3b0: 3b62 6f6f 6c26 6774 3b20 7665 7269 6669 ;bool> verifi │ │ │ -0007c3c0: 6564 5f6c 6561 6673 2829 2063 6f6e 7374 ed_leafs() const │ │ │ -0007c3d0: 3b0a 0a09 2f2f 2072 6574 7572 6e73 2074 ;...// returns t │ │ │ -0007c3e0: 7275 6520 6966 2074 6865 2065 6e74 6972 rue if the entir │ │ │ -0007c3f0: 6520 7472 6565 2069 7320 6b6e 6f77 6e20 e tree is known │ │ │ -0007c400: 616e 6420 7665 7269 6669 6564 0a09 626f and verified..bo │ │ │ -0007c410: 6f6c 2069 735f 636f 6d70 6c65 7465 2829 ol is_complete() │ │ │ -0007c420: 2063 6f6e 7374 3b0a 0a09 2f2f 2072 6574 const;...// ret │ │ │ -0007c430: 7572 6e73 2074 7275 6520 6966 2061 6c6c urns true if all │ │ │ -0007c440: 2062 6c6f 636b 2068 6173 6865 7320 696e block hashes in │ │ │ -0007c450: 2074 6865 2073 7065 6369 6669 6564 2072 the specified r │ │ │ -0007c460: 616e 6765 2068 6176 6520 6265 656e 2076 ange have been v │ │ │ -0007c470: 6572 6966 6965 640a 0962 6f6f 6c20 626c erified..bool bl │ │ │ -0007c480: 6f63 6b73 5f76 6572 6966 6965 6428 696e ocks_verified(in │ │ │ -0007c490: 7420 626c 6f63 6b5f 6964 782c 2069 6e74 t block_idx, int │ │ │ -0007c4a0: 206e 756d 5f62 6c6f 636b 7329 2063 6f6e num_blocks) con │ │ │ -0007c4b0: 7374 3b0a 0a3c 2f70 7265 3e3c 2f74 643e st;..
    │ │ │ -0007c4c0: 3c2f 7472 3e3c 7472 2073 7479 6c65 3d22 relevance& │ │ │ -0007c4f0: 6e62 7370 3b30 3c2f 7464 3e3c 7464 3e3c nbsp;0< │ │ │ -0007c500: 6120 6872 6566 3d22 6a61 7661 7363 7269 a href="javascri │ │ │ -0007c510: 7074 3a65 7870 616e 6428 3238 3029 223e pt:expand(280)"> │ │ │ -0007c520: 2e2e 2f69 6e63 6c75 6465 2f6c 6962 746f ../include/libto │ │ │ -0007c530: 7272 656e 742f 6175 785f 2f6d 6572 6b6c rrent/aux_/merkl │ │ │ -0007c540: 655f 7472 6565 2e68 7070 3a31 3735 3c2f e_tree.hpp:175make │ │ │ -0007c560: 7468 6973 2061 2073 7464 3a3a 756e 6971 this a std::uniq │ │ │ -0007c570: 7565 5f70 7472 3c73 6861 3235 365f 6861 ue_ptr< │ │ │ -0007c590: 7472 2069 643d 2232 3830 2220 7374 796c tr id="280" styl │ │ │ -0007c5a0: 653d 2264 6973 706c 6179 3a20 6e6f 6e65 e="display: none │ │ │ -0007c5b0: 3b22 2063 6f6c 7370 616e 3d22 3322 3e3c ;" colspan="3">< │ │ │ -0007c5c0: 7464 2063 6f6c 7370 616e 3d22 3322 3e3c td colspan="3">< │ │ │ -0007c5d0: 6832 3e6d 616b 6520 7468 6973 2061 2073 h2>make this a s │ │ │ -0007c5e0: 7464 3a3a 756e 6971 7565 5f70 7472 3c73 td::unique_ptr

    ../include │ │ │ -0007c610: 2f6c 6962 746f 7272 656e 742f 6175 785f /libtorrent/aux_ │ │ │ -0007c620: 2f6d 6572 6b6c 655f 7472 6565 2e68 7070 /merkle_tree.hpp │ │ │ -0007c630: 3a31 3735 3c2f 6834 3e3c 7072 6520 7374 :175

    ..int blocks_
    │ │ │ -0007c680: 7065 725f 7069 6563 6528 2920 636f 6e73  per_piece() cons
    │ │ │ -0007c690: 7420 7b20 7265 7475 726e 2031 2026 6c74  t { return 1 <
    │ │ │ -0007c6a0: 3b26 6c74 3b20 6d5f 626c 6f63 6b73 5f70  ;< m_blocks_p
    │ │ │ -0007c6b0: 6572 5f70 6965 6365 5f6c 6f67 3b20 7d0a  er_piece_log; }.
    │ │ │ -0007c6c0: 092f 2f20 7468 6520 6e75 6d62 6572 2074  .// the number t
    │ │ │ -0007c6d0: 7265 6520 6c65 7665 6c73 2070 6572 2070  ree levels per p
    │ │ │ -0007c6e0: 6965 6365 2e20 5468 6973 2069 7320 3020  iece. This is 0 
    │ │ │ -0007c6f0: 6966 2074 6865 2062 6c6f 636b 206c 6179  if the block lay
    │ │ │ -0007c700: 6572 2069 7320 616c 736f 0a09 2f2f 2074  er is also..// t
    │ │ │ -0007c710: 6865 2070 6965 6365 206c 6179 6572 2e0a  he piece layer..
    │ │ │ -0007c720: 0969 6e74 2070 6965 6365 5f6c 6576 656c  .int piece_level
    │ │ │ -0007c730: 7328 2920 636f 6e73 7420 7b20 7265 7475  s() const { retu
    │ │ │ -0007c740: 726e 206d 5f62 6c6f 636b 735f 7065 725f  rn m_blocks_per_
    │ │ │ -0007c750: 7069 6563 655f 6c6f 673b 207d 0a0a 0969  piece_log; }...i
    │ │ │ -0007c760: 6e74 2062 6c6f 636b 5f6c 6179 6572 5f73  nt block_layer_s
    │ │ │ -0007c770: 7461 7274 2829 2063 6f6e 7374 3b0a 0969  tart() const;..i
    │ │ │ -0007c780: 6e74 2070 6965 6365 5f6c 6179 6572 5f73  nt piece_layer_s
    │ │ │ -0007c790: 7461 7274 2829 2063 6f6e 7374 3b0a 0969  tart() const;..i
    │ │ │ -0007c7a0: 6e74 206e 756d 5f70 6965 6365 7328 2920  nt num_pieces() 
    │ │ │ -0007c7b0: 636f 6e73 743b 0a09 696e 7420 6e75 6d5f  const;..int num_
    │ │ │ -0007c7c0: 6c65 6166 7328 2920 636f 6e73 743b 0a0a  leafs() const;..
    │ │ │ -0007c7d0: 0976 6f69 6420 6f70 7469 6d69 7a65 5f73  .void optimize_s
    │ │ │ -0007c7e0: 746f 7261 6765 2829 3b0a 0976 6f69 6420  torage();..void 
    │ │ │ -0007c7f0: 6f70 7469 6d69 7a65 5f73 746f 7261 6765  optimize_storage
    │ │ │ -0007c800: 5f70 6965 6365 5f6c 6179 6572 2829 3b0a  _piece_layer();.
    │ │ │ -0007c810: 0976 6f69 6420 616c 6c6f 6361 7465 5f66  .void allocate_f
    │ │ │ -0007c820: 756c 6c28 293b 0a0a 092f 2f20 6120 706f  ull();...// a po
    │ │ │ -0007c830: 696e 7465 7220 746f 2074 6865 2072 6f6f  inter to the roo
    │ │ │ -0007c840: 7420 6861 7368 2066 6f72 2074 6869 7320  t hash for this 
    │ │ │ -0007c850: 6669 6c65 2e0a 0963 6861 7220 636f 6e73  file...char cons
    │ │ │ -0007c860: 742a 206d 5f72 6f6f 7420 3d20 6e75 6c6c  t* m_root = null
    │ │ │ -0007c870: 7074 723b 0a0a 092f 2f20 7468 6973 2069  ptr;...// this i
    │ │ │ -0007c880: 7320 6569 7468 6572 2074 6865 2066 756c  s either the ful
    │ │ │ -0007c890: 6c20 7472 6565 2c20 6f72 2073 6f6d 6520  l tree, or some 
    │ │ │ -0007c8a0: 7370 6172 7365 2072 6570 7265 7365 6e74  sparse represent
    │ │ │ -0007c8b0: 6174 696f 6e20 6f66 2069 742c 0a09 2f2f  ation of it,..//
    │ │ │ -0007c8c0: 2064 6570 656e 6469 6e67 206f 6e20 6d5f   depending on m_
    │ │ │ -0007c8d0: 6d6f 6465 0a3c 6469 7620 7374 796c 653d  mode.
    .aux::vector& │ │ │ -0007c910: 6c74 3b73 6861 3235 365f 6861 7368 2667 lt;sha256_hash&g │ │ │ -0007c920: 743b 206d 5f74 7265 653b 0a3c 2f64 6976 t; m_tree;.
    ..// when the f │ │ │ -0007c940: 756c 6c20 7472 6565 2069 7320 616c 6c6f ull tree is allo │ │ │ -0007c950: 6361 7465 642c 2074 6869 7320 6861 7320 cated, this has │ │ │ -0007c960: 6f6e 6520 6269 7420 666f 7220 6561 6368 one bit for each │ │ │ -0007c970: 2062 6c6f 636b 2068 6173 682e 2061 0a09 block hash. a.. │ │ │ -0007c980: 2f2f 2031 206d 6561 6e73 2077 6520 6861 // 1 means we ha │ │ │ -0007c990: 7665 2076 6572 6966 6965 6420 7468 6520 ve verified the │ │ │ -0007c9a0: 626c 6f63 6b20 6861 7368 2074 6f20 6265 block hash to be │ │ │ -0007c9b0: 2063 6f72 7265 6374 2c20 6f74 6865 7277 correct, otherw │ │ │ -0007c9c0: 6973 6520 7468 6520 626c 6f63 6b0a 092f ise the block../ │ │ │ -0007c9d0: 2f20 6861 7368 206d 6179 2072 6570 7265 / hash may repre │ │ │ -0007c9e0: 7365 6e74 2077 6861 7427 7320 6f6e 2064 sent what's on d │ │ │ -0007c9f0: 6973 6b2c 2062 7574 2077 6520 6861 7665 isk, but we have │ │ │ -0007ca00: 6e27 7420 6265 656e 2061 626c 6520 746f n't been able to │ │ │ -0007ca10: 2076 6572 6966 7920 6974 0a09 2f2f 2079 verify it..// y │ │ │ -0007ca20: 6574 0a09 6269 7466 6965 6c64 206d 5f62 et..bitfield m_b │ │ │ -0007ca30: 6c6f 636b 5f76 6572 6966 6965 643b 0a0a lock_verified;.. │ │ │ -0007ca40: 092f 2f20 6e75 6d62 6572 206f 6620 626c .// number of bl │ │ │ -0007ca50: 6f63 6b73 2069 6e20 7468 6520 6669 6c65 ocks in the file │ │ │ -0007ca60: 2074 6869 7320 7472 6565 2072 6570 7265 this tree repre │ │ │ -0007ca70: 7365 6e74 732e 2054 6865 206e 756d 6265 sents. The numbe │ │ │ -0007ca80: 7220 6f66 206c 6561 6673 2069 6e0a 092f r of leafs in../ │ │ │ -0007ca90: 2f20 7468 6520 7472 6565 2069 7320 726f / the tree is ro │ │ │ -0007caa0: 756e 6465 6420 7570 2074 6f20 616e 2065 unded up to an e │ │ │ -0007cab0: 7665 6e20 706f 7765 7220 6f66 2032 2e0a ven power of 2.. │ │ │ -0007cac0: 0969 6e74 206d 5f6e 756d 5f62 6c6f 636b .int m_num_block │ │ │ -0007cad0: 7320 3d20 303b 0a0a 092f 2f20 7468 6520 s = 0;...// the │ │ │ -0007cae0: 6e75 6d62 6572 206f 6620 626c 6f63 6b73 number of blocks │ │ │ -0007caf0: 2070 6572 2070 6965 6365 2c20 7370 6563 per piece, spec │ │ │ -0007cb00: 6966 6965 6420 6173 2068 6f77 206d 616e ified as how man │ │ │ -0007cb10: 7920 7374 6570 7320 746f 2073 6869 6674 y steps to shift │ │ │ -0007cb20: 0a09 2f2f 2072 6967 6874 2031 2074 6f20 ..// right 1 to │ │ │ -0007cb30: 6765 7420 7468 6520 6e75 6d62 6572 206f get the number o │ │ │ -0007cb40: 6620 626c 6f63 6b73 2069 6e20 6f6e 6520 f blocks in one │ │ │ -0007cb50: 7069 6563 652e 2054 6869 7320 6973 2061 piece. This is a │ │ │ -0007cb60: 2063 6f6d 7061 6374 0a09 2f2f 2072 6570 compact..// rep │ │ │ -0007cb70: 7265 7365 6e74 6174 696f 6e20 7468 6174 resentation that │ │ │ -0007cb80: 2773 2076 616c 6964 2062 6563 6175 7365 's valid because │ │ │ -0007cb90: 2070 6965 6365 7320 6172 6520 616c 7761 pieces are alwa │ │ │ -0007cba0: 7973 2070 6f77 6572 7320 6f66 2032 2e0a ys powers of 2.. │ │ │ -0007cbb0: 092f 2f20 7468 6973 2069 7320 6e65 6365 .// this is nece │ │ │ -0007cbc0: 7373 6172 7920 746f 206b 6e6f 7720 7768 ssary to know wh │ │ │ -0007cbd0: 6963 6820 6c61 7965 7220 696e 2074 6865 ich layer in the │ │ │ -0007cbe0: 2074 7265 6520 7468 6520 7069 6563 6520 tree the piece │ │ │ -0007cbf0: 6c61 7965 7220 6973 2e0a 0973 7464 3a3a layer is...std:: │ │ │ -0007cc00: 7569 6e74 385f 7420 6d5f 626c 6f63 6b73 uint8_t m_blocks │ │ │ -0007cc10: 5f70 6572 5f70 6965 6365 5f6c 6f67 203d _per_piece_log = │ │ │ -0007cc20: 2030 3b0a 0a09 656e 756d 2063 6c61 7373 0;...enum class │ │ │ -0007cc30: 206d 6f64 655f 7420 3a20 7374 643a 3a75 mode_t : std::u │ │ │ -0007cc40: 696e 7438 5f74 0a09 7b0a 0909 2f2f 2061 int8_t..{...// a │ │ │ -0007cc50: 2064 6566 6175 6c74 2063 6f6e 7374 7275 default constru │ │ │ -0007cc60: 6374 6564 2074 7265 6520 6973 2074 7275 cted tree is tru │ │ │ -0007cc70: 6c79 2065 6d70 7479 2e20 4974 2064 6f65 ly empty. It doe │ │ │ -0007cc80: 7320 6e6f 7420 6576 656e 2068 6176 6520 s not even have │ │ │ -0007cc90: 610a 0909 2f2f 2072 6f6f 7420 6861 7368 a...// root hash │ │ │ -0007cca0: 0a09 0975 6e69 6e69 7469 616c 697a 6564 ...uninitialized │ │ │ -0007ccb0: 5f74 7265 652c 0a0a 0909 2f2f 2077 6520 _tree,....// we │ │ │ -0007ccc0: 646f 6e27 7420 6861 7665 2061 6e79 2068 don't have any h │ │ │ -0007ccd0: 6173 6865 7320 696e 2074 6869 7320 7472 ashes in this tr │ │ │ -0007cce0: 6565 2e20 6d5f 7472 6565 2073 686f 756c ee. m_tree shoul │ │ │ -0007ccf0: 6420 6265 2065 6d70 7479 0a09 092f 2f20 d be empty...// │ │ │ -0007cd00: 616e 2065 6d70 7479 2074 7265 6520 7374 an empty tree st │ │ │ -0007cd10: 696c 6c20 616c 7761 7973 2068 6176 6520 ill always have │ │ │ -0007cd20: 7468 6520 726f 6f74 2068 6173 6820 2861 the root hash (a │ │ │ -0007cd30: 7661 696c 6162 6c65 2061 7320 726f 6f74 vailable as root │ │ │ -0007cd40: 2829 290a 0909 656d 7074 795f 7472 6565 ())...empty_tree │ │ │ -0007cd50: 2c0a 0a09 092f 2f20 696e 2074 6869 7320 ,....// in this │ │ │ -0007cd60: 6d6f 6465 2c20 6d5f 7472 6565 2072 6570 mode, m_tree rep │ │ │ -0007cd70: 7265 7365 6e74 7320 7468 6520 6675 6c6c resents the full │ │ │ -0007cd80: 2074 7265 652c 2069 6e63 6c75 6469 6e67 tree, including │ │ │ -0007cd90: 2070 6164 6469 6e67 2e0a 0909 6675 6c6c padding....full │ │ │ -0007cda0: 5f74 7265 652c 0a0a 3c2f 7072 653e 3c2f _tree,..
    relevan │ │ │ -0007cde0: 6365 266e 6273 703b 303c 2f74 643e 3c74 ce 0../include/li │ │ │ -0007ce20: 6274 6f72 7265 6e74 2f61 7578 5f2f 7365 btorrent/aux_/se │ │ │ -0007ce30: 7373 696f 6e5f 696e 7465 7266 6163 652e ssion_interface. │ │ │ -0007ce40: 6870 703a 3231 323c 2f61 3e3c 2f74 643e hpp:212 │ │ │ -0007ce50: 3c74 643e 6974 2077 6f75 6c64 2062 6520 it would be │ │ │ -0007ce60: 6e69 6365 2074 6f20 6e6f 7420 6861 7665 nice to not have │ │ │ -0007ce70: 2074 6869 7320 6265 2070 6172 7420 6f66 this be part of │ │ │ -0007ce80: 2073 6573 7369 6f6e 5f69 6e74 6572 6661 session_interfa │ │ │ -0007ce90: 6365 3c2f 7464 3e3c 2f74 723e 3c74 7220 ce

    │ │ │ -0007cee0: 6974 2077 6f75 6c64 2062 6520 6e69 6365 it would be nice │ │ │ -0007cef0: 2074 6f20 6e6f 7420 6861 7665 2074 6869 to not have thi │ │ │ -0007cf00: 7320 6265 2070 6172 7420 6f66 2073 6573 s be part of ses │ │ │ -0007cf10: 7369 6f6e 5f69 6e74 6572 6661 6365 3c2f sion_interface

    ../includ │ │ │ -0007cf30: 652f 6c69 6274 6f72 7265 6e74 2f61 7578 e/libtorrent/aux │ │ │ -0007cf40: 5f2f 7365 7373 696f 6e5f 696e 7465 7266 _/session_interf │ │ │ -0007cf50: 6163 652e 6870 703a 3231 323c 2f68 343e ace.hpp:212

    │ │ │ -0007cf60: 3c70 7265 2073 7479 6c65 3d22 6261 636b
    ..virt
    │ │ │ -0007cfa0: 7561 6c20 766f 6964 2064 6566 6572 7265  ual void deferre
    │ │ │ -0007cfb0: 645f 7375 626d 6974 5f6a 6f62 7328 2920  d_submit_jobs() 
    │ │ │ -0007cfc0: 3d20 303b 0a0a 0909 7669 7274 7561 6c20  = 0;....virtual 
    │ │ │ -0007cfd0: 7374 643a 3a75 696e 7431 365f 7420 6c69  std::uint16_t li
    │ │ │ -0007cfe0: 7374 656e 5f70 6f72 7428 2920 636f 6e73  sten_port() cons
    │ │ │ -0007cff0: 7420 3d20 303b 0a09 0976 6972 7475 616c  t = 0;...virtual
    │ │ │ -0007d000: 2073 7464 3a3a 7569 6e74 3136 5f74 2073   std::uint16_t s
    │ │ │ -0007d010: 736c 5f6c 6973 7465 6e5f 706f 7274 2829  sl_listen_port()
    │ │ │ -0007d020: 2063 6f6e 7374 203d 2030 3b0a 0a09 0976   const = 0;....v
    │ │ │ -0007d030: 6972 7475 616c 2069 6e74 206c 6973 7465  irtual int liste
    │ │ │ -0007d040: 6e5f 706f 7274 2861 7578 3a3a 7472 616e  n_port(aux::tran
    │ │ │ -0007d050: 7370 6f72 7420 7373 6c2c 2061 6464 7265  sport ssl, addre
    │ │ │ -0007d060: 7373 2063 6f6e 7374 2661 6d70 3b20 6c6f  ss const& lo
    │ │ │ -0007d070: 6361 6c5f 6164 6472 2920 3d20 303b 0a0a  cal_addr) = 0;..
    │ │ │ -0007d080: 0909 7669 7274 7561 6c20 766f 6964 2066  ..virtual void f
    │ │ │ -0007d090: 6f72 5f65 6163 685f 6c69 7374 656e 5f73  or_each_listen_s
    │ │ │ -0007d0a0: 6f63 6b65 7428 7374 643a 3a66 756e 6374  ocket(std::funct
    │ │ │ -0007d0b0: 696f 6e26 6c74 3b76 6f69 6428 6175 783a  ion<void(aux:
    │ │ │ -0007d0c0: 3a6c 6973 7465 6e5f 736f 636b 6574 5f68  :listen_socket_h
    │ │ │ -0007d0d0: 616e 646c 6520 636f 6e73 7426 616d 703b  andle const&
    │ │ │ -0007d0e0: 2926 6774 3b20 6629 203d 2030 3b0a 0a09  )> f) = 0;...
    │ │ │ -0007d0f0: 092f 2f20 6173 6b20 666f 7220 7768 6963  .// ask for whic
    │ │ │ -0007d100: 6820 696e 7465 7266 6163 6520 616e 6420  h interface and 
    │ │ │ -0007d110: 706f 7274 2074 6f20 6269 6e64 206f 7574  port to bind out
    │ │ │ -0007d120: 676f 696e 6720 7065 6572 2063 6f6e 6e65  going peer conne
    │ │ │ -0007d130: 6374 696f 6e73 206f 6e0a 0909 7669 7274  ctions on...virt
    │ │ │ -0007d140: 7561 6c20 7463 703a 3a65 6e64 706f 696e  ual tcp::endpoin
    │ │ │ -0007d150: 7420 6269 6e64 5f6f 7574 676f 696e 675f  t bind_outgoing_
    │ │ │ -0007d160: 736f 636b 6574 2873 6f63 6b65 745f 7479  socket(socket_ty
    │ │ │ -0007d170: 7065 2661 6d70 3b20 732c 2061 6464 7265  pe& s, addre
    │ │ │ -0007d180: 7373 2063 6f6e 7374 2661 6d70 3b0a 0909  ss const&...
    │ │ │ -0007d190: 0972 656d 6f74 655f 6164 6472 6573 732c  .remote_address,
    │ │ │ -0007d1a0: 2065 7272 6f72 5f63 6f64 6526 616d 703b   error_code&
    │ │ │ -0007d1b0: 2065 6329 2063 6f6e 7374 203d 2030 3b0a   ec) const = 0;.
    │ │ │ -0007d1c0: 0909 7669 7274 7561 6c20 626f 6f6c 2076  ..virtual bool v
    │ │ │ -0007d1d0: 6572 6966 795f 626f 756e 645f 6164 6472  erify_bound_addr
    │ │ │ -0007d1e0: 6573 7328 6164 6472 6573 7320 636f 6e73  ess(address cons
    │ │ │ -0007d1f0: 7426 616d 703b 2061 6464 722c 2062 6f6f  t& addr, boo
    │ │ │ -0007d200: 6c20 7574 700a 0909 092c 2065 7272 6f72  l utp...., error
    │ │ │ -0007d210: 5f63 6f64 6526 616d 703b 2065 6329 203d  _code& ec) =
    │ │ │ -0007d220: 2030 3b0a 0a23 6966 6e64 6566 2054 4f52   0;..#ifndef TOR
    │ │ │ -0007d230: 5245 4e54 5f44 4953 4142 4c45 5f4d 5554  RENT_DISABLE_MUT
    │ │ │ -0007d240: 4142 4c45 5f54 4f52 5245 4e54 530a 0909  ABLE_TORRENTS...
    │ │ │ -0007d250: 7669 7274 7561 6c20 7374 643a 3a76 6563  virtual std::vec
    │ │ │ -0007d260: 746f 7226 6c74 3b73 7464 3a3a 7368 6172  tor<std::shar
    │ │ │ -0007d270: 6564 5f70 7472 266c 743b 746f 7272 656e  ed_ptr<torren
    │ │ │ -0007d280: 7426 6774 3b26 6774 3b20 6669 6e64 5f63  t>> find_c
    │ │ │ -0007d290: 6f6c 6c65 6374 696f 6e28 0a09 0909 7374  ollection(....st
    │ │ │ -0007d2a0: 643a 3a73 7472 696e 6720 636f 6e73 7426  d::string const&
    │ │ │ -0007d2b0: 616d 703b 2063 6f6c 6c65 6374 696f 6e29  amp; collection)
    │ │ │ -0007d2c0: 2063 6f6e 7374 203d 2030 3b0a 2365 6e64   const = 0;.#end
    │ │ │ -0007d2d0: 6966 0a0a 3c64 6976 2073 7479 6c65 3d22  if..
    ..virtual prox │ │ │ -0007d310: 795f 7365 7474 696e 6773 2070 726f 7879 y_settings proxy │ │ │ -0007d320: 2829 2063 6f6e 7374 203d 2030 3b0a 3c2f () const = 0;..#if TORRENT │ │ │ -0007d340: 5f55 5345 5f49 3250 0a09 0976 6972 7475 _USE_I2P...virtu │ │ │ -0007d350: 616c 2063 6861 7220 636f 6e73 742a 2069 al char const* i │ │ │ -0007d360: 3270 5f73 6573 7369 6f6e 2829 2063 6f6e 2p_session() con │ │ │ -0007d370: 7374 203d 2030 3b0a 0909 7669 7274 7561 st = 0;...virtua │ │ │ -0007d380: 6c20 7374 643a 3a73 7472 696e 6720 636f l std::string co │ │ │ -0007d390: 6e73 7426 616d 703b 206c 6f63 616c 5f69 nst& local_i │ │ │ -0007d3a0: 3270 5f65 6e64 706f 696e 7428 2920 636f 2p_endpoint() co │ │ │ -0007d3b0: 6e73 7420 3d20 303b 0a23 656e 6469 660a nst = 0;.#endif. │ │ │ -0007d3c0: 0a09 0976 6972 7475 616c 2076 6f69 6420 ...virtual void │ │ │ -0007d3d0: 7072 696f 7269 7469 7a65 5f63 6f6e 6e65 prioritize_conne │ │ │ -0007d3e0: 6374 696f 6e73 2873 7464 3a3a 7765 616b ctions(std::weak │ │ │ -0007d3f0: 5f70 7472 266c 743b 746f 7272 656e 7426 _ptr<torrent& │ │ │ -0007d400: 6774 3b20 7429 203d 2030 3b0a 0a09 0976 gt; t) = 0;....v │ │ │ -0007d410: 6972 7475 616c 2076 6f69 6420 7472 6967 irtual void trig │ │ │ -0007d420: 6765 725f 6175 746f 5f6d 616e 6167 6528 ger_auto_manage( │ │ │ -0007d430: 2920 3d20 303b 0a0a 0909 7669 7274 7561 ) = 0;....virtua │ │ │ -0007d440: 6c20 766f 6964 2061 7070 6c79 5f73 6574 l void apply_set │ │ │ -0007d450: 7469 6e67 735f 7061 636b 2873 7464 3a3a tings_pack(std:: │ │ │ -0007d460: 7368 6172 6564 5f70 7472 266c 743b 7365 shared_ptr<se │ │ │ -0007d470: 7474 696e 6773 5f70 6163 6b26 6774 3b20 ttings_pack> │ │ │ -0007d480: 7061 636b 2920 3d20 303b 0a09 0976 6972 pack) = 0;...vir │ │ │ -0007d490: 7475 616c 2073 6573 7369 6f6e 5f73 6574 tual session_set │ │ │ -0007d4a0: 7469 6e67 7320 636f 6e73 7426 616d 703b tings const& │ │ │ -0007d4b0: 2073 6574 7469 6e67 7328 2920 636f 6e73 settings() cons │ │ │ -0007d4c0: 7420 3d20 303b 0a0a 0909 7669 7274 7561 t = 0;....virtua │ │ │ -0007d4d0: 6c20 766f 6964 2071 7565 7565 5f74 7261 l void queue_tra │ │ │ -0007d4e0: 636b 6572 5f72 6571 7565 7374 2874 7261 cker_request(tra │ │ │ -0007d4f0: 636b 6572 5f72 6571 7565 7374 2072 6571 cker_request req │ │ │ -0007d500: 0a09 0909 2c20 7374 643a 3a77 6561 6b5f ...., std::weak_ │ │ │ -0007d510: 7074 7226 6c74 3b72 6571 7565 7374 5f63 ptr<request_c │ │ │ -0007d520: 616c 6c62 6163 6b26 6774 3b20 6329 203d allback> c) = │ │ │ -0007d530: 2030 3b0a 0a09 092f 2f20 7065 6572 2d63 0;....// peer-c │ │ │ -0007d540: 6c61 7373 6573 0a09 0976 6972 7475 616c lasses...virtual │ │ │ -0007d550: 2076 6f69 6420 7365 745f 7065 6572 5f63 void set_peer_c │ │ │ -0007d560: 6c61 7373 6573 2870 6565 725f 636c 6173 lasses(peer_clas │ │ │ -0007d570: 735f 7365 742a 2073 2c20 6164 6472 6573 s_set* s, addres │ │ │ -0007d580: 7320 636f 6e73 7426 616d 703b 2061 2c20 s const& a, │ │ │ -0007d590: 736f 636b 6574 5f74 7970 655f 7420 7374 socket_type_t st │ │ │ -0007d5a0: 2920 3d20 303b 0a09 0976 6972 7475 616c ) = 0;...virtual │ │ │ -0007d5b0: 2070 6565 725f 636c 6173 735f 706f 6f6c peer_class_pool │ │ │ -0007d5c0: 2063 6f6e 7374 2661 6d70 3b20 7065 6572 const& peer │ │ │ -0007d5d0: 5f63 6c61 7373 6573 2829 2063 6f6e 7374 _classes() const │ │ │ -0007d5e0: 203d 2030 3b0a 0909 7669 7274 7561 6c20 = 0;...virtual │ │ │ -0007d5f0: 7065 6572 5f63 6c61 7373 5f70 6f6f 6c26 peer_class_pool& │ │ │ -0007d600: 616d 703b 2070 6565 725f 636c 6173 7365 amp; peer_classe │ │ │ -0007d610: 7328 2920 3d20 303b 0a09 0976 6972 7475 s() = 0;...virtu │ │ │ -0007d620: 616c 2062 6f6f 6c20 6967 6e6f 7265 5f75 al bool ignore_u │ │ │ -0007d630: 6e63 686f 6b65 5f73 6c6f 7473 5f73 6574 nchoke_slots_set │ │ │ -0007d640: 2870 6565 725f 636c 6173 735f 7365 7420 (peer_class_set │ │ │ -0007d650: 636f 6e73 7426 616d 703b 2073 6574 2920 const& set) │ │ │ -0007d660: 636f 6e73 7420 3d20 303b 0a09 0976 6972 const = 0;...vir │ │ │ -0007d670: 7475 616c 2069 6e74 2063 6f70 795f 7065 tual int copy_pe │ │ │ -0007d680: 7274 696e 656e 745f 6368 616e 6e65 6c73 rtinent_channels │ │ │ -0007d690: 2870 6565 725f 636c 6173 735f 7365 7420 (peer_class_set │ │ │ -0007d6a0: 636f 6e73 7426 616d 703b 2073 6574 0a09 const& set.. │ │ │ -0007d6b0: 0909 2c20 696e 7420 6368 616e 6e65 6c2c .., int channel, │ │ │ -0007d6c0: 2062 616e 6477 6964 7468 5f63 6861 6e6e bandwidth_chann │ │ │ -0007d6d0: 656c 2a2a 2064 7374 2c20 696e 7420 6d29 el** dst, int m) │ │ │ -0007d6e0: 203d 2030 3b0a 0909 7669 7274 7561 6c20 = 0;...virtual │ │ │ -0007d6f0: 696e 7420 7573 655f 7175 6f74 615f 6f76 int use_quota_ov │ │ │ -0007d700: 6572 6865 6164 2870 6565 725f 636c 6173 erhead(peer_clas │ │ │ -0007d710: 735f 7365 7426 616d 703b 2073 6574 2c20 s_set& set, │ │ │ -0007d720: 696e 7420 616d 6f75 6e74 5f64 6f77 6e2c int amount_down, │ │ │ -0007d730: 2069 6e74 2061 6d6f 756e 745f 7570 2920 int amount_up) │ │ │ -0007d740: 3d20 303b 0a0a 0909 7669 7274 7561 6c20 = 0;....virtual │ │ │ -0007d750: 6261 6e64 7769 6474 685f 6d61 6e61 6765 bandwidth_manage │ │ │ -0007d760: 722a 2067 6574 5f62 616e 6477 6964 7468 r* get_bandwidth │ │ │ -0007d770: 5f6d 616e 6167 6572 2869 6e74 2063 6861 _manager(int cha │ │ │ -0007d780: 6e6e 656c 2920 3d20 303b 0a0a 0909 7669 nnel) = 0;....vi │ │ │ -0007d790: 7274 7561 6c20 766f 6964 2073 656e 745f rtual void sent_ │ │ │ -0007d7a0: 6279 7465 7328 696e 7420 6279 7465 735f bytes(int bytes_ │ │ │ -0007d7b0: 7061 796c 6f61 642c 2069 6e74 2062 7974 payload, int byt │ │ │ -0007d7c0: 6573 5f70 726f 746f 636f 6c29 203d 2030 es_protocol) = 0 │ │ │ -0007d7d0: 3b0a 0909 7669 7274 7561 6c20 766f 6964 ;...virtual void │ │ │ -0007d7e0: 2072 6563 6569 7665 645f 6279 7465 7328 received_bytes( │ │ │ -0007d7f0: 696e 7420 6279 7465 735f 7061 796c 6f61 int bytes_payloa │ │ │ -0007d800: 642c 2069 6e74 2062 7974 6573 5f70 726f d, int bytes_pro │ │ │ -0007d810: 746f 636f 6c29 203d 2030 3b0a 0909 7669 tocol) = 0;...vi │ │ │ -0007d820: 7274 7561 6c20 766f 6964 2074 7261 6e63 rtual void tranc │ │ │ -0007d830: 6965 7665 5f69 705f 7061 636b 6574 2869 ieve_ip_packet(i │ │ │ -0007d840: 6e74 2062 7974 6573 2c20 626f 6f6c 2069 nt bytes, bool i │ │ │ -0007d850: 7076 3629 203d 2030 3b0a 3c2f 7072 653e pv6) = 0;.
    │ │ │ -0007d860: 3c2f 7464 3e3c 2f74 723e 3c74 7220 7374 relev │ │ │ -0007d890: 616e 6365 266e 6273 703b 303c 2f74 643e ance 0 │ │ │ -0007d8a0: 3c74 643e 3c61 2068 7265 663d 226a 6176 ../include/ │ │ │ -0007d8d0: 6c69 6274 6f72 7265 6e74 2f61 7578 5f2f libtorrent/aux_/ │ │ │ -0007d8e0: 6465 7072 6563 6174 6564 2e68 7070 3a34 deprecated.hpp:4 │ │ │ -0007d8f0: 373c 2f61 3e3c 2f74 643e 3c74 643e 6669 7fi │ │ │ -0007d900: 6775 7265 206f 7574 2077 6869 6368 2076 gure out which v │ │ │ -0007d910: 6572 7369 6f6e 206f 6620 636c 616e 6720 ersion of clang │ │ │ -0007d920: 7468 6973 2069 7320 7375 7070 6f72 7465 this is supporte │ │ │ -0007d930: 6420 696e 3c2f 7464 3e3c 2f74 723e 3c74 d infigure out whi │ │ │ -0007d990: 6368 2076 6572 7369 6f6e 206f 6620 636c ch version of cl │ │ │ -0007d9a0: 616e 6720 7468 6973 2069 7320 7375 7070 ang this is supp │ │ │ -0007d9b0: 6f72 7465 6420 696e 3c2f 6832 3e3c 6834 orted in

    ../include/libt │ │ │ -0007d9d0: 6f72 7265 6e74 2f61 7578 5f2f 6465 7072 orrent/aux_/depr │ │ │ -0007d9e0: 6563 6174 6564 2e68 7070 3a34 373c 2f68 ecated.hpp:47
    CONT
    │ │ │ -0007da30: 5241 4354 2c20 5354 5249 4354 204c 4941  RACT, STRICT LIA
    │ │ │ -0007da40: 4249 4c49 5459 2c20 4f52 2054 4f52 5420  BILITY, OR TORT 
    │ │ │ -0007da50: 2849 4e43 4c55 4449 4e47 204e 4547 4c49  (INCLUDING NEGLI
    │ │ │ -0007da60: 4745 4e43 4520 4f52 204f 5448 4552 5749  GENCE OR OTHERWI
    │ │ │ -0007da70: 5345 290a 4152 4953 494e 4720 494e 2041  SE).ARISING IN A
    │ │ │ -0007da80: 4e59 2057 4159 204f 5554 204f 4620 5448  NY WAY OUT OF TH
    │ │ │ -0007da90: 4520 5553 4520 4f46 2054 4849 5320 534f  E USE OF THIS SO
    │ │ │ -0007daa0: 4654 5741 5245 2c20 4556 454e 2049 4620  FTWARE, EVEN IF 
    │ │ │ -0007dab0: 4144 5649 5345 4420 4f46 2054 4845 0a50  ADVISED OF THE.P
    │ │ │ -0007dac0: 4f53 5349 4249 4c49 5459 204f 4620 5355  OSSIBILITY OF SU
    │ │ │ -0007dad0: 4348 2044 414d 4147 452e 0a0a 2a2f 0a0a  CH DAMAGE...*/..
    │ │ │ -0007dae0: 2369 666e 6465 6620 544f 5252 454e 545f  #ifndef TORRENT_
    │ │ │ -0007daf0: 4445 5052 4543 4154 4544 5f48 5050 5f49  DEPRECATED_HPP_I
    │ │ │ -0007db00: 4e43 4c55 4445 440a 2364 6566 696e 6520  NCLUDED.#define 
    │ │ │ -0007db10: 544f 5252 454e 545f 4445 5052 4543 4154  TORRENT_DEPRECAT
    │ │ │ -0007db20: 4544 5f48 5050 5f49 4e43 4c55 4445 440a  ED_HPP_INCLUDED.
    │ │ │ -0007db30: 0a23 6966 2021 6465 6669 6e65 6420 544f  .#if !defined TO
    │ │ │ -0007db40: 5252 454e 545f 4255 494c 4449 4e47 5f4c  RRENT_BUILDING_L
    │ │ │ -0007db50: 4942 5241 5259 0a23 2064 6566 696e 6520  IBRARY.# define 
    │ │ │ -0007db60: 544f 5252 454e 545f 4445 5052 4543 4154  TORRENT_DEPRECAT
    │ │ │ -0007db70: 4544 205b 5b64 6570 7265 6361 7465 645d  ED [[deprecated]
    │ │ │ -0007db80: 5d0a 2365 6c73 650a 2320 6465 6669 6e65  ].#else.# define
    │ │ │ -0007db90: 2054 4f52 5245 4e54 5f44 4550 5245 4341   TORRENT_DEPRECA
    │ │ │ -0007dba0: 5445 440a 2365 6e64 6966 0a0a 2369 6620  TED.#endif..#if 
    │ │ │ -0007dbb0: 6465 6669 6e65 6420 5f5f 636c 616e 675f  defined __clang_
    │ │ │ -0007dbc0: 5f0a 0a2f 2f20 3d3d 3d3d 3d3d 2043 4c41  _..// ====== CLA
    │ │ │ -0007dbd0: 4e47 203d 3d3d 3d3d 3d3d 3d0a 0a23 2069  NG ========..# i
    │ │ │ -0007dbe0: 6620 2164 6566 696e 6564 2054 4f52 5245  f !defined TORRE
    │ │ │ -0007dbf0: 4e54 5f42 5549 4c44 494e 475f 4c49 4252  NT_BUILDING_LIBR
    │ │ │ -0007dc00: 4152 590a 3c64 6976 2073 7479 6c65 3d22  ARY.
    # define TORR │ │ │ -0007dc40: 454e 545f 4445 5052 4543 4154 4544 5f45 ENT_DEPRECATED_E │ │ │ -0007dc50: 4e55 4d20 5f5f 6174 7472 6962 7574 655f NUM __attribute_ │ │ │ -0007dc60: 5f20 2828 6465 7072 6563 6174 6564 2929 _ ((deprecated)) │ │ │ -0007dc70: 0a3c 2f64 6976 3e23 2065 6e64 6966 0a0a .
    # endif.. │ │ │ -0007dc80: 2365 6c69 6620 6465 6669 6e65 6420 5f5f #elif defined __ │ │ │ -0007dc90: 474e 5543 5f5f 0a0a 2f2f 203d 3d3d 3d3d GNUC__..// ===== │ │ │ -0007dca0: 3d3d 3d20 4743 4320 3d3d 3d3d 3d3d 3d3d === GCC ======== │ │ │ -0007dcb0: 0a0a 2f2f 2064 6570 7265 6361 7469 6f6e ..// deprecation │ │ │ -0007dcc0: 206d 6172 6b75 7020 6973 206f 6e6c 7920 markup is only │ │ │ -0007dcd0: 656e 6162 6c65 6420 7768 656e 206c 6962 enabled when lib │ │ │ -0007dce0: 746f 7272 656e 740a 2f2f 2068 6561 6465 torrent.// heade │ │ │ -0007dcf0: 7273 2061 7265 2069 6e63 6c75 6465 6420 rs are included │ │ │ -0007dd00: 6279 2063 6c69 656e 7473 2c20 6e6f 7420 by clients, not │ │ │ -0007dd10: 7768 696c 6520 6275 696c 6469 6e67 0a2f while building./ │ │ │ -0007dd20: 2f20 6c69 6274 6f72 7265 6e74 2069 7473 / libtorrent its │ │ │ -0007dd30: 656c 660a 2320 6966 205f 5f47 4e55 435f elf.# if __GNUC_ │ │ │ -0007dd40: 5f20 2667 743b 3d20 3620 2661 6d70 3b26 _ >= 6 && │ │ │ -0007dd50: 616d 703b 2021 6465 6669 6e65 6420 544f amp; !defined TO │ │ │ -0007dd60: 5252 454e 545f 4255 494c 4449 4e47 5f4c RRENT_BUILDING_L │ │ │ -0007dd70: 4942 5241 5259 0a23 2020 6465 6669 6e65 IBRARY.# define │ │ │ -0007dd80: 2054 4f52 5245 4e54 5f44 4550 5245 4341 TORRENT_DEPRECA │ │ │ -0007dd90: 5445 445f 454e 554d 205f 5f61 7474 7269 TED_ENUM __attri │ │ │ -0007dda0: 6275 7465 5f5f 2028 2864 6570 7265 6361 bute__ ((depreca │ │ │ -0007ddb0: 7465 6429 290a 2320 656e 6469 660a 0a23 ted)).# endif..# │ │ │ -0007ddc0: 656e 6469 660a 0a23 6966 6e64 6566 2054 endif..#ifndef T │ │ │ -0007ddd0: 4f52 5245 4e54 5f44 4550 5245 4341 5445 ORRENT_DEPRECATE │ │ │ -0007dde0: 445f 454e 554d 0a23 6465 6669 6e65 2054 D_ENUM.#define T │ │ │ -0007ddf0: 4f52 5245 4e54 5f44 4550 5245 4341 5445 ORRENT_DEPRECATE │ │ │ -0007de00: 445f 454e 554d 0a23 656e 6469 660a 0a23 D_ENUM.#endif..# │ │ │ -0007de10: 656e 6469 660a 3c2f 7072 653e 3c2f 7464 endif.
    relevance │ │ │ -0007de50: 266e 6273 703b 303c 2f74 643e 3c74 643e  0 │ │ │ -0007de60: 3c61 2068 7265 663d 226a 6176 6173 6372 ../include/libt │ │ │ -0007de90: 6f72 7265 6e74 2f61 7578 5f2f 706f 6f6c orrent/aux_/pool │ │ │ -0007dea0: 2e68 7070 3a35 333c 2f61 3e3c 2f74 643e .hpp:53 │ │ │ -0007deb0: 3c74 643e 656e 7375 7265 2074 6865 2061 ensure the a │ │ │ -0007dec0: 6c69 676e 6d65 6e74 2069 7320 676f 6f64 lignment is good │ │ │ -0007ded0: 2068 6572 653c 2f74 643e 3c2f 7472 3e3c here< │ │ │ -0007dee0: 7472 2069 643d 2232 3833 2220 7374 796c tr id="283" styl │ │ │ -0007def0: 653d 2264 6973 706c 6179 3a20 6e6f 6e65 e="display: none │ │ │ -0007df00: 3b22 2063 6f6c 7370 616e 3d22 3322 3e3c ;" colspan="3">< │ │ │ -0007df10: 7464 2063 6f6c 7370 616e 3d22 3322 3e3c td colspan="3">< │ │ │ -0007df20: 6832 3e65 6e73 7572 6520 7468 6520 616c h2>ensure the al │ │ │ -0007df30: 6967 6e6d 656e 7420 6973 2067 6f6f 6420 ignment is good │ │ │ -0007df40: 6865 7265 3c2f 6832 3e3c 6834 3e2e 2e2f here

    ../ │ │ │ -0007df50: 696e 636c 7564 652f 6c69 6274 6f72 7265 include/libtorre │ │ │ -0007df60: 6e74 2f61 7578 5f2f 706f 6f6c 2e68 7070 nt/aux_/pool.hpp │ │ │ -0007df70: 3a35 333c 2f68 343e 3c70 7265 2073 7479 :53

    #ifndef TORREN
    │ │ │ -0007dfc0: 545f 504f 4f4c 5f48 5050 0a23 6465 6669  T_POOL_HPP.#defi
    │ │ │ -0007dfd0: 6e65 2054 4f52 5245 4e54 5f50 4f4f 4c5f  ne TORRENT_POOL_
    │ │ │ -0007dfe0: 4850 500a 0a23 696e 636c 7564 6520 226c  HPP..#include "l
    │ │ │ -0007dff0: 6962 746f 7272 656e 742f 6173 7365 7274  ibtorrent/assert
    │ │ │ -0007e000: 2e68 7070 220a 0a23 696e 636c 7564 6520  .hpp"..#include 
    │ │ │ -0007e010: 226c 6962 746f 7272 656e 742f 6175 785f  "libtorrent/aux_
    │ │ │ -0007e020: 2f64 6973 6162 6c65 5f77 6172 6e69 6e67  /disable_warning
    │ │ │ -0007e030: 735f 7075 7368 2e68 7070 220a 2369 6e63  s_push.hpp".#inc
    │ │ │ -0007e040: 6c75 6465 2026 6c74 3b62 6f6f 7374 2f70  lude <boost/p
    │ │ │ -0007e050: 6f6f 6c2f 706f 6f6c 2e68 7070 2667 743b  ool/pool.hpp>
    │ │ │ -0007e060: 0a23 696e 636c 7564 6520 226c 6962 746f  .#include "libto
    │ │ │ -0007e070: 7272 656e 742f 6175 785f 2f64 6973 6162  rrent/aux_/disab
    │ │ │ -0007e080: 6c65 5f77 6172 6e69 6e67 735f 706f 702e  le_warnings_pop.
    │ │ │ -0007e090: 6870 7022 0a0a 2369 6e63 6c75 6465 2026  hpp"..#include &
    │ │ │ -0007e0a0: 6c74 3b63 7374 6464 6566 2667 743b 0a23  lt;cstddef>.#
    │ │ │ -0007e0b0: 696e 636c 7564 6520 266c 743b 6e65 7726  include <new&
    │ │ │ -0007e0c0: 6774 3b20 2f2f 2066 6f72 2070 6c61 6365  gt; // for place
    │ │ │ -0007e0d0: 6d65 6e74 206e 6577 0a0a 6e61 6d65 7370  ment new..namesp
    │ │ │ -0007e0e0: 6163 6520 6c69 6274 6f72 7265 6e74 207b  ace libtorrent {
    │ │ │ -0007e0f0: 0a6e 616d 6573 7061 6365 2061 7578 207b  .namespace aux {
    │ │ │ -0007e100: 0a0a 7374 7275 6374 2061 6c6c 6f63 6174  ..struct allocat
    │ │ │ -0007e110: 6f72 5f6e 6577 5f64 656c 6574 650a 7b0a  or_new_delete.{.
    │ │ │ -0007e120: 0975 7369 6e67 2073 697a 655f 7479 7065  .using size_type
    │ │ │ -0007e130: 203d 2073 7464 3a3a 7369 7a65 5f74 3b0a   = std::size_t;.
    │ │ │ -0007e140: 0975 7369 6e67 2064 6966 6665 7265 6e63  .using differenc
    │ │ │ -0007e150: 655f 7479 7065 203d 2073 7464 3a3a 7074  e_type = std::pt
    │ │ │ -0007e160: 7264 6966 665f 743b 0a0a 3c64 6976 2073  rdiff_t;..
    .static │ │ │ -0007e1a0: 6368 6172 2a20 6d61 6c6c 6f63 2873 697a char* malloc(siz │ │ │ -0007e1b0: 655f 7479 7065 2063 6f6e 7374 2062 7974 e_type const byt │ │ │ -0007e1c0: 6573 290a 3c2f 6469 763e 097b 2072 6574 es).
    .{ ret │ │ │ -0007e1d0: 7572 6e20 6e65 7720 6368 6172 5b62 7974 urn new char[byt │ │ │ -0007e1e0: 6573 5d3b 207d 0a09 7374 6174 6963 2076 es]; }..static v │ │ │ -0007e1f0: 6f69 6420 6672 6565 2863 6861 722a 2063 oid free(char* c │ │ │ -0007e200: 6f6e 7374 2062 6c6f 636b 290a 097b 2064 onst block)..{ d │ │ │ -0007e210: 656c 6574 6520 5b5d 2062 6c6f 636b 3b20 elete [] block; │ │ │ -0007e220: 7d0a 7d3b 0a0a 7573 696e 6720 706f 6f6c }.};..using pool │ │ │ -0007e230: 203d 2062 6f6f 7374 3a3a 706f 6f6c 266c = boost::pool&l │ │ │ -0007e240: 743b 616c 6c6f 6361 746f 725f 6e65 775f t;allocator_new_ │ │ │ -0007e250: 6465 6c65 7465 2667 743b 3b0a 0a2f 2f20 delete>;..// │ │ │ -0007e260: 4c69 6b65 2062 6f6f 7374 3a3a 6f62 6a65 Like boost::obje │ │ │ -0007e270: 6374 5f70 6f6f 6c20 6275 7420 7573 6573 ct_pool but uses │ │ │ -0007e280: 2075 6e6f 7264 6572 6564 2066 7265 6528 unordered free( │ │ │ -0007e290: 2920 7261 7468 6572 2074 6861 6e20 7468 ) rather than th │ │ │ -0007e2a0: 650a 2f2f 204f 284e 2920 6f72 6465 7265 e.// O(N) ordere │ │ │ -0007e2b0: 645f 6672 6565 2829 2074 6861 7420 626f d_free() that bo │ │ │ -0007e2c0: 6f73 743a 3a6f 626a 6563 745f 706f 6f6c ost::object_pool │ │ │ -0007e2d0: 3a3a 6465 7374 726f 7928 2920 7265 6c69 ::destroy() reli │ │ │ -0007e2e0: 6573 206f 6e2e 0a2f 2f20 5468 6520 706f es on..// The po │ │ │ -0007e2f0: 6f6c 2069 7473 656c 6620 646f 6573 206e ol itself does n │ │ │ -0007e300: 6f74 2074 7261 636b 206f 7574 7374 616e ot track outstan │ │ │ -0007e310: 6469 6e67 2061 6c6c 6f63 6174 696f 6e73 ding allocations │ │ │ -0007e320: 2c20 736f 2063 616c 6c65 7273 0a2f 2f20 , so callers.// │ │ │ -0007e330: 6d75 7374 2064 6573 7472 6f79 2829 2065 must destroy() e │ │ │ -0007e340: 7665 7279 206f 626a 6563 7420 6265 666f very object befo │ │ │ -0007e350: 7265 2074 6865 2070 6f6f 6c20 6973 2064 re the pool is d │ │ │ -0007e360: 6573 7472 6f79 6564 2e0a 7465 6d70 6c61 estroyed..templa │ │ │ -0007e370: 7465 2026 6c74 3b74 7970 656e 616d 6520 te <typename │ │ │ -0007e380: 5426 6774 3b0a 7374 7275 6374 206f 626a T>.struct obj │ │ │ -0007e390: 6563 745f 706f 6f6c 0a7b 0a09 6f62 6a65 ect_pool.{..obje │ │ │ -0007e3a0: 6374 5f70 6f6f 6c28 2920 3a20 6d5f 706f ct_pool() : m_po │ │ │ -0007e3b0: 6f6c 2873 697a 656f 6628 5429 2920 7b7d ol(sizeof(T)) {} │ │ │ -0007e3c0: 0a09 6f62 6a65 6374 5f70 6f6f 6c28 6f62 ..object_pool(ob │ │ │ -0007e3d0: 6a65 6374 5f70 6f6f 6c20 636f 6e73 7426 ject_pool const& │ │ │ -0007e3e0: 616d 703b 2920 3d20 6465 6c65 7465 3b0a amp;) = delete;. │ │ │ -0007e3f0: 096f 626a 6563 745f 706f 6f6c 2661 6d70 .object_pool& │ │ │ -0007e400: 3b20 6f70 6572 6174 6f72 3d28 6f62 6a65 ; operator=(obje │ │ │ -0007e410: 6374 5f70 6f6f 6c20 636f 6e73 7426 616d ct_pool const&am │ │ │ -0007e420: 703b 2920 3d20 6465 6c65 7465 3b0a 0a09 p;) = delete;... │ │ │ -0007e430: 542a 2063 6f6e 7374 7275 6374 2829 0a09 T* construct().. │ │ │ -0007e440: 7b0a 0909 766f 6964 2a20 636f 6e73 7420 {...void* const │ │ │ -0007e450: 7374 6f72 6167 6520 3d20 6d5f 706f 6f6c storage = m_pool │ │ │ -0007e460: 2e6d 616c 6c6f 6328 293b 0a09 0974 7279 .malloc();...try │ │ │ -0007e470: 0a09 097b 0a09 0909 7265 7475 726e 206e ...{....return n │ │ │ -0007e480: 6577 2028 7374 6f72 6167 6529 2054 2829 ew (storage) T() │ │ │ -0007e490: 3b0a 0909 7d0a 0909 6361 7463 6820 282e ;...}...catch (. │ │ │ -0007e4a0: 2e2e 290a 0909 7b0a 0909 096d 5f70 6f6f ..)...{....m_poo │ │ │ -0007e4b0: 6c2e 6672 6565 2873 746f 7261 6765 293b l.free(storage); │ │ │ -0007e4c0: 0a09 0909 7468 726f 773b 0a09 097d 0a3c ....throw;...}.< │ │ │ -0007e4d0: 2f70 7265 3e3c 2f74 643e 3c2f 7472 3e3c /pre>< │ │ │ -0007e4e0: 7472 2073 7479 6c65 3d22 6261 636b 6772 tr style="backgr │ │ │ -0007e4f0: 6f75 6e64 3a20 2363 6363 223e 3c74 643e ound: #ccc"> │ │ │ -0007e500: 7265 6c65 7661 6e63 6526 6e62 7370 3b30 relevance 0 │ │ │ -0007e510: 3c2f 7464 3e3c 7464 3e3c 6120 6872 6566 ../inc │ │ │ -0007e540: 6c75 6465 2f6c 6962 746f 7272 656e 742f lude/libtorrent/ │ │ │ -0007e550: 6175 785f 2f75 7470 5f73 7472 6561 6d2e aux_/utp_stream. │ │ │ -0007e560: 6870 703a 3639 333c 2f61 3e3c 2f74 643e hpp:693 │ │ │ -0007e570: 3c74 643e 6974 2077 6f75 6c64 2062 6520 it would be │ │ │ -0007e580: 6e69 6365 2074 6f20 6d61 6b65 2074 6869 nice to make thi │ │ │ -0007e590: 7320 7072 6976 6174 653c 2f74 643e 3c2f s private

    it would │ │ │ -0007e5f0: 6265 206e 6963 6520 746f 206d 616b 6520 be nice to make │ │ │ -0007e600: 7468 6973 2070 7269 7661 7465 3c2f 6832 this private

    ../include/ │ │ │ -0007e620: 6c69 6274 6f72 7265 6e74 2f61 7578 5f2f libtorrent/aux_/ │ │ │ -0007e630: 7574 705f 7374 7265 616d 2e68 7070 3a36 utp_stream.hpp:6 │ │ │ -0007e640: 3933 3c2f 6834 3e3c 7072 6520 7374 796c 93

    .bool consume_i
    │ │ │ -0007e690: 6e63 6f6d 696e 675f 6461 7461 280a 0909  ncoming_data(...
    │ │ │ -0007e6a0: 7574 705f 6865 6164 6572 2063 6f6e 7374  utp_header const
    │ │ │ -0007e6b0: 2a20 7068 2c20 7374 643a 3a75 696e 7438  * ph, std::uint8
    │ │ │ -0007e6c0: 5f74 2063 6f6e 7374 2a20 7074 722c 2069  _t const* ptr, i
    │ │ │ -0007e6d0: 6e74 2070 6179 6c6f 6164 5f73 697a 652c  nt payload_size,
    │ │ │ -0007e6e0: 2074 696d 655f 706f 696e 7420 6e6f 7729   time_point now)
    │ │ │ -0007e6f0: 3b0a 0976 6f69 6420 7570 6461 7465 5f6d  ;..void update_m
    │ │ │ -0007e700: 7475 5f6c 696d 6974 7328 293b 0a09 766f  tu_limits();..vo
    │ │ │ -0007e710: 6964 2065 7870 6572 6965 6e63 6564 5f6c  id experienced_l
    │ │ │ -0007e720: 6f73 7328 7374 643a 3a75 696e 7433 325f  oss(std::uint32_
    │ │ │ -0007e730: 7420 7365 715f 6e72 2c20 7469 6d65 5f70  t seq_nr, time_p
    │ │ │ -0007e740: 6f69 6e74 206e 6f77 293b 0a0a 0976 6f69  oint now);...voi
    │ │ │ -0007e750: 6420 7365 6e64 5f64 6566 6572 7265 645f  d send_deferred_
    │ │ │ -0007e760: 6163 6b28 293b 0a09 766f 6964 2073 6f63  ack();..void soc
    │ │ │ -0007e770: 6b65 745f 6472 6169 6e65 6428 293b 0a0a  ket_drained();..
    │ │ │ -0007e780: 0976 6f69 6420 7365 745f 7573 6572 6461  .void set_userda
    │ │ │ -0007e790: 7461 2875 7470 5f73 7472 6561 6d2a 2073  ta(utp_stream* s
    │ │ │ -0007e7a0: 2920 7b20 6d5f 7573 6572 6461 7461 203d  ) { m_userdata =
    │ │ │ -0007e7b0: 2073 3b20 7d0a 0976 6f69 6420 6162 6f72   s; }..void abor
    │ │ │ -0007e7c0: 7428 293b 0a09 7564 703a 3a65 6e64 706f  t();..udp::endpo
    │ │ │ -0007e7d0: 696e 7420 7265 6d6f 7465 5f65 6e64 706f  int remote_endpo
    │ │ │ -0007e7e0: 696e 7428 2920 636f 6e73 743b 0a0a 0973  int() const;...s
    │ │ │ -0007e7f0: 7464 3a3a 7569 6e74 3136 5f74 2072 6563  td::uint16_t rec
    │ │ │ -0007e800: 6569 7665 5f69 6428 2920 636f 6e73 7420  eive_id() const 
    │ │ │ -0007e810: 7b20 7265 7475 726e 206d 5f72 6563 765f  { return m_recv_
    │ │ │ -0007e820: 6964 3b20 7d0a 0962 6f6f 6c20 6d61 7463  id; }..bool matc
    │ │ │ -0007e830: 6828 7564 703a 3a65 6e64 706f 696e 7420  h(udp::endpoint 
    │ │ │ -0007e840: 636f 6e73 7426 616d 703b 2065 702c 2073  const& ep, s
    │ │ │ -0007e850: 7464 3a3a 7569 6e74 3136 5f74 2069 6429  td::uint16_t id)
    │ │ │ -0007e860: 2063 6f6e 7374 3b0a 0a09 2f2f 206e 6f6e   const;...// non
    │ │ │ -0007e870: 2d63 6f70 7961 626c 650a 0975 7470 5f73  -copyable..utp_s
    │ │ │ -0007e880: 6f63 6b65 745f 696d 706c 2875 7470 5f73  ocket_impl(utp_s
    │ │ │ -0007e890: 6f63 6b65 745f 696d 706c 2063 6f6e 7374  ocket_impl const
    │ │ │ -0007e8a0: 2661 6d70 3b29 203d 2064 656c 6574 653b  &) = delete;
    │ │ │ -0007e8b0: 0a09 7574 705f 736f 636b 6574 5f69 6d70  ..utp_socket_imp
    │ │ │ -0007e8c0: 6c20 636f 6e73 7426 616d 703b 206f 7065  l const& ope
    │ │ │ -0007e8d0: 7261 746f 723d 2875 7470 5f73 6f63 6b65  rator=(utp_socke
    │ │ │ -0007e8e0: 745f 696d 706c 2063 6f6e 7374 2661 6d70  t_impl const&
    │ │ │ -0007e8f0: 3b29 203d 2064 656c 6574 653b 0a0a 092f  ;) = delete;.../
    │ │ │ -0007e900: 2f20 5468 6520 756e 6465 726c 7969 6e67  / The underlying
    │ │ │ -0007e910: 2055 4450 2073 6f63 6b65 7420 7468 6973   UDP socket this
    │ │ │ -0007e920: 2075 5450 2073 6f63 6b65 7420 6973 2062   uTP socket is b
    │ │ │ -0007e930: 6f75 6e64 2074 6f0a 3c64 6976 2073 7479  ound to.
    .std::weak │ │ │ -0007e970: 5f70 7472 266c 743b 7574 705f 736f 636b _ptr<utp_sock │ │ │ -0007e980: 6574 5f69 6e74 6572 6661 6365 2667 743b et_interface> │ │ │ -0007e990: 206d 5f73 6f63 6b3b 0a3c 2f64 6976 3e0a m_sock;.
    . │ │ │ -0007e9a0: 0976 6f69 6420 6164 645f 7772 6974 655f .void add_write_ │ │ │ -0007e9b0: 6275 6666 6572 2876 6f69 6420 636f 6e73 buffer(void cons │ │ │ -0007e9c0: 742a 2062 7566 2c20 696e 7420 6c65 6e29 t* buf, int len) │ │ │ -0007e9d0: 3b0a 0976 6f69 6420 6164 645f 7265 6164 ;..void add_read │ │ │ -0007e9e0: 5f62 7566 6665 7228 766f 6964 2a20 6275 _buffer(void* bu │ │ │ -0007e9f0: 662c 2069 6e74 206c 656e 293b 0a0a 0969 f, int len);...i │ │ │ -0007ea00: 6e74 2073 656e 645f 6465 6c61 7928 2920 nt send_delay() │ │ │ -0007ea10: 636f 6e73 7420 7b20 7265 7475 726e 206d const { return m │ │ │ -0007ea20: 5f73 656e 645f 6465 6c61 793b 207d 0a09 _send_delay; }.. │ │ │ -0007ea30: 696e 7420 7265 6376 5f64 656c 6179 2829 int recv_delay() │ │ │ -0007ea40: 2063 6f6e 7374 207b 2072 6574 7572 6e20 const { return │ │ │ -0007ea50: 6d5f 7265 6376 5f64 656c 6179 3b20 7d0a m_recv_delay; }. │ │ │ -0007ea60: 0a09 766f 6964 2069 7373 7565 5f72 6561 ..void issue_rea │ │ │ -0007ea70: 6428 293b 0a09 766f 6964 2069 7373 7565 d();..void issue │ │ │ -0007ea80: 5f77 7269 7465 2829 3b0a 0976 6f69 6420 _write();..void │ │ │ -0007ea90: 7375 6273 6372 6962 655f 7772 6974 6561 subscribe_writea │ │ │ -0007eaa0: 626c 6528 293b 0a0a 0962 6f6f 6c20 6368 ble();...bool ch │ │ │ -0007eab0: 6563 6b5f 6669 6e5f 7365 6e74 2829 2063 eck_fin_sent() c │ │ │ -0007eac0: 6f6e 7374 3b0a 0a09 766f 6964 2064 6f5f onst;...void do_ │ │ │ -0007ead0: 636f 6e6e 6563 7428 7463 703a 3a65 6e64 connect(tcp::end │ │ │ -0007eae0: 706f 696e 7420 636f 6e73 7426 616d 703b point const& │ │ │ -0007eaf0: 2065 7029 3b0a 0a09 7374 643a 3a73 697a ep);...std::siz │ │ │ -0007eb00: 655f 7420 7265 6164 5f73 6f6d 6528 626f e_t read_some(bo │ │ │ -0007eb10: 6f6c 2063 6f6e 7374 2063 6c65 6172 5f62 ol const clear_b │ │ │ -0007eb20: 7566 6665 7273 2c20 6572 726f 725f 636f uffers, error_co │ │ │ -0007eb30: 6465 2661 6d70 3b20 6563 293b 0a09 7374 de& ec);..st │ │ │ -0007eb40: 643a 3a73 697a 655f 7420 7772 6974 655f d::size_t write_ │ │ │ -0007eb50: 736f 6d65 2862 6f6f 6c20 636f 6e73 7420 some(bool const │ │ │ -0007eb60: 636c 6561 725f 6275 6666 6572 7329 3b20 clear_buffers); │ │ │ -0007eb70: 2f2f 2057 6172 6e69 6e67 3a20 6e6f 6e2d // Warning: non- │ │ │ -0007eb80: 626c 6f63 6b69 6e67 0a09 696e 7420 7265 blocking..int re │ │ │ -0007eb90: 6365 6976 655f 6275 6666 6572 5f73 697a ceive_buffer_siz │ │ │ -0007eba0: 6528 2920 636f 6e73 7420 7b20 7265 7475 e() const { retu │ │ │ -0007ebb0: 726e 206d 5f72 6563 6569 7665 5f62 7566 rn m_receive_buf │ │ │ -0007ebc0: 6665 725f 7369 7a65 3b20 7d0a 0a09 626f fer_size; }...bo │ │ │ -0007ebd0: 6f6c 206e 756c 6c5f 6275 6666 6572 7328 ol null_buffers( │ │ │ -0007ebe0: 2920 636f 6e73 7420 7b20 7265 7475 726e ) const { return │ │ │ -0007ebf0: 206d 5f6e 756c 6c5f 6275 6666 6572 733b m_null_buffers; │ │ │ -0007ec00: 207d 0a0a 7072 6976 6174 653a 0a0a 092f }..private:.../ │ │ │ -0007ec10: 2f20 6974 2773 2069 6d70 6f72 7461 6e74 / it's important │ │ │ -0007ec20: 2074 6861 7420 7468 6573 6520 6d61 7463 that these matc │ │ │ -0007ec30: 6820 7468 6520 656e 756d 7320 696e 2070 h the enums in p │ │ │ -0007ec40: 6572 666f 726d 616e 6365 5f63 6f75 6e74 erformance_count │ │ │ -0007ec50: 6572 7320 666f 720a 092f 2f20 6e75 6d5f ers for..// num_ │ │ │ -0007ec60: 7574 705f 6964 6c65 2065 7463 2e0a 0965 utp_idle etc...e │ │ │ -0007ec70: 6e75 6d20 636c 6173 7320 7374 6174 655f num class state_ │ │ │ -0007ec80: 7420 7b0a 0909 2f2f 206e 6f74 2079 6574 t {...// not yet │ │ │ -0007ec90: 2063 6f6e 6e65 6374 6564 0a09 096e 6f6e connected...non │ │ │ -0007eca0: 652c 0a09 092f 2f20 7365 6e74 2061 2073 e,...// sent a s │ │ │ -0007ecb0: 796e 2070 6163 6b65 742c 206e 6f74 2072 yn packet, not r │ │ │ -0007ecc0: 6563 6569 7665 6420 616e 7920 6163 6b73 eceived any acks │ │ │ -0007ecd0: 0a09 0973 796e 5f73 656e 742c 0a3c 2f70 ...syn_sent,.

    re │ │ │ -0007ed10: 6c65 7661 6e63 6526 6e62 7370 3b30 3c2f levance 0../inclu │ │ │ -0007ed50: 6465 2f6c 6962 746f 7272 656e 742f 6175 de/libtorrent/au │ │ │ -0007ed60: 785f 2f61 6e6e 6f75 6e63 655f 656e 7472 x_/announce_entr │ │ │ -0007ed70: 792e 6870 703a 3734 3c2f 613e 3c2f 7464 y.hpp:74include the │ │ │ -0007ed90: 206e 756d 6265 7220 6f66 2070 6565 7273 number of peers │ │ │ -0007eda0: 2072 6563 6569 7665 6420 6672 6f6d 2074 received from t │ │ │ -0007edb0: 6869 7320 7472 6163 6b65 722c 2061 7420 his tracker, at │ │ │ -0007edc0: 6c61 7374 2061 6e6e 6f75 6e63 653c 2f74 last announce

    inclu │ │ │ -0007ee20: 6465 2074 6865 206e 756d 6265 7220 6f66 de the number of │ │ │ -0007ee30: 2070 6565 7273 2072 6563 6569 7665 6420 peers received │ │ │ -0007ee40: 6672 6f6d 2074 6869 7320 7472 6163 6b65 from this tracke │ │ │ -0007ee50: 722c 2061 7420 6c61 7374 0a61 6e6e 6f75 r, at last.annou │ │ │ -0007ee60: 6e63 653c 2f68 323e 3c68 343e 2e2e 2f69 nce

    ../i │ │ │ -0007ee70: 6e63 6c75 6465 2f6c 6962 746f 7272 656e nclude/libtorren │ │ │ -0007ee80: 742f 6175 785f 2f61 6e6e 6f75 6e63 655f t/aux_/announce_ │ │ │ -0007ee90: 656e 7472 792e 6870 703a 3734 3c2f 6834 entry.hpp:74

    names
    │ │ │ -0007eee0: 7061 6365 2061 7578 207b 0a0a 0973 7472  pace aux {...str
    │ │ │ -0007eef0: 7563 7420 544f 5252 454e 545f 4558 5452  uct TORRENT_EXTR
    │ │ │ -0007ef00: 415f 4558 504f 5254 2061 6e6e 6f75 6e63  A_EXPORT announc
    │ │ │ -0007ef10: 655f 696e 666f 6861 7368 0a09 7b0a 0909  e_infohash..{...
    │ │ │ -0007ef20: 616e 6e6f 756e 6365 5f69 6e66 6f68 6173  announce_infohas
    │ │ │ -0007ef30: 6828 293b 0a0a 0909 2f2f 2069 6620 7468  h();....// if th
    │ │ │ -0007ef40: 6973 2074 7261 636b 6572 2068 6173 2072  is tracker has r
    │ │ │ -0007ef50: 6574 7572 6e65 6420 616e 2065 7272 6f72  eturned an error
    │ │ │ -0007ef60: 206f 7220 7761 726e 696e 6720 6d65 7373   or warning mess
    │ │ │ -0007ef70: 6167 650a 0909 2f2f 2074 6861 7420 6d65  age...// that me
    │ │ │ -0007ef80: 7373 6167 6520 6973 2073 746f 7265 6420  ssage is stored 
    │ │ │ -0007ef90: 6865 7265 0a09 0973 7464 3a3a 7374 7269  here...std::stri
    │ │ │ -0007efa0: 6e67 206d 6573 7361 6765 3b0a 0a09 092f  ng message;..../
    │ │ │ -0007efb0: 2f20 6966 2074 6869 7320 7472 6163 6b65  / if this tracke
    │ │ │ -0007efc0: 7220 6661 696c 6564 2074 6865 206c 6173  r failed the las
    │ │ │ -0007efd0: 7420 7469 6d65 2069 7420 7761 7320 636f  t time it was co
    │ │ │ -0007efe0: 6e74 6163 7465 640a 0909 2f2f 2074 6869  ntacted...// thi
    │ │ │ -0007eff0: 7320 6572 726f 7220 636f 6465 2073 7065  s error code spe
    │ │ │ -0007f000: 6369 6669 6573 2077 6861 7420 6572 726f  cifies what erro
    │ │ │ -0007f010: 7220 6f63 6375 7272 6564 0a09 0965 7272  r occurred...err
    │ │ │ -0007f020: 6f72 5f63 6f64 6520 6c61 7374 5f65 7272  or_code last_err
    │ │ │ -0007f030: 6f72 3b0a 0a09 092f 2f20 7468 6520 7469  or;....// the ti
    │ │ │ -0007f040: 6d65 206f 6620 6e65 7874 2074 7261 636b  me of next track
    │ │ │ -0007f050: 6572 2061 6e6e 6f75 6e63 650a 0909 7469  er announce...ti
    │ │ │ -0007f060: 6d65 5f70 6f69 6e74 3332 206e 6578 745f  me_point32 next_
    │ │ │ -0007f070: 616e 6e6f 756e 6365 203d 2028 7469 6d65  announce = (time
    │ │ │ -0007f080: 5f70 6f69 6e74 3332 3a3a 6d69 6e29 2829  _point32::min)()
    │ │ │ -0007f090: 3b0a 0a09 092f 2f20 6e6f 2061 6e6e 6f75  ;....// no annou
    │ │ │ -0007f0a0: 6e63 6573 2062 6566 6f72 6520 7468 6973  nces before this
    │ │ │ -0007f0b0: 2074 696d 650a 0909 7469 6d65 5f70 6f69   time...time_poi
    │ │ │ -0007f0c0: 6e74 3332 206d 696e 5f61 6e6e 6f75 6e63  nt32 min_announc
    │ │ │ -0007f0d0: 6520 3d20 2874 696d 655f 706f 696e 7433  e = (time_point3
    │ │ │ -0007f0e0: 323a 3a6d 696e 2928 293b 0a0a 3c64 6976  2::min)();..
    .
    ..// these are │ │ │ -0007f130: 6569 7468 6572 202d 3120 6f72 2074 6865 either -1 or the │ │ │ -0007f140: 2073 6372 6170 6520 696e 666f 726d 6174 scrape informat │ │ │ -0007f150: 696f 6e20 7468 6973 2074 7261 636b 6572 ion this tracker │ │ │ -0007f160: 206c 6173 740a 0909 2f2f 2072 6573 706f last...// respo │ │ │ -0007f170: 6e64 6564 2077 6974 682e 202a 696e 636f nded with. *inco │ │ │ -0007f180: 6d70 6c65 7465 2a20 6973 2074 6865 2063 mplete* is the c │ │ │ -0007f190: 7572 7265 6e74 206e 756d 6265 7220 6f66 urrent number of │ │ │ -0007f1a0: 2064 6f77 6e6c 6f61 6465 7273 2069 6e0a downloaders in. │ │ │ -0007f1b0: 0909 2f2f 2074 6865 2073 7761 726d 2c20 ..// the swarm, │ │ │ -0007f1c0: 2a63 6f6d 706c 6574 652a 2069 7320 7468 *complete* is th │ │ │ -0007f1d0: 6520 6375 7272 656e 7420 6e75 6d62 6572 e current number │ │ │ -0007f1e0: 206f 6620 7365 6564 7320 696e 2074 6865 of seeds in the │ │ │ -0007f1f0: 2073 7761 726d 2061 6e64 0a09 092f 2f20 swarm and...// │ │ │ -0007f200: 2a64 6f77 6e6c 6f61 6465 642a 2069 7320 *downloaded* is │ │ │ -0007f210: 7468 6520 6375 6d75 6c61 7469 7665 206e the cumulative n │ │ │ -0007f220: 756d 6265 7220 6f66 2063 6f6d 706c 6574 umber of complet │ │ │ -0007f230: 6564 2064 6f77 6e6c 6f61 6473 206f 6620 ed downloads of │ │ │ -0007f240: 7468 6973 0a09 092f 2f20 746f 7272 656e this...// torren │ │ │ -0007f250: 742c 2073 696e 6365 2074 6865 2062 6567 t, since the beg │ │ │ -0007f260: 696e 6e69 6e67 206f 6620 7469 6d65 2028 inning of time ( │ │ │ -0007f270: 6672 6f6d 2074 6869 7320 7472 6163 6b65 from this tracke │ │ │ -0007f280: 7227 7320 706f 696e 7420 6f66 0a09 092f r's point of.../ │ │ │ -0007f290: 2f20 7669 6577 292e 0a0a 0909 2f2f 2069 / view).....// i │ │ │ -0007f2a0: 6620 7468 6973 2074 7261 636b 6572 2068 f this tracker h │ │ │ -0007f2b0: 6173 2072 6574 7572 6e65 6420 7363 7261 as returned scra │ │ │ -0007f2c0: 7065 2064 6174 612c 2074 6865 7365 2066 pe data, these f │ │ │ -0007f2d0: 6965 6c64 7320 6172 6520 6669 6c6c 6564 ields are filled │ │ │ -0007f2e0: 2069 6e0a 0909 2f2f 2077 6974 6820 7661 in...// with va │ │ │ -0007f2f0: 6c69 6420 6e75 6d62 6572 732e 204f 7468 lid numbers. Oth │ │ │ -0007f300: 6572 7769 7365 2074 6865 7920 6172 6520 erwise they are │ │ │ -0007f310: 7365 7420 746f 202d 312e 2060 6069 6e63 set to -1. ``inc │ │ │ -0007f320: 6f6d 706c 6574 6560 6020 636f 756e 7473 omplete`` counts │ │ │ -0007f330: 0a09 092f 2f20 7468 6520 6e75 6d62 6572 ...// the number │ │ │ -0007f340: 206f 6620 6375 7272 656e 7420 646f 776e of current down │ │ │ -0007f350: 6c6f 6164 6572 732e 2060 6063 6f6d 706c loaders. ``compl │ │ │ -0007f360: 6574 6560 6020 636f 756e 7473 2074 6865 ete`` counts the │ │ │ -0007f370: 206e 756d 6265 7220 6f66 0a09 092f 2f20 number of...// │ │ │ -0007f380: 6375 7272 656e 7420 7065 6572 7320 636f current peers co │ │ │ -0007f390: 6d70 6c65 7465 6420 7468 6520 646f 776e mpleted the down │ │ │ -0007f3a0: 6c6f 6164 2c20 6f72 2022 7365 6564 7322 load, or "seeds" │ │ │ -0007f3b0: 2e20 6060 646f 776e 6c6f 6164 6564 6060 . ``downloaded`` │ │ │ -0007f3c0: 2069 7320 7468 650a 0909 2f2f 2063 756d is the...// cum │ │ │ -0007f3d0: 756c 6174 6976 6520 6e75 6d62 6572 206f ulative number o │ │ │ -0007f3e0: 6620 636f 6d70 6c65 7465 6420 646f 776e f completed down │ │ │ -0007f3f0: 6c6f 6164 732e 0a09 0969 6e74 2073 6372 loads....int scr │ │ │ -0007f400: 6170 655f 696e 636f 6d70 6c65 7465 203d ape_incomplete = │ │ │ -0007f410: 202d 313b 0a09 0969 6e74 2073 6372 6170 -1;...int scrap │ │ │ -0007f420: 655f 636f 6d70 6c65 7465 203d 202d 313b e_complete = -1; │ │ │ -0007f430: 0a09 0969 6e74 2073 6372 6170 655f 646f ...int scrape_do │ │ │ -0007f440: 776e 6c6f 6164 6564 203d 202d 313b 0a0a wnloaded = -1;.. │ │ │ -0007f450: 0909 2f2f 2074 6865 206e 756d 6265 7220 ..// the number │ │ │ -0007f460: 6f66 2074 696d 6573 2069 6e20 6120 726f of times in a ro │ │ │ -0007f470: 7720 7765 2068 6176 6520 6661 696c 6564 w we have failed │ │ │ -0007f480: 2074 6f20 616e 6e6f 756e 6365 2074 6f20 to announce to │ │ │ -0007f490: 7468 6973 0a09 092f 2f20 7472 6163 6b65 this...// tracke │ │ │ -0007f4a0: 722e 0a09 0973 7464 3a3a 7569 6e74 385f r....std::uint8_ │ │ │ -0007f4b0: 7420 6661 696c 7320 3a20 373b 0a0a 0909 t fails : 7;.... │ │ │ -0007f4c0: 2f2f 2074 7275 6520 7768 696c 6520 7765 // true while we │ │ │ -0007f4d0: 2772 6520 7761 6974 696e 6720 666f 7220 're waiting for │ │ │ -0007f4e0: 6120 7265 7370 6f6e 7365 2066 726f 6d20 a response from │ │ │ -0007f4f0: 7468 6520 7472 6163 6b65 722e 0a09 0962 the tracker....b │ │ │ -0007f500: 6f6f 6c20 7570 6461 7469 6e67 203a 2031 ool updating : 1 │ │ │ -0007f510: 3b0a 0a09 092f 2f20 7365 7420 746f 2074 ;....// set to t │ │ │ -0007f520: 7275 6520 7768 656e 2077 6520 6765 7420 rue when we get │ │ │ -0007f530: 6120 7661 6c69 6420 7265 7370 6f6e 7365 a valid response │ │ │ -0007f540: 2066 726f 6d20 616e 2061 6e6e 6f75 6e63 from an announc │ │ │ -0007f550: 650a 0909 2f2f 2077 6974 6820 6576 656e e...// with even │ │ │ -0007f560: 743d 7374 6172 7465 642e 2049 6620 6974 t=started. If it │ │ │ -0007f570: 2069 7320 7365 742c 2077 6520 776f 6e27 is set, we won' │ │ │ -0007f580: 7420 7365 6e64 2073 7461 7274 2069 6e20 t send start in │ │ │ -0007f590: 7468 6520 7375 6273 6571 7565 6e74 0a09 the subsequent.. │ │ │ -0007f5a0: 092f 2f2 TRUNCATED DUE TO SIZE LIMIT: 10485760 bytes