add not delete pieces in start/end of file

This commit is contained in:
YouROK
2021-02-20 12:38:39 +03:00
parent ce5b06d8e9
commit d76142aeeb
2 changed files with 4 additions and 1 deletions

View File

@@ -2,10 +2,13 @@ package torrstor
import ( import (
"sort" "sort"
"github.com/anacrolix/torrent"
) )
type Range struct { type Range struct {
Start, End int Start, End int
File *torrent.File
} }
func inRanges(ranges []Range, ind int) bool { func inRanges(ranges []Range, ind int) bool {

View File

@@ -144,7 +144,7 @@ func (c *Cache) updatePriority() {
func (r *Reader) getPiecesRange() Range { func (r *Reader) getPiecesRange() Range {
startOff, endOff := r.getOffsetRange() startOff, endOff := r.getOffsetRange()
return Range{r.getPieceNum(startOff), r.getPieceNum(endOff)} return Range{r.getPieceNum(startOff), r.getPieceNum(endOff), r.file}
} }
func (r *Reader) getReaderPiece() int { func (r *Reader) getReaderPiece() int {