Fix bug that timing script stalls with -m1

This commit is contained in:
Tatsuhiro Tsujikawa 2017-08-23 20:10:23 +09:00
parent 09c468a4b4
commit a6a561af47
1 changed files with 14 additions and 6 deletions

View File

@ -309,8 +309,7 @@ void conn_timeout_cb(EV_P_ ev_timer *w, int revents) {
namespace { namespace {
bool check_stop_client_request_timeout(Client *client, ev_timer *w) { bool check_stop_client_request_timeout(Client *client, ev_timer *w) {
if (client->req_left == 0 || if (client->req_left == 0) {
client->streams.size() >= client->session->max_concurrent_streams()) {
// no more requests to make, stop timer // no more requests to make, stop timer
ev_timer_stop(client->worker->loop, w); ev_timer_stop(client->worker->loop, w);
return true; return true;
@ -324,6 +323,11 @@ namespace {
void client_request_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) { void client_request_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) {
auto client = static_cast<Client *>(w->data); auto client = static_cast<Client *>(w->data);
if (client->streams.size() >= (size_t)config.max_concurrent_streams) {
ev_timer_stop(client->worker->loop, w);
return;
}
if (client->submit_request() != 0) { if (client->submit_request() != 0) {
ev_timer_stop(client->worker->loop, w); ev_timer_stop(client->worker->loop, w);
client->process_request_failure(); client->process_request_failure();
@ -833,10 +837,14 @@ void Client::on_stream_close(int32_t stream_id, bool success, bool final) {
return; return;
} }
if (!config.timing_script && !final && req_left > 0 && if (!final && req_left > 0) {
submit_request() != 0) { if (config.timing_script) {
if (!ev_is_active(&request_timeout_watcher)) {
ev_feed_event(worker->loop, &request_timeout_watcher, EV_TIMER);
}
} else if (submit_request() != 0) {
process_request_failure(); process_request_failure();
return; }
} }
} }