fix torrent_status::next_announce

This commit is contained in:
arvidn 2018-01-29 00:22:59 +01:00 committed by Arvid Norberg
parent ca3ea591df
commit 01c41fadcf
4 changed files with 9 additions and 12 deletions

View File

@ -1,4 +1,5 @@
* fix torrent_status::next_announce
* fix pad-file scalability issue * fix pad-file scalability issue
* made coalesce_reads/coalesce_writes settings take effect on linux and windows * made coalesce_reads/coalesce_writes settings take effect on linux and windows
* restore support for incoming connections over SOCKS5 (disabled by default) * restore support for incoming connections over SOCKS5 (disabled by default)

View File

@ -2048,6 +2048,11 @@ int main(int argc, char* argv[])
if (print_trackers) if (print_trackers)
{ {
snprintf(str, sizeof(str), "next_announce: %4" PRId64 " | current tracker: %s\x1b[K\n"
, boost::int64_t(duration_cast<seconds>(s.next_announce).count())
, s.current_tracker.c_str());
out += str;
pos += 1;
std::vector<announce_entry> tr = h.trackers(); std::vector<announce_entry> tr = h.trackers();
time_point now = clock_type::now(); time_point now = clock_type::now();
for (std::vector<announce_entry>::iterator i = tr.begin() for (std::vector<announce_entry>::iterator i = tr.begin()

View File

@ -730,10 +730,6 @@ namespace libtorrent
// immediately // immediately
void do_connect_boost(); void do_connect_boost();
// returns the absolute time when the next tracker
// announce will take place.
time_point next_announce() const;
// forcefully sets next_announce to the current time // forcefully sets next_announce to the current time
void force_tracker_request(time_point, int tracker_idx); void force_tracker_request(time_point, int tracker_idx);
void scrape_tracker(int idx, bool user_triggered); void scrape_tracker(int idx, bool user_triggered);

View File

@ -3768,11 +3768,6 @@ namespace {
if (want_peers()) m_ses.prioritize_connections(shared_from_this()); if (want_peers()) m_ses.prioritize_connections(shared_from_this());
} }
time_point torrent::next_announce() const
{
return m_waiting_tracker?m_tracker_timer.expires_at():min_time();
}
// this is the entry point for the client to force a re-announce. It's // this is the entry point for the client to force a re-announce. It's
// considered a client-initiated announce (as opposed to the regular ones, // considered a client-initiated announce (as opposed to the regular ones,
// issued by libtorrent) // issued by libtorrent)
@ -12208,10 +12203,10 @@ namespace {
st->download_payload_rate = m_stat.download_payload_rate(); st->download_payload_rate = m_stat.download_payload_rate();
st->upload_payload_rate = m_stat.upload_payload_rate(); st->upload_payload_rate = m_stat.upload_payload_rate();
if (m_waiting_tracker && !is_paused()) if (is_paused() || m_tracker_timer.expires_at() < now)
st->next_announce = next_announce() - now;
else
st->next_announce = seconds(0); st->next_announce = seconds(0);
else
st->next_announce = m_tracker_timer.expires_at() - now;
if (st->next_announce.count() < 0) if (st->next_announce.count() < 0)
st->next_announce = seconds(0); st->next_announce = seconds(0);