]> granicus.if.org Git - apache/commitdiff
* Improve reusage of already resolved addresses to avoid unnecessary DNS lookups.
authorRuediger Pluem <rpluem@apache.org>
Thu, 28 Mar 2013 19:36:03 +0000 (19:36 +0000)
committerRuediger Pluem <rpluem@apache.org>
Thu, 28 Mar 2013 19:36:03 +0000 (19:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1462269 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/proxy_util.c

index 441d2e40f53dde814250a3a14a3f033933cb2216..9e773fb2e7fd35b64f28ffc3a9eba4ee20883a6b 100644 (file)
@@ -2156,10 +2156,21 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
             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) {