r5378 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Fri Oct 1 11:07:42 CEST 2010


Author: phk
Date: 2010-10-01 11:07:42 +0200 (Fri, 01 Oct 2010)
New Revision: 5378

Modified:
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
Log:
Unify/Macroize bereq timeout fields



Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2010-10-01 09:00:08 UTC (rev 5377)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2010-10-01 09:07:42 UTC (rev 5378)
@@ -450,49 +450,29 @@
 	return (sp->wrk->ttl - sp->t_req);
 }
 
+/*--------------------------------------------------------------------*/
 
-void
-VRT_l_bereq_connect_timeout(struct sess *sp, double num)
-{
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	sp->wrk->connect_timeout = (num > 0 ? num : 0);
+#define BEREQ_TIMEOUT(which)					\
+void								\
+VRT_l_bereq_##which(struct sess *sp, double num)		\
+{								\
+								\
+	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);			\
+	sp->wrk->which = (num > 0.0 ? num : 0.0);		\
+}								\
+								\
+double								\
+VRT_r_bereq_##which(struct sess *sp)				\
+{								\
+								\
+	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);			\
+	return(sp->wrk->which);					\
 }
 
-double
-VRT_r_bereq_connect_timeout(struct sess *sp)
-{
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	return (sp->wrk->connect_timeout);
-}
+BEREQ_TIMEOUT(connect_timeout)
+BEREQ_TIMEOUT(first_byte_timeout)
+BEREQ_TIMEOUT(between_bytes_timeout)
 
-void
-VRT_l_bereq_first_byte_timeout(struct sess *sp, double num)
-{
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	sp->wrk->first_byte_timeout = (num > 0 ? num : 0);
-}
-
-double
-VRT_r_bereq_first_byte_timeout(struct sess *sp)
-{
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	return (sp->wrk->first_byte_timeout);
-}
-
-void
-VRT_l_bereq_between_bytes_timeout(struct sess *sp, double num)
-{
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	sp->wrk->between_bytes_timeout = (num > 0 ? num : 0);
-}
-
-double
-VRT_r_bereq_between_bytes_timeout(struct sess *sp)
-{
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	return (sp->wrk->between_bytes_timeout);
-}
-
 /*--------------------------------------------------------------------*/
 
 const char *




More information about the varnish-commit mailing list