Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
stop data dl before setting each file priority
Browse files Browse the repository at this point in the history
  • Loading branch information
boypt committed Jul 22, 2021
1 parent 5731bd4 commit 2c72f66
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand Down

0 comments on commit 2c72f66

Please sign in to comment.