]> granicus.if.org Git - apache/commitdiff
mod_proxy: follow up to r1822849 and r1822878.
authorYann Ylavic <ylavic@apache.org>
Thu, 1 Feb 2018 15:01:40 +0000 (15:01 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 1 Feb 2018 15:01:40 +0000 (15:01 +0000)
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

index 0684eb24bd2b4a776adc440f749c98edbb5f85ee..4388ae990f23a2f26f408d3c6b31a1323552c916 100644 (file)
@@ -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;