Mailing List Archive

[master] 03757a35b rename debug.fail_rollback() & debug.ok_rollback()
commit 03757a35be7a9587dfa504323606f0d83ef908b3
Author: Nils Goroll <nils.goroll@uplex.de>
Date: Wed Jan 20 10:18:20 2021 +0100

rename debug.fail_rollback() & debug.ok_rollback()

Though introduced for the purpose of failing upon rollback, they
actually just call VRT_fail() from the PRIV_* fini callback and thus
should be named accordingly.

diff --git a/bin/varnishtest/tests/m00017.vtc b/bin/varnishtest/tests/m00017.vtc
index 012e92989..4e2e8cdd8 100644
--- a/bin/varnishtest/tests/m00017.vtc
+++ b/bin/varnishtest/tests/m00017.vtc
@@ -215,10 +215,10 @@ varnish v1 -vcl+backend {

sub vcl_deliver {
if (req.url ~ "/veto") {
- debug.fail_rollback();
+ debug.fail_task_fini();
}
if (req.url ~ "/ok") {
- debug.ok_rollback();
+ debug.ok_task_fini();
}
std.rollback(req);
set resp.http.test = req.http.test;
diff --git a/vmod/vmod_debug.c b/vmod/vmod_debug.c
index 3b7c1bbb4..49dd3276c 100644
--- a/vmod/vmod_debug.c
+++ b/vmod/vmod_debug.c
@@ -63,7 +63,7 @@ static struct vsc_seg *vsc_seg = NULL;
static struct VSC_debug *vsc = NULL;
static int loads;
static const int store_ip_token;
-static const int fail_rollback_token;
+static const int fail_task_fini_token;
extern void mylog(struct vsl_log *vsl, enum VSL_tag_e tag,
const char *fmt, ...) v_printflike_(3,4);

@@ -1204,23 +1204,23 @@ fail_f(VRT_CTX, void *priv)
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
assert(priv == fail_magic);

- VRT_fail(ctx, "thou shalt not rollet back");
+ VRT_fail(ctx, "thou shalt not fini");
}

-static const struct vmod_priv_methods xyzzy_fail_rollback_methods[1] = {{
+static const struct vmod_priv_methods xyzzy_fail_task_fini_methods[1] = {{
.magic = VMOD_PRIV_METHODS_MAGIC,
- .type = "debug_fail_rollback",
+ .type = "debug_fail_task_fini",
.fini = fail_f
}};

-VCL_VOID v_matchproto_(td_xyzzy_debug_fail_rollback)
-xyzzy_fail_rollback(VRT_CTX)
+VCL_VOID v_matchproto_(td_xyzzy_debug_fail_task_fini)
+xyzzy_fail_task_fini(VRT_CTX)
{
struct vmod_priv *p;

CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);

- p = VRT_priv_task(ctx, &fail_rollback_token);
+ p = VRT_priv_task(ctx, &fail_task_fini_token);
if (p == NULL) {
VRT_fail(ctx, "no priv task - out of ws?");
return;
@@ -1228,22 +1228,22 @@ xyzzy_fail_rollback(VRT_CTX)

if (p->priv != NULL) {
assert(p->priv == fail_magic);
- assert(p->methods == xyzzy_fail_rollback_methods);
+ assert(p->methods == xyzzy_fail_task_fini_methods);
return;
}

p->priv = fail_magic;
- p->methods = xyzzy_fail_rollback_methods;
+ p->methods = xyzzy_fail_task_fini_methods;
}

-VCL_VOID v_matchproto_(td_xyzzy_debug_ok_rollback)
-xyzzy_ok_rollback(VRT_CTX)
+VCL_VOID v_matchproto_(td_xyzzy_debug_ok_task_fini)
+xyzzy_ok_task_fini(VRT_CTX)
{
struct vmod_priv *p;

CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);

- p = VRT_priv_task(ctx, &fail_rollback_token);
+ p = VRT_priv_task(ctx, &fail_task_fini_token);
if (p == NULL) {
VRT_fail(ctx, "no priv task - out of ws?");
return;
diff --git a/vmod/vmod_debug.vcc b/vmod/vmod_debug.vcc
index 3f2e13bcc..8ee1f27cd 100644
--- a/vmod/vmod_debug.vcc
+++ b/vmod/vmod_debug.vcc
@@ -300,13 +300,13 @@ $Function STRING client_port()

Get the stringified client port from the session attr

-$Function VOID fail_rollback()
+$Function VOID fail_task_fini()

-fail any rollback before ok_rollback() is called
+fail any task fini before ok_task_fini() is called

-$Function VOID ok_rollback()
+$Function VOID ok_task_fini()

-Allow rollbacks. Must be called before the end of the task.
+Allow task_fini. Must be called before the end of the task.

$Function STRING re_quote(STRING)

_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit