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
|
// startend -> 8/16 MB
|
||||||
mb5 := int64(t.Info().PieceLength)
|
startend := int64(t.Info().PieceLength)
|
||||||
if mb5 < 8*1024*1024 {
|
if startend < 8*1024*1024 {
|
||||||
mb5 = 8 * 1024 * 1024
|
startend = 8 * 1024 * 1024
|
||||||
}
|
}
|
||||||
|
|
||||||
readerStart := file.NewReader()
|
readerStart := file.NewReader()
|
||||||
defer readerStart.Close()
|
defer readerStart.Close()
|
||||||
readerStart.SetResponsive()
|
readerStart.SetResponsive()
|
||||||
readerStart.SetReadahead(0)
|
readerStart.SetReadahead(0)
|
||||||
readerStartEnd := size - mb5
|
readerStartEnd := size - startend
|
||||||
|
|
||||||
if readerStartEnd < 0 {
|
if readerStartEnd < 0 {
|
||||||
// Если конец начального ридера оказался за началом
|
// Если конец начального ридера оказался за началом
|
||||||
@@ -84,7 +84,7 @@ func (t *Torrent) Preload(index int, size int64) {
|
|||||||
readerStartEnd = file.Length()
|
readerStartEnd = file.Length()
|
||||||
}
|
}
|
||||||
|
|
||||||
readerEndStart := file.Length() - mb5
|
readerEndStart := file.Length() - startend
|
||||||
readerEndEnd := file.Length()
|
readerEndEnd := file.Length()
|
||||||
|
|
||||||
var wa sync.WaitGroup
|
var wa sync.WaitGroup
|
||||||
|
|||||||
@@ -255,9 +255,9 @@ func (c *Cache) getRemPieces() []*Piece {
|
|||||||
readerPos := r.getReaderPiece()
|
readerPos := r.getReaderPiece()
|
||||||
readerRAHPos := r.getReaderRAHPiece()
|
readerRAHPos := r.getReaderRAHPiece()
|
||||||
end := r.getPiecesRange().End
|
end := r.getPiecesRange().End
|
||||||
count := int(16 * 1024 * 1024 / c.pieceLength * 5) // 80 MB
|
count := int(16 * 1024 * 1024 * 4 / c.pieceLength) // 64 MB window
|
||||||
if count > 40 {
|
if count > 64 {
|
||||||
count = 40
|
count = 64
|
||||||
}
|
}
|
||||||
limit := 0
|
limit := 0
|
||||||
for i := readerPos; i < end && limit < count; i++ {
|
for i := readerPos; i < end && limit < count; i++ {
|
||||||
|
|||||||
Reference in New Issue
Block a user