mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
safe UpdateCompletion() on Release()
This commit is contained in:
@@ -199,7 +199,7 @@ func (c *Cache) cleanPieces() {
|
|||||||
rems := (c.filled-c.capacity)/c.pieceLength + 1
|
rems := (c.filled-c.capacity)/c.pieceLength + 1
|
||||||
for _, p := range remPieces {
|
for _, p := range remPieces {
|
||||||
c.removePiece(p)
|
c.removePiece(p)
|
||||||
c.torrent.Piece(p.Id).UpdateCompletion()
|
//c.torrent.Piece(p.Id).UpdateCompletion() // safe call in Piece.Release()
|
||||||
rems--
|
rems--
|
||||||
if rems <= 0 {
|
if rems <= 0 {
|
||||||
utils.FreeOSMemGC()
|
utils.FreeOSMemGC()
|
||||||
|
|||||||
@@ -85,5 +85,5 @@ func (p *DiskPiece) Release() {
|
|||||||
|
|
||||||
os.Remove(p.name)
|
os.Remove(p.name)
|
||||||
|
|
||||||
p.piece.cache.torrent.Piece(p.piece.Id).SetPriority(torrent.PiecePriorityNone)
|
//p.piece.cache.torrent.Piece(p.piece.Id).SetPriority(torrent.PiecePriorityNone)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,5 +70,5 @@ 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)
|
//p.piece.cache.torrent.Piece(p.piece.Id).SetPriority(torrent.PiecePriorityNone)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ func (p *Piece) Release() {
|
|||||||
} else {
|
} else {
|
||||||
p.dPiece.Release()
|
p.dPiece.Release()
|
||||||
}
|
}
|
||||||
// if !p.cache.isClosed {
|
if !p.cache.isClosed {
|
||||||
// p.cache.torrent.Piece(p.Id).SetPriority(torrent.PiecePriorityNone)
|
p.cache.torrent.Piece(p.Id).SetPriority(torrent.PiecePriorityNone)
|
||||||
// // fix remove pieces hash
|
// fix remove pieces hash and rewind
|
||||||
// p.cache.torrent.Piece(p.Id).UpdateCompletion()
|
p.cache.torrent.Piece(p.Id).UpdateCompletion()
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user