r2908 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Wed Jul 9 10:56:47 CEST 2008
Author: phk
Date: 2008-07-09 10:56:46 +0200 (Wed, 09 Jul 2008)
New Revision: 2908
Modified:
trunk/varnish-cache/bin/varnishd/cache.h
trunk/varnish-cache/bin/varnishd/cache_cli.c
trunk/varnish-cache/bin/varnishd/cache_vcl.c
Log:
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.
Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2008-07-09 08:14:25 UTC (rev 2907)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2008-07-09 08:56:46 UTC (rev 2908)
@@ -577,7 +577,7 @@
void VCL_Refresh(struct VCL_conf **vcc);
void VCL_Rel(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_MET_MAC(l,u,b) void VCL_##l##_method(struct sess *);
Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-07-09 08:14:25 UTC (rev 2907)
+++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-07-09 08:56:46 UTC (rev 2908)
@@ -102,6 +102,7 @@
cli = priv;
VSL(SLT_CLI, 0, "Rd %s", p);
+ VCL_Poll();
vsb_clear(cli->sb);
LOCK(&cli_mtx);
cli_dispatch(cli, ccf_master_cli, p);
@@ -150,11 +151,8 @@
while (1) {
pfd[0].fd = heritage.cli_in;
pfd[0].events = POLLIN;
- i = poll(pfd, 1, 5000);
- if (i == 0) {
- VCL_Idle();
- continue;
- }
+ i = poll(pfd, 1, INFTIM);
+ assert(i == 1);
if (pfd[0].revents & POLLHUP) {
fprintf(stderr,
"EOF on CLI connection, exiting\n");
Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-07-09 08:14:25 UTC (rev 2907)
+++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-07-09 08:56:46 UTC (rev 2908)
@@ -105,7 +105,7 @@
vc->busy--;
/*
* 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);
}
@@ -198,7 +198,7 @@
/*--------------------------------------------------------------------*/
void
-VCL_Idle(void)
+VCL_Poll(void)
{
struct vcls *vcl, *vcl2;
More information about the varnish-commit
mailing list