r2732 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Jun 17 22:46:29 CEST 2008


Author: phk
Date: 2008-06-17 22:46:29 +0200 (Tue, 17 Jun 2008)
New Revision: 2732

Modified:
   trunk/varnish-cache/bin/varnishd/cache_center.c
Log:
Add a debug.xid CLI command to the child process that allows us to
inspect and change the XID counter.

This will allow varnishtester to test XID headers for correct behaviour.



Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2008-06-17 20:35:45 UTC (rev 2731)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2008-06-17 20:46:29 UTC (rev 2732)
@@ -72,6 +72,8 @@
 
 #include "shmlog.h"
 #include "vcl.h"
+#include "cli.h"
+#include "cli_priv.h"
 #include "cache.h"
 
 static unsigned xids;
@@ -966,10 +968,36 @@
 DOT }
 */
 
+/*--------------------------------------------------------------------
+ * Debugging aids
+ */
+
+static void
+cli_debug_xid(struct cli *cli, const char * const *av, void *priv)
+{
+        (void)priv;
+	if (av[2] != NULL) 
+		xids = strtoul(av[2], NULL, 0);
+	cli_out(cli, "XID is %u\n", xids);
+}
+
+static struct cli_proto debug_cmds[] = {
+	{ "debug.xid", "debug.xid",
+		"\tExamine or set XID\n", 0, 1, cli_debug_xid },
+	{ NULL }
+};
+
+/*--------------------------------------------------------------------
+ *
+ */
+
 void
 CNT_Init(void)
 {
 
 	srandomdev();
 	xids = random();
+	CLI_AddFuncs(DEBUG_CLI, debug_cmds);
 }
+
+




More information about the varnish-commit mailing list