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

simple, functional interface to add additional balancer lb selection methods

without requiring code changes to mod_proxy/mod_proxy_balancer;
these can be implemented via sub-modules now.

Let the games begin...


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@232282 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jim Jagielski
2005-08-12 12:47:04 +00:00
parent 5d7d8f280f
commit a7d488a6d2
5 changed files with 134 additions and 57 deletions

View File

@@ -1155,6 +1155,8 @@ PROXY_DECLARE(const char *) ap_proxy_add_balancer(proxy_balancer **balancer,
const char *url)
{
char *c, *q, *uri = apr_pstrdup(p, url);
int i;
proxy_balancer_method *lbmethod;
c = strchr(uri, ':');
if (c == NULL || c[1] != '/' || c[2] != '/' || c[3] == '\0')
@@ -1167,8 +1169,20 @@ PROXY_DECLARE(const char *) ap_proxy_add_balancer(proxy_balancer **balancer,
*balancer = apr_array_push(conf->balancers);
memset(*balancer, 0, sizeof(proxy_balancer));
/*
* NOTE: The default method is byrequests, which we assume
* exists!
*/
lbmethod = (proxy_balancer_method *)conf->lbmethods->elts;
for (i = 0; i < conf->lbmethods->nelts; i++) {
if (!strcasecmp(lbmethod->name, "byrequests")) {
break;
}
lbmethod++;
}
(*balancer)->name = uri;
(*balancer)->lbmethod = lbmethod_requests;
(*balancer)->lbmethod = lbmethod;
(*balancer)->workers = apr_array_make(p, 5, sizeof(proxy_worker));
/* XXX Is this a right place to create mutex */
#if APR_HAS_THREADS