@cryptotaxi247 / kubo / commits / 28a610a13

ping: return an error when ping count <= 0

License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>

Steven Allen committed Jan 4, 2018 at 10:41 UTC 28a610a13a252968e2430712962a5802328106cb
1 file changed +4
core/commands/ping.go
+4
@@ -103,6 +103,10 @@ trip latency information.
103 return
104 }
105
106 + if numPings <= 0 {
107 + res.SetError(fmt.Errorf("error: ping count must be greater than 0, was %d", numPings), cmdkit.ErrNormal)
108 + }
109 +
110 outChan := pingPeer(ctx, n, peerID, numPings)
111 res.SetOutput(outChan)
112 },