Use scope timer in Torrent.writeChunk
This commit is contained in:
parent
802e121a64
commit
96050948c2
|
@ -711,15 +711,11 @@ func (t *Torrent) offsetRequest(off int64) (req request, ok bool) {
|
|||
}
|
||||
|
||||
func (t *Torrent) writeChunk(piece int, begin int64, data []byte) (err error) {
|
||||
tr := perf.NewTimer()
|
||||
|
||||
defer perf.ScopeTimerErr(&err)()
|
||||
n, err := t.pieces[piece].Storage().WriteAt(data, begin)
|
||||
if err == nil && n != len(data) {
|
||||
err = io.ErrShortWrite
|
||||
}
|
||||
if err == nil {
|
||||
tr.Mark("write chunk")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue