func (c *connection) receiveChunk(msg *pp.Message) {
t := c.t
cl := t.cl
- chunksReceived.Add(1)
+ torrent.Add("chunks received", 1)
req := newRequestFromMessage(msg)
if c.deleteRequest(req) {
c.updateRequests()
} else {
- unexpectedChunksReceived.Add(1)
+ torrent.Add("chunks received unexpected", 1)
}
if c.PeerChoked {
// Do we actually want this chunk?
if !t.wantPiece(req) {
- unwantedChunksReceived.Add(1)
+ torrent.Add("chunks received unwanted", 1)
c.allStats(add(1, func(cs *ConnStats) *Count { return &cs.ChunksReadUnwanted }))
return
}
// I could move a lot of these counters to their own file, but I suspect they
// may be attached to a Client someday.
var (
- unwantedChunksReceived = expvar.NewInt("chunksReceivedUnwanted")
- unexpectedChunksReceived = expvar.NewInt("chunksReceivedUnexpected")
- chunksReceived = expvar.NewInt("chunksReceived")
-
torrent = expvar.NewMap("torrent")
peersAddedBySource = expvar.NewMap("peersAddedBySource")