From cf85d9f6e6fb68f7ca6cfd59b8fa4c6245e682bd Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Wed, 8 Mar 2017 16:31:05 +0000 Subject: [PATCH] final tune and preventative coding git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1786009 13f79535-47bb-0310-9956-ffa450edef68 --- modules/proxy/mod_proxy_hcheck.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/proxy/mod_proxy_hcheck.c b/modules/proxy/mod_proxy_hcheck.c index af31d90975..959a9215c0 100644 --- a/modules/proxy/mod_proxy_hcheck.c +++ b/modules/proxy/mod_proxy_hcheck.c @@ -78,19 +78,17 @@ typedef struct { static void *hc_create_config(apr_pool_t *p, server_rec *s) { - sctx_t *ctx = (sctx_t *) apr_palloc(p, sizeof(sctx_t)); + sctx_t *ctx = apr_pcalloc(p, sizeof(sctx_t)); + ctx->s = s; apr_pool_create(&ctx->p, p); ctx->ba = apr_bucket_alloc_create(p); ctx->templates = apr_array_make(p, 10, sizeof(hc_template_t)); ctx->conditions = apr_table_make(p, 10); ctx->hcworkers = apr_hash_make(p); - ctx->s = s; - return ctx; } static ap_watchdog_t *watchdog; -static apr_thread_pool_t *hctp = NULL; static int tpsize = HC_THREADPOOL_SIZE; /* @@ -872,6 +870,8 @@ static apr_status_t hc_watchdog_callback(int state, void *data, sctx_t *ctx = (sctx_t *)data; server_rec *s = ctx->s; proxy_server_conf *conf; + static apr_thread_pool_t *hctp = NULL; + switch (state) { case AP_WATCHDOG_STATE_STARTING: ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(03258) @@ -978,9 +978,10 @@ static apr_status_t hc_watchdog_callback(int state, void *data, } static int hc_post_config(apr_pool_t *p, apr_pool_t *plog, - apr_pool_t *ptemp, server_rec *s) + apr_pool_t *ptemp, server_rec *main_s) { apr_status_t rv; + server_rec *s = main_s; APR_OPTIONAL_FN_TYPE(ap_watchdog_get_instance) *hc_watchdog_get_instance; APR_OPTIONAL_FN_TYPE(ap_watchdog_register_callback) *hc_watchdog_register_callback; @@ -1009,9 +1010,9 @@ static int hc_post_config(apr_pool_t *p, apr_pool_t *plog, &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); + ap_log_error(APLOG_MARK, APLOG_TRACE4, 0, s, APLOGNO(10019) + "Missing unique per-server context: %s (%pp:%pp) (no hchecks)", + s->server_hostname, s, ctx->s); s = s->next; continue; } @@ -1026,7 +1027,7 @@ static int hc_post_config(apr_pool_t *p, apr_pool_t *plog, return !OK; } ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(03265) - "watchdog callback registered (%s)", HCHECK_WATHCHDOG_NAME); + "watchdog callback registered (%s for %s)", HCHECK_WATHCHDOG_NAME, s->server_hostname); s = s->next; } return OK; -- 2.40.0