From: Kupai József Date: Sat, 10 Oct 2015 12:31:02 +0000 (+0200) Subject: fix: added announce to torrent spec X-Git-Tag: v1.0.0~1021^2 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=70a307a5ea079656c59370ee067912f2f985ee9c;p=btrtrc.git fix: added announce to torrent spec --- diff --git a/client.go b/client.go index 57736273..a5139307 100644 --- 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 }