diff --git a/server/torr/storage/torrstor/reader.go b/server/torr/storage/torrstor/reader.go index 28be26f..c659b6b 100644 --- a/server/torr/storage/torrstor/reader.go +++ b/server/torr/storage/torrstor/reader.go @@ -90,6 +90,9 @@ func (r *Reader) Read(p []byte) (n int, err error) { } func (r *Reader) SetReadahead(length int64) { + if length > r.cache.capacity { + length = r.cache.capacity + } r.Reader.SetReadahead(length) r.readahead = length }