[master] 5b6377e Get the VCL state tracking precise enough to pass our testcases

Poul-Henning Kamp phk at FreeBSD.org
Mon Nov 27 12:30:13 UTC 2017


commit 5b6377e3e959145f2ea63f4da6ea9646c88379da
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Nov 27 12:28:28 2017 +0000

    Get the VCL state tracking precise enough to pass our testcases

diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index e042a61..26043ea 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -997,8 +997,7 @@ vcl_cli_discard(struct cli *cli, const char * const *av, void *priv)
 		free(vcl->loaded_name);
 		AZ(errno=pthread_rwlock_destroy(&vcl->temp_rwl));
 		FREE_OBJ(vcl);
-	} else {
-		assert(vcl->temp == VCL_TEMP_COLD);
+	} else if (vcl->temp == VCL_TEMP_COLD) {
 		VCL_Poll();
 	}
 }
diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index 224082b..671fc21 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -750,7 +750,7 @@ mcf_vcl_discard(struct cli *cli, const char * const *av, void *priv)
 		(void)mgt_vcl_setstate(cli, vp, VCL_STATE_COLD);
 	if (MCH_Running()) {
 		/* XXX If this fails the child is crashing, figure that later */
-		assert(!vp->warm);
+		assert(vp->state != VCL_STATE_WARM);
 		(void)mgt_cli_askchild(&status, &p, "vcl.discard %s\n", av[2]);
 		free(p);
 	}
diff --git a/bin/varnishtest/tests/v00045.vtc b/bin/varnishtest/tests/v00045.vtc
index 1c4ac7b..a0c5114 100644
--- a/bin/varnishtest/tests/v00045.vtc
+++ b/bin/varnishtest/tests/v00045.vtc
@@ -17,7 +17,7 @@ varnish v1 -cliok "vcl.state vcl1 cold"
 # We should now see it as cooling
 delay 1
 
-varnish v1 -cliexpect "auto/cooling.*vcl1" vcl.list
+varnish v1 -cliexpect "cold/cooling.*vcl1" vcl.list
 
 # It can't be warmed up yet
 delay 1
@@ -25,7 +25,7 @@ varnish v1 -cliexpect "vmod-debug ref on vcl1" "vcl.state vcl1 warm"
 
 # It will eventually cool down
 delay 2
-varnish v1 -cliexpect "auto/cold.*vcl1" vcl.list
+varnish v1 -cliexpect "cold/cold.*vcl1" vcl.list
 
 # At this point it becomes possible to warm up again
 varnish v1 -cliok "vcl.state vcl1 warm"


More information about the varnish-commit mailing list