Commit da8aeae2 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

The cachers CLI thread is responsible for garbage collecting dicarded

VCL programs, but in practice it didn't happen because we fired the
GC function VCL_Idle() after 5 seconds of silence on the CLI port and
the manager pings every three (by default).

Instead change the name of VCL_Idle() to VCL_Poll() and call it
before every CLI command, so that any query command will get an
up to date status.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2908 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 0b6d3018
...@@ -577,7 +577,7 @@ void VCL_Init(void); ...@@ -577,7 +577,7 @@ void VCL_Init(void);
void VCL_Refresh(struct VCL_conf **vcc); void VCL_Refresh(struct VCL_conf **vcc);
void VCL_Rel(struct VCL_conf **vcc); void VCL_Rel(struct VCL_conf **vcc);
void VCL_Get(struct VCL_conf **vcc); void VCL_Get(struct VCL_conf **vcc);
void VCL_Idle(void); void VCL_Poll(void);
#define VCL_RET_MAC(l,u,b,n) #define VCL_RET_MAC(l,u,b,n)
#define VCL_MET_MAC(l,u,b) void VCL_##l##_method(struct sess *); #define VCL_MET_MAC(l,u,b) void VCL_##l##_method(struct sess *);
......
...@@ -102,6 +102,7 @@ cli_vlu(void *priv, const char *p) ...@@ -102,6 +102,7 @@ cli_vlu(void *priv, const char *p)
cli = priv; cli = priv;
VSL(SLT_CLI, 0, "Rd %s", p); VSL(SLT_CLI, 0, "Rd %s", p);
VCL_Poll();
vsb_clear(cli->sb); vsb_clear(cli->sb);
LOCK(&cli_mtx); LOCK(&cli_mtx);
cli_dispatch(cli, ccf_master_cli, p); cli_dispatch(cli, ccf_master_cli, p);
...@@ -150,11 +151,8 @@ CLI_Run(void) ...@@ -150,11 +151,8 @@ CLI_Run(void)
while (1) { while (1) {
pfd[0].fd = heritage.cli_in; pfd[0].fd = heritage.cli_in;
pfd[0].events = POLLIN; pfd[0].events = POLLIN;
i = poll(pfd, 1, 5000); i = poll(pfd, 1, INFTIM);
if (i == 0) { assert(i == 1);
VCL_Idle();
continue;
}
if (pfd[0].revents & POLLHUP) { if (pfd[0].revents & POLLHUP) {
fprintf(stderr, fprintf(stderr,
"EOF on CLI connection, exiting\n"); "EOF on CLI connection, exiting\n");
......
...@@ -105,7 +105,7 @@ VCL_Rel(struct VCL_conf **vcc) ...@@ -105,7 +105,7 @@ VCL_Rel(struct VCL_conf **vcc)
vc->busy--; vc->busy--;
/* /*
* We do not garbage collect discarded VCL's here, that happens * We do not garbage collect discarded VCL's here, that happens
* in VCL_Idle() which is called from the CLI thread. * in VCL_Poll() which is called from the CLI thread.
*/ */
UNLOCK(&vcl_mtx); UNLOCK(&vcl_mtx);
} }
...@@ -198,7 +198,7 @@ VCL_Nuke(struct vcls *vcl) ...@@ -198,7 +198,7 @@ VCL_Nuke(struct vcls *vcl)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
void void
VCL_Idle(void) VCL_Poll(void)
{ {
struct vcls *vcl, *vcl2; struct vcls *vcl, *vcl2;
......
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