[master] fe3f7e9f2 vcli_proto: Use VTIM_poll_tmo()

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


commit fe3f7e9f2ee74a3ae4bb0b919f18146196adbe41
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Feb 29 18:09:25 2024 +0100

    vcli_proto: Use VTIM_poll_tmo()

diff --git a/lib/libvarnish/vcli_proto.c b/lib/libvarnish/vcli_proto.c
index e0fca5cec..90a1b0b4f 100644
--- a/lib/libvarnish/vcli_proto.c
+++ b/lib/libvarnish/vcli_proto.c
@@ -45,6 +45,7 @@
 #include "vas.h"	// XXX Flexelint "not used" - but req'ed for assert()
 #include "vcli.h"
 #include "vsha256.h"
+#include "vtim.h"
 
 void
 VCLI_AuthResponse(int S_fd, const char *challenge,
@@ -110,17 +111,13 @@ VCLI_WriteResult(int fd, unsigned status, const char *result)
 static int
 read_tmo(int fd, char *ptr, unsigned len, double tmo)
 {
-	int i, j, to;
+	int i, j;
 	struct pollfd pfd;
 
-	if (tmo > 0)
-		to = (int)(tmo * 1e3);
-	else
-		to = -1;
 	pfd.fd = fd;
 	pfd.events = POLLIN;
 	for (j = 0; len > 0; ) {
-		i = poll(&pfd, 1, to);
+		i = poll(&pfd, 1, VTIM_poll_tmo(tmo));
 		if (i < 0) {
 			errno = EINTR;
 			return (-1);


More information about the varnish-commit mailing list