From: phk Date: Tue, 17 Jun 2008 20:46:29 +0000 (+0000) Subject: Add a debug.xid CLI command to the child process that allows us to X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efcdcb62bd4052938bf617482ee1156ed13a0850;p=varnish 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. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2732 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_center.c b/varnish-cache/bin/varnishd/cache_center.c index d549ebdc..61d76333 100644 --- a/varnish-cache/bin/varnishd/cache_center.c +++ b/varnish-cache/bin/varnishd/cache_center.c @@ -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); } + +