diff --git a/src/h2load.cc b/src/h2load.cc index 856d556f..7e1d14f6 100644 --- a/src/h2load.cc +++ b/src/h2load.cc @@ -731,11 +731,11 @@ void Client::signal_write() { ev_io_start(worker->loop, &wev); } Worker::Worker(uint32_t id, SSL_CTX *ssl_ctx, size_t req_todo, size_t nclients, ssize_t rate, Config *config) : stats(req_todo), loop(ev_loop_new(0)), ssl_ctx(ssl_ctx), config(config), - id(id), tls_info_report_done(false), rate_loop(EV_DEFAULT), current_second(0), nconns_made(0), nclients(nclients), rate(rate) { + id(id), tls_info_report_done(false), current_second(0), nconns_made(0), nclients(nclients), rate(rate) { stats.req_todo = req_todo; progress_interval = std::max((size_t)1, req_todo / 10); - nreqs_per_client = req_todo / nclients; - nreqs_rem = req_todo % nclients; + auto nreqs_per_client = req_todo / nclients; + auto nreqs_rem = req_todo % nclients; if (config->is_rate_mode()) { // create timer that will go off every second @@ -1332,6 +1332,12 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } + if (config.is_rate_mode() && 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; + exit(EXIT_FAILURE); + } + if (!datafile.empty()) { config.data_fd = open(datafile.c_str(), O_RDONLY | O_BINARY); if (config.data_fd == -1) { diff --git a/src/h2load.h b/src/h2load.h index 865f2b8f..8e632f8f 100644 --- a/src/h2load.h +++ b/src/h2load.h @@ -184,12 +184,9 @@ struct Worker { size_t progress_interval; uint32_t id; bool tls_info_report_done; - struct ev_loop *rate_loop; ssize_t current_second; ssize_t nconns_made; ssize_t nclients; - ssize_t nreqs_per_client; - ssize_t nreqs_rem; ev_timer timeout_watcher; ssize_t rate;