mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
migrate to old gotorrent
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/anacrolix/torrent"
|
||||
|
||||
"server/log"
|
||||
"server/settings"
|
||||
"server/torr/storage/state"
|
||||
@@ -193,12 +194,9 @@ func (c *Cache) getRemPieces() []*Piece {
|
||||
fill += p.Size
|
||||
}
|
||||
piece := c.torrent.Piece(id)
|
||||
state := piece.State()
|
||||
state := c.torrent.PieceState(id)
|
||||
if len(ranges) > 0 {
|
||||
if !inRanges(ranges, id) {
|
||||
if state.Priority != torrent.PiecePriorityNone {
|
||||
piece.SetPriority(torrent.PiecePriorityNone)
|
||||
}
|
||||
if p.Size > 0 {
|
||||
piecesRemove = append(piecesRemove, p)
|
||||
}
|
||||
@@ -207,10 +205,6 @@ func (c *Cache) getRemPieces() []*Piece {
|
||||
piece.SetPriority(torrent.PiecePriorityNormal)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if state.Priority != torrent.PiecePriorityNone {
|
||||
piece.SetPriority(torrent.PiecePriorityNone)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,9 +98,5 @@ func (p *Piece) Release() {
|
||||
p.Size = 0
|
||||
p.complete = false
|
||||
|
||||
//Костыль чтобы двиг понял что куска нет, иногда загружает его по новый хз почему
|
||||
pce := p.cache.torrent.Piece(p.Id)
|
||||
pce.SetPriority(torrent.PiecePriorityNone)
|
||||
pce.UpdateCompletion()
|
||||
pce.SetPriority(torrent.PiecePriorityNone)
|
||||
p.cache.torrent.Piece(p.Id).SetPriority(torrent.PiecePriorityNone)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/anacrolix/torrent"
|
||||
|
||||
"server/log"
|
||||
"server/settings"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user