From b0923608bb0cc24c54e4a9c0be321c10a30c6c86 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 23 May 2016 11:00:49 +1000 Subject: [PATCH] Handle tracker announce prepare errors --- tracker_scraper.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tracker_scraper.go b/tracker_scraper.go index 71493b2f..c675e115 100644 --- a/tracker_scraper.go +++ b/tracker_scraper.go @@ -30,12 +30,16 @@ func trackerToTorrentPeers(ps []tracker.Peer) (ret []Peer) { return } -// Return how long to wait before trying again. +// Return how long to wait before trying again. For most errors, we return 5 +// minutes, a relatively quick turn around for DNS changes. func (me *trackerScraper) announce() time.Duration { blocked, urlToUse, host, err := me.t.cl.prepareTrackerAnnounceUnlocked(me.url) + if err != nil { + log.Printf("error preparing announce to %q: %s", me.url, err) + return 5 * time.Minute + } if blocked { - // Wait for DNS to potentially change. Very few people do it faster - // than 5 minutes. + log.Printf("announce to tracker %q blocked by IP", me.url) return 5 * time.Minute } me.t.cl.mu.Lock()