r2535 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Sat Feb 23 20:58:05 CET 2008


Author: phk
Date: 2008-02-23 20:58:04 +0100 (Sat, 23 Feb 2008)
New Revision: 2535

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
Log:
Fix obj.last_use:  We cannot use obj.lru_stamp, as that is only updated
when we shuffle the LRU list.


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2008-02-23 19:54:44 UTC (rev 2534)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2008-02-23 19:58:04 UTC (rev 2535)
@@ -275,6 +275,7 @@
 	VTAILQ_HEAD(, esi_bit)	esibits;
 
 	double			lru_stamp;
+	double			last_use;
 
 	/* Prefetch */
 	struct object		*parent;

Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2008-02-23 19:54:44 UTC (rev 2534)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2008-02-23 19:58:04 UTC (rev 2535)
@@ -151,8 +151,10 @@
 	CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
 
 	sp->t_resp = TIM_real();
-	if (sp->obj->objhead != NULL)
+	if (sp->obj->objhead != NULL) {
+		sp->obj->last_use = sp->t_resp;	/* XXX: locking ? */
 		EXP_Touch(sp->obj, sp->t_resp);
+	}
 	RES_BuildHttp(sp);
 	VCL_deliver_method(sp);
 	switch (sp->handling) {

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2008-02-23 19:54:44 UTC (rev 2534)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2008-02-23 19:58:04 UTC (rev 2535)
@@ -535,7 +535,7 @@
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);	/* XXX */
-	return (TIM_real() - sp->obj->lru_stamp);
+	return (TIM_real() - sp->obj->last_use);
 }
 
 int




More information about the varnish-commit mailing list