r3057 - in trunk/varnish-cache: bin/varnishd include

phk at projects.linpro.no phk at projects.linpro.no
Fri Aug 1 12:50:36 CEST 2008


Author: phk
Date: 2008-08-01 12:50:36 +0200 (Fri, 01 Aug 2008)
New Revision: 3057

Modified:
   trunk/varnish-cache/bin/varnishd/cache_panic.c
   trunk/varnish-cache/include/libvarnish.h
Log:
Add WRONG(expl) macro for panicing from places we just shouldn't get to.

Dump the handling value from the last VCL method on panic



Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_panic.c	2008-08-01 10:06:56 UTC (rev 3056)
+++ trunk/varnish-cache/bin/varnishd/cache_panic.c	2008-08-01 10:50:36 UTC (rev 3057)
@@ -194,7 +194,7 @@
 static void
 pan_sess(const struct sess *sp)
 {
-	const char *stp;
+	const char *stp, *hand;
 
 	vsb_printf(vsp, "sp = %p {\n", sp);
 	vsb_printf(vsp,
@@ -210,10 +210,24 @@
 /*lint -restore */
 		default: stp = NULL;
 	}
+	switch (sp->handling) {
+/*lint -save -e525 */
+#define VCL_RET_MAC(l, u, b, v) case VCL_RET_##u: hand = #u; break;
+#define VCL_RET_MAC_E(l, u, b, v) case VCL_RET_##u: hand = #u; break;
+#include "vcl_returns.h"
+#undef VCL_RET_MAC
+#undef VCL_RET_MAC_E
+/*lint -restore */
+		default: stp = NULL;
+	}
 	if (stp != NULL)
 		vsb_printf(vsp, "  step = %s,\n", stp);
 	else
 		vsb_printf(vsp, "  step = 0x%x,\n", sp->step);
+	if (stp != NULL)
+		vsb_printf(vsp, "  handling = %s,\n", hand);
+	else
+		vsb_printf(vsp, "  handling = 0x%x,\n", sp->handling);
 	if (sp->err_code)
 		vsb_printf(vsp,
 		    "  err_code = %d, err_reason = %s,\n", sp->err_code,
@@ -247,6 +261,10 @@
 	const struct sess *sp;
 
 	switch(xxx) {
+	case 3:
+		vsb_printf(vsp,
+		    "Wrong turn:\n%s\n", cond);
+		break;
 	case 2:
 		vsb_printf(vsp,
 		    "Panic from VCL:\n%s\n", cond);

Modified: trunk/varnish-cache/include/libvarnish.h
===================================================================
--- trunk/varnish-cache/include/libvarnish.h	2008-08-01 10:06:56 UTC (rev 3056)
+++ trunk/varnish-cache/include/libvarnish.h	2008-08-01 10:50:36 UTC (rev 3057)
@@ -98,3 +98,7 @@
 #define XXXAZ(foo)	do { xxxassert((foo) == 0); } while (0)
 #define XXXAN(foo)	do { xxxassert((foo) != 0); } while (0)
 #define diagnostic(foo)	assert(foo)
+#define WRONG(expl) 							\
+do {									\
+	lbv_assert(__func__, __FILE__, __LINE__, expl, errno, 3);	\
+} while (0)




More information about the varnish-commit mailing list