From 0c7b5ab3da2b0f42292e45d515c1114e75394d07 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 17 Jul 2010 23:32:17 +0000 Subject: [PATCH] fix to tracker announce code --- src/torrent.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/torrent.cpp b/src/torrent.cpp index d5686c8dd..a4a915855 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -1523,6 +1523,8 @@ namespace libtorrent m_ses.m_tracker_manager.queue_request(m_ses.m_io_service, m_ses.m_half_open, req , tracker_login() , m_abort?boost::shared_ptr():shared_from_this()); ae.updating = true; + ae.next_announce = now + seconds(20); + ae.min_announce = now + seconds(10); if (m_ses.m_alerts.should_post()) { @@ -1750,12 +1752,7 @@ namespace libtorrent void torrent::force_tracker_request() { - if (is_paused()) return; - ptime now = time_now_hires(); - for (std::vector::iterator i = m_trackers.begin() - , end(m_trackers.end()); i != end; ++i) - i->next_announce = (std::max)(now, i->min_announce); - update_tracker_timer(now); + force_tracker_request(time_now_hires()); } void torrent::force_tracker_request(ptime t) @@ -1763,7 +1760,7 @@ namespace libtorrent if (is_paused()) return; for (std::vector::iterator i = m_trackers.begin() , end(m_trackers.end()); i != end; ++i) - i->next_announce = (std::max)(t, i->min_announce); + i->next_announce = (std::max)(t, i->min_announce) + seconds(1); update_tracker_timer(time_now_hires()); } @@ -5563,19 +5560,12 @@ namespace libtorrent && !settings().announce_to_all_tiers) break; } - if (next_announce == max_time()) return; + if (next_announce <= now) return; m_waiting_tracker = true; error_code ec; boost::weak_ptr self(shared_from_this()); - if (next_announce <= now) - { - // no need to post this via asio, just call directly - on_tracker_announce_disp(self, ec); - return; - } - // since we don't know if we have to re-issue the async_wait or not // always do it // if (m_tracker_timer.expires_at() <= next_announce) return;