workerconf->keepalive_set = worker->keepalive_set;
workerconf->flush_packets = worker->flush_packets;
workerconf->flush_wait = worker->flush_wait;
- workerconf->health = 0;
+ workerconf->httpstatus.health = HEALTH_UNKNOWN;
workerconf->used = 1;
return APR_SUCCESS;
}
rv = checkstorage->ap_slotmem_mem(myscore, id, (void *) &workerconf);
if (rv != APR_SUCCESS)
return rv;
- *health = workerconf->health;
+ *health = workerconf->httpstatus.health;
return APR_SUCCESS;
}
/* set the health of the entry: for the health-checker */
rv = checkstorage->ap_slotmem_mem(myscore, id, (void *) &workerconf);
if (rv != APR_SUCCESS)
return rv;
- workerconf->health = value;
+ workerconf->httpstatus.health = value;
workerconf->time_checked = apr_time_now();
return APR_SUCCESS;
}
return APR_SUCCESS;
rv = test_backend(workerconf->scheme, workerconf->hostname, workerconf->port, pool);
if (rv != APR_SUCCESS)
- workerconf->health = HEALTH_NO;
+ workerconf->httpstatus.health = HEALTH_NO;
else
- workerconf->health = HEALTH_OK;
+ workerconf->httpstatus.health = HEALTH_OK;
workerconf->time_checked = apr_time_now();
return rv;
}
return NULL;
}
+static ap_proxy_close_worker(proxy_worker *worker, request_rec *r)
+{
+ /* XXX: Only prefork mpm's ??? */
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
+ "ap_proxy_close_worker: id %d name %s %d", worker->id, worker->name, worker->cp->conn);
+ if (worker->cp->conn) {
+ worker->cp->conn->close = 1;
+ worker->cp->conn->close_on_recycle = 1;
+ ap_proxy_release_connection("Any", worker->cp->conn, r->server);
+ }
+}
/* Find the worker that has the 'route' defined
*/
static proxy_worker *find_route_worker(proxy_balancer *balancer,
int checking_standby = 0;
int checked_standby = 0;
proxy_worker *worker;
- const health_worker_method *worker_storage;
- worker_storage = ap_lookup_provider(PROXY_CKMETHOD, "default", "0");
while (!checked_standby) {
worker = (proxy_worker *)balancer->workers->elts;
for (i = 0; i < balancer->workers->nelts; i++, worker++) {
- if (worker_storage) {
- int health;
- worker_storage->get_health(worker->id, &health);
- if (health != HEALTH_OK)
- continue;
+ if (worker->s->health == HEALTH_NO) {
+ ap_proxy_close_worker(worker, r);
+ continue;
}
if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) )
continue;
proxy_worker *rworker = NULL;
rworker = find_route_worker(balancer, worker->s->redirect, r);
/* Check if the redirect worker is usable */
- if (rworker && worker_storage) {
- int health;
- worker_storage->get_health(worker->id, &health);
- if (health != HEALTH_OK)
+ if (rworker)
+ if (rworker->s->health == HEALTH_NO) {
+ ap_proxy_close_worker(rworker, r);
continue;
- }
+ }
if (rworker && !PROXY_WORKER_IS_USABLE(rworker)) {
/*
* If the worker is in error state run
while (!mycandidate && !checked_standby) {
worker = (proxy_worker *)balancer->workers->elts;
for (i = 0; i < balancer->workers->nelts; i++, worker++) {
+ if (worker->s->health == HEALTH_NO) {
+ ap_proxy_close_worker(worker, r);
+ continue;
+ }
if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) )
continue;
/* If the worker is in error state run
while (!mycandidate && !checked_standby) {
worker = (proxy_worker *)balancer->workers->elts;
for (i = 0; i < balancer->workers->nelts; i++, worker++) {
+ if (worker->s->health == HEALTH_NO) {
+ ap_proxy_close_worker(worker, r);
+ continue;
+ }
if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) )
continue;
/* If the worker is in error state run