r4471 - in trunk/varnish-cache: bin/varnishd include lib/libvarnish
phk at projects.linpro.no
phk at projects.linpro.no
Mon Jan 18 22:28:20 CET 2010
Author: phk
Date: 2010-01-18 22:28:19 +0100 (Mon, 18 Jan 2010)
New Revision: 4471
Modified:
trunk/varnish-cache/bin/varnishd/cache_cli.c
trunk/varnish-cache/include/cli_common.h
trunk/varnish-cache/lib/libvarnish/cli_serve.c
Log:
Add the unadultered cli command to struct cli, and make the default
"before" callback arg be the cli struct like the "after" callback.
Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_cli.c 2010-01-18 21:07:41 UTC (rev 4470)
+++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2010-01-18 21:28:19 UTC (rev 4471)
@@ -96,8 +96,10 @@
static void
cli_cb_before(void *priv)
{
+ struct cli *cli;
- VSL(SLT_CLI, 0, "Rd %s", priv);
+ cli = priv;
+ VSL(SLT_CLI, 0, "Rd %s", cli->cmd);
VCL_Poll();
VBE_Poll();
Lck_Lock(&cli_mtx);
Modified: trunk/varnish-cache/include/cli_common.h
===================================================================
--- trunk/varnish-cache/include/cli_common.h 2010-01-18 21:07:41 UTC (rev 4470)
+++ trunk/varnish-cache/include/cli_common.h 2010-01-18 21:28:19 UTC (rev 4471)
@@ -34,6 +34,7 @@
struct vsb *sb;
enum cli_status_e result;
void *priv;
+ const char *cmd;
};
int cli_writeres(int fd, const struct cli *cli);
Modified: trunk/varnish-cache/lib/libvarnish/cli_serve.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/cli_serve.c 2010-01-18 21:07:41 UTC (rev 4470)
+++ trunk/varnish-cache/lib/libvarnish/cli_serve.c 2010-01-18 21:28:19 UTC (rev 4471)
@@ -92,8 +92,9 @@
cs = cfd->cls;
CHECK_OBJ_NOTNULL(cs, CLS_MAGIC);
+ cfd->cli->cmd = p;
if (cs->before != NULL)
- cs->before(cs->priv != NULL ? cs->priv : (void*)(uintptr_t)p);
+ cs->before(cs->priv != NULL ? cs->priv : cfd->cli);
VTAILQ_FOREACH(cfn, &cs->funcs, list) {
vsb_clear(cfd->cli->sb);
cfd->cli->result = CLIS_OK;
@@ -107,6 +108,7 @@
cs->after(cs->priv != NULL ? cs->priv : cfd->cli);
if (cli_writeres(cfd->fdo, cfd->cli) || cfd->cli->result == CLIS_CLOSE)
return (1);
+ cfd->cli->cmd = NULL;
return (0);
}
More information about the varnish-commit
mailing list