From 716dc553219b816eac749fcd843dfa8c3e76c2f4 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Fri, 25 Feb 2022 19:49:49 +1100 Subject: [PATCH] Fix race in MergeSpec using DisableInitialPieceCheck --- client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.go b/client.go index 21a4e0e0..4815d53a 100644 --- a/client.go +++ b/client.go @@ -1301,7 +1301,6 @@ func (t *Torrent) MergeSpec(spec *TorrentSpec) error { if spec.DisplayName != "" { t.SetDisplayName(spec.DisplayName) } - t.initialPieceCheckDisabled = spec.DisableInitialPieceCheck if spec.InfoBytes != nil { err := t.SetInfoBytes(spec.InfoBytes) if err != nil { @@ -1312,6 +1311,7 @@ func (t *Torrent) MergeSpec(spec *TorrentSpec) error { cl.AddDhtNodes(spec.DhtNodes) cl.lock() defer cl.unlock() + t.initialPieceCheckDisabled = spec.DisableInitialPieceCheck useTorrentSources(spec.Sources, t) for _, url := range spec.Webseeds { t.addWebSeed(url)