]> err.no Git - varnish/commitdiff
The cachers CLI thread is responsible for garbage collecting dicarded
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 9 Jul 2008 08:56:46 +0000 (08:56 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 9 Jul 2008 08:56:46 +0000 (08:56 +0000)
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: svn+ssh://projects.linpro.no/svn/varnish/trunk@2908 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_cli.c
varnish-cache/bin/varnishd/cache_vcl.c

index 7df47fe3110f88d191a2584ae844c4f292fb4cb4..518d2dde521edc385cac5f4f932422d523cc7701 100644 (file)
@@ -577,7 +577,7 @@ void VCL_Init(void);
 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 *);
index 4924d702074777978d52b500bc31644d22fa66c0..ddd928add045a6f5c4be09a3ab10bbe9d61248c5 100644 (file)
@@ -102,6 +102,7 @@ cli_vlu(void *priv, const char *p)
 
        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 @@ CLI_Run(void)
        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");
index e5d65340b0e6b8b05f9326176de9f01822e65121..491f4921fd85a94b877497b6634a11c3259fcf71 100644 (file)
@@ -105,7 +105,7 @@ VCL_Rel(struct VCL_conf **vcc)
        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 @@ VCL_Nuke(struct vcls *vcl)
 /*--------------------------------------------------------------------*/
 
 void
-VCL_Idle(void)
+VCL_Poll(void)
 {
        struct vcls *vcl, *vcl2;