From 50eac7bdf0cd03e9258a89dfd78ac7a8594ae41e Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 9 Aug 2015 00:24:17 +0900 Subject: [PATCH] h2load: Fix -r does not work without -C option --- src/h2load.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/h2load.cc b/src/h2load.cc index 1043da3a..9f265eba 100644 --- a/src/h2load.cc +++ b/src/h2load.cc @@ -1333,7 +1333,8 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } - if (config.is_rate_mode() && config.nconns < (ssize_t)config.nthreads) { + if (config.is_rate_mode() && config.nconns != 0 && + config.nconns < (ssize_t)config.nthreads) { std::cerr << "-C, -t: the total number of connections must be greater than " "or equal " << "to the number of threads." << std::endl; @@ -1568,7 +1569,7 @@ int main(int argc, char **argv) { auto nclients_extra_rem_per_thread = 0; // In rate mode, we want each Worker to create a total of // C/t connections. - if (config.is_rate_mode()) { + if (config.is_rate_mode() && config.nconns > seconds * config.rate) { nclients_extra = config.nconns - (seconds * config.rate); nclients_extra_per_thread = nclients_extra / (ssize_t)config.nthreads; nclients_extra_rem_per_thread =