[master] 746b4da Move bo->doclose to bo->htc->doclose which is more correct.

Poul-Henning Kamp phk at FreeBSD.org
Wed Jun 24 13:41:10 CEST 2015


commit 746b4da3cafc6146fbcea65dbc741ccf7353d66e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jun 24 11:08:36 2015 +0000

    Move bo->doclose to bo->htc->doclose which is more correct.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 71ac981..8883de1 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -225,6 +225,7 @@ struct http_conn {
 #define HTTP_CONN_MAGIC		0x3e19edd1
 
 	int			fd;
+	enum sess_close		doclose;
 	unsigned		maxbytes;
 	unsigned		maxhdr;
 	struct ws		*ws;
@@ -481,8 +482,6 @@ struct busyobj {
 
 	struct pool_task	fetch_task;
 
-	enum sess_close		doclose;
-
 #define BO_FLAG(l, r, w, d) unsigned	l:1;
 #include "tbl/bo_flags.h"
 #undef BO_FLAG
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index f85e4ca..66c79d8 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -109,6 +109,7 @@ vbe_dir_getfd(struct worker *wrk, const struct director *d, struct busyobj *bo)
 	if (bo->htc == NULL)
 		/* XXX: counter ? */
 		return (-1);
+	bo->htc->doclose = SC_NULL;
 
 	FIND_TMO(connect_timeout, tmod, bo, bp);
 	vc = VBT_Get(bp->tcp_pool, tmod, bp, wrk);
@@ -176,7 +177,7 @@ vbe_dir_finish(const struct director *d, struct worker *wrk,
 		VBT_Wait(wrk, bo->htc->vbc);
 	CHECK_OBJ_NOTNULL(bo->htc->vbc->backend, BACKEND_MAGIC);
 	bo->htc->vbc->backend = NULL;
-	if (bo->doclose != SC_NULL) {
+	if (bo->htc->doclose != SC_NULL) {
 		VSLb(bo->vsl, SLT_BackendClose, "%d %s", bo->htc->vbc->fd,
 		    bp->display_name);
 		VBT_Close(bp->tcp_pool, &bo->htc->vbc);
@@ -237,7 +238,6 @@ vbe_dir_gethdrs(const struct director *d, struct worker *wrk,
 		    bo->req->req_body_status != REQ_BODY_CACHED)
 			break;
 		VSC_C_main->backend_retry++;
-		bo->doclose = SC_NULL;
 	} while (extrachance);
 	return (-1);
 }
diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index d899378..5dc4abe 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -143,7 +143,6 @@ VBO_GetBusyObj(struct worker *wrk, const struct req *req)
 	VCL_Ref(bo->vcl);
 
 	bo->t_first = bo->t_prev = NAN;
-	bo->doclose = SC_NULL;
 
 	memcpy(bo->digest, req->digest, sizeof bo->digest);
 
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 3eed33b..ce83b99 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -169,7 +169,6 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo)
 	CHECK_OBJ_NOTNULL(bo->req, REQ_MAGIC);
 
 	assert(bo->state == BOS_INVALID);
-	assert(bo->doclose == SC_NULL);
 	AZ(bo->storage_hint);
 
 	HTTP_Setup(bo->bereq0, bo->ws, bo->vsl, SLT_BereqMethod);
@@ -228,7 +227,6 @@ vbf_stp_retry(struct worker *wrk, struct busyobj *bo)
 
 	/* VDI_Finish must have been called before */
 	assert(bo->director_state == DIR_S_NULL);
-	bo->doclose = SC_NULL;
 
 	/* reset other bo attributes - See VBO_GetBusyObj */
 	bo->storage_hint = NULL;
@@ -261,7 +259,6 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 
-	assert(bo->doclose == SC_NULL);
 	AZ(bo->storage_hint);
 
 	if (bo->do_pass)
@@ -372,7 +369,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
 	}
 
 	if (bo->htc->body_status == BS_ERROR) {
-		bo->doclose = SC_RX_BODY;
+		bo->htc->doclose = SC_RX_BODY;
 		VDI_Finish(bo->wrk, bo);
 		VSLb(bo->vsl, SLT_Error, "Body cannot be fetched");
 		assert(bo->director_state == DIR_S_NULL);
@@ -414,7 +411,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
 			 */
 			VSLb(bo->vsl, SLT_Error,
 			    "304 response but not conditional fetch");
-			bo->doclose = SC_RX_BAD;
+			bo->htc->doclose = SC_RX_BAD;
 			VDI_Finish(bo->wrk, bo);
 			return (F_STP_FAIL);
 		}
@@ -429,14 +426,14 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
 	VCL_backend_response_method(bo->vcl, wrk, NULL, bo, NULL);
 
 	if (wrk->handling == VCL_RET_ABANDON) {
-		bo->doclose = SC_RESP_CLOSE;
+		bo->htc->doclose = SC_RESP_CLOSE;
 		VDI_Finish(bo->wrk, bo);
 		return (F_STP_FAIL);
 	}
 
 	if (wrk->handling == VCL_RET_RETRY) {
 		if (bo->htc->body_status != BS_NONE)
-			bo->doclose = SC_RESP_CLOSE;
+			bo->htc->doclose = SC_RESP_CLOSE;
 		if (bo->director_state != DIR_S_NULL)
 			VDI_Finish(bo->wrk, bo);
 
@@ -494,14 +491,14 @@ vbf_fetch_body_helper(struct busyobj *bo)
 			VSLb(vfc->wrk->vsl, SLT_FetchError,
 			    "Pass delivery abandoned");
 			vfps = VFP_END;
-			bo->doclose = SC_RX_BODY;
+			bo->htc->doclose = SC_RX_BODY;
 			break;
 		}
 		AZ(vfc->failed);
 		l = est;
 		assert(l >= 0);
 		if (VFP_GetStorage(vfc, &l, &ptr) != VFP_OK) {
-			bo->doclose = SC_RX_BODY;
+			bo->htc->doclose = SC_RX_BODY;
 			break;
 		}
 
@@ -522,7 +519,7 @@ vbf_fetch_body_helper(struct busyobj *bo)
 	if (vfps == VFP_ERROR) {
 		AN(vfc->failed);
 		(void)VFP_Error(vfc, "Fetch pipeline failed to process");
-		bo->doclose = SC_RX_BODY;
+		bo->htc->doclose = SC_RX_BODY;
 	}
 
 	if (!bo->do_stream)
@@ -612,14 +609,14 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
 
 	if (VFP_Open(bo->vfc)) {
 		(void)VFP_Error(bo->vfc, "Fetch pipeline failed to open");
-		bo->doclose = SC_RX_BODY;
+		bo->htc->doclose = SC_RX_BODY;
 		VDI_Finish(bo->wrk, bo);
 		return (F_STP_ERROR);
 	}
 
 	if (vbf_beresp2obj(bo)) {
 		(void)VFP_Error(bo->vfc, "Could not get storage");
-		bo->doclose = SC_RX_BODY;
+		bo->htc->doclose = SC_RX_BODY;
 		VDI_Finish(bo->wrk, bo);
 		return (F_STP_ERROR);
 	}
@@ -809,9 +806,10 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
 	    wrk->handling == VCL_RET_ABANDON) {
 		VSB_delete(synth_body);
 
-		bo->doclose = SC_RESP_CLOSE;
-		if (bo->director_state != DIR_S_NULL)
+		if (bo->director_state != DIR_S_NULL) {
+			bo->htc->doclose = SC_RESP_CLOSE;
 			VDI_Finish(bo->wrk, bo);
+		}
 
 		if (wrk->handling == VCL_RET_RETRY &&
 		    bo->retries++ < cache_param->max_retries)
@@ -897,7 +895,6 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 
 	THR_SetBusyobj(bo);
 	stp = F_STP_MKBEREQ;
-	assert(bo->doclose == SC_NULL);
 	assert(isnan(bo->t_first));
 	assert(isnan(bo->t_prev));
 	VSLb_ts_busyobj(bo, "Start", W_TIM_real(wrk));
diff --git a/bin/varnishd/http1/cache_http1_fetch.c b/bin/varnishd/http1/cache_http1_fetch.c
index 12f18f1..cc63d92 100644
--- a/bin/varnishd/http1/cache_http1_fetch.c
+++ b/bin/varnishd/http1/cache_http1_fetch.c
@@ -135,7 +135,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
 		VSLb(bo->vsl, SLT_FetchError, "backend write error: %d (%s)",
 		    errno, strerror(errno));
 		VSLb_ts_busyobj(bo, "Bereq", W_TIM_real(wrk));
-		bo->doclose = SC_TX_ERROR;
+		htc->doclose = SC_TX_ERROR;
 		return (1);
 	}
 	VSLb_ts_busyobj(bo, "Bereq", W_TIM_real(wrk));
@@ -168,7 +168,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
 			VSLb(bo->vsl, SLT_FetchError,
 			    "http %sread error: overflow",
 			    first ? "first " : "");
-			bo->doclose = SC_RX_OVERFLOW;
+			htc->doclose = SC_RX_OVERFLOW;
 			return (-1);
 		}
 		if (hs == HTC_S_EOF) {
@@ -177,7 +177,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
 			    htc->rxbuf_e - htc->rxbuf_b;
 			VSLb(bo->vsl, SLT_FetchError, "http %sread error: EOF",
 			    first ? "first " : "");
-			bo->doclose = SC_RX_TIMEOUT;
+			htc->doclose = SC_RX_TIMEOUT;
 			return (first ? 1 : -1);
 		}
 		if (first) {
@@ -192,11 +192,11 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
 
 	if (HTTP1_DissectResponse(hp, htc)) {
 		VSLb(bo->vsl, SLT_FetchError, "http format error");
-		bo->doclose = SC_RX_JUNK;
+		htc->doclose = SC_RX_JUNK;
 		return (-1);
 	}
 
-	bo->doclose = http_DoConnection(hp);
+	htc->doclose = http_DoConnection(hp);
 
 	return (0);
 }
diff --git a/bin/varnishd/http1/cache_http1_pipe.c b/bin/varnishd/http1/cache_http1_pipe.c
index 45b137d..aba7445 100644
--- a/bin/varnishd/http1/cache_http1_pipe.c
+++ b/bin/varnishd/http1/cache_http1_pipe.c
@@ -172,7 +172,7 @@ V1P_Process(struct req *req, struct busyobj *bo, int fd)
 	VSLb_ts_req(req, "PipeSess", W_TIM_real(wrk));
 	pipecharge(req, &acct_pipe, bo->htc->vbc->backend->vsc);
 	SES_Close(req->sp, SC_TX_PIPE);
-	bo->doclose = SC_TX_PIPE;
+	bo->htc->doclose = SC_TX_PIPE;
 }
 
 /*--------------------------------------------------------------------*/



More information about the varnish-commit mailing list