]> Sergey Matveev's repositories - btrtrc.git/commitdiff
fix: added announce to torrent spec
authorKupai József <jozsef.kupai@nokia.com>
Sat, 10 Oct 2015 12:31:02 +0000 (14:31 +0200)
committerKupai József <jozsef.kupai@nokia.com>
Sat, 10 Oct 2015 12:31:02 +0000 (14:31 +0200)
client.go

index 5773627382ff5fb4596161a8f4e903f84532d651..a513930739ebfd56878596ea212b88b87b72007f 100644 (file)
--- a/client.go
+++ b/client.go
@@ -2140,6 +2140,13 @@ func TorrentSpecFromMetaInfo(mi *metainfo.MetaInfo) (spec *TorrentSpec) {
                Info:        &mi.Info,
                DisplayName: mi.Info.Name,
        }
+
+       if len(spec.Trackers) == 0 {
+               spec.Trackers = [][]string{[]string{mi.Announce}}
+       } else {
+               spec.Trackers[0] = append(spec.Trackers[0], mi.Announce)
+       }
+
        CopyExact(&spec.InfoHash, &mi.Info.Hash)
        return
 }