From b130ad94d067ad3a4a221660b016dea69886cda0 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 7 Jul 2008 22:11:39 +0000 Subject: [PATCH] Dismantle directors and backends properly. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2895 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_backend.c | 38 ++++++++++++++++++---- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_backend.c b/varnish-cache/bin/varnishd/cache_backend.c index 7338e65b..0a17b604 100644 --- a/varnish-cache/bin/varnishd/cache_backend.c +++ b/varnish-cache/bin/varnishd/cache_backend.c @@ -664,14 +664,39 @@ void VRT_fini_dir(struct cli *cli, struct director *b) { - ASSERT_CLI(); -#if 0 - VBE_DropRef(b); -#else - (void)b; (void)cli; -#endif + ASSERT_CLI(); + 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 @@ -679,4 +704,5 @@ VBE_Init(void) { MTX_INIT(&VBE_mtx); + CLI_AddFuncs(DEBUG_CLI, debug_cmds); } -- 2.39.5