From 823a630e809fc46481b3b9b8ce2f262cac084de7 Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Mon, 16 Jul 2018 11:20:26 +0000 Subject: [PATCH] util_filter: Axe conn_rec->empty brigade. Since it's internal util_filter use, we shouldn't expose it in conn_rec and can replace it with a pooled brigade provided by ap_reuse_brigade_from_pool(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1836020 13f79535-47bb-0310-9956-ffa450edef68 --- include/ap_mmn.h | 5 +++-- include/httpd.h | 3 --- server/core.c | 1 - server/util_filter.c | 11 ++++++++--- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/ap_mmn.h b/include/ap_mmn.h index 87d6854161..357c909cb4 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -581,14 +581,15 @@ * conn_rec, and add ring entry 'pending' in struct * ap_filter_t * 20180711.2 (2.5.1-dev) Add ap_reuse_brigade_from_pool() + * 20180716.1 (2.5.1-dev) Axe conn_rec->empty brigade */ #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */ #ifndef MODULE_MAGIC_NUMBER_MAJOR -#define MODULE_MAGIC_NUMBER_MAJOR 20180711 +#define MODULE_MAGIC_NUMBER_MAJOR 20180716 #endif -#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a diff --git a/include/httpd.h b/include/httpd.h index cf84d5fb73..22b1a99ebc 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -1221,9 +1221,6 @@ struct conn_rec { /** Array of requests being handled under this connection. */ apr_array_header_t *requests; - /** Empty bucket brigade */ - apr_bucket_brigade *empty; - /** Ring of pending filters (with setaside buckets) */ struct ap_filter_ring *pending_filters; diff --git a/server/core.c b/server/core.c index 5d2961d8d0..d928ba2263 100644 --- a/server/core.c +++ b/server/core.c @@ -5325,7 +5325,6 @@ static conn_rec *core_create_conn(apr_pool_t *ptrans, server_rec *s, c->id = id; c->bucket_alloc = alloc; - c->empty = apr_brigade_create(c->pool, c->bucket_alloc); c->async_filter = sconf->async_filter; c->clogging_input_filters = 0; diff --git a/server/util_filter.c b/server/util_filter.c index ff36a13553..5474c31da1 100644 --- a/server/util_filter.c +++ b/server/util_filter.c @@ -1002,12 +1002,16 @@ AP_DECLARE(int) ap_filter_should_yield(ap_filter_t *f) AP_DECLARE_NONSTD(int) ap_filter_output_pending(conn_rec *c) { int data_in_output_filters = DECLINED; + apr_bucket_brigade *bb; ap_filter_t *f; if (!c->pending_filters) { return DECLINED; } + bb = ap_reuse_brigade_from_pool("ap_fop_bb", c->pool, + c->bucket_alloc); + for (f = APR_RING_FIRST(c->pending_filters); f != APR_RING_SENTINEL(c->pending_filters, ap_filter_t, pending); f = APR_RING_NEXT(f, pending)) { @@ -1015,9 +1019,10 @@ AP_DECLARE_NONSTD(int) ap_filter_output_pending(conn_rec *c) && !APR_BRIGADE_EMPTY(f->bb)) { apr_status_t rv; - rv = ap_pass_brigade(f, c->empty); - apr_brigade_cleanup(c->empty); - if (rv != APR_SUCCESS && !APR_STATUS_IS_EAGAIN(rv)) { + rv = ap_pass_brigade(f, bb); + apr_brigade_cleanup(bb); + + if (rv != APR_SUCCESS) { ap_log_cerror(APLOG_MARK, APLOG_DEBUG, rv, c, APLOGNO(00470) "write failure in '%s' output filter", f->frec->name); return rv; -- 2.50.1