mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
hope finally fix rewind
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package torr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
@@ -102,7 +101,7 @@ func GetTorrent(hashHex string) *Torrent {
|
||||
go func() {
|
||||
lockApi.Lock()
|
||||
defer lockApi.Unlock()
|
||||
fmt.Println("Add torrent")
|
||||
log.TLogln("Add torrent")
|
||||
tr, _ := NewTorrent(tor.TorrentSpec, bts)
|
||||
if tr != nil {
|
||||
tr.Title = tor.Title
|
||||
@@ -215,15 +214,15 @@ func SetSettings(set *sets.BTSets) {
|
||||
}
|
||||
lockApi.Lock()
|
||||
defer lockApi.Unlock()
|
||||
fmt.Println("drop all")
|
||||
log.TLogln("drop all")
|
||||
dropAllTorrent()
|
||||
time.Sleep(time.Second * 2)
|
||||
fmt.Println("disconect")
|
||||
log.TLogln("disconect")
|
||||
bts.Disconnect()
|
||||
sets.SetBTSets(set)
|
||||
fmt.Println("connect")
|
||||
log.TLogln("connect")
|
||||
bts.Connect()
|
||||
fmt.Println("end set settings")
|
||||
log.TLogln("end set settings")
|
||||
}
|
||||
|
||||
func SetDefSettings() {
|
||||
|
||||
@@ -199,6 +199,7 @@ func (c *Cache) cleanPieces() {
|
||||
rems := (c.filled-c.capacity)/c.pieceLength + 1
|
||||
for _, p := range remPieces {
|
||||
c.removePiece(p)
|
||||
c.torrent.Piece(p.Id).UpdateCompletion()
|
||||
rems--
|
||||
if rems <= 0 {
|
||||
utils.FreeOSMemGC()
|
||||
@@ -239,7 +240,7 @@ func (c *Cache) getRemPieces() []*Piece {
|
||||
}
|
||||
}
|
||||
|
||||
c.updatePriority()
|
||||
c.clearPriority()
|
||||
|
||||
c.muReaders.Lock()
|
||||
for r, _ := range c.readers {
|
||||
@@ -328,10 +329,10 @@ func (c *Cache) CloseReader(r *Reader) {
|
||||
r.Close()
|
||||
delete(r.cache.readers, r)
|
||||
r.cache.muReaders.Unlock()
|
||||
go c.updatePriority()
|
||||
go c.clearPriority()
|
||||
}
|
||||
|
||||
func (c *Cache) updatePriority() {
|
||||
func (c *Cache) clearPriority() {
|
||||
time.Sleep(time.Second)
|
||||
ranges := make([]Range, 0)
|
||||
c.muReaders.Lock()
|
||||
|
||||
Reference in New Issue
Block a user