Commit 9c4e8c8d authored by Guillaume Quintard's avatar Guillaume Quintard

Make vdir_remove_backend return void

parent ca42915c
...@@ -123,7 +123,7 @@ vmod_fallback_remove_backend(VRT_CTX, ...@@ -123,7 +123,7 @@ vmod_fallback_remove_backend(VRT_CTX,
{ {
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(fb, VMOD_DIRECTORS_FALLBACK_MAGIC); CHECK_OBJ_NOTNULL(fb, VMOD_DIRECTORS_FALLBACK_MAGIC);
(void)vdir_remove_backend(fb->vd, be); vdir_remove_backend(fb->vd, be);
} }
VCL_BACKEND __match_proto__() VCL_BACKEND __match_proto__()
......
...@@ -91,7 +91,7 @@ vmod_hash_remove_backend(VRT_CTX, ...@@ -91,7 +91,7 @@ vmod_hash_remove_backend(VRT_CTX,
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_HASH_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_HASH_MAGIC);
(void)vdir_remove_backend(rr->vd, be); vdir_remove_backend(rr->vd, be);
} }
VCL_BACKEND __match_proto__() VCL_BACKEND __match_proto__()
......
...@@ -118,7 +118,7 @@ VCL_VOID vmod_random_remove_backend(VRT_CTX, ...@@ -118,7 +118,7 @@ VCL_VOID vmod_random_remove_backend(VRT_CTX,
{ {
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_RANDOM_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_RANDOM_MAGIC);
(void)vdir_remove_backend(rr->vd, be); vdir_remove_backend(rr->vd, be);
} }
VCL_BACKEND __match_proto__() VCL_BACKEND __match_proto__()
......
...@@ -127,7 +127,7 @@ vmod_round_robin_remove_backend(VRT_CTX, ...@@ -127,7 +127,7 @@ vmod_round_robin_remove_backend(VRT_CTX,
{ {
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_ROUND_ROBIN_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_ROUND_ROBIN_MAGIC);
(void)vdir_remove_backend(rr->vd, be); vdir_remove_backend(rr->vd, be);
} }
VCL_BACKEND __match_proto__() VCL_BACKEND __match_proto__()
......
...@@ -133,14 +133,14 @@ vdir_add_backend(struct vdir *vd, VCL_BACKEND be, double weight) ...@@ -133,14 +133,14 @@ vdir_add_backend(struct vdir *vd, VCL_BACKEND be, double weight)
return (u); return (u);
} }
unsigned void
vdir_remove_backend(struct vdir *vd, VCL_BACKEND be) vdir_remove_backend(struct vdir *vd, VCL_BACKEND be)
{ {
unsigned u, n; unsigned u, n;
CHECK_OBJ_NOTNULL(vd, VDIR_MAGIC); CHECK_OBJ_NOTNULL(vd, VDIR_MAGIC);
if (be == NULL) if (be == NULL)
return (vd->n_backend); return;
CHECK_OBJ(be, DIRECTOR_MAGIC); CHECK_OBJ(be, DIRECTOR_MAGIC);
vdir_wrlock(vd); vdir_wrlock(vd);
for (u = 0; u < vd->n_backend; u++) for (u = 0; u < vd->n_backend; u++)
...@@ -148,7 +148,7 @@ vdir_remove_backend(struct vdir *vd, VCL_BACKEND be) ...@@ -148,7 +148,7 @@ vdir_remove_backend(struct vdir *vd, VCL_BACKEND be)
break; break;
if (u == vd->n_backend) { if (u == vd->n_backend) {
vdir_unlock(vd); vdir_unlock(vd);
return (vd->n_backend); return;
} }
vd->total_weight -= vd->weight[u]; vd->total_weight -= vd->weight[u];
n = (vd->n_backend - u) - 1; n = (vd->n_backend - u) - 1;
...@@ -156,7 +156,6 @@ vdir_remove_backend(struct vdir *vd, VCL_BACKEND be) ...@@ -156,7 +156,6 @@ vdir_remove_backend(struct vdir *vd, VCL_BACKEND be)
memmove(&vd->weight[u], &vd->weight[u+1], n * sizeof(vd->weight[0])); memmove(&vd->weight[u], &vd->weight[u+1], n * sizeof(vd->weight[0]));
vd->n_backend--; vd->n_backend--;
vdir_unlock(vd); vdir_unlock(vd);
return (vd->n_backend);
} }
unsigned unsigned
......
...@@ -48,7 +48,7 @@ void vdir_rdlock(struct vdir *vd); ...@@ -48,7 +48,7 @@ void vdir_rdlock(struct vdir *vd);
void vdir_wrlock(struct vdir *vd); void vdir_wrlock(struct vdir *vd);
void vdir_unlock(struct vdir *vd); void vdir_unlock(struct vdir *vd);
unsigned vdir_add_backend(struct vdir *, VCL_BACKEND be, double weight); unsigned vdir_add_backend(struct vdir *, VCL_BACKEND be, double weight);
unsigned vdir_remove_backend(struct vdir *, VCL_BACKEND be); void vdir_remove_backend(struct vdir *, VCL_BACKEND be);
unsigned vdir_any_healthy(struct vdir *, const struct busyobj *, unsigned vdir_any_healthy(struct vdir *, const struct busyobj *,
double *changed); double *changed);
VCL_BACKEND vdir_pick_be(struct vdir *, double w, const struct busyobj *); VCL_BACKEND vdir_pick_be(struct vdir *, double w, const struct busyobj *);
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