fix read a head

This commit is contained in:
yourok
2023-10-24 22:03:42 +03:00
parent 64ae3b8f1c
commit dfde29f178

View File

@@ -198,11 +198,10 @@ func (t *Torrent) updateRA() {
if t.Torrent != nil && t.Torrent.Info() != nil { if t.Torrent != nil && t.Torrent.Info() != nil {
pieceLen := t.Torrent.Info().PieceLength pieceLen := t.Torrent.Info().PieceLength
adj := pieceLen * int64(t.Torrent.Stats().ActivePeers) / int64(1+t.cache.Readers()) adj := pieceLen * int64(t.Torrent.Stats().ActivePeers) / int64(1+t.cache.Readers())
switch { if adj < pieceLen {
case adj < pieceLen:
adj = pieceLen adj = pieceLen
case adj > pieceLen*4: //} else if adj > pieceLen*4 {
adj = pieceLen * 4 // adj = pieceLen * 4
} }
go t.cache.AdjustRA(adj) go t.cache.AdjustRA(adj)
} }