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

Function child_init

modules/proxy/mod_proxy.c:3252–3328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3250}
3251
3252static void child_init(apr_pool_t *p, server_rec *s)
3253{
3254 proxy_worker *reverse = NULL;
3255
3256 apr_status_t rv = apr_global_mutex_child_init(&proxy_mutex,
3257 apr_global_mutex_lockfile(proxy_mutex),
3258 p);
3259 if (rv != APR_SUCCESS) {
3260 ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, APLOGNO(02479)
3261 "could not init proxy_mutex in child");
3262 exit(1); /* Ugly, but what else? */
3263 }
3264
3265 /* TODO */
3266 while (s) {
3267 void *sconf = s->module_config;
3268 proxy_server_conf *conf;
3269 proxy_worker *worker;
3270 int i;
3271
3272 conf = (proxy_server_conf *)ap_get_module_config(sconf, &proxy_module);
3273 /*
3274 * NOTE: non-balancer members don't use shm at all...
3275 * after all, why should they?
3276 */
3277 worker = (proxy_worker *)conf->workers->elts;
3278 for (i = 0; i < conf->workers->nelts; i++, worker++) {
3279 ap_proxy_initialize_worker(worker, s, p);
3280 }
3281 /* Create and initialize forward worker if defined */
3282 if (conf->req_set && conf->req) {
3283 proxy_worker *forward;
3284 ap_proxy_define_worker(conf->pool, &forward, NULL, NULL,
3285 "http://www.apache.org", 0);
3286 conf->forward = forward;
3287 PROXY_STRNCPY(conf->forward->s->name, "proxy:forward");
3288 PROXY_STRNCPY(conf->forward->s->name_ex, "proxy:forward");
3289 PROXY_STRNCPY(conf->forward->s->hostname, "*"); /* for compatibility */
3290 PROXY_STRNCPY(conf->forward->s->hostname_ex, "*");
3291 PROXY_STRNCPY(conf->forward->s->scheme, "*");
3292 conf->forward->hash.def = conf->forward->s->hash.def =
3293 ap_proxy_hashfunc(conf->forward->s->name_ex, PROXY_HASHFUNC_DEFAULT);
3294 conf->forward->hash.fnv = conf->forward->s->hash.fnv =
3295 ap_proxy_hashfunc(conf->forward->s->name_ex, PROXY_HASHFUNC_FNV);
3296 /* Do not disable worker in case of errors */
3297 conf->forward->s->status |= PROXY_WORKER_IGNORE_ERRORS;
3298 /* Mark as the "generic" worker */
3299 conf->forward->s->status |= PROXY_WORKER_GENERIC;
3300 ap_proxy_initialize_worker(conf->forward, s, p);
3301 /* Disable address cache for generic forward worker */
3302 conf->forward->s->is_address_reusable = 0;
3303 }
3304 if (!reverse) {
3305 ap_proxy_define_worker(conf->pool, &reverse, NULL, NULL,
3306 "http://www.apache.org", 0);
3307 PROXY_STRNCPY(reverse->s->name, "proxy:reverse");
3308 PROXY_STRNCPY(reverse->s->name_ex, "proxy:reverse");
3309 PROXY_STRNCPY(reverse->s->hostname, "*"); /* for compatibility */

Callers

nothing calls this directly

Calls 5

ap_get_module_configFunction · 0.85
ap_proxy_define_workerFunction · 0.85
ap_proxy_hashfuncFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected