Skip to content

Commit

Permalink
display protocol version counts
Browse files Browse the repository at this point in the history
  • Loading branch information
dajohi committed May 16, 2024
1 parent 072276e commit 52e1b30
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ func (m *Manager) prunePeers() {
m.mtx.Lock()
now := time.Now()

protoMap := make(map[uint32]uint)
var count int
for k, node := range m.nodes {
// do not remove untried nodes
Expand All @@ -274,11 +275,16 @@ func (m *Manager) prunePeers() {
count++
continue
}
protoMap[node.ProtocolVersion]++
}
l := len(m.nodes)
m.mtx.Unlock()

m.log.Printf("Pruned %d addresses: %d remaining", count, l)
var t string
for proto, count := range protoMap {
t += fmt.Sprintf(" (%v:%v)", proto, count)
}
m.log.Printf("Pruned %d addresses: %d remaining%s", count, l, t)
}

func (m *Manager) deserializePeers() error {
Expand Down

0 comments on commit 52e1b30

Please sign in to comment.