]> granicus.if.org Git - apache/commitdiff
Avoid having to recheck DNS
authorJim Jagielski <jim@apache.org>
Fri, 15 Jan 2016 22:11:02 +0000 (22:11 +0000)
committerJim Jagielski <jim@apache.org>
Fri, 15 Jan 2016 22:11:02 +0000 (22:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1724886 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_hcheck.c

index d035ed127f639f5f5139d24c5ad08cfbc91a7627..3a4b9a159f49deaced8c61ab71b42f6d006ca915 100644 (file)
@@ -314,7 +314,7 @@ static apr_status_t hc_check_tcp(sctx_t *ctx, apr_pool_t *p, proxy_worker *worke
             ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ctx->s, APLOGNO() "Cannot init worker");
             return rv;
         }
-        err = apr_sockaddr_info_get(&(cp->addr), worker->s->hostname, APR_UNSPEC,
+        err = apr_sockaddr_info_get(&(worker->cp->addr), worker->s->hostname, APR_UNSPEC,
                                     worker->s->port, 0, ctx->p);
 
         if (err != APR_SUCCESS) {
@@ -324,7 +324,7 @@ static apr_status_t hc_check_tcp(sctx_t *ctx, apr_pool_t *p, proxy_worker *worke
             return err;
         }
     }
-    backend = (proxy_conn_rec *) apr_palloc(p, sizeof(proxy_conn_rec));
+    cp->addr = worker->cp->addr;
     status = ap_proxy_acquire_connection("HCTCP", &backend, ctx->hc, ctx->s);
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ctx->s, APLOGNO()
                      "ap_proxy_acquire_connection (%d).", status);
@@ -342,8 +342,8 @@ static apr_status_t hc_check_tcp(sctx_t *ctx, apr_pool_t *p, proxy_worker *worke
     ctx->hc->cp = cp;
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ctx->s, APLOGNO()
                      "Health check TCP Status (%d).", status);
+    backend_cleanup("HCTCP", backend, ctx->s);
     if (status != OK) {
-        backend_cleanup("HCTCP", backend, ctx->s);
         return APR_EGENERAL;
     }
     return APR_SUCCESS;