MCPcopy Create free account
hub / github.com/apache/httpd / hc_post_config

Function hc_post_config

modules/proxy/mod_proxy_hcheck.c:1143–1198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1141 return OK;
1142}
1143static int hc_post_config(apr_pool_t *p, apr_pool_t *plog,
1144 apr_pool_t *ptemp, server_rec *main_s)
1145{
1146 apr_status_t rv;
1147 server_rec *s = main_s;
1148
1149 APR_OPTIONAL_FN_TYPE(ap_watchdog_get_instance) *hc_watchdog_get_instance;
1150 APR_OPTIONAL_FN_TYPE(ap_watchdog_register_callback) *hc_watchdog_register_callback;
1151
1152 if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG) {
1153 return OK;
1154 }
1155 hc_watchdog_get_instance = APR_RETRIEVE_OPTIONAL_FN(ap_watchdog_get_instance);
1156 hc_watchdog_register_callback = APR_RETRIEVE_OPTIONAL_FN(ap_watchdog_register_callback);
1157 if (!hc_watchdog_get_instance || !hc_watchdog_register_callback) {
1158 ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s, APLOGNO(03262)
1159 "mod_watchdog is required");
1160 return !OK;
1161 }
1162 rv = hc_watchdog_get_instance(&watchdog,
1163 HCHECK_WATHCHDOG_NAME,
1164 0, 1, p);
1165 if (rv) {
1166 ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, APLOGNO(03263)
1167 "Failed to create watchdog instance (%s)",
1168 HCHECK_WATHCHDOG_NAME);
1169 return !OK;
1170 }
1171 while (s) {
1172 sctx_t *ctx = ap_get_module_config(s->module_config,
1173 &proxy_hcheck_module);
1174
1175 if (s != ctx->s) {
1176 ap_log_error(APLOG_MARK, APLOG_TRACE4, 0, s, APLOGNO(10019)
1177 "Missing unique per-server context: %s (%pp:%pp) (no hchecks)",
1178 s->server_hostname, s, ctx->s);
1179 s = s->next;
1180 continue;
1181 }
1182 rv = hc_watchdog_register_callback(watchdog,
1183 AP_WD_TM_SLICE,
1184 ctx,
1185 hc_watchdog_callback);
1186 if (rv) {
1187 ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, APLOGNO(03264)
1188 "Failed to register watchdog callback (%s)",
1189 HCHECK_WATHCHDOG_NAME);
1190 return !OK;
1191 }
1192 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(03265)
1193 "watchdog callback registered (%s for %s)", HCHECK_WATHCHDOG_NAME, s->server_hostname);
1194 s = s->next;
1195 }
1196
1197 return OK;
1198}
1199
1200static void hc_show_exprs(request_rec *r)

Callers

nothing calls this directly

Calls 3

ap_state_queryFunction · 0.85
ap_get_module_configFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected