added failcount to peer_info. fixes #31

This commit is contained in:
Arvid Norberg 2007-04-13 20:19:04 +00:00
parent 591ec48e77
commit a22ad5ad33
4 changed files with 12 additions and 5 deletions

View File

@ -244,9 +244,7 @@ int peer_index(libtorrent::tcp::endpoint addr, std::vector<libtorrent::peer_info
void print_peer_info(std::ostream& out, std::vector<libtorrent::peer_info> 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<peer_info>::const_iterator i = peers.begin();
i != peers.end(); ++i)
@ -272,8 +270,10 @@ void print_peer_info(std::ostream& out, std::vector<libtorrent::peer_info> 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)
{

View File

@ -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

View File

@ -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;
}
}

View File

@ -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