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