From 06874d9eb61e907b8056267d7e6c8c2b12f24e6a Mon Sep 17 00:00:00 2001 From: yourok <8yourok8@mail.ru> Date: Mon, 28 Jan 2019 01:46:56 +0300 Subject: [PATCH] change readahead --- src/server/utils/Torrent.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/server/utils/Torrent.go b/src/server/utils/Torrent.go index 3f47c3b..b75cd4c 100644 --- a/src/server/utils/Torrent.go +++ b/src/server/utils/Torrent.go @@ -51,11 +51,14 @@ func GotInfo(t *torrent.Torrent, timeout int) error { } func GetReadahead() int64 { - readahead := int64(float64(settings.Get().CacheSize) * 0.33) - if readahead < 66*1024*1024 { - readahead = int64(settings.Get().CacheSize) - if readahead > 66*1024*1024 { - readahead = 66 * 1024 * 1024 + readahead := settings.Get().CacheSize - (138412032) //132mb + if readahead < 69206016 { //66mb + readahead = int64(float64(settings.Get().CacheSize) * 0.33) + if readahead < 66*1024*1024 { + readahead = int64(settings.Get().CacheSize) + if readahead > 66*1024*1024 { + readahead = 66 * 1024 * 1024 + } } } return readahead