From: Jim Jagielski Date: Mon, 7 Feb 2011 17:15:04 +0000 (+0000) Subject: Keep track of how many workers we've used so far... no need X-Git-Tag: 2.3.11~94 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=68dcb0f78922d3a7d6a4bf7a72b6fcea125c8922;p=thirdparty%2Fapache%2Fhttpd.git Keep track of how many workers we've used so far... no need to provide field to add another if no slots exist. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1068020 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/mod_proxy_balancer.c b/modules/proxy/mod_proxy_balancer.c index 5d990bd3809..6604093234c 100644 --- a/modules/proxy/mod_proxy_balancer.c +++ b/modules/proxy/mod_proxy_balancer.c @@ -1028,7 +1028,7 @@ static int balancer_handler(request_rec *r) proxy_worker *nworker; apr_status_t rv; nworker = ap_proxy_get_worker(conf->pool, bsel, conf, val); - if (!nworker) { + if (!nworker && storage->num_free_slots(bsel->slot)) { if ((rv = PROXY_GLOBAL_LOCK(bsel)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: BALANCER: (%s). Lock failed for adding worker", @@ -1143,7 +1143,10 @@ static int balancer_handler(request_rec *r) ap_rputs("\n\n" "" "\n", r); - ap_rprintf(r, "\n", balancer->max_workers); + /* 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, "\n", balancer->max_workers, + balancer->max_workers - (int)storage->num_free_slots(balancer->slot)); if (*balancer->s->sticky) { if (strcmp(balancer->s->sticky, balancer->s->sticky_path)) { ap_rvputs(r, "\n", r); - ap_rputs("", r); + if (storage->num_free_slots(bsel->slot) != 0) { + ap_rputs("", r); + } ap_rputs("\n", r); ap_rvputs(r, "
MaxMembersStickySessionDisableFailoverTimeoutFailoverAttemptsMethod
%d%d [%d Used]", balancer->s->sticky, " | ", @@ -1271,9 +1274,11 @@ static int balancer_handler(request_rec *r) ap_rvputs(r, "value ='", bsel->s->sticky, NULL); } ap_rputs("'>    (Use '-' to delete)
Add New Worker:" - "    Are you sure? " - "
Add New Worker:" + "    Are you sure? " + "
\n