Skip to content

armgit / hey

Public Imported from GitHub
0

HTTP load generator, ApacheBench (ab) replacement

Go

Sanity checks for n and c.

mdakin01e8ba26a402
diff --git a/main.go b/main.go
index bfe1421..9e2aae5 100644
--- a/main.go
+++ b/main.go
@@ -39,7 +39,7 @@ var (
var usage = `Usage: boom [options...] <url>
Options:
- -n Number of requests to run.
+ -n Number of requests to run. Can not be
-c Number of requests to run concurrently. Total number of requests cannot
be smaller than the concurency level.
@@ -63,6 +63,10 @@ func main() {
n := *flagN
c := *flagC
+ if n <= 0 || c <= 0 {
+ usageAndExit()
+ }
+
// If total number is smaller than concurrency level,
// make the total number c.
if c > n {