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

Function ap_proxy_share_worker

modules/proxy/proxy_util.c:2223–2253  ·  view source on GitHub ↗

* Create an already defined worker and free up memory */

Source from the content-addressed store, hash-verified

2221 * Create an already defined worker and free up memory
2222 */
2223PROXY_DECLARE(apr_status_t) ap_proxy_share_worker(proxy_worker *worker, proxy_worker_shared *shm,
2224 int i)
2225{
2226 char *action = "copying";
2227 if (!shm || !worker->s)
2228 return APR_EINVAL;
2229
2230 if ((worker->s->hash.def != shm->hash.def) ||
2231 (worker->s->hash.fnv != shm->hash.fnv)) {
2232 memcpy(shm, worker->s, sizeof(proxy_worker_shared));
2233 if (worker->s->was_malloced)
2234 free(worker->s); /* was malloced in ap_proxy_define_worker */
2235 } else {
2236 action = "re-using";
2237 }
2238 worker->s = shm;
2239 worker->s->index = i;
2240
2241 if (APLOGdebug(ap_server_conf)) {
2242 apr_pool_t *pool;
2243 apr_pool_create(&pool, ap_server_conf->process->pool);
2244 apr_pool_tag(pool, "proxy_worker_name");
2245 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, APLOGNO(02338)
2246 "%s shm[%d] (0x%pp) for worker: %s", action, i, (void *)shm,
2247 ap_proxy_worker_name(pool, worker));
2248 if (pool) {
2249 apr_pool_destroy(pool);
2250 }
2251 }
2252 return APR_SUCCESS;
2253}
2254
2255PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, server_rec *s, apr_pool_t *p)
2256{

Callers 2

balancer_post_configFunction · 0.85

Calls 2

ap_proxy_worker_nameFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected