]> granicus.if.org Git - apache/commitdiff
Don't stop sending a request if EAGAIN is returned, which will only
authorRoy T. Fielding <fielding@apache.org>
Mon, 12 May 2008 20:53:13 +0000 (20:53 +0000)
committerRoy T. Fielding <fielding@apache.org>
Mon, 12 May 2008 20:53:13 +0000 (20:53 +0000)
happen if both the write and subsequent wait are returning EAGAIN,
and count posted bytes correctly when the initial write of a request
is not complete.

PR 10038, 38861, 39679
Submitted by: Patrick McManus <mcmanus datapower.com> (in 2003)
              Stefan Fleiter <stefan.fleiter web.de>  (in 2006)
              and Davanum Srinivas (in 2006).  Committed patch
              contains parts of all three, tweaked by Roy (2008).

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@655637 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
support/ab.c

diff --git a/CHANGES b/CHANGES
index 523f88ee37e2a3b55e284394ae892ac415bd014e..f945e2530083aa6b2a28c6b670b0930a0326cc9e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,14 @@
 Changes with Apache 2.3.0
 [ When backported to 2.2.x, remove entry from this file ]
 
+  *) ab: Don't stop sending a request if EAGAIN is returned, which
+     will only happen if both the write and subsequent wait are
+     returning EAGAIN, and count posted bytes correctly when the initial
+     write of a request is not complete. PR 10038, 38861, 39679
+     [Patrick McManus <mcmanus datapower.com>,
+      Stefan Fleiter <stefan.fleiter web.de>,
+      Davanum Srinivas, Roy T. Fielding]
+
   *) ab: Overhaul stats collection and reporting to avoid integer
      truncation and time divisions within the test loop, retain
      native time resolution until output, remove unused data,
index 438872b8aaf75d4795c4d3ef6359ed77ebd339b3..d74111e403213d2f299a5b127468cc7539fd0f7d 100644 (file)
@@ -627,8 +627,8 @@ static void write_request(struct connection * c)
         if (c->rwrite == 0) {
             apr_socket_timeout_set(c->aprsock, 0);
             c->connect = tnow;
-            c->rwrite = reqlen;
             c->rwrote = 0;
+            c->rwrite = reqlen;
             if (posting)
                 c->rwrite += postlen;
         }
@@ -655,28 +655,17 @@ static void write_request(struct connection * c)
 #endif
             e = apr_socket_send(c->aprsock, request + c->rwrote, &l);
 
-        /*
-         * Bail early on the most common case
-         */
-        if (l == c->rwrite)
-            break;
-
-        if (e != APR_SUCCESS) {
-            /*
-             * Let's hope this traps EWOULDBLOCK too !
-             */
-            if (!APR_STATUS_IS_EAGAIN(e)) {
-                epipe++;
-                printf("Send request failed!\n");
-                close_connection(c);
-            }
+        if (e != APR_SUCCESS && !APR_STATUS_IS_EAGAIN(e)) {
+            epipe++;
+            printf("Send request failed!\n");
+            close_connection(c);
             return;
         }
+        totalposted += l;
         c->rwrote += l;
         c->rwrite -= l;
-    } while (1);
+    } while (c->rwrite);
 
-    totalposted += c->rwrite;
     c->state = STATE_READ;
     c->endwrite = lasttime = apr_time_now();
     {