Fix icmp ping
This commit is contained in:
1 parent
89e542c902
commit
64dd7b9649
1 file changed
+4
@@ -337,8 +337,12 @@ 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
|
||||
}
|
||||
} else {
|
||||
result.Data = err.Error()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user