You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2011/11/25 18:32:45 UTC
svn commit: r1206269 - in /httpd/httpd/branches/2.4.x/modules/proxy:
mod_proxy.h mod_proxy_balancer.c proxy_util.c
Author: jim
Date: Fri Nov 25 17:32:44 2011
New Revision: 1206269
URL: http://svn.apache.org/viewvc?rev=1206269&view=rev
Log:
Merge r1206268 from trunk:
Allow compile time changes of field sizes and be more
"clear" regarding the diff between balancer and worker slots...
Reviewed/backported by: jim
Modified:
httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.h
httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_balancer.c
httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c
Modified: httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.h?rev=1206269&r1=1206268&r2=1206269&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.h Fri Nov 25 17:32:44 2011
@@ -162,7 +162,7 @@ typedef struct {
} proxy_status; /* Status display options */
apr_sockaddr_t *source_address;
apr_global_mutex_t *mutex; /* global lock (needed??) */
- ap_slotmem_instance_t *slot; /* balancers shm data - runtime */
+ ap_slotmem_instance_t *bslot; /* balancers shm data - runtime */
ap_slotmem_provider_t *storage;
unsigned int req_set:1;
@@ -296,13 +296,25 @@ PROXY_WORKER_DISABLED | PROXY_WORKER_STO
#define PROXY_WORKER_DEFAULT_RETRY 60
/* Some max char string sizes, for shm fields */
+#ifndef PROXY_WORKER_MAX_SCHEME_SIZE
#define PROXY_WORKER_MAX_SCHEME_SIZE 16
+#endif
+#ifndef PROXY_WORKER_MAX_ROUTE_SIZE
#define PROXY_WORKER_MAX_ROUTE_SIZE 64
+#endif
+#ifndef PROXY_WORKER_MAX_NAME_SIZE
#define PROXY_WORKER_MAX_NAME_SIZE 96
+#endif
+#ifndef PROXY_WORKER_MAX_HOSTNAME_SIZE
#define PROXY_WORKER_MAX_HOSTNAME_SIZE 64
+#endif
+#ifndef PROXY_BALANCER_MAX_STICKY_SIZE
#define PROXY_BALANCER_MAX_STICKY_SIZE 64
+#endif
+#ifndef PROXY_MAX_PROVIDER_NAME_SIZE
#define PROXY_MAX_PROVIDER_NAME_SIZE 16
+#endif
#define PROXY_STRNCPY(dst, src) apr_cpystrn((dst), (src), sizeof(dst))
@@ -413,7 +425,7 @@ typedef struct {
struct proxy_balancer {
apr_array_header_t *workers; /* initially configured workers */
apr_array_header_t *errstatuses; /* statuses to force members into error */
- ap_slotmem_instance_t *slot; /* worker shm data - runtime */
+ ap_slotmem_instance_t *wslot; /* worker shm data - runtime */
ap_slotmem_provider_t *storage;
int growth; /* number of post-config workers can added */
int max_workers; /* maximum number of allowed workers */
Modified: httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_balancer.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_balancer.c?rev=1206269&r1=1206268&r2=1206269&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_balancer.c (original)
+++ httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_balancer.c Fri Nov 25 17:32:44 2011
@@ -735,7 +735,7 @@ static int balancer_post_config(apr_pool
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "balancer slotmem_create failed");
return !OK;
}
- conf->slot = new;
+ conf->bslot = new;
}
conf->storage = storage;
@@ -767,12 +767,12 @@ static int balancer_post_config(apr_pool
apr_pool_cleanup_null);
/* setup shm for balancers */
- if ((rv = storage->grab(conf->slot, &index)) != APR_SUCCESS) {
+ if ((rv = storage->grab(conf->bslot, &index)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "balancer slotmem_grab failed");
return !OK;
}
- if ((rv = storage->dptr(conf->slot, index, (void *)&bshm)) != APR_SUCCESS) {
+ if ((rv = storage->dptr(conf->bslot, index, (void *)&bshm)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "balancer slotmem_dptr failed");
return !OK;
}
@@ -794,7 +794,7 @@ static int balancer_post_config(apr_pool
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "worker slotmem_create failed");
return !OK;
}
- balancer->slot = new;
+ balancer->wslot = new;
balancer->storage = storage;
/* sync all timestamps */
@@ -806,12 +806,12 @@ static int balancer_post_config(apr_pool
proxy_worker_shared *shm;
worker = *workers;
- if ((rv = storage->grab(balancer->slot, &index)) != APR_SUCCESS) {
+ if ((rv = storage->grab(balancer->wslot, &index)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "worker slotmem_grab failed");
return !OK;
}
- if ((rv = storage->dptr(balancer->slot, index, (void *)&shm)) != APR_SUCCESS) {
+ if ((rv = storage->dptr(balancer->wslot, index, (void *)&shm)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "worker slotmem_dptr failed");
return !OK;
}
@@ -1084,7 +1084,7 @@ static int balancer_handler(request_rec
char *ret;
proxy_worker *nworker;
nworker = ap_proxy_get_worker(conf->pool, bsel, conf, val);
- if (!nworker && storage->num_free_slots(bsel->slot)) {
+ 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,
"%s: Lock failed for adding worker",
@@ -1095,7 +1095,7 @@ static int balancer_handler(request_rec
unsigned int index;
proxy_worker_shared *shm;
PROXY_COPY_CONF_PARAMS(nworker, conf);
- if ((rv = storage->grab(bsel->slot, &index)) != APR_SUCCESS) {
+ if ((rv = storage->grab(bsel->wslot, &index)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_EMERG, rv, r,
"worker slotmem_grab failed");
if ((rv = PROXY_GLOBAL_UNLOCK(bsel)) != APR_SUCCESS) {
@@ -1105,7 +1105,7 @@ static int balancer_handler(request_rec
}
return HTTP_BAD_REQUEST;
}
- if ((rv = storage->dptr(bsel->slot, index, (void *)&shm)) != APR_SUCCESS) {
+ if ((rv = storage->dptr(bsel->wslot, index, (void *)&shm)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_EMERG, rv, r,
"worker slotmem_dptr failed");
if ((rv = PROXY_GLOBAL_UNLOCK(bsel)) != APR_SUCCESS) {
@@ -1209,7 +1209,7 @@ static int balancer_handler(request_rec
/* the below is a safe cast, since the number of slots total will
* never be more than max_workers, which is restricted to int */
ap_rprintf(r, "<td align='center'>%d [%d Used]</td>\n", balancer->max_workers,
- balancer->max_workers - (int)storage->num_free_slots(balancer->slot));
+ balancer->max_workers - (int)storage->num_free_slots(balancer->wslot));
if (*balancer->s->sticky) {
if (strcmp(balancer->s->sticky, balancer->s->sticky_path)) {
ap_rvputs(r, "<td align='center'>", balancer->s->sticky, " | ",
@@ -1340,7 +1340,7 @@ static int balancer_handler(request_rec
ap_rvputs(r, "value ='", bsel->s->sticky, NULL);
}
ap_rputs("'> (Use '-' to delete)</td></tr>\n", r);
- if (storage->num_free_slots(bsel->slot) != 0) {
+ if (storage->num_free_slots(bsel->wslot) != 0) {
ap_rputs("<tr><td>Add New Worker:</td><td><input name='b_nwrkr' id='b_nwrkr' size=32 type=text>"
" Are you sure? <input name='b_wyes' id='b_wyes' type=checkbox value='1'>"
"</td></tr>", r);
@@ -1373,8 +1373,8 @@ static void balancer_child_init(apr_pool
if (conf->balancers->nelts) {
apr_size_t size;
unsigned int num;
- storage->attach(&(conf->slot), conf->id, &size, &num, p);
- if (!conf->slot) {
+ storage->attach(&(conf->bslot), conf->id, &size, &num, p);
+ if (!conf->bslot) {
ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "slotmem_attach failed");
exit(1); /* Ugly, but what else? */
}
Modified: httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c?rev=1206269&r1=1206268&r2=1206269&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c Fri Nov 25 17:32:44 2011
@@ -1422,8 +1422,8 @@ PROXY_DECLARE(apr_status_t) ap_proxy_ini
}
/* now attach */
- storage->attach(&(balancer->slot), balancer->sname, &size, &num, p);
- if (!balancer->slot) {
+ storage->attach(&(balancer->wslot), balancer->sname, &size, &num, p);
+ if (!balancer->wslot) {
ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s, "slotmem_attach failed");
return APR_EGENERAL;
}
@@ -2917,7 +2917,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_syn
for (index = 0; index < b->max_workers; index++) {
int found;
apr_status_t rv;
- if ((rv = storage->dptr(b->slot, (unsigned int)index, (void *)&shm)) != APR_SUCCESS) {
+ if ((rv = storage->dptr(b->wslot, (unsigned int)index, (void *)&shm)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "worker slotmem_dptr failed");
return APR_EGENERAL;
}