expose the full peer list size through session_status

This commit is contained in:
Arvid Norberg 2010-10-01 04:07:38 +00:00
parent 1b308a0ca8
commit cd08a61f35
3 changed files with 17 additions and 3 deletions

View File

@ -918,7 +918,10 @@ int main(int argc, char* argv[])
case 't': poll_interval = atoi(arg); break;
case 'F': refresh_delay = atoi(arg); break;
case 'H': start_dht = false; --i; break;
case 'W': settings.max_peerlist_size = atoi(arg); break;
case 'W':
settings.max_peerlist_size = atoi(arg);
settings.max_paused_peerlist_size = atoi(arg) / 2;
break;
case 'x':
{
FILE* filter = fopen(arg, "r");
@ -1475,8 +1478,8 @@ int main(int argc, char* argv[])
, cs.queued_bytes);
out += str;
snprintf(str, sizeof(str), "==== optimistic unchoke: %d unchoke counter: %d ====\n"
, sess_stat.optimistic_unchoke_counter, sess_stat.unchoke_counter);
snprintf(str, sizeof(str), "==== optimistic unchoke: %d unchoke counter: %d peerlist: %d ====\n"
, sess_stat.optimistic_unchoke_counter, sess_stat.unchoke_counter, sess_stat.peerlist_size);
out += str;
#ifndef TORRENT_DISABLE_DHT

View File

@ -105,6 +105,8 @@ namespace libtorrent
size_type dht_global_nodes;
std::vector<dht_lookup> active_requests;
#endif
int peerlist_size;
};
}

View File

@ -3564,6 +3564,15 @@ namespace aux {
}
#endif
int peerlist_size = 0;
for (torrent_map::const_iterator i = m_torrents.begin()
, end(m_torrents.end()); i != end; ++i)
{
peerlist_size += i->second->get_policy().num_peers();
}
s.peerlist_size = peerlist_size;
return s;
}