diff options
author | Jim Jagielski <jim@apache.org> | 2011-02-07 18:15:04 +0100 |
---|---|---|
committer | Jim Jagielski <jim@apache.org> | 2011-02-07 18:15:04 +0100 |
commit | 68dcb0f78922d3a7d6a4bf7a72b6fcea125c8922 (patch) | |
tree | 54bea92c932723f15573cf7a89f603413c68b494 /modules/proxy | |
parent | Save this for later to be done... recall that .free needs to (diff) | |
download | apache2-68dcb0f78922d3a7d6a4bf7a72b6fcea125c8922.tar.xz apache2-68dcb0f78922d3a7d6a4bf7a72b6fcea125c8922.zip |
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
Diffstat (limited to 'modules/proxy')
-rw-r--r-- | modules/proxy/mod_proxy_balancer.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/modules/proxy/mod_proxy_balancer.c b/modules/proxy/mod_proxy_balancer.c index 5d990bd380..6604093234 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<table border='0' style='text-align: left;'><tr>" "<th>MaxMembers</th><th>StickySession</th><th>DisableFailover</th><th>Timeout</th><th>FailoverAttempts</th><th>Method</th>" "</tr>\n<tr>", r); - ap_rprintf(r, "<td align='center'>%d</td>\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, "<td align='center'>%d [%d Used]</td>\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, "<td align='center'>", 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)</td></tr>\n", r); - 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); + if (storage->num_free_slots(bsel->slot) != 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); + } ap_rputs("<tr><td colspan=2><input type=submit value='Submit'></td></tr>\n", r); ap_rvputs(r, "</table>\n<input type=hidden name='b' id='b' ", NULL); ap_rvputs(r, "value='", bsel->name + sizeof(BALANCER_PREFIX) - 1, |