Diffentiate "no backend" from "none resolved" in VDI_Resolve()

recover a minor improvement from #2680:

This commit is to emit slightly different error messages to
differentiate between the cases "no backend set in vcl" and
"none returned from the director".

Includes minor polishing

Ref #2860 #3311
parent 30d149fd
......@@ -103,24 +103,26 @@ VRT_VDI_Resolve(VRT_CTX, VCL_BACKEND d)
static VCL_BACKEND
VDI_Resolve(VRT_CTX)
{
const struct director *d;
VCL_BACKEND d;
struct busyobj *bo;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
bo = ctx->bo;
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CHECK_OBJ_ORNULL(bo->director_req, DIRECTOR_MAGIC);
d = VRT_VDI_Resolve(ctx, bo->director_req);
CHECK_OBJ_ORNULL(d, DIRECTOR_MAGIC);
if (d == NULL) {
VSLb(bo->vsl, SLT_FetchError, "No backend");
} else {
AN(d->vdir);
if (d->vdir->admin_health->health == 0)
d = NULL;
if (bo->director_req == NULL) {
VSLb(bo->vsl, SLT_FetchError, "No backend");
return (NULL);
}
return (d);
CHECK_OBJ(bo->director_req, DIRECTOR_MAGIC);
d = VRT_VDI_Resolve(ctx, bo->director_req);
if (d != NULL)
return (d);
VSLb(bo->vsl, SLT_FetchError,
"Director %s returned no backend", bo->director_req->vcl_name);
return (NULL);
}
/* Get a set of response headers -------------------------------------*/
......
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