r3877 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Wed Mar 4 12:45:11 CET 2009


Author: phk
Date: 2009-03-04 12:45:10 +0100 (Wed, 04 Mar 2009)
New Revision: 3877

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_backend.c
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
Log:
Move the htc from bereq to worker



Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2009-03-04 11:37:39 UTC (rev 3876)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2009-03-04 11:45:10 UTC (rev 3877)
@@ -218,6 +218,7 @@
 
 	struct SHA256Context	*sha256ctx;
 
+	struct http_conn	htc[1];
 	struct ws		ws[1];
 	struct http		http[3];
 	struct http		*bereq;
@@ -247,8 +248,6 @@
 	unsigned		magic;
 #define BEREQ_MAGIC		0x3b6d250c
 	VTAILQ_ENTRY(bereq)	list;
-	struct ws		ws[1];
-	struct http_conn	htc[1];
 	unsigned		cacheable;
 	double			age;
 	double			entered;

Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2009-03-04 11:37:39 UTC (rev 3876)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2009-03-04 11:45:10 UTC (rev 3877)
@@ -145,7 +145,6 @@
 VBE_new_bereq(struct sess *sp)
 {
 	struct bereq *bereq;
-	volatile unsigned len;
 
 	Lck_Lock(&VBE_mtx);
 	bereq = VTAILQ_FIRST(&bereq_head);
@@ -155,12 +154,10 @@
 	if (bereq != NULL) {
 		CHECK_OBJ(bereq, BEREQ_MAGIC);
 	} else {
-		len =  params->sess_workspace;
-		bereq = calloc(sizeof *bereq + len, 1);
+		bereq = calloc(sizeof *bereq, 1);
 		if (bereq == NULL)
 			return (NULL);
 		bereq->magic = BEREQ_MAGIC;
-		WS_Init(bereq->ws, "bereq", bereq + 1, len);
 		sp->wrk->stats->n_bereq++;
 	}
 	return (bereq);
@@ -180,7 +177,6 @@
 	*bereqp = NULL;
 
 	CHECK_OBJ_NOTNULL(bereq, BEREQ_MAGIC);
-	WS_Reset(bereq->ws, NULL);
 	Lck_Lock(&VBE_mtx);
 	VTAILQ_INSERT_HEAD(&bereq_head, bereq, list);
 	Lck_Unlock(&VBE_mtx);

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2009-03-04 11:37:39 UTC (rev 3876)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2009-03-04 11:45:10 UTC (rev 3877)
@@ -370,10 +370,10 @@
 
 	/* Receive response */
 
-	HTC_Init(bereq->htc, bereq->ws, vc->fd);
+	HTC_Init(sp->wrk->htc, sp->wrk->ws, vc->fd);
 	TCP_set_read_timeout(vc->fd, sp->first_byte_timeout);
 	do {
-		i = HTC_Rx(bereq->htc);
+		i = HTC_Rx(sp->wrk->htc);
 		TCP_set_read_timeout(vc->fd, sp->between_bytes_timeout);
 	}
 	while (i == 0);
@@ -386,7 +386,7 @@
 
 	hp = sp->wrk->beresp;
 
-	if (http_DissectResponse(sp->wrk, bereq->htc, hp)) {
+	if (http_DissectResponse(sp->wrk, sp->wrk->htc, hp)) {
 		VBE_ClosedFd(sp);
 		/* XXX: other cleanup ? */
 		return (__LINE__);
@@ -429,10 +429,10 @@
 	if (is_head) {
 		/* nothing */
 	} else if (http_GetHdr(hp, H_Content_Length, &b)) {
-		cls = fetch_straight(sp, sp->bereq->htc, b);
+		cls = fetch_straight(sp, sp->wrk->htc, b);
 		mklen = 1;
 	} else if (http_HdrIs(hp, H_Transfer_Encoding, "chunked")) {
-		cls = fetch_chunked(sp, sp->bereq->htc);
+		cls = fetch_chunked(sp, sp->wrk->htc);
 		mklen = 1;
 	} else if (http_GetHdr(hp, H_Transfer_Encoding, &b)) {
 		/* XXX: AUGH! */
@@ -451,13 +451,13 @@
 		 * If we have connection closed, it is safe to read what
 		 * comes in any case.
 		 */
-		cls = fetch_eof(sp, sp->bereq->htc);
+		cls = fetch_eof(sp, sp->wrk->htc);
 		mklen = 1;
 	} else if (hp->protover < 1.1) {
 		/*
 		 * With no Connection header, assume EOF
 		 */
-		cls = fetch_eof(sp, sp->bereq->htc);
+		cls = fetch_eof(sp, sp->wrk->htc);
 		mklen = 1;
 	} else {
 		/*



More information about the varnish-commit mailing list