You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by bp...@apache.org on 2014/10/02 08:44:28 UTC
svn commit: r1628893 -
/celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
Author: bpetri
Date: Thu Oct 2 06:44:28 2014
New Revision: 1628893
URL: http://svn.apache.org/r1628893
Log:
CELIX-160: remove debug output, add break for loop
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=1628893&r1=1628892&r2=1628893&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 Thu Oct 2 06:44:28 2014
@@ -74,6 +74,7 @@ static const char * const CONFIGURATION_
static const char * const ENDPOINT_URL = "org.amdatu.remote.admin.http.url";
static const char *DEFAULT_PORT = "8888";
+static const char *DEFAULT_IP = "127.0.0.1";
static int remoteServiceAdmin_callback(struct mg_connection *conn);
@@ -114,7 +115,7 @@ celix_status_t remoteServiceAdmin_create
bundleContext_getProperty(context, "RSA_INTERFACE", &interface);
if ((interface != NULL) && (remoteServiceAdmin_getIpAdress(interface, &ip) != CELIX_SUCCESS)) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "RSA: Could not retrieve IP adress for interface %s\n", interface);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "RSA: Could not retrieve IP adress for interface %s", interface);
}
if (ip == NULL) {
@@ -127,7 +128,8 @@ celix_status_t remoteServiceAdmin_create
(*admin)->ip = apr_pstrdup(pool, ip);
}
else {
- fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "RSA: No IP address for service annunciation set.");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "RSA: No IP address for service annunciation set. Using %s", DEFAULT_IP);
+ (*admin)->ip = (char*) DEFAULT_IP;
}
@@ -403,16 +405,12 @@ static celix_status_t remoteServiceAdmin
if (getifaddrs(&ifaddr) != -1)
{
- for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next)
+ for (ifa = ifaddr; ifa != NULL && status != CELIX_SUCCESS; ifa = ifa->ifa_next)
{
if (ifa->ifa_addr == NULL)
continue;
- printf("ITERATE\n");
-
if ((getnameinfo(ifa->ifa_addr,sizeof(struct sockaddr_in), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) == 0) && (ifa->ifa_addr->sa_family == AF_INET)) {
- printf("\tInterface : <%s>\n",ifa->ifa_name );
- printf("\t Address : <%s>\n", host);
if (interface == NULL) {
*ip = strdup(host);
status = CELIX_SUCCESS;