This is needed if a director (like the dns director) needs a closer look at each backend to determine which to use. IE: Look at the IP or similar.
PS: It seems a bit wrong to expose vdi_simple_SOMETHING directly, but it
also seemed strange to do VBE_Something. More semantics than anything,
though.
---
varnish-cache/bin/varnishd/cache.h | 1 +
varnish-cache/bin/varnishd/cache_backend.c | 14 ++++++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/varnish-cache/bin/varnishd/cache.h
b/varnish-cache/bin/varnishd/cache.h
index 2561a0d..35e286d 100644
--- a/varnish-cache/bin/varnishd/cache.h
+++ b/varnish-cache/bin/varnishd/cache.h
@@ -464,6 +464,7 @@ void VBE_ClosedFd(struct sess *sp);
void VBE_RecycleFd(struct sess *sp);
void VBE_AddHostHeader(const struct sess *sp);
void VBE_Poll(void);
+struct backend *vdi_simple_get_backend(const struct director *d);
/* cache_backend_cfg.c */
void VBE_Init(void);
diff --git a/varnish-cache/bin/varnishd/cache_backend.c
b/varnish-cache/bin/varnishd/cache_backend.c
index ed35fec..a0c54c6 100644
--- a/varnish-cache/bin/varnishd/cache_backend.c
+++ b/varnish-cache/bin/varnishd/cache_backend.c
@@ -498,6 +498,20 @@ vdi_simple_healthy(double now, const struct director *d,
uintptr_t target)
return (vbe_Healthy(now, target, vs->backend));
}
+/* Reveals the real backend of a simple director if needed. */
+struct backend *
+vdi_simple_get_backend(const struct director *d)
+{
+ CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
+ struct vdi_simple *vs, *vs2;
+
+ vs2 = d->priv;
+ if (vs2->magic != VDI_SIMPLE_MAGIC)
+ return NULL;
+ CAST_OBJ_NOTNULL(vs, d->priv, VDI_SIMPLE_MAGIC);
+ return vs->backend;
+}
+
/*lint -e{818} not const-able */
static void
vdi_simple_fini(struct director *d)
--
1.5.4.3
pgpaCIemaG4hs.pgp
Description: PGP signature
_______________________________________________ varnish-dev mailing list [email protected] http://lists.varnish-cache.org/mailman/listinfo/varnish-dev
