Commit fdd871ad authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Rename and argument switcheroo cleanup



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5567 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent ecf02047
......@@ -526,8 +526,8 @@ extern pthread_t VCA_thread;
void VBE_UseHealth(const struct director *vdi);
struct vbc *VDI_GetFd(const struct director *, struct sess *sp);
int VDI_Healthy(double now, const struct director *, uintptr_t target);
int VDI_Healthy_sp(const struct sess *sp, const struct director *);
int VDI_Healthy_x(double now, const struct director *, uintptr_t target);
int VDI_Healthy(const struct director *, const struct sess *sp);
void VDI_CloseFd(struct sess *sp);
void VDI_RecycleFd(struct sess *sp);
void VDI_AddHostHeader(const struct sess *sp);
......
......@@ -111,7 +111,7 @@ VDI_GetFd(const struct director *d, struct sess *sp)
*/
int
VDI_Healthy_sp(const struct sess *sp, const struct director *d)
VDI_Healthy(const struct director *d, const struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
......@@ -120,7 +120,7 @@ VDI_Healthy_sp(const struct sess *sp, const struct director *d)
}
int
VDI_Healthy(double now, const struct director *d, uintptr_t target)
VDI_Healthy_x(double now, const struct director *d, uintptr_t target)
{
CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
......
......@@ -157,7 +157,7 @@ vdi_dns_pick_host(const struct sess *sp, struct vdi_dns_hostgroup *group) {
current = i + initial - nhosts;
else
current = i + initial;
if (VDI_Healthy_sp(sp, group->hosts[current])) {
if (VDI_Healthy(group->hosts[current], sp)) {
group->next_host = current+1;
return (group->hosts[current]);
}
......@@ -390,7 +390,7 @@ vdi_dns_getfd(const struct director *director, struct sess *sp)
CAST_OBJ_NOTNULL(vs, director->priv, VDI_DNS_MAGIC);
dir = vdi_dns_find_backend(sp, vs);
if (!dir || !VDI_Healthy_sp(sp, dir))
if (!dir || !VDI_Healthy(dir, sp))
return (NULL);
vbe = VDI_GetFd(dir, sp);
......
......@@ -138,7 +138,7 @@ vdi_random_getfd(const struct director *d, struct sess *sp)
if (r >= s1)
continue;
d2 = vs->hosts[i].backend;
if (!VDI_Healthy_sp(sp, d2))
if (!VDI_Healthy(d2, sp))
break;
vbe = VDI_GetFd(d2, sp);
if (vbe != NULL)
......@@ -153,7 +153,7 @@ vdi_random_getfd(const struct director *d, struct sess *sp)
for (i = 0; i < vs->nhosts; i++) {
d2 = vs->hosts[i].backend;
/* XXX: cache result of healty to avoid double work */
if (VDI_Healthy_sp(sp, d2))
if (VDI_Healthy(d2, sp))
s1 += vs->hosts[i].weight;
}
......@@ -172,7 +172,7 @@ vdi_random_getfd(const struct director *d, struct sess *sp)
s1 = 0.0;
for (i = 0; i < vs->nhosts; i++) {
d2 = vs->hosts[i].backend;
if (!VDI_Healthy_sp(sp, d2))
if (!VDI_Healthy(d2, sp))
continue;
s1 += vs->hosts[i].weight;
if (r >= s1)
......@@ -197,7 +197,7 @@ vdi_random_healthy(double now, const struct director *d, uintptr_t target)
CAST_OBJ_NOTNULL(vs, d->priv, VDI_RANDOM_MAGIC);
for (i = 0; i < vs->nhosts; i++) {
if (VDI_Healthy(now, vs->hosts[i].backend, target))
if (VDI_Healthy_x(now, vs->hosts[i].backend, target))
return 1;
}
return 0;
......
......@@ -74,7 +74,7 @@ vdi_round_robin_getfd(const struct director *d, struct sess *sp)
for (i = 0; i < vs->nhosts; i++) {
backend = vs->hosts[vs->next_host].backend;
vs->next_host = (vs->next_host + 1) % vs->nhosts;
if (!VDI_Healthy_sp(sp, backend))
if (!VDI_Healthy(backend, sp))
continue;
vbe = VDI_GetFd(backend, sp);
if (vbe != NULL)
......@@ -96,7 +96,7 @@ vdi_round_robin_healthy(double now, const struct director *d, uintptr_t target)
for (i = 0; i < vs->nhosts; i++) {
backend = vs->hosts[i].backend;
if (VDI_Healthy(now, backend, target))
if (VDI_Healthy_x(now, backend, target))
return 1;
}
return 0;
......
......@@ -393,7 +393,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
if (oc == NULL /* We found no live object */
&& grace_oc != NULL /* There is a grace candidate */
&& (busy_oc != NULL /* Somebody else is already busy */
|| !VDI_Healthy(sp->t_req, sp->director, (uintptr_t)oh))) {
|| !VDI_Healthy_x(sp->t_req, sp->director, (uintptr_t)oh))) {
/* Or it is impossible to fetch */
o = oc_getobj(sp->wrk, grace_oc);
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
......
......@@ -559,6 +559,6 @@ VRT_r_req_backend_healthy(const struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC);
return (VDI_Healthy_sp(sp, sp->director));
return (VDI_Healthy(sp->director, sp));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment