Skip to content

Commit

Permalink
always assign ctx->handling = &wrk->handling
Browse files Browse the repository at this point in the history
This is option 'always add ctx->handling' from #2997:

we add the (struct vrt_ctx).handling pointer even where there is no VCL
method for consistency to enable use of VRT_fail() consistently.
  • Loading branch information
nigoroll committed Nov 6, 2019
1 parent bea1da6 commit ac979b6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 6 additions & 0 deletions bin/varnishd/cache/cache_vcl.c
Expand Up @@ -77,6 +77,7 @@ VCL_Bo2Ctx(struct vrt_ctx *ctx, struct busyobj *bo)


CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(bo->wrk, WORKER_MAGIC);
ctx->vcl = bo->vcl; ctx->vcl = bo->vcl;
ctx->vsl = bo->vsl; ctx->vsl = bo->vsl;
ctx->http_bereq = bo->bereq; ctx->http_bereq = bo->bereq;
Expand All @@ -85,6 +86,8 @@ VCL_Bo2Ctx(struct vrt_ctx *ctx, struct busyobj *bo)
ctx->sp = bo->sp; ctx->sp = bo->sp;
ctx->now = bo->t_prev; ctx->now = bo->t_prev;
ctx->ws = bo->ws; ctx->ws = bo->ws;
ctx->handling = &bo->wrk->handling;
*ctx->handling = 0;
} }


void void
Expand All @@ -94,6 +97,7 @@ VCL_Req2Ctx(struct vrt_ctx *ctx, struct req *req)
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_ORNULL(req->topreq, REQ_MAGIC); CHECK_OBJ_ORNULL(req->topreq, REQ_MAGIC);
CHECK_OBJ_NOTNULL(req->wrk, WORKER_MAGIC);


ctx->vcl = req->vcl; ctx->vcl = req->vcl;
ctx->vsl = req->vsl; ctx->vsl = req->vsl;
Expand All @@ -104,6 +108,8 @@ VCL_Req2Ctx(struct vrt_ctx *ctx, struct req *req)
ctx->sp = req->sp; ctx->sp = req->sp;
ctx->now = req->t_prev; ctx->now = req->t_prev;
ctx->ws = req->ws; ctx->ws = req->ws;
ctx->handling = &req->wrk->handling;
*ctx->handling = 0;
} }


/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
Expand Down
2 changes: 0 additions & 2 deletions bin/varnishd/cache/cache_vrt_vcl.c
Expand Up @@ -441,8 +441,6 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
ctx.syntax = ctx.vcl->conf->syntax; ctx.syntax = ctx.vcl->conf->syntax;
ctx.specific = specific; ctx.specific = specific;
ctx.method = method; ctx.method = method;
wrk->handling = 0;
ctx.handling = &wrk->handling;
aws = WS_Snapshot(wrk->aws); aws = WS_Snapshot(wrk->aws);
wrk->cur_method = method; wrk->cur_method = method;
wrk->seen_methods |= method; wrk->seen_methods |= method;
Expand Down
2 changes: 1 addition & 1 deletion include/vrt.h
Expand Up @@ -258,7 +258,7 @@ struct vrt_ctx {


unsigned syntax; unsigned syntax;
unsigned method; unsigned method;
unsigned *handling; // not in director context unsigned *handling;
unsigned vclver; unsigned vclver;


struct vsb *msg; // Only in ...init() struct vsb *msg; // Only in ...init()
Expand Down

0 comments on commit ac979b6

Please sign in to comment.