r3099 - trunk/varnish-cache/lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Mon Aug 18 10:25:48 CEST 2008


Author: phk
Date: 2008-08-18 10:25:48 +0200 (Mon, 18 Aug 2008)
New Revision: 3099

Modified:
   trunk/varnish-cache/lib/libvcl/vcc_backend.c
Log:
Make up my mind: defaults go in varnishd



Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_backend.c	2008-08-18 08:18:43 UTC (rev 3098)
+++ trunk/varnish-cache/lib/libvcl/vcc_backend.c	2008-08-18 08:25:48 UTC (rev 3099)
@@ -351,8 +351,8 @@
 	ExpectErr(tl, '{');
 	vcc_NextToken(tl);
 
-	window = 8;
-	threshold = 3;
+	window = 0;
+	threshold = 0;
 	Fb(tl, 0, "\t.probe = {\n");
 	while (tl->t->tok != '}') {
 
@@ -414,32 +414,36 @@
 		vcc_NextToken(tl);
 	}
 
-	if (t_threshold == NULL && t_window != NULL) {
-		vsb_printf(tl->sb, "Must specify .threshold with .window\n");
-		vcc_ErrWhere(tl, t_window);
-		return;
-	} else if (t_threshold != NULL && t_window == NULL) {
-		if (threshold > 64) {
-			vsb_printf(tl->sb, "Threshold must be 64 or less.\n");
-			vcc_ErrWhere(tl, t_threshold);
+	if (t_threshold != NULL || t_window != NULL) {
+		if (t_threshold == NULL && t_window != NULL) {
+			vsb_printf(tl->sb,
+			    "Must specify .threshold with .window\n");
+			vcc_ErrWhere(tl, t_window);
 			return;
+		} else if (t_threshold != NULL && t_window == NULL) {
+			if (threshold > 64) {
+				vsb_printf(tl->sb,
+				    "Threshold must be 64 or less.\n");
+				vcc_ErrWhere(tl, t_threshold);
+				return;
+			}
+			window = threshold + 1;
+		} else if (window > 64) {
+			AN(t_window);
+			vsb_printf(tl->sb, "Window must be 64 or less.\n");
+			vcc_ErrWhere(tl, t_window);
+			return;
 		}
-		window = threshold + 1;
-	} else if (window > 64) {
-		AN(t_window);
-		vsb_printf(tl->sb, "Window must be 64 or less.\n");
-		vcc_ErrWhere(tl, t_window);
-		return;
+		if (threshold > window ) {
+			vsb_printf(tl->sb,
+			    "Threshold can not be greater than window.\n");
+			vcc_ErrWhere(tl, t_threshold);
+			AN(t_window);
+			vcc_ErrWhere(tl, t_window);
+		}
+		Fb(tl, 0, "\t\t.window = %u,\n", window);
+		Fb(tl, 0, "\t\t.threshold = %u\n", threshold);
 	}
-	if (threshold > window ) {
-		vsb_printf(tl->sb,
-		    "Threshold can not be greater than window.\n");
-		vcc_ErrWhere(tl, t_threshold);
-		AN(t_window);
-		vcc_ErrWhere(tl, t_window);
-	}
-	Fb(tl, 0, "\t\t.window = %u,\n", window);
-	Fb(tl, 0, "\t\t.threshold = %u\n", threshold);
 	Fb(tl, 0, "\t},\n");
 	ExpectErr(tl, '}');
 	vcc_NextToken(tl);




More information about the varnish-commit mailing list