[master] cdc9884 Move Add/DelDirector into VRT, vmods will need to call them.

Poul-Henning Kamp phk at FreeBSD.org
Mon Apr 23 22:06:23 UTC 2018


commit cdc9884aee1958f2eb37e5dacc6dac51ecaa1873
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Apr 23 21:33:58 2018 +0000

    Move Add/DelDirector into VRT, vmods will need to call them.

diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 90e9a4b..40b36e7 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -499,7 +499,7 @@ VRT_new_backend_clustered(VRT_CTX, struct vsmw_cluster *vc,
 	    "%s.%s", VCL_Name(ctx->vcl), vrt->vcl_name);
 	AN(be->vsc);
 
-	retval = VCL_AddDirector(ctx->vcl, d, vrt->vcl_name);
+	retval = VRT_AddDirector(ctx, d, vrt->vcl_name);
 
 	if (retval == 0)
 		return (d);
@@ -571,7 +571,7 @@ VBE_Poll(void)
 		if (be->n_conn > 0)
 			continue;
 		Lck_Unlock(&backends_mtx);
-		VCL_DelDirector(be->director);
+		VRT_DelDirector(NULL, be->director);
 		Lck_Lock(&backends_mtx);
 	}
 	Lck_Unlock(&backends_mtx);
diff --git a/bin/varnishd/cache/cache_director.h b/bin/varnishd/cache/cache_director.h
index 91786ef..c65118b 100644
--- a/bin/varnishd/cache/cache_director.h
+++ b/bin/varnishd/cache/cache_director.h
@@ -92,8 +92,8 @@ struct director {
 unsigned VDI_Healthy(const struct director *, double *);
 
 /* cache_vcl.c */
-int VCL_AddDirector(struct vcl *, struct director *, const char *);
-void VCL_DelDirector(struct director *);
+int VRT_AddDirector(VRT_CTX, struct director *, const char *);
+void VRT_DelDirector(VRT_CTX, struct director *);
 
 /* cache_director.c */
 
diff --git a/bin/varnishd/cache/cache_vcl_vrt.c b/bin/varnishd/cache/cache_vcl_vrt.c
index ce94c75..ca45c76 100644
--- a/bin/varnishd/cache/cache_vcl_vrt.c
+++ b/bin/varnishd/cache/cache_vcl_vrt.c
@@ -126,13 +126,16 @@ VCL_Rel(struct vcl **vcc)
 /*--------------------------------------------------------------------*/
 
 int
-VCL_AddDirector(struct vcl *vcl, struct director *d, const char *vcl_name)
+VRT_AddDirector(VRT_CTX, struct director *d, const char *vcl_name)
 {
 	struct vsb *vsb;
+	struct vcl *vcl;
 
+	vcl = ctx->vcl;
 	CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC);
 	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
 	AN(d->destroy);
+	d->admin_health = VDI_AH_PROBE;
 
 	vsb = VSB_new_auto();
 	AN(vsb);
@@ -163,10 +166,11 @@ VCL_AddDirector(struct vcl *vcl, struct director *d, const char *vcl_name)
 }
 
 void
-VCL_DelDirector(struct director *d)
+VRT_DelDirector(VRT_CTX, struct director *d)
 {
 	struct vcl *vcl;
 
+	(void)ctx;
 	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
 	vcl = d->vcl;
 	CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC);


More information about the varnish-commit mailing list