Attached is a patch to make KQueue have the same behavior as the other pollset methods for a POLLHUP.

The current code will trigger a POLLERR when KQueue has an EOF. This is an incorrect behavior. It should trigger a POLLHUP like poll or epoll would.

Justin lead me to this bug several days ago on IRC.

My pollset patch for the Event MPM also has this change:
http://httpd.apache.org/~pquerna/event-mpm/event-apr_pollset-2004-11-01.patch

-Paul Querna
Index: poll/unix/poll.c
===================================================================
RCS file: /home/cvspublic/apr/poll/unix/poll.c,v
retrieving revision 1.46
diff -u -r1.46 poll.c
--- poll/unix/poll.c    7 Jul 2004 07:40:12 -0000       1.46
+++ poll/unix/poll.c    1 Nov 2004 23:37:25 -0000
@@ -50,7 +50,9 @@
         rv |= APR_POLLIN;
     if (event & EVFILT_WRITE)
         rv |= APR_POLLOUT;
-    if (flags & EV_ERROR || flags & EV_EOF)
+    if (flags & EV_EOF)
+        rv |= APR_POLLHUP;
+    if (flags & EV_ERROR)
         rv |= APR_POLLERR;
 
     return rv;

Reply via email to