Use new DHT stats fields

This commit is contained in:
Matt Joiner 2018-04-12 16:11:22 +10:00
parent dfb15da131
commit 485d8cdf61
2 changed files with 3 additions and 4 deletions

View File

@ -105,7 +105,7 @@ func writeDhtServerStatus(w io.Writer, s *dht.Server) {
fmt.Fprintf(w, "\tDHT nodes: %d (%d good, %d banned)\n", dhtStats.Nodes, dhtStats.GoodNodes, dhtStats.BadNodes) fmt.Fprintf(w, "\tDHT nodes: %d (%d good, %d banned)\n", dhtStats.Nodes, dhtStats.GoodNodes, dhtStats.BadNodes)
fmt.Fprintf(w, "\tDHT Server ID: %x\n", s.ID()) fmt.Fprintf(w, "\tDHT Server ID: %x\n", s.ID())
fmt.Fprintf(w, "\tDHT port: %d\n", missinggo.AddrPort(s.Addr())) fmt.Fprintf(w, "\tDHT port: %d\n", missinggo.AddrPort(s.Addr()))
fmt.Fprintf(w, "\tDHT announces: %d\n", dhtStats.ConfirmedAnnounces) fmt.Fprintf(w, "\tDHT announces: %d\n", dhtStats.SuccessfulOutboundAnnouncePeerQueries)
fmt.Fprintf(w, "\tOutstanding transactions: %d\n", dhtStats.OutstandingTransactions) fmt.Fprintf(w, "\tOutstanding transactions: %d\n", dhtStats.OutstandingTransactions)
} }

View File

@ -766,10 +766,9 @@ func TestAddMetainfoWithNodes(t *testing.T) {
cl, err := NewClient(cfg) cl, err := NewClient(cfg)
require.NoError(t, err) require.NoError(t, err)
defer cl.Close() defer cl.Close()
sum := func() (ret int) { sum := func() (ret int64) {
cl.eachDhtServer(func(s *dht.Server) { cl.eachDhtServer(func(s *dht.Server) {
ret += s.NumNodes() ret += s.Stats().OutboundQueriesAttempted
ret += s.Stats().OutstandingTransactions
}) })
return return
} }