From f4eaf3dba4173b97b6421a4bb42e9a0c91243a09 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 30 Dec 2017 20:57:43 +0100 Subject: [PATCH 1/6] add note about dynamic loading/unloading of torrents --- docs/manual.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/manual.rst b/docs/manual.rst index a1e82afcf..4b12bc31e 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -641,6 +641,10 @@ directory structure that libtorrent will download torrents into. dynamic loading of torrent files ================================ +.. note:: + This feature will be removed in the next major release of libtorrent. As an + alternative, torrents can be loaded on demand by plugins. + libtorrent has a feature that can unload idle torrents from memory. The purpose of this is to support being active on many more torrents than the RAM permits. This is useful for both embedded devices that have limited RAM and servers From f9968e1e903d6c49f65429c7fccec62fca432554 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 30 Dec 2017 21:04:06 +0100 Subject: [PATCH 2/6] refresh fwd.hpp --- include/libtorrent/fwd.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/libtorrent/fwd.hpp b/include/libtorrent/fwd.hpp index 9a5349556..c99129f6b 100644 --- a/include/libtorrent/fwd.hpp +++ b/include/libtorrent/fwd.hpp @@ -179,6 +179,12 @@ class hasher; struct ip_filter; class port_filter; +// include/libtorrent/peer_class.hpp +struct peer_class_info; + +// include/libtorrent/peer_class_type_filter.hpp +struct peer_class_type_filter; + // include/libtorrent/peer_connection_handle.hpp struct peer_connection_handle; struct bt_peer_connection_handle; From e4ac70c98b1587bbcfb580d8ade2d88f1308e5b6 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 30 Dec 2017 21:23:36 +0100 Subject: [PATCH 3/6] update boost.asio link in documentation, minor cleanup of tutorial examples --- docs/manual.rst | 2 +- examples/bt-get.cpp | 1 - examples/bt-get2.cpp | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/manual.rst b/docs/manual.rst index 4b12bc31e..2bd6424ca 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -109,7 +109,7 @@ with an associated port. For documentation on these types, please refer to the `asio documentation`_. -.. _`asio documentation`: http://asio.sourceforge.net/asio-0.3.8/doc/asio/reference.html +.. _`asio documentation`: http://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio.html exceptions ========== diff --git a/examples/bt-get.cpp b/examples/bt-get.cpp index 6609a5214..9eddf4924 100644 --- a/examples/bt-get.cpp +++ b/examples/bt-get.cpp @@ -41,7 +41,6 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -namespace lt = libtorrent; int main(int argc, char const* argv[]) { if (argc != 2) { diff --git a/examples/bt-get2.cpp b/examples/bt-get2.cpp index 68a7fe5b1..a17075cb8 100644 --- a/examples/bt-get2.cpp +++ b/examples/bt-get2.cpp @@ -44,7 +44,6 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -namespace lt = libtorrent; using clk = std::chrono::steady_clock; // return the name of a torrent status enum From b45acf28a56ac6ee5876140fc15496346e364ed9 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 31 Dec 2017 00:01:54 +0100 Subject: [PATCH 4/6] improve fwd.hpp generator --- include/libtorrent/fwd.hpp | 4 ++-- tools/gen_fwd.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/libtorrent/fwd.hpp b/include/libtorrent/fwd.hpp index c99129f6b..df53d28bd 100644 --- a/include/libtorrent/fwd.hpp +++ b/include/libtorrent/fwd.hpp @@ -33,8 +33,6 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_FWD_HPP #define TORRENT_FWD_HPP -#include "libtorrent/export.hpp" - namespace libtorrent { // include/libtorrent/add_torrent_params.hpp @@ -272,4 +270,6 @@ struct lazy_entry; } +namespace lt = libtorrent; + #endif // TORRENT_FWD_HPP diff --git a/tools/gen_fwd.py b/tools/gen_fwd.py index aeb0137f6..671ad8c53 100644 --- a/tools/gen_fwd.py +++ b/tools/gen_fwd.py @@ -38,8 +38,6 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_FWD_HPP #define TORRENT_FWD_HPP -#include "libtorrent/export.hpp" - namespace libtorrent { ''' @@ -47,6 +45,8 @@ file_footer = ''' } +namespace lt = libtorrent; + #endif // TORRENT_FWD_HPP ''' From 714154259154667f0b15dac2783a71ee6aa3c90a Mon Sep 17 00:00:00 2001 From: arvidn Date: Mon, 1 Jan 2018 08:54:39 -0500 Subject: [PATCH 5/6] update libsimulator with boost-1.66 fix --- simulation/libsimulator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulation/libsimulator b/simulation/libsimulator index de7e1e391..5a5e25005 160000 --- a/simulation/libsimulator +++ b/simulation/libsimulator @@ -1 +1 @@ -Subproject commit de7e1e3914a097f3f7a0c8156447f5149bd8e447 +Subproject commit 5a5e25005fb449c8a90b7f2c642dce48a64a9f68 From 1877724c177ba3f74ae396bbe87c832eb05a1a29 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Fri, 5 Jan 2018 13:54:14 +0800 Subject: [PATCH 6/6] raise auto piece size selection limit to 16 MB in create_torrent() 16 MB is chosen to have a bit more future proof Also rewrite the auto piece size selection algorithm, so that it will scale with torrent content size, suggested by @ssiloti. --- src/create_torrent.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/create_torrent.cpp b/src/create_torrent.cpp index ea9e40195..1858c4f6d 100644 --- a/src/create_torrent.cpp +++ b/src/create_torrent.cpp @@ -332,16 +332,20 @@ namespace libtorrent // a piece_size of 0 means automatic if (piece_size == 0 && !m_merkle_torrent) { - const int target_size = 40 * 1024; - piece_size = int(fs.total_size() / (target_size / 20)); + // size_table is computed from the following: + // target_list_size = sqrt(total_size) * 2; + // target_piece_size = total_size / (target_list_size / hash_size); + // Given hash_size = 20 bytes, target_piece_size = (16*1024 * pow(2, i)) + // we can determine size_table = (total_size = pow(2 * target_piece_size / hash_size, 2)) + boost::int64_t const size_table[] = {2684355, 10737418, 42949673, 171798692, 687194767, + 2748779069LL, 10995116278LL, 43980465111LL, 175921860444LL, 703687441777LL}; - int i = 16*1024; - for (; i < 2*1024*1024; i *= 2) + int i = 0; + for (int max = sizeof(size_table) / sizeof(size_table[0]); i < max; ++i) { - if (piece_size > i) continue; - break; + if (size_table[i] >= fs.total_size()) break; } - piece_size = i; + piece_size = 0x4000 << i; } else if (piece_size == 0 && m_merkle_torrent) {