peerconn.go | 2 +- webseed-peer.go | 1 + diff --git a/peerconn.go b/peerconn.go index c1b98c2ade52405b3989fba3e736840db60069df..e17d211680bb7a1e8aa0f19bf654b26326ac1b1f 100644 --- a/peerconn.go +++ b/peerconn.go @@ -869,7 +869,7 @@ func (cn *PeerConn) wroteBytes(n int64) { cn.allStats(add(n, func(cs *ConnStats) *Count { return &cs.BytesWritten })) } -func (cn *PeerConn) readBytes(n int64) { +func (cn *Peer) readBytes(n int64) { cn.allStats(add(n, func(cs *ConnStats) *Count { return &cs.BytesRead })) } diff --git a/webseed-peer.go b/webseed-peer.go index fb981585be2b6925311e34e58e54db649f3285a7..71cdfcb4c7ce43f62b34ad9dc36b0ad9d375b0ed 100644 --- a/webseed-peer.go +++ b/webseed-peer.go @@ -126,6 +126,7 @@ // We do this here rather than inside receiveChunk, since we want to count errors too. I'm not // sure if we can divine which errors indicate cancellation on our end without hitting the // network though. ws.peer.doChunkReadStats(int64(len(result.Bytes))) + ws.peer.readBytes(int64(len(result.Bytes))) ws.peer.t.cl.lock() defer ws.peer.t.cl.unlock() if result.Err != nil {