[experimental-ims] 0c18d87 Move do_close from worker to busyobj and rename it should_close to distinguish it from the electables (do_esi, do_gzip etc).

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


commit 0c18d87646410a2468e97fb231c10a524c3586ef
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Nov 30 07:33:47 2011 +0000

    Move do_close from worker to busyobj and rename it should_close to
    distinguish it from the electables (do_esi, do_gzip etc).

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 8491150..819e701 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -332,7 +332,6 @@ struct worker {
 	struct http		*beresp;
 	struct vbc		*vbc;
 
-	unsigned		do_close;
 	char			*h_content_length;
 
 	/* Stream state */
@@ -504,6 +503,8 @@ struct busyobj {
 	enum body_status	body_status;
 	struct vef_priv		*vef_priv;
 
+	unsigned		should_close;
+
 	unsigned		do_esi;
 	unsigned		do_gzip;
 	unsigned		do_gunzip;
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index a8138da..6bda81f 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -568,7 +568,7 @@ cnt_fetch(struct sess *sp)
 	AN(sp->director);
 	AZ(wrk->vbc);
 	AZ(wrk->h_content_length);
-	AZ(wrk->do_close);
+	AZ(wrk->busyobj->should_close);
 	AZ(wrk->storage_hint);
 
 	http_Setup(wrk->beresp, wrk->ws);
diff --git a/bin/varnishd/cache/cache_dir.c b/bin/varnishd/cache/cache_dir.c
index d4794f9..eba6183 100644
--- a/bin/varnishd/cache/cache_dir.c
+++ b/bin/varnishd/cache/cache_dir.c
@@ -61,7 +61,6 @@ VDI_CloseFd(struct worker *wrk)
 	wrk->vbc->backend = NULL;
 	VBE_ReleaseConn(wrk->vbc);
 	wrk->vbc = NULL;
-	wrk->do_close = 0;
 }
 
 /* Recycle a connection ----------------------------------------------*/
@@ -74,7 +73,6 @@ VDI_RecycleFd(struct worker *wrk)
 	CHECK_OBJ_NOTNULL(wrk->vbc, VBC_MAGIC);
 	CHECK_OBJ_NOTNULL(wrk->vbc->backend, BACKEND_MAGIC);
 	assert(wrk->vbc->fd >= 0);
-	AZ(wrk->do_close);
 
 	bp = wrk->vbc->backend;
 
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index a198650..16509f0 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -589,7 +589,7 @@ FetchBody(struct worker *w, struct object *obj)
 	}
 	AZ(w->busyobj->fetch_failed);
 
-	if (cls == 0 && w->do_close)
+	if (cls == 0 && w->busyobj->should_close)
 		cls = 1;
 
 	WSLB(w, SLT_Length, "%u", obj->len);
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 58fb8e4..0908b74 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -217,6 +217,7 @@ pan_busyobj(const struct busyobj *bo)
 	if (bo->do_gunzip)	VSB_printf(pan_vsp, "    do_gunzip\n");
 	if (bo->do_esi)		VSB_printf(pan_vsp, "    do_esi\n");
 	if (bo->do_stream)	VSB_printf(pan_vsp, "    do_stream\n");
+	if (bo->should_close)	VSB_printf(pan_vsp, "    should_close\n");
 	VSB_printf(pan_vsp, "    bodystatus = %d,\n", bo->body_status);
 	VSB_printf(pan_vsp, "    },\n");
 }
@@ -258,9 +259,6 @@ pan_sess(const struct sess *sp)
 	VSB_printf(pan_vsp, "  restarts = %d, esi_level = %d\n",
 	    sp->restarts, sp->esi_level);
 
-	VSB_printf(pan_vsp, "  flags = ");
-	if (sp->wrk->do_close)	VSB_printf(pan_vsp, " do_close");
-	VSB_printf(pan_vsp, "\n");
 	pan_busyobj(sp->wrk->busyobj);
 
 	pan_ws(sp->ws, 2);
diff --git a/bin/varnishd/cache/cache_rfc2616.c b/bin/varnishd/cache/cache_rfc2616.c
index ae9614d..c2a795a 100644
--- a/bin/varnishd/cache/cache_rfc2616.c
+++ b/bin/varnishd/cache/cache_rfc2616.c
@@ -186,11 +186,11 @@ RFC2616_Body(const struct sess *sp)
 	hp = sp->wrk->beresp;
 
 	if (hp->protover < 11 && !http_HdrIs(hp, H_Connection, "keep-alive"))
-		sp->wrk->do_close = 1;
+		sp->wrk->busyobj->should_close = 1;
 	else if (http_HdrIs(hp, H_Connection, "close"))
-		sp->wrk->do_close = 1;
+		sp->wrk->busyobj->should_close = 1;
 	else
-		sp->wrk->do_close = 0;
+		sp->wrk->busyobj->should_close = 0;
 
 	if (!strcasecmp(http_GetReq(sp->wrk->bereq), "head")) {
 		/*



More information about the varnish-commit mailing list