|
|
008793 |
diff --git a/support/ab.c b/support/ab.c
|
|
|
008793 |
index f54c402..93c9066 100644
|
|
|
008793 |
--- a/support/ab.c
|
|
|
008793 |
+++ b/support/ab.c
|
|
|
008793 |
@@ -344,6 +344,7 @@ apr_time_t start, lasttime, stoptime;
|
|
|
008793 |
char _request[2048];
|
|
|
008793 |
char *request = _request;
|
|
|
008793 |
apr_size_t reqlen;
|
|
|
008793 |
+int requests_initialized = 0;
|
|
|
008793 |
|
|
|
008793 |
/* one global throw-away buffer to read stuff into */
|
|
|
008793 |
char buffer[8192];
|
|
|
008793 |
@@ -1253,12 +1254,18 @@ static void start_connect(struct connection * c)
|
|
|
008793 |
else {
|
|
|
008793 |
set_conn_state(c, STATE_UNCONNECTED);
|
|
|
008793 |
apr_socket_close(c->aprsock);
|
|
|
008793 |
- err_conn++;
|
|
|
008793 |
- if (bad++ > 10) {
|
|
|
008793 |
+ if (good == 0 && destsa->next) {
|
|
|
008793 |
+ destsa = destsa->next;
|
|
|
008793 |
+ err_conn = 0;
|
|
|
008793 |
+ }
|
|
|
008793 |
+ else if (bad++ > 10) {
|
|
|
008793 |
fprintf(stderr,
|
|
|
008793 |
"\nTest aborted after 10 failures\n\n");
|
|
|
008793 |
apr_err("apr_socket_connect()", rv);
|
|
|
008793 |
}
|
|
|
008793 |
+ else {
|
|
|
008793 |
+ err_conn++;
|
|
|
008793 |
+ }
|
|
|
008793 |
|
|
|
008793 |
start_connect(c);
|
|
|
008793 |
return;
|
|
|
008793 |
@@ -1339,6 +1346,7 @@ static void read_connection(struct connection * c)
|
|
|
008793 |
apr_status_t status;
|
|
|
008793 |
char *part;
|
|
|
008793 |
char respcode[4]; /* 3 digits and null */
|
|
|
008793 |
+ int i;
|
|
|
008793 |
|
|
|
008793 |
r = sizeof(buffer);
|
|
|
008793 |
#ifdef USE_SSL
|
|
|
008793 |
@@ -1362,6 +1370,13 @@ static void read_connection(struct connection * c)
|
|
|
008793 |
good++;
|
|
|
008793 |
close_connection(c);
|
|
|
008793 |
}
|
|
|
008793 |
+ else if (scode == SSL_ERROR_SYSCALL
|
|
|
008793 |
+ && c->read == 0
|
|
|
008793 |
+ && destsa->next
|
|
|
008793 |
+ && c->state == STATE_CONNECTING
|
|
|
008793 |
+ && good == 0) {
|
|
|
008793 |
+ return;
|
|
|
008793 |
+ }
|
|
|
008793 |
else if (scode != SSL_ERROR_WANT_WRITE
|
|
|
008793 |
&& scode != SSL_ERROR_WANT_READ) {
|
|
|
008793 |
/* some fatal error: */
|
|
|
008793 |
@@ -1387,8 +1402,8 @@ static void read_connection(struct connection * c)
|
|
|
008793 |
}
|
|
|
008793 |
/* catch legitimate fatal apr_socket_recv errors */
|
|
|
008793 |
else if (status != APR_SUCCESS) {
|
|
|
008793 |
- err_recv++;
|
|
|
008793 |
if (recverrok) {
|
|
|
008793 |
+ err_recv++;
|
|
|
008793 |
bad++;
|
|
|
008793 |
close_connection(c);
|
|
|
008793 |
if (verbosity >= 1) {
|
|
|
008793 |
@@ -1396,7 +1411,12 @@ static void read_connection(struct connection * c)
|
|
|
008793 |
fprintf(stderr,"%s: %s (%d)\n", "apr_socket_recv", apr_strerror(status, buf, sizeof buf), status);
|
|
|
008793 |
}
|
|
|
008793 |
return;
|
|
|
008793 |
- } else {
|
|
|
008793 |
+ } else if (destsa->next && c->state == STATE_CONNECTING
|
|
|
008793 |
+ && c->read == 0 && good == 0) {
|
|
|
008793 |
+ return;
|
|
|
008793 |
+ }
|
|
|
008793 |
+ else {
|
|
|
008793 |
+ err_recv++;
|
|
|
008793 |
apr_err("apr_socket_recv", status);
|
|
|
008793 |
}
|
|
|
008793 |
}
|
|
|
008793 |
@@ -1523,6 +1543,16 @@ static void read_connection(struct connection * c)
|
|
|
008793 |
}
|
|
|
008793 |
c->bread += c->cbx - (s + l - c->cbuff) + r - tocopy;
|
|
|
008793 |
totalbread += c->bread;
|
|
|
008793 |
+
|
|
|
008793 |
+ /* We have received the header, so we know this destination socket
|
|
|
008793 |
+ * address is working, so initialize all remaining requests. */
|
|
|
008793 |
+ if (!requests_initialized) {
|
|
|
008793 |
+ for (i = 1; i < concurrency; i++) {
|
|
|
008793 |
+ con[i].socknum = i;
|
|
|
008793 |
+ start_connect(&con[i]);
|
|
|
008793 |
+ }
|
|
|
008793 |
+ requests_initialized = 1;
|
|
|
008793 |
+ }
|
|
|
008793 |
}
|
|
|
008793 |
}
|
|
|
008793 |
else {
|
|
|
008793 |
@@ -1734,11 +1764,10 @@ static void test(void)
|
|
|
008793 |
apr_signal(SIGINT, output_results);
|
|
|
008793 |
#endif
|
|
|
008793 |
|
|
|
008793 |
- /* initialise lots of requests */
|
|
|
008793 |
- for (i = 0; i < concurrency; i++) {
|
|
|
008793 |
- con[i].socknum = i;
|
|
|
008793 |
- start_connect(&con[i]);
|
|
|
008793 |
- }
|
|
|
008793 |
+ /* initialise first connection to determine destination socket address
|
|
|
008793 |
+ * which should be used for next connections. */
|
|
|
008793 |
+ con[0].socknum = 0;
|
|
|
008793 |
+ start_connect(&con[0]);
|
|
|
008793 |
|
|
|
008793 |
do {
|
|
|
008793 |
apr_int32_t n;
|
|
|
008793 |
@@ -1786,14 +1815,20 @@ static void test(void)
|
|
|
008793 |
if ((rtnev & APR_POLLIN) || (rtnev & APR_POLLPRI) || (rtnev & APR_POLLHUP))
|
|
|
008793 |
read_connection(c);
|
|
|
008793 |
if ((rtnev & APR_POLLERR) || (rtnev & APR_POLLNVAL)) {
|
|
|
008793 |
- bad++;
|
|
|
008793 |
- err_except++;
|
|
|
008793 |
- /* avoid apr_poll/EINPROGRESS loop on HP-UX, let recv discover ECONNREFUSED */
|
|
|
008793 |
- if (c->state == STATE_CONNECTING) {
|
|
|
008793 |
- read_connection(c);
|
|
|
008793 |
+ if (destsa->next && c->state == STATE_CONNECTING && good == 0) {
|
|
|
008793 |
+ destsa = destsa->next;
|
|
|
008793 |
+ start_connect(c);
|
|
|
008793 |
}
|
|
|
008793 |
else {
|
|
|
008793 |
- start_connect(c);
|
|
|
008793 |
+ bad++;
|
|
|
008793 |
+ err_except++;
|
|
|
008793 |
+ /* avoid apr_poll/EINPROGRESS loop on HP-UX, let recv discover ECONNREFUSED */
|
|
|
008793 |
+ if (c->state == STATE_CONNECTING) {
|
|
|
008793 |
+ read_connection(c);
|
|
|
008793 |
+ }
|
|
|
008793 |
+ else {
|
|
|
008793 |
+ start_connect(c);
|
|
|
008793 |
+ }
|
|
|
008793 |
}
|
|
|
008793 |
continue;
|
|
|
008793 |
}
|