Commit 19150844 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Give the busyobj a copy of req->digest, and move adding saintmode entries

to use busyobj.
parent d274585f
......@@ -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;
......
......@@ -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++;
......
......@@ -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 *);
......
......@@ -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);
......
......@@ -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());
}
/*--------------------------------------------------------------------*/
......
......@@ -295,7 +295,7 @@ sp_variables = (
'DURATION',
( ),
( 'backend_response',),
'cR'
'cB'
),
('beresp.status',
'INT',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment