mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Avoid the overhead of creating and grabbing a uuid for
the balancer nonce if we're never going to use it. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1383490 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1109,6 +1109,8 @@ PROXY_DECLARE(char *) ap_proxy_update_balancer(apr_pool_t *p,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define PROXY_UNSET_NONCE '\n'
|
||||
|
||||
PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
|
||||
proxy_balancer **balancer,
|
||||
proxy_server_conf *conf,
|
||||
@@ -1116,9 +1118,7 @@ PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
|
||||
const char *alias,
|
||||
int do_malloc)
|
||||
{
|
||||
char nonce[APR_UUID_FORMATTED_LENGTH + 1];
|
||||
proxy_balancer_method *lbmethod;
|
||||
apr_uuid_t uuid;
|
||||
proxy_balancer_shared *bshared;
|
||||
char *c, *q, *uri = apr_pstrdup(p, url);
|
||||
const char *sname;
|
||||
@@ -1173,14 +1173,7 @@ PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
|
||||
(*balancer)->hash = bshared->hash;
|
||||
|
||||
bshared->forcerecovery = 1;
|
||||
|
||||
/* Retrieve a UUID and store the nonce for the lifetime of
|
||||
* the process. */
|
||||
apr_uuid_get(&uuid);
|
||||
apr_uuid_format(nonce, &uuid);
|
||||
if (PROXY_STRNCPY(bshared->nonce, nonce) != APR_SUCCESS) {
|
||||
return apr_psprintf(p, "balancer nonce (%s) too long", nonce);
|
||||
}
|
||||
*bshared->nonce = PROXY_UNSET_NONCE; /* impossible valid input */
|
||||
|
||||
(*balancer)->s = bshared;
|
||||
(*balancer)->sconf = conf;
|
||||
@@ -1195,6 +1188,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_share_balancer(proxy_balancer *balancer,
|
||||
proxy_balancer_shared *shm,
|
||||
int i)
|
||||
{
|
||||
apr_status_t rv = APR_SUCCESS;
|
||||
proxy_balancer_method *lbmethod;
|
||||
if (!shm || !balancer->s)
|
||||
return APR_EINVAL;
|
||||
@@ -1208,7 +1202,18 @@ PROXY_DECLARE(apr_status_t) ap_proxy_share_balancer(proxy_balancer *balancer,
|
||||
lbmethod = ap_lookup_provider(PROXY_LBMETHOD, balancer->s->lbpname, "0");
|
||||
if (lbmethod)
|
||||
balancer->lbmethod = lbmethod;
|
||||
return APR_SUCCESS;
|
||||
|
||||
if (*balancer->s->nonce == PROXY_UNSET_NONCE) {
|
||||
char nonce[APR_UUID_FORMATTED_LENGTH + 1];
|
||||
apr_uuid_t uuid;
|
||||
/* Retrieve a UUID and store the nonce for the lifetime of
|
||||
* the process.
|
||||
*/
|
||||
apr_uuid_get(&uuid);
|
||||
apr_uuid_format(nonce, &uuid);
|
||||
rv = PROXY_STRNCPY(balancer->s->nonce, nonce);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
PROXY_DECLARE(apr_status_t) ap_proxy_initialize_balancer(proxy_balancer *balancer, server_rec *s, apr_pool_t *p)
|
||||
|
Reference in New Issue
Block a user