From 54eb378a1ea5e28fc860fdca31404c0d5a24835d Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 19 Oct 2008 04:31:33 +0000 Subject: [PATCH] simplified is_active() function --- src/session_impl.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 1312844bc..253bf0778 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1299,10 +1299,17 @@ namespace aux { { bool is_active(torrent* t, session_settings const& s) { - return !(s.dont_count_slow_torrents - && t->statistics().upload_payload_rate() == 0.f - && t->statistics().download_payload_rate() == 0.f - && time_now() - t->started() > seconds(s.auto_manage_startup)); + // if we count slow torrents, every torrent + // is considered active + if (!s.dont_count_slow_torrents) return true; + + // 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; } }