fix force-reannounce and tracker retry issue
This commit is contained in:
parent
21e2894a4d
commit
aa25ed00c6
|
@ -36,6 +36,8 @@
|
||||||
incoming connection
|
incoming connection
|
||||||
* added more detailed instrumentation of the disk I/O thread
|
* added more detailed instrumentation of the disk I/O thread
|
||||||
|
|
||||||
|
* fix force-reannounce and tracker retry issue
|
||||||
|
|
||||||
0.15.1 release
|
0.15.1 release
|
||||||
|
|
||||||
* fixed rare crash when purging the peer list
|
* fixed rare crash when purging the peer list
|
||||||
|
|
|
@ -1469,11 +1469,12 @@ int main(int argc, char* argv[])
|
||||||
for (std::vector<announce_entry>::iterator i = tr.begin()
|
for (std::vector<announce_entry>::iterator i = tr.begin()
|
||||||
, end(tr.end()); i != end; ++i)
|
, end(tr.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
snprintf(str, sizeof(str), "%2d %-55s fails: %-3d (%-3d) %s %s \"%s\" %s\n"
|
snprintf(str, sizeof(str), "%2d %-55s fails: %-3d (%-3d) %s %s %5d \"%s\" %s\n"
|
||||||
, i->tier, i->url.c_str(), i->fails, i->fail_limit, i->verified?"OK ":"- "
|
, i->tier, i->url.c_str(), i->fails, i->fail_limit, i->verified?"OK ":"- "
|
||||||
, i->updating?"updating"
|
, i->updating?"updating"
|
||||||
:!i->will_announce(now)?""
|
:!i->will_announce(now)?""
|
||||||
:to_string(total_seconds(i->next_announce - now), 8).c_str()
|
:to_string(total_seconds(i->next_announce - now), 8).c_str()
|
||||||
|
, i->min_announce > now ? total_seconds(i->min_announce - now) : 0
|
||||||
, i->last_error ? i->last_error.message().c_str() : ""
|
, i->last_error ? i->last_error.message().c_str() : ""
|
||||||
, i->message.c_str());
|
, i->message.c_str());
|
||||||
out += str;
|
out += str;
|
||||||
|
|
|
@ -75,6 +75,8 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
announce_entry(std::string const& u)
|
announce_entry(std::string const& u)
|
||||||
: url(u)
|
: url(u)
|
||||||
|
, next_announce(min_time())
|
||||||
|
, min_announce(min_time())
|
||||||
, tier(0)
|
, tier(0)
|
||||||
, fail_limit(3)
|
, fail_limit(3)
|
||||||
, fails(0)
|
, fails(0)
|
||||||
|
|
|
@ -1732,7 +1732,7 @@ namespace libtorrent
|
||||||
void torrent::force_tracker_request()
|
void torrent::force_tracker_request()
|
||||||
{
|
{
|
||||||
if (is_paused()) return;
|
if (is_paused()) return;
|
||||||
ptime now = time_now();
|
ptime now = time_now_hires();
|
||||||
for (std::vector<announce_entry>::iterator i = m_trackers.begin()
|
for (std::vector<announce_entry>::iterator i = m_trackers.begin()
|
||||||
, end(m_trackers.end()); i != end; ++i)
|
, end(m_trackers.end()); i != end; ++i)
|
||||||
i->next_announce = (std::max)(now, i->min_announce);
|
i->next_announce = (std::max)(now, i->min_announce);
|
||||||
|
@ -1745,7 +1745,7 @@ namespace libtorrent
|
||||||
for (std::vector<announce_entry>::iterator i = m_trackers.begin()
|
for (std::vector<announce_entry>::iterator i = m_trackers.begin()
|
||||||
, end(m_trackers.end()); i != end; ++i)
|
, 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);
|
||||||
update_tracker_timer(time_now());
|
update_tracker_timer(time_now_hires());
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent::set_tracker_login(
|
void torrent::set_tracker_login(
|
||||||
|
@ -5536,18 +5536,25 @@ namespace libtorrent
|
||||||
&& !settings().announce_to_all_tiers) break;
|
&& !settings().announce_to_all_tiers) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next_announce == max_time()
|
if (next_announce == max_time()) return;
|
||||||
|| next_announce <= now) return;
|
|
||||||
|
m_waiting_tracker = true;
|
||||||
|
error_code ec;
|
||||||
|
boost::weak_ptr<torrent> 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
|
// since we don't know if we have to re-issue the async_wait or not
|
||||||
// always do it
|
// always do it
|
||||||
// if (m_tracker_timer.expires_at() <= next_announce) return;
|
// if (m_tracker_timer.expires_at() <= next_announce) return;
|
||||||
|
|
||||||
error_code ec;
|
|
||||||
boost::weak_ptr<torrent> self(shared_from_this());
|
|
||||||
m_tracker_timer.expires_at(next_announce, ec);
|
m_tracker_timer.expires_at(next_announce, ec);
|
||||||
m_tracker_timer.async_wait(boost::bind(&torrent::on_tracker_announce_disp, self, _1));
|
m_tracker_timer.async_wait(boost::bind(&torrent::on_tracker_announce_disp, self, _1));
|
||||||
m_waiting_tracker = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent::start_announcing()
|
void torrent::start_announcing()
|
||||||
|
|
Loading…
Reference in New Issue