Mailing List Archive

r1808 - trunk/varnish-cache/bin/varnishd
Author: phk
Date: 2007-08-07 09:23:10 +0200 (Tue, 07 Aug 2007)
New Revision: 1808

Modified:
trunk/varnish-cache/bin/varnishd/cache_center.c
Log:
Implement "error" action in vcl_fetch() and vcl_deliver()



Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c 2007-08-07 06:55:52 UTC (rev 1807)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c 2007-08-07 07:23:10 UTC (rev 1808)
@@ -149,8 +149,17 @@
sp->t_resp = TIM_real();
RES_BuildHttp(sp);
VCL_deliver_method(sp);
- if (sp->handling != VCL_RET_DELIVER)
+ switch (sp->handling) {
+ case VCL_RET_DELIVER:
+ break;
+ case VCL_RET_ERROR:
+ HSH_Deref(sp->obj);
+ sp->obj = NULL;
+ sp->step = STP_ERROR;
+ return (0);
+ default:
INCOMPL();
+ }

RES_WriteObj(sp);
HSH_Deref(sp->obj);
@@ -323,11 +332,23 @@

VCL_fetch_method(sp);

- if (sp->handling == VCL_RET_ERROR)
+ switch (sp->handling) {
+ case VCL_RET_ERROR:
+ sp->obj->ttl = 0;
+ sp->obj->cacheable = 0;
+ HSH_Unbusy(sp->obj);
+ HSH_Deref(sp->obj);
+ sp->obj = NULL;
+ sp->step = STP_ERROR;
+ return (0);
+ case VCL_RET_PASS:
+ sp->obj->pass = 1;
+ break;
+ case VCL_RET_INSERT:
+ break;
+ default:
INCOMPL();
-
- if (sp->handling == VCL_RET_PASS)
- sp->obj->pass = 1;
+ }
}

sp->obj->cacheable = 1;