nghttpx, h2load: Perform write whenever read succeeds

This commit is contained in:
Tatsuhiro Tsujikawa 2015-03-28 19:00:59 +09:00
parent 3fd5d0af79
commit 6f58434d89
3 changed files with 10 additions and 15 deletions

View File

@ -143,10 +143,8 @@ void readcb(struct ev_loop *loop, ev_io *w, int revents) {
client->fail(); client->fail();
return; return;
} }
if (ev_is_active(&client->wev)) { writecb(loop, &client->wev, revents);
writecb(loop, &client->wev, revents); // client->disconnect() and client->fail() may be called
// client->disconnect() and client->fail() may be called
}
} }
} // namespace } // namespace

View File

@ -81,11 +81,9 @@ void readcb(struct ev_loop *loop, ev_io *w, int revents) {
delete handler; delete handler;
return; return;
} }
if (ev_is_active(handler->get_wev())) { if (handler->do_write() != 0) {
if (handler->do_write() != 0) { delete handler;
delete handler; return;
return;
}
} }
} }
} // namespace } // namespace

View File

@ -116,12 +116,11 @@ void readcb(struct ev_loop *loop, ev_io *w, int revents) {
return; return;
} }
http2session->connection_alive(); http2session->connection_alive();
if (ev_is_active(http2session->get_wev())) {
rv = http2session->do_write(); rv = http2session->do_write();
if (rv != 0) { if (rv != 0) {
http2session->disconnect(http2session->should_hard_fail()); http2session->disconnect(http2session->should_hard_fail());
return; return;
}
} }
} }
} // namespace } // namespace