]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Handle tracker announce prepare errors
authorMatt Joiner <anacrolix@gmail.com>
Mon, 23 May 2016 01:00:49 +0000 (11:00 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 23 May 2016 01:00:49 +0000 (11:00 +1000)
tracker_scraper.go

index 71493b2f6ee94e89b93a146a1405de2f621eaa88..c675e11510c6475ad71c8d6cfd05a00aed9ed2b8 100644 (file)
@@ -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()