mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-06 21:50:05 +00:00
Fix icmp ping
This commit is contained in:
@@ -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()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user