add logging in monitor_peers for healthy/banned/defunct counts (#436)

This commit is contained in:
AntiochP 2017-12-06 09:28:11 -05:00 committed by GitHub
parent f7866d9f32
commit 0b9ca727d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,12 +88,35 @@ impl Seeder {
.for_each(move |_| {
debug!(
LOGGER,
"monitoring peers ({} / {} / {})",
"monitoring_peers: {} / {} / {}",
p2p_server.most_work_peers().len(),
p2p_server.connected_peers().len(),
p2p_server.all_peers().len(),
);
let all_peers = p2p_server.all_peers();
let healthy_count = all_peers
.iter()
.filter(|x| x.flags == p2p::State::Healthy)
.count();
let banned_count = all_peers
.iter()
.filter(|x| x.flags == p2p::State::Banned)
.count();
let defunct_count = all_peers
.iter()
.filter(|x| x.flags == p2p::State::Defunct)
.count();
debug!(
LOGGER,
"monitoring_peers: all - {}, healthy - {}, banned - {}, defunct - {}",
all_peers.len(),
healthy_count,
banned_count,
defunct_count,
);
// maintenance step first, clean up p2p server peers
let _ = p2p_server.clean_peers();