forked from premiere/premiere-libtorrent
improve tracker debug logging
This commit is contained in:
parent
6d865f0c60
commit
f099f356c6
|
@ -2909,8 +2909,22 @@ bool is_downloading_state(int const st)
|
|||
// so that each one should get at least one announce
|
||||
std::vector<announce_state> listen_socket_states;
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
int idx = -1;
|
||||
if (should_log())
|
||||
{
|
||||
debug_log("*** announce: "
|
||||
"[ announce_to_all_tiers: %d announce_to_all_trackers: %d num_trackers: %d ]"
|
||||
, settings().get_bool(settings_pack::announce_to_all_tiers)
|
||||
, settings().get_bool(settings_pack::announce_to_all_trackers)
|
||||
, int(m_trackers.size()));
|
||||
}
|
||||
#endif
|
||||
for (auto& ae : m_trackers)
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
++idx;
|
||||
#endif
|
||||
// update the endpoint list by adding entries for new listen sockets
|
||||
// and removing entries for non-existent ones
|
||||
std::size_t valid_endpoints = 0;
|
||||
|
@ -2964,15 +2978,11 @@ bool is_downloading_state(int const st)
|
|||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
if (should_log())
|
||||
{
|
||||
debug_log("*** tracker: \"%s\" "
|
||||
"[ tiers: %d trackers: %d"
|
||||
" i->tier: %d tier: %d"
|
||||
" working: %d limit: %d"
|
||||
" can: %d sent: %d ]"
|
||||
, ae.url.c_str(), settings().get_bool(settings_pack::announce_to_all_tiers)
|
||||
, settings().get_bool(settings_pack::announce_to_all_trackers)
|
||||
, ae.tier, state.tier, aep.is_working(), ae.fail_limit
|
||||
, aep.can_announce(now, is_seed(), ae.fail_limit), state.sent_announce);
|
||||
debug_log("*** tracker: (%d) [ep: %s ] \"%s\" [ i->tier: %d tier: %d"
|
||||
" working: %d limit: %d can: %d sent: %d ]"
|
||||
, idx, print_endpoint(aep.local_endpoint).c_str()
|
||||
, ae.url.c_str(), ae.tier, state.tier, aep.is_working()
|
||||
, ae.fail_limit, aep.can_announce(now, is_seed(), ae.fail_limit), state.sent_announce);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3026,7 +3036,7 @@ bool is_downloading_state(int const st)
|
|||
if (should_log())
|
||||
{
|
||||
debug_log("==> TRACKER REQUEST \"%s\" event: %s abort: %d ssl: %p "
|
||||
"port: %d ssl-port: %d fails: %d upd: %d"
|
||||
"port: %d ssl-port: %d fails: %d upd: %d ep: %s"
|
||||
, req.url.c_str()
|
||||
, (req.event == tracker_request::stopped ? "stopped"
|
||||
: req.event == tracker_request::started ? "started" : "")
|
||||
|
@ -3039,7 +3049,8 @@ bool is_downloading_state(int const st)
|
|||
, m_ses.listen_port()
|
||||
, m_ses.ssl_listen_port()
|
||||
, aep.fails
|
||||
, aep.updating);
|
||||
, aep.updating
|
||||
, print_endpoint(aep.local_endpoint).c_str());
|
||||
}
|
||||
|
||||
// if we're not logging session logs, don't bother creating an
|
||||
|
@ -8848,8 +8859,22 @@ bool is_downloading_state(int const st)
|
|||
|
||||
std::vector<timer_state> listen_socket_states;
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
int idx = -1;
|
||||
if (should_log())
|
||||
{
|
||||
debug_log("*** update_tracker_timer: "
|
||||
"[ announce_to_all_tiers: %d announce_to_all_trackers: %d num_trackers: %d ]"
|
||||
, settings().get_bool(settings_pack::announce_to_all_tiers)
|
||||
, settings().get_bool(settings_pack::announce_to_all_trackers)
|
||||
, int(m_trackers.size()));
|
||||
}
|
||||
#endif
|
||||
for (auto const& t : m_trackers)
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
++idx;
|
||||
#endif
|
||||
for (auto const& aep : t.endpoints)
|
||||
{
|
||||
auto aep_state_iter = std::find_if(listen_socket_states.begin(), listen_socket_states.end()
|
||||
|
@ -8863,20 +8888,6 @@ bool is_downloading_state(int const st)
|
|||
|
||||
if (state.done) continue;
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
if (should_log())
|
||||
{
|
||||
debug_log("*** tracker: \"%s\" "
|
||||
"[ tiers: %d trackers: %d"
|
||||
" found: %d i->tier: %d tier: %d"
|
||||
" working: %d fails: %d limit: %d upd: %d ]"
|
||||
, t.url.c_str(), settings().get_bool(settings_pack::announce_to_all_tiers)
|
||||
, settings().get_bool(settings_pack::announce_to_all_trackers), state.found_working
|
||||
, t.tier, state.tier, aep.is_working(), aep.fails, t.fail_limit
|
||||
, aep.updating);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (settings().get_bool(settings_pack::announce_to_all_tiers)
|
||||
&& state.found_working
|
||||
&& t.tier <= state.tier
|
||||
|
@ -8887,6 +8898,18 @@ bool is_downloading_state(int const st)
|
|||
if (aep.is_working()) { state.tier = t.tier; state.found_working = false; }
|
||||
if (aep.fails >= t.fail_limit && t.fail_limit != 0) continue;
|
||||
if (!aep.enabled) continue;
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
if (should_log())
|
||||
{
|
||||
debug_log("*** tracker: (%d) [ep: %s ] \"%s\" [ found: %d i->tier: %d tier: %d"
|
||||
" working: %d fails: %d limit: %d upd: %d ]"
|
||||
, idx, print_endpoint(aep.local_endpoint).c_str(), t.url.c_str()
|
||||
, state.found_working, t.tier, state.tier, aep.is_working()
|
||||
, aep.fails, t.fail_limit, aep.updating);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (aep.updating)
|
||||
{
|
||||
state.found_working = true;
|
||||
|
@ -8916,7 +8939,7 @@ bool is_downloading_state(int const st)
|
|||
debug_log("*** update tracker timer: next_announce < now %d"
|
||||
" m_waiting_tracker: %d next_announce_in: %d"
|
||||
, next_announce <= now, m_waiting_tracker
|
||||
, int(total_seconds(now - next_announce)));
|
||||
, int(total_seconds(next_announce - now)));
|
||||
#endif
|
||||
|
||||
// don't re-issue the timer if it's the same expiration time as last time
|
||||
|
@ -10997,7 +11020,8 @@ bool is_downloading_state(int const st)
|
|||
aep->message = msg;
|
||||
fails = aep->fails;
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
debug_log("*** increment tracker fail count [%d]", aep->fails);
|
||||
debug_log("*** increment tracker fail count [ep: %s url: %s %d]"
|
||||
, print_endpoint(aep->local_endpoint).c_str(), r.url.c_str(), aep->fails);
|
||||
#endif
|
||||
// don't try to announce from this endpoint again
|
||||
if (ec == boost::system::errc::address_family_not_supported
|
||||
|
@ -11005,7 +11029,7 @@ bool is_downloading_state(int const st)
|
|||
{
|
||||
aep->enabled = false;
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
debug_log("*** disabling endpoint [%s] for tracker \"%s\""
|
||||
debug_log("*** disabling endpoint [ep: %s url: %s ]"
|
||||
, print_endpoint(aep->local_endpoint).c_str(), r.url.c_str());
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue