Commit 4b87b41b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add the unadultered cli command to struct cli, and make the default

"before" callback arg be the cli struct like the "after" callback.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4471 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 5c279deb
......@@ -96,8 +96,10 @@ CLI_AddFuncs(enum cli_set_e which, struct cli_proto *p)
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);
......
......@@ -34,6 +34,7 @@ struct cli {
struct vsb *sb;
enum cli_status_e result;
void *priv;
const char *cmd;
};
int cli_writeres(int fd, const struct cli *cli);
......
......@@ -92,8 +92,9 @@ cls_vlu(void *priv, const char *p)
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 @@ cls_vlu(void *priv, const char *p)
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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment