From 6f58434d8929034c6c6228e2612d7471946362a9 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 28 Mar 2015 19:00:59 +0900 Subject: [PATCH] nghttpx, h2load: Perform write whenever read succeeds --- src/h2load.cc | 6 ++---- src/shrpx_client_handler.cc | 8 +++----- src/shrpx_http2_session.cc | 11 +++++------ 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/h2load.cc b/src/h2load.cc index 4eb65ebb..07a2888c 100644 --- a/src/h2load.cc +++ b/src/h2load.cc @@ -143,10 +143,8 @@ void readcb(struct ev_loop *loop, ev_io *w, int revents) { client->fail(); return; } - if (ev_is_active(&client->wev)) { - writecb(loop, &client->wev, revents); - // client->disconnect() and client->fail() may be called - } + writecb(loop, &client->wev, revents); + // client->disconnect() and client->fail() may be called } } // namespace diff --git a/src/shrpx_client_handler.cc b/src/shrpx_client_handler.cc index 04702200..c8065bb4 100644 --- a/src/shrpx_client_handler.cc +++ b/src/shrpx_client_handler.cc @@ -81,11 +81,9 @@ void readcb(struct ev_loop *loop, ev_io *w, int revents) { delete handler; return; } - if (ev_is_active(handler->get_wev())) { - if (handler->do_write() != 0) { - delete handler; - return; - } + if (handler->do_write() != 0) { + delete handler; + return; } } } // namespace diff --git a/src/shrpx_http2_session.cc b/src/shrpx_http2_session.cc index 41732f5e..6649eac2 100644 --- a/src/shrpx_http2_session.cc +++ b/src/shrpx_http2_session.cc @@ -116,12 +116,11 @@ void readcb(struct ev_loop *loop, ev_io *w, int revents) { return; } http2session->connection_alive(); - if (ev_is_active(http2session->get_wev())) { - rv = http2session->do_write(); - if (rv != 0) { - http2session->disconnect(http2session->should_hard_fail()); - return; - } + + rv = http2session->do_write(); + if (rv != 0) { + http2session->disconnect(http2session->should_hard_fail()); + return; } } } // namespace