Mailing List Archive

r2530 - trunk/varnish-cache/bin/varnishd
Author: phk
Date: 2008-02-23 20:26:38 +0100 (Sat, 23 Feb 2008)
New Revision: 2530

Modified:
trunk/varnish-cache/bin/varnishd/cache.h
trunk/varnish-cache/bin/varnishd/cache_expire.c
trunk/varnish-cache/bin/varnishd/cache_hash.c
trunk/varnish-cache/bin/varnishd/cache_vrt.c
Log:
Rename EXP_TTLchange() to EXP_Rearm() and move binheap check into
cache_expire.c.


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2008-02-23 19:15:23 UTC (rev 2529)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2008-02-23 19:26:38 UTC (rev 2530)
@@ -439,7 +439,7 @@
/* cache_expiry.c */
void EXP_Insert(struct object *o);
void EXP_Init(void);
-void EXP_TTLchange(struct object *o);
+void EXP_Rearm(struct object *o);
void EXP_Touch(struct object *o, double now);
int EXP_NukeOne(struct sess *sp);


Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c 2008-02-23 19:15:23 UTC (rev 2529)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2008-02-23 19:26:38 UTC (rev 2530)
@@ -115,10 +115,21 @@
}
}

+/*--------------------------------------------------------------------
+ * We have changed one or more of the object timers, shuffle it
+ * accordingly in the binheap
+ *
+ * The VCL code can send us here on a non-cached object, just return.
+ *
+ * XXX: special case check for ttl = 0 ?
+ */
+
void
-EXP_TTLchange(struct object *o)
+EXP_Rearm(struct object *o)
{

+ if (o->timer_idx == 0)
+ return;
LOCK(&exp_mtx);
if (o->timer_idx != lru_target) {
assert(o->timer_idx != 0); /* XXX: symbolic zero ? */

Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-02-23 19:15:23 UTC (rev 2529)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-02-23 19:26:38 UTC (rev 2530)
@@ -210,8 +210,7 @@
if (BAN_CheckObject(o, h->hd[HTTP_HDR_URL].b, oh->hash)) {
o->ttl = 0;
WSP(sp, SLT_ExpBan, "%u was banned", o->xid);
- if (o->timer_idx != 0)
- EXP_TTLchange(o);
+ EXP_Rearm(o);
continue;
}
if (o->vary != NULL && !VRY_Match(sp, o->vary))

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-02-23 19:15:23 UTC (rev 2529)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-02-23 19:26:38 UTC (rev 2530)
@@ -293,8 +293,7 @@
if (a < 0)
a = 0;
sp->obj->ttl = sp->t_req + a;
- if (sp->obj->timer_idx != 0)
- EXP_TTLchange(sp->obj);
+ EXP_Rearm(sp->obj);
}

double
@@ -318,8 +317,7 @@
if (a < 0)
a = 0;
sp->obj->grace = a;
- if (sp->obj->timer_idx != 0)
- EXP_TTLchange(sp->obj);
+ EXP_Rearm(sp->obj);
}

double
@@ -355,8 +353,7 @@
WSL(sp->wrk, SLT_VCL_info, sp->id,
"XID %u: obj.prefetch (%g) less than ttl (%g), ignored.",
sp->obj->xid, a, sp->obj->ttl - sp->t_req);
- if (sp->obj->timer_idx != 0)
- EXP_TTLchange(sp->obj);
+ EXP_Rearm(sp->obj);
}

double