mirror of
https://github.com/nezhahq/nezha.git
synced 2025-02-02 09:38:13 -05:00
Fix icmp ping
This commit is contained in:
parent
89e542c902
commit
64dd7b9649
@ -337,8 +337,12 @@ func handleIcmpPingTask(task *pb.Task, result *pb.TaskResult) {
|
|||||||
err = pinger.Run() // Blocks until finished.
|
err = pinger.Run() // Blocks until finished.
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
result.Delay = float32(pinger.Statistics().AvgRtt.Microseconds()) / 1000.0
|
if pinger.Statistics().PacketsRecv == 0 {
|
||||||
result.Successful = true
|
result.Data = "Ping 未收到回包"
|
||||||
|
} else {
|
||||||
|
result.Delay = float32(pinger.Statistics().AvgRtt.Microseconds()) / 1000.0
|
||||||
|
result.Successful = true
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
result.Data = err.Error()
|
result.Data = err.Error()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user