[master] ac979b67f always assign ctx->handling = &wrk->handling

Nils Goroll nils.goroll at uplex.de
Wed Nov 6 14:47:07 UTC 2019


commit ac979b67f10b217912d4c596a5803af11c49cbb8
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed May 15 11:33:30 2019 +0200

    always assign ctx->handling = &wrk->handling
    
    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.

diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 9adb3f431..2a26c34a3 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -77,6 +77,7 @@ VCL_Bo2Ctx(struct vrt_ctx *ctx, struct busyobj *bo)
 
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	CHECK_OBJ_NOTNULL(bo->wrk, WORKER_MAGIC);
 	ctx->vcl = bo->vcl;
 	ctx->vsl = bo->vsl;
 	ctx->http_bereq = bo->bereq;
@@ -85,6 +86,8 @@ VCL_Bo2Ctx(struct vrt_ctx *ctx, struct busyobj *bo)
 	ctx->sp = bo->sp;
 	ctx->now = bo->t_prev;
 	ctx->ws = bo->ws;
+	ctx->handling = &bo->wrk->handling;
+	*ctx->handling = 0;
 }
 
 void
@@ -94,6 +97,7 @@ VCL_Req2Ctx(struct vrt_ctx *ctx, struct req *req)
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	CHECK_OBJ_ORNULL(req->topreq, REQ_MAGIC);
+	CHECK_OBJ_NOTNULL(req->wrk, WORKER_MAGIC);
 
 	ctx->vcl = req->vcl;
 	ctx->vsl = req->vsl;
@@ -104,6 +108,8 @@ VCL_Req2Ctx(struct vrt_ctx *ctx, struct req *req)
 	ctx->sp = req->sp;
 	ctx->now = req->t_prev;
 	ctx->ws = req->ws;
+	ctx->handling = &req->wrk->handling;
+	*ctx->handling = 0;
 }
 
 /*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_vrt_vcl.c b/bin/varnishd/cache/cache_vrt_vcl.c
index 451d7aea3..2617db9e1 100644
--- a/bin/varnishd/cache/cache_vrt_vcl.c
+++ b/bin/varnishd/cache/cache_vrt_vcl.c
@@ -441,8 +441,6 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
 	ctx.syntax = ctx.vcl->conf->syntax;
 	ctx.specific = specific;
 	ctx.method = method;
-	wrk->handling = 0;
-	ctx.handling = &wrk->handling;
 	aws = WS_Snapshot(wrk->aws);
 	wrk->cur_method = method;
 	wrk->seen_methods |= method;
diff --git a/include/vrt.h b/include/vrt.h
index 6eaa34690..c78f2c402 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -258,7 +258,7 @@ struct vrt_ctx {
 
 	unsigned			syntax;
 	unsigned			method;
-	unsigned			*handling;	// not in director context
+	unsigned			*handling;
 	unsigned			vclver;
 
 	struct vsb			*msg;	// Only in ...init()


More information about the varnish-commit mailing list