cmd/quictpu/ping: -c and -i

This commit is contained in:
Leopold Schabel 2022-06-19 14:03:42 +02:00
parent 7a9df45b5e
commit 916fb404f6
1 changed files with 4 additions and 5 deletions

View File

@ -22,8 +22,8 @@ import (
var (
flagDebug = flag.Bool("debug", false, "Enable debug logging")
flagCount = flag.Int("count", 1, "Number of pings to send, -1 for infinite")
flagDelay = flag.Duration("delay", 1*time.Second, "Delay between pings")
flagCount = flag.Int("c", 1, "Number of pings to send, -1 for infinite")
flagDelay = flag.Duration("i", 1*time.Second, "Delay between pings")
flagAddr = flag.String("addr", "", "Address to ping (<host>:<port>)")
)
@ -73,7 +73,8 @@ func main() {
c := 0
for c < *flagCount || *flagCount == -1 {
for c := 0; c < *flagCount || *flagCount == -1; c++ {
c := c
t := time.Now()
minTimeout := 100 * time.Millisecond
if *flagDelay > minTimeout {
@ -105,7 +106,5 @@ func main() {
}
time.Sleep(*flagDelay)
c++
}
}