Commit 8070f329 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make EXP_Ttl() take a pointer to struct exp rather than struct object

parent d299d768
......@@ -928,7 +928,7 @@ extern pthread_t cli_thread;
/* cache_expiry.c */
void EXP_Clr(struct exp *e);
double EXP_Ttl(const struct req *, const struct object*);
double EXP_Ttl(const struct req *, const struct exp*);
double EXP_When(const struct exp *exp);
void EXP_Insert(struct objcore *oc);
void EXP_Inject(struct objcore *oc, struct lru *lru, double when);
......
......@@ -76,14 +76,14 @@ EXP_Clr(struct exp *e)
*/
double
EXP_Ttl(const struct req *req, const struct object *o)
EXP_Ttl(const struct req *req, const struct exp *e)
{
double r;
r = o->exp.ttl;
r = e->ttl;
if (req != NULL && req->d_ttl > 0. && req->d_ttl < r)
r = req->d_ttl;
return (o->exp.t_origin + r);
return (e->t_origin + r);
}
/*--------------------------------------------------------------------
......@@ -468,7 +468,7 @@ exp_expire(struct exp_priv *ep, double now)
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
VSLb(&ep->vsl, SLT_ExpKill, "EXP_Expired x=%u t=%.0f",
oc_getxid(&ep->wrk->stats, oc) & VSL_IDENTMASK,
EXP_Ttl(NULL, o) - now);
EXP_Ttl(NULL, &o->exp) - now);
(void)HSH_DerefObjCore(&ep->wrk->stats, &oc);
return (0);
}
......
......@@ -430,7 +430,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
if (o->vary != NULL && !VRY_Match(req, o->vary))
continue;
if (EXP_Ttl(req, o) >= req->t_req) {
if (EXP_Ttl(req, &o->exp) >= req->t_req) {
/* If still valid, use it */
assert(oh->refcnt > 1);
assert(oc->objhead == oh);
......
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