Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
tracker list removes dup entries
Browse files Browse the repository at this point in the history
  • Loading branch information
boypt committed Jul 15, 2021
1 parent c02f2c3 commit 7fd672a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions engine/engineUtil.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,22 @@ func (e *Engine) ParseTrackerList() error {
if lst, err := fetchTxtList(line[7:]); err == nil {
trackers = append(trackers, lst...)
} else {
log.Println("[ParseTrackerList] ignored", err)
log.Println("[ParseTrackerList] ignored", err, line)
}
} else {
trackers = append(trackers, line)
}
}

e.Trackers = trackers
// remove duplicated entries
dupMap := make(map[string]struct{})
for _, t := range trackers {
dupMap[t] = struct{}{}
}
for t := range dupMap {
e.Trackers = append(e.Trackers, t)
}

log.Printf("[ParseTrackerList] got %d trackers", len(e.Trackers))
return nil
}
Expand Down

0 comments on commit 7fd672a

Please sign in to comment.