[master] 17fa38652 v1p: Use VTIM_poll_tmo()

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Feb 5 18:19:05 UTC 2024


commit 17fa386524b9d6734660f304ef3599611a7e33ab
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Feb 1 09:20:33 2024 +0100

    v1p: Use VTIM_poll_tmo()
    
    Otherwise poll(2) returns EINVAL on FreeBSD when both pipe_timeout and
    pipe_task_deadline are disabled.
    
    Fixes #4043

diff --git a/bin/varnishd/http1/cache_http1_pipe.c b/bin/varnishd/http1/cache_http1_pipe.c
index 7ffe4b68c..98464ab46 100644
--- a/bin/varnishd/http1/cache_http1_pipe.c
+++ b/bin/varnishd/http1/cache_http1_pipe.c
@@ -149,13 +149,12 @@ 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 = -1.;
+			tmo = NAN;
 		if (deadline > 0.) {
 			tmo_task = deadline - VTIM_real();
-			tmo = (tmo > 0.) ? vmin(tmo, tmo_task) : tmo_task;
-			tmo = vmax(tmo, 0.);
+			tmo = vmin(tmo, tmo_task);
 		}
-		i = poll(fds, 2, (int)(tmo * 1e3));
+		i = poll(fds, 2, VTIM_poll_tmo(tmo));
 		if (i == 0)
 			sc = SC_RX_TIMEOUT;
 		if (i < 1)


More information about the varnish-commit mailing list