Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions native/mod_proxy_cluster/mod_proxy_cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -3085,6 +3085,7 @@ static proxy_worker *find_route_worker(request_rec *r,
int sizew = balancer->workers->elt_size;

proxy_worker *worker;
node_context *nodecontext;

checking_standby = checked_standby = 0;
while (!checked_standby) {
Expand Down Expand Up @@ -3118,10 +3119,12 @@ static proxy_worker *find_route_worker(request_rec *r,
nodeinfo_t *node;
if (node_storage->read_node(index, &node) != APR_SUCCESS)
return NULL; /* can't read node */
if (context_host_ok(r, balancer, index, vhost_table, context_table, node_table) != NULL)
return worker;
else
return NULL; /* application has been removed from the node */
if ((nodecontext = context_host_ok(r, balancer, index, vhost_table, context_table, node_table)) != NULL) {
apr_table_setn(r->subprocess_env, "BALANCER_CONTEXT_ID", apr_psprintf(r->pool, "%d", (*nodecontext).context));
return worker;
} else {
return NULL; /* application has been removed from the node */
}
} else {
/*
* If the worker is in error state run
Expand All @@ -3136,7 +3139,16 @@ static proxy_worker *find_route_worker(request_rec *r,
ap_proxy_retry_worker("BALANCER", worker, r->server);
#endif
if (PROXY_WORKER_IS_USABLE(worker)) {
return worker;
/* The context may not be available */
nodeinfo_t *node;
if (node_storage->read_node(index, &node) != APR_SUCCESS)
return NULL; /* can't read node */
if ((nodecontext = context_host_ok(r, balancer, index, vhost_table, context_table, node_table)) != NULL) {
apr_table_setn(r->subprocess_env, "BALANCER_CONTEXT_ID", apr_psprintf(r->pool, "%d", (*nodecontext).context));
return worker;
} else {
return NULL; /* application has been removed from the node */
}
} else {
/*
* We have a worker that is unusable.
Expand Down Expand Up @@ -3165,8 +3177,18 @@ static proxy_worker *find_route_worker(request_rec *r,
ap_proxy_retry_worker("BALANCER", rworker, r->server);
#endif
}
if (rworker && PROXY_WORKER_IS_USABLE(rworker))
return rworker;
if (rworker && PROXY_WORKER_IS_USABLE(rworker)) {
/* The context may not be available */
nodeinfo_t *node;
if (node_storage->read_node(index, &node) != APR_SUCCESS)
return NULL; /* can't read node */
if ((nodecontext = context_host_ok(r, balancer, index, vhost_table, context_table, node_table)) != NULL) {
apr_table_setn(r->subprocess_env, "BALANCER_CONTEXT_ID", apr_psprintf(r->pool, "%d", (*nodecontext).context));
return rworker;
} else {
return NULL; /* application has been removed from the node */
}
}
}
}
}
Expand Down