[master] e7b720ead shard director: Use VRT_priv_task_get() properly

Nils Goroll nils.goroll at uplex.de
Mon Jan 18 15:18:07 UTC 2021


commit e7b720eadba23b5b7d544de8163087d8400a714e
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Jan 18 14:27:40 2021 +0100

    shard director: Use VRT_priv_task_get() properly
    
    This is how 08b642d70ff15346eb1818171862f70a3a9266af should have looked
    like.

diff --git a/vmod/vmod_directors_shard.c b/vmod/vmod_directors_shard.c
index 1d0ce41f7..77fab676a 100644
--- a/vmod/vmod_directors_shard.c
+++ b/vmod/vmod_directors_shard.c
@@ -615,13 +615,6 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
 	else
 		resolve = VENUM(NOW);
 
-	if (ctx->method & SHARD_VCL_TASK_BEREQ) {
-		pp = shard_param_task_l(ctx, shardd, shardd->name,
-		    shardd->param);
-		if (pp == NULL)
-			return (NULL);
-	}
-
 	if (resolve == VENUM(LAZY)) {
 		if ((args & ~arg_resolve) == 0) {
 			AN(vshard->dir);
@@ -635,6 +628,11 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
 			    "context");
 			return (NULL);
 		}
+
+		pp = shard_param_task_l(ctx, shardd, shardd->name,
+		    shardd->param);
+		if (pp == NULL)
+			return (NULL);
 	} else if (resolve == VENUM(NOW)) {
 		if (ctx->method & VCL_MET_TASK_H) {
 			shard_fail(ctx, shardd->name, "%s",
@@ -642,9 +640,10 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
 			    "used in vcl_init{}/vcl_fini{}");
 			return (NULL);
 		}
-		pp = shard_param_stack(&pstk,
-		    pp != NULL ? pp : shardd->param,
-		    shardd->name);
+		ppt = shard_param_task_r(ctx, shardd, shardd->name,
+		    shardd->param);
+		AN(ppt);
+		pp = shard_param_stack(&pstk, ppt, shardd->name);
 	} else {
 		WRONG("resolve enum");
 	}


More information about the varnish-commit mailing list