added an option to not count inactive torrents against the limits for auto managed torrents

This commit is contained in:
Arvid Norberg 2008-06-21 09:15:29 +00:00
parent b183b2e593
commit d0e579826c
2 changed files with 19 additions and 1 deletions

View File

@ -126,6 +126,7 @@ namespace libtorrent
, peer_tos(0)
, active_downloads(8)
, active_seeds(5)
, dont_count_inactive_torrents(true)
, auto_manage_interval(30)
, share_ratio_limit(2.f)
, seed_time_ratio_limit(7.f)
@ -363,6 +364,11 @@ namespace libtorrent
int active_downloads;
int active_seeds;
// if this is true, torrents that don't have any significant
// transfers are not counted as active when determining which
// auto managed torrents to pause and resume
bool dont_count_inactive_torrents;
// the number of seconds in between recalculating which
// torrents to activate and which ones to queue
int auto_manage_interval;

View File

@ -1357,10 +1357,16 @@ namespace aux {
, end(downloaders.end()); i != end; ++i)
{
torrent* t = *i;
if (!t->is_paused()
&& settings().dont_count_inactive_torrents
&& t->statistics().upload_payload_rate() == 0.f
&& t->statistics().download_payload_rate() == 0.f)
continue;
if (num_downloaders > 0)
{
if (t->state() != torrent_status::queued_for_checking
&& t->state() != torrent_status::checking_files)
&& t->state() != torrent_status::checking_files)
{
--num_downloaders;
--num_seeds;
@ -1377,6 +1383,12 @@ namespace aux {
, end(seeds.end()); i != end; ++i)
{
torrent* t = *i;
if (!t->is_paused()
&& settings().dont_count_inactive_torrents
&& t->statistics().upload_payload_rate() == 0.f
&& t->statistics().download_payload_rate() == 0.f)
continue;
if (num_seeds > 0)
{
--num_downloaders;