Revert "Quick fix for missing MetaInfo.Announce everywhere with trackers"

This reverts commit b7a8d08bbf.
This commit is contained in:
Matt Joiner 2017-02-15 18:40:30 +11:00
parent 415fdcb982
commit a959bdd0f8
3 changed files with 3 additions and 18 deletions

View File

@ -78,18 +78,3 @@ func (mi *MetaInfo) Magnet(displayName string, infoHash Hash) (m Magnet) {
m.InfoHash = infoHash
return
}
func (mi *MetaInfo) FlatTrackers() (ret []string) {
m := make(map[string]struct{})
for _, t := range mi.AnnounceList {
for _, s := range t {
m[s] = struct{}{}
}
}
m[mi.Announce] = struct{}{}
ret = make([]string, 0, len(m))
for s := range m {
ret = append(ret, s)
}
return
}

4
t.go
View File

@ -197,8 +197,8 @@ func (t *Torrent) String() string {
return s
}
func (t *Torrent) AddTrackers(urls []string) {
func (t *Torrent) AddTrackers(announceList [][]string) {
t.cl.mu.Lock()
defer t.cl.mu.Unlock()
t.addTrackers([][]string{urls})
t.addTrackers(announceList)
}

View File

@ -1354,7 +1354,7 @@ func (t *Torrent) pieceHashed(piece int, correct bool) {
if correct {
pieceHashedCorrect.Add(1)
} else {
log.Printf("%s: piece %d (%v) failed hash: %d connections contributed", t, piece, p.Hash, len(touchers))
log.Printf("%s: piece %d (%x) failed hash: %d connections contributed", t, piece, p.Hash, len(touchers))
pieceHashedNotCorrect.Add(1)
}
}