]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Export Torrent.UseSources
authorMatt Joiner <anacrolix@gmail.com>
Tue, 15 Mar 2022 02:42:00 +0000 (13:42 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Tue, 15 Mar 2022 02:42:00 +0000 (13:42 +1100)
client.go
sources.go

index a6b6b21642681f65fdda2dc46c392dff17d1a141..275a267f0ba4fdf567b638f24deaf0942abb895e 100644 (file)
--- a/client.go
+++ b/client.go
@@ -1312,10 +1312,10 @@ func (t *Torrent) MergeSpec(spec *TorrentSpec) error {
        }
        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)
        }
index 4fd44673e41b2cc0c5e0ae2122dbef43db17c7e7..a03b767506a568940e5c2c3d0576d2f92e80dd75 100644 (file)
@@ -10,7 +10,9 @@ import (
        "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