[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apr-cvs
Subject:    svn commit: r178842 - in /apr/apr/branches/0.9.x: CHANGES
From:       wsanchez () apache ! org
Date:       2005-05-28 0:06:37
Message-ID: 20050528000637.5203.qmail () minotaur ! apache ! org
[Download RAW message or body]

Author: wsanchez
Date: Fri May 27 17:06:36 2005
New Revision: 178842

URL: http://svn.apache.org/viewcvs?rev=178842&view=rev
Log:
Backport r178340 from trunk:

network_io/unix/sendrecv.c: Deal with EAGAIN after poll().

Following apr_wait_for_io_or_timeout(), we were doing I/O and not
dealing with EAGAIN.  It is legal for poll() to indicate that a socket
is available for writing and then for write() to fail with EAGAIN if
the state of the socket changed in between the poll() and write()
calls.  This only seems to actually happen on Mac OS 10.4 (Darwin 8).

Rather than trying write() only once, if we get an EAGAIN, continue to
call apr_wait_for_io_or_timeout() and try writing.

Modified:
    apr/apr/branches/0.9.x/CHANGES
    apr/apr/branches/0.9.x/network_io/unix/sendrecv.c

Modified: apr/apr/branches/0.9.x/CHANGES
URL: http://svn.apache.org/viewcvs/apr/apr/branches/0.9.x/CHANGES?rev=178842&r1=178841&r2=178842&view=diff
 ==============================================================================
--- apr/apr/branches/0.9.x/CHANGES (original)
+++ apr/apr/branches/0.9.x/CHANGES Fri May 27 17:06:36 2005
@@ -2,6 +2,9 @@
 
   *) Fix detection of rwlocks on Mac OS X. [Aaron Bannert]
 
+  *) Fix issue with poll() followed by net I/O yielding EAGAIN on
+     Mac OS 10.4 (Darwin 8). [Wilfredo Sanchez]
+
 Changes with APR 0.9.6
 
   *) Add apr_threadattr_stacksize_set() for overriding the default

Modified: apr/apr/branches/0.9.x/network_io/unix/sendrecv.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/0.9.x/network_io/unix/sendrecv.c?rev=178842&r1=178841&r2=178842&view=diff
 ==============================================================================
--- apr/apr/branches/0.9.x/network_io/unix/sendrecv.c (original)
+++ apr/apr/branches/0.9.x/network_io/unix/sendrecv.c Fri May 27 17:06:36 2005
@@ -41,7 +41,7 @@
         rv = write(sock->socketdes, buf, (*len));
     } while (rv == -1 && errno == EINTR);
 
-    if (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) 
+    while (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) 
         && apr_is_option_set(sock->netmask, APR_SO_TIMEOUT)) {
         apr_status_t arv;
 do_select:
@@ -81,7 +81,7 @@
         rv = read(sock->socketdes, buf, (*len));
     } while (rv == -1 && errno == EINTR);
 
-    if (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && 
+    while (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && 
         apr_is_option_set(sock->netmask, APR_SO_TIMEOUT)) {
 do_select:
         arv = apr_wait_for_io_or_timeout(NULL, sock, 1);
@@ -121,7 +121,7 @@
                     where->salen);
     } while (rv == -1 && errno == EINTR);
 
-    if (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)
+    while (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)
         && apr_is_option_set(sock->netmask, APR_SO_TIMEOUT)) {
         apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 0);
         if (arv != APR_SUCCESS) {
@@ -154,7 +154,7 @@
                       (struct sockaddr*)&from->sa, &from->salen);
     } while (rv == -1 && errno == EINTR);
 
-    if (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) &&
+    while (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) &&
         apr_is_option_set(sock->netmask, APR_SO_TIMEOUT)) {
         apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 1);
         if (arv != APR_SUCCESS) {
@@ -201,7 +201,7 @@
         rv = writev(sock->socketdes, vec, nvec);
     } while (rv == -1 && errno == EINTR);
 
-    if (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && 
+    while (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && 
         apr_is_option_set(sock->netmask, APR_SO_TIMEOUT)) {
         apr_status_t arv;
 do_select:
@@ -300,7 +300,7 @@
                       *len);   /* number of bytes to send */
     } while (rv == -1 && errno == EINTR);
 
-    if (rv == -1 && 
+    while (rv == -1 && 
         (errno == EAGAIN || errno == EWOULDBLOCK) && 
         apr_is_option_set(sock->netmask, APR_SO_TIMEOUT)) {
 do_select:
@@ -641,7 +641,7 @@
         }
     } while (rc == -1 && errno == EINTR);
 
-    if (rc == -1 && 
+    while (rc == -1 && 
         (errno == EAGAIN || errno == EWOULDBLOCK) && 
         apr_is_option_set(sock->netmask, APR_SO_TIMEOUT)) {
         apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 0);
@@ -789,7 +789,7 @@
                        flags);             /* flags */
     } while (rv == -1 && errno == EINTR);
 
-    if (rv == -1 &&
+    while (rv == -1 &&
         (errno == EAGAIN || errno == EWOULDBLOCK) &&
         apr_is_option_set(sock->netmask, APR_SO_TIMEOUT)) {
 do_select:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic