summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorJan Kaluža <jkaluza@apache.org>2014-09-30 10:39:41 +0000
committerJan Kaluža <jkaluza@apache.org>2014-09-30 10:39:41 +0000
commit430892c1abdcc388e056a81f7117f0c20d7d6638 (patch)
treed3766f5d9046ccf706836674bcad93f3141b25c0 /support
parent358075baa36bac30a10cd0c4f7b0c5b8a22b5c84 (diff)
downloadhttpd-430892c1abdcc388e056a81f7117f0c20d7d6638.tar.gz
ab: Use only one connection to determine working destination socket address.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1628388 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'support')
-rw-r--r--support/ab.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/support/ab.c b/support/ab.c
index 095e3d03a7..a4599dc30c 100644
--- a/support/ab.c
+++ b/support/ab.c
@@ -343,6 +343,7 @@ apr_time_t start, lasttime, stoptime;
char _request[8192];
char *request = _request;
apr_size_t reqlen;
+int requests_initialized = 0;
/* one global throw-away buffer to read stuff into */
char buffer[8192];
@@ -1395,6 +1396,7 @@ static void read_connection(struct connection * c)
apr_status_t status;
char *part;
char respcode[4]; /* 3 digits and null */
+ int i;
r = sizeof(buffer);
#ifdef USE_SSL
@@ -1593,6 +1595,16 @@ static void read_connection(struct connection * c)
}
c->bread += c->cbx - (s + l - c->cbuff) + r - tocopy;
totalbread += c->bread;
+
+ /* We have received the header, so we know this destination socket
+ * address is working, so initialize all remaining requests. */
+ if (!requests_initialized) {
+ for (i = 1; i < concurrency; i++) {
+ con[i].socknum = i;
+ start_connect(&con[i]);
+ }
+ requests_initialized = 1;
+ }
}
}
else {
@@ -1797,11 +1809,10 @@ static void test(void)
apr_signal(SIGINT, output_results);
#endif
- /* initialise lots of requests */
- for (i = 0; i < concurrency; i++) {
- con[i].socknum = i;
- start_connect(&con[i]);
- }
+ /* initialise first connection to determine destination socket address
+ * which should be used for next connections. */
+ con[0].socknum = 0;
+ start_connect(&con[0]);
do {
apr_int32_t n;