[master] 1915084 Give the busyobj a copy of req->digest, and move adding saintmode entries to use busyobj.
Poul-Henning Kamp
phk at varnish-cache.org
Mon Apr 29 10:16:43 CEST 2013
commit 19150844249c856daca1e66a4a2496fef11b3e67
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Apr 29 08:16:20 2013 +0000
Give the busyobj a copy of req->digest, and move adding saintmode entries
to use busyobj.
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 232e2f1..b15eaba 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -516,6 +516,7 @@ struct busyobj {
struct http *bereq;
struct http *beresp;
struct object *fetch_obj;
+ unsigned char digest[DIGEST_LEN];
struct exp exp;
struct http_conn htc;
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index e0f9348..3b1636b 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -228,27 +228,24 @@ vbe_NewConn(void)
*/
void
-VBE_AddTrouble(const struct req *req, double dt)
+VBE_AddTrouble(const struct busyobj *bo, double expires)
{
struct trouble *tp;
struct vbc *vbc;
struct backend *be;
- CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
- CHECK_OBJ_NOTNULL(req->busyobj, BUSYOBJ_MAGIC);
- vbc = req->busyobj->vbc;
+ CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+ vbc = bo->vbc;
if (vbc == NULL)
return;
CHECK_OBJ_NOTNULL(vbc, VBC_MAGIC);
be = vbc->backend;
CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC);
- if (dt <= 0.)
- return;
ALLOC_OBJ(tp, TROUBLE_MAGIC);
if (tp == NULL)
return;
- memcpy(tp->digest, req->digest, sizeof tp->digest);
- tp->timeout = req->t_req + dt;
+ memcpy(tp->digest, bo->digest, sizeof tp->digest);
+ tp->timeout = expires;
Lck_Lock(&vbc->backend->mtx);
VTAILQ_INSERT_HEAD(&be->troublelist, tp, list);
be->n_trouble++;
diff --git a/bin/varnishd/cache/cache_backend.h b/bin/varnishd/cache/cache_backend.h
index 670fcf8..a291604 100644
--- a/bin/varnishd/cache/cache_backend.h
+++ b/bin/varnishd/cache/cache_backend.h
@@ -169,7 +169,7 @@ struct vbc {
/* cache_backend.c */
void VBE_ReleaseConn(struct vbc *vc);
-void VBE_AddTrouble(const struct req *req, double dt);
+void VBE_AddTrouble(const struct busyobj *, double expires);
/* cache_backend_cfg.c */
void VBE_DropRefConn(struct backend *);
diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index dfda90f..9131cd0 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -137,6 +137,8 @@ VBO_GetBusyObj(struct worker *wrk, struct req *req)
WS_Init(bo->ws, "bo", p, bo->end - p);
+ memcpy(bo->digest, req->digest, sizeof bo->digest);
+
bo->do_stream = 1;
return (bo);
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index 4621695..aa16783 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -391,10 +391,11 @@ VRT_BOOL_string(unsigned val)
*/
void
-VRT_l_beresp_saintmode(const struct req *req, double a)
+VRT_l_beresp_saintmode(const struct busyobj *bo, double a)
{
- VBE_AddTrouble(req, a);
+ if (a > 0.)
+ VBE_AddTrouble(bo, a + VTIM_real());
}
/*--------------------------------------------------------------------*/
diff --git a/lib/libvcl/generate.py b/lib/libvcl/generate.py
index c68d60f..a346767 100755
--- a/lib/libvcl/generate.py
+++ b/lib/libvcl/generate.py
@@ -295,7 +295,7 @@ sp_variables = (
'DURATION',
( ),
( 'backend_response',),
- 'cR'
+ 'cB'
),
('beresp.status',
'INT',
More information about the varnish-commit
mailing list