ps->badopt_set = 0;
ps->source_address = NULL;
ps->source_address_set = 0;
- ps->pool = p;
-
+ apr_pool_create_ex(&ps->pool, p, NULL, NULL);
+ apr_global_mutex_create(&ps->mutex,
+ "mod_proxy_config_mutex",
+ APR_LOCK_DEFAULT, p);
return ps;
}
ps->proxy_status_set = overrides->proxy_status_set || base->proxy_status_set;
ps->source_address = (overrides->source_address_set == 0) ? base->source_address : overrides->source_address;
ps->source_address_set = overrides->source_address_set || base->source_address_set;
- ps->pool = p;
+ ps->pool = base->pool;
+ ps->mutex = base->mutex;
return ps;
}
static const char *set_source_address(cmd_parms *parms, void *dummy,
(val = apr_table_get(params, "b_nwrkr"))) {
char *ret;
proxy_worker *nworker;
- nworker = ap_proxy_get_worker(conf->pool, bsel, conf, val);
+ nworker = ap_proxy_get_worker(r->pool, bsel, conf, val);
if (!nworker && storage->num_free_slots(bsel->wslot)) {
if ((rv = PROXY_GLOBAL_LOCK(bsel)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01194)
{
apr_status_t rv = APR_SUCCESS;
int mpm_threads;
+ proxy_server_conf *conf = (proxy_server_conf *)ap_get_module_config(s->module_config, &proxy_module);
if (worker->s->status & PROXY_WORKER_INITIALIZED) {
/* The worker is already initialized */
else {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00927)
"initializing worker %s local", worker->s->name);
+ apr_global_mutex_lock(conf->mutex);
/* Now init local worker data */
if (worker->tmutex == NULL) {
rv = apr_thread_mutex_create(&(worker->tmutex), APR_THREAD_MUTEX_DEFAULT, p);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00928)
"can not create worker thread mutex");
+ apr_global_mutex_unlock(conf->mutex);
return rv;
}
}
if (worker->cp == NULL) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00929)
"can not create connection pool");
+ apr_global_mutex_unlock(conf->mutex);
return APR_EGENERAL;
}
"initialized single connection worker in child %" APR_PID_T_FMT " for (%s)",
getpid(), worker->s->hostname);
}
+ apr_global_mutex_unlock(conf->mutex);
+
}
if (rv == APR_SUCCESS) {
worker->s->status |= (PROXY_WORKER_INITIALIZED);
if (!found) {
proxy_worker **runtime;
runtime = apr_array_push(b->workers);
+ apr_global_mutex_lock(conf->mutex);
*runtime = apr_palloc(conf->pool, sizeof(proxy_worker));
+ apr_global_mutex_unlock(conf->mutex);
(*runtime)->hash = shm->hash;
(*runtime)->context = NULL;
(*runtime)->cp = NULL;
(*runtime)->balancer = b;
(*runtime)->s = shm;
(*runtime)->tmutex = NULL;
- if ((rv = ap_proxy_initialize_worker(*runtime, s, conf->pool)) != APR_SUCCESS) {
+ rv = ap_proxy_initialize_worker(*runtime, s, conf->pool);
+ if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, APLOGNO(00966) "Cannot init worker");
return rv;
}