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

View File

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

View File

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