[master] 05aba58 Inject another BOS_STATE, to tell if we have committed to action in vcl_backend_response{}

Poul-Henning Kamp phk at FreeBSD.org
Thu Jan 16 12:20:54 CET 2014


commit 05aba583a0a911681c08d0b4e54a71248758c84a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Jan 16 11:20:04 2014 +0000

    Inject another BOS_STATE, to tell if we have committed to action
    in vcl_backend_response{}

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index e733c38..1c0a203 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -502,6 +502,7 @@ oc_getlru(const struct objcore *oc)
 enum busyobj_state_e {
 	BOS_INVALID = 0,	/* don't touch (yet) */
 	BOS_REQ_DONE,		/* beresp.* can be examined */
+	BOS_COMITTED,		/* beresp.* can be examined */
 	BOS_FETCHING,		/* beresp.* can be examined */
 	BOS_FINISHED,		/* object is complete */
 	BOS_FAILED,		/* something went wrong */
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 4ee5b97..defba02 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -238,24 +238,25 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo)
 
 	VCL_backend_response_method(bo->vcl, wrk, NULL, bo, bo->beresp->ws);
 
-	if (bo->do_esi)
-		bo->do_stream = 0;
-	if (bo->do_pass)
-		bo->fetch_objcore->flags |= OC_F_PASS;
-
-	if (wrk->handling == VCL_RET_DELIVER)
-		return (do_ims ? F_STP_CONDFETCH : F_STP_FETCH);
 	if (wrk->handling == VCL_RET_RETRY) {
-		assert(bo->state == BOS_REQ_DONE);
 		bo->retries++;
 		if (bo->retries <= cache_param->max_retries) {
 			VDI_CloseFd(&bo->vbc);
 			return (F_STP_STARTFETCH);
 		}
-		// XXX: wrk->handling = VCL_RET_SYNTH;
+		INCOMPL();
 	}
 
-	INCOMPL();
+	if (bo->state == BOS_REQ_DONE)
+		VBO_setstate(bo, BOS_COMITTED);	
+
+	if (bo->do_esi)
+		bo->do_stream = 0;
+	if (bo->do_pass)
+		bo->fetch_objcore->flags |= OC_F_PASS;
+
+	assert(wrk->handling == VCL_RET_DELIVER);
+	return (do_ims ? F_STP_CONDFETCH : F_STP_FETCH);
 }
 
 /*--------------------------------------------------------------------
@@ -454,7 +455,7 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
 	if (bo->do_stream)
 		HSH_Unbusy(&wrk->stats, obj->objcore);
 
-	if (bo->state == BOS_REQ_DONE)
+	if (bo->state == BOS_COMITTED)
 		VBO_setstate(bo, BOS_FETCHING);
 	else if (bo->state != BOS_FAILED)
 		WRONG("Wrong bo->state");



More information about the varnish-commit mailing list