dht: Add counters for writes and write errors
This commit is contained in:
parent
980cd69ab2
commit
b98c1a7edc
|
@ -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")
|
||||
)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue