diff options
author | Yann Ylavic <ylavic@apache.org> | 2024-05-28 16:10:43 +0200 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2024-05-28 16:10:43 +0200 |
commit | c0a30141cad8ee5541a8c73b4b19f7a6a78f979b (patch) | |
tree | 4fdd4c2dbe9fc63874e6c3ebe7d2b775092c0e9b /modules/http2 | |
parent | Steal an APLONGO for PR 448. (diff) | |
download | apache2-c0a30141cad8ee5541a8c73b4b19f7a6a78f979b.tar.xz apache2-c0a30141cad8ee5541a8c73b4b19f7a6a78f979b.zip |
mpm_event,core: Handle async POLLIN/POLLOUT in CONN_STATE_PROCESS state.
* include/httpd.h:
Rename CONN_STATE_CHECK_REQUEST_LINE_READABLE to CONN_STATE_KEEPALIVE
and CONN_STATE_READ_REQUEST_LINE to CONN_STATE_PROCESS, keeping the
old enums as aliases. Rework comments about each state.
* server/mpm/event/event.c:
Use the new states names.
Let the process_connection hooks return CONN_STATE_PROCESS for mpm_event
to POLLIN or POLLOUT depending on c->cs->sense being CONN_SENSE_WANT_READ
or CONN_SENSE_WANT_WRITE respectively.
Remove (ab)use of CONN_STATE_WRITE_COMPLETION with CONN_SENSE_WANT_READ to
mean poll() for read (and the need for the obscure c->clogging_input_filters
to make it work as expected). This is what CONN_STATE_PROCESS is for now.
Update the comment about the states that can be returned by process_connection
hooks (and their usage).
Use the same queue (process_q renamed from write_completion_q) for polling
connections in both CONN_STATE_PROCESS and CONN_STATE_WRITE_COMPLETION
states since they both use the same (server_rec's) Timeout. This implies
that both states are accounted as "write-completion" in mod_status for now.
* server/mpm/motorz/motorz.c, server/mpm/simple/simple_io.c, modules/http/http_core.c:
Use the new states names (only).
* include/scoreboard.h:
Change comment about process_score->write_completion to note that the
counter refers to CONN_STATE_PROCESS connections returned to the MPM
too.
* modules/http2/h2_c1.c:
Return the c1 connection with the CONN_STATE_PROCESS state rather than
CONN_STATE_WRITE_COMPLETION when waiting for a window update (i.e. ask
the MPM to poll for read directly). This avoids the transition to
CONN_STATE_KEEPALIVE which could kill the connection under high load.
Github: closes #448
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918022 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/http2')
-rw-r--r-- | modules/http2/h2_c1.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/http2/h2_c1.c b/modules/http2/h2_c1.c index 739b1d14d5..0a3e8395ad 100644 --- a/modules/http2/h2_c1.c +++ b/modules/http2/h2_c1.c @@ -152,20 +152,25 @@ apr_status_t h2_c1_run(conn_rec *c) case H2_SESSION_ST_IDLE: case H2_SESSION_ST_BUSY: case H2_SESSION_ST_WAIT: - c->cs->state = CONN_STATE_WRITE_COMPLETION; - if (!keepalive) { + if (keepalive) { + /* flush then keep-alive */ + c->cs->state = CONN_STATE_WRITE_COMPLETION; + } + else { /* let the MPM know that we are not done and want * the Timeout behaviour instead of a KeepAliveTimeout * See PR 63534. */ + c->cs->state = CONN_STATE_PROCESS; c->cs->sense = CONN_SENSE_WANT_READ; } break; + case H2_SESSION_ST_CLEANUP: case H2_SESSION_ST_DONE: default: c->cs->state = CONN_STATE_LINGER; - break; + break; } } |