Commit 528c8dcc authored by Nils Goroll's avatar Nils Goroll

add_backend layering check before weightadjust check

to be consistent with remove_backend
parent c5710755
...@@ -264,14 +264,6 @@ vmod_random_add_backend(VRT_CTX, struct vmod_weightadjust_random *rr, ...@@ -264,14 +264,6 @@ vmod_random_add_backend(VRT_CTX, struct vmod_weightadjust_random *rr,
wa_vcl = rr->extra.wa_vcl; wa_vcl = rr->extra.wa_vcl;
CHECK_OBJ_NOTNULL(wa_vcl, VMOD_WADJ_VCL_MAGIC); CHECK_OBJ_NOTNULL(wa_vcl, VMOD_WADJ_VCL_MAGIC);
if (weight_update == NULL || weight_update[0] == '\0') {
msg(ctx, 0, "vmod weightadjust director %s "
"add_backend(%s) without weight update falls back "
"to standard behaviour",
rr->vd->dir->vcl_name, vcl_be->name);
goto no_weightadjust;
}
if (vcl_be->priv == NULL) { if (vcl_be->priv == NULL) {
ERR(ctx, "can only be used with real backends " ERR(ctx, "can only be used with real backends "
"(no director layering)"); "(no director layering)");
...@@ -280,6 +272,14 @@ vmod_random_add_backend(VRT_CTX, struct vmod_weightadjust_random *rr, ...@@ -280,6 +272,14 @@ vmod_random_add_backend(VRT_CTX, struct vmod_weightadjust_random *rr,
CAST_OBJ_NOTNULL(be, vcl_be->priv, BACKEND_MAGIC); CAST_OBJ_NOTNULL(be, vcl_be->priv, BACKEND_MAGIC);
if (weight_update == NULL || weight_update[0] == '\0') {
msg(ctx, 0, "vmod weightadjust director %s "
"add_backend(%s) without weight update falls back "
"to standard behaviour",
rr->vd->dir->vcl_name, vcl_be->name);
goto no_weightadjust;
}
vdir_rdlock(rr->vd); vdir_rdlock(rr->vd);
nb = rr->vd->n_backend; nb = rr->vd->n_backend;
for (u = 0; u < nb; u++) { for (u = 0; u < nb; u++) {
......
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