[master] 25ae15e Call vcl_init{} from the compiled VMODs event(LOAD) code.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Jun 15 10:26:00 CEST 2015
commit 25ae15ef46c04c0a3e81a264ccd627873d9482a2
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Jun 15 08:25:30 2015 +0000
Call vcl_init{} from the compiled VMODs event(LOAD) code.
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 422d6fd..ff25f62 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -247,7 +247,7 @@ VCL_Load(struct cli *cli, const char *name, const char *fn, const char *state)
i = vcl->conf->event_vcl(&ctx, VCL_EVENT_LOAD);
AZ(VSB_finish(vsb));
if (i) {
- VCLI_Out(cli, "VCL \"%s\" Failed to initialize", name);
+ VCLI_Out(cli, "VCL \"%s\" Failed initialization", name);
if (VSB_len(vsb))
VCLI_Out(cli, "\nMessage:\n\t%s", VSB_data(vsb));
AZ(vcl->conf->event_vcl(&ctx, VCL_EVENT_DISCARD));
@@ -256,21 +256,6 @@ VCL_Load(struct cli *cli, const char *name, const char *fn, const char *state)
VSB_delete(vsb);
return (1);
}
- VSB_clear(vsb);
- (void)vcl->conf->init_func(&ctx);
- AZ(VSB_finish(vsb));
- if (hand == VCL_RET_FAIL) {
- VCLI_Out(cli, "VCL \"%s\" vcl_init{} failed", name);
- if (VSB_len(vsb))
- VCLI_Out(cli, "\nMessage:\n\t%s", VSB_data(vsb));
- ctx.method = VCL_MET_FINI;
- (void)vcl->conf->fini_func(&ctx);
- AZ(vcl->conf->event_vcl(&ctx, VCL_EVENT_DISCARD));
- (void)dlclose(vcl->dlh);
- FREE_OBJ(vcl);
- VSB_delete(vsb);
- return (1);
- }
VSB_delete(vsb);
vcl_set_state(vcl, state);
assert(hand == VCL_RET_OK);
diff --git a/bin/varnishtest/tests/v00040.vtc b/bin/varnishtest/tests/v00040.vtc
index a21ca4b..408169f 100644
--- a/bin/varnishtest/tests/v00040.vtc
+++ b/bin/varnishtest/tests/v00040.vtc
@@ -12,7 +12,7 @@ client c1 {
rxresp
} -run
-varnish v1 -errvcl {VCL "vcl2" vcl_init{} failed} {
+varnish v1 -errvcl {VCL "vcl2" Failed initialization} {
sub vcl_init {
return (fail);
}
diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c
index aff800a..59fb851 100644
--- a/lib/libvcc/vcc_backend.c
+++ b/lib/libvcc/vcc_backend.c
@@ -410,7 +410,7 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
ifp = New_IniFin(tl);
VSB_printf(ifp->ini,
- "\tVRT_init_vbe(ctx, &%s, &vgc_dir_priv_%s);",
+ "\tVRT_init_vbe(ctx, &%s,\n\t &vgc_dir_priv_%s);",
vgcname, vgcname);
VSB_printf(ifp->fin,
"\t\tVRT_fini_vbe(ctx, &%s,\n\t\t &vgc_dir_priv_%s);",
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index e837742..24ca4df 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -325,7 +325,8 @@ EmitInitFini(const struct vcc *tl)
VSB_delete(p->ini);
}
- Fc(tl, 0, "\treturn(0);\n");
+ Fc(tl, 0, "\t(void)VGC_function_vcl_init(ctx);\n");
+ Fc(tl, 0, "\treturn(*ctx->handling == VCL_RET_OK ? 0: -1);\n");
Fc(tl, 0, "}\n");
/*
More information about the varnish-commit
mailing list