[experimental-ims] 4faa178 Move body_status from worker to busyobj

Geoff Simmons geoff at varnish-cache.org
Mon Jan 9 21:52:44 CET 2012


commit 4faa178440e6b73cc7e7924a845e1f26bf1f386e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Nov 29 19:00:10 2011 +0000

    Move body_status from worker to busyobj

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index cb2a68e..c4d6f08 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -316,8 +316,8 @@ struct worker {
 	struct SHA256Context	*sha256ctx;
 
 	struct ws		ws[1];
-	struct http		*bereq;
-	struct http		*beresp;
+
+
 	struct http		*resp;
 
 	struct object		*obj;
@@ -327,9 +327,11 @@ struct worker {
 	/* This is only here so VRT can find it */
 	const char		*storage_hint;
 
-	/* Fetch stuff */
+	/* Fetch stuff.  Here because pipe has no busyobj */
+	struct http		*bereq;
+	struct http		*beresp;
 	struct vbc		*vbc;
-	enum body_status	body_status;
+
 	struct vef_priv		*vef_priv;
 	unsigned		do_stream;
 	unsigned		do_esi;
@@ -503,6 +505,8 @@ struct busyobj {
 	struct object		*fetch_obj;
 	struct exp		exp;
 	struct http_conn	htc;
+
+	enum body_status	body_status;
 };
 
 /* Object structure --------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 86b54d0..7d4a280 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -606,7 +606,7 @@ cnt_fetch(struct sess *sp)
 		 * headers are adultered by VCL
 		 * NB: Also sets other wrk variables
 		 */
-		wrk->body_status = RFC2616_Body(sp);
+		wrk->busyobj->body_status = RFC2616_Body(sp);
 
 		sp->err_code = http_GetStatus(wrk->beresp);
 
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 7180a5b..15eeb9b 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -229,7 +229,7 @@ fetch_straight(struct worker *w, struct http_conn *htc, ssize_t cl)
 {
 	int i;
 
-	assert(w->body_status == BS_LENGTH);
+	assert(w->busyobj->body_status == BS_LENGTH);
 
 	if (cl < 0) {
 		return (FetchError(w, "straight length field bogus"));
@@ -256,7 +256,7 @@ fetch_chunked(struct worker *w, struct http_conn *htc)
 	unsigned u;
 	ssize_t cl;
 
-	assert(w->body_status == BS_CHUNKED);
+	assert(w->busyobj->body_status == BS_CHUNKED);
 	do {
 		/* Skip leading whitespace */
 		do {
@@ -314,7 +314,7 @@ fetch_eof(struct worker *w, struct http_conn *htc)
 {
 	int i;
 
-	assert(w->body_status == BS_EOF);
+	assert(w->busyobj->body_status == BS_EOF);
 	i = w->busyobj->vfp->bytes(w, htc, SSIZE_MAX);
 	if (i < 0)
 		return (-1);
@@ -515,7 +515,7 @@ FetchBody(struct worker *w, struct object *obj)
 
 	/* XXX: pick up estimate from objdr ? */
 	cl = 0;
-	switch (w->body_status) {
+	switch (w->busyobj->body_status) {
 	case BS_NONE:
 		cls = 0;
 		mklen = 0;
@@ -567,10 +567,10 @@ FetchBody(struct worker *w, struct object *obj)
 	w->busyobj->fetch_obj = NULL;
 
 	WSLB(w, SLT_Fetch_Body, "%u(%s) cls %d mklen %u",
-	    w->body_status, body_status(w->body_status),
+	    w->busyobj->body_status, body_status(w->busyobj->body_status),
 	    cls, mklen);
 
-	if (w->body_status == BS_ERROR) {
+	if (w->busyobj->body_status == BS_ERROR) {
 		VDI_CloseFd(w);
 		return (__LINE__);
 	}
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 641fe99..85fcae0 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -213,6 +213,7 @@ pan_busyobj(const struct busyobj *bo)
 	VSB_printf(pan_vsp, "  busyobj = %p {\n", bo);
 	if (bo->is_gzip)	VSB_printf(pan_vsp, "    is_gzip\n");
 	if (bo->is_gunzip)	VSB_printf(pan_vsp, "    is_gunzip\n");
+	VSB_printf(pan_vsp, "    bodystatus = %d,\n", bo->body_status);
 	VSB_printf(pan_vsp, "    },\n");
 }
 
@@ -260,7 +261,6 @@ pan_sess(const struct sess *sp)
 	if (sp->wrk->do_esi)	VSB_printf(pan_vsp, " do_esi");
 	if (sp->wrk->do_close)	VSB_printf(pan_vsp, " do_close");
 	VSB_printf(pan_vsp, "\n");
-	VSB_printf(pan_vsp, "  bodystatus = %d\n", sp->wrk->body_status);
 	pan_busyobj(sp->wrk->busyobj);
 
 	pan_ws(sp->ws, 2);



More information about the varnish-commit mailing list