[PATCH 02/25] Make FetchBody take a busyobj struct as parameter instead of obj, and prepare the busyobj->fetch_obj before calling FetchBody.

Martin Blix Grydeland martin at varnish-software.com
Sun Jan 22 18:53:08 CET 2012


---
 bin/varnishd/cache/cache.h        |    2 +-
 bin/varnishd/cache/cache_center.c |   10 ++++++++--
 bin/varnishd/cache/cache_fetch.c  |    7 +++----
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 11f0f6a..7fcd41e 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -771,7 +771,7 @@ struct storage *FetchStorage(struct worker *w, ssize_t sz);
 int FetchError(struct worker *w, const char *error);
 int FetchError2(struct worker *w, const char *error, const char *more);
 int FetchHdr(struct sess *sp, int need_host_hdr);
-int FetchBody(struct worker *w, struct object *obj);
+int FetchBody(struct worker *w, struct busyobj *bo);
 int FetchReqBody(const struct sess *sp);
 void Fetch_Init(void);
 
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index b03ba4b..f9908b3 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -908,7 +908,10 @@ cnt_fetchbody(struct sess *sp, struct worker *wrk, struct req *req)
 	}
 
 	/* Use unmodified headers*/
-	i = FetchBody(wrk, req->obj);
+	AZ(wrk->busyobj->fetch_obj);
+	wrk->busyobj->fetch_obj = req->obj;
+	i = FetchBody(wrk, wrk->busyobj);
+	AZ(wrk->busyobj->fetch_obj);
 
 	http_Setup(wrk->busyobj->bereq, NULL);
 	http_Setup(wrk->busyobj->beresp, NULL);
@@ -977,7 +980,10 @@ cnt_streambody(struct sess *sp, struct worker *wrk, struct req *req)
 
 	AssertObjCorePassOrBusy(req->obj->objcore);
 
-	i = FetchBody(wrk, req->obj);
+	AZ(wrk->busyobj->fetch_obj);
+	wrk->busyobj->fetch_obj = req->obj;
+	i = FetchBody(wrk, wrk->busyobj);
+	AZ(wrk->busyobj->fetch_obj);
 
 	http_Setup(wrk->busyobj->bereq, NULL);
 	http_Setup(wrk->busyobj->beresp, NULL);
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 7070612..06d23e6 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -484,20 +484,19 @@ FetchHdr(struct sess *sp, int need_host_hdr)
 /*--------------------------------------------------------------------*/
 
 int
-FetchBody(struct worker *wrk, struct object *obj)
+FetchBody(struct worker *wrk, struct busyobj *bo)
 {
 	int cls;
 	struct storage *st;
 	int mklen;
 	ssize_t cl;
 	struct http_conn *htc;
-	struct busyobj *bo;
+	struct object *obj;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	bo = wrk->busyobj;
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-	AZ(bo->fetch_obj);
 	CHECK_OBJ_NOTNULL(bo->vbc, VBC_MAGIC);
+	obj = bo->fetch_obj;
 	CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
 	CHECK_OBJ_NOTNULL(obj->http, HTTP_MAGIC);
 
-- 
1.7.4.1




More information about the varnish-dev mailing list