[master] da08539 Change EXP_Ttl() to take objcore argument.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Feb 9 01:19:12 CET 2016
commit da0853992588103b55df646c453f3592b0cd80ee
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Feb 8 22:27:19 2016 +0000
Change EXP_Ttl() to take objcore argument.
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 7ca3eb7..387aa01 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -721,7 +721,7 @@ extern pthread_t cli_thread;
#define EXP_WHEN(to) \
((to)->t_origin + (to)->ttl + (to)->grace + (to)->keep)
-double EXP_Ttl(const struct req *, const struct exp*);
+double EXP_Ttl(const struct req *, const struct objcore *);
void EXP_Insert(struct worker *wrk, struct objcore *oc);
void EXP_Rearm(struct objcore *, double now, double ttl, double grace,
double keep);
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 10f5f82..590bc02 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -92,14 +92,16 @@ exp_event(struct worker *wrk, struct objcore *oc, enum exp_event_e e)
*/
double
-EXP_Ttl(const struct req *req, const struct exp *e)
+EXP_Ttl(const struct req *req, const struct objcore *oc)
{
double r;
- r = e->ttl;
+ CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
+
+ r = oc->exp.ttl;
if (req != NULL && req->d_ttl > 0. && req->d_ttl < r)
r = req->d_ttl;
- return (e->t_origin + r);
+ return (oc->exp.t_origin + r);
}
/*--------------------------------------------------------------------
@@ -334,7 +336,7 @@ exp_expire(struct exp_priv *ep, double now)
CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC);
VSLb(&ep->vsl, SLT_ExpKill, "EXP_Expired x=%u t=%.0f",
- ObjGetXID(ep->wrk, oc), EXP_Ttl(NULL, &oc->exp) - now);
+ ObjGetXID(ep->wrk, oc), EXP_Ttl(NULL, oc) - now);
exp_event(ep->wrk, oc, EXP_REMOVE);
(void)HSH_DerefObjCore(ep->wrk, &oc);
return (0);
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index d58e070..a8f438b 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -406,7 +406,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
continue;
}
- if (EXP_Ttl(req, &oc->exp) >= req->t_req) {
+ if (EXP_Ttl(req, oc) >= req->t_req) {
/* If still valid, use it */
assert(oh->refcnt > 1);
assert(oc->objhead == oh);
More information about the varnish-commit
mailing list