client.go | 2 +- sources.go | 4 +++- diff --git a/client.go b/client.go index a6b6b21642681f65fdda2dc46c392dff17d1a141..275a267f0ba4fdf567b638f24deaf0942abb895e 100644 --- a/client.go +++ b/client.go @@ -1312,10 +1312,10 @@ } } cl := t.cl cl.AddDhtNodes(spec.DhtNodes) + t.UseSources(spec.Sources) cl.lock() defer cl.unlock() t.initialPieceCheckDisabled = spec.DisableInitialPieceCheck - t.useSources(spec.Sources) for _, url := range spec.Webseeds { t.addWebSeed(url) } diff --git a/sources.go b/sources.go index 4fd44673e41b2cc0c5e0ae2122dbef43db17c7e7..a03b767506a568940e5c2c3d0576d2f92e80dd75 100644 --- a/sources.go +++ b/sources.go @@ -10,7 +10,9 @@ "github.com/anacrolix/torrent/bencode" "github.com/anacrolix/torrent/metainfo" ) -func (t *Torrent) useSources(sources []string) { +// Add HTTP endpoints that serve the metainfo. They will be used if the torrent info isn't obtained +// yet. The Client HTTP client is used. +func (t *Torrent) UseSources(sources []string) { select { case <-t.Closed(): return