From 6e7f39321df599b3b05ca721f0096c3837d39556 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 24 Apr 2015 14:08:58 +1000 Subject: [PATCH] We are not interested in POLLIN in wait_close but any mode of a closed socket --- src/libckpool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libckpool.c b/src/libckpool.c index 24c66f10..011194fc 100644 --- a/src/libckpool.c +++ b/src/libckpool.c @@ -893,13 +893,13 @@ int wait_close(int sockd, int timeout) if (unlikely(sockd < 0)) return -1; sfd.fd = sockd; - sfd.events = POLLIN; + sfd.events = POLLRDHUP; sfd.revents = 0; timeout *= 1000; ret = poll(&sfd, 1, timeout); if (ret < 1) return 0; - return sfd.revents & POLLHUP; + return sfd.revents & (POLLHUP | POLLRDHUP | POLLERR); } /* Emulate a select read wait for high fds that select doesn't support */