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.
parent 21d4a83b
...@@ -215,10 +215,10 @@ varnish v1 -vcl+backend { ...@@ -215,10 +215,10 @@ varnish v1 -vcl+backend {
sub vcl_deliver { sub vcl_deliver {
if (req.url ~ "/veto") { if (req.url ~ "/veto") {
debug.fail_rollback(); debug.fail_task_fini();
} }
if (req.url ~ "/ok") { if (req.url ~ "/ok") {
debug.ok_rollback(); debug.ok_task_fini();
} }
std.rollback(req); std.rollback(req);
set resp.http.test = req.http.test; set resp.http.test = req.http.test;
......
...@@ -63,7 +63,7 @@ static struct vsc_seg *vsc_seg = NULL; ...@@ -63,7 +63,7 @@ static struct vsc_seg *vsc_seg = NULL;
static struct VSC_debug *vsc = NULL; static struct VSC_debug *vsc = NULL;
static int loads; static int loads;
static const int store_ip_token; 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, extern void mylog(struct vsl_log *vsl, enum VSL_tag_e tag,
const char *fmt, ...) v_printflike_(3,4); const char *fmt, ...) v_printflike_(3,4);
...@@ -1204,23 +1204,23 @@ fail_f(VRT_CTX, void *priv) ...@@ -1204,23 +1204,23 @@ fail_f(VRT_CTX, void *priv)
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
assert(priv == fail_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, .magic = VMOD_PRIV_METHODS_MAGIC,
.type = "debug_fail_rollback", .type = "debug_fail_task_fini",
.fini = fail_f .fini = fail_f
}}; }};
VCL_VOID v_matchproto_(td_xyzzy_debug_fail_rollback) VCL_VOID v_matchproto_(td_xyzzy_debug_fail_task_fini)
xyzzy_fail_rollback(VRT_CTX) xyzzy_fail_task_fini(VRT_CTX)
{ {
struct vmod_priv *p; struct vmod_priv *p;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); 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) { if (p == NULL) {
VRT_fail(ctx, "no priv task - out of ws?"); VRT_fail(ctx, "no priv task - out of ws?");
return; return;
...@@ -1228,22 +1228,22 @@ xyzzy_fail_rollback(VRT_CTX) ...@@ -1228,22 +1228,22 @@ xyzzy_fail_rollback(VRT_CTX)
if (p->priv != NULL) { if (p->priv != NULL) {
assert(p->priv == fail_magic); assert(p->priv == fail_magic);
assert(p->methods == xyzzy_fail_rollback_methods); assert(p->methods == xyzzy_fail_task_fini_methods);
return; return;
} }
p->priv = fail_magic; 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) VCL_VOID v_matchproto_(td_xyzzy_debug_ok_task_fini)
xyzzy_ok_rollback(VRT_CTX) xyzzy_ok_task_fini(VRT_CTX)
{ {
struct vmod_priv *p; struct vmod_priv *p;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); 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) { if (p == NULL) {
VRT_fail(ctx, "no priv task - out of ws?"); VRT_fail(ctx, "no priv task - out of ws?");
return; return;
......
...@@ -300,13 +300,13 @@ $Function STRING client_port() ...@@ -300,13 +300,13 @@ $Function STRING client_port()
Get the stringified client port from the session attr 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) $Function STRING re_quote(STRING)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment