From 55b178a8ca174fb4e7f850cae60e0ca665e5cc19 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 15 Mar 2022 13:42:00 +1100 Subject: [PATCH] Export Torrent.UseSources --- client.go | 2 +- sources.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index a6b6b216..275a267f 100644 --- 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) } diff --git a/sources.go b/sources.go index 4fd44673..a03b7675 100644 --- a/sources.go +++ b/sources.go @@ -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 -- 2.48.1