forked from premiere/premiere-libtorrent
simplified is_active() function
This commit is contained in:
parent
89c7a3168b
commit
54eb378a1e
|
@ -1299,10 +1299,17 @@ namespace aux {
|
||||||
{
|
{
|
||||||
bool is_active(torrent* t, session_settings const& s)
|
bool is_active(torrent* t, session_settings const& s)
|
||||||
{
|
{
|
||||||
return !(s.dont_count_slow_torrents
|
// if we count slow torrents, every torrent
|
||||||
&& t->statistics().upload_payload_rate() == 0.f
|
// is considered active
|
||||||
&& t->statistics().download_payload_rate() == 0.f
|
if (!s.dont_count_slow_torrents) return true;
|
||||||
&& time_now() - t->started() > seconds(s.auto_manage_startup));
|
|
||||||
|
// if the torrent started less than 2 minutes
|
||||||
|
// ago (default), let it count as active since
|
||||||
|
// the rates are probably not accurate yet
|
||||||
|
if (time_now() - t->started() < seconds(s.auto_manage_startup)) return true;
|
||||||
|
|
||||||
|
return t->statistics().upload_payload_rate() != 0.f
|
||||||
|
|| t->statistics().download_payload_rate() != 0.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue