Refactor torrent fetching

This commit is contained in:
Ben Sarmiento
2024-04-30 00:16:38 +02:00
parent 00bd0763d6
commit 102512f7d3
4 changed files with 77 additions and 90 deletions

View File

@@ -262,7 +262,7 @@ func (t *TorrentManager) repair(torrent *Torrent) {
}
func (t *TorrentManager) assignUnassignedLinks(torrent *Torrent) bool {
t.log.Infof("Trying to assign links to incomplete torrent %s", t.GetKey(torrent))
t.log.Infof("Trying to assign %d links to incomplete torrent %s", torrent.UnassignedLinks.Cardinality(), t.GetKey(torrent))
// handle torrents with incomplete links for selected files
assignedCount := 0
rarCount := 0
@@ -272,8 +272,7 @@ func (t *TorrentManager) assignUnassignedLinks(torrent *Torrent) bool {
unrestrict := t.UnrestrictLinkUntilOk(link)
if unrestrict == nil {
newUnassignedLinks.Set(link, nil)
// return early, no point continuing
return false
return false // next
}
// try to assign to a selected file