From 1a3e292e1d4dc8295f7832ce3995c32826adca8d Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Thu, 1 Feb 2018 15:01:40 +0000 Subject: [PATCH] mod_proxy: follow up to r1822849 and r1822878. Does r1822878's "static" APR_RETRIEVE_OPTIONAL_FN work if, say, mod_proxy is builtin but mod_http2 isn't? Not worth taking the risk here since it's not a fast path... Note: if this is an issue, I'm afraid it applies elsewhere too. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1822879 13f79535-47bb-0310-9956-ffa450edef68 --- modules/proxy/proxy_util.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 0684eb24bd..4388ae990f 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -1816,17 +1816,10 @@ PROXY_DECLARE(apr_status_t) ap_proxy_share_worker(proxy_worker *worker, proxy_wo PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, server_rec *s, apr_pool_t *p) { - static int have_get_h2_num_workers = 0; - static APR_OPTIONAL_FN_TYPE(http2_get_num_workers) - *get_h2_num_workers = NULL; + APR_OPTIONAL_FN_TYPE(http2_get_num_workers) *get_h2_num_workers; apr_status_t rv = APR_SUCCESS; int max_threads, minw, maxw; - if (get_h2_num_workers == NULL) { - get_h2_num_workers = APR_RETRIEVE_OPTIONAL_FN(http2_get_num_workers); - have_get_h2_num_workers = (get_h2_num_workers != NULL); - } - if (worker->s->status & PROXY_WORKER_INITIALIZED) { /* The worker is already initialized */ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00924) @@ -1854,7 +1847,8 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser * since it has it's own pool of processing threads. */ ap_mpm_query(AP_MPMQ_MAX_THREADS, &max_threads); - if (have_get_h2_num_workers) { + get_h2_num_workers = APR_RETRIEVE_OPTIONAL_FN(http2_get_num_workers); + if (get_h2_num_workers) { get_h2_num_workers(s, &minw, &maxw); if (max_threads < maxw) { max_threads = maxw; -- 2.50.1