r2895 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Jul 8 00:11:39 CEST 2008


Author: phk
Date: 2008-07-08 00:11:39 +0200 (Tue, 08 Jul 2008)
New Revision: 2895

Modified:
   trunk/varnish-cache/bin/varnishd/cache_backend.c
Log:
Dismantle directors and backends properly.



Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2008-07-07 21:49:21 UTC (rev 2894)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2008-07-07 22:11:39 UTC (rev 2895)
@@ -664,19 +664,45 @@
 VRT_fini_dir(struct cli *cli, struct director *b)
 {
 
+	(void)cli;
 	ASSERT_CLI();
-#if 0
-	VBE_DropRef(b);	
-#else
-	(void)b;
-	(void)cli;
-#endif
+	CHECK_OBJ_NOTNULL(b, DIRECTOR_MAGIC);
+	b->fini(b);
 }
+
 /*--------------------------------------------------------------------*/
 
+static void
+cli_debug_backend(struct cli *cli, const char * const *av, void *priv)
+{
+	struct backend *b;
+
+	(void)av;
+	(void)priv;
+	ASSERT_CLI();
+	VTAILQ_FOREACH(b, &backends, list) {
+		CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC);
+		cli_out(cli, "%p %s/%s/%s %d\n",
+		    b,
+		    b->vrt->vcl_name,
+		    b->vrt->hostname,
+		    b->vrt->portname,
+		    b->refcount);
+	}
+}
+
+static struct cli_proto debug_cmds[] = {
+	{ "debug.backend", "debug.backend",
+	    "\tExamine Backend internals\n", 0, 0, cli_debug_backend },
+	{ NULL }
+};
+
+/*--------------------------------------------------------------------*/
+
 void
 VBE_Init(void)
 {
 
 	MTX_INIT(&VBE_mtx);
+	CLI_AddFuncs(DEBUG_CLI, debug_cmds);
 }




More information about the varnish-commit mailing list