]> granicus.if.org Git - apache/commitdiff
Simplify ap_proxy_doconnect(); now returns apr_status_t
authorChuck Murcko <chuck@apache.org>
Tue, 14 Nov 2000 17:15:11 +0000 (17:15 +0000)
committerChuck Murcko <chuck@apache.org>
Tue, 14 Nov 2000 17:15:11 +0000 (17:15 +0000)
PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86961 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy.h
modules/proxy/proxy_util.c

index 75c4d5b0a97958c3b547ae34ccde6357a22cd648..951d9d8eb93553b5af60d6e1da547012462671fc 100644 (file)
@@ -273,7 +273,7 @@ int ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p);
 int ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *p);
 int ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *p);
 int ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p);
-int ap_proxy_doconnect(apr_socket_t *sock, char *host, apr_uint32_t port, request_rec *r);
+apr_status_t ap_proxy_doconnect(apr_socket_t *sock, char *host, apr_uint32_t port, request_rec *r);
 int ap_proxy_garbage_init(server_rec *, apr_pool_t *);
 /* This function is called by ap_table_do() for all header lines */
 int ap_proxy_send_hdr_line(void *p, const char *key, const char *value);
index de47219f34b2ebd4c5831fe4c419943383e8cfc3..6338ca92be99341ead2acdd04a002eea0ad33648 100644 (file)
@@ -1136,8 +1136,9 @@ static int proxy_match_word(struct dirconn_entry *This, request_rec *r)
     return host != NULL && ap_strstr_c(host, This->name) != NULL;
 }
 
-int ap_proxy_doconnect(apr_socket_t *sock, char *host, apr_uint32_t port, request_rec *r)
+apr_status_t ap_proxy_doconnect(apr_socket_t *sock, char *host, apr_uint32_t port, request_rec *r)
 {
+    apr_status_t rv;
     int i;
 
     for (i = 0; host[i] != '\0'; i++)
@@ -1149,20 +1150,18 @@ int ap_proxy_doconnect(apr_socket_t *sock, char *host, apr_uint32_t port, reques
         apr_set_ipaddr(sock, APR_REMOTE, host);
         host = NULL;
     }
-    for(;;)
+
+    do
     {
-        apr_status_t rv = apr_connect(sock, host);
-        if (APR_STATUS_IS_EINTR(rv))
-            continue;
-        else if (rv == APR_SUCCESS)
-            return 0;
-        else {
-            ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
-                "proxy connect to %s port %d failed", host, port);
-            return -1;
-        }
+        rv = apr_connect(sock, host);
+    } while (APR_STATUS_IS_EINTR(rv));
+
+    if (rv != APR_SUCCESS)
+    {
+        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+            "proxy connect to %s port %d failed", host, port);
     }
-    return -1;
+    return rv;
 }
 
 /* This function is called by ap_table_do() for all header lines */