You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2013/03/28 20:36:03 UTC

svn commit: r1462269 - /httpd/httpd/trunk/modules/proxy/proxy_util.c

Author: rpluem
Date: Thu Mar 28 19:36:03 2013
New Revision: 1462269

URL: http://svn.apache.org/r1462269
Log:
* Improve reusage of already resolved addresses to avoid unnecessary DNS lookups.

Modified:
    httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1462269&r1=1462268&r2=1462269&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Thu Mar 28 19:36:03 2013
@@ -2156,10 +2156,21 @@ ap_proxy_determine_connection(apr_pool_t
             conn->uds_path = uds_path;
         }
         else {
-            err = apr_sockaddr_info_get(&(conn->addr),
-                                        conn->hostname, APR_UNSPEC,
-                                        conn->port, 0,
-                                        conn->pool);
+            if (worker->s->is_address_reusable && !worker->s->disablereuse
+                && worker->cp->addr) {
+                /*
+                 * We got here because only conn->hostname was null.
+                 * If we have a worker->cp->addr we are allowed to reuse it
+                 * and hence save a DNS lookup.
+                 */
+                conn->addr = worker->cp->addr;
+            }
+            else {
+                err = apr_sockaddr_info_get(&(conn->addr),
+                                            conn->hostname, APR_UNSPEC,
+                                            conn->port, 0,
+                                            conn->pool);
+            }
         }
     }
     else if (!worker->cp->addr) {