added 'added' and 'completed' time to torrent_status
This commit is contained in:
parent
5247db7f90
commit
a3bff512e1
|
@ -3055,6 +3055,9 @@ It contains the following fields::
|
|||
bool upload_mode;
|
||||
|
||||
int priority;
|
||||
|
||||
time_t added_time;
|
||||
time_t completed_time;
|
||||
};
|
||||
|
||||
``progress`` is a value in the range [0, 1], that represents the progress of the
|
||||
|
@ -3277,6 +3280,12 @@ been resolved. If the torrent is not auto-managed, you have to explicitly
|
|||
take it out of the upload mode by calling `set_upload_mode()`_ on the
|
||||
torrent_handle_.
|
||||
|
||||
``added_time`` is the posix-time when this torrent was added. i.e. what
|
||||
``time(NULL)`` returned at the time.
|
||||
|
||||
``completed_time`` is the posix-time when this torrent was finished. If
|
||||
the torrent is not yet finished, this is 0.
|
||||
|
||||
peer_info
|
||||
=========
|
||||
|
||||
|
|
|
@ -969,6 +969,12 @@ namespace libtorrent
|
|||
boost::uint32_t m_total_failed_bytes;
|
||||
boost::uint32_t m_total_redundant_bytes;
|
||||
|
||||
// the posix time this torrent was added and when
|
||||
// it was completed. If the torrent isn't yet
|
||||
// completed, m_completed_time is 0
|
||||
time_t m_added_time;
|
||||
time_t m_completed_time;
|
||||
|
||||
// ==============================
|
||||
// The following members are specifically
|
||||
// ordered to make the 24 bit members
|
||||
|
|
|
@ -124,6 +124,8 @@ namespace libtorrent
|
|||
, seed_mode(false)
|
||||
, upload_mode(false)
|
||||
, priority(0)
|
||||
, added_time(0)
|
||||
, completed_time(0)
|
||||
{}
|
||||
|
||||
enum state_t
|
||||
|
@ -303,6 +305,10 @@ namespace libtorrent
|
|||
|
||||
// the priority of this torrent
|
||||
int priority;
|
||||
|
||||
// the time this torrent was added and completed
|
||||
time_t added_time;
|
||||
time_t completed_time;
|
||||
};
|
||||
|
||||
struct TORRENT_EXPORT block_info
|
||||
|
|
|
@ -326,6 +326,8 @@ namespace libtorrent
|
|||
, m_piece_time_deviation(0)
|
||||
, m_total_failed_bytes(0)
|
||||
, m_total_redundant_bytes(0)
|
||||
, m_added_time(time(0))
|
||||
, m_completed_time(0)
|
||||
, m_upload_mode_time(0)
|
||||
, m_state(torrent_status::checking_resume_data)
|
||||
, m_storage_mode(p.storage_mode)
|
||||
|
@ -3600,6 +3602,11 @@ namespace libtorrent
|
|||
if (m_seed_mode) m_verified.resize(m_torrent_file->num_pieces(), false);
|
||||
super_seeding(rd.dict_find_int_value("super_seeding", 0));
|
||||
|
||||
m_added_time = rd.dict_find_int_value("added_time", m_added_time);
|
||||
m_completed_time = rd.dict_find_int_value("completed_time", m_completed_time);
|
||||
if (m_completed_time != 0 && m_completed_time < m_added_time)
|
||||
m_completed_time = m_added_time;
|
||||
|
||||
lazy_entry const* file_priority = rd.dict_find_list("file_priority");
|
||||
if (file_priority && file_priority->list_size()
|
||||
== m_torrent_file->num_files())
|
||||
|
@ -3748,6 +3755,9 @@ namespace libtorrent
|
|||
ret["seed_mode"] = m_seed_mode;
|
||||
ret["super_seeding"] = m_super_seeding;
|
||||
|
||||
ret["added_time"] = m_added_time;
|
||||
ret["completed_time"] = m_completed_time;
|
||||
|
||||
const sha1_hash& info_hash = torrent_file().info_hash();
|
||||
ret["info-hash"] = std::string((char*)info_hash.begin(), (char*)info_hash.end());
|
||||
|
||||
|
@ -4463,6 +4473,8 @@ namespace libtorrent
|
|||
|
||||
send_upload_only();
|
||||
|
||||
m_completed_time = time(0);
|
||||
|
||||
// disconnect all seeds
|
||||
// TODO: should disconnect all peers that have the pieces we have
|
||||
// not just seeds
|
||||
|
@ -4504,6 +4516,8 @@ namespace libtorrent
|
|||
set_queue_position((std::numeric_limits<int>::max)());
|
||||
m_policy.recalculate_connect_candidates();
|
||||
|
||||
m_completed_time = 0;
|
||||
|
||||
send_upload_only();
|
||||
}
|
||||
|
||||
|
@ -6106,6 +6120,9 @@ namespace libtorrent
|
|||
if (m_error) st.error = m_error.message() + ": " + m_error_file;
|
||||
st.seed_mode = m_seed_mode;
|
||||
|
||||
st.added_time = m_added_time;
|
||||
st.completed_time - m_completed_time;
|
||||
|
||||
st.last_scrape = m_last_scrape;
|
||||
st.upload_mode = m_upload_mode;
|
||||
st.up_bandwidth_queue = 0;
|
||||
|
|
Loading…
Reference in New Issue