instead of using a fixed request timeout for every peer, have an adaptable one based on the average download time for a block

This commit is contained in:
Arvid Norberg
2014-12-08 17:06:04 +00:00
parent c4e5df8e4d
commit 4eaec6d87f
5 changed files with 71 additions and 48 deletions

View File

@@ -474,10 +474,16 @@ void print_peer_info(std::string& out, std::vector<libtorrent::peer_info> const&
}
if (print_timers)
{
snprintf(str, sizeof(str), "%8d %4d %7d %6d "
char req_timeout[20] = "-";
// timeout is only meaningful if there is at least one outstanding
// request to the peer
if (i->download_queue_length > 0)
snprintf(req_timeout, sizeof(req_timeout), "%d", i->request_timeout);
snprintf(str, sizeof(str), "%8d %4d %7s %6d "
, int(total_seconds(i->last_active))
, int(total_seconds(i->last_request))
, i->request_timeout
, req_timeout
, int(total_seconds(i->download_queue_time)));
out += str;
}