diff --git a/main.go b/main.go index 83c91e7..d60c326 100644 --- a/main.go +++ b/main.go @@ -125,6 +125,7 @@ func (m UploadManager) isBWInRange(bw float64) bool { } func (m UploadManager) pingWorker() error { +outerLoop: for { stats, err := doPing(conf.Host, conf.PPP, time.Second) if err != nil { @@ -141,19 +142,13 @@ func (m UploadManager) pingWorker() error { return err } - if stats == nil { - log.Warningf("ping to %s failed: %v", conf.Host, "no response") - time.Sleep(time.Duration(conf.Interval) * time.Minute) - continue - } - log.Infof("ping %s over threshold detected, starting extended pings...", stats.AvgRtt) for stats.AvgRtt.Milliseconds() >= conf.ThrottlePingThreshold { stats, err = doPing(conf.Host, conf.ConformationPPP, time.Second) if err != nil { log.Warningf("ping to %s failed: %v", conf.Host, err) time.Sleep(time.Duration(conf.Interval) * time.Minute) - continue + continue outerLoop } if stats.AvgRtt.Milliseconds() >= conf.ThrottlePingThreshold {