mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
очередной фикс
This commit is contained in:
@@ -155,7 +155,7 @@ func (c *Cache) GetState() *state.CacheState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
readersState := make([]*state.ReaderState, 0)
|
readersState := make([]*state.ReaderState, 0)
|
||||||
|
|
||||||
if c.Readers() > 0 {
|
if c.Readers() > 0 {
|
||||||
c.muReaders.Lock()
|
c.muReaders.Lock()
|
||||||
for r, _ := range c.readers {
|
for r, _ := range c.readers {
|
||||||
@@ -258,13 +258,13 @@ func (c *Cache) getRemPieces() []*Piece {
|
|||||||
if !c.pieces[i].Complete {
|
if !c.pieces[i].Complete {
|
||||||
if i == readerPos {
|
if i == readerPos {
|
||||||
c.torrent.Piece(i).SetPriority(torrent.PiecePriorityNow)
|
c.torrent.Piece(i).SetPriority(torrent.PiecePriorityNow)
|
||||||
} else if i == readerPos + 1 {
|
} else if i == readerPos+1 {
|
||||||
c.torrent.Piece(i).SetPriority(torrent.PiecePriorityNext)
|
c.torrent.Piece(i).SetPriority(torrent.PiecePriorityNext)
|
||||||
} else if i > readerPos && i <= readerRAHPos {
|
} else if i > readerPos && i <= readerRAHPos {
|
||||||
c.torrent.Piece(i).SetPriority(torrent.PiecePriorityReadahead)
|
c.torrent.Piece(i).SetPriority(torrent.PiecePriorityReadahead)
|
||||||
} else if i > readerRAHPos && i <= readerPos + (end - readerPos)/2 && c.torrent.PieceState(i).Priority != torrent.PiecePriorityHigh {
|
} else if i > readerRAHPos && i <= readerRAHPos+5 && c.torrent.PieceState(i).Priority != torrent.PiecePriorityHigh {
|
||||||
c.torrent.Piece(i).SetPriority(torrent.PiecePriorityHigh)
|
c.torrent.Piece(i).SetPriority(torrent.PiecePriorityHigh)
|
||||||
} else if i > readerPos + (end - readerPos)/2 && c.torrent.PieceState(i).Priority != torrent.PiecePriorityNormal {
|
} else if i > readerRAHPos+5 && c.torrent.PieceState(i).Priority != torrent.PiecePriorityNormal {
|
||||||
c.torrent.Piece(i).SetPriority(torrent.PiecePriorityNormal)
|
c.torrent.Piece(i).SetPriority(torrent.PiecePriorityNormal)
|
||||||
}
|
}
|
||||||
limit++
|
limit++
|
||||||
@@ -282,10 +282,10 @@ func (c *Cache) getRemPieces() []*Piece {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cache) isIdInFileBE(ranges []Range, id int) bool {
|
func (c *Cache) isIdInFileBE(ranges []Range, id int) bool {
|
||||||
|
|
||||||
// keep 8/16 MB
|
// keep 8/16 MB
|
||||||
FileRangeNotDelete := int64(c.pieceLength)
|
FileRangeNotDelete := int64(c.pieceLength)
|
||||||
if (FileRangeNotDelete < 8 * 1024 * 1024) {
|
if FileRangeNotDelete < 8*1024*1024 {
|
||||||
FileRangeNotDelete = 8 * 1024 * 1024
|
FileRangeNotDelete = 8 * 1024 * 1024
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user