git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: svn commit: r1832609 - in /httpd/httpd/branches/2.4.x: ./ docs/manual/howto/ docs/manual/mod/ modules/proxy/ modules/proxy/balancers/


On Fri, Jul 20, 2018 at 12:13 PM, Ruediger Pluem <rpluem@xxxxxxxxxx> wrote:
>
> Something like the attached? The mod_lbmethod_byrequests.c part needs to be done for lb modules though.

+/* post_config hook: */
+static int lbmethod_byrequests_post_config(apr_pool_t *pconf, apr_pool_t *plog,
+        apr_pool_t *ptemp, server_rec *s)
+{
+
+    /* lbmethod_byrequests_post_config() will be called twice during
startup.  So, don't
+     * set up the static data the 1st time through. */
+    if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG) {
+        return OK;
+    }
+
+    if (!ap_proxy_balancer_get_best_worker_fn) {

Shouldn't we remove this check to retrieve the function pointer unconditionally?
With static linking the pointer may not be NULL but still point to
garbage (mod_lbmethod_byrequests linked statically but mod_proxy
linked dynamically, if that's ever possible). APR_RETRIEVE_OPTIONAL_FN
is cheap anyway.

+        ap_proxy_balancer_get_best_worker_fn =
+                APR_RETRIEVE_OPTIONAL_FN(ap_proxy_balancer_get_best_worker);
+        if (!ap_proxy_balancer_get_best_worker_fn) {
+            ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO()
+                         "mod_proxy must be loaded for
mod_lbmethod_byrequests");
+            return !OK;
+        }
+    }
+
+    return OK;
+}

Otherwise, the patch looks good to me, thanks!

Regards,
Yann.



( ! ) Warning: include(msgfooter.php): failed to open stream: No such file or directory in /var/www/git/apache2-developers/msg04339.html on line 110
Call Stack
#TimeMemoryFunctionLocation
10.0006364664{main}( ).../msg04339.html:0

( ! ) Warning: include(): Failed opening 'msgfooter.php' for inclusion (include_path='.:/var/www/git') in /var/www/git/apache2-developers/msg04339.html on line 110
Call Stack
#TimeMemoryFunctionLocation
10.0006364664{main}( ).../msg04339.html:0