From 5c53bbbaa22bc796b59560dc11a3c6dd417dc1da Mon Sep 17 00:00:00 2001 From: YouROK <8yourok8@mail.ru> Date: Mon, 8 Mar 2021 21:07:49 +0300 Subject: [PATCH] fix preload size --- server/torr/torrent.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/torr/torrent.go b/server/torr/torrent.go index 67373b8..3216827 100644 --- a/server/torr/torrent.go +++ b/server/torr/torrent.go @@ -272,6 +272,10 @@ func (t *Torrent) Preload(index int, size int64) { file = t.Files()[0] } + if size > file.Length() { + size = file.Length() + } + if t.Info() != nil { pl := t.Info().PieceLength mb5 := int64(5 * 1024 * 1024)