[master] 5a239cb More correct handling of POLLERR and POLLHUP

Poul-Henning Kamp phk at FreeBSD.org
Tue Mar 13 09:48:08 UTC 2018


commit 5a239cbc3a6def944712f3ad063076cb14724acf
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Mar 13 09:47:16 2018 +0000

    More correct handling of POLLERR and POLLHUP

diff --git a/bin/varnishd/http1/cache_http1_pipe.c b/bin/varnishd/http1/cache_http1_pipe.c
index 6f8828a..224298b 100644
--- a/bin/varnishd/http1/cache_http1_pipe.c
+++ b/bin/varnishd/http1/cache_http1_pipe.c
@@ -104,9 +104,9 @@ V1P_Process(const struct req *req, int fd, struct v1p_acct *v1a)
 	}
 	memset(fds, 0, sizeof fds);
 	fds[0].fd = fd;
-	fds[0].events = POLLIN | POLLERR;
+	fds[0].events = POLLIN;
 	fds[1].fd = req->sp->fd;
-	fds[1].events = POLLIN | POLLERR;
+	fds[1].events = POLLIN;
 
 	while (fds[0].fd > -1 || fds[1].fd > -1) {
 		fds[0].revents = 0;
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index f72bbb0..e5857e7 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -1509,14 +1509,14 @@ cmd_http_expect_close(CMD_ARGS)
 		stop_h2(hp);
 	while (1) {
 		fds[0].fd = hp->fd;
-		fds[0].events = POLLIN | POLLERR;
+		fds[0].events = POLLIN;
 		fds[0].revents = 0;
 		i = poll(fds, 1, hp->timeout);
 		if (i < 0 && errno == EINTR)
 			continue;
 		if (i == 0)
 			vtc_log(vl, hp->fatal, "Expected close: timeout");
-		if (i != 1 || !(fds[0].revents & (POLLIN|POLLERR)))
+		if (i != 1 || !(fds[0].revents & (POLLIN|POLLERR|POLLHUP)))
 			vtc_log(vl, hp->fatal,
 			    "Expected close: poll = %d, revents = 0x%x",
 			    i, fds[0].revents);


More information about the varnish-commit mailing list