diff --git a/examples/client_test.cpp b/examples/client_test.cpp index 323cfd403..ea2e92389 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -244,9 +244,7 @@ int peer_index(libtorrent::tcp::endpoint addr, std::vector const& peers) { using namespace libtorrent; -#ifndef ANSI_TERMINAL_COLORS - out << " down (total) up (total) q r flags source block progress country client \n"; -#endif + out << " down (total) up (total) q r flags source fail block-progress country client \n"; for (std::vector::const_iterator i = peers.begin(); i != peers.end(); ++i) @@ -272,8 +270,10 @@ void print_peer_info(std::ostream& out, std::vector const << ((i->source & peer_info::pex)?"P":"_") << ((i->source & peer_info::dht)?"D":"_") << ((i->source & peer_info::lsd)?"L":"_") - << ((i->source & peer_info::resume_data)?"R":"_") - << " "; + << ((i->source & peer_info::resume_data)?"R":"_") << " "; + out.width(2); + out.fill(' '); + out << (i->failcount) << " "; if (i->downloading_piece_index >= 0) { diff --git a/include/libtorrent/peer_info.hpp b/include/libtorrent/peer_info.hpp index d0c376bf0..f535c307c 100755 --- a/include/libtorrent/peer_info.hpp +++ b/include/libtorrent/peer_info.hpp @@ -102,6 +102,10 @@ namespace libtorrent // that we haven't sent yet int upload_queue_length; + // the number of times this IP + // has failed to connect + int failcount; + // the currently downloading piece // if piece index is -1 all associated // members are just set to 0 diff --git a/src/bt_peer_connection.cpp b/src/bt_peer_connection.cpp index 2b424afda..3f70f216f 100755 --- a/src/bt_peer_connection.cpp +++ b/src/bt_peer_connection.cpp @@ -247,11 +247,13 @@ namespace libtorrent if (peer_info_struct()) { p.source = peer_info_struct()->source; + p.failcount = peer_info_struct()->failcount; } else { assert(!is_local()); p.source = 0; + p.failcount = 0; } } diff --git a/src/web_peer_connection.cpp b/src/web_peer_connection.cpp index 1f6b009d6..cc74703d3 100755 --- a/src/web_peer_connection.cpp +++ b/src/web_peer_connection.cpp @@ -589,6 +589,7 @@ namespace libtorrent p.client = m_server_string; p.connection_type = peer_info::web_seed; p.source = 0; + p.failcount = 0; } bool web_peer_connection::in_handshake() const