[master] 49c619b Move htc from worker to busyobj

Poul-Henning Kamp phk at varnish-cache.org
Tue Nov 29 19:22:45 CET 2011


commit 49c619b275799f619ea69a300e5c6b9c430da80d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Nov 29 18:22:33 2011 +0000

    Move htc from worker to busyobj

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 5196575..125dd53 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -315,7 +315,6 @@ struct worker {
 	/* Lookup stuff */
 	struct SHA256Context	*sha256ctx;
 
-	struct http_conn	htc[1];
 	struct ws		ws[1];
 	struct http		*bereq;
 	struct http		*beresp;
@@ -503,6 +502,7 @@ struct busyobj {
 	struct vgz		*vgz_rx;
 
 	struct exp		exp;
+	struct http_conn	htc;
 };
 
 /* Object structure --------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_esi_fetch.c b/bin/varnishd/cache/cache_esi_fetch.c
index 3dbc5ce..71dd815 100644
--- a/bin/varnishd/cache/cache_esi_fetch.c
+++ b/bin/varnishd/cache/cache_esi_fetch.c
@@ -336,7 +336,7 @@ vfp_esi_bytes(struct worker *w, struct http_conn *htc, ssize_t bytes)
 	CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
 	AZ(w->busyobj->fetch_failed);
 	AN(w->busyobj->vep);
-	assert(w->htc == htc);
+	assert(&w->busyobj->htc == htc);
 	if (w->busyobj->is_gzip && w->do_gunzip)
 		i = vfp_esi_bytes_gu(w, htc, bytes);
 	else if (w->busyobj->is_gunzip && w->do_gzip)
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 2a2de5b..0b86821 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -383,10 +383,13 @@ FetchHdr(struct sess *sp)
 	struct http *hp;
 	int retry = -1;
 	int i;
+	struct http_conn *htc;
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
 	w = sp->wrk;
+	CHECK_OBJ_NOTNULL(w->busyobj, BUSYOBJ_MAGIC);
+	htc = &w->busyobj->htc;
 
 	AN(sp->director);
 	AZ(sp->wrk->obj);
@@ -437,12 +440,13 @@ FetchHdr(struct sess *sp)
 
 	/* Receive response */
 
-	HTC_Init(w->htc, w->ws, vc->fd, vc->vsl_id, cache_param->http_resp_size,
+	HTC_Init(htc, w->ws, vc->fd, vc->vsl_id,
+	    cache_param->http_resp_size,
 	    cache_param->http_resp_hdr_len);
 
 	VTCP_set_read_timeout(vc->fd, vc->first_byte_timeout);
 
-	i = HTC_Rx(w->htc);
+	i = HTC_Rx(htc);
 
 	if (i < 0) {
 		WSP(sp, SLT_FetchError, "http first read error: %d %d (%s)",
@@ -456,7 +460,7 @@ FetchHdr(struct sess *sp)
 	VTCP_set_read_timeout(vc->fd, vc->between_bytes_timeout);
 
 	while (i == 0) {
-		i = HTC_Rx(w->htc);
+		i = HTC_Rx(htc);
 		if (i < 0) {
 			WSP(sp, SLT_FetchError,
 			    "http first read error: %d %d (%s)",
@@ -469,7 +473,7 @@ FetchHdr(struct sess *sp)
 
 	hp = w->beresp;
 
-	if (http_DissectResponse(w, w->htc, hp)) {
+	if (http_DissectResponse(w, htc, hp)) {
 		WSP(sp, SLT_FetchError, "http format error");
 		VDI_CloseFd(sp->wrk);
 		/* XXX: other cleanup ? */
@@ -487,13 +491,17 @@ FetchBody(struct worker *w, struct object *obj)
 	struct storage *st;
 	int mklen;
 	ssize_t cl;
+	struct http_conn *htc;
 
 	CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
+	CHECK_OBJ_NOTNULL(w->busyobj, BUSYOBJ_MAGIC);
 	AZ(w->fetch_obj);
 	CHECK_OBJ_NOTNULL(w->vbc, VBC_MAGIC);
 	CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
 	CHECK_OBJ_NOTNULL(obj->http, HTTP_MAGIC);
 
+	htc = &w->busyobj->htc;
+
 	if (w->busyobj->vfp == NULL)
 		w->busyobj->vfp = &vfp_nop;
 
@@ -519,21 +527,21 @@ FetchBody(struct worker *w, struct object *obj)
 	case BS_LENGTH:
 		cl = fetch_number( w->h_content_length, 10);
 		w->busyobj->vfp->begin(w, cl > 0 ? cl : 0);
-		cls = fetch_straight(w, w->htc, cl);
+		cls = fetch_straight(w, htc, cl);
 		mklen = 1;
 		if (w->busyobj->vfp->end(w))
 			cls = -1;
 		break;
 	case BS_CHUNKED:
 		w->busyobj->vfp->begin(w, cl);
-		cls = fetch_chunked(w, w->htc);
+		cls = fetch_chunked(w, htc);
 		mklen = 1;
 		if (w->busyobj->vfp->end(w))
 			cls = -1;
 		break;
 	case BS_EOF:
 		w->busyobj->vfp->begin(w, cl);
-		cls = fetch_eof(w, w->htc);
+		cls = fetch_eof(w, htc);
 		mklen = 1;
 		if (w->busyobj->vfp->end(w))
 			cls = -1;
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index 7c364c0..d0b4226 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -131,7 +131,7 @@ stv_pick_stevedore(struct worker *wrk, const char **hint)
 			return (stv_transient);
 
 		/* Hint was not valid, nuke it */
-		WSL(wrk, SLT_Debug, wrk->htc->vsl_id,
+		WSL(wrk, SLT_Debug, 0, 			/* XXX VSL_id ?? */
 		    "Storage hint not usable");
 		*hint = NULL;
 	}



More information about the varnish-commit mailing list