r5415 - trunk/varnish-cache/bin/varnishtest

phk at varnish-cache.org phk at varnish-cache.org
Wed Oct 6 20:08:13 CEST 2010


Author: phk
Date: 2010-10-06 20:08:13 +0200 (Wed, 06 Oct 2010)
New Revision: 5415

Modified:
   trunk/varnish-cache/bin/varnishtest/vtc_client.c
Log:
Implicitly wait on client to complete before we do anything disruptive
to it's state.



Modified: trunk/varnish-cache/bin/varnishtest/vtc_client.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_client.c	2010-10-05 19:35:42 UTC (rev 5414)
+++ trunk/varnish-cache/bin/varnishtest/vtc_client.c	2010-10-06 18:08:13 UTC (rev 5415)
@@ -63,6 +63,7 @@
 	unsigned		repeat;
 
 	pthread_t		tp;
+	unsigned		running;
 };
 
 static VTAILQ_HEAD(, client)	clients =
@@ -171,6 +172,7 @@
 	CHECK_OBJ_NOTNULL(c, CLIENT_MAGIC);
 	vtc_log(c->vl, 2, "Starting client");
 	AZ(pthread_create(&c->tp, NULL, client_thread, c));
+	c->running = 1;
 }
 
 /**********************************************************************
@@ -188,6 +190,7 @@
 	if (res != NULL)
 		vtc_log(c->vl, 0, "Client returned \"%s\"", (char *)res);
 	c->tp = 0;
+	c->running = 0;
 }
 
 /**********************************************************************
@@ -240,6 +243,16 @@
 	for (; *av != NULL; av++) {
 		if (vtc_error)
 			break;
+
+		if (!strcmp(*av, "-wait")) {
+			client_wait(c);
+			continue;
+		}
+
+		/* Don't muck about with a running client */
+		if (c->running)
+			client_wait(c);
+
 		if (!strcmp(*av, "-connect")) {
 			bprintf(c->connect, "%s", av[1]);
 			av++;
@@ -254,10 +267,6 @@
 			client_start(c);
 			continue;
 		}
-		if (!strcmp(*av, "-wait")) {
-			client_wait(c);
-			continue;
-		}
 		if (!strcmp(*av, "-run")) {
 			client_run(c);
 			continue;




More information about the varnish-commit mailing list