[master] 9d392361d vtim: Change the semantics of vtim_poll_tmo()

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


commit 9d392361d76ace7a18c8eda7f0a46dcd4fe41c10
Author: Dridi Boukelmoune <dridi.boukelmoune at 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))));
 }
 


More information about the varnish-commit mailing list