From: Bill Stoddard Date: Sun, 7 Jul 2002 16:35:20 +0000 (+0000) Subject: Optimize reading keep-alive requests with APR_INCOMPLETE_READ. In the X-Git-Tag: 2.0.40~306 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8286cb80fd160a4259ddf10c3ea016777d34d083;p=apache Optimize reading keep-alive requests with APR_INCOMPLETE_READ. In the profiling I've done, the read() in apr_read() would always fail with EAGAIN. This will send the thread directly to select to wait for the next request. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95968 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/http_core.c b/modules/http/http_core.c index 8bd0fb7e8d..9bbcdfcfd5 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -274,7 +274,9 @@ static apr_port_t http_port(const request_rec *r) static int ap_process_http_connection(conn_rec *c) { request_rec *r; - + int csd_set = 0; + apr_socket_t *csd = NULL; + /* * Read and process each request found on our connection * until no requests are left or we decide to close. @@ -282,7 +284,7 @@ static int ap_process_http_connection(conn_rec *c) ap_update_child_status(c->sbh, SERVER_BUSY_READ, NULL); while ((r = ap_read_request(c)) != NULL) { - + c->keepalive = AP_CONN_UNKNOWN; /* process the request if it was read without error */ @@ -301,6 +303,12 @@ static int ap_process_http_connection(conn_rec *c) if (ap_graceful_stop_signalled()) break; + /* Go straight to select() to wait for the next request */ + if (!csd_set) { + csd = ap_get_module_config(c->conn_config, &core_module); + csd_set = 1; + } + apr_setsocketopt(csd, APR_INCOMPLETE_READ, 1); } return OK;