From: Jim Jagielski Date: Mon, 27 Apr 2009 15:02:40 +0000 (+0000) Subject: Fold in initial template for methods to be able to X-Git-Tag: 2.3.3~686 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7e145e73125bf8ae2d736a60beaa376629954837;p=thirdparty%2Fapache%2Fhttpd.git Fold in initial template for methods to be able to reset (initialize) and "age" their data, useful when adding new workers, or when workers come back into the fold.... Logic and code to come in a bit :) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@769020 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/balancers/mod_lbmethod_bybusyness.c b/modules/proxy/balancers/mod_lbmethod_bybusyness.c index 5bdeef7e7d4..0e5ebc87a14 100644 --- a/modules/proxy/balancers/mod_lbmethod_bybusyness.c +++ b/modules/proxy/balancers/mod_lbmethod_bybusyness.c @@ -105,10 +105,20 @@ static proxy_worker *find_best_bybusyness(proxy_balancer *balancer, } +static apr_status_t reset(proxy_balancer *balancer, request_rec *r) { + return APR_SUCCESS; +} + +static apr_status_t age(proxy_balancer *balancer, request_rec *r) { + return APR_SUCCESS; +} + static const proxy_balancer_method bybusyness = { "bybusyness", &find_best_bybusyness, + &reset, + &age, NULL }; diff --git a/modules/proxy/balancers/mod_lbmethod_byrequests.c b/modules/proxy/balancers/mod_lbmethod_byrequests.c index f5ff91d0149..fc15db6c089 100644 --- a/modules/proxy/balancers/mod_lbmethod_byrequests.c +++ b/modules/proxy/balancers/mod_lbmethod_byrequests.c @@ -132,6 +132,14 @@ static proxy_worker *find_best_byrequests(proxy_balancer *balancer, return mycandidate; } +static apr_status_t reset(proxy_balancer *balancer, request_rec *r) { + return APR_SUCCESS; +} + +static apr_status_t age(proxy_balancer *balancer, request_rec *r) { + return APR_SUCCESS; +} + /* * How to add additional lbmethods: * 1. Create func which determines "best" candidate worker @@ -142,6 +150,8 @@ static const proxy_balancer_method byrequests = { "byrequests", &find_best_byrequests, + &reset, + &age, NULL }; diff --git a/modules/proxy/balancers/mod_lbmethod_bytraffic.c b/modules/proxy/balancers/mod_lbmethod_bytraffic.c index d1d882bd15d..e2b339a8e89 100644 --- a/modules/proxy/balancers/mod_lbmethod_bytraffic.c +++ b/modules/proxy/balancers/mod_lbmethod_bytraffic.c @@ -105,10 +105,20 @@ static proxy_worker *find_best_bytraffic(proxy_balancer *balancer, return mycandidate; } +static apr_status_t reset(proxy_balancer *balancer, request_rec *r) { + return APR_SUCCESS; +} + +static apr_status_t age(proxy_balancer *balancer, request_rec *r) { + return APR_SUCCESS; +} + static const proxy_balancer_method bytraffic = { "bytraffic", &find_best_bytraffic, + &reset, + &age, NULL }; diff --git a/modules/proxy/balancers/mod_lbmethod_heartbeat.c b/modules/proxy/balancers/mod_lbmethod_heartbeat.c index 571c0e70b49..094e7e53d97 100644 --- a/modules/proxy/balancers/mod_lbmethod_heartbeat.c +++ b/modules/proxy/balancers/mod_lbmethod_heartbeat.c @@ -299,10 +299,20 @@ static proxy_worker *find_best_hb(proxy_balancer *balancer, return mycandidate; } +static apr_status_t reset(proxy_balancer *balancer, request_rec *r) { + return APR_SUCCESS; +} + +static apr_status_t age(proxy_balancer *balancer, request_rec *r) { + return APR_SUCCESS; +} + static const proxy_balancer_method heartbeat = { "heartbeat", &find_best_hb, + &reset, + &age, NULL }; diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h index 70996983d22..9963594178e 100644 --- a/modules/proxy/mod_proxy.h +++ b/modules/proxy/mod_proxy.h @@ -390,6 +390,8 @@ struct proxy_balancer_method { const char *name; /* name of the load balancer method*/ proxy_worker *(*finder)(proxy_balancer *balancer, request_rec *r); + apr_status_t (*reset)(proxy_balancer *balancer, request_rec *r); + apr_status_t (*age)(proxy_balancer *balancer, request_rec *r); void *context; /* general purpose storage */ }; diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 22deafea77a..fd29389cf3b 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -2346,6 +2346,8 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function, worker->hostname); } else { + if (worker->s->retries) { + } worker->s->error_time = 0; worker->s->retries = 0; }