fix removed pieces redownload

This commit is contained in:
YouROK
2021-07-19 11:22:40 +03:00
parent eeb28b6a73
commit 090bc59310
3 changed files with 5 additions and 8 deletions

View File

@@ -8,8 +8,6 @@ import (
"sync"
"time"
"github.com/anacrolix/torrent"
"server/log"
"server/settings"
)
@@ -84,6 +82,4 @@ func (p *DiskPiece) Release() {
p.piece.Complete = false
os.Remove(p.name)
p.piece.cache.torrent.Piece(p.piece.Id).SetPriority(torrent.PiecePriorityNone)
}

View File

@@ -4,8 +4,6 @@ import (
"io"
"sync"
"time"
"github.com/anacrolix/torrent"
)
type MemPiece struct {
@@ -69,6 +67,4 @@ func (p *MemPiece) Release() {
}
p.piece.Size = 0
p.piece.Complete = false
p.piece.cache.torrent.Piece(p.piece.Id).SetPriority(torrent.PiecePriorityNone)
}

View File

@@ -1,7 +1,9 @@
package torrstor
import (
"github.com/anacrolix/torrent"
"github.com/anacrolix/torrent/storage"
"server/settings"
)
@@ -73,4 +75,7 @@ func (p *Piece) Release() {
} else {
p.dPiece.Release()
}
p.cache.torrent.Piece(p.Id).SetPriority(torrent.PiecePriorityNone)
p.cache.torrent.Piece(p.Id).UpdateCompletion()
}