set short timeouts in GetTorrent, NewTorrent and Preload log

This commit is contained in:
nikk gitanes
2024-06-07 17:19:34 +03:00
parent 47a2982bfd
commit b6328d6153
3 changed files with 16 additions and 3 deletions

View File

@@ -85,6 +85,11 @@ func NewTorrent(spec *torrent.TorrentSpec, bt *BTServer) (*Torrent, error) {
return tor, nil
}
timeout := time.Second * time.Duration(settings.BTsets.TorrentDisconnectTimeout)
if timeout > time.Minute {
timeout = time.Minute
}
torr := new(Torrent)
torr.Torrent = goTorrent
torr.Stat = state.TorrentAdded
@@ -92,7 +97,7 @@ func NewTorrent(spec *torrent.TorrentSpec, bt *BTServer) (*Torrent, error) {
torr.bt = bt
torr.closed = goTorrent.Closed()
torr.TorrentSpec = spec
torr.AddExpiredTime(time.Second * time.Duration(settings.BTsets.TorrentDisconnectTimeout))
torr.AddExpiredTime(timeout)
torr.Timestamp = time.Now().Unix()
go torr.watch()