change preload

This commit is contained in:
YouROK
2021-07-11 17:14:51 +03:00
parent 90048ce9f8
commit 33db9da5ee

View File

@@ -217,14 +217,14 @@ func WriteStatus(w io.Writer) {
} }
func Preload(torr *Torrent, index int) { func Preload(torr *Torrent, index int) {
if !sets.BTsets.PreloadBuffer { cache := float32(sets.BTsets.CacheSize)
size := int64(32 * 1024 * 1024) preload := float32(sets.BTsets.PreloadCache)
if size > sets.BTsets.CacheSize { size := int64((cache / 100.0) * preload)
size = sets.BTsets.CacheSize if size < 32*1024*1024 {
} size = 32 * 1024 * 1024
torr.Preload(index, size)
} else {
size := int64(float32(sets.BTsets.ReaderReadAHead) / 100.0 * float32(sets.BTsets.CacheSize))
torr.Preload(index, size)
} }
if size > sets.BTsets.CacheSize {
size = sets.BTsets.CacheSize
}
torr.Preload(index, size)
} }