[master] d2ed41c Move the stream-stopper all the way to where streaming will happen

Poul-Henning Kamp phk at varnish-cache.org
Fri Sep 6 23:50:45 CEST 2013


commit d2ed41c6aaac8ec33811fb36c95e9aaa3048b394
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Sep 6 20:07:08 2013 +0000

    Move the stream-stopper all the way to where streaming will happen

diff --git a/bin/varnishd/cache/cache_http1_deliver.c b/bin/varnishd/cache/cache_http1_deliver.c
index 04dab9d..640d94a 100644
--- a/bin/varnishd/cache/cache_http1_deliver.c
+++ b/bin/varnishd/cache/cache_http1_deliver.c
@@ -184,9 +184,6 @@ V1D_Deliver(struct req *req)
 	CHECK_OBJ_NOTNULL(req->obj, OBJECT_MAGIC);
 	CHECK_OBJ_NOTNULL(req->obj->objcore, OBJCORE_MAGIC);
 
-	while (req->obj->objcore->busyobj)
-		(void)usleep(10000);
-
 	req->res_mode = 0;
 
 	if (!req->disable_esi && req->obj->esidata != NULL) {
@@ -275,11 +272,12 @@ V1D_Deliver(struct req *req)
 
 	if (!req->wantbody) {
 		/* This was a HEAD or conditional request */
-	} else if (req->obj->len == 0) {
-		/* Nothing to do here */
 	} else if (req->res_mode & RES_ESI) {
+		AZ(req->obj->objcore->busyobj);
 		ESI_Deliver(req);
 	} else if (req->res_mode & RES_ESI_CHILD && req->gzip_resp) {
+		while (req->obj->objcore->busyobj)
+			(void)usleep(10000);
 		ESI_DeliverChild(req);
 	} else if (req->res_mode & RES_GUNZIP ||
 	    (req->res_mode & RES_ESI_CHILD &&
diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index 65f443b..5b878b9 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -46,6 +46,8 @@ ObjIterBegin(struct object *obj)
 
 	CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
 	ALLOC_OBJ(oi, OBJITER_MAGIC);
+	while (obj->objcore->busyobj != NULL)
+		usleep(10000);
 	if (oi != NULL)
 		oi->obj = obj;
 	return (oi);



More information about the varnish-commit mailing list