]> err.no Git - varnish/commitdiff
Add a debug.xid CLI command to the child process that allows us to
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 17 Jun 2008 20:46:29 +0000 (20:46 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 17 Jun 2008 20:46:29 +0000 (20:46 +0000)
inspect and change the XID counter.

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

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2732 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_center.c

index d549ebdc956b18f24b37cf0a86f5ec19617c5d20..61d76333d6d641302a00a908ac7e6020d8e41b4f 100644 (file)
@@ -72,6 +72,8 @@ DOT acceptor -> start [style=bold,color=green,weight=4]
 
 #include "shmlog.h"
 #include "vcl.h"
+#include "cli.h"
+#include "cli_priv.h"
 #include "cache.h"
 
 static unsigned xids;
@@ -966,10 +968,36 @@ CNT_Session(struct sess *sp)
 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);
 }
+
+