fixed bug where trackers wouldn't be retried if they failed

This commit is contained in:
Arvid Norberg 2010-04-27 18:22:59 +00:00
parent 8d3733b013
commit 2705859bb4
4 changed files with 17 additions and 9 deletions

View File

@ -28,6 +28,7 @@
incoming connection
* added more detailed instrumentation of the disk I/O thread
* fixed bug where trackers wouldn't be retried if they failed
* slight performance fix in disk elevator algorithm
* fixed potential issue where a piece could be checked twice
* fixed build issue on windows related to GetCompressedSize()

View File

@ -1432,7 +1432,7 @@ int main(int argc, char* argv[])
snprintf(str, sizeof(str), "%2d %-55s fails: %-3d %s %s \"%s\" %s\n"
, i->tier, i->url.c_str(), i->fails, i->verified?"OK ":"- "
, i->updating?"updating"
:!i->verified?""
:!i->will_announce(now)?""
:to_string(total_seconds(i->next_announce - now), 8).c_str()
, i->last_error ? i->last_error.message().c_str() : ""
, i->message.c_str());

View File

@ -149,6 +149,13 @@ namespace libtorrent
void failed(int retry_interval = 0);
bool will_announce(ptime now) const
{
return now <= next_announce
&& (fails < fail_limit || fail_limit == 0)
&& !updating;
}
bool can_announce(ptime now) const
{
return now >= next_announce

View File

@ -5477,14 +5477,14 @@ namespace libtorrent
if (i->is_working()) { tier = i->tier; found_working = false; }
if (i->fails >= i->fail_limit && i->fail_limit != 0) continue;
if (i->updating) { found_working = true; continue; }
if (i->is_working())
{
ptime next_tracker_announce = (std::max)(i->next_announce, i->min_announce);
if (!i->updating && next_tracker_announce < next_announce) next_announce = next_tracker_announce;
found_working = true;
if (!settings().announce_to_all_trackers
&& !settings().announce_to_all_tiers) break;
}
ptime next_tracker_announce = (std::max)(i->next_announce, i->min_announce);
if (!i->updating
&& next_tracker_announce < next_announce
&& (!found_working || i->is_working()))
next_announce = next_tracker_announce;
if (i->is_working()) found_working = true;
if (!settings().announce_to_all_trackers
&& !settings().announce_to_all_tiers) break;
}
if (next_announce == max_time()) return;