Commit 1ff0c0f4 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

vrt_var: Make bereq.task_deadline unset-able

The other timeouts should eventually become unset-able as well, where
an unset variable falls back to a parameter and zero means no timeout,
overriding the fallback parameter.

Refs #4043
parent 98945cea
...@@ -387,7 +387,19 @@ VRT_l_client_identity(VRT_CTX, const char *str, VCL_STRANDS s) ...@@ -387,7 +387,19 @@ VRT_l_client_identity(VRT_CTX, const char *str, VCL_STRANDS s)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
#define BEREQ_TIMEOUT(which) \ #define BEREQ_TIMEOUT_UNSET0(which)
#define BEREQ_TIMEOUT_UNSET1(which) \
VCL_VOID \
VRT_u_bereq_##which(VRT_CTX) \
{ \
\
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); \
ctx->bo->which = NAN; \
}
#define BEREQ_TIMEOUT(which, unset) \
VCL_VOID \ VCL_VOID \
VRT_l_bereq_##which(VRT_CTX, VCL_DURATION num) \ VRT_l_bereq_##which(VRT_CTX, VCL_DURATION num) \
{ \ { \
...@@ -404,12 +416,14 @@ VRT_r_bereq_##which(VRT_CTX) \ ...@@ -404,12 +416,14 @@ VRT_r_bereq_##which(VRT_CTX) \
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); \
return (ctx->bo->which); \ return (ctx->bo->which); \
} } \
\
BEREQ_TIMEOUT_UNSET##unset(which)
BEREQ_TIMEOUT(connect_timeout) BEREQ_TIMEOUT(connect_timeout, 0)
BEREQ_TIMEOUT(first_byte_timeout) BEREQ_TIMEOUT(first_byte_timeout, 0)
BEREQ_TIMEOUT(between_bytes_timeout) BEREQ_TIMEOUT(between_bytes_timeout, 0)
BEREQ_TIMEOUT(task_deadline) BEREQ_TIMEOUT(task_deadline, 1)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
......
...@@ -27,8 +27,9 @@ varnish v1 -cliok "param.set pipe_timeout 0s" ...@@ -27,8 +27,9 @@ varnish v1 -cliok "param.set pipe_timeout 0s"
varnish v1 -cliok "param.set pipe_task_deadline 0s" varnish v1 -cliok "param.set pipe_task_deadline 0s"
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
sub vcl_pipe { sub vcl_pipe {
if (req.method == "TMO") { set bereq.task_deadline = 1.1s;
set bereq.task_deadline = 1.1s; if (req.method != "TMO") {
unset bereq.task_deadline;
} }
} }
} -start } -start
......
...@@ -850,8 +850,10 @@ bereq.task_deadline ...@@ -850,8 +850,10 @@ bereq.task_deadline
Writable from: vcl_pipe Writable from: vcl_pipe
Unsetable from: vcl_pipe
Deadline for pipe sessions, defaults ``0s``, which falls back to the Deadline for pipe sessions, defaults ``0s``, which falls back to the
``pipe_task_deadline`` parameter, see :ref:`varnishd(1)` ``pipe_task_deadline`` parameter, see :ref:`varnishd(1)`
.. _bereq.time: .. _bereq.time:
......
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