From 58f787e23564cd1399c08ac32489cdf27d7b5454 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Mon, 25 Jul 2022 15:57:26 +0200 Subject: [PATCH] fixed no response crash --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index 982b0dd..83c91e7 100644 --- a/main.go +++ b/main.go @@ -141,6 +141,12 @@ 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)