From 785ceb3a0e13cf495e9f66059fadae1c2a157788 Mon Sep 17 00:00:00 2001 From: nikk gitanes Date: Thu, 23 Dec 2021 09:12:02 +0300 Subject: [PATCH] disable priorities management not req on new torrent? --- server/torr/storage/torrstor/cache.go | 48 +++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/server/torr/storage/torrstor/cache.go b/server/torr/storage/torrstor/cache.go index 1a5f56b..10cd25a 100644 --- a/server/torr/storage/torrstor/cache.go +++ b/server/torr/storage/torrstor/cache.go @@ -252,30 +252,30 @@ func (c *Cache) getRemPieces() []*Piece { if c.isIdInFileBE(ranges, r.getReaderPiece()) { continue } - readerPos := r.getReaderPiece() - readerRAHPos := r.getReaderRAHPiece() - end := r.getPiecesRange().End - count := int(16 * 1024 * 1024 / c.pieceLength * 5) // 80 MB - if count > 40 { - count = 40 - } - limit := 0 - for i := readerPos; i < end && limit < count; i++ { - if !c.pieces[i].Complete { - if i == readerPos { - c.torrent.Piece(i).SetPriority(torrent.PiecePriorityNow) - } else if i == readerPos+1 { - c.torrent.Piece(i).SetPriority(torrent.PiecePriorityNext) - } else if i > readerPos && i <= readerRAHPos { - c.torrent.Piece(i).SetPriority(torrent.PiecePriorityReadahead) - } else if i > readerRAHPos && i <= readerRAHPos+5 && c.torrent.PieceState(i).Priority != torrent.PiecePriorityHigh { - c.torrent.Piece(i).SetPriority(torrent.PiecePriorityHigh) - } else if i > readerRAHPos+5 && c.torrent.PieceState(i).Priority != torrent.PiecePriorityNormal { - c.torrent.Piece(i).SetPriority(torrent.PiecePriorityNormal) - } - limit++ - } - } +// readerPos := r.getReaderPiece() +// readerRAHPos := r.getReaderRAHPiece() +// end := r.getPiecesRange().End +// count := int(16 * 1024 * 1024 / c.pieceLength * 5) // 80 MB +// if count > 40 { +// count = 40 +// } +// limit := 0 +// for i := readerPos; i < end && limit < count; i++ { +// if !c.pieces[i].Complete { +// if i == readerPos { +// c.torrent.Piece(i).SetPriority(torrent.PiecePriorityNow) +// } else if i == readerPos+1 { +// c.torrent.Piece(i).SetPriority(torrent.PiecePriorityNext) +// } else if i > readerPos && i <= readerRAHPos { +// c.torrent.Piece(i).SetPriority(torrent.PiecePriorityReadahead) +// } else if i > readerRAHPos && i <= readerRAHPos+5 && c.torrent.PieceState(i).Priority != torrent.PiecePriorityHigh { +// c.torrent.Piece(i).SetPriority(torrent.PiecePriorityHigh) +// } else if i > readerRAHPos+5 && c.torrent.PieceState(i).Priority != torrent.PiecePriorityNormal { +// c.torrent.Piece(i).SetPriority(torrent.PiecePriorityNormal) +// } +// limit++ +// } +// } } c.muReaders.Unlock()