You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2016/06/30 17:29:41 UTC
svn commit: r1750843 - in /httpd/httpd/branches/2.2.x: STATUS
modules/proxy/proxy_util.c
Author: wrowe
Date: Thu Jun 30 17:29:41 2016
New Revision: 1750843
URL: http://svn.apache.org/viewvc?rev=1750843&view=rev
Log:
mod_proxy: save DNS lookups
Backports: r1462269, r1463455
Submitted by: rpluem
Reviewed by: wrowe, ylavic
Modified:
httpd/httpd/branches/2.2.x/STATUS
httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c
Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=1750843&r1=1750842&r2=1750843&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Thu Jun 30 17:29:41 2016
@@ -112,13 +112,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
http://people.apache.org/~rpluem/patches/proxy_race_retry_2.2.x_v2.diff
+1: rpluem, wrowe, ylavic
- *) mod_proxy: save DNS lookups
- trunk patch: https://svn.apache.org/viewvc?view=revision&revision=1462269
- https://svn.apache.org/viewvc?view=revision&revision=1463455
- 2.4.x patch: http://svn.apache.org/viewvc?view=revision&revision=1511313
- 2.2.x patch: http://people.apache.org/~rpluem/patches/proxy-dns-patch_2.2.x.diff
- +1: rpluem, wrowe, ylavic
-
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
[ New proposals should be added at the end of the list ]
Modified: httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c?rev=1750843&r1=1750842&r2=1750843&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c Thu Jun 30 17:29:41 2016
@@ -2233,36 +2233,48 @@ ap_proxy_determine_connection(apr_pool_t
conn->port = uri->port;
}
socket_cleanup(conn);
- err = apr_sockaddr_info_get(&(conn->addr),
- conn->hostname, APR_UNSPEC,
- conn->port, 0,
- conn->pool);
- }
- else if (!worker->cp->addr) {
- if ((err = PROXY_THREAD_LOCK(worker)) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server,
- "proxy: lock");
- return HTTP_INTERNAL_SERVER_ERROR;
+ if (!worker->is_address_reusable || worker->disablereuse) {
+ /*
+ * Only do a lookup if we should not reuse the backend address.
+ * Otherwise we will look it up once for the worker.
+ */
+ err = apr_sockaddr_info_get(&(conn->addr),
+ conn->hostname, APR_UNSPEC,
+ conn->port, 0,
+ conn->pool);
}
-
+ }
+ if (worker->is_address_reusable && !worker->disablereuse) {
/*
- * Worker can have the single constant backend adress.
- * The single DNS lookup is used once per worker.
- * If dynamic change is needed then set the addr to NULL
- * inside dynamic config to force the lookup.
+ * Looking up the backend address for the worker only makes sense if
+ * we can reuse the address.
*/
- err = apr_sockaddr_info_get(&(worker->cp->addr),
- conn->hostname, APR_UNSPEC,
- conn->port, 0,
- worker->cp->pool);
- conn->addr = worker->cp->addr;
- if ((uerr = PROXY_THREAD_UNLOCK(worker)) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_ERR, uerr, r->server,
- "proxy: unlock");
+ if (!worker->cp->addr) {
+ if ((err = PROXY_THREAD_LOCK(worker)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server,
+ "proxy: lock");
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ /*
+ * Worker can have the single constant backend adress.
+ * The single DNS lookup is used once per worker.
+ * If dynamic change is needed then set the addr to NULL
+ * inside dynamic config to force the lookup.
+ */
+ err = apr_sockaddr_info_get(&(worker->cp->addr),
+ conn->hostname, APR_UNSPEC,
+ conn->port, 0,
+ worker->cp->pool);
+ conn->addr = worker->cp->addr;
+ if ((uerr = PROXY_THREAD_UNLOCK(worker)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, uerr, r->server,
+ "proxy: unlock");
+ }
+ }
+ else {
+ conn->addr = worker->cp->addr;
}
- }
- else {
- conn->addr = worker->cp->addr;
}
/* Close a possible existing socket if we are told to do so */
if (conn->close) {