mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
adjust RA
This commit is contained in:
@@ -63,17 +63,17 @@ func (t *Torrent) Preload(index int, size int64) {
|
||||
}
|
||||
}()
|
||||
|
||||
// mb5 -> 8/16 MB
|
||||
mb5 := int64(t.Info().PieceLength)
|
||||
if mb5 < 8*1024*1024 {
|
||||
mb5 = 8 * 1024 * 1024
|
||||
// startend -> 8/16 MB
|
||||
startend := int64(t.Info().PieceLength)
|
||||
if startend < 8*1024*1024 {
|
||||
startend = 8 * 1024 * 1024
|
||||
}
|
||||
|
||||
readerStart := file.NewReader()
|
||||
defer readerStart.Close()
|
||||
readerStart.SetResponsive()
|
||||
readerStart.SetReadahead(0)
|
||||
readerStartEnd := size - mb5
|
||||
readerStartEnd := size - startend
|
||||
|
||||
if readerStartEnd < 0 {
|
||||
// Если конец начального ридера оказался за началом
|
||||
@@ -84,7 +84,7 @@ func (t *Torrent) Preload(index int, size int64) {
|
||||
readerStartEnd = file.Length()
|
||||
}
|
||||
|
||||
readerEndStart := file.Length() - mb5
|
||||
readerEndStart := file.Length() - startend
|
||||
readerEndEnd := file.Length()
|
||||
|
||||
var wa sync.WaitGroup
|
||||
|
||||
@@ -255,9 +255,9 @@ func (c *Cache) getRemPieces() []*Piece {
|
||||
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
|
||||
count := int(16 * 1024 * 1024 * 4 / c.pieceLength) // 64 MB window
|
||||
if count > 64 {
|
||||
count = 64
|
||||
}
|
||||
limit := 0
|
||||
for i := readerPos; i < end && limit < count; i++ {
|
||||
|
||||
Reference in New Issue
Block a user