proxy_conn_pool *cp; /* Connection pool to use */
proxy_worker_shared *s; /* Shared data */
proxy_balancer *balancer; /* which balancer am I in? */
+ apr_thread_mutex_t *tmutex; /* Thread lock for updating address cache */
void *context; /* general purpose storage */
};
const char *sname; /* filesystem safe balancer name */
apr_time_t wupdated; /* timestamp of last change to workers list */
apr_global_mutex_t *gmutex; /* global lock for updating list of workers */
- apr_thread_mutex_t *tmutex; /* Thread lock for updating address cache and worker selection*/
+ apr_thread_mutex_t *tmutex; /* Thread lock for updating shm */
void *context; /* general purpose storage */
proxy_balancer_shared *s; /* Shared data */
};
(*runtime)->cp = NULL;
(*runtime)->balancer = b;
(*runtime)->s = shm;
+ (*runtime)->tmutex = NULL;
if ((rv = ap_proxy_initialize_worker(*runtime, s, conf->pool)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "Cannot init worker");
return rv;
rv = apr_thread_mutex_create(&(balancer->tmutex), APR_THREAD_MUTEX_DEFAULT, p);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
- "can not create thread mutex");
+ "can not create balancer thread mutex");
return rv;
}
}
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
"initializing worker %s local", worker->s->name);
/* 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_DEBUG, 0, s,
+ "can not create worker thread mutex");
+ return rv;
+ }
+ }
if (worker->cp == NULL)
init_conn_pool(p, worker);
if (worker->cp == NULL) {
conn->pool);
}
else if (!worker->cp->addr) {
- if ((err = PROXY_THREAD_LOCK(worker->balancer)) != APR_SUCCESS) {
+ if ((err = PROXY_THREAD_LOCK(worker)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server,
"proxy: lock");
return HTTP_INTERNAL_SERVER_ERROR;
conn->port, 0,
worker->cp->pool);
conn->addr = worker->cp->addr;
- if ((uerr = PROXY_THREAD_UNLOCK(worker->balancer)) != APR_SUCCESS) {
+ if ((uerr = PROXY_THREAD_UNLOCK(worker)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, uerr, r->server,
"proxy: unlock");
}