[master] 233b392 push busyobj out of V1F fetching

Poul-Henning Kamp phk at FreeBSD.org
Wed Sep 3 13:22:31 CEST 2014


commit 233b39282d2a30b869e072d4cc38977d46aa1974
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Sep 3 11:22:09 2014 +0000

    push busyobj out of V1F fetching

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 4e7046f..4c0e6d2 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -809,7 +809,7 @@ void VBO_waitstate(struct busyobj *bo, enum busyobj_state_e want);
 
 /* cache_http1_fetch.c [V1F] */
 int V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, struct req *req);
-void V1F_Setup_Fetch(struct busyobj *bo);
+void V1F_Setup_Fetch(struct vfp_ctx *vfc, ssize_t cl, struct http_conn *htc);
 
 /* cache_http1_fsm.c [HTTP1] */
 typedef int (req_body_iter_f)(struct req *, void *priv, void *ptr, size_t);
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index b4c4457..24ba95d 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -556,7 +556,7 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
 		ObjSetFlag(bo->vfc, OF_IMSCAND, 1);
 
 	if (bo->htc.body_status != BS_NONE)
-		V1F_Setup_Fetch(bo);
+		V1F_Setup_Fetch(bo->vfc, bo->content_length, &bo->htc);
 
 	/*
 	 * Ready to fetch the body
diff --git a/bin/varnishd/cache/cache_http1_fetch.c b/bin/varnishd/cache/cache_http1_fetch.c
index b622c3c..b6657d5 100644
--- a/bin/varnishd/cache/cache_http1_fetch.c
+++ b/bin/varnishd/cache/cache_http1_fetch.c
@@ -153,39 +153,34 @@ static const struct vfp v1f_eof = {
  */
 
 void
-V1F_Setup_Fetch(struct busyobj *bo)
+V1F_Setup_Fetch(struct vfp_ctx *vfc, ssize_t cl, struct http_conn *htc)
 {
-	struct http_conn *htc;
 	struct vfp_entry *vfe;
 
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-	htc = &bo->htc;
+	CHECK_OBJ_NOTNULL(vfc, VFP_CTX_MAGIC);
 	CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
-	CHECK_OBJ_NOTNULL(bo->vbc, VBC_MAGIC);
 
 	switch(htc->body_status) {
 	case BS_EOF:
-		assert(bo->content_length == -1);
-		vfe = VFP_Push(bo->vfc, &v1f_eof, 0);
-		vfe->priv1 = &bo->htc;
+		assert(cl == -1);
+		vfe = VFP_Push(vfc, &v1f_eof, 0);
 		vfe->priv2 = 0;
 		break;
 	case BS_LENGTH:
-		assert(bo->content_length > 0);
-		vfe = VFP_Push(bo->vfc, &v1f_straight, 0);
-		vfe->priv1 = &bo->htc;
-		vfe->priv2 = bo->content_length;
+		assert(cl > 0);
+		vfe = VFP_Push(vfc, &v1f_straight, 0);
+		vfe->priv2 = cl;
 		break;
 	case BS_CHUNKED:
-		assert(bo->content_length == -1);
-		vfe = VFP_Push(bo->vfc, &v1f_chunked, 0);
-		vfe->priv1 = &bo->htc;
+		assert(cl == -1);
+		vfe = VFP_Push(vfc, &v1f_chunked, 0);
 		vfe->priv2 = -1;
 		break;
 	default:
 		WRONG("Wrong body_status");
 		break;
 	}
+	vfe->priv1 = htc;
 	return;
 }
 



More information about the varnish-commit mailing list