fix freez preload

This commit is contained in:
YouROK
2020-12-22 19:53:03 +03:00
parent 6f07e85b5a
commit a77ef9e431

View File

@@ -277,9 +277,9 @@ func (t *Torrent) Preload(index int, size int64) {
readerEnd.Seek(-1024, io.SeekEnd)
readerEnd.Read(make([]byte, 1))
defer t.cache.CloseReader(readerEnd)
pl := t.Info().PieceLength
lastStat := ""
for t.PreloadedBytes < size {
for t.PreloadedBytes < size-pl {
t.muTorrent.Lock()
if t.Torrent == nil {
return