mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
hope finally fix rewind
This commit is contained in:
@@ -2,7 +2,7 @@ module server
|
||||
|
||||
go 1.17
|
||||
|
||||
replace github.com/anacrolix/torrent v1.30.3 => github.com/tsynik/torrent v1.2.7-0.20210822081106-f50bd5065818
|
||||
replace github.com/anacrolix/torrent v1.30.3 => github.com/tsynik/torrent v1.2.7-0.20210822152206-0c6be3586d70
|
||||
|
||||
exclude github.com/willf/bitset v1.2.0
|
||||
|
||||
|
||||
@@ -656,8 +656,8 @@ github.com/tinylib/msgp v1.1.1/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDW
|
||||
github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
|
||||
github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/tsynik/torrent v1.2.7-0.20210822081106-f50bd5065818 h1:8FwSi/4QLjNRNwFtqx2YX2z8kZlMC+n3oe6PcUKorw8=
|
||||
github.com/tsynik/torrent v1.2.7-0.20210822081106-f50bd5065818/go.mod h1:6qxhn+CsyQ9b35j3ETXGDMLh4z2vTTutGx3ZnllNcCo=
|
||||
github.com/tsynik/torrent v1.2.7-0.20210822152206-0c6be3586d70 h1:zcj/875ut7qO4xSePJHWPjlYJzaSKtXngythxng8glo=
|
||||
github.com/tsynik/torrent v1.2.7-0.20210822152206-0c6be3586d70/go.mod h1:6qxhn+CsyQ9b35j3ETXGDMLh4z2vTTutGx3ZnllNcCo=
|
||||
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q=
|
||||
github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM=
|
||||
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
||||
|
||||
@@ -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