httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Saccoccio" <r...@fastcgi.com>
Subject [patch] ab.c
Date Sat, 20 Jul 2002 23:07:59 GMT
I encountered some brokenness running ab on Win2K.  It was spinning do to a
bug in apr_poll() (patches posted to apr) and start_connect().

The patch fixes this and a couple of other tweaks..

concurrency is now required to be smaller than the number of requests rather
than trying to deal with it (badly).

If there were no more requests to be made, start_connect() will now remove
the socket from the pollset.  Without this the pollset will have an entry
with a socket with a closed handle.  This change should probably be applied
to ssl_start_connect() as well.

A timeout return from apr_poll() is now properly handled.

Note there are piles of tabs in ab.c that should be removed.

--rob


diff -u -r1.113 ab.c
--- ab.c	16 Jul 2002 09:30:16 -0000	1.113
+++ ab.c	20 Jul 2002 22:46:50 -0000
@@ -592,11 +592,7 @@
     int i, count, hdone = 0;
     char ssl_hostname[80];

-    /* XXX - Verify if it's okay - TBD */
-    if (requests < concurrency)
-        requests = concurrency;
-
-    if (!(started < requests))
+    if (started >= requests)
         return;

     c->read = 0;
@@ -1208,8 +1204,10 @@
     }
 #endif

-    if (!(started < requests))
-	return;
+    if (started >= requests) {
+        apr_poll_socket_remove(readbits, c->aprsock);
+        return;
+    }

     c->read = 0;
     c->bread = 0;
@@ -1644,19 +1642,20 @@
 	    break;		/* no need to do another round */
 	}

-	n = concurrency;
 #ifdef USE_SSL
         if (ssl == 1)
             status = APR_SUCCESS;
         else
 #endif
 	status = apr_poll(readbits, concurrency, &n, aprtimeout);
-	if (status != APR_SUCCESS)
-	    apr_err("apr_poll", status);
-
-	if (!n) {
-	    err("\nServer timed out\n\n");
-	}
+        if (status != APR_SUCCESS) {
+            if (status == APR_TIMEUP) {
+                err("Server timed out\n");
+            }
+            else {
+                apr_err("apr_poll", status);
+            }
+        }

 	for (i = 0; i < concurrency; i++) {
 	    /*
@@ -2087,6 +2086,11 @@
 	    copyright();
 	    return 0;
 	}
+    }
+
+    if (requests < concurrency) {
+	fprintf(stderr, "%s: requests is less than concurrency\n", argv[0]);
+	usage(argv[0]);
     }

     if (opt->ind != argc - 1) {


Mime
View raw message