added timeout

This commit is contained in:
2023-04-18 00:38:08 +02:00
parent 3a97d96d82
commit f1463bf120

View File

@@ -33,7 +33,7 @@ type WaybarOut struct {
} }
func formatLine(stats *probing.Statistics) { func formatLine(stats *probing.Statistics) {
if stats.PacketLoss >= 100.0 { if stats.PacketLoss >= 100.0 || stats.PacketsRecv == 0 {
// fontawesome/forkawesome doesn't have the fitting icon... // fontawesome/forkawesome doesn't have the fitting icon...
// so this is the utf-8 icon/emoji // so this is the utf-8 icon/emoji
fmt.Printf("%%{F#%s}🚫\n", CritColor) fmt.Printf("%%{F#%s}🚫\n", CritColor)
@@ -91,6 +91,7 @@ func main() {
goto sleep goto sleep
} }
pinger.Count = *PingCount pinger.Count = *PingCount
pinger.Timeout = 3 * time.Second
if *Waybar { if *Waybar {
pinger.OnFinish = formatLineWaybar pinger.OnFinish = formatLineWaybar
} else { } else {