mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 17:01:09 +03:00
add logging in monitor_peers for healthy/banned/defunct counts (#436)
This commit is contained in:
parent
f7866d9f32
commit
0b9ca727d3
1 changed files with 24 additions and 1 deletions
|
@ -88,12 +88,35 @@ impl Seeder {
|
||||||
.for_each(move |_| {
|
.for_each(move |_| {
|
||||||
debug!(
|
debug!(
|
||||||
LOGGER,
|
LOGGER,
|
||||||
"monitoring peers ({} / {} / {})",
|
"monitoring_peers: {} / {} / {}",
|
||||||
p2p_server.most_work_peers().len(),
|
p2p_server.most_work_peers().len(),
|
||||||
p2p_server.connected_peers().len(),
|
p2p_server.connected_peers().len(),
|
||||||
p2p_server.all_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
|
// maintenance step first, clean up p2p server peers
|
||||||
let _ = p2p_server.clean_peers();
|
let _ = p2p_server.clean_peers();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue