You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2012/06/19 17:13:37 UTC

svn commit: r1351737 - /httpd/httpd/trunk/support/ab.c

Author: jorton
Date: Tue Jun 19 15:13:37 2012
New Revision: 1351737

URL: http://svn.apache.org/viewvc?rev=1351737&view=rev
Log:
* 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.

Modified:
    httpd/httpd/trunk/support/ab.c

Modified: httpd/httpd/trunk/support/ab.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/support/ab.c?rev=1351737&r1=1351736&r2=1351737&view=diff
==============================================================================
--- httpd/httpd/trunk/support/ab.c (original)
+++ httpd/httpd/trunk/support/ab.c Tue Jun 19 15:13:37 2012
@@ -1186,8 +1186,10 @@ static void start_connect(struct connect
     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 */