mirror of
https://github.com/pnx/pinger.git
synced 2026-06-16 03:24:54 +02:00
main.go: make printStats() take a probing.Statistics object.
This commit is contained in:
parent
2747946264
commit
57a969561e
1 changed files with 2 additions and 4 deletions
6
main.go
6
main.go
|
|
@ -12,9 +12,7 @@ import (
|
|||
)
|
||||
|
||||
// printStats prints statistics from a ping.
|
||||
func printStats(pinger *probing.Pinger) {
|
||||
stats := pinger.Statistics()
|
||||
|
||||
func printStats(stats *probing.Statistics) {
|
||||
fmt.Printf("%d packets transmitted, %d packets received, %.2f%% packet loss\n",
|
||||
stats.PacketsSent, stats.PacketsRecv, stats.PacketLoss)
|
||||
|
||||
|
|
@ -38,7 +36,7 @@ func eventLoop(pinger *probing.Pinger, ticker *time.Ticker) {
|
|||
return
|
||||
// Ticker ticks. print stats.
|
||||
case <-ticker.C:
|
||||
printStats(pinger)
|
||||
printStats(pinger.Statistics())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue