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.
|
||||
}
|
||||
if err == nil {
|
||||
result.Delay = float32(pinger.Statistics().AvgRtt.Microseconds()) / 1000.0
|
||||
result.Successful = true
|
||||
if pinger.Statistics().PacketsRecv == 0 {
|
||||
result.Data = "Ping 未收到回包"
|
||||
} else {
|
||||
result.Delay = float32(pinger.Statistics().AvgRtt.Microseconds()) / 1000.0
|
||||
result.Successful = true
|
||||
}
|
||||
} else {
|
||||
result.Data = err.Error()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user