From: Matt Joiner Date: Sun, 17 Jun 2018 06:18:22 +0000 (+1000) Subject: Move chunk expvars into torrent prefix X-Git-Tag: v1.0.0~127^2~9 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=3a17708c78928734d5a95a1befb6e74fbc320357;p=btrtrc.git Move chunk expvars into torrent prefix --- diff --git a/connection.go b/connection.go index d6e2dcc3..f58ab288 100644 --- a/connection.go +++ b/connection.go @@ -1204,7 +1204,7 @@ func (cn *connection) rw() io.ReadWriter { func (c *connection) receiveChunk(msg *pp.Message) { t := c.t cl := t.cl - chunksReceived.Add(1) + torrent.Add("chunks received", 1) req := newRequestFromMessage(msg) @@ -1212,7 +1212,7 @@ func (c *connection) receiveChunk(msg *pp.Message) { if c.deleteRequest(req) { c.updateRequests() } else { - unexpectedChunksReceived.Add(1) + torrent.Add("chunks received unexpected", 1) } if c.PeerChoked { @@ -1224,7 +1224,7 @@ func (c *connection) receiveChunk(msg *pp.Message) { // 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 } diff --git a/global.go b/global.go index 5875fd14..43b84ee1 100644 --- a/global.go +++ b/global.go @@ -23,10 +23,6 @@ func defaultPeerExtensionBytes() peerExtensionBytes { // 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")