[master] 36087a87d param: Tweak timeouts with the special value "never"

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue Mar 5 08:53:08 UTC 2024


commit 36087a87d00d4309096303d01afcf013222772be
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Feb 26 19:10:09 2024 +0100

    param: Tweak timeouts with the special value "never"

diff --git a/bin/varnishd/mgt/mgt_param_tweak.c b/bin/varnishd/mgt/mgt_param_tweak.c
index 8ad63d821..be0af0b62 100644
--- a/bin/varnishd/mgt/mgt_param_tweak.c
+++ b/bin/varnishd/mgt/mgt_param_tweak.c
@@ -138,6 +138,22 @@ parse_duration(const char *p, const char **err)
 int v_matchproto_(tweak_t)
 tweak_timeout(struct vsb *vsb, const struct parspec *par, const char *arg)
 {
+	volatile double *dest = par->priv;
+
+	if (arg != NULL && !strcmp(arg, "never")) {
+		*dest = INFINITY;
+		return (0);
+	}
+
+	if (*dest == INFINITY && arg == NULL) {
+		VSB_cat(vsb, "never");
+		return (0);
+	}
+
+	if (*dest == INFINITY && arg == JSON_FMT) {
+		VSB_cat(vsb, "\"never\"");
+		return (0);
+	}
 
 	return (tweak_generic_double(vsb, arg, par, parse_duration, "%.3f"));
 }


More information about the varnish-commit mailing list