commit 762856de2cfb0ff7e96991c32577795085e7b7fd
parent 888e39055f2067a6a45c21926dc32bf6b9cd3e50
Author: Christian Grothoff <christian@grothoff.org>
Date: Fri, 26 Apr 2013 09:51:10 +0000
handle case where poll/select have nothing left to do
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
@@ -1468,6 +1468,8 @@ MHD_select (struct MHD_Daemon *daemon,
timeout.tv_sec = ltimeout / 1000;
tv = &timeout;
}
+ if (-1 == max)
+ return MHD_YES;
num_ready = SELECT (max + 1, &rs, &ws, &es, tv);
if (MHD_YES == daemon->shutdown)
return MHD_NO;
@@ -1555,6 +1557,8 @@ MHD_poll_all (struct MHD_Daemon *daemon,
p[poll_server+i].events |= POLLOUT;
i++;
}
+ if (0 == poll_server + num_connections)
+ return MHD_YES;
if (poll (p, poll_server + num_connections, timeout) < 0)
{
if (EINTR == errno)
@@ -1635,6 +1639,8 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon,
timeout = 0;
else
timeout = -1;
+ if (0 == poll_count)
+ return MHD_YES;
if (poll (p, poll_count, timeout) < 0)
{
if (EINTR == errno)