--- /srv/rebuilderd/tmp/rebuilderdGmusbb/inputs/libtorrent-rasterbar-doc_2.0.13-1_all.deb +++ /srv/rebuilderd/tmp/rebuilderdGmusbb/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 1684932 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()
  • │ │ │ │ │ │ │ │ │ @@ -116,32 +116,32 @@ │ │ │ std::vector<char> generate_buf () const; │ │ │ file_storage const& files () const; │ │ │ void set_comment (char const* str); │ │ │ void set_creator (char const* str); │ │ │ void set_creation_date (std::time_t timestamp); │ │ │ void set_hash (piece_index_t index, sha1_hash const& h); │ │ │ void set_hash2 (file_index_t file, piece_index_t::diff_type piece, sha256_hash const& h); │ │ │ - void add_http_seed (string_view url); │ │ │ void add_url_seed (string_view url); │ │ │ + void add_http_seed (string_view url); │ │ │ void add_node (std::pair<std::string, int> node); │ │ │ void add_tracker (string_view url, int tier = 0); │ │ │ void set_root_cert (string_view cert); │ │ │ - bool priv () const; │ │ │ void set_priv (bool p); │ │ │ + bool priv () const; │ │ │ bool is_v1_only () const; │ │ │ bool is_v2_only () const; │ │ │ int num_pieces () const; │ │ │ piece_index_t end_piece () const; │ │ │ index_range<piece_index_t> piece_range () const noexcept; │ │ │ file_index_t end_file () const; │ │ │ index_range<file_index_t> file_range () const noexcept; │ │ │ index_range<piece_index_t::diff_type> file_piece_range (file_index_t f); │ │ │ std::int64_t total_size () const; │ │ │ - int piece_length () const; │ │ │ int piece_size (piece_index_t i) const; │ │ │ + int piece_length () const; │ │ │ void add_collection (string_view c); │ │ │ void add_similar_torrent (sha1_hash ih); │ │ │ │ │ │ static constexpr create_flags_t modification_time = 2_bit; │ │ │ static constexpr create_flags_t symlinks = 3_bit; │ │ │ static constexpr create_flags_t v2_only = 5_bit; │ │ │ static constexpr create_flags_t v1_only = 6_bit; │ │ │ @@ -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.

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

    This function sets an X.509 certificate in PEM format to the torrent. This makes the │ │ │ torrent an SSL torrent. An SSL torrent requires that each peer has a valid certificate │ │ │ signed by this root certificate. For SSL torrents, all peers are connecting over SSL │ │ │ connections. For more information, see the section on ssl torrents.

    │ │ │

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

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

    set_priv() priv()

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

    priv() set_priv()

    │ │ │
    │ │ │ -bool priv () const;
    │ │ │  void set_priv (bool p);
    │ │ │ +bool priv () const;
    │ │ │  
    │ │ │

    Sets and queries the private flag of the torrent. │ │ │ Torrents with the private flag set ask the client to not use any other │ │ │ sources than the tracker for peers, and to not use DHT to advertise itself publicly, │ │ │ only the tracker.

    │ │ │ [report issue]
    │ │ │
    │ │ │ @@ -369,21 +369,21 @@ │ │ │ [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;
    │ │ │ +int piece_length () const;
    │ │ │  
    │ │ │

    piece_length() returns the piece size of all pieces but the │ │ │ last one. piece_size() returns the size of the specified piece. │ │ │ these functions are just forwarding to the associated file_storage.

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

    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,25 +8,25 @@
    │ │ │ │            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 _p_r_i_v_(_)_ _s_e_t___p_r_i_v_(_)
    │ │ │ │            o _n_u_m___p_i_e_c_e_s_(_)
    │ │ │ │            o _p_i_e_c_e___r_a_n_g_e_(_)
    │ │ │ │            o _f_i_l_e___r_a_n_g_e_(_)
    │ │ │ │            o _f_i_l_e___p_i_e_c_e___r_a_n_g_e_(_)
    │ │ │ │            o _t_o_t_a_l___s_i_z_e_(_)
    │ │ │ │ -          o _p_i_e_c_e___s_i_z_e_(_)_ _p_i_e_c_e___l_e_n_g_t_h_(_)
    │ │ │ │ +          o _p_i_e_c_e___l_e_n_g_t_h_(_)_ _p_i_e_c_e___s_i_z_e_(_)
    │ │ │ │            o _a_d_d___s_i_m_i_l_a_r___t_o_r_r_e_n_t_(_)_ _a_d_d___c_o_l_l_e_c_t_i_o_n_(_)
    │ │ │ │      * _a_d_d___f_i_l_e_s_(_)
    │ │ │ │      * _s_e_t___p_i_e_c_e___h_a_s_h_e_s_(_)
    │ │ │ │  This section describes the functions and classes that are used to create
    │ │ │ │  torrent files. It is a layered API with low level classes and higher level
    │ │ │ │  convenience functions. A torrent is created in 4 steps:
    │ │ │ │     1. first the files that will be part of the torrent are determined.
    │ │ │ │ @@ -78,32 +78,32 @@
    │ │ │ │     file_storage const& ffiilleess () const;
    │ │ │ │     void sseett__ccoommmmeenntt (char const* str);
    │ │ │ │     void sseett__ccrreeaattoorr (char const* str);
    │ │ │ │     void sseett__ccrreeaattiioonn__ddaattee (std::time_t timestamp);
    │ │ │ │     void sseett__hhaasshh (piece_index_t index, sha1_hash const& h);
    │ │ │ │     void sseett__hhaasshh22 (file_index_t file, piece_index_t::diff_type piece,
    │ │ │ │  sha256_hash const& h);
    │ │ │ │ -   void aadddd__hhttttpp__sseeeedd (string_view url);
    │ │ │ │     void aadddd__uurrll__sseeeedd (string_view url);
    │ │ │ │ +   void aadddd__hhttttpp__sseeeedd (string_view url);
    │ │ │ │     void aadddd__nnooddee (std::pair node);
    │ │ │ │     void aadddd__ttrraacckkeerr (string_view url, int tier = 0);
    │ │ │ │     void sseett__rroooott__cceerrtt (string_view cert);
    │ │ │ │ -   bool pprriivv () const;
    │ │ │ │     void sseett__pprriivv (bool p);
    │ │ │ │ +   bool pprriivv () const;
    │ │ │ │     bool iiss__vv11__oonnllyy () const;
    │ │ │ │     bool iiss__vv22__oonnllyy () const;
    │ │ │ │     int nnuumm__ppiieecceess () const;
    │ │ │ │     piece_index_t eenndd__ppiieeccee () const;
    │ │ │ │     index_range ppiieeccee__rraannggee () const noexcept;
    │ │ │ │     file_index_t eenndd__ffiillee () const;
    │ │ │ │     index_range ffiillee__rraannggee () const noexcept;
    │ │ │ │     index_range ffiillee__ppiieeccee__rraannggee (file_index_t f);
    │ │ │ │     std::int64_t ttoottaall__ssiizzee () const;
    │ │ │ │ -   int ppiieeccee__lleennggtthh () const;
    │ │ │ │     int ppiieeccee__ssiizzee (piece_index_t i) const;
    │ │ │ │ +   int ppiieeccee__lleennggtthh () const;
    │ │ │ │     void aadddd__ccoolllleeccttiioonn (string_view c);
    │ │ │ │     void aadddd__ssiimmiillaarr__ttoorrrreenntt (sha1_hash ih);
    │ │ │ │  
    │ │ │ │     static constexpr create_flags_t mmooddiiffiiccaattiioonn__ttiimmee  = 2_bit;
    │ │ │ │     static constexpr create_flags_t ssyymmlliinnkkss  = 3_bit;
    │ │ │ │     static constexpr create_flags_t vv22__oonnllyy  = 5_bit;
    │ │ │ │     static constexpr create_flags_t vv11__oonnllyy  = 6_bit;
    │ │ │ │ @@ -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]
    │ │ │ │ @@ -235,17 +235,17 @@
    │ │ │ │  makes the torrent an SSSSLL ttoorrrreenntt. An SSL torrent requires that each peer has a
    │ │ │ │  valid certificate signed by this root certificate. For SSL torrents, all peers
    │ │ │ │  are connecting over SSL connections. For more information, see the section on
    │ │ │ │  _s_s_l_ _t_o_r_r_e_n_t_s.
    │ │ │ │  The string is not the path to the cert, it's the actual content of the
    │ │ │ │  certificate.
    │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
    │ │ │ │ -********** sseett__pprriivv(()) pprriivv(()) **********
    │ │ │ │ -bool pprriivv () const;
    │ │ │ │ +********** pprriivv(()) sseett__pprriivv(()) **********
    │ │ │ │  void sseett__pprriivv (bool p);
    │ │ │ │ +bool pprriivv () const;
    │ │ │ │  Sets and queries the private flag of the torrent. Torrents with the private
    │ │ │ │  flag set ask the client to not use any other sources than the tracker for
    │ │ │ │  peers, and to not use DHT to advertise itself publicly, only the tracker.
    │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
    │ │ │ │  ********** nnuumm__ppiieecceess(()) **********
    │ │ │ │  int nnuumm__ppiieecceess () const;
    │ │ │ │  returns the number of pieces in the associated _f_i_l_e___s_t_o_r_a_g_e object.
    │ │ │ │ @@ -263,17 +263,17 @@
    │ │ │ │  for v2 and hybrid torrents only, the pieces in the specified file, specified as
    │ │ │ │  delta from the first piece in the file. i.e. the first index is 0.
    │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
    │ │ │ │  ********** ttoottaall__ssiizzee(()) **********
    │ │ │ │  std::int64_t ttoottaall__ssiizzee () const;
    │ │ │ │  the total number of bytes of all files and pad files
    │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
    │ │ │ │ -********** ppiieeccee__ssiizzee(()) ppiieeccee__lleennggtthh(()) **********
    │ │ │ │ -int ppiieeccee__lleennggtthh () const;
    │ │ │ │ +********** ppiieeccee__lleennggtthh(()) ppiieeccee__ssiizzee(()) **********
    │ │ │ │  int ppiieeccee__ssiizzee (piece_index_t i) const;
    │ │ │ │ +int ppiieeccee__lleennggtthh () const;
    │ │ │ │  piece_length() returns the piece size of all pieces but the last one.
    │ │ │ │  piece_size() returns the size of the specified piece. these functions are just
    │ │ │ │  forwarding to the associated _f_i_l_e___s_t_o_r_a_g_e.
    │ │ │ │  [_r_e_p_o_r_t_ _i_s_s_u_e]
    │ │ │ │  ********** aadddd__ssiimmiillaarr__ttoorrrreenntt(()) aadddd__ccoolllleeccttiioonn(()) **********
    │ │ │ │  void aadddd__ccoolllleeccttiioonn (string_view c);
    │ │ │ │  void aadddd__ssiimmiillaarr__ttoorrrreenntt (sha1_hash ih);
    │ │ │ │ @@ -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);
    │ │ │ │  void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
    │ │ │ │     , std::function const& f, error_code& ec);
    │ │ │ │ -void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
    │ │ │ │ +inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
    │ │ │ │     , settings_interface const& settings
    │ │ │ │ -   , std::function const& f, error_code& ec);
    │ │ │ │ +   , std::function const& f);
    │ │ │ │  inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
    │ │ │ │     , std::function const& f);
    │ │ │ │ -inline void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p);
    │ │ │ │ +void sseett__ppiieeccee__hhaasshheess (create_torrent& t, std::string const& p
    │ │ │ │ +   , settings_interface const& settings
    │ │ │ │ +   , std::function const& f, error_code& ec);
    │ │ │ │  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);
    │ │ │ │  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_int (int name, int val) = 0;
    │ │ │ +   virtual void set_str (int name, std::string val) = 0;
    │ │ │ +   virtual bool has_val (int name) const = 0;
    │ │ │ +   virtual void set_bool (int name, bool 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]
    │ │ │ +
    │ │ │

    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
    │ │ │  {
    │ │ │ @@ -199,18 +475,18 @@
    │ │ │  

    remove_torrent()

    │ │ │
    │ │ │  virtual void remove_torrent (storage_index_t) = 0;
    │ │ │  
    │ │ │

    remove the storage with the specified index. This is not expected to │ │ │ delete any files from disk, just to clean up any resources associated │ │ │ with the specified storage.

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

    async_write() async_read()

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

    async_read() async_write()

    │ │ │
    │ │ │  virtual void async_read (storage_index_t storage, peer_request const& r
    │ │ │        , std::function<void(disk_buffer_holder, storage_error const&)> handler
    │ │ │        , disk_job_flags_t flags = {}) = 0;
    │ │ │  virtual bool async_write (storage_index_t storage, peer_request const& r
    │ │ │        , char const* buf, std::shared_ptr<disk_observer> o
    │ │ │        , std::function<void(storage_error const&)> handler
    │ │ │ @@ -470,16 +746,16 @@
    │ │ │  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 (storage_index_t idx, disk_interface& disk_io);
    │ │ │     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;
    │ │ │ @@ -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__iinntt (int name, int val) = 0; │ │ │ │ + virtual void sseett__ssttrr (int name, std::string val) = 0; │ │ │ │ + virtual bool hhaass__vvaall (int name) const = 0; │ │ │ │ + virtual void sseett__bbooooll (int name, bool 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] │ │ │ │ ************ 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 │ │ │ │ { │ │ │ │ @@ -159,15 +454,15 @@ │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** rreemmoovvee__ttoorrrreenntt(()) ********** │ │ │ │ virtual void rreemmoovvee__ttoorrrreenntt (storage_index_t) = 0; │ │ │ │ remove the storage with the specified index. This is not expected to delete any │ │ │ │ files from disk, just to clean up any resources associated with the specified │ │ │ │ storage. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** aassyynncc__wwrriittee(()) aassyynncc__rreeaadd(()) ********** │ │ │ │ +********** aassyynncc__rreeaadd(()) aassyynncc__wwrriittee(()) ********** │ │ │ │ virtual void aassyynncc__rreeaadd (storage_index_t storage, peer_request const& r │ │ │ │ , std::function handler │ │ │ │ , disk_job_flags_t flags = {}) = 0; │ │ │ │ virtual bool aassyynncc__wwrriittee (storage_index_t storage, peer_request const& r │ │ │ │ , char const* buf, std::shared_ptr o │ │ │ │ , std::function handler │ │ │ │ , disk_job_flags_t flags = {}) = 0; │ │ │ │ @@ -362,16 +657,16 @@ │ │ │ │ (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 (storage_index_t idx, disk_interface& disk_io); │ │ │ │ explicit operator bbooooll () const; │ │ │ │ operator ssttoorraaggee__iinnddeexx__tt () const; │ │ │ │ void rreesseett (); │ │ │ │ storage_holder& ooppeerraattoorr== (storage_holder const&) = delete; │ │ │ │ ssttoorraaggee__hhoollddeerr (storage_holder const&) = delete; │ │ │ │ ssttoorraaggee__hhoollddeerr (storage_holder&& rhs) noexcept; │ │ │ │ storage_holder& ooppeerraattoorr== (storage_holder&& rhs) noexcept; │ │ │ │ @@ -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_piece() sent_have() 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_piece (peer_request const&);
    │ │ │  virtual void sent_unchoke ();
    │ │ │ +virtual void sent_interested ();
    │ │ │ +virtual void sent_not_interested ();
    │ │ │  
    │ │ │

    called after a choke message has been sent to the peer

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

    sent_payload()

    │ │ │
    │ │ │  virtual void sent_payload (int /* bytes */);
    │ │ │ @@ -670,21 +740,21 @@
    │ │ │  
    │ │ │

    on_unknown_message()

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

    this is not called for web seeds

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

    on_piece_failed() on_piece_pass()

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

    on_piece_pass() on_piece_failed()

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

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

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

    tick()

    │ │ │
    │ │ │ @@ -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,58 +2,58 @@ │ │ │ │ _[_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_(_) │ │ │ │ o _o_n___u_n_k_n_o_w_n___t_o_r_r_e_n_t_(_) │ │ │ │ o _o_n___t_i_c_k_(_) │ │ │ │ o _g_e_t___u_n_c_h_o_k_e___p_r_i_o_r_i_t_y_(_) │ │ │ │ o _l_o_a_d___s_t_a_t_e_(_) │ │ │ │ * _t_o_r_r_e_n_t___p_l_u_g_i_n │ │ │ │ o _n_e_w___c_o_n_n_e_c_t_i_o_n_(_) │ │ │ │ - o _o_n___p_i_e_c_e___f_a_i_l_e_d_(_)_ _o_n___p_i_e_c_e___p_a_s_s_(_) │ │ │ │ + o _o_n___p_i_e_c_e___p_a_s_s_(_)_ _o_n___p_i_e_c_e___f_a_i_l_e_d_(_) │ │ │ │ o _t_i_c_k_(_) │ │ │ │ - o _o_n___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___u_n_c_h_o_k_e_(_)_ _o_n___n_o_t___i_n_t_e_r_e_s_t_e_d_(_)_ _o_n___h_a_v_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___i_n_t_e_r_e_s_t_e_d_(_)_ _o_n___h_a_v_e___n_o_n_e_(_) │ │ │ │ + _o_n___d_o_n_t___h_a_v_e_(_)_ _o_n___b_i_t_f_i_e_l_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___p_i_e_c_e_(_)_ _s_e_n_t___h_a_v_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 _o_n___p_i_e_c_e___p_a_s_s_(_)_ _o_n___p_i_e_c_e___f_a_i_l_e_d_(_) │ │ │ │ o _t_i_c_k_(_) │ │ │ │ o _w_r_i_t_e___r_e_q_u_e_s_t_(_) │ │ │ │ * _c_r_y_p_t_o___p_l_u_g_i_n │ │ │ │ o _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; │ │ │ │ + void aadddd__eexxtteennssiioonn (std::shared_ptr); │ │ │ │ + peer_plugin const* ffiinndd__pplluuggiinn (string_view type) const; │ │ │ │ + bool iiss__sseeeedd () const; │ │ │ │ + bool uuppllooaadd__oonnllyy () const; │ │ │ │ + bool hhaass__ppiieeccee (piece_index_t i) const; │ │ │ │ + peer_id const& ppiidd () const; │ │ │ │ + bool iiss__cchhookkeedd () const; │ │ │ │ + bool iiss__iinntteerreessttiinngg () const; │ │ │ │ + bool hhaass__ppeeeerr__cchhookkeedd () const; │ │ │ │ + bool iiss__ppeeeerr__iinntteerreesstteedd () const; │ │ │ │ + void mmaayybbee__uunncchhookkee__tthhiiss__ppeeeerr (); │ │ │ │ + void cchhookkee__tthhiiss__ppeeeerr (); │ │ │ │ + void ggeett__ppeeeerr__iinnffoo (peer_info& p) const; │ │ │ │ + torrent_handle aassssoocciiaatteedd__ttoorrrreenntt () const; │ │ │ │ + _t_c_p_:_:_e_n_d_p_o_i_n_t llooccaall__eennddppooiinntt () const; │ │ │ │ + _t_c_p_:_:_e_n_d_p_o_i_n_t const& rreemmoottee () const; │ │ │ │ + bool iiss__ddiissccoonnnneeccttiinngg () const; │ │ │ │ + void ddiissccoonnnneecctt (error_code const& ec, operation_t op │ │ │ │ + , disconnect_severity_t = peer_connection_interface::normal); │ │ │ │ + bool iiss__oouuttggooiinngg () 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); │ │ │ │ + time_point ttiimmee__ooff__llaasstt__uunncchhookkee () const; │ │ │ │ + std::time_t llaasstt__sseeeenn__ccoommpplleettee () const; │ │ │ │ + bool ooppeerraattoorr!!== (peer_connection_handle const& o) const; │ │ │ │ + bool ooppeerraattoorr<< (peer_connection_handle const& o) const; │ │ │ │ + bool ooppeerraattoorr==== (peer_connection_handle const& o) const; │ │ │ │ + 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 ssuuppppoorrtt__eexxtteennssiioonnss () const; │ │ │ │ + bool ppaacckkeett__ffiinniisshheedd () const; │ │ │ │ + bool ssuuppppoorrttss__eennccrryyppttiioonn () const; │ │ │ │ + void sswwiittcchh__rreeccvv__ccrryyppttoo (std::shared_ptr crypto); │ │ │ │ + void sswwiittcchh__sseenndd__ccrryyppttoo (std::shared_ptr crypto); │ │ │ │ + std::shared_ptr nnaattiivvee__hhaannddllee () const; │ │ │ │ +}; │ │ │ │ +[_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ************ 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 │ │ │ │ { │ │ │ │ @@ -257,16 +322,16 @@ │ │ │ │ Torrent plugins are associated with a single torrent and have a number of │ │ │ │ functions called at certain events. Many of its functions have the ability to │ │ │ │ change or override the default libtorrent behavior. │ │ │ │ struct torrent_plugin │ │ │ │ { │ │ │ │ virtual std::shared_ptr nneeww__ccoonnnneeccttiioonn (peer_connection_handle │ │ │ │ const&); │ │ │ │ - virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t); │ │ │ │ virtual void oonn__ppiieeccee__ppaassss (piece_index_t); │ │ │ │ + virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t); │ │ │ │ virtual void ttiicckk (); │ │ │ │ virtual bool oonn__rreessuummee (); │ │ │ │ virtual bool oonn__ppaauussee (); │ │ │ │ virtual void oonn__ffiilleess__cchheecckkeedd (); │ │ │ │ virtual void oonn__ssttaattee (torrent_status::state_t); │ │ │ │ virtual void oonn__aadddd__ppeeeerr (tcp::endpoint const&, │ │ │ │ peer_source_flags_t, add_peer_flags_t); │ │ │ │ @@ -286,28 +351,28 @@ │ │ │ │ have its hook functions called on event specific to that peer. │ │ │ │ The peer_connection_handle will be valid as long as the shared_ptr is being │ │ │ │ held by the torrent object. So, it is generally a good idea to not keep a │ │ │ │ shared_ptr to your own _p_e_e_r___p_l_u_g_i_n. If you want to keep references to it, use │ │ │ │ weak_ptr. │ │ │ │ If this function throws an exception, the connection will be closed. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** oonn__ppiieeccee__ffaaiilleedd(()) oonn__ppiieeccee__ppaassss(()) ********** │ │ │ │ -virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t); │ │ │ │ +********** oonn__ppiieeccee__ppaassss(()) oonn__ppiieeccee__ffaaiilleedd(()) ********** │ │ │ │ virtual void oonn__ppiieeccee__ppaassss (piece_index_t); │ │ │ │ +virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t); │ │ │ │ These hooks are called when a piece passes the hash check or fails the hash │ │ │ │ check, respectively. The index is the piece index that was downloaded. It is │ │ │ │ possible to access the list of peers that participated in sending the piece │ │ │ │ through the torrent and the piece_picker. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** ttiicckk(()) ********** │ │ │ │ virtual void ttiicckk (); │ │ │ │ This hook is called approximately once per second. It is a way of making it │ │ │ │ easy for plugins to do timed events, for sending messages or whatever. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** oonn__ppaauussee(()) oonn__rreessuummee(()) ********** │ │ │ │ +********** oonn__rreessuummee(()) oonn__ppaauussee(()) ********** │ │ │ │ virtual bool oonn__rreessuummee (); │ │ │ │ virtual bool oonn__ppaauussee (); │ │ │ │ These hooks are called when the torrent is paused and resumed respectively. The │ │ │ │ return value indicates if the event was handled. A return value of true │ │ │ │ indicates that it was handled, and no other _p_l_u_g_i_n after this one will have │ │ │ │ this hook function called, and the standard handler will also not be invoked. │ │ │ │ So, returning true effectively overrides the standard behavior of pause or │ │ │ │ @@ -355,51 +420,51 @@ │ │ │ │ { │ │ │ │ virtual string_view ttyyppee () const; │ │ │ │ virtual void aadddd__hhaannddsshhaakkee (entry&); │ │ │ │ virtual void oonn__ddiissccoonnnneecctt (error_code const&); │ │ │ │ virtual void oonn__ccoonnnneecctteedd (); │ │ │ │ virtual bool oonn__hhaannddsshhaakkee (span); │ │ │ │ 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__iinntteerreesstteedd (); │ │ │ │ + virtual bool oonn__hhaavvee (piece_index_t); │ │ │ │ virtual bool oonn__ddoonntt__hhaavvee (piece_index_t); │ │ │ │ + virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//); │ │ │ │ + virtual bool oonn__iinntteerreesstteedd (); │ │ │ │ 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__aalllloowweedd__ffaasstt (piece_index_t); │ │ │ │ virtual bool oonn__cchhookkee (); │ │ │ │ + virtual bool oonn__rreeqquueesstt (peer_request const&); │ │ │ │ virtual bool oonn__uunncchhookkee (); │ │ │ │ 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__rreejjeecctt (peer_request const&); │ │ │ │ + virtual bool oonn__ssuuggggeesstt (piece_index_t); │ │ │ │ + virtual void sseenntt__hhaavvee__nnoonnee (); │ │ │ │ + virtual void sseenntt__hhaavvee__aallll (); │ │ │ │ virtual void sseenntt__ccaanncceell (peer_request const&); │ │ │ │ + virtual void sseenntt__rreeqquueesstt (peer_request const&); │ │ │ │ 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__nnoott__iinntteerreesstteedd (); │ │ │ │ - virtual void sseenntt__ppiieeccee (peer_request const&); │ │ │ │ + virtual void sseenntt__rreejjeecctt__rreeqquueesstt (peer_request const&); │ │ │ │ virtual void sseenntt__hhaavvee (piece_index_t); │ │ │ │ + virtual void sseenntt__ppiieeccee (peer_request const&); │ │ │ │ virtual void sseenntt__uunncchhookkee (); │ │ │ │ + virtual void sseenntt__iinntteerreesstteedd (); │ │ │ │ + virtual void sseenntt__nnoott__iinntteerreesstteedd (); │ │ │ │ virtual void sseenntt__ppaayyllooaadd (int //** bbyytteess **//); │ │ │ │ virtual bool ccaann__ddiissccoonnnneecctt (error_code const& //**eecc**//); │ │ │ │ virtual bool oonn__eexxtteennddeedd (int //**lleennggtthh**//, int //**mmssgg**//, │ │ │ │ span //**bbooddyy**//); │ │ │ │ virtual bool oonn__uunnkknnoowwnn__mmeessssaaggee (int //**lleennggtthh**//, int //**mmssgg**//, │ │ │ │ span //**bbooddyy**//); │ │ │ │ - virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t); │ │ │ │ virtual void oonn__ppiieeccee__ppaassss (piece_index_t); │ │ │ │ + virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t); │ │ │ │ virtual void ttiicckk (); │ │ │ │ virtual bool wwrriittee__rreeqquueesstt (peer_request const&); │ │ │ │ }; │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** ttyyppee(()) ********** │ │ │ │ virtual string_view ttyyppee () const; │ │ │ │ This function is expected to return the name of the _p_l_u_g_i_n. │ │ │ │ @@ -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); │ │ │ │ +********** oonn__hhaavvee__aallll(()) oonn__cchhookkee(()) oonn__uunncchhookkee(()) oonn__nnoott__iinntteerreesstteedd(()) oonn__hhaavvee(()) │ │ │ │ +oonn__rreeqquueesstt(()) oonn__aalllloowweedd__ffaasstt(()) oonn__iinntteerreesstteedd(()) oonn__hhaavvee__nnoonnee(()) oonn__ddoonntt__hhaavvee(()) │ │ │ │ +oonn__bbiittffiieelldd(()) ********** │ │ │ │ virtual bool oonn__nnoott__iinntteerreesstteedd (); │ │ │ │ -virtual bool oonn__aalllloowweedd__ffaasstt (piece_index_t); │ │ │ │ -virtual bool oonn__iinntteerreesstteedd (); │ │ │ │ +virtual bool oonn__hhaavvee (piece_index_t); │ │ │ │ virtual bool oonn__ddoonntt__hhaavvee (piece_index_t); │ │ │ │ +virtual bool oonn__bbiittffiieelldd (bitfield const& //**bbiittffiieelldd**//); │ │ │ │ +virtual bool oonn__iinntteerreesstteedd (); │ │ │ │ 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__aalllloowweedd__ffaasstt (piece_index_t); │ │ │ │ virtual bool oonn__cchhookkee (); │ │ │ │ +virtual bool oonn__rreeqquueesstt (peer_request const&); │ │ │ │ virtual bool oonn__uunncchhookkee (); │ │ │ │ returning true from any of the message handlers indicates that the _p_l_u_g_i_n has │ │ │ │ handled the message. it will break the _p_l_u_g_i_n chain traversing and not let │ │ │ │ anyone else handle the message, including the default handler. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** oonn__ppiieeccee(()) ********** │ │ │ │ virtual bool oonn__ppiieeccee (peer_request const& //**ppiieeccee**// │ │ │ │ , span //**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__ppiieeccee(()) sseenntt__hhaavvee(()) │ │ │ │ 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__ppiieeccee (peer_request const&); │ │ │ │ virtual void sseenntt__uunncchhookkee (); │ │ │ │ +virtual void sseenntt__iinntteerreesstteedd (); │ │ │ │ +virtual void sseenntt__nnoott__iinntteerreesstteedd (); │ │ │ │ called after a choke message has been sent to the peer │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** 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] │ │ │ │ @@ -491,17 +556,17 @@ │ │ │ │ receiving large messages. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** oonn__uunnkknnoowwnn__mmeessssaaggee(()) ********** │ │ │ │ virtual bool oonn__uunnkknnoowwnn__mmeessssaaggee (int //**lleennggtthh**//, int //**mmssgg**//, │ │ │ │ span //**bbooddyy**//); │ │ │ │ this is not called for web seeds │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** oonn__ppiieeccee__ffaaiilleedd(()) oonn__ppiieeccee__ppaassss(()) ********** │ │ │ │ -virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t); │ │ │ │ +********** oonn__ppiieeccee__ppaassss(()) oonn__ppiieeccee__ffaaiilleedd(()) ********** │ │ │ │ virtual void oonn__ppiieeccee__ppaassss (piece_index_t); │ │ │ │ +virtual void oonn__ppiieeccee__ffaaiilleedd (piece_index_t); │ │ │ │ called when a piece that this peer participated in either fails or passes the │ │ │ │ hash_check │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** ttiicckk(()) ********** │ │ │ │ virtual void ttiicckk (); │ │ │ │ called approximately once every second │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ @@ -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 │ │ │ @@ -29,29 +29,29 @@ │ │ │ │ │ │ │ │ │

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

    │ │ │ @@ -80,35 +80,35 @@ │ │ │

    Client applications are responsible for protecting resume files from │ │ │ tampering. At minimum, store them with filesystem permissions that │ │ │ prevent other users on the system from modifying them, and do not load │ │ │ resume data received from untrusted sources (e.g. downloaded, synced │ │ │ from a shared location, or supplied by a peer) without independently │ │ │ validating or overriding the security-sensitive fields after parsing.

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

    write_resume_data_buf() write_resume_data()

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

    write_resume_data() write_resume_data_buf()

    │ │ │

    Declared in "libtorrent/write_resume_data.hpp"

    │ │ │
    │ │ │ -std::vector<char> write_resume_data_buf (add_torrent_params const& atp);
    │ │ │  entry write_resume_data (add_torrent_params const& atp);
    │ │ │ +std::vector<char> write_resume_data_buf (add_torrent_params const& atp);
    │ │ │  
    │ │ │

    this function turns the resume data in an add_torrent_params object │ │ │ into a bencoded structure

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

    write_torrent_file() write_torrent_file_buf()

    │ │ │

    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, write_torrent_flags_t flags);
    │ │ │  
    │ │ │

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

    │ │ │
      │ │ │
    • The 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___r_e_s_u_m_e___d_a_t_a_(_)_ _w_r_i_t_e___r_e_s_u_m_e___d_a_t_a___b_u_f_(_) │ │ │ │ * _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e_(_)_ _w_r_i_t_e___t_o_r_r_e_n_t___f_i_l_e___b_u_f_(_) │ │ │ │ * _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 │ │ │ │ , 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, │ │ │ │ @@ -45,28 +45,28 @@ │ │ │ │ Client applications are responsible for protecting resume files from tampering. │ │ │ │ At minimum, store them with filesystem permissions that prevent other users on │ │ │ │ the system from modifying them, and do not load resume data received from │ │ │ │ untrusted sources (e.g. downloaded, synced from a shared location, or supplied │ │ │ │ by a peer) without independently validating or overriding the security- │ │ │ │ sensitive fields after parsing. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -************ wwrriittee__rreessuummee__ddaattaa__bbuuff(()) wwrriittee__rreessuummee__ddaattaa(()) ************ │ │ │ │ +************ wwrriittee__rreessuummee__ddaattaa(()) wwrriittee__rreessuummee__ddaattaa__bbuuff(()) ************ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_._h_p_p" │ │ │ │ -std::vector wwrriittee__rreessuummee__ddaattaa__bbuuff (add_torrent_params const& atp); │ │ │ │ entry wwrriittee__rreessuummee__ddaattaa (add_torrent_params const& atp); │ │ │ │ +std::vector wwrriittee__rreessuummee__ddaattaa__bbuuff (add_torrent_params const& atp); │ │ │ │ this function turns the resume data in an add_torrent_params object into a │ │ │ │ bencoded structure │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ************ wwrriittee__ttoorrrreenntt__ffiillee(()) wwrriittee__ttoorrrreenntt__ffiillee__bbuuff(()) ************ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_w_r_i_t_e___r_e_s_u_m_e___d_a_t_a_._h_p_p" │ │ │ │ -entry wwrriittee__ttoorrrreenntt__ffiillee (add_torrent_params const& atp, write_torrent_flags_t │ │ │ │ -flags); │ │ │ │ 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, write_torrent_flags_t │ │ │ │ +flags); │ │ │ │ writes only the fields to create a .torrent file. This function may fail with a │ │ │ │ std::system_error exception if: │ │ │ │ * The _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s object passed to this function does not contain │ │ │ │ the info dictionary (the ti field) │ │ │ │ * The piece layers are not complete for all files that need them │ │ │ │ The write_torrent_file_buf() overload returns the torrent file in bencoded │ │ │ │ buffer form. This overload may be faster at the expense of lost flexibility to │ │ ├── ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Session.html │ │ │ @@ -34,58 +34,58 @@ │ │ │ │ │ │ @@ -95,48 +95,48 @@ │ │ │

      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 (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);
      │ │ │     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 (settings_pack const& sp);
      │ │ │ -session_params (settings_pack&& sp);
      │ │ │  session_params ();
      │ │ │ +session_params (settings_pack&& sp);
      │ │ │  
      │ │ │

      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&&) noexcept;
      │ │ │ -   session_proxy& operator= (session_proxy const&) &;
      │ │ │     session_proxy (session_proxy const&);
      │ │ │ +   session_proxy (session_proxy&&) noexcept;
      │ │ │     session_proxy& operator= (session_proxy&&) & noexcept;
      │ │ │ -   session_proxy ();
      │ │ │     ~session_proxy ();
      │ │ │ +   session_proxy ();
      │ │ │ +   session_proxy& operator= (session_proxy const&) &;
      │ │ │  };
      │ │ │  
      │ │ │ - │ │ │ │ │ │ -[report issue]
      │ │ │ -

      ~session_proxy() session_proxy() operator=()

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

      session_proxy() ~session_proxy() operator=()

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

      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 (session_params&& params, session_flags_t flags);
      │ │ │ +   explicit session (session_params&& params);
      │ │ │     explicit session (session_params const& params);
      │ │ │ +   session (session_params const& params, session_flags_t flags);
      │ │ │ +   session (session_params&& params, session_flags_t flags);
      │ │ │     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 (session_params&& params, io_context& ios);
      │ │ │     ~session ();
      │ │ │     session_proxy abort ();
      │ │ │  };
      │ │ │  
      │ │ │ [report issue]
      │ │ │

      session()

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

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

      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,44 +310,44 @@ │ │ │ [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;
      │ │ │ +   void refresh_torrent_status (std::vector<torrent_status>* ret
      │ │ │ +      , status_flags_t flags = {}) const;
      │ │ │     std::vector<torrent_status> get_torrent_status (
      │ │ │        std::function<bool(torrent_status const&)> const& pred
      │ │ │        , status_flags_t flags = {}) const;
      │ │ │ -   void 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);
      │ │ │ -   void async_add_torrent (add_torrent_params const& params);
      │ │ │ -   torrent_handle add_torrent (add_torrent_params const& params);
      │ │ │ +   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);
      │ │ │     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);
      │ │ │ +   torrent_handle add_torrent (add_torrent_params const& params);
      │ │ │ +   void async_add_torrent (add_torrent_params const& params);
      │ │ │ +   bool is_paused () const;
      │ │ │     void resume ();
      │ │ │     void pause ();
      │ │ │ -   bool is_paused () const;
      │ │ │     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;
      │ │ │ -   void set_peer_class_filter (ip_filter const& f);
      │ │ │ +   unsigned short listen_port () const;
      │ │ │ +   unsigned short ssl_listen_port () const;
      │ │ │     ip_filter get_peer_class_filter () const;
      │ │ │ -   void set_peer_class_type_filter (peer_class_type_filter const& f);
      │ │ │ +   void set_peer_class_filter (ip_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);
      │ │ │ +   settings_pack get_settings () const;
      │ │ │ +   void apply_settings (settings_pack&&);
      │ │ │     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,24 +421,24 @@
      │ │ │  

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

      │ │ │
      │ │ │ +void refresh_torrent_status (std::vector<torrent_status>* ret
      │ │ │ +      , status_flags_t flags = {}) const;
      │ │ │  std::vector<torrent_status> get_torrent_status (
      │ │ │        std::function<bool(torrent_status const&)> const& pred
      │ │ │        , status_flags_t flags = {}) const;
      │ │ │ -void refresh_torrent_status (std::vector<torrent_status>* ret
      │ │ │ -      , status_flags_t flags = {}) const;
      │ │ │  
      │ │ │
      │ │ │

      Note

      │ │ │

      these calls are potentially expensive and won't scale well with │ │ │ lots of torrents. If you're concerned about performance, consider │ │ │ using post_torrent_updates() instead.

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

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

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

      add_torrent() async_add_torrent()

      │ │ │
      │ │ │ -torrent_handle add_torrent (add_torrent_params const& params, error_code& ec);
      │ │ │ -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);
      │ │ │ +torrent_handle add_torrent (add_torrent_params const& params);
      │ │ │ +void async_add_torrent (add_torrent_params const& params);
      │ │ │  
      │ │ │

      You add torrents through the add_torrent() function where you give an │ │ │ object with all the parameters. The add_torrent() overloads will block │ │ │ until the torrent has been added (or failed to be added) and returns │ │ │ an error code and a torrent_handle. In order to add torrents more │ │ │ efficiently, consider using async_add_torrent() which returns │ │ │ immediately, without waiting for the torrent to add. Notification of │ │ │ @@ -568,23 +568,23 @@ │ │ │ want to control are torrent_flags::paused and │ │ │ torrent_flags::auto_managed. In order to add a magnet link that will │ │ │ just download the metadata, but no payload, set the │ │ │ torrent_flags::upload_mode flag.

      │ │ │

      Special consideration has to be taken when adding hybrid torrents │ │ │ (i.e. torrents that are BitTorrent v2 torrents that are backwards │ │ │ compatible with v1). For more details, see BitTorrent v2 torrents.

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

      resume() is_paused() pause()

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

      is_paused() resume() pause()

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

      Pausing the session has the same effect as pausing every torrent in │ │ │ it, except that torrents will not be resumed by the auto-manage │ │ │ mechanism. Resuming will restore the torrents to their previous paused │ │ │ state. i.e. the session pause state is separate from the torrent pause │ │ │ state. A torrent is inactive if it is paused or if the session is │ │ │ paused.

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

      │ │ │ @@ -794,16 +794,16 @@ │ │ │ ses.add_extension(&lt::create_smart_ban_plugin); │ │ │ │ │ │ │ │ │ [report issue]
      │ │ │
      │ │ │

      set_ip_filter() get_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,37 +814,37 @@ │ │ │

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

      is_listening() listen_port() ssl_listen_port()

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

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

      get_peer_class_filter() set_peer_class_filter()

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

      set_peer_class_filter() get_peer_class_filter()

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

      Sets the peer class filter for this session. All new peer connections │ │ │ will take this into account and be added to the peer classes specified │ │ │ by this filter, based on the peer's IP address.

      │ │ │

      The ip-filter essentially maps an IP -> uint32. Each bit in that 32 │ │ │ bit integer represents a peer class. The least significant bit │ │ │ represents class 0, the next bit class 1 and so on.

      │ │ │ @@ -869,16 +869,16 @@ │ │ │

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

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

      │ │ │
        │ │ │ @@ -917,21 +917,21 @@ │ │ │ remove the peer class if it's still assigned to torrents or peers. It │ │ │ will however remove it once the last peer and torrent drops their │ │ │ references to it.

        │ │ │

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

        │ │ │

        For more information on peer classes, see peer classes.

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

      set_peer_class() get_peer_class()

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

      get_peer_class() set_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 │ │ │ @@ -976,29 +976,29 @@ │ │ │ advised to remove them from the back of the queue, to minimize the │ │ │ shifting.

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

      get_settings() apply_settings()

      │ │ │
      │ │ │ -void apply_settings (settings_pack&&);
      │ │ │ -settings_pack get_settings () const;
      │ │ │  void apply_settings (settings_pack const&);
      │ │ │ +settings_pack get_settings () const;
      │ │ │ +void apply_settings (settings_pack&&);
      │ │ │  
      │ │ │

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

      set_alert_notify() pop_alerts() wait_for_alert()

      │ │ │
      │ │ │ -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]
      │ │ │ @@ -1135,20 +1135,20 @@ │ │ │ │ │ │ [report issue]
      │ │ │
      │ │ │
      │ │ │

      write_session_params() read_session_params() write_session_params_buf()

      │ │ │

      Declared in "libtorrent/session_params.hpp"

      │ │ │
      │ │ │ +session_params read_session_params (bdecode_node const& e
      │ │ │ +   , save_state_flags_t flags = save_state_flags_t::all());
      │ │ │  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 (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 │ │ │ session using the state from a previous one (or by programmatically configure │ │ │ the session up-front). │ │ │ ├── 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 _s_e_s_s_i_o_n___p_r_o_x_y_(_)_ _~_s_e_s_s_i_o_n___p_r_o_x_y_(_)_ _o_p_e_r_a_t_o_r_=_(_) │ │ │ │ * _s_e_s_s_i_o_n │ │ │ │ o _s_e_s_s_i_o_n_(_) │ │ │ │ o _s_e_s_s_i_o_n_(_) │ │ │ │ o _~_s_e_s_s_i_o_n_(_) │ │ │ │ o _a_b_o_r_t_(_) │ │ │ │ * _s_e_s_s_i_o_n___h_a_n_d_l_e │ │ │ │ o _i_s___v_a_l_i_d_(_) │ │ │ │ o _s_e_s_s_i_o_n___s_t_a_t_e_(_) │ │ │ │ - o _g_e_t___t_o_r_r_e_n_t___s_t_a_t_u_s_(_)_ _r_e_f_r_e_s_h___t_o_r_r_e_n_t___s_t_a_t_u_s_(_) │ │ │ │ + o _r_e_f_r_e_s_h___t_o_r_r_e_n_t___s_t_a_t_u_s_(_)_ _g_e_t___t_o_r_r_e_n_t___s_t_a_t_u_s_(_) │ │ │ │ o _p_o_s_t___t_o_r_r_e_n_t___u_p_d_a_t_e_s_(_) │ │ │ │ o _p_o_s_t___s_e_s_s_i_o_n___s_t_a_t_s_(_) │ │ │ │ o _p_o_s_t___d_h_t___s_t_a_t_s_(_) │ │ │ │ o _s_e_t___d_h_t___s_t_a_t_e_(_) │ │ │ │ o _g_e_t___t_o_r_r_e_n_t_s_(_)_ _f_i_n_d___t_o_r_r_e_n_t_(_) │ │ │ │ - o _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_)_ _a_d_d___t_o_r_r_e_n_t_(_) │ │ │ │ - o _r_e_s_u_m_e_(_)_ _i_s___p_a_u_s_e_d_(_)_ _p_a_u_s_e_(_) │ │ │ │ + o _a_d_d___t_o_r_r_e_n_t_(_)_ _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_) │ │ │ │ + o _i_s___p_a_u_s_e_d_(_)_ _r_e_s_u_m_e_(_)_ _p_a_u_s_e_(_) │ │ │ │ o _i_s___d_h_t___r_u_n_n_i_n_g_(_) │ │ │ │ o _s_e_t___d_h_t___s_t_o_r_a_g_e_(_) │ │ │ │ o _a_d_d___d_h_t___n_o_d_e_(_) │ │ │ │ o _d_h_t___g_e_t___i_t_e_m_(_) │ │ │ │ o _d_h_t___g_e_t___i_t_e_m_(_) │ │ │ │ o _d_h_t___p_u_t___i_t_e_m_(_) │ │ │ │ o _d_h_t___p_u_t___i_t_e_m_(_) │ │ │ │ - o _d_h_t___g_e_t___p_e_e_r_s_(_)_ _d_h_t___a_n_n_o_u_n_c_e_(_) │ │ │ │ + o _d_h_t___a_n_n_o_u_n_c_e_(_)_ _d_h_t___g_e_t___p_e_e_r_s_(_) │ │ │ │ o _d_h_t___l_i_v_e___n_o_d_e_s_(_) │ │ │ │ o _d_h_t___s_a_m_p_l_e___i_n_f_o_h_a_s_h_e_s_(_) │ │ │ │ o _d_h_t___d_i_r_e_c_t___r_e_q_u_e_s_t_(_) │ │ │ │ o _a_d_d___e_x_t_e_n_s_i_o_n_(_) │ │ │ │ o _s_e_t___i_p___f_i_l_t_e_r_(_)_ _g_e_t___i_p___f_i_l_t_e_r_(_) │ │ │ │ o _s_e_t___p_o_r_t___f_i_l_t_e_r_(_) │ │ │ │ - o _l_i_s_t_e_n___p_o_r_t_(_)_ _i_s___l_i_s_t_e_n_i_n_g_(_)_ _s_s_l___l_i_s_t_e_n___p_o_r_t_(_) │ │ │ │ - o _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 _i_s___l_i_s_t_e_n_i_n_g_(_)_ _l_i_s_t_e_n___p_o_r_t_(_)_ _s_s_l___l_i_s_t_e_n___p_o_r_t_(_) │ │ │ │ + o _s_e_t___p_e_e_r___c_l_a_s_s___f_i_l_t_e_r_(_)_ _g_e_t___p_e_e_r___c_l_a_s_s___f_i_l_t_e_r_(_) │ │ │ │ o _s_e_t___p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r_(_)_ _g_e_t___p_e_e_r___c_l_a_s_s___t_y_p_e___f_i_l_t_e_r_(_) │ │ │ │ o _c_r_e_a_t_e___p_e_e_r___c_l_a_s_s_(_) │ │ │ │ o _d_e_l_e_t_e___p_e_e_r___c_l_a_s_s_(_) │ │ │ │ - o _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 _g_e_t___p_e_e_r___c_l_a_s_s_(_)_ _s_e_t___p_e_e_r___c_l_a_s_s_(_) │ │ │ │ o _r_e_m_o_v_e___t_o_r_r_e_n_t_(_) │ │ │ │ o _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 _s_e_t___a_l_e_r_t___n_o_t_i_f_y_(_)_ _p_o_p___a_l_e_r_t_s_(_)_ _w_a_i_t___f_o_r___a_l_e_r_t_(_) │ │ │ │ o _a_d_d___p_o_r_t___m_a_p_p_i_n_g_(_)_ _d_e_l_e_t_e___p_o_r_t___m_a_p_p_i_n_g_(_) │ │ │ │ o _r_e_o_p_e_n___n_e_t_w_o_r_k___s_o_c_k_e_t_s_(_) │ │ │ │ o _n_a_t_i_v_e___h_a_n_d_l_e_(_) │ │ │ │ * _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s_(_)_ _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_(_) │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ************ sseessssiioonn__ppaarraammss ************ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n___p_a_r_a_m_s_._h_p_p" │ │ │ │ The _s_e_s_s_i_o_n___p_a_r_a_m_s is a parameters pack for configuring the _s_e_s_s_i_o_n before it's │ │ │ │ started. │ │ │ │ struct session_params │ │ │ │ { │ │ │ │ sseessssiioonn__ppaarraammss (settings_pack const& sp); │ │ │ │ - sseessssiioonn__ppaarraammss (settings_pack&& sp); │ │ │ │ sseessssiioonn__ppaarraammss (); │ │ │ │ - sseessssiioonn__ppaarraammss (settings_pack const& sp │ │ │ │ - , std::vector> exts); │ │ │ │ + sseessssiioonn__ppaarraammss (settings_pack&& sp); │ │ │ │ sseessssiioonn__ppaarraammss (settings_pack&& sp │ │ │ │ , std::vector> exts); │ │ │ │ + sseessssiioonn__ppaarraammss (settings_pack const& sp │ │ │ │ + , std::vector> exts); │ │ │ │ │ │ │ │ settings_pack settings; │ │ │ │ std::vector> extensions; │ │ │ │ dht::dht_state dht_state; │ │ │ │ dht::dht_storage_constructor_type dht_storage_constructor; │ │ │ │ disk_io_constructor_type disk_io_constructor; │ │ │ │ std::map ext_state; │ │ │ │ libtorrent::ip_filter ip_filter; │ │ │ │ }; │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** sseessssiioonn__ppaarraammss(()) ********** │ │ │ │ sseessssiioonn__ppaarraammss (settings_pack const& sp); │ │ │ │ -sseessssiioonn__ppaarraammss (settings_pack&& sp); │ │ │ │ sseessssiioonn__ppaarraammss (); │ │ │ │ +sseessssiioonn__ppaarraammss (settings_pack&& sp); │ │ │ │ This constructor can be used to start with the default plugins (ut_metadata, │ │ │ │ ut_pex and smart_ban). Pass a _s_e_t_t_i_n_g_s___p_a_c_k to set the initial settings when │ │ │ │ the _s_e_s_s_i_o_n starts. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** sseessssiioonn__ppaarraammss(()) ********** │ │ │ │ -sseessssiioonn__ppaarraammss (settings_pack const& sp │ │ │ │ - , std::vector> 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 (session_proxy&&) noexcept; │ │ │ │ - session_proxy& ooppeerraattoorr== (session_proxy const&) &; │ │ │ │ sseessssiioonn__pprrooxxyy (session_proxy const&); │ │ │ │ + sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept; │ │ │ │ session_proxy& ooppeerraattoorr== (session_proxy&&) & noexcept; │ │ │ │ - sseessssiioonn__pprrooxxyy (); │ │ │ │ ~~sseessssiioonn__pprrooxxyy (); │ │ │ │ + sseessssiioonn__pprrooxxyy (); │ │ │ │ + session_proxy& ooppeerraattoorr== (session_proxy const&) &; │ │ │ │ }; │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** ~~sseessssiioonn__pprrooxxyy(()) sseessssiioonn__pprrooxxyy(()) ooppeerraattoorr==(()) ********** │ │ │ │ -sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept; │ │ │ │ -session_proxy& ooppeerraattoorr== (session_proxy const&) &; │ │ │ │ +********** sseessssiioonn__pprrooxxyy(()) ~~sseessssiioonn__pprrooxxyy(()) ooppeerraattoorr==(()) ********** │ │ │ │ sseessssiioonn__pprrooxxyy (session_proxy const&); │ │ │ │ +sseessssiioonn__pprrooxxyy (session_proxy&&) noexcept; │ │ │ │ session_proxy& ooppeerraattoorr== (session_proxy&&) & noexcept; │ │ │ │ -sseessssiioonn__pprrooxxyy (); │ │ │ │ ~~sseessssiioonn__pprrooxxyy (); │ │ │ │ +sseessssiioonn__pprrooxxyy (); │ │ │ │ +session_proxy& ooppeerraattoorr== (session_proxy const&) &; │ │ │ │ default constructor, does not refer to any _s_e_s_s_i_o_n implementation object. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ************ sseessssiioonn ************ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n_._h_p_p" │ │ │ │ The _s_e_s_s_i_o_n holds all state that spans multiple torrents. Among other things it │ │ │ │ runs the network loop and manages all torrents. Once it's created, the _s_e_s_s_i_o_n │ │ │ │ object will spawn the main thread that will do all the work. The main thread │ │ │ │ @@ -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 (); │ │ │ │ - sseessssiioonn (session_params&& params, session_flags_t flags); │ │ │ │ + explicit sseessssiioonn (session_params&& params); │ │ │ │ explicit sseessssiioonn (session_params const& params); │ │ │ │ + sseessssiioonn (session_params const& params, session_flags_t flags); │ │ │ │ + sseessssiioonn (session_params&& params, session_flags_t flags); │ │ │ │ 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); │ │ │ │ + sseessssiioonn (session_params&& params, io_context& ios); │ │ │ │ ~~sseessssiioonn (); │ │ │ │ session_proxy aabboorrtt (); │ │ │ │ }; │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** sseessssiioonn(()) ********** │ │ │ │ -sseessssiioonn (session_params const& params, session_flags_t flags); │ │ │ │ -explicit sseessssiioonn (session_params&& params); │ │ │ │ sseessssiioonn (); │ │ │ │ -sseessssiioonn (session_params&& params, session_flags_t flags); │ │ │ │ +explicit sseessssiioonn (session_params&& params); │ │ │ │ explicit sseessssiioonn (session_params const& params); │ │ │ │ +sseessssiioonn (session_params const& params, session_flags_t flags); │ │ │ │ +sseessssiioonn (session_params&& params, session_flags_t flags); │ │ │ │ Constructs the _s_e_s_s_i_o_n objects which acts as the container of torrents. In │ │ │ │ order to avoid a race condition between starting the _s_e_s_s_i_o_n and configuring │ │ │ │ it, you can pass in a _s_e_s_s_i_o_n___p_a_r_a_m_s object. Its settings will take effect │ │ │ │ before the _s_e_s_s_i_o_n starts up. │ │ │ │ The overloads taking flags can be used to start a _s_e_s_s_i_o_n in paused mode (by │ │ │ │ passing in session::paused). Note that add_default_plugins do not have an │ │ │ │ affect on constructors that take a _s_e_s_s_i_o_n___p_a_r_a_m_s object. It already contains │ │ │ │ the plugins to use. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** sseessssiioonn(()) ********** │ │ │ │ sseessssiioonn (session_params 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); │ │ │ │ +sseessssiioonn (session_params&& params, io_context& ios); │ │ │ │ Overload of the constructor that takes an external io_context to run the │ │ │ │ _s_e_s_s_i_o_n object on. This is primarily useful for tests that may want to run │ │ │ │ multiple sessions on a single io_context, or low resource systems where │ │ │ │ additional threads are expensive and sharing an io_context with other events is │ │ │ │ fine. │ │ │ │ Warning │ │ │ │ The _s_e_s_s_i_o_n object does not cleanly terminate with an external io_context. The │ │ │ │ @@ -232,37 +232,37 @@ │ │ │ │ operation on it will throw a system_error exception, with error code │ │ │ │ invalid_session_handle. │ │ │ │ struct session_handle │ │ │ │ { │ │ │ │ bool iiss__vvaalliidd () const; │ │ │ │ session_params sseessssiioonn__ssttaattee (save_state_flags_t flags = │ │ │ │ save_state_flags_t::all()) const; │ │ │ │ + void rreeffrreesshh__ttoorrrreenntt__ssttaattuuss (std::vector* ret │ │ │ │ + , status_flags_t flags = {}) const; │ │ │ │ std::vector ggeett__ttoorrrreenntt__ssttaattuuss ( │ │ │ │ std::function const& pred │ │ │ │ , status_flags_t flags = {}) const; │ │ │ │ - void 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); │ │ │ │ - void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ - torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ + 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); │ │ │ │ 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); │ │ │ │ + torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ + void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ + bool iiss__ppaauusseedd () const; │ │ │ │ void rreessuummee (); │ │ │ │ void ppaauussee (); │ │ │ │ - bool iiss__ppaauusseedd () const; │ │ │ │ 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; │ │ │ │ - void sseett__ppeeeerr__ccllaassss__ffiilltteerr (ip_filter const& f); │ │ │ │ + unsigned short lliisstteenn__ppoorrtt () const; │ │ │ │ + unsigned short ssssll__lliisstteenn__ppoorrtt () const; │ │ │ │ ip_filter ggeett__ppeeeerr__ccllaassss__ffiilltteerr () const; │ │ │ │ - void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f); │ │ │ │ + void sseett__ppeeeerr__ccllaassss__ffiilltteerr (ip_filter const& f); │ │ │ │ peer_class_type_filter ggeett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr () const; │ │ │ │ + void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f); │ │ │ │ peer_class_t ccrreeaattee__ppeeeerr__ccllaassss (char const* name); │ │ │ │ void ddeelleettee__ppeeeerr__ccllaassss (peer_class_t cid); │ │ │ │ - void sseett__ppeeeerr__ccllaassss (peer_class_t cid, peer_class_info const& pci); │ │ │ │ peer_class_info ggeett__ppeeeerr__ccllaassss (peer_class_t cid) const; │ │ │ │ + void 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); │ │ │ │ + settings_pack ggeett__sseettttiinnggss () const; │ │ │ │ + void aappppllyy__sseettttiinnggss (settings_pack&&); │ │ │ │ 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,20 +334,20 @@ │ │ │ │ all()) const; │ │ │ │ returns the current _s_e_s_s_i_o_n state. This can be passed to _w_r_i_t_e___s_e_s_s_i_o_n___p_a_r_a_m_s_(_) │ │ │ │ to save the state to disk and restored using _r_e_a_d___s_e_s_s_i_o_n___p_a_r_a_m_s_(_) when │ │ │ │ constructing a new _s_e_s_s_i_o_n. The kind of state that's included is all settings, │ │ │ │ the DHT routing table, possibly plugin-specific state. the flags parameter can │ │ │ │ be used to only save certain parts of the _s_e_s_s_i_o_n state │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** ggeett__ttoorrrreenntt__ssttaattuuss(()) rreeffrreesshh__ttoorrrreenntt__ssttaattuuss(()) ********** │ │ │ │ +********** rreeffrreesshh__ttoorrrreenntt__ssttaattuuss(()) ggeett__ttoorrrreenntt__ssttaattuuss(()) ********** │ │ │ │ +void rreeffrreesshh__ttoorrrreenntt__ssttaattuuss (std::vector* ret │ │ │ │ + , status_flags_t flags = {}) const; │ │ │ │ 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 │ │ │ │ torrents. If you're concerned about performance, consider using │ │ │ │ post_torrent_updates() instead. │ │ │ │ get_torrent_status returns a vector of the _t_o_r_r_e_n_t___s_t_a_t_u_s for every torrent │ │ │ │ which satisfies pred, which is a predicate function which determines if a │ │ │ │ torrent should be included in the returned set or not. Returning true means it │ │ │ │ @@ -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; │ │ │ │ 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); │ │ │ │ -void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ -torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ +********** aadddd__ttoorrrreenntt(()) aassyynncc__aadddd__ttoorrrreenntt(()) ********** │ │ │ │ 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); │ │ │ │ +torrent_handle aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ +void aassyynncc__aadddd__ttoorrrreenntt (add_torrent_params const& params); │ │ │ │ You add torrents through the _a_d_d___t_o_r_r_e_n_t_(_) function where you give an object │ │ │ │ with all the parameters. The _a_d_d___t_o_r_r_e_n_t_(_) overloads will block until the │ │ │ │ torrent has been added (or failed to be added) and returns an error code and a │ │ │ │ _t_o_r_r_e_n_t___h_a_n_d_l_e. In order to add torrents more efficiently, consider using │ │ │ │ _a_s_y_n_c___a_d_d___t_o_r_r_e_n_t_(_) which returns immediately, without waiting for the torrent │ │ │ │ to add. Notification of the torrent being added is sent as _a_d_d___t_o_r_r_e_n_t___a_l_e_r_t. │ │ │ │ The save_path field in _a_d_d___t_o_r_r_e_n_t___p_a_r_a_m_s must be set to a valid path where the │ │ │ │ @@ -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(()) ********** │ │ │ │ +********** iiss__ppaauusseedd(()) rreessuummee(()) ppaauussee(()) ********** │ │ │ │ +bool iiss__ppaauusseedd () const; │ │ │ │ void rreessuummee (); │ │ │ │ void ppaauussee (); │ │ │ │ -bool iiss__ppaauusseedd () const; │ │ │ │ Pausing the _s_e_s_s_i_o_n has the same effect as pausing every torrent in it, except │ │ │ │ that torrents will not be resumed by the auto-manage mechanism. Resuming will │ │ │ │ restore the torrents to their previous paused state. i.e. the _s_e_s_s_i_o_n pause │ │ │ │ state is separate from the torrent pause state. A torrent is inactive if it is │ │ │ │ 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 │ │ │ │ @@ -600,16 +600,16 @@ │ │ │ │ A _p_l_u_g_i_n that, with a small overhead, can ban peers that sends bad data │ │ │ │ with very high accuracy. Should eliminate most problems on poisoned │ │ │ │ torrents. │ │ │ │ #include │ │ │ │ ses.add_extension(<::create_smart_ban_plugin); │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** sseett__iipp__ffiilltteerr(()) ggeett__iipp__ffiilltteerr(()) ********** │ │ │ │ -void sseett__iipp__ffiilltteerr (ip_filter f); │ │ │ │ ip_filter ggeett__iipp__ffiilltteerr () const; │ │ │ │ +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,27 +617,27 @@ │ │ │ │ ********** sseett__ppoorrtt__ffiilltteerr(()) ********** │ │ │ │ void sseett__ppoorrtt__ffiilltteerr (port_filter const& f); │ │ │ │ apply _p_o_r_t___f_i_l_t_e_r f to incoming and outgoing peers. a port filter will reject │ │ │ │ making outgoing peer connections to certain remote ports. The main intention is │ │ │ │ to be able to avoid triggering certain anti-virus software by connecting to │ │ │ │ SMTP, FTP ports. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** lliisstteenn__ppoorrtt(()) iiss__lliisstteenniinngg(()) ssssll__lliisstteenn__ppoorrtt(()) ********** │ │ │ │ -unsigned short ssssll__lliisstteenn__ppoorrtt () const; │ │ │ │ -unsigned short lliisstteenn__ppoorrtt () const; │ │ │ │ +********** iiss__lliisstteenniinngg(()) lliisstteenn__ppoorrtt(()) ssssll__lliisstteenn__ppoorrtt(()) ********** │ │ │ │ bool iiss__lliisstteenniinngg () const; │ │ │ │ +unsigned short lliisstteenn__ppoorrtt () const; │ │ │ │ +unsigned short ssssll__lliisstteenn__ppoorrtt () const; │ │ │ │ is_listening() will tell you whether or not the _s_e_s_s_i_o_n has successfully opened │ │ │ │ a listening port. If it hasn't, this function will return false, and then you │ │ │ │ can set a new _s_e_t_t_i_n_g_s___p_a_c_k_:_:_l_i_s_t_e_n___i_n_t_e_r_f_a_c_e_s to try another interface and │ │ │ │ port to bind to. │ │ │ │ listen_port() returns the port we ended up listening on. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** ggeett__ppeeeerr__ccllaassss__ffiilltteerr(()) sseett__ppeeeerr__ccllaassss__ffiilltteerr(()) ********** │ │ │ │ -void sseett__ppeeeerr__ccllaassss__ffiilltteerr (ip_filter const& f); │ │ │ │ +********** sseett__ppeeeerr__ccllaassss__ffiilltteerr(()) ggeett__ppeeeerr__ccllaassss__ffiilltteerr(()) ********** │ │ │ │ ip_filter ggeett__ppeeeerr__ccllaassss__ffiilltteerr () const; │ │ │ │ +void sseett__ppeeeerr__ccllaassss__ffiilltteerr (ip_filter const& f); │ │ │ │ Sets the peer class filter for this _s_e_s_s_i_o_n. All new peer connections will take │ │ │ │ this into account and be added to the peer classes specified by this filter, │ │ │ │ based on the peer's IP address. │ │ │ │ The ip-filter essentially maps an IP -> uint32. Each bit in that 32 bit integer │ │ │ │ represents a peer class. The least significant bit represents class 0, the next │ │ │ │ bit class 1 and so on. │ │ │ │ For more info, see _i_p___f_i_l_t_e_r. │ │ │ │ @@ -655,16 +655,16 @@ │ │ │ │ removed from a peer as a result of this call, peer classes are only added. │ │ │ │ The peer_class argument cannot be greater than 31. The bitmasks representing │ │ │ │ peer classes in the peer_class_filter are 32 bits. │ │ │ │ The get_peer_class_filter() function returns the current filter. │ │ │ │ For more information, see _p_e_e_r_ _c_l_a_s_s_e_s. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr(()) ggeett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr(()) ********** │ │ │ │ -void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f); │ │ │ │ peer_class_type_filter ggeett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr () const; │ │ │ │ +void sseett__ppeeeerr__ccllaassss__ttyyppee__ffiilltteerr (peer_class_type_filter const& f); │ │ │ │ Sets and gets the ppeeeerr ccllaassss ttyyppee ffiilltteerr. This is controls automatic peer class │ │ │ │ assignments to peers based on what kind of socket it is. │ │ │ │ It does not only support assigning peer classes, it also supports removing peer │ │ │ │ classes based on socket type. │ │ │ │ The order of these rules being applied are: │ │ │ │ 1. peer-class IP filter │ │ │ │ 2. peer-class type filter, removing classes │ │ │ │ @@ -692,17 +692,17 @@ │ │ │ │ Since peer classes are reference counted, this function will not remove the │ │ │ │ peer class if it's still assigned to torrents or peers. It will however remove │ │ │ │ it once the last peer and torrent drops their references to it. │ │ │ │ There is no need to call this function for custom peer classes. All peer │ │ │ │ classes will be properly destructed when the _s_e_s_s_i_o_n object destructs. │ │ │ │ For more information on peer classes, see _p_e_e_r_ _c_l_a_s_s_e_s. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** sseett__ppeeeerr__ccllaassss(()) ggeett__ppeeeerr__ccllaassss(()) ********** │ │ │ │ -void sseett__ppeeeerr__ccllaassss (peer_class_t cid, peer_class_info const& pci); │ │ │ │ +********** ggeett__ppeeeerr__ccllaassss(()) sseett__ppeeeerr__ccllaassss(()) ********** │ │ │ │ peer_class_info ggeett__ppeeeerr__ccllaassss (peer_class_t cid) const; │ │ │ │ +void sseett__ppeeeerr__ccllaassss (peer_class_t cid, peer_class_info const& pci); │ │ │ │ These functions queries information from a peer class and updates the │ │ │ │ configuration of a peer class, respectively. │ │ │ │ cid must refer to an existing peer class. If it does not, the return value of │ │ │ │ get_peer_class() is undefined. │ │ │ │ set_peer_class() sets all the information in the _p_e_e_r___c_l_a_s_s___i_n_f_o object in the │ │ │ │ specified peer class. There is no option to only update a single property. │ │ │ │ A peer or torrent belonging to more than one class, the highest priority among │ │ │ │ @@ -733,24 +733,24 @@ │ │ │ │ Note that when a queued or downloading torrent is removed, its position in the │ │ │ │ download queue is vacated and every subsequent torrent in the queue has their │ │ │ │ queue positions updated. This can potentially cause a large state_update to be │ │ │ │ posted. When removing all torrents, it is advised to remove them from the back │ │ │ │ of the queue, to minimize the shifting. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ ********** ggeett__sseettttiinnggss(()) aappppllyy__sseettttiinnggss(()) ********** │ │ │ │ -void aappppllyy__sseettttiinnggss (settings_pack&&); │ │ │ │ -settings_pack ggeett__sseettttiinnggss () const; │ │ │ │ void aappppllyy__sseettttiinnggss (settings_pack const&); │ │ │ │ +settings_pack ggeett__sseettttiinnggss () const; │ │ │ │ +void aappppllyy__sseettttiinnggss (settings_pack&&); │ │ │ │ Applies the settings specified by the _s_e_t_t_i_n_g_s___p_a_c_k s. This is an asynchronous │ │ │ │ operation that will return immediately and actually apply the settings to the │ │ │ │ main thread of libtorrent some time later. │ │ │ │ [_r_e_p_o_r_t_ _i_s_s_u_e] │ │ │ │ -********** sseett__aalleerrtt__nnoottiiffyy(()) wwaaiitt__ffoorr__aalleerrtt(()) ppoopp__aalleerrttss(()) ********** │ │ │ │ -void sseett__aalleerrtt__nnoottiiffyy (std::function const& fun); │ │ │ │ +********** sseett__aalleerrtt__nnoottiiffyy(()) ppoopp__aalleerrttss(()) wwaaiitt__ffoorr__aalleerrtt(()) ********** │ │ │ │ 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 = │ │ │ │ @@ -851,20 +851,20 @@ │ │ │ │ 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(()) │ │ │ │ ************ │ │ │ │ Declared in "_l_i_b_t_o_r_r_e_n_t_/_s_e_s_s_i_o_n___p_a_r_a_m_s_._h_p_p" │ │ │ │ +session_params rreeaadd__sseessssiioonn__ppaarraammss (bdecode_node const& e │ │ │ │ + , save_state_flags_t flags = save_state_flags_t::all()); │ │ │ │ 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 (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 │ │ │ │ _s_e_s_s_i_o_n up-front). The flags parameter can be used to only save and load │ │ │ │ certain aspects of the session's state. The _buf suffix indicates the function │ │ ├── ./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,23 +4752,23 @@ │ │ │ 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_bool (int name, bool 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;
      │ │ │ +   std::string const& get_str (int name) const override;
      │ │ │     bool get_bool (int name) const override;
      │ │ │  
      │ │ │     enum type_bases
      │ │ │     {
      │ │ │        string_type_base,
      │ │ │        int_type_base,
      │ │ │        bool_type_base,
      │ │ │ @@ -4838,23 +4838,23 @@
      │ │ │        socks5,
      │ │ │        socks5_pw,
      │ │ │        http,
      │ │ │        http_pw,
      │ │ │     };
      │ │ │  };
      │ │ │  
      │ │ │ - │ │ │ │ │ │ -[report issue]
      │ │ │ -

      set_bool() set_int() set_str()

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

      set_int() set_bool() set_str()

      │ │ │
      │ │ │ -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_bool (int name, bool 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,22 +4874,22 @@ │ │ │ [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_bool() get_str() get_int()

      │ │ │
      │ │ │ -std::string const& get_str (int name) const override;
      │ │ │  int get_int (int name) const override;
      │ │ │ +std::string const& get_str (int name) const override;
      │ │ │  bool get_bool (int name) const override;
      │ │ │  
      │ │ │

      queries the current configuration option from the settings_pack. │ │ │ name is one of the enumeration values from string_types, int_types │ │ │ or bool_types. The enum value must match the type of the get_* │ │ │ function. If the specified setting field has not been set, the default │ │ │ value is returned.

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

      setting_by_name() name_for_setting()

      │ │ │ +

      Declared in "libtorrent/settings_pack.hpp"

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

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

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

      default_settings()

      │ │ │ +

      Declared in "libtorrent/settings_pack.hpp"

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

      returns a settings_pack with every setting set to its default value

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

      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

      │ │ │
      │ │ │ │ │ │
    │ │ │
    │ │ │
    │ │ │
    │ │ │ ..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 │ │ │ -0007dd3 TRUNCATED DUE TO SIZE LIMIT: 10485760 bytes