mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
change expired time logic
This commit is contained in:
@@ -92,7 +92,7 @@ func NewTorrent(spec *torrent.TorrentSpec, bt *BTServer) (*Torrent, error) {
|
||||
torr.bt = bt
|
||||
torr.closed = goTorrent.Closed()
|
||||
torr.TorrentSpec = spec
|
||||
torr.AddExpiredTime(time.Minute)
|
||||
torr.AddExpiredTime(time.Second * time.Duration(settings.BTsets.TorrentDisconnectTimeout))
|
||||
torr.Timestamp = time.Now().Unix()
|
||||
|
||||
go torr.watch()
|
||||
@@ -106,8 +106,8 @@ func (t *Torrent) WaitInfo() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Close torrent if not info while 5 minutes
|
||||
tm := time.NewTimer(time.Minute * 5)
|
||||
// Close torrent if no info in 1 minute + TorrentDisconnectTimeout config option
|
||||
tm := time.NewTimer(time.Minute + time.Second*time.Duration(settings.BTsets.TorrentDisconnectTimeout))
|
||||
|
||||
select {
|
||||
case <-t.Torrent.GotInfo():
|
||||
@@ -134,7 +134,7 @@ func (t *Torrent) GotInfo() bool {
|
||||
t.Stat = state.TorrentGettingInfo
|
||||
if t.WaitInfo() {
|
||||
t.Stat = state.TorrentWorking
|
||||
t.AddExpiredTime(time.Minute * 5)
|
||||
t.AddExpiredTime(time.Minute + time.Second*time.Duration(settings.BTsets.TorrentDisconnectTimeout))
|
||||
return true
|
||||
} else {
|
||||
t.Close()
|
||||
|
||||
Reference in New Issue
Block a user