[master] 95c563e Introduce the bereq.backend* variables.
Poul-Henning Kamp
phk at varnish-cache.org
Mon Apr 29 15:11:07 CEST 2013
commit 95c563e59c15536595969f8fe53b8b4cc9f17d5e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Apr 29 13:10:21 2013 +0000
Introduce the bereq.backend* variables.
NB: bereq.backend.healthy always fails right now.
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index 8060a50..9395c73 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -268,6 +268,50 @@ VRT_r_req_backend(const struct req *req)
return (req->director);
}
+unsigned
+VRT_r_req_backend_healthy(const struct req *req)
+{
+ CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+ /*
+ * XXX: Not optimal, but we do not have a backend in vcl_deliver
+ * XXX: and we have to return something.
+ */
+ if (req->director == NULL)
+ return (0);
+ CHECK_OBJ_NOTNULL(req->director, DIRECTOR_MAGIC);
+ return (VDI_Healthy(req->director, req));
+}
+
+/*--------------------------------------------------------------------*/
+
+void
+VRT_l_bereq_backend(struct busyobj *bo, struct director *be)
+{
+
+ CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+ AN(bo->director);
+ bo->director = be;
+}
+
+struct director *
+VRT_r_bereq_backend(const struct busyobj *bo)
+{
+
+ CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+ AN(bo->director);
+ return (bo->director);
+}
+
+unsigned
+VRT_r_bereq_backend_healthy(const struct busyobj *bo)
+{
+
+ CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+ CHECK_OBJ_NOTNULL(bo->director, DIRECTOR_MAGIC);
+ //XXX return (VDI_Healthy(bo->director, req));
+ return (0);
+}
+
/*--------------------------------------------------------------------*/
void
@@ -517,17 +561,3 @@ VRT_r_obj_uncacheable(const struct req *req)
CHECK_OBJ_NOTNULL(req->obj, OBJECT_MAGIC);
return (req->obj->objcore->flags & OC_F_PASS ? 1 : 0);
}
-
-unsigned
-VRT_r_req_backend_healthy(const struct req *req)
-{
- CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
- /*
- * XXX: Not optimal, but we do not have a backend in vcl_deliver
- * XXX: and we have to return something.
- */
- if (req->director == NULL)
- return (0);
- CHECK_OBJ_NOTNULL(req->director, DIRECTOR_MAGIC);
- return (VDI_Healthy(req->director, req));
-}
diff --git a/lib/libvcl/generate.py b/lib/libvcl/generate.py
index a346767..bd5e6ab 100755
--- a/lib/libvcl/generate.py
+++ b/lib/libvcl/generate.py
@@ -165,12 +165,6 @@ sp_variables = (
( 'proc',),
'cR'
),
- ('req.backend',
- 'BACKEND',
- ( 'proc',),
- ( 'proc',),
- 'R'
- ),
('req.restarts',
'INT',
( 'proc',),
@@ -219,6 +213,12 @@ sp_variables = (
( ),
'R'
),
+ ('req.backend',
+ 'BACKEND',
+ ( 'proc',),
+ ( 'proc',),
+ 'R'
+ ),
('req.backend.healthy',
'BOOL',
( 'proc',),
@@ -237,6 +237,18 @@ sp_variables = (
( 'recv',),
'R'
),
+ ('bereq.backend',
+ 'BACKEND',
+ ( 'backend_fetch', 'backend_response'),
+ ( 'backend_fetch', 'backend_response'),
+ 'B'
+ ),
+ ('bereq.backend.healthy',
+ 'BOOL',
+ ( 'backend_fetch', 'backend_response'),
+ ( ),
+ 'B'
+ ),
('bereq.method',
'STRING',
( 'pipe', 'backend_fetch', 'pass', 'miss', 'backend_response',),
More information about the varnish-commit
mailing list