From ec92f68bb53930e1ea6d69ea0303cd6b42abcd4f Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 22 Jun 2024 09:28:15 +0700 Subject: [PATCH 1/2] save --- erigon-lib/downloader/downloader.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/erigon-lib/downloader/downloader.go b/erigon-lib/downloader/downloader.go index 3db185f9819..ac4a9b524b8 100644 --- a/erigon-lib/downloader/downloader.go +++ b/erigon-lib/downloader/downloader.go @@ -807,6 +807,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 bit 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) } } From 0ada2469761dc257ddf7befe38e834e4e3b2493f Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 22 Jun 2024 09:31:17 +0700 Subject: [PATCH 2/2] save --- erigon-lib/downloader/downloader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erigon-lib/downloader/downloader.go b/erigon-lib/downloader/downloader.go index ac4a9b524b8..a3e5fd2a3cb 100644 --- a/erigon-lib/downloader/downloader.go +++ b/erigon-lib/downloader/downloader.go @@ -807,7 +807,7 @@ 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 bit it has no info assume that the + // 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 {