OSSP CVS Repository

ossp - Difference in ossp-pkg/pth/pth_high.c versions 1.84 and 1.85
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/pth/pth_high.c 1.84 -> 1.85

--- pth_high.c   2002/10/15 20:34:22     1.84
+++ pth_high.c   2002/10/15 21:14:27     1.85
@@ -413,13 +413,19 @@
     for(i = 0; i < nfd; i++) {
         if (!pth_util_fd_valid(pfd[i].fd))
             return_errno(-1, EBADF);
-        if (pfd[i].events & POLLIN)
+        if (pfd[i].events & (POLLIN|POLLRDNORM))
             FD_SET(pfd[i].fd, &rfds);
-        if (pfd[i].events & POLLOUT)
+        /* see select(2): "the only exceptional condition detectable
+           is out-of-band data received on a socket", hence we push
+           POLLWRBAND events onto wfds instead of efds. */
+        if (pfd[i].events & (POLLOUT|POLLWRNORM|POLLWRBAND))
             FD_SET(pfd[i].fd, &wfds);
-        if (pfd[i].events & POLLPRI)
+        if (pfd[i].events & (POLLPRI|POLLRDBAND))
             FD_SET(pfd[i].fd, &efds);
-        if (pfd[i].fd >= maxfd && (pfd[i].events & (POLLIN|POLLOUT|POLLPRI)))
+        if (   pfd[i].fd >= maxfd
+            && (pfd[i].events & (POLLIN|POLLOUT|POLLPRI|
+                                 POLLRDNORM|POLLRDBAND|
+                                 POLLWRNORM|POLLWRBAND)))
             maxfd = pfd[i].fd;
     }
     if (maxfd == -1)
@@ -439,7 +445,10 @@
                 continue;
             }
             if (FD_ISSET(pfd[i].fd, &rfds)) {
-                pfd[i].revents |= POLLIN;
+                if (pfd[i].events & POLLIN)
+                    pfd[i].revents |= POLLIN;
+                if (pfd[i].events & POLLRDNORM)
+                    pfd[i].revents |= POLLRDNORM;
                 ok++;
                 /* support for POLLHUP */
                 if (recv(pfd[i].fd, data, 64, MSG_PEEK) == -1) {
@@ -452,11 +461,19 @@
                 }
             }
             if (FD_ISSET(pfd[i].fd, &wfds)) {
-                pfd[i].revents |= POLLOUT;
+                if (pfd[i].events & POLLOUT)
+                    pfd[i].revents |= POLLOUT;
+                if (pfd[i].events & POLLWRNORM)
+                    pfd[i].revents |= POLLWRNORM;
+                if (pfd[i].events & POLLWRBAND)
+                    pfd[i].revents |= POLLWRBAND;
                 ok++;
             }
             if (FD_ISSET(pfd[i].fd, &efds)) {
-                pfd[i].revents |= POLLPRI;
+                if (pfd[i].events & POLLPRI)
+                    pfd[i].revents |= POLLPRI;
+                if (pfd[i].events & POLLRDBAND)
+                    pfd[i].revents |= POLLRDBAND;
                 ok++;
             }
             if (ok)

CVSTrac 2.0.1