1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-05 16:55:50 +03:00

Async write completion for Event MPM

(backported from async-dev branch to 2.3 trunk)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@327945 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brian Pane
2005-10-24 03:33:14 +00:00
parent 158559eacb
commit cb0e5db86f
4 changed files with 114 additions and 56 deletions

View File

@@ -191,47 +191,23 @@ AP_DECLARE(void) ap_die(int type, request_rec *r)
ap_send_error_response(r_1st_err, recursive_error);
}
static void check_pipeline_flush(conn_rec *c)
static void check_pipeline(conn_rec *c)
{
apr_bucket *e;
apr_bucket_brigade *bb;
/* ### if would be nice if we could PEEK without a brigade. that would
### allow us to defer creation of the brigade to when we actually
### need to send a FLUSH. */
bb = apr_brigade_create(c->pool, c->bucket_alloc);
/* Flush the filter contents if:
*
* 1) the connection will be closed
* 2) there isn't a request ready to be read
*/
/* ### is zero correct? that means "read one line" */
if (c->keepalive != AP_CONN_CLOSE) {
apr_bucket_brigade *bb = apr_brigade_create(c->pool, c->bucket_alloc);
if (ap_get_brigade(c->input_filters, bb, AP_MODE_EATCRLF,
APR_NONBLOCK_READ, 0) != APR_SUCCESS) {
c->data_in_input_filters = 0; /* we got APR_EOF or an error */
}
else {
c->data_in_input_filters = 1;
return; /* don't flush */
}
}
e = apr_bucket_flush_create(c->bucket_alloc);
/* We just send directly to the connection based filters. At
* this point, we know that we have seen all of the data
* (request finalization sent an EOS bucket, which empties all
* of the request filters). We just want to flush the buckets
* if something hasn't been sent to the network yet.
*/
APR_BRIGADE_INSERT_HEAD(bb, e);
ap_pass_brigade(c->output_filters, bb);
}
void ap_process_request(request_rec *r)
void ap_process_async_request(request_rec *r)
{
int access_status;
apr_bucket_brigade *bb;
@@ -289,11 +265,30 @@ void ap_process_request(request_rec *r)
*/
c->cs->state = CONN_STATE_WRITE_COMPLETION;
check_pipeline_flush(c);
check_pipeline(c);
if (ap_extended_status)
ap_time_process_request(c->sbh, STOP_PREQUEST);
}
void ap_process_request(request_rec *r)
{
apr_bucket_brigade *bb;
apr_bucket *b;
conn_rec *c = r->connection;
ap_process_async_request(r);
if (!c->data_in_input_filters) {
bb = apr_brigade_create(c->pool, c->bucket_alloc);
b = apr_bucket_flush_create(c->bucket_alloc);
APR_BRIGADE_INSERT_HEAD(bb, b);
ap_pass_brigade(c->output_filters, bb);
}
if (ap_extended_status) {
ap_time_process_request(c->sbh, STOP_PREQUEST);
}
}
static apr_table_t *rename_original_env(apr_pool_t *p, apr_table_t *t)
{
const apr_array_header_t *env_arr = apr_table_elts(t);