diff --git a/dht/expvar.go b/dht/expvar.go index 4fdf69ce..11a0a987 100644 --- a/dht/expvar.go +++ b/dht/expvar.go @@ -11,4 +11,6 @@ var ( readUnmarshalError = expvar.NewInt("dhtReadUnmarshalError") readQuery = expvar.NewInt("dhtReadQuery") announceErrors = expvar.NewInt("dhtAnnounceErrors") + writeErrors = expvar.NewInt("dhtWriteErrors") + writes = expvar.NewInt("dhtWrites") ) diff --git a/dht/server.go b/dht/server.go index 56917292..bf269398 100644 --- a/dht/server.go +++ b/dht/server.go @@ -382,7 +382,9 @@ func (s *Server) writeToNode(b []byte, node Addr) (err error) { } } n, err := s.socket.WriteTo(b, node.UDPAddr()) + writes.Add(1) if err != nil { + writeErrors.Add(1) err = fmt.Errorf("error writing %d bytes to %s: %s", len(b), node, err) return }