[master] 530eaf0 De-generalize resp.backend.ip. In the future backends may not have IP numbers.
Poul-Henning Kamp
phk at FreeBSD.org
Wed Jan 7 11:24:56 CET 2015
commit 530eaf02b7ce14086dec995525f55065ab1b13ce
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Jan 7 10:22:55 2015 +0000
De-generalize resp.backend.ip. In the future backends may not have
IP numbers.
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 4dda66b..226f420 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -480,19 +480,6 @@ vbe_dir_getbody(const struct director *d, struct worker *wrk,
return (0);
}
-static struct suckaddr * __match_proto__(vdi_suckaddr_f)
-vbe_dir_suckaddr(const struct director *d, struct worker *wrk,
- struct busyobj *bo)
-{
- CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
- CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
- CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-
- if (bo->htc->vbc != NULL)
- return(bo->htc->vbc->addr);
- return (NULL);
-}
-
/*--------------------------------------------------------------------*/
void
@@ -534,7 +521,6 @@ VRT_init_vbe(VRT_CTX, struct director **bp, int idx,
vs->dir.gethdrs = vbe_dir_gethdrs;
vs->dir.getbody = vbe_dir_getbody;
vs->dir.finish = vbe_dir_finish;
- vs->dir.suckaddr = vbe_dir_suckaddr;
vs->vrt = t;
diff --git a/bin/varnishd/cache/cache_director.c b/bin/varnishd/cache/cache_director.c
index 3a1961a..13a25c9 100644
--- a/bin/varnishd/cache/cache_director.c
+++ b/bin/varnishd/cache/cache_director.c
@@ -152,16 +152,3 @@ VDI_Healthy(const struct director *d, const struct busyobj *bo)
AN(d->healthy);
return (d->healthy(d, bo, NULL));
}
-
-/* Get suckaddr ------------------------------------------------------*/
-
-struct suckaddr *
-VDI_Suckaddr(const struct director *d, struct worker *wrk, struct busyobj *bo)
-{
- CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
- CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
- CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
-
- AN(d->suckaddr);
- return (d->suckaddr(d, wrk, bo));
-}
diff --git a/bin/varnishd/cache/cache_director.h b/bin/varnishd/cache/cache_director.h
index e904686..7941213 100644
--- a/bin/varnishd/cache/cache_director.h
+++ b/bin/varnishd/cache/cache_director.h
@@ -53,8 +53,6 @@ typedef int vdi_getbody_f(const struct director *, struct worker *,
struct busyobj *);
typedef void vdi_finish_f(const struct director *, struct worker *,
struct busyobj *);
-typedef struct suckaddr *vdi_suckaddr_f(const struct director *,
- struct worker *, struct busyobj *);
struct director {
unsigned magic;
@@ -67,7 +65,6 @@ struct director {
vdi_gethdrs_f *gethdrs;
vdi_getbody_f *getbody;
vdi_finish_f *finish;
- vdi_suckaddr_f *suckaddr;
void *priv;
};
@@ -79,8 +76,6 @@ void VDI_Finish(const struct director *d, struct worker *wrk,
struct busyobj *bo);
int VDI_GetFd(const struct director *d, struct worker *wrk, struct busyobj *);
int VDI_Healthy(const struct director *, const struct busyobj *);
-struct suckaddr *VDI_Suckaddr(const struct director *d, struct worker *wrk,
- struct busyobj *bo);
void VDI_AddHostHeader(struct http *to, const struct vbc *vbc);
void VBE_Init(void);
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index 845eb99..e4007c2 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -305,13 +305,21 @@ VRT_r_beresp_backend_name(VRT_CTX)
return (NULL);
}
+/*--------------------------------------------------------------------
+ * Backends do not in general have a IP number (any more) and this
+ * variable is really not about the backend, but the backend connection.
+ * XXX: we may need a more general beresp.backend.{details|ident}
+ */
+
VCL_IP
VRT_r_beresp_backend_ip(VRT_CTX)
{
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
- return (VDI_Suckaddr(ctx->bo->director_resp, ctx->bo->wrk, ctx->bo));
+ if (ctx->bo->htc != NULL && ctx->bo->htc->vbc != NULL)
+ return(ctx->bo->htc->vbc->addr);
+ return (NULL);
}
/*--------------------------------------------------------------------*/
More information about the varnish-commit
mailing list