diff --git a/docs/manual.rst b/docs/manual.rst index f351e58c4..3474252dc 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -2981,6 +2981,9 @@ that will be sent to the tracker. The user-agent is a good way to identify your int max_peerlist_size; int min_announce_interval; + + bool prioritize_partial_pieces; + int auto_manage_startup; }; ``user_agent`` this is the client identification to the tracker. @@ -3252,6 +3255,16 @@ for a tracker. This is specified in seconds, defaults to 5 minutes and is used as a sanity check on what is returned from a tracker. It mitigates hammering misconfigured trackers. +If ``prioritize_partial_pieces`` is true, partial pieces are picked +before pieces that are more rare. If false, rare pieces are always +prioritized, unless the number of partial pieces is growing out of +proportion. + +``auto_manage_startup`` is the number of seconds a torrent is considered +active after it was started, regardless of upload and download speed. This +is so that newly started torrents are not considered inactive until they +have a fair chance to start downloading. + pe_settings =========== diff --git a/include/libtorrent/session_settings.hpp b/include/libtorrent/session_settings.hpp index 3d48fbbba..e71efc7e3 100644 --- a/include/libtorrent/session_settings.hpp +++ b/include/libtorrent/session_settings.hpp @@ -142,6 +142,7 @@ namespace libtorrent , max_peerlist_size(8000) , min_announce_interval(5 * 60) , prioritize_partial_pieces(false) + , auto_manage_startup(120) {} // this is the user agent that will be sent to the tracker @@ -441,6 +442,14 @@ namespace libtorrent // if true, partial pieces are picked before pieces // that are more rare bool prioritize_partial_pieces; + + // the number of seconds a torrent is considered + // active after it was started, regardless of + // upload and download speed. This is so that + // newly started torrents are not considered + // inactive until they have a fair chance to + // start downloading. + int auto_manage_startup; }; #ifndef TORRENT_DISABLE_DHT diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index e2b0078c9..f4ad12f17 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -217,6 +217,7 @@ namespace libtorrent void pause(); void resume(); + ptime started() const { return m_started; } void do_pause(); void do_resume(); diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 885ff8e63..c7409a8fc 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1290,7 +1290,8 @@ namespace aux { { return !(s.dont_count_slow_torrents && t->statistics().upload_payload_rate() == 0.f - && t->statistics().download_payload_rate() == 0.f); + && t->statistics().download_payload_rate() == 0.f + && time_now() - t->started() > seconds(s.auto_manage_startup)); } }