added torrent_status::finished_time

This commit is contained in:
Arvid Norberg 2009-09-30 17:21:59 +00:00
parent dfccf0b412
commit ea1761838a
6 changed files with 23 additions and 9 deletions

View File

@ -71,6 +71,7 @@
* added support for bitcomet padding files * added support for bitcomet padding files
* improved support for sparse files on windows * improved support for sparse files on windows
* added ability to give seeding torrents preference to active slots * added ability to give seeding torrents preference to active slots
* added torrent_status::finished_time
release 0.14.7 release 0.14.7

View File

@ -74,6 +74,7 @@ void bind_torrent_status()
.def_readonly("all_time_upload", &torrent_status::all_time_upload) .def_readonly("all_time_upload", &torrent_status::all_time_upload)
.def_readonly("all_time_download", &torrent_status::all_time_download) .def_readonly("all_time_download", &torrent_status::all_time_download)
.def_readonly("active_time", &torrent_status::active_time) .def_readonly("active_time", &torrent_status::active_time)
.def_readonly("finished_time", &torrent_status::finished_time)
.def_readonly("seeding_time", &torrent_status::seeding_time) .def_readonly("seeding_time", &torrent_status::seeding_time)
.def_readonly("seed_rank", &torrent_status::seed_rank) .def_readonly("seed_rank", &torrent_status::seed_rank)
.def_readonly("last_scrape", &torrent_status::last_scrape) .def_readonly("last_scrape", &torrent_status::last_scrape)

View File

@ -2885,6 +2885,7 @@ It contains the following fields::
size_type all_time_download; size_type all_time_download;
int active_time; int active_time;
int finished_time;
int seeding_time; int seeding_time;
int seed_rank; int seed_rank;
@ -3089,11 +3090,12 @@ the ``session_status`` object.
payload byte counters. They are saved in and restored from resume data to keep totals payload byte counters. They are saved in and restored from resume data to keep totals
across sessions. across sessions.
``active_time`` and ``seeding_time`` are second counters. They keep track of the ``active_time``, ``finished_time`` and ``seeding_time`` are second counters.
number of seconds this torrent has been active (not paused) and the number of They keep track of the number of seconds this torrent has been active (not
seconds it has been active while being a seed. ``seeding_time`` should be >= paused) and the number of seconds it has been active while being finished and
``active_time`` They are saved in and restored from resume data, to keep totals active while being a seed. ``seeding_time`` should be >= ``finished_time`` which
across sessions. should be >= ``active_time``. They are all saved in and restored from resume data,
to keep totals across sessions.
``seed_rank`` is a rank of how important it is to seed the torrent, it is used ``seed_rank`` is a rank of how important it is to seed the torrent, it is used
to determine which torrents to seed and which to queue. It is based on the peer to determine which torrents to seed and which to queue. It is based on the peer

View File

@ -736,6 +736,10 @@ namespace libtorrent
// does not count when the torrent is stopped or paused // does not count when the torrent is stopped or paused
time_duration m_active_time; time_duration m_active_time;
// total time we've been finished with this torrent
// does not count when the torrent is stopped or paused
time_duration m_finished_time;
// total time we've been available as a seed on this torrent // total time we've been available as a seed on this torrent
// does not count when the torrent is stopped or paused // does not count when the torrent is stopped or paused
time_duration m_seeding_time; time_duration m_seeding_time;

View File

@ -112,6 +112,7 @@ namespace libtorrent
, all_time_upload(0) , all_time_upload(0)
, all_time_download(0) , all_time_download(0)
, active_time(0) , active_time(0)
, finished_time(0)
, seeding_time(0) , seeding_time(0)
, seed_rank(0) , seed_rank(0)
, last_scrape(0) , last_scrape(0)
@ -272,6 +273,7 @@ namespace libtorrent
// and as being a seed, saved and restored // and as being a seed, saved and restored
// from resume data // from resume data
int active_time; int active_time;
int finished_time;
int seeding_time; int seeding_time;
// higher value means more important to seed // higher value means more important to seed

View File

@ -205,6 +205,7 @@ namespace libtorrent
, add_torrent_params const& p) , add_torrent_params const& p)
: m_policy(this) : m_policy(this)
, m_active_time(seconds(0)) , m_active_time(seconds(0))
, m_finished_time(seconds(0))
, m_seeding_time(seconds(0)) , m_seeding_time(seconds(0))
, m_total_uploaded(0) , m_total_uploaded(0)
, m_total_downloaded(0) , m_total_downloaded(0)
@ -3382,6 +3383,7 @@ namespace libtorrent
m_total_uploaded = rd.dict_find_int_value("total_uploaded"); m_total_uploaded = rd.dict_find_int_value("total_uploaded");
m_total_downloaded = rd.dict_find_int_value("total_downloaded"); m_total_downloaded = rd.dict_find_int_value("total_downloaded");
m_active_time = seconds(rd.dict_find_int_value("active_time")); m_active_time = seconds(rd.dict_find_int_value("active_time"));
m_finished_time = seconds(rd.dict_find_int_value("finished_time"));
m_seeding_time = seconds(rd.dict_find_int_value("seeding_time")); m_seeding_time = seconds(rd.dict_find_int_value("seeding_time"));
m_complete = rd.dict_find_int_value("num_seeds", -1); m_complete = rd.dict_find_int_value("num_seeds", -1);
m_incomplete = rd.dict_find_int_value("num_downloaders", -1); m_incomplete = rd.dict_find_int_value("num_downloaders", -1);
@ -3521,6 +3523,7 @@ namespace libtorrent
ret["total_downloaded"] = m_total_downloaded; ret["total_downloaded"] = m_total_downloaded;
ret["active_time"] = total_seconds(m_active_time); ret["active_time"] = total_seconds(m_active_time);
ret["finished_time"] = total_seconds(m_finished_time);
ret["seeding_time"] = total_seconds(m_seeding_time); ret["seeding_time"] = total_seconds(m_seeding_time);
int seeds = 0; int seeds = 0;
@ -4885,15 +4888,15 @@ namespace libtorrent
ptime now = time_now(); ptime now = time_now();
int seed_time = total_seconds(m_seeding_time); int finished_time = total_seconds(m_finished_time);
int download_time = total_seconds(m_active_time) - seed_time; int download_time = total_seconds(m_active_time) - finished_time;
// if we haven't yet met the seed limits, set the seed_ratio_not_met // if we haven't yet met the seed limits, set the seed_ratio_not_met
// flag. That will make this seed prioritized // flag. That will make this seed prioritized
// downloaded may be 0 if the torrent is 0-sized // downloaded may be 0 if the torrent is 0-sized
size_type downloaded = (std::max)(m_total_downloaded, m_torrent_file->total_size()); size_type downloaded = (std::max)(m_total_downloaded, m_torrent_file->total_size());
if (seed_time < s.seed_time_limit if (finished_time < s.seed_time_limit
&& (download_time > 1 && seed_time / download_time < s.seed_time_ratio_limit) && (download_time > 1 && finished_time / download_time < s.seed_time_ratio_limit)
&& downloaded > 0 && downloaded > 0
&& m_total_uploaded / downloaded < s.share_ratio_limit) && m_total_uploaded / downloaded < s.share_ratio_limit)
ret |= seed_ratio_not_met; ret |= seed_ratio_not_met;
@ -5769,6 +5772,7 @@ namespace libtorrent
st.all_time_upload = m_total_uploaded; st.all_time_upload = m_total_uploaded;
st.all_time_download = m_total_downloaded; st.all_time_download = m_total_downloaded;
st.active_time = total_seconds(m_active_time);
st.active_time = total_seconds(m_active_time); st.active_time = total_seconds(m_active_time);
st.seeding_time = total_seconds(m_seeding_time); st.seeding_time = total_seconds(m_seeding_time);