mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
change reader close
This commit is contained in:
@@ -272,13 +272,16 @@ func (t *Torrent) Preload(index int, size int64) {
|
|||||||
// Reader for not pieces break in cache without readers
|
// Reader for not pieces break in cache without readers
|
||||||
readerStart := t.cache.NewReader(file)
|
readerStart := t.cache.NewReader(file)
|
||||||
readerStart.Read(make([]byte, 1))
|
readerStart.Read(make([]byte, 1))
|
||||||
defer t.cache.CloseReader(readerStart)
|
defer t.CloseReader(readerStart)
|
||||||
|
|
||||||
readerEnd := t.cache.NewReader(file)
|
readerEnd := t.cache.NewReader(file)
|
||||||
readerEnd.Seek(-1024, io.SeekEnd)
|
readerEnd.Seek(-1024, io.SeekEnd)
|
||||||
readerEnd.Read(make([]byte, 1))
|
readerEnd.Read(make([]byte, 1))
|
||||||
defer t.cache.CloseReader(readerEnd)
|
defer t.CloseReader(readerEnd)
|
||||||
|
|
||||||
pl := t.Info().PieceLength
|
pl := t.Info().PieceLength
|
||||||
lastStat := ""
|
lastStat := ""
|
||||||
|
|
||||||
for t.PreloadedBytes < size-pl {
|
for t.PreloadedBytes < size-pl {
|
||||||
t.muTorrent.Lock()
|
t.muTorrent.Lock()
|
||||||
if t.Torrent == nil {
|
if t.Torrent == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user