Commit 210d4dd5 authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Defensive

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1785871 13f79535-47bb-0310-9956-ffa450edef68
parent dd92fe64
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
10019
10020
+13 −4
Original line number Diff line number Diff line
@@ -981,11 +981,13 @@ static int hc_post_config(apr_pool_t *p, apr_pool_t *plog,
                       apr_pool_t *ptemp, server_rec *s)
{
    apr_status_t rv;
    sctx_t *ctx;

    APR_OPTIONAL_FN_TYPE(ap_watchdog_get_instance) *hc_watchdog_get_instance;
    APR_OPTIONAL_FN_TYPE(ap_watchdog_register_callback) *hc_watchdog_register_callback;

    if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG) {
        return OK;
    }
    hc_watchdog_get_instance = APR_RETRIEVE_OPTIONAL_FN(ap_watchdog_get_instance);
    hc_watchdog_register_callback = APR_RETRIEVE_OPTIONAL_FN(ap_watchdog_register_callback);
    if (!hc_watchdog_get_instance || !hc_watchdog_register_callback) {
@@ -1003,9 +1005,16 @@ static int hc_post_config(apr_pool_t *p, apr_pool_t *plog,
        return !OK;
    }
    while (s) {
        ctx = (sctx_t *) ap_get_module_config(s->module_config,
        sctx_t *ctx = ap_get_module_config(s->module_config,
                                           &proxy_hcheck_module);

        if (s != ctx->s) {
            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(10019)
                         "We somehow have a context/server mismatch (%pp:%pp)",
                         s, ctx->s);
            s = s->next;
            continue;
        }
        rv = hc_watchdog_register_callback(watchdog,
                apr_time_from_sec(HCHECK_WATHCHDOG_INTERVAL),
                ctx,