Merge pull request #279 from Erope/master

Fix: fix icmp ping & fix agent action build

Co-authored-by: Erope <44471469+Erope@users.noreply.github.com>
This commit is contained in:
naiba 2023-03-01 23:43:21 +08:00 committed by GitHub
commit 9e9cada57d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -9,7 +9,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
container:
image: goreleaser/goreleaser-cross
image: goreleaser/goreleaser-cross:v1.19.2
steps:
- uses: actions/checkout@master
with:

View File

@ -337,7 +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
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()