apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roo...@apache.org
Subject svn commit: r386167 - in /apr/apr/branches/1.2.x: CHANGES poll/unix/kqueue.c test/testpoll.c
Date Wed, 15 Mar 2006 21:27:07 GMT
Author: rooneg
Date: Wed Mar 15 13:27:05 2006
New Revision: 386167

URL: http://svn.apache.org/viewcvs?rev=386167&view=rev
Log:
Merge r386154 from trunk to the 1.2.x branch.

Original log message:

Fix a longstanding missunderstanding in our kqueue pollset code.  It turns
out that the kqueue filter types are not bitfields, so checking for them
via & EVFILT_READ or & EVFILT_WRITE is inappropriate.

Test Fixes By: Joe Orton

* poll/unix/kqueue.c
  (get_kqueue_revent): Use == instead of & when testing for filter types.

* test/testpoll.c
  (multi_event_pollset): Handle the fact that we can sometimes get multiple
   events for a single socket.

* CHANGES: Note fix.

Modified:
    apr/apr/branches/1.2.x/CHANGES
    apr/apr/branches/1.2.x/poll/unix/kqueue.c
    apr/apr/branches/1.2.x/test/testpoll.c

Modified: apr/apr/branches/1.2.x/CHANGES
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/CHANGES?rev=386167&r1=386166&r2=386167&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/CHANGES (original)
+++ apr/apr/branches/1.2.x/CHANGES Wed Mar 15 13:27:05 2006
@@ -1,5 +1,9 @@
 Changes for APR 1.2.4
 
+  *) Correct bug in kqueue backend for apr_pollset where we would
+     erroneously indicate that a socket was readable or writeable.
+     [Garrett Rooney]
+
   *) Make the filePtr in apr_file_t an apr_off_t on Unix, to avoid issues
      truncating offsets down to 32 bits on large file systems.
      [Garrett Rooney]

Modified: apr/apr/branches/1.2.x/poll/unix/kqueue.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/poll/unix/kqueue.c?rev=386167&r1=386166&r2=386167&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/poll/unix/kqueue.c (original)
+++ apr/apr/branches/1.2.x/poll/unix/kqueue.c Wed Mar 15 13:27:05 2006
@@ -22,9 +22,9 @@
 {
     apr_int16_t rv = 0;
 
-    if (event & EVFILT_READ)
+    if (event == EVFILT_READ)
         rv |= APR_POLLIN;
-    if (event & EVFILT_WRITE)
+    if (event == EVFILT_WRITE)
         rv |= APR_POLLOUT;
     if (flags & EV_EOF)
         rv |= APR_POLLHUP;

Modified: apr/apr/branches/1.2.x/test/testpoll.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/test/testpoll.c?rev=386167&r1=386166&r2=386167&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/test/testpoll.c (original)
+++ apr/apr/branches/1.2.x/test/testpoll.c Wed Mar 15 13:27:05 2006
@@ -309,10 +309,25 @@
 
     rv = apr_pollset_poll(pollset, 0, &lrv, &descs);
     ABTS_INT_EQUAL(tc, 0, APR_STATUS_IS_TIMEUP(rv));
-    ABTS_INT_EQUAL(tc, 1, lrv);
-    ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s);
-    ABTS_INT_EQUAL(tc, APR_POLLIN | APR_POLLOUT, descs[0].rtnevents);
-    ABTS_PTR_EQUAL(tc, s[0],  descs[0].client_data);
+    if (lrv == 1) {
+        ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s);
+        ABTS_INT_EQUAL(tc, APR_POLLIN | APR_POLLOUT, descs[0].rtnevents);
+        ABTS_PTR_EQUAL(tc, s[0],  descs[0].client_data);
+    }
+    else if (lrv == 2) {
+        ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s);
+        ABTS_PTR_EQUAL(tc, s[0], descs[0].client_data);
+        ABTS_PTR_EQUAL(tc, s[0], descs[1].desc.s);
+        ABTS_PTR_EQUAL(tc, s[0], descs[1].client_data);
+        ABTS_ASSERT(tc, "returned events incorrect",
+                    ((descs[0].rtnevents | descs[1].rtnevents)
+                     == (APR_POLLIN | APR_POLLOUT))
+                    && descs[0].rtnevents != descs[1].rtnevents);
+    }
+    else {
+        ABTS_ASSERT(tc, "either one or two events returned",
+                    lrv == 1 || lrv == 2);
+    }
 
     recv_msg(s, 0, p, tc);
 



Mime
View raw message