Mailing List Archive

[master] 9d392361d vtim: Change the semantics of vtim_poll_tmo()
commit 9d392361d76ace7a18c8eda7f0a46dcd4fe41c10
Author: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
Date: Mon Feb 26 17:31:38 2024 +0100

vtim: Change the semantics of vtim_poll_tmo()

From now on, INFINITY disables the timeout and NAN is no longer allowed.

Refs #3045

diff --git a/bin/varnishd/http1/cache_http1_pipe.c b/bin/varnishd/http1/cache_http1_pipe.c
index 98464ab46..dd8b9098b 100644
--- a/bin/varnishd/http1/cache_http1_pipe.c
+++ b/bin/varnishd/http1/cache_http1_pipe.c
@@ -149,7 +149,7 @@ V1P_Process(const struct req *req, int fd, struct v1p_acct *v1a,
fds[1].revents = 0;
tmo = cache_param->pipe_timeout;
if (tmo == 0.)
- tmo = NAN;
+ tmo = INFINITY;
if (deadline > 0.) {
tmo_task = deadline - VTIM_real();
tmo = vmin(tmo, tmo_task);
diff --git a/lib/libvarnish/vtim.c b/lib/libvarnish/vtim.c
index 01e218db5..33907432a 100644
--- a/lib/libvarnish/vtim.c
+++ b/lib/libvarnish/vtim.c
@@ -458,8 +458,9 @@ int
VTIM_poll_tmo(vtim_dur tmo)
{

- if (isnan(tmo))
+ if (isinf(tmo))
return (-1);
+ assert(!isnan(tmo));
return (vmax_t(int, 0, ((int)(tmo * 1e3))));
}

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