[master] 36e9a06 Move some non-protocol specific body-fetch code back to cache_fetch.c

Poul-Henning Kamp phk at varnish-cache.org
Tue Nov 26 16:58:10 CET 2013


commit 36e9a06fe5af4e72a56f7118419b463e1c500ec0
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Nov 26 13:40:22 2013 +0000

    Move some non-protocol specific body-fetch code back to cache_fetch.c

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 914217e..37449a5 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -442,6 +442,39 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
 	VBO_setstate(bo, BOS_FETCHING);
 
 	V1F_fetch_body(wrk, bo);
+
+	bo->vfp = NULL;
+
+	VSLb(bo->vsl, SLT_Fetch_Body, "%u(%s)",
+	    bo->htc.body_status, body_status_2str(bo->htc.body_status));
+
+	http_Teardown(bo->bereq);
+	http_Teardown(bo->beresp);
+
+	if (bo->state == BOS_FAILED) {
+		wrk->stats.fetch_failed++;
+	} else {
+		assert(bo->state == BOS_FETCHING);
+
+		VSLb(bo->vsl, SLT_Length, "%zd", obj->len);
+
+		{
+		/* Sanity check fetch methods accounting */
+			ssize_t uu;
+			struct storage *st;
+
+			uu = 0;
+			VTAILQ_FOREACH(st, &obj->store, list)
+				uu += st->len;
+			if (bo->do_stream)
+				/* Streaming might have started freeing stuff */
+				assert(uu <= obj->len);
+
+			else
+				assert(uu == obj->len);
+		}
+	}
+
 	if (!bo->do_stream && bo->state != BOS_FAILED)
 		HSH_Unbusy(&wrk->stats, obj->objcore);
 
diff --git a/bin/varnishd/cache/cache_http1_fetch.c b/bin/varnishd/cache/cache_http1_fetch.c
index bd1cc47..3f36be2 100644
--- a/bin/varnishd/cache/cache_http1_fetch.c
+++ b/bin/varnishd/cache/cache_http1_fetch.c
@@ -403,14 +403,6 @@ V1F_fetch_body(struct worker *wrk, struct busyobj *bo)
 		}
 	}
 
-	bo->vfp = NULL;
-
-	VSLb(bo->vsl, SLT_Fetch_Body, "%u(%s) cls %d",
-	    htc->body_status, body_status_2str(htc->body_status), cls);
-
-	http_Teardown(bo->bereq);
-	http_Teardown(bo->beresp);
-
 	if (bo->vbc != NULL) {
 		if (cls)
 			VDI_CloseFd(&bo->vbc);
@@ -419,27 +411,5 @@ V1F_fetch_body(struct worker *wrk, struct busyobj *bo)
 	}
 	AZ(bo->vbc);
 
-	if (bo->state == BOS_FAILED) {
-		wrk->stats.fetch_failed++;
-	} else {
-		assert(bo->state == BOS_FETCHING);
-
-		VSLb(bo->vsl, SLT_Length, "%zd", obj->len);
-
-		{
-		/* Sanity check fetch methods accounting */
-			ssize_t uu;
-
-			uu = 0;
-			VTAILQ_FOREACH(st, &obj->store, list)
-				uu += st->len;
-			if (bo->do_stream)
-				/* Streaming might have started freeing stuff */
-				assert(uu <= obj->len);
-
-			else
-				assert(uu == obj->len);
-		}
-	}
 	bo->stats = NULL;
 }



More information about the varnish-commit mailing list