celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject svn commit: r1632612 - in /celix/trunk/remote_services/discovery/private/src: endpoint_discovery_poller.c endpoint_discovery_server.c
Date Fri, 17 Oct 2014 15:37:34 GMT
Author: bpetri
Date: Fri Oct 17 15:37:34 2014
New Revision: 1632612

URL: http://svn.apache.org/r1632612
Log:
CELIX-169: add proper clean up

Modified:
    celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c
    celix/trunk/remote_services/discovery/private/src/endpoint_discovery_server.c

Modified: celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c?rev=1632612&r1=1632611&r2=1632612&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c (original)
+++ celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c Fri Oct
17 15:37:34 2014
@@ -93,6 +93,7 @@ celix_status_t endpointDiscoveryPoller_c
 
 	(*poller)->poll_interval = atoi(interval);
 	(*poller)->discovery = discovery;
+	(*poller)->running = false;
 	(*poller)->entries = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
 
 	const char* sep = ",";

Modified: celix/trunk/remote_services/discovery/private/src/endpoint_discovery_server.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery/private/src/endpoint_discovery_server.c?rev=1632612&r1=1632611&r2=1632612&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery/private/src/endpoint_discovery_server.c (original)
+++ celix/trunk/remote_services/discovery/private/src/endpoint_discovery_server.c Fri Oct
17 15:37:34 2014
@@ -143,11 +143,10 @@ celix_status_t endpointDiscoveryServer_c
 		if ((*server)->ctx != NULL)
 		{
 			fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "Starting discovery server on port %s...", port);
-			(*server)->port = port;
 		}
 		else {
 			errno = 0;
-			char* newPort = calloc(10, sizeof(*newPort));
+			char newPort[10];
 	        char* endptr = port;
 	        int currentPort = strtol(port, &endptr, 10);
 
@@ -156,14 +155,17 @@ celix_status_t endpointDiscoveryServer_c
 	        }
 
 	        port_counter++;
-			snprintf(newPort, 6,  "%d", (currentPort+1));
+			snprintf(&newPort[0], 10,  "%d", (currentPort+1));
 
 			fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error while starting discovery server on port
%s - retrying on port %s...", port, newPort);
 			port = newPort;
+
 		}
 
 	} while(((*server)->ctx == NULL) && (port_counter < MAX_NUMBER_OF_RESTARTS));
 
+	(*server)->port = strdup(port);
+
 	return status;
 }
 



Mime
View raw message