From 485d8cdf6147b0339892ed0b8a1f7dac2d9d2e24 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 12 Apr 2018 16:11:22 +1000 Subject: [PATCH] Use new DHT stats fields --- client.go | 2 +- client_test.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/client.go b/client.go index f0d21cac..646d7765 100644 --- a/client.go +++ b/client.go @@ -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 Server ID: %x\n", s.ID()) 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) } diff --git a/client_test.go b/client_test.go index 5e176218..1b07f9c5 100644 --- a/client_test.go +++ b/client_test.go @@ -766,10 +766,9 @@ func TestAddMetainfoWithNodes(t *testing.T) { cl, err := NewClient(cfg) require.NoError(t, err) defer cl.Close() - sum := func() (ret int) { + sum := func() (ret int64) { cl.eachDhtServer(func(s *dht.Server) { - ret += s.NumNodes() - ret += s.Stats().OutstandingTransactions + ret += s.Stats().OutboundQueriesAttempted }) return }