[PATCH] Make "done" function available in VCL

MAGNIEN, Thierry thierry.magnien at sfr.com
Fri Mar 7 16:37:41 CET 2014


Update : previous patch generates a segfault during varnishtest while building modules. Not sure the fix is perfect but it seems to work.

Here is the updated patch:


--- varnish-3.0.5/bin/varnishd/cache_center.c
+++ varnish-3.0.5.new/bin/varnishd/cache_center.c
@@ -332,6 +332,10 @@ cnt_done(struct sess *sp)
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
        CHECK_OBJ_ORNULL(sp->vcl, VCL_CONF_MAGIC);

+       if (sp->fd >= 0) {
+           VCL_done_method(sp);
+       }
+
        AZ(sp->obj);
        AZ(sp->vbc);
        sp->director = NULL;

--- varnish-3.0.5/lib/libvcl/generate.py        2013-12-02 08:47:57.000000000 +0100
+++ varnish-3.0.5.new/lib/libvcl/generate.py    2014-03-06 11:03:48.000000000 +0100
@@ -92,6 +92,7 @@
        ('fetch',       ('error', 'restart', 'hit_for_pass', 'deliver',)),
        ('deliver',     ('restart', 'deliver',)),
        ('error',       ('restart', 'deliver',)),
+       ('done',        ('ok',)),
        ('init',        ('ok',)),
        ('fini',        ('ok',)),
 )

--- varnish-3.0.5/bin/varnishd/default.vcl
+++ varnish-3.0.5.new/bin/varnishd/default.vcl
@@ -147,3 +147,7 @@ sub vcl_init {
 sub vcl_fini {
        return (ok);
 }
+
+sub vcl_done {
+       return (ok);
+}



More information about the varnish-dev mailing list