Use scope timer in Torrent.writeChunk

This commit is contained in:
Matt Joiner 2018-06-21 23:22:13 +10:00
parent 802e121a64
commit 96050948c2
1 changed files with 1 additions and 5 deletions

View File

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