1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

Follow-up to r1891477.

Axe a few lines of code and document a potential optimization

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891591 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Christophe Jaillet
2021-07-16 16:18:44 +00:00
parent f389b86222
commit eb3b8d4526

View File

@@ -3677,17 +3677,15 @@ PROXY_DECLARE(apr_status_t) ap_proxy_sync_balancer(proxy_balancer *b, server_rec
} }
if (!found) { if (!found) {
proxy_worker **runtime; proxy_worker **runtime;
/* XXX: a thread mutex is maybe enough here */
apr_global_mutex_lock(proxy_mutex); apr_global_mutex_lock(proxy_mutex);
runtime = apr_array_push(b->workers); runtime = apr_array_push(b->workers);
*runtime = apr_palloc(conf->pool, sizeof(proxy_worker)); *runtime = apr_pcalloc(conf->pool, sizeof(proxy_worker));
apr_global_mutex_unlock(proxy_mutex); apr_global_mutex_unlock(proxy_mutex);
memset(*runtime, 0, sizeof(proxy_worker));
(*runtime)->hash = shm->hash; (*runtime)->hash = shm->hash;
(*runtime)->balancer = b; (*runtime)->balancer = b;
(*runtime)->s = shm; (*runtime)->s = shm;
#if APR_HAS_THREADS
(*runtime)->tmutex = NULL;
#endif
rv = ap_proxy_initialize_worker(*runtime, s, conf->pool); rv = ap_proxy_initialize_worker(*runtime, s, conf->pool);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, APLOGNO(00966) "Cannot init worker"); ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, APLOGNO(00966) "Cannot init worker");