don' differentiate priorities here

to avoid cache end pieces overlap early normal ones
This commit is contained in:
nikk gitanes
2021-08-19 08:53:08 +03:00
parent 83d002560b
commit 02df404e04

View File

@@ -253,16 +253,16 @@ func (c *Cache) getRemPieces() []*Piece {
if limit > 40 { if limit > 40 {
limit = 40 limit = 40
} }
count := limit // count := limit
for pc <= end && limit > 0 { for pc <= end && limit > 0 {
if !c.pieces[pc].Complete { if !c.pieces[pc].Complete {
if c.torrent.PieceState(pc).Priority == torrent.PiecePriorityNone { if c.torrent.PieceState(pc).Priority == torrent.PiecePriorityNone {
if limit < count/2 { // if limit < count/2 {
c.torrent.Piece(pc).SetPriority(torrent.PiecePriorityHigh) // c.torrent.Piece(pc).SetPriority(torrent.PiecePriorityHigh)
} else { // } else {
c.torrent.Piece(pc).SetPriority(torrent.PiecePriorityNormal) c.torrent.Piece(pc).SetPriority(torrent.PiecePriorityNormal)
} // }
} }
limit-- limit--
} }