log more details on the cause of disconnects

This commit is contained in:
Arvid Norberg 2011-02-14 04:48:02 +00:00
parent a73f52a3d5
commit b471e40064
4 changed files with 30 additions and 3 deletions

View File

@ -888,6 +888,8 @@ namespace libtorrent
int m_incoming_piece_picks;
int m_end_game_piece_picks;
int m_snubbed_piece_picks;
int m_connect_timeouts;
int m_uninteresting_peers;
#endif
// each second tick the timer takes a little

View File

@ -55,7 +55,7 @@ gen_report('peer_ul_rates2', ['peers up 0-2', 'peers up 2-5', 'peers up 5-10', '
gen_report('disk', ['disk write queued bytes', 'disk block buffers'])
gen_report('peers_upload', ['peers up interested', 'peers up unchoked', 'peers up requests', 'peers disk-up', 'peers bw-up'])
gen_report('peers_download', ['peers down interesting', 'peers down unchoked', 'peers down requests', 'peers disk-down', 'peers bw-down'])
gen_report('peer_errors', ['error peers', 'peer disconnects', 'peers eof', 'peers connection reset'])
gen_report('peer_errors', ['error peers', 'peer disconnects', 'peers eof', 'peers connection reset' 'connect timeouts', 'uninteresting peers disconnect'])
gen_report('piece_picker_end_game', ['end game piece picker blocks', 'strict end game piece picker blocks', 'piece picker blocks', 'piece picks', 'reject piece picks', 'unchoked piece picks', 'incoming redundant piece picks', 'incoming piece picks', 'end game piece picks', 'snubbed piece picks'])
gen_report('piece_picker', ['piece picks', 'reject piece picks', 'unchoked piece picks', 'incoming redundant piece picks', 'incoming piece picks', 'end game piece picks', 'snubbed piece picks'])
gen_report('bandwidth', ['% failed payload bytes', '% wasted payload bytes', '% protocol bytes'])

View File

@ -2021,7 +2021,7 @@ namespace libtorrent
if (m_choke_rejects > m_ses.settings().max_rejects)
{
disconnect(errors::too_many_requests_when_choked);
disconnect(errors::too_many_requests_when_choked, 2);
return;
}
else if ((m_choke_rejects & 0xf) == 0)
@ -3268,12 +3268,18 @@ namespace libtorrent
(*m_ses.m_logger) << "CONNECTION FAILED: " << print_endpoint(m_remote) << "\n";
#endif
#ifdef TORRENT_STATS
++m_ses.m_connect_timeouts;
#endif
if (m_connection_ticket != -1)
{
m_ses.m_half_open.done(m_connection_ticket);
m_connecting = false;
}
TORRENT_ASSERT(m_connecting);
// a connection attempt using uTP just failed
// mark this peer as not supporting uTP
// we'll never try it again (unless we're trying holepunch)
@ -3342,6 +3348,16 @@ namespace libtorrent
if (error == 2) ++m_ses.m_error_peers;
if (ec == error::connection_reset) ++m_ses.m_connreset_peers;
if (ec == error::eof) ++m_ses.m_eof_peers;
if (ec == error_code(errors::upload_upload_connection)
|| ec == error_code(errors::uninteresting_upload_peer)
|| ec == error_code(errors::timed_out_inactivity)
|| ec == error_code(errors::timed_out_no_handshake)
|| ec == error_code(errors::timed_out_no_request)
|| ec == error_code(errors::timed_out_no_interest)
|| ec == error_code(errors::torrent_aborted)
|| ec == error_code(errors::self_connection)
|| ec == error_code(errors::torrent_paused))
++m_ses.m_uninteresting_peers;
#endif
// we cannot do this in a constructor

View File

@ -806,6 +806,8 @@ namespace aux {
m_incoming_piece_picks = 0;
m_end_game_piece_picks = 0;
m_snubbed_piece_picks = 0;
m_connect_timeouts = 0;
m_uninteresting_peers = 0;
rotate_stats_log();
#endif
#ifdef TORRENT_DISK_STATS
@ -909,6 +911,8 @@ namespace aux {
":incoming piece picks"
":end game piece picks"
":snubbed piece picks"
":connect timeouts"
":uninteresting peers disconnect"
":% failed payload bytes"
":% wasted payload bytes"
":% protocol bytes"
@ -2686,7 +2690,8 @@ namespace aux {
"%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t"
"%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t"
"%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t"
"%d\t%d\t%d\t%d\t%d\t%d\t%d\t%f\t%f\t%f\n"
"%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t"
"%f\t%f\t%f\n"
, total_milliseconds(now - m_last_log_rotation) / 1000.f
, int(upload_rate)
, int(download_rate)
@ -2744,6 +2749,8 @@ namespace aux {
, m_incoming_piece_picks
, m_end_game_piece_picks
, m_snubbed_piece_picks
, m_connect_timeouts
, m_uninteresting_peers
, (float(m_total_failed_bytes) * 100.f / m_stat.total_payload_download())
, (float(m_total_redundant_bytes) * 100.f / m_stat.total_payload_download())
, (float(m_stat.total_protocol_download()) * 100.f / m_stat.total_download())
@ -2763,6 +2770,8 @@ namespace aux {
m_incoming_piece_picks = 0;
m_end_game_piece_picks = 0;
m_snubbed_piece_picks = 0;
m_connect_timeouts = 0;
m_uninteresting_peers = 0;
#endif
// --------------------------------------------------------------