fix max size length

This commit is contained in:
YouROK
2021-05-26 12:32:15 +03:00
parent ac092ce169
commit c114ca2d23

View File

@@ -29,6 +29,9 @@ func (p *MemPiece) WriteAt(b []byte, off int64) (n int, err error) {
}
n = copy(p.buffer[off:], b[:])
p.piece.Size += int64(n)
if p.piece.Size > p.piece.cache.pieceLength {
p.piece.Size = p.piece.cache.pieceLength
}
p.piece.Accessed = time.Now().Unix()
return
}