document peer turnover settings and update default settings to enable it. In trunk, make the peer turnover interval configurable as well

This commit is contained in:
Arvid Norberg 2010-10-30 15:59:57 +00:00
parent e4de1fc8b1
commit 08a234f6a6
4 changed files with 28 additions and 5 deletions

View File

@ -77,6 +77,7 @@ void bind_session_settings()
.def_readwrite("share_ratio_limit", &session_settings::share_ratio_limit)
.def_readwrite("seed_time_ratio_limit", &session_settings::seed_time_ratio_limit)
.def_readwrite("seed_time_limit", &session_settings::seed_time_limit)
.def_readwrite("peer_turnover_interval", &session_settings::peer_turnover_interval)
.def_readwrite("peer_turnover", &session_settings::peer_turnover)
.def_readwrite("peer_turnover_cutoff", &session_settings::peer_turnover_cutoff)
.def_readwrite("close_redundant_connections", &session_settings::close_redundant_connections)

View File

@ -3805,6 +3805,9 @@ session_settings
float share_ratio_limit;
float seed_time_ratio_limit;
int seed_time_limit;
int peer_turnover_interval;
float peer_turnover;
float peer_turnover_cutoff;
bool close_redundant_connections;
int auto_scrape_interval;
@ -4269,6 +4272,19 @@ for considering a seeding torrent to have met the seed limit criteria. See queui
(specified in seconds) before it is considered having met the seed limit criteria.
See queuing_.
``peer_turnover_interval`` controls a feature where libtorrent periodically can disconnect
the least useful peers in the hope of connecting to better ones. This settings controls
the interval of this optimistic disconnect. It defaults to every 5 minutes, and
is specified in seconds.
``peer_turnover`` Is the fraction of the peers that are disconnected. This is
a float where 1.f represents all peers an 0 represents no peers. It defaults to
4% (i.e. 0.04f)
``peer_turnover_cutoff`` is the cut off trigger for optimistic unchokes. If a torrent
has more than this fraction of its connection limit, the optimistic unchoke is
triggered. This defaults to 90% (i.e. 0.9f).
``close_redundant_connections`` specifies whether libtorrent should close
connections where both ends have no utility in keeping the connection open.
For instance if both ends have completed their downloads, there's no point

View File

@ -164,8 +164,9 @@ namespace libtorrent
, share_ratio_limit(2.f)
, seed_time_ratio_limit(7.f)
, seed_time_limit(24 * 60 * 60) // 24 hours
, peer_turnover(1 / 100.f)
, peer_turnover_cutoff(1.1f) // disable until the crash is resolved
, peer_turnover_interval(300)
, peer_turnover(2 / 50.f)
, peer_turnover_cutoff(.9f)
, close_redundant_connections(true)
, auto_scrape_interval(1800)
, auto_scrape_min_interval(300)
@ -580,9 +581,14 @@ namespace libtorrent
float seed_time_ratio_limit;
int seed_time_limit;
// the interval (in seconds) between optimistic disconnects
// if the disconnects happen and how many peers are disconnected
// is controlled by peer_turnover and peer_turnover_cutoff
int peer_turnover_interval;
// the percentage of peers to disconnect every
// 90 seconds (if we're at the peer limit)
// defaults to 1/50:th
// turnoever interval (if we're at the peer limit)
// defaults to 2/50:th
float peer_turnover;
// when we are connected to more than

View File

@ -2501,7 +2501,7 @@ namespace aux {
--m_disconnect_time_scaler;
if (m_disconnect_time_scaler <= 0)
{
m_disconnect_time_scaler = 90;
m_disconnect_time_scaler = m_settings.peer_turnover_interval;
if (num_connections() >= m_settings.connections_limit * m_settings.peer_turnover_cutoff
&& !m_torrents.empty())