Merge branch 'master' into old-engine

This commit is contained in:
nikk gitanes
2023-10-31 05:06:34 +03:00
4 changed files with 48 additions and 16 deletions

View File

@@ -198,11 +198,10 @@ func (t *Torrent) updateRA() {
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())
switch {
case adj < pieceLen:
if adj < pieceLen {
adj = pieceLen
case adj > pieceLen*4:
adj = pieceLen * 4
//} else if adj > pieceLen*4 {
// adj = pieceLen * 4
}
go t.cache.AdjustRA(adj)
}