From 2c72f661f3ac832920a6089d1a87d084441e6dba Mon Sep 17 00:00:00 2001 From: boypt <1033514+boypt@users.noreply.github.com> Date: Thu, 22 Jul 2021 14:16:14 +0800 Subject: [PATCH] stop data dl before setting each file priority --- engine/engine.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/engine/engine.go b/engine/engine.go index 7f6c7c32..b7ca8339 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -366,12 +366,11 @@ func (e *Engine) StartTorrent(infohash string) error { } if t.t.Info() != nil { t.t.AllowDataUpload() - t.t.AllowDataDownload() - // start all files by setting the priority to normal for _, f := range t.t.Files() { f.SetPriority(torrent.PiecePriorityNormal) } + t.t.AllowDataDownload() } return nil } @@ -392,13 +391,12 @@ func (e *Engine) StopTorrent(infohash string) error { } if t.t.Info() != nil { + t.t.DisallowDataDownload() // stop all files by setting the priority to None for _, f := range t.t.Files() { f.SetPriority(torrent.PiecePriorityNone) } - t.t.DisallowDataUpload() - t.t.DisallowDataDownload() } t.Started = false