r551 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Fri Jul 21 23:28:51 CEST 2006


Author: phk
Date: 2006-07-21 23:28:51 +0200 (Fri, 21 Jul 2006)
New Revision: 551

Modified:
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
   trunk/varnish-cache/bin/varnishd/rfc2616.c
Log:
Implement TTL adjustment from VCL

Log in shmem where the TTL came from (doc-candidate):

	696613561 RFC 900 1153517009 1153517014 1153517914 900 0
        |         |   |   |          |          |          |   |
        |         |   |   |          |          |          |   age
        |         |   |   |          |          |          max-age
        |         |   |   |          |          Expires: header
        |         |   |   |          Date: header
        |         |   |   "now"
        |         |   TTL relative to "now"
        |         who set the TTL
        xid of object

or
	
	696613561 VCL 20 1153517009
	|         |   |  |
	|         |   |  "now"
	|         |   TTL relative to "now"
	|         who set the TTL
        xid of object




Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2006-07-21 21:13:43 UTC (rev 550)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2006-07-21 21:28:51 UTC (rev 551)
@@ -113,7 +113,11 @@
 {
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	(void)a;
+	CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);	/* XXX */
+	VSL(SLT_TTL, sp->fd, "%u VCL %.0f %u", sp->obj->xid, a, sp->t_req);
+	sp->obj->ttl = sp->t_req + a;
+	if (sp->obj->heap_idx != 0)
+		EXP_TTLchange(sp->obj);
 }
 
 double

Modified: trunk/varnish-cache/bin/varnishd/rfc2616.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/rfc2616.c	2006-07-21 21:13:43 UTC (rev 550)
+++ trunk/varnish-cache/bin/varnishd/rfc2616.c	2006-07-21 21:28:51 UTC (rev 551)
@@ -71,7 +71,7 @@
 #endif
 
 static time_t
-RFC2616_Ttl(int fd, struct http *hp, time_t t_req, time_t t_resp, struct object *obj)
+RFC2616_Ttl(struct sess *sp, struct http *hp, time_t t_req, time_t t_resp, struct object *obj)
 {
 	int retirement_age;
 	unsigned u1, u2;
@@ -119,7 +119,7 @@
 	}
 
 	/* calculated TTL, Our time, Date, Expires, max-age, age */
-	VSL(SLT_TTL, fd, "%d %d %d %d %d %d",
+	VSL(SLT_TTL, sp->fd, "%u RFC %d %d %d %d %d %d", sp->xid,
 	    (int)(ttd - t_req), (int)t_req, (int)h_date, (int)h_expires,
 	    (int)u1, (int)u2);
 
@@ -155,7 +155,7 @@
 		break;
 	}
 
-	sp->obj->ttl = RFC2616_Ttl(sp->fd, hp, sp->t_req, sp->t_resp, sp->obj);
+	sp->obj->ttl = RFC2616_Ttl(sp, hp, sp->t_req, sp->t_resp, sp->obj);
 	sp->obj->entered = sp->t_req;
 	if (sp->obj->ttl == 0) {
 		sp->obj->cacheable = 0;




More information about the varnish-commit mailing list