forked from premiere/premiere-libtorrent
report tracker errors in the tracker list
This commit is contained in:
parent
384bfdec48
commit
eeda665d06
|
@ -1804,6 +1804,10 @@ ones with lower tier will always be tried before the one with higher tier number
|
|||
int next_announce_in() const;
|
||||
int min_announce_in() const;
|
||||
|
||||
error_code last_error;
|
||||
|
||||
std::string message;
|
||||
|
||||
boost::uint8_t tier;
|
||||
boost::uint8_t fail_limit;
|
||||
boost::uint8_t fails;
|
||||
|
@ -1827,6 +1831,12 @@ ones with lower tier will always be tried before the one with higher tier number
|
|||
this tracker. ``min_announce_in()`` returns the number of seconds until we are
|
||||
allowed to force another tracker update with this tracker.
|
||||
|
||||
If the last time this tracker was contacted failed, ``last_error`` is the error
|
||||
code describing what error occurred.
|
||||
|
||||
If the last time this tracker was contacted, the tracker returned a warning
|
||||
or error message, ``message`` contains that message.
|
||||
|
||||
``fail_limit`` is the max number of failures to announce to this tracker in
|
||||
a row, before this tracker is not used anymore.
|
||||
|
||||
|
|
|
@ -1428,11 +1428,13 @@ int main(int argc, char* argv[])
|
|||
for (std::vector<announce_entry>::iterator i = tr.begin()
|
||||
, end(tr.end()); i != end; ++i)
|
||||
{
|
||||
snprintf(str, sizeof(str), "%2d %-55s fails: %-3d %s %s\n"
|
||||
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?""
|
||||
:to_string(total_seconds(i->next_announce - now), 8).c_str());
|
||||
:to_string(total_seconds(i->next_announce - now), 8).c_str()
|
||||
, i->last_error ? i->last_error.message().c_str() : ""
|
||||
, i->message.c_str());
|
||||
out += str;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,6 +97,14 @@ namespace libtorrent
|
|||
// no announces before this time
|
||||
ptime min_announce;
|
||||
|
||||
// if this tracker failed the last time it was contacted
|
||||
// this error code specifies what error occurred
|
||||
error_code last_error;
|
||||
|
||||
// if this tracker has returned an error or warning message
|
||||
// that message is stored here
|
||||
std::string message;
|
||||
|
||||
boost::uint8_t tier;
|
||||
// the number of times this tracker can fail
|
||||
// in a row before it's removed. 0 means unlimited
|
||||
|
|
|
@ -6459,6 +6459,8 @@ namespace libtorrent
|
|||
if (ae)
|
||||
{
|
||||
ae->failed(retry_interval);
|
||||
ae->last_error = ec;
|
||||
ae->message = msg;
|
||||
int tracker_index = ae - &m_trackers[0];
|
||||
deprioritize_tracker(tracker_index);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue