cmd/tracker-announce: Was using empty AnnounceRequest

This commit is contained in:
Matt Joiner 2018-08-13 20:26:47 +10:00
parent 066809403a
commit 8b4a4193a8
1 changed files with 5 additions and 4 deletions

View File

@ -47,16 +47,16 @@ func main() {
for _, tier := range ts.Trackers { for _, tier := range ts.Trackers {
for _, tURI := range tier { for _, tURI := range tier {
wg.Add(1) wg.Add(1)
go doTracker(tURI, wg.Done) go doTracker(tURI, wg.Done, ar)
} }
} }
} }
wg.Wait() wg.Wait()
} }
func doTracker(tURI string, done func()) { func doTracker(tURI string, done func(), ar tracker.AnnounceRequest) {
defer done() defer done()
for _, res := range announces(tURI) { for _, res := range announces(tURI, ar) {
err := res.error err := res.error
resp := res.AnnounceResponse resp := res.AnnounceResponse
if err != nil { if err != nil {
@ -72,12 +72,13 @@ type announceResult struct {
error error
} }
func announces(uri string) (ret []announceResult) { func announces(uri string, ar tracker.AnnounceRequest) (ret []announceResult) {
u, err := url.Parse(uri) u, err := url.Parse(uri)
if err != nil { if err != nil {
return []announceResult{{error: err}} return []announceResult{{error: err}}
} }
a := tracker.Announce{ a := tracker.Announce{
Request: ar,
TrackerUrl: uri, TrackerUrl: uri,
} }
if u.Scheme == "udp" { if u.Scheme == "udp" {