apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric van der Maarel <eric.vandermaa...@nedap.com>
Subject Fwd: Re: 100% cpu with APR on Windows
Date Fri, 29 Jul 2011 07:29:49 GMT
Hi,

Maybe the patch is required as an attachment? Here it is.
Can it be included in apr?

Regards,
Eric

--- apr.orig/poll/unix/select.c	2009-10-02 18:24:00.000000000 +0200
+++ apr/poll/unix/select.c	2011-07-07 14:55:29.000000000 +0200
@@ -149,6 +149,14 @@
              break;
          }
          if (FD_ISSET(fd, &readset)) {
+            char c;
+            int r = recv(fd, &c, 1, MSG_PEEK);
+            if (r == 0) {
+                aprset[i].rtnevents |= APR_POLLHUP;
+            }
+            else if (r < 0) {
+                aprset[i].rtnevents |= APR_POLLERR;
+            }
              aprset[i].rtnevents |= APR_POLLIN;
          }
          if (FD_ISSET(fd, &writeset)) {
@@ -399,6 +407,14 @@
              pollset->p->result_set[j] = pollset->p->query_set[i];
              pollset->p->result_set[j].rtnevents = 0;
              if (FD_ISSET(fd, &readset)) {
+                char c;
+                int r = recv(fd, &c, 1, MSG_PEEK);
+                if (r == 0) {
+                    pollset->p->result_set[j].rtnevents |= APR_POLLHUP;
+                }
+                else if (r < 0) {
+                    pollset->p->result_set[j].rtnevents |= APR_POLLERR;
+                }
                  pollset->p->result_set[j].rtnevents |= APR_POLLIN;
              }
              if (FD_ISSET(fd, &writeset)) {



-- 
-------------------------------------------
| Eric van der Maarel                     |
| NEDAP IDEAS                             |
| eric.vandermaarel@nedap.com             |
-------------------------------------------^[ZZ

Mime
View raw message