include target in DHT lookups, when queried from the session (#1207)
This commit is contained in:
parent
e0d7729f87
commit
e0c8ad738d
|
@ -1,3 +1,4 @@
|
||||||
|
* include target in DHT lookups, when queried from the session
|
||||||
* improve support for HTTP redirects for web seeds
|
* improve support for HTTP redirects for web seeds
|
||||||
* use string_view in entry interface
|
* use string_view in entry interface
|
||||||
* deprecate "send_stats" property on trackers (since lt_tracker extension has
|
* deprecate "send_stats" property on trackers (since lt_tracker extension has
|
||||||
|
|
|
@ -1841,8 +1841,7 @@ int main(int argc, char* argv[])
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int bucket = 0;
|
int bucket = 0;
|
||||||
for (std::vector<dht_routing_bucket>::iterator i = dht_routing_table.begin()
|
for (dht_routing_bucket const& n : dht_routing_table)
|
||||||
, end(dht_routing_table.end()); i != end; ++i, ++bucket)
|
|
||||||
{
|
{
|
||||||
char const* progress_bar =
|
char const* progress_bar =
|
||||||
"################################"
|
"################################"
|
||||||
|
@ -1852,32 +1851,34 @@ int main(int argc, char* argv[])
|
||||||
char const* short_progress_bar = "--------";
|
char const* short_progress_bar = "--------";
|
||||||
std::snprintf(str, sizeof(str)
|
std::snprintf(str, sizeof(str)
|
||||||
, "%3d [%3d, %d] %s%s\x1b[K\n"
|
, "%3d [%3d, %d] %s%s\x1b[K\n"
|
||||||
, bucket, i->num_nodes, i->num_replacements
|
, bucket, n.num_nodes, n.num_replacements
|
||||||
, progress_bar + (128 - i->num_nodes)
|
, progress_bar + (128 - n.num_nodes)
|
||||||
, short_progress_bar + (8 - (std::min)(8, i->num_replacements)));
|
, short_progress_bar + (8 - (std::min)(8, n.num_replacements)));
|
||||||
out += str;
|
out += str;
|
||||||
pos += 1;
|
pos += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::vector<dht_lookup>::iterator i = dht_active_requests.begin()
|
for (dht_lookup const& l : dht_active_requests)
|
||||||
, end(dht_active_requests.end()); i != end; ++i)
|
|
||||||
{
|
{
|
||||||
std::snprintf(str, sizeof(str)
|
std::snprintf(str, sizeof(str)
|
||||||
, " %10s [limit: %2d] "
|
, " %10s target: %s "
|
||||||
|
"[limit: %2d] "
|
||||||
"in-flight: %-2d "
|
"in-flight: %-2d "
|
||||||
"left: %-3d "
|
"left: %-3d "
|
||||||
"1st-timeout: %-2d "
|
"1st-timeout: %-2d "
|
||||||
"timeouts: %-2d "
|
"timeouts: %-2d "
|
||||||
"responses: %-2d "
|
"responses: %-2d "
|
||||||
"last_sent: %-2d\x1b[K\n"
|
"last_sent: %-2d "
|
||||||
, i->type
|
"\x1b[K\n"
|
||||||
, i->branch_factor
|
, l.type
|
||||||
, i->outstanding_requests
|
, to_hex(l.target).c_str()
|
||||||
, i->nodes_left
|
, l.branch_factor
|
||||||
, i->first_timeout
|
, l.outstanding_requests
|
||||||
, i->timeouts
|
, l.nodes_left
|
||||||
, i->responses
|
, l.first_timeout
|
||||||
, i->last_sent);
|
, l.timeouts
|
||||||
|
, l.responses
|
||||||
|
, l.last_sent);
|
||||||
out += str;
|
out += str;
|
||||||
pos += 1;
|
pos += 1;
|
||||||
}
|
}
|
||||||
|
@ -1899,19 +1900,17 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
if (print_trackers)
|
if (print_trackers)
|
||||||
{
|
{
|
||||||
std::vector<announce_entry> tr = h.trackers();
|
|
||||||
time_point const now = clock_type::now();
|
time_point const now = clock_type::now();
|
||||||
for (std::vector<announce_entry>::iterator i = tr.begin()
|
for (announce_entry const& ae : h.trackers())
|
||||||
, end(tr.end()); i != end; ++i)
|
|
||||||
{
|
{
|
||||||
if (pos + 1 >= terminal_height) break;
|
if (pos + 1 >= terminal_height) break;
|
||||||
std::snprintf(str, sizeof(str), "%2d %-55s fails: %-3d (%-3d) %s %s %5d \"%s\" %s\x1b[K\n"
|
std::snprintf(str, sizeof(str), "%2d %-55s fails: %-3d (%-3d) %s %s %5d \"%s\" %s\x1b[K\n"
|
||||||
, i->tier, i->url.c_str(), i->fails, i->fail_limit, i->verified?"OK ":"- "
|
, ae.tier, ae.url.c_str(), ae.fails, ae.fail_limit, ae.verified?"OK ":"- "
|
||||||
, i->updating?"updating"
|
, ae.updating?"updating"
|
||||||
:to_string(int(total_seconds(i->next_announce - now)), 8).c_str()
|
:to_string(int(total_seconds(ae.next_announce - now)), 8).c_str()
|
||||||
, int(i->min_announce > now ? total_seconds(i->min_announce - now) : 0)
|
, int(ae.min_announce > now ? total_seconds(ae.min_announce - now) : 0)
|
||||||
, i->last_error ? i->last_error.message().c_str() : ""
|
, ae.last_error ? ae.last_error.message().c_str() : ""
|
||||||
, i->message.c_str());
|
, ae.message.c_str());
|
||||||
out += str;
|
out += str;
|
||||||
pos += 1;
|
pos += 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2174,6 +2174,9 @@ namespace libtorrent
|
||||||
// sense that they increased the branch
|
// sense that they increased the branch
|
||||||
// factor
|
// factor
|
||||||
int first_timeout;
|
int first_timeout;
|
||||||
|
|
||||||
|
// the node-id or info-hash target for this lookup
|
||||||
|
sha1_hash target;
|
||||||
};
|
};
|
||||||
|
|
||||||
// struct to hold information about a single DHT routing table bucket
|
// struct to hold information about a single DHT routing table bucket
|
||||||
|
|
|
@ -537,6 +537,7 @@ void traversal_algorithm::status(dht_lookup& l)
|
||||||
l.type = name();
|
l.type = name();
|
||||||
l.nodes_left = 0;
|
l.nodes_left = 0;
|
||||||
l.first_timeout = 0;
|
l.first_timeout = 0;
|
||||||
|
l.target = m_target;
|
||||||
|
|
||||||
int last_sent = INT_MAX;
|
int last_sent = INT_MAX;
|
||||||
time_point now = aux::time_now();
|
time_point now = aux::time_now();
|
||||||
|
|
Loading…
Reference in New Issue