celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject svn commit: r1628728 - /celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
Date Wed, 01 Oct 2014 15:11:16 GMT
Author: bpetri
Date: Wed Oct  1 15:11:16 2014
New Revision: 1628728

URL: http://svn.apache.org/r1628728
Log:
CELIX-160: Add new property RSA_IP, which can be used to override the locally determined IP
adress

Modified:
    celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c

Modified: celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c?rev=1628728&r1=1628727&r2=1628728&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
(original)
+++ celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
Wed Oct  1 15:11:16 2014
@@ -369,24 +369,31 @@ static celix_status_t constructServiceUr
 	} else {
 		char host[APRMAXHOSTLEN + 1];
 		apr_sockaddr_t *sa;
-		char *ip;
+		char *ip = NULL;
         
-		apr_status_t stat = apr_gethostname(host, APRMAXHOSTLEN + 1, admin->pool); /*TODO mem
leak*/
-		if (stat != APR_SUCCESS) {
-			status = CELIX_BUNDLE_EXCEPTION;
-		} else {
-			stat = apr_sockaddr_info_get(&sa, host, APR_INET, 0, 0, admin->pool); /*TODO mem
leak*/
+		bundleContext_getProperty(admin->context, "RSA_IP", &ip);
+
+		if (ip == NULL) {
+			apr_status_t stat = apr_gethostname(host, APRMAXHOSTLEN + 1, admin->pool); /*TODO mem
leak*/
 			if (stat != APR_SUCCESS) {
 				status = CELIX_BUNDLE_EXCEPTION;
 			} else {
-				stat = apr_sockaddr_ip_get(&ip, sa);
+				stat = apr_sockaddr_info_get(&sa, host, APR_INET, 0, 0, admin->pool); /*TODO mem
leak*/
 				if (stat != APR_SUCCESS) {
 					status = CELIX_BUNDLE_EXCEPTION;
 				} else {
-					*serviceUrl = apr_pstrcat(admin->pool, "http://", ip, ":", admin->port, service,
NULL );
+					stat = apr_sockaddr_ip_get(&ip, sa);
+					if (stat != APR_SUCCESS) {
+						status = CELIX_BUNDLE_EXCEPTION;
+					} else {
+						*serviceUrl = apr_pstrcat(admin->pool, "http://", ip, ":", admin->port, service,
NULL );
+					}
 				}
 			}
 		}
+		else {
+			*serviceUrl = apr_pstrcat(admin->pool, "http://", ip, ":", admin->port, service,
NULL );
+		}
 	}
     
 	return status;



Mime
View raw message