Skip to content

Commit fd4f1ac

Browse files
dl: additional pre-check for having info (#11012)
cherry-pick of #10853
1 parent 1417f89 commit fd4f1ac

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

erigon-lib/downloader/downloader.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,19 @@ func (d *Downloader) mainLoop(silent bool) error {
811811

812812
for _, t := range d.torrentClient.Torrents() {
813813
if urls, ok := d.webseeds.ByFileName(t.Name()); ok {
814+
// if we have created a torrent, but it has no info, assume that the
815+
// webseed download either has not been called yet or has failed and
816+
// try again here - otherwise the torrent will be left with no info
817+
if t.Info() == nil {
818+
ts, ok, err := d.webseeds.DownloadAndSaveTorrentFile(d.ctx, t.Name())
819+
if ok && err == nil {
820+
_, _, err = addTorrentFile(d.ctx, ts, d.torrentClient, d.db, d.webseeds)
821+
if err != nil {
822+
continue
823+
}
824+
}
825+
}
826+
814827
t.AddWebSeeds(urls)
815828
}
816829
}

0 commit comments

Comments
 (0)