From 194bbb0bacc190ddd5be70907c4b1395689a5af0 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 11 Feb 2017 15:41:06 -0500 Subject: [PATCH 1/5] use boost-1.63 on appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 24395be59..30b100eb3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -89,7 +89,7 @@ install: & copy c:\openssl-1.0.1p-vs2015\lib\libeay32MT.lib c:\openssl-1.0.1p-vs2015\lib\libeay32.lib ) - cd %ROOT_DIRECTORY% -- set BOOST_ROOT=c:\Libraries\boost +- set BOOST_ROOT=c:\Libraries\boost_1_63_0 - set BOOST_BUILD_PATH=%BOOST_ROOT%\tools\build - echo %BOOST_ROOT% - echo %BOOST_BUILD_PATH% From cbd1c26a1168d8f0d03dc1a864f8384f63049039 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 12 Feb 2017 17:55:34 -0500 Subject: [PATCH 2/5] fix ABI compatibility issue introduced with preformatted entry type --- ChangeLog | 1 + bindings/python/src/create_torrent.cpp | 2 +- include/libtorrent/create_torrent.hpp | 6 ++++++ src/create_torrent.cpp | 30 +++++++++++++++++++++++--- src/torrent.cpp | 11 +++++++--- test/test_create_torrent.cpp | 2 +- 6 files changed, 44 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d2857cf8..cab4c9d27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + * fix ABI compatibility issue introduced with preformatted entry type * add web_seed_name_lookup_retry to session_settings * slightly improve proxy settings backwards compatibility * add function to get default settings diff --git a/bindings/python/src/create_torrent.cpp b/bindings/python/src/create_torrent.cpp index b42272116..cc4b711d8 100644 --- a/bindings/python/src/create_torrent.cpp +++ b/bindings/python/src/create_torrent.cpp @@ -196,7 +196,7 @@ void bind_create_torrent() class_("create_torrent", no_init) .def(init()) - .def(init(arg("ti"))) + .def(init((arg("ti"), arg("version") = LIBTORRENT_VERSION_NUM))) .def(init((arg("storage"), arg("piece_size") = 0 , arg("pad_file_limit") = -1, arg("flags") = int(libtorrent::create_torrent::optimize_alignment)))) diff --git a/include/libtorrent/create_torrent.hpp b/include/libtorrent/create_torrent.hpp index fa111500c..37cea88d7 100644 --- a/include/libtorrent/create_torrent.hpp +++ b/include/libtorrent/create_torrent.hpp @@ -39,6 +39,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/storage.hpp" #include "libtorrent/hasher.hpp" #include "libtorrent/file.hpp" // for combine_path etc. +#include "libtorrent/version.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp" @@ -170,10 +171,13 @@ namespace libtorrent // ``alignment`` is used when pad files are enabled. This is the size // eligible files are aligned to. The default is -1, which means the // piece size of the torrent. + // The ``use_preformatted`` parameter can be set to true to preserve + // invalid encoding of the .torrent file. create_torrent(file_storage& fs, int piece_size = 0 , int pad_file_limit = -1, int flags = optimize_alignment , int alignment = -1); create_torrent(torrent_info const& ti); + create_torrent(torrent_info const& ti, bool use_preformatted); // internal ~create_torrent(); @@ -298,6 +302,8 @@ namespace libtorrent private: + void load_from_torrent_info(torrent_info const& ti, bool const use_preformatted); + file_storage& m_files; // if m_info_dict is initialized, it is // used instead of m_files to generate diff --git a/src/create_torrent.cpp b/src/create_torrent.cpp index 5f2e66a56..ea9e40195 100644 --- a/src/create_torrent.cpp +++ b/src/create_torrent.cpp @@ -382,6 +382,23 @@ namespace libtorrent , m_merkle_torrent(ti.is_merkle_torrent()) , m_include_mtime(false) , m_include_symlinks(false) + { + load_from_torrent_info(ti, false); + } + + create_torrent::create_torrent(torrent_info const& ti, bool const use_preformatted) + : m_files(const_cast(ti.files())) + , m_creation_date(time(0)) + , m_multifile(ti.num_files() > 1) + , m_private(ti.priv()) + , m_merkle_torrent(ti.is_merkle_torrent()) + , m_include_mtime(false) + , m_include_symlinks(false) + { + load_from_torrent_info(ti, use_preformatted); + } + + void create_torrent::load_from_torrent_info(torrent_info const& ti, bool const use_preformatted) { TORRENT_ASSERT(ti.is_valid()); TORRENT_ASSERT(ti.num_pieces() > 0); @@ -418,9 +435,16 @@ namespace libtorrent m_piece_hash.resize(m_files.num_pieces()); for (int i = 0; i < num_pieces(); ++i) set_hash(i, ti.hash_for_piece(i)); - boost::shared_array const info = ti.metadata(); - int const size = ti.metadata_size(); - m_info_dict.preformatted().assign(&info[0], &info[0] + size); + if (use_preformatted) + { + boost::shared_array const info = ti.metadata(); + int const size = ti.metadata_size(); + m_info_dict.preformatted().assign(&info[0], &info[0] + size); + } + else + { + m_info_dict = bdecode(&ti.metadata()[0], &ti.metadata()[0] + ti.metadata_size()); + } m_info_hash = ti.info_hash(); } diff --git a/src/torrent.cpp b/src/torrent.cpp index 521644b4c..83f338473 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -7215,9 +7215,14 @@ namespace libtorrent { if (m_magnet_link || (m_save_resume_flags & torrent_handle::save_info_dict)) { - boost::shared_array const info = torrent_file().metadata(); - int const size = torrent_file().metadata_size(); - ret["info"].preformatted().assign(&info[0], &info[0] + size); + ret["info"] = bdecode(&torrent_file().metadata()[0] + , &torrent_file().metadata()[0] + torrent_file().metadata_size()); +// TODO: re-enable this code once there's a non-inlined encoder function. Or +// perhaps this should not be used until saving resume_data via +// add_torrent_params and a free function, similar to read_resume_data +// boost::shared_array const info = torrent_file().metadata(); +// int const size = torrent_file().metadata_size(); +// ret["info"].preformatted().assign(&info[0], &info[0] + size); } } diff --git a/test/test_create_torrent.cpp b/test/test_create_torrent.cpp index 3fb106279..5f1e38d29 100644 --- a/test/test_create_torrent.cpp +++ b/test/test_create_torrent.cpp @@ -49,7 +49,7 @@ TORRENT_TEST(create_verbatim_torrent) lt::torrent_info info(test_torrent, sizeof(test_torrent) - 1); - lt::create_torrent t(info); + lt::create_torrent t(info, true); std::vector buffer; lt::bencode(std::back_inserter(buffer), t.generate()); From 1300204ff1655a02ae22ea7a0e686b5a6a948ea2 Mon Sep 17 00:00:00 2001 From: arvidn Date: Mon, 13 Feb 2017 08:09:01 -0500 Subject: [PATCH 3/5] back-port pavel's fix to ip_interface.name --- src/enum_net.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/enum_net.cpp b/src/enum_net.cpp index 5faeee9e0..64f6aadee 100644 --- a/src/enum_net.cpp +++ b/src/enum_net.cpp @@ -698,6 +698,7 @@ namespace libtorrent for (;i != udp::resolver_iterator(); ++i) { iface.interface_address = i->endpoint().address(); + iface.name[0] = '\0'; iface.mtu = 1500; if (iface.interface_address.is_v4()) iface.netmask = address_v4::netmask(iface.interface_address.to_v4()); From b922357c4839d33bdcd0689030782c0b592ed337 Mon Sep 17 00:00:00 2001 From: Andrei Kurushin Date: Tue, 14 Feb 2017 00:37:45 +0300 Subject: [PATCH 4/5] backport test framework directory creation fix (#1707) backport test framework directory creation fix --- test/main.cpp | 99 +++++++++++++++++++++++++++++++++++++-------------- test/test.cpp | 8 +++-- 2 files changed, 77 insertions(+), 30 deletions(-) diff --git a/test/main.cpp b/test/main.cpp index 4d3b9382e..7d1b24f18 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -45,6 +45,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/assert.hpp" #include "libtorrent/file.hpp" +#include "libtorrent/aux_/escape_string.hpp" #include #ifdef WIN32 @@ -222,6 +223,53 @@ void print_usage(char const* executable) "by -l. If no test is specified, all tests are run\n", executable); } +void change_directory(std::string const& f, error_code& ec) +{ + ec.clear(); + +#ifdef TORRENT_WINDOWS +#if TORRENT_USE_WSTRING +#define SetCurrentDirectory_ SetCurrentDirectoryW + std::wstring n = convert_to_wstring(f); +#else +#define SetCurrentDirectory_ SetCurrentDirectoryA + std::string const& n = convert_to_native(f); +#endif // TORRENT_USE_WSTRING + + if (SetCurrentDirectory_(n.c_str()) == 0) + ec.assign(GetLastError(), system_category()); +#else + std::string n = convert_to_native(f); + int ret = ::chdir(n.c_str()); + if (ret != 0) + ec.assign(errno, system_category()); +#endif +} + +struct unit_directory_guard +{ + std::string dir; + unit_directory_guard(std::string const& d) : dir(d) {} + ~unit_directory_guard() + { + error_code ec; + std::string parent_dir = parent_path(dir); + change_directory(parent_dir, ec); // windows will not allow to remove current dir, so let's change it to root + if (ec) + { + TEST_ERROR("Failed to change directory: " + ec.message()); + return; + } + if (!keep_files) + { + error_code ec; + remove_all(dir, ec); + if (ec) + TEST_ERROR("Failed to remove unit test directory: " + ec.message()); + } + } +}; + EXPORT int main(int argc, char const* argv[]) { char const* executable = argv[0]; @@ -321,24 +369,11 @@ EXPORT int main(int argc, char const* argv[]) #else process_id = getpid(); #endif + std::string root_dir = current_working_directory(); char dir[40]; snprintf(dir, sizeof(dir), "test_tmp_%u", process_id); - std::string test_dir = complete(dir); - error_code ec; - create_directory(test_dir, ec); - if (ec) - { - fprintf(stderr, "Failed to create test directory: %s\n", ec.message().c_str()); - return 1; - } -#ifdef TORRENT_WINDOWS - SetCurrentDirectoryA(dir); -#else - chdir(dir); -#endif - fprintf(stderr, "cwd = \"%s\"\n", test_dir.c_str()); - - int total_failures = 0; + std::string unit_dir_prefix = combine_path(root_dir, dir); + std::printf("cwd_prefix = \"%s\"\n", unit_dir_prefix.c_str()); if (_g_num_unit_tests == 0) { @@ -355,6 +390,25 @@ EXPORT int main(int argc, char const* argv[]) if (filter && tests_to_run.count(_g_unit_tests[i].name) == 0) continue; + std::string unit_dir = unit_dir_prefix; + char i_str[40]; + snprintf(i_str, sizeof(i_str), "%u", i); + unit_dir.append(i_str); + error_code ec; + create_directory(unit_dir, ec); + if (ec) + { + std::printf("Failed to create unit test directory: %s\n", ec.message().c_str()); + return 1; + } + unit_directory_guard unit_dir_guard(unit_dir); + change_directory(unit_dir, ec); + if (ec) + { + std::printf("Failed to change unit test directory: %s\n", ec.message().c_str()); + return 1; + } + unit_test_t& t = _g_unit_tests[i]; if (redirect_stdout) @@ -422,7 +476,6 @@ EXPORT int main(int argc, char const* argv[]) t.num_failures = _g_test_failures; t.run = true; - total_failures += _g_test_failures; ++num_run; if (redirect_stdout && t.output) @@ -459,16 +512,8 @@ EXPORT int main(int argc, char const* argv[]) if (redirect_stdout) fflush(stdout); if (redirect_stderr) fflush(stderr); - int ret = print_failures(); -#if !defined TORRENT_LOGGING - if (ret == 0 && !keep_files) - { - remove_all(test_dir, ec); - if (ec) - fprintf(stderr, "failed to remove test dir: %s\n", ec.message().c_str()); - } -#endif + int total_num_failures = print_failures(); - return total_failures ? 333 : 0; + return total_num_failures ? 333 : 0; } diff --git a/test/test.cpp b/test/test.cpp index 93cacd099..770db6ce9 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE. unit_test_t _g_unit_tests[1024]; int _g_num_unit_tests = 0; -int _g_test_failures = 0; +int _g_test_failures = 0; // flushed at start of every unit int _g_test_idx = 0; static std::vector failure_strings; @@ -65,6 +65,7 @@ int print_failures() } fprintf(stderr, "\n\n"); + int total_num_failures = 0; for (int i = 0; i < _g_num_unit_tests; ++i) { @@ -77,6 +78,7 @@ int print_failures() } else { + total_num_failures += _g_unit_tests[i].num_failures; fprintf(stderr, "\x1b[31m[%-*s] %d FAILURES\n" , longest_name , _g_unit_tests[i].name @@ -86,8 +88,8 @@ int print_failures() fprintf(stderr, "\x1b[0m"); - if (_g_test_failures > 0) + if (total_num_failures > 0) fprintf(stderr, "\n\n\x1b[41m == %d TEST(S) FAILED ==\x1b[0m\n\n\n", _g_test_failures); - return _g_test_failures; + return total_num_failures; } From 116802fcdf7275d2fcf25733d01b4b4de514636f Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 16 Feb 2017 07:03:43 -0500 Subject: [PATCH 5/5] update tuning documentation (#1717) update tuning documentation and make the stats header be posted when logging is disabled (if stats_notifications are enabled) --- bindings/python/test.py | 14 +++- docs/tuning.rst | 110 +++++++++++---------------- include/libtorrent/alert_types.hpp | 4 +- include/libtorrent/settings_pack.hpp | 21 ++--- src/session.cpp | 5 -- src/session_impl.cpp | 3 +- src/settings_pack.cpp | 2 +- 7 files changed, 72 insertions(+), 87 deletions(-) diff --git a/bindings/python/test.py b/bindings/python/test.py index 3ffa8c9ed..62b08d9de 100644 --- a/bindings/python/test.py +++ b/bindings/python/test.py @@ -7,6 +7,7 @@ import time import os import shutil import binascii +import inspect class test_create_torrent(unittest.TestCase): @@ -238,7 +239,18 @@ class test_session(unittest.TestCase): def test_post_session_stats(self): s = lt.session({'alert_mask': lt.alert.category_t.stats_notification, 'enable_dht': False}) s.post_session_stats() - a = s.wait_for_alert(1000) + alerts = [] + # first the stats headers log line. but not if logging is disabled + if 'log_alert' in [i[0] for i in inspect.getmembers(lt)]: + s.wait_for_alert(1000) + alerts = s.pop_alerts() + a = alerts.pop(0) + self.assertTrue(isinstance(a, lt.log_alert)) + # then the actual stats values + if len(alerts) == 0: + s.wait_for_alert(1000) + alerts = s.pop_alerts() + a = alerts.pop(0) self.assertTrue(isinstance(a, lt.session_stats_alert)) self.assertTrue(isinstance(a.values, dict)) self.assertTrue(len(a.values) > 0) diff --git a/docs/tuning.rst b/docs/tuning.rst index b1dcf192a..53bd3b5b4 100644 --- a/docs/tuning.rst +++ b/docs/tuning.rst @@ -23,6 +23,38 @@ computer. This document describes techniques to benchmark libtorrent performance and how parameters are likely to affect it. +profiling +========= + +libtorrent is instrumented with a number of counters and gauges you can have +access to via the ``session_stats_alert``. First, enable these alerts in the +alert mask:: + + settings_pack p; + p.set_int(settings_mask::alert_mask, alert::stats_notification); + ses.apply_settings(p); + +Then print alerts to a file:: + + std::vector alerts; + ses.pop_alerts(&alerts); + + for (auto* a : alerts) { + std::cout << a->message() << "\n"; + } + +If you want to separate generic alerts from session stats, you can filter on the +alert category in the alert, ``alert::category()``. + +The alerts with data will have the type ``session_stats_alert`` and there is one +``session_log_alert`` that will be posted on startup containing the column names +for all metrics. Logging this line will greatly simplify interpreting the output. + +The python scrip in ``tools/parse_session_stats.py`` can parse the resulting +file and produce graphs of relevant stats. It requires gnuplot__. + +__ http://www.gnuplot.info + reducing memory footprint ========================= @@ -145,21 +177,6 @@ all peers. This is the least amount of memory possible for the send buffer. You should benchmark your max send rate when adjusting this setting. If you have a very fast disk, you are less likely see a performance hit. -optimize hashing for memory usage ---------------------------------- - -When libtorrent is doing hash checks of a file, or when it re-reads a piece that -was just completed to verify its hash, there are two options. The default one -is optimized for speed, which allocates buffers for the entire piece, reads in -the whole piece in one read call, then hashes it. - -The second option is to optimize for memory usage instead, where a single buffer -is allocated, and the piece is read one block at a time, hashing it as each -block is read from the file. For low memory environments, this latter approach -is recommended. Change this by settings ``settings_pack::optimize_hashing_for_speed`` -to false. This will significantly reduce peak memory usage, especially for -torrents with very large pieces. - reduce executable size ---------------------- @@ -185,28 +202,6 @@ For all available options, see the `building libtorrent`_ secion. .. _`building libtorrent`: building.html -play nice with the disk -======================= - -When checking a torrent, libtorrent will try to read as fast as possible from the disk. -The only thing that might hold it back is a CPU that is slow at calculating SHA-1 hashes, -but typically the file checking is limited by disk read speed. Most operating systems -today do not prioritize disk access based on the importance of the operation, this means -that checking a torrent might delay other disk accesses, such as virtual memory swapping -or just loading file by other (interactive) applications. - -In order to play nicer with the disk, and leave some spare time for it to service other -processes that might be of higher importance to the end-user, you can introduce a sleep -between the disc accesses. This is a direct tradeoff between how fast you can check a -torrent and how soft you will hit the disk. - -You control this by setting the ``settings_pack::file_checks_delay_per_block`` to greater -than zero. This number is the number of milliseconds to sleep between each read of 16 kiB. - -The sleeps are not necessarily in between each 16 kiB block (it might be read in larger chunks), -but the number will be multiplied by the number of blocks that were read, to maintain the -same semantics. - high performance seeding ======================== @@ -251,25 +246,6 @@ the read cache is removed immediately. This saves a significant amount of cache which can be used as read-ahead for other peers. To enable volatile read cache, set ``settings_pack::volatile_read_cache`` to true. -SSD as level 2 cache --------------------- - -It is possible to introduce a second level of cache, below the RAM disk cache. This is done -by setting ``settings_pack::mmap_cache`` to a file path pointing to the SSD drive, and -increasing the ``settings_pack::cache_size`` to the number of 16 kiB blocks would fit -on the drive (or less). - -This will allocate disk buffers (for reading and writing) from a memory region that has -been mapped to the specified file. If the drive this file lives on is not significantly -faster than the destination drive, performance will be degraded. The point is to take -advantage primarily of the fast read speed from SSD drives and use it to extend the read -cache, improving seed performance. - -Which parts of the cache that actually live in RAM is determined by the operating system. - -Note that when using this feature, any block which ends up being pulled from the mmapped -file will be considered a cache hit. - uTP-TCP mixed mode ------------------ @@ -305,8 +281,8 @@ peers ----- First of all, in order to allow many connections, set the global connection limit -high, ``session::set_max_connections()``. Also set the upload rate limit to -infinite, ``session::set_upload_rate_limit()``, passing 0 means infinite. +high, ``settings_pack::connections_limit``. Also set the upload rate limit to +infinite, ``settings_pack::upload_rate_limit``, 0 means infinite. When dealing with a large number of peers, it might be a good idea to have slightly stricter timeouts, to get rid of lingering connections as soon as possible. @@ -319,9 +295,10 @@ multiple connections from the same IP. That way two people from behind the same can use the service simultaneously. This is controlled by ``settings_pack::allow_multiple_connections_per_ip``. -In order to always unchoke peers, turn off automatic unchoke -``settings_pack::auto_upload_slots`` and set the number of upload slots to a large -number via ``session::set_max_uploads()``, or use -1 (which means infinite). +In order to always unchoke peers, turn off automatic unchoke by setting +``settings_pack::choking_algorithm`` to ``fixed_slot_choker`` and set the number +of upload slots to a large number via ``settings_pack::unchoke_slots_limit``, +or use -1 (which means infinite). torrent limits -------------- @@ -356,12 +333,12 @@ the returned vector. If you have a lot of torrents, you might want to update the of only certain torrents. For instance, you might only be interested in torrents that are being downloaded. -The intended use of these functions is to start off by calling ``get_torrent_status`` -to get a list of all torrents that match your criteria. Then call ``refresh_torrent_status`` +The intended use of these functions is to start off by calling ``get_torrent_status()`` +to get a list of all torrents that match your criteria. Then call ``refresh_torrent_status()`` on that list. This will only refresh the status for the torrents in your list, and thus ignore all other torrents you might be running. This may save a significant amount of time, especially if the number of torrents you're interested in is small. In order to -keep your list of interested torrents up to date, you can either call ``get_torrent_status`` +keep your list of interested torrents up to date, you can either call ``get_torrent_status()`` from time to time, to include torrents you might have become interested in since the last time. In order to stop refreshing a certain torrent, simply remove it from the list. @@ -370,6 +347,9 @@ update your list based on these alerts. There are alerts for when torrents are a paused, resumed, completed etc. Doing this ensures that you only query status for the minimal set of torrents you are actually interested in. +To get an update with only the torrents that have changed since last time, call +``session::post_torrent_updates()``. + benchmarking ============ @@ -455,7 +435,7 @@ covered here, or if you have improved any of the parser scrips, please consider contributing it back to the project. If you have run tests and found that some algorithm or default value in -libtorrent is suboptimal, please contribute that knowledge back as well, to +libtorrent are suboptimal, please contribute that knowledge back as well, to allow us to improve the library. If you have additional suggestions on how to tune libtorrent for any specific diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index 324f9097e..0bddfa547 100644 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -1559,6 +1559,8 @@ namespace libtorrent // This alert is posted approximately once every second, and it contains // byte counters of most statistics that's tracked for torrents. Each active // torrent posts these alerts regularly. + // This alert has been superceded by calling ``post_torrent_updates()`` + // regularly on the session object. This alert will be removed struct TORRENT_EXPORT stats_alert TORRENT_FINAL : torrent_alert { // internal @@ -2448,7 +2450,7 @@ namespace libtorrent // this is posted when one or more blocks are picked by the piece picker, // assuming the verbose piece picker logging is enabled (see // picker_log_notification). - struct TORRENT_EXPORT picker_log_alert : peer_alert + struct TORRENT_EXPORT picker_log_alert TORRENT_FINAL : peer_alert { #ifndef TORRENT_DISABLE_LOGGING diff --git a/include/libtorrent/settings_pack.hpp b/include/libtorrent/settings_pack.hpp index 90db63ed7..70814b445 100644 --- a/include/libtorrent/settings_pack.hpp +++ b/include/libtorrent/settings_pack.hpp @@ -252,10 +252,10 @@ namespace libtorrent // in a swarm has the same IP address. allow_multiple_connections_per_ip = bool_type_base, +#ifndef TORRENT_NO_DEPRECATE // if set to true, upload, download and unchoke limits are ignored for // peers on the local network. This option is *DEPRECATED*, please use // set_peer_class_filter() instead. -#ifndef TORRENT_NO_DEPRECATE ignore_limits_on_local_network, #else deprecated1, @@ -930,7 +930,7 @@ namespace libtorrent // still allocates all upload capacity, but shuffles it around to // the best peers first. For this choker to be efficient, you need // to set a global upload rate limit - // (``session::set_upload_rate_limit()``). For more information + // (``settings_pack::upload_rate_limit``). For more information // about this choker, see the paper_. This choker is not fully // implemented nor tested. // @@ -1170,6 +1170,7 @@ namespace libtorrent recv_socket_buffer_size, send_socket_buffer_size, +#ifndef TORRENT_NO_DEPRECATE // ``file_checks_delay_per_block`` is the number of milliseconds to // sleep in between disk read operations when checking torrents. This // defaults to 0, but can be set to higher numbers to slow down the @@ -1178,6 +1179,9 @@ namespace libtorrent // bit longer, as long as they leave disk I/O time for other // processes. file_checks_delay_per_block, +#else + deprecated14, +#endif // ``read_cache_line_size`` is the number of blocks to read into the // read cache when a read cache miss occurs. Setting this to 0 is @@ -1287,20 +1291,11 @@ namespace libtorrent // share_mode_target is set to more than 3, nothing is downloaded. share_mode_target, - // ``upload_rate_limit``, ``download_rate_limit``, - // ``local_upload_rate_limit`` and ``local_download_rate_limit`` sets + // ``upload_rate_limit`` and ``download_rate_limit`` sets // the session-global limits of upload and download rate limits, in - // bytes per second. The local rates refer to peers on the local - // network. By default peers on the local network are not rate + // bytes per second. By default peers on the local network are not rate // limited. // - // These rate limits are only used for local peers (peers within the - // same subnet as the client itself) and it is only used when - // ``ignore_limits_on_local_network`` is set to true (which it is by - // default). These rate limits default to unthrottled, but can be - // useful in case you want to treat local peers preferentially, but - // not quite unthrottled. - // // A value of 0 means unlimited. upload_rate_limit, download_rate_limit, diff --git a/src/session.cpp b/src/session.cpp index b99e0c505..227c78b7c 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -117,11 +117,6 @@ namespace libtorrent // connect to 5 peers per second set.set_int(settings_pack::connection_speed, 5); - // be extra nice on the hard drive when running - // on embedded devices. This might slow down - // torrent checking - set.set_int(settings_pack::file_checks_delay_per_block, 5); - // only have 4 files open at a time set.set_int(settings_pack::file_pool_size, 4); diff --git a/src/session_impl.cpp b/src/session_impl.cpp index ae1b66555..bd0f29d4e 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -566,7 +566,8 @@ namespace aux { TORRENT_ASSERT(is_single_thread()); #ifndef TORRENT_DISABLE_LOGGING - if (m_alerts.should_post()) + if (m_alerts.should_post() + || m_alerts.should_post()) { session_log(" *** session thread init"); diff --git a/src/settings_pack.cpp b/src/settings_pack.cpp index bc439b1e9..b498aae5f 100644 --- a/src/settings_pack.cpp +++ b/src/settings_pack.cpp @@ -285,7 +285,7 @@ namespace libtorrent SET(max_rejects, 50, 0), SET(recv_socket_buffer_size, 0, &session_impl::update_socket_buffer_size), SET(send_socket_buffer_size, 0, &session_impl::update_socket_buffer_size), - SET(file_checks_delay_per_block, 0, 0), + DEPRECATED_SET(file_checks_delay_per_block, 0, 0), SET(read_cache_line_size, 32, 0), SET(write_cache_line_size, 16, 0), SET(optimistic_disk_retry, 10 * 60, 0),