From 8313628629ad452c4eb62961026aad1614e94645 Mon Sep 17 00:00:00 2001 From: ckolivas Date: Wed, 22 Apr 2015 14:54:00 +1000 Subject: [PATCH] Differentiate ready for writes from hangups in wait_write_select --- src/libckpool.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libckpool.c b/src/libckpool.c index f20a8803..fee42439 100644 --- a/src/libckpool.c +++ b/src/libckpool.c @@ -983,14 +983,19 @@ out: int wait_write_select(int sockd, int timeout) { struct pollfd sfd; + int ret = -1; if (unlikely(sockd < 0)) - return -1; + goto out; sfd.fd = sockd; sfd.events = POLLOUT; sfd.revents = 0; timeout *= 1000; - return poll(&sfd, 1, timeout); + ret = poll(&sfd, 1, timeout); + if (ret && !(sfd.revents & POLLOUT)) + ret = -1; +out: + return ret; } int write_length(int sockd, const void *buf, int len)