From 6b27c0f4ed3f404da34f51f5a19c58427539b84b Mon Sep 17 00:00:00 2001 From: nikk gitanes Date: Tue, 31 Oct 2023 11:51:24 +0300 Subject: [PATCH] Update torrent.go --- server/torr/torrent.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/server/torr/torrent.go b/server/torr/torrent.go index 2f5ea04..694602e 100644 --- a/server/torr/torrent.go +++ b/server/torr/torrent.go @@ -193,8 +193,8 @@ func (t *Torrent) progressEvent() { } func (t *Torrent) updateRA() { - t.muTorrent.Lock() - defer t.muTorrent.Unlock() + // t.muTorrent.Lock() + // defer t.muTorrent.Unlock() // if t.Torrent != nil && t.Torrent.Info() != nil { // pieceLen := t.Torrent.Info().PieceLength // adj := pieceLen * int64(t.Torrent.Stats().ActivePeers) / int64(1+t.cache.Readers()) @@ -206,13 +206,8 @@ func (t *Torrent) updateRA() { // } // go t.cache.AdjustRA(adj) // } - if t.cache != nil { - readers := t.cache.Readers() - if readers > 0 { // actually it's 0 in preload - adj := int64(16 << 20) // 16 MB fixed RA - go t.cache.AdjustRA(adj) - } - } + adj := int64(16 << 20) // 16 MB fixed RA + go t.cache.AdjustRA(adj) } func (t *Torrent) expired() bool {