Skip to content

Commit

Permalink
dl: additional pre-check for having info (#11012)
Browse files Browse the repository at this point in the history
cherry-pick of #10853
  • Loading branch information
AskAlexSharov authored Jul 4, 2024
1 parent 1417f89 commit fd4f1ac
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions erigon-lib/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,19 @@ func (d *Downloader) mainLoop(silent bool) error {

for _, t := range d.torrentClient.Torrents() {
if urls, ok := d.webseeds.ByFileName(t.Name()); ok {
// if we have created a torrent, but it has no info, assume that the
// webseed download either has not been called yet or has failed and
// try again here - otherwise the torrent will be left with no info
if t.Info() == nil {
ts, ok, err := d.webseeds.DownloadAndSaveTorrentFile(d.ctx, t.Name())
if ok && err == nil {
_, _, err = addTorrentFile(d.ctx, ts, d.torrentClient, d.db, d.webseeds)
if err != nil {
continue
}
}
}

t.AddWebSeeds(urls)
}
}
Expand Down

0 comments on commit fd4f1ac

Please sign in to comment.