From 23646992922ed207a3646d2925f6c157b68072d1 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 10 Jun 2018 18:18:53 +0200 Subject: [PATCH 1/2] clarify documentation for move_storage() --- include/libtorrent/torrent_handle.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index 00b322150..99770a6a0 100644 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -1254,9 +1254,13 @@ namespace libtorrent // fails, ask the user which mode to use. The client may then re-issue // the ``move_storage`` call with one of the other modes. // - // ``dont_replace`` always takes the existing file in the target + // ``dont_replace`` always keeps the existing file in the target // directory, if there is one. The source files will still be removed in - // that case. + // that case. Note that it won't automatically re-check files. If an + // incomplete torrent is moved into a directory with the complete files, + // pause, move, force-recheck and resume. Without the re-checking, the + // torrent will keep downloading and files in the new download directory + // will be overwritten. // // Files that have been renamed to have absolute paths are not moved by // this function. Keep in mind that files that don't belong to the From af686a3819409dfa78ccf09236e2ab7246187cc4 Mon Sep 17 00:00:00 2001 From: arvidn Date: Thu, 14 Jun 2018 23:53:13 +0200 Subject: [PATCH 2/2] add switch to client_test to log session stats --- examples/client_test.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/examples/client_test.cpp b/examples/client_test.cpp index db53a4524..c8ce24b0d 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -625,6 +625,7 @@ std::string bind_to_interface = ""; int poll_interval = 5; int max_connections_per_torrent = 50; bool seed_mode = false; +bool stats_enabled = false; int cache_size = 1024; bool share_mode = false; @@ -914,7 +915,7 @@ bool handle_alert(torrent_view& view, session_view& ses_view { ses_view.update_counters(s->values, sizeof(s->values)/sizeof(s->values[0]) , duration_cast(s->timestamp().time_since_epoch()).count()); - return true; + return !stats_enabled; } #ifndef TORRENT_DISABLE_DHT @@ -1224,6 +1225,7 @@ int main(int argc, char* argv[]) " -G Add torrents in seed-mode (i.e. assume all pieces\n" " are present and check hashes on-demand)\n" " -E specify how many disk I/O threads to use\n" + " -O print session stats counters to the log\n" "\n BITTORRENT OPTIONS\n" " -c sets the max number of connections\n" " -T sets the max number of connections per torrent\n" @@ -1284,7 +1286,7 @@ int main(int argc, char* argv[]) "URL is a url to a torrent file\n" "\n" "Example for running benchmark:\n\n" - " client_test -k -z -N -h -H -M -l 2000 -S 1000 -T 1000 -c 1000 test.torrent\n"); + " client_test -k -z -N -h -H -M -l 2000 -S 1000 -T 1000 -c 1000 -O test.torrent\n"); ; return 0; } @@ -1371,6 +1373,7 @@ int main(int argc, char* argv[]) case 'B': settings.set_int(settings_pack::peer_timeout, atoi(arg)); break; case 'n': settings.set_bool(settings_pack::announce_to_all_tiers, true); --i; break; case 'G': seed_mode = true; --i; break; + case 'O': stats_enabled = true; --i; break; case 'E': settings.set_int(settings_pack::aio_threads, atoi(arg)); break; case 'd': settings.set_int(settings_pack::download_rate_limit, atoi(arg) * 1000); break; case 'u': settings.set_int(settings_pack::upload_rate_limit, atoi(arg) * 1000); break; @@ -1753,7 +1756,11 @@ int main(int argc, char* argv[]) ses.async_add_torrent(p); } - if (c == 'q') break; + if (c == 'q') + { + quit = true; + break; + } if (c == 'W' && h.is_valid()) { @@ -1937,7 +1944,11 @@ int main(int argc, char* argv[]) } } while (sleep_and_input(&c, 0)); - if (c == 'q') break; + if (c == 'q') + { + quit = true; + break; + } } // loop through the alert queue to see if anything has happened.