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

Function ap_proxy_initialize_worker

modules/proxy/proxy_util.c:2255–2403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2253}
2254
2255PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, server_rec *s, apr_pool_t *p)
2256{
2257 APR_OPTIONAL_FN_TYPE(http2_get_num_workers) *get_h2_num_workers;
2258 apr_status_t rv = APR_SUCCESS;
2259 int max_threads, minw, maxw;
2260
2261 if (worker->s->status & PROXY_WORKER_INITIALIZED) {
2262 /* The worker is already initialized */
2263 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00924)
2264 "worker %s shared already initialized",
2265 ap_proxy_worker_name(p, worker));
2266 }
2267 else {
2268 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00925)
2269 "initializing worker %s shared",
2270 ap_proxy_worker_name(p, worker));
2271 /* Set default parameters */
2272 if (!worker->s->retry_set) {
2273 worker->s->retry = apr_time_from_sec(PROXY_WORKER_DEFAULT_RETRY);
2274 }
2275 /* Consistently set address and connection reusabilty: when reuse
2276 * is disabled by configuration, or when the address is known already
2277 * to not be reusable for this worker (in any case, thus ignore/force
2278 * DisableReuse).
2279 */
2280 if (!worker->s->address_ttl || (!worker->s->address_ttl_set
2281 && worker->s->disablereuse)) {
2282 worker->s->is_address_reusable = 0;
2283 }
2284 if (!worker->s->is_address_reusable && !worker->s->disablereuse) {
2285 /* Explicit enablereuse=on can't work in this case, warn user. */
2286 if (worker->s->disablereuse_set) {
2287 ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, APLOGNO(10400)
2288 "enablereuse/disablereuse ignored for worker %s",
2289 ap_proxy_worker_name(p, worker));
2290 }
2291 worker->s->disablereuse = 1;
2292 }
2293
2294 /*
2295 * When mod_http2 is loaded we might have more threads since it has
2296 * its own pool of processing threads.
2297 */
2298 ap_mpm_query(AP_MPMQ_MAX_THREADS, &max_threads);
2299 get_h2_num_workers = APR_RETRIEVE_OPTIONAL_FN(http2_get_num_workers);
2300 if (get_h2_num_workers) {
2301 get_h2_num_workers(s, &minw, &maxw);
2302 /* So now the max is:
2303 * max_threads-1 threads for HTTP/1 each requiring one connection
2304 * + one thread for HTTP/2 requiring maxw connections
2305 */
2306 max_threads = max_threads - 1 + maxw;
2307 }
2308 if (max_threads > 1) {
2309 /* Default hmax is max_threads to scale with the load and never
2310 * wait for an idle connection to proceed.
2311 */
2312 if (worker->s->hmax == 0) {

Callers 8

mod_proxy.hFile · 0.85
proxy_handlerFunction · 0.85
child_initFunction · 0.85
init_balancer_membersFunction · 0.85
hc_get_hcworkerFunction · 0.85
hc_init_batonFunction · 0.85
ap_proxy_sync_balancerFunction · 0.85

Calls 5

ap_proxy_worker_nameFunction · 0.85
ap_mpm_queryFunction · 0.85
init_conn_poolFunction · 0.85
connection_constructorFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected