Record webseed request result bytes against client stats

Should fix the issue where webseeds cause >100% useful data readings.
This commit is contained in:
Matt Joiner 2021-10-25 16:17:55 +11:00
parent 37373864e4
commit 28726f737c
2 changed files with 2 additions and 1 deletions

View File

@ -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 }))
}

View File

@ -126,6 +126,7 @@ func (ws *webseedPeer) requestResultHandler(r Request, webseedRequest webseed.Re
// 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 {