[master] 8070f32 Make EXP_Ttl() take a pointer to struct exp rather than struct object
Poul-Henning Kamp
phk at FreeBSD.org
Thu Jun 26 17:03:03 CEST 2014
commit 8070f32925bd01fd8543f0826d5ff477883c53b8
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Jun 26 10:32:53 2014 +0000
Make EXP_Ttl() take a pointer to struct exp rather than struct object
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 3721d06..60d7b26 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -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);
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 9ae6558..bbb19a3 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -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);
}
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 66fe0d5..d6e404c 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -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);
More information about the varnish-commit
mailing list