diff options
author | Joe Orton <jorton@apache.org> | 2012-06-19 17:13:37 +0200 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2012-06-19 17:13:37 +0200 |
commit | 6c85d01a0618f8c3c968ed8ee4673c535eb51746 (patch) | |
tree | 0db1d282c178c7b52d2510e025ff868ac7ff9162 /support | |
parent | Updates. (diff) | |
download | apache2-6c85d01a0618f8c3c968ed8ee4673c535eb51746.tar.xz apache2-6c85d01a0618f8c3c968ed8ee4673c535eb51746.zip |
* support/ab.c (test, start_connect): Only bind the local end of the
socket (and look up an address for it) if -B is specified.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1351737 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'support')
-rw-r--r-- | support/ab.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/support/ab.c b/support/ab.c index 6b1e98954f..d2b1a986f9 100644 --- a/support/ab.c +++ b/support/ab.c @@ -1186,8 +1186,10 @@ static void start_connect(struct connection * c) apr_err("socket", rv); } - if ((rv = apr_socket_bind(c->aprsock, mysa)) != APR_SUCCESS) { - apr_err("bind", rv); + if (myhost) { + if ((rv = apr_socket_bind(c->aprsock, mysa)) != APR_SUCCESS) { + apr_err("bind", rv); + } } c->pollfd.desc_type = APR_POLL_SOCKET; @@ -1686,13 +1688,15 @@ static void test(void) exit(1); } #endif /* NOT_ASCII */ - - /* This only needs to be done once */ - if ((rv = apr_sockaddr_info_get(&mysa, myhost, APR_UNSPEC, 0, 0, cntxt)) != APR_SUCCESS) { - char buf[120]; - apr_snprintf(buf, sizeof(buf), - "apr_sockaddr_info_get() for %s", myhost); - apr_err(buf, rv); + + if (myhost) { + /* This only needs to be done once */ + if ((rv = apr_sockaddr_info_get(&mysa, myhost, APR_UNSPEC, 0, 0, cntxt)) != APR_SUCCESS) { + char buf[120]; + apr_snprintf(buf, sizeof(buf), + "apr_sockaddr_info_get() for %s", myhost); + apr_err(buf, rv); + } } /* This too */ |