Export Torrent.UseSources
This commit is contained in:
parent
39af2fe8f2
commit
55b178a8ca
|
@ -1312,10 +1312,10 @@ func (t *Torrent) MergeSpec(spec *TorrentSpec) error {
|
||||||
}
|
}
|
||||||
cl := t.cl
|
cl := t.cl
|
||||||
cl.AddDhtNodes(spec.DhtNodes)
|
cl.AddDhtNodes(spec.DhtNodes)
|
||||||
|
t.UseSources(spec.Sources)
|
||||||
cl.lock()
|
cl.lock()
|
||||||
defer cl.unlock()
|
defer cl.unlock()
|
||||||
t.initialPieceCheckDisabled = spec.DisableInitialPieceCheck
|
t.initialPieceCheckDisabled = spec.DisableInitialPieceCheck
|
||||||
t.useSources(spec.Sources)
|
|
||||||
for _, url := range spec.Webseeds {
|
for _, url := range spec.Webseeds {
|
||||||
t.addWebSeed(url)
|
t.addWebSeed(url)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,9 @@ import (
|
||||||
"github.com/anacrolix/torrent/metainfo"
|
"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 {
|
select {
|
||||||
case <-t.Closed():
|
case <-t.Closed():
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue