added timeout
This commit is contained in:
@@ -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 {
|
||||||
|
Reference in New Issue
Block a user