[experimental-ims] ab47f76 Move VCL-controlled backend timeouts from struct worker to busyobj

Geoff Simmons geoff at varnish-cache.org
Tue Feb 14 17:49:34 CET 2012


commit ab47f76a79c82f615fb3f964db61f1ecbfdf87e5
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Mon Feb 13 13:49:11 2012 +0100

    Move VCL-controlled backend timeouts from struct worker to busyobj

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index e76b0de..1371d48 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -320,11 +320,6 @@ struct worker {
 
 	struct busyobj		*busyobj;
 
-	/* Timeouts */
-	double			connect_timeout;
-	double			first_byte_timeout;
-	double			between_bytes_timeout;
-
 	/* Temporary accounting */
 	struct acct		acct_tmp;
 };
@@ -494,6 +489,11 @@ struct busyobj {
 	unsigned		do_gunzip;
 	unsigned		do_stream;
 	unsigned		do_pass;
+
+	/* Timeouts */
+	double			connect_timeout;
+	double			first_byte_timeout;
+	double			between_bytes_timeout;
 };
 
 /* Object structure --------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index b683300..039300b 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -89,13 +89,14 @@ VBE_ReleaseConn(struct vbc *vc)
 	MPL_Free(vbcpool, vc);
 }
 
-#define FIND_TMO(tmx, dst, sp, be)		\
-	do {					\
-		dst = sp->wrk->tmx;		\
-		if (dst == 0.0)			\
-			dst = be->tmx;		\
-		if (dst == 0.0)			\
-			dst = cache_param->tmx;	\
+#define FIND_TMO(tmx, dst, sp, be)					\
+	do {								\
+		CHECK_OBJ_NOTNULL(sp->wrk->busyobj, BUSYOBJ_MAGIC);	\
+		dst = sp->wrk->busyobj->tmx;				\
+		if (dst == 0.0)						\
+			dst = be->tmx;					\
+		if (dst == 0.0)						\
+			dst = cache_param->tmx;				\
 	} while (0)
 
 /*--------------------------------------------------------------------
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index fca55b0..137f198 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -1418,10 +1418,6 @@ cnt_recv(struct sess *sp, struct worker *wrk, struct req *req)
 	req->director = req->vcl->director[0];
 	AN(req->director);
 
-	wrk->connect_timeout = 0;
-	wrk->first_byte_timeout = 0;
-	wrk->between_bytes_timeout = 0;
-
 	req->disable_esi = 0;
 	req->hash_always_miss = 0;
 	req->hash_ignore_busy = 0;
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index ec067a2..cc7fb5b 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -236,7 +236,8 @@ VRT_l_bereq_##which(struct sess *sp, double num)		\
 {								\
 								\
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);			\
-	sp->wrk->which = (num > 0.0 ? num : 0.0);		\
+	CHECK_OBJ_NOTNULL(sp->wrk->busyobj, BUSYOBJ_MAGIC);	\
+	sp->wrk->busyobj->which = (num > 0.0 ? num : 0.0);	\
 }								\
 								\
 double __match_proto__()					\
@@ -244,7 +245,8 @@ VRT_r_bereq_##which(struct sess *sp)				\
 {								\
 								\
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);			\
-	return(sp->wrk->which);					\
+	CHECK_OBJ_NOTNULL(sp->wrk->busyobj, BUSYOBJ_MAGIC);	\
+	return(sp->wrk->busyobj->which);			\
 }
 
 BEREQ_TIMEOUT(connect_timeout)



More information about the varnish-commit mailing list