[master] c50858f Wait 10 seconds for a client connection

Poul-Henning Kamp phk at varnish-cache.org
Fri Jan 28 15:53:25 CET 2011


commit c50858f2b73292a62e92fe77c4b68dc3051de775
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Jan 28 14:53:11 2011 +0000

    Wait 10 seconds for a client connection

diff --git a/bin/varnishtest/vtc_client.c b/bin/varnishtest/vtc_client.c
index abdd279..b93dcd3 100644
--- a/bin/varnishtest/vtc_client.c
+++ b/bin/varnishtest/vtc_client.c
@@ -77,7 +77,6 @@ client_thread(void *priv)
 	struct client *c;
 	struct vtclog *vl;
 	int fd;
-	int i;
 	unsigned u;
 	struct vsb *vsb;
 	char *p;
@@ -99,14 +98,11 @@ client_thread(void *priv)
 		vtc_log(vl, 2, "Started (%u iterations)", c->repeat);
 	for (u = 0; u < c->repeat; u++) {
 		vtc_log(vl, 3, "Connect to %s", vsb_data(vsb));
-		fd = VSS_open(vsb_data(vsb), 0);
-		for (i = 0; fd < 0 && i < 3; i++) {
-			(void)sleep(1);
-			fd = VSS_open(vsb_data(vsb), 0);
-		}
+		fd = VSS_open(vsb_data(vsb), 10.);
 		if (fd < 0)
 			vtc_log(c->vl, 0, "Failed to open %s", vsb_data(vsb));
 		assert(fd >= 0);
+		TCP_blocking(fd);
 		TCP_myname(fd, mabuf, sizeof mabuf, mpbuf, sizeof mpbuf);
 		vtc_log(vl, 3, "connected fd %d from %s %s to %s",
 		    fd, mabuf, mpbuf, vsb_data(vsb));



More information about the varnish-commit mailing list