Author: abroekhuis
Date: Fri Jun 13 20:04:59 2014
New Revision: 1602509
URL: http://svn.apache.org/r1602509
Log:
CELIX-124: Applied patch, added some missing destroy functions to the mocks.
Modified:
incubator/celix/trunk/deployment_admin/private/src/deployment_admin.c
incubator/celix/trunk/deployment_admin/private/src/deployment_package.c
incubator/celix/trunk/device_access/device_access/private/src/device_manager.c
incubator/celix/trunk/device_access/device_access/private/src/driver_loader.c
incubator/celix/trunk/framework/CMakeLists.txt
incubator/celix/trunk/framework/private/mock/bundle_archive_mock.c
incubator/celix/trunk/framework/private/mock/bundle_revision_mock.c
incubator/celix/trunk/framework/private/src/bundle.c
incubator/celix/trunk/framework/private/src/filter.c
incubator/celix/trunk/framework/private/src/framework.c
incubator/celix/trunk/framework/private/src/properties.c
incubator/celix/trunk/framework/private/src/resolver.c
incubator/celix/trunk/framework/private/src/service_tracker.c
incubator/celix/trunk/log_service/private/src/log.c
incubator/celix/trunk/remote_services/discovery_shm/private/include/discovery.h
incubator/celix/trunk/remote_services/discovery_shm/private/src/discovery.c
incubator/celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c
incubator/celix/trunk/remote_services/discovery_slp/private/src/discovery.c
incubator/celix/trunk/remote_services/remote_service_admin/private/include/remote_service_admin_impl.h
incubator/celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
incubator/celix/trunk/remote_services/remote_service_admin_shm/private/include/remote_service_admin_shm_impl.h
incubator/celix/trunk/remote_services/remote_service_admin_shm/private/src/remote_service_admin_activator.c
incubator/celix/trunk/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c
incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c
incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c
incubator/celix/trunk/remote_shell/private/src/remote_shell.c
incubator/celix/trunk/shell/private/src/inspect_command.c
incubator/celix/trunk/shell/private/src/log_command.c
incubator/celix/trunk/shell/private/src/shell.c
Modified: incubator/celix/trunk/deployment_admin/private/src/deployment_admin.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/deployment_admin/private/src/deployment_admin.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/deployment_admin/private/src/deployment_admin.c (original)
+++ incubator/celix/trunk/deployment_admin/private/src/deployment_admin.c Fri Jun 13 20:04:59
2014
@@ -523,6 +523,10 @@ celix_status_t deploymentAdmin_processDe
}
}
+ if(services!=NULL){
+ arrayList_destroy(services);
+ }
+
}
@@ -569,6 +573,10 @@ celix_status_t deploymentAdmin_dropDeplo
}
}
+ if(services!=NULL){
+ arrayList_destroy(services);
+ }
+
}
}
}
Modified: incubator/celix/trunk/deployment_admin/private/src/deployment_package.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/deployment_admin/private/src/deployment_package.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/deployment_admin/private/src/deployment_package.c (original)
+++ incubator/celix/trunk/deployment_admin/private/src/deployment_package.c Fri Jun 13 20:04:59
2014
@@ -163,6 +163,7 @@ celix_status_t deploymentPackage_process
arrayList_add(package->resourceInfos, info);
}
}
+ hashMapIterator_destroy(iter);
return status;
}
Modified: incubator/celix/trunk/device_access/device_access/private/src/device_manager.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/device_access/device_access/private/src/device_manager.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/device_access/device_access/private/src/device_manager.c (original)
+++ incubator/celix/trunk/device_access/device_access/private/src/device_manager.c Fri Jun
13 20:04:59 2014
@@ -468,6 +468,10 @@ celix_status_t deviceManager_getIdleDevi
arrayList_add(*idleDevices, ref);
}
}
+
+ if(bundles!=NULL){
+ arrayList_destroy(bundles);
+ }
}
}
}
@@ -526,6 +530,7 @@ celix_status_t deviceManager_getIdleDevi
}
}
}
+ hashMapIterator_destroy(iter);
}
return status;
}
Modified: incubator/celix/trunk/device_access/device_access/private/src/driver_loader.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/device_access/device_access/private/src/driver_loader.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/device_access/device_access/private/src/driver_loader.c (original)
+++ incubator/celix/trunk/device_access/device_access/private/src/driver_loader.c Fri Jun
13 20:04:59 2014
@@ -145,10 +145,12 @@ celix_status_t driverLoader_loadDriver(d
if (status == CELIX_SUCCESS) {
arrayList_addAll(*references, refs);
}
+ }
+
if (refs != NULL) {
arrayList_destroy(refs);
}
- }
+
apr_pool_destroy(spool);
@@ -160,7 +162,8 @@ celix_status_t driverLoader_loadDriver(d
celix_status_t driverLoader_loadDriverForLocator(driver_loader_pt loader, apr_pool_t *pool,
driver_locator_service_pt locator, char *driverId, array_list_pt *references) {
celix_status_t status = CELIX_SUCCESS;
- arrayList_create(references);
+ //The list is created in the bundle_getRegisteredServices chain
+ //arrayList_create(references);
apr_pool_t *loadPool;
apr_status_t aprStatus = apr_pool_create(&loadPool, pool);
Modified: incubator/celix/trunk/framework/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/CMakeLists.txt?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/framework/CMakeLists.txt (original)
+++ incubator/celix/trunk/framework/CMakeLists.txt Fri Jun 13 20:04:59 2014
@@ -230,7 +230,7 @@ if (FRAMEWORK)
private/src/celix_errorcodes.c
private/src/celix_log.c
private/src/framework.c)
- target_link_libraries(framework_test ${APR_LIBRARY} ${APRUTIL_LIBRARY} ${CPPUTEST_LIBRARY}
${CPPUTEST_EXT_LIBRARY} ${UUID_LIBRARY} celix_utils)
+ target_link_libraries(framework_test ${APR_LIBRARY} ${APRUTIL_LIBRARY} ${CPPUTEST_LIBRARY}
${CPPUTEST_EXT_LIBRARY} ${UUID} celix_utils)
add_executable(filter_test
private/test/filter_test.cpp
Modified: incubator/celix/trunk/framework/private/mock/bundle_archive_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/bundle_archive_mock.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/mock/bundle_archive_mock.c (original)
+++ incubator/celix/trunk/framework/private/mock/bundle_archive_mock.c Fri Jun 13 20:04:59
2014
@@ -52,6 +52,11 @@ celix_status_t bundleArchive_recreate(ch
return mock_c()->returnValue().value.intValue;
}
+celix_status_t bundleArchive_destroy(bundle_archive_pt archive) {
+ mock_c()->actualCall("bundleArchive_destroy");
+ return mock_c()->returnValue().value.intValue;
+}
+
celix_status_t bundleArchive_getId(bundle_archive_pt archive, long *id) {
mock_c()->actualCall("bundleArchive_getId")
->withPointerParameters("archive", archive)
Modified: incubator/celix/trunk/framework/private/mock/bundle_revision_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/bundle_revision_mock.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/mock/bundle_revision_mock.c (original)
+++ incubator/celix/trunk/framework/private/mock/bundle_revision_mock.c Fri Jun 13 20:04:59
2014
@@ -32,6 +32,11 @@ celix_status_t bundleRevision_create(fra
return mock_c()->returnValue().value.intValue;
}
+celix_status_t bundleRevision_destroy(bundle_revision_pt revision) {
+ mock_c()->actualCall("bundleRevision_destroy");
+ return mock_c()->returnValue().value.intValue;
+}
+
celix_status_t bundleRevision_getNumber(bundle_revision_pt revision, long *revisionNr) {
mock_c()->actualCall("bundleRevision_getNumber");
return mock_c()->returnValue().value.intValue;
Modified: incubator/celix/trunk/framework/private/src/bundle.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle.c Fri Jun 13 20:04:59 2014
@@ -149,13 +149,12 @@ celix_status_t bundle_getArchive(bundle_
celix_status_t bundle_getCurrentModule(bundle_pt bundle, module_pt *module) {
celix_status_t status = CELIX_SUCCESS;
- if (bundle == NULL || *module != NULL) {
+ if (bundle == NULL || *module != NULL || arrayList_size(bundle->modules)==0 ) {
status = CELIX_ILLEGAL_ARGUMENT;
} else {
*module = arrayList_get(bundle->modules, arrayList_size(bundle->modules) - 1);
}
- framework_logIfError(logger, status, NULL, "Failed to get bundle module");
return status;
}
@@ -196,6 +195,10 @@ celix_status_t bundle_getEntry(bundle_pt
}
celix_status_t bundle_getState(bundle_pt bundle, bundle_state_e *state) {
+ if(bundle==NULL){
+ *state = OSGI_FRAMEWORK_BUNDLE_UNKNOWN;
+ return CELIX_BUNDLE_EXCEPTION;
+ }
*state = bundle->state;
return CELIX_SUCCESS;
}
Modified: incubator/celix/trunk/framework/private/src/filter.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/filter.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/filter.c (original)
+++ incubator/celix/trunk/framework/private/src/filter.c Fri Jun 13 20:04:59 2014
@@ -70,7 +70,7 @@ void filter_destroy(filter_pt filter) {
arrayList_clear(filter->value);
arrayList_destroy(filter->value);
filter->value = NULL;
- } else if (filter->operand == OR) {
+ } else if ( (filter->operand == OR) || (filter->operand == AND) ) {
int size = arrayList_size(filter->value);
int i = 0;
for (i = 0; i < size; i++) {
Modified: incubator/celix/trunk/framework/private/src/framework.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Fri Jun 13 20:04:59 2014
@@ -224,6 +224,7 @@ celix_status_t framework_create(framewor
celix_status_t framework_destroy(framework_pt framework) {
celix_status_t status = CELIX_SUCCESS;
+ if(framework->installedBundleMap!=NULL){
hash_map_iterator_pt iterator = hashMapIterator_create(framework->installedBundleMap);
while (hashMapIterator_hasNext(iterator)) {
linked_list_pt wires;
@@ -252,18 +253,29 @@ celix_status_t framework_destroy(framewo
hashMapIterator_remove(iterator);
}
hashMapIterator_destroy(iterator);
+ }
hashMap_destroy(framework->installRequestMap, false, false);
// serviceRegistry_destroy(framework->registry);
arrayList_destroy(framework->globalLockWaitersList);
+
+ if(framework->serviceListeners!=NULL){
arrayList_destroy(framework->serviceListeners);
+ }
+ if(framework->bundleListeners){
arrayList_destroy(framework->bundleListeners);
+ }
+ if(framework->frameworkListeners){
arrayList_destroy(framework->frameworkListeners);
+ }
+ if(framework->requests){
arrayList_destroy(framework->requests);
-
+ }
+ if(framework->installedBundleMap!=NULL){
hashMap_destroy(framework->installedBundleMap, false, false);
+ }
return status;
}
@@ -1352,6 +1364,7 @@ void fw_addServiceListener(framework_pt
arrayList_add(infos, info);
hook->added(hook->handle, infos);
serviceRegistry_ungetService(framework->registry, framework->bundle, ref, &ungetResult);
+ arrayList_destroy(infos);
}
free(info);
@@ -1410,6 +1423,7 @@ void fw_removeServiceListener(framework_
arrayList_add(infos, info);
hook->removed(hook->handle, infos);
serviceRegistry_ungetService(framework->registry, framework->bundle, ref, &ungetResult);
+ arrayList_destroy(infos);
}
arrayList_destroy(listenerHooks);
@@ -1526,6 +1540,7 @@ void fw_serviceChanged(framework_pt fram
element->listener->serviceChanged(element->listener, event);
+ free(event);
//TODO cleanup service reference
} else if (eventType == OSGI_FRAMEWORK_SERVICE_EVENT_MODIFIED) {
@@ -2025,10 +2040,10 @@ celix_status_t fw_fireBundleEvent(framew
request->type = BUNDLE_EVENT_TYPE;
request->error = NULL;
- arrayList_add(framework->requests, request);
if (celixThreadMutex_lock(&framework->dispatcherLock) != CELIX_SUCCESS) {
status = CELIX_FRAMEWORK_EXCEPTION;
} else {
+ arrayList_add(framework->requests, request);
if (celixThreadCondition_broadcast(&framework->dispatcher)) {
status = CELIX_FRAMEWORK_EXCEPTION;
} else {
@@ -2065,10 +2080,10 @@ celix_status_t fw_fireFrameworkEvent(fra
request->error = message;
}
- arrayList_add(framework->requests, request);
if (celixThreadMutex_lock(&framework->dispatcherLock) != CELIX_SUCCESS) {
status = CELIX_FRAMEWORK_EXCEPTION;
} else {
+ arrayList_add(framework->requests, request);
if (celixThreadCondition_broadcast(&framework->dispatcher)) {
status = CELIX_FRAMEWORK_EXCEPTION;
} else {
@@ -2086,7 +2101,8 @@ celix_status_t fw_fireFrameworkEvent(fra
static void *fw_eventDispatcher(void *fw) {
framework_pt framework = (framework_pt) fw;
- request_pt request = NULL;
+ //request_pt request = NULL;
+ struct request req;
while (true) {
int size;
@@ -2110,7 +2126,15 @@ static void *fw_eventDispatcher(void *fw
return NULL;
}
- request = (request_pt) arrayList_remove(framework->requests, 0);
+ request_pt request = (request_pt) arrayList_remove(framework->requests, 0);
+ bool validReq=false;
+ if(request!=NULL){
+ memset(&req,0,sizeof(struct request));
+ memcpy(&req,request,sizeof(struct request));
+ free(request);
+ request=&req;
+ validReq=true;
+ }
if ((status = celixThreadMutex_unlock(&framework->dispatcherLock)) != 0) {
fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Error unlocking the dispatcher.");
@@ -2118,7 +2142,7 @@ static void *fw_eventDispatcher(void *fw
return NULL;
}
- if (request != NULL) {
+ if (validReq) {
int i;
int size = arrayList_size(request->listeners);
for (i = 0; i < size; i++) {
@@ -2152,23 +2176,23 @@ static void *fw_eventDispatcher(void *fw
celix_status_t fw_invokeBundleListener(framework_pt framework, bundle_listener_pt listener,
bundle_event_pt event, bundle_pt bundle) {
// We only support async bundle listeners for now
bundle_state_e state;
- bundle_getState(bundle, &state);
+ celix_status_t ret = bundle_getState(bundle, &state);
if (state == OSGI_FRAMEWORK_BUNDLE_STARTING || state == OSGI_FRAMEWORK_BUNDLE_ACTIVE) {
listener->bundleChanged(listener, event);
}
- return CELIX_SUCCESS;
+ return ret;
}
celix_status_t fw_invokeFrameworkListener(framework_pt framework, framework_listener_pt listener,
framework_event_pt event, bundle_pt bundle) {
bundle_state_e state;
- bundle_getState(bundle, &state);
+ celix_status_t ret = bundle_getState(bundle, &state);
if (state == OSGI_FRAMEWORK_BUNDLE_STARTING || state == OSGI_FRAMEWORK_BUNDLE_ACTIVE) {
listener->frameworkEvent(listener, event);
}
- return CELIX_SUCCESS;
+ return ret;
}
celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
Modified: incubator/celix/trunk/framework/private/src/properties.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/properties.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/properties.c (original)
+++ incubator/celix/trunk/framework/private/src/properties.c Fri Jun 13 20:04:59 2014
@@ -170,6 +170,7 @@ void properties_store(properties_pt prop
fputc('\n', file);
}
+ hashMapIterator_destroy(iterator);
}
fclose(file);
} else {
Modified: incubator/celix/trunk/framework/private/src/resolver.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/resolver.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/resolver.c (original)
+++ incubator/celix/trunk/framework/private/src/resolver.c Fri Jun 13 20:04:59 2014
@@ -227,10 +227,12 @@ void resolver_removeInvalidCandidate(mod
break;
}
}
+ linkedListIterator_destroy(candIter);
}
+ linkedListIterator_destroy(itCandSetList);
}
}
- free(iterator);
+ hashMapIterator_destroy(iterator);
if (linkedList_size(invalid) > 0) {
while (!linkedList_isEmpty(invalid)) {
Modified: incubator/celix/trunk/framework/private/src/service_tracker.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_tracker.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_tracker.c (original)
+++ incubator/celix/trunk/framework/private/src/service_tracker.c Fri Jun 13 20:04:59 2014
@@ -328,9 +328,10 @@ static celix_status_t serviceTracker_unt
} else {
status = bundleContext_ungetService(tracker->context, reference, &result);
}
- free(tracked);
- break;
+
+ //break;
}
+ free(tracked);
}
}
Modified: incubator/celix/trunk/log_service/private/src/log.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/log_service/private/src/log.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/log_service/private/src/log.c (original)
+++ incubator/celix/trunk/log_service/private/src/log.c Fri Jun 13 20:04:59 2014
@@ -111,7 +111,7 @@ apr_status_t log_destroy(void *logp) {
celix_status_t log_addEntry(log_pt log, log_entry_pt entry) {
apr_thread_mutex_lock(log->lock);
- linkedList_addElement(log->entries, entry);
+ //linkedList_addElement(log->entries, entry);
// notify any listeners
if (log->listenerThread != NULL)
@@ -135,6 +135,7 @@ celix_status_t log_getEntries(log_pt log
while (linkedListIterator_hasNext(iter)) {
linkedList_addElement(entries, linkedListIterator_next(iter));
}
+ linkedListIterator_destroy(iter);
*list = entries;
@@ -222,6 +223,7 @@ celix_status_t log_addLogListener(log_pt
celix_status_t log_removeLogListener(log_pt logger, log_listener_pt listener) {
celix_status_t status = CELIX_SUCCESS;
celix_status_t threadStatus = CELIX_SUCCESS;
+ bool last=false;
status = CELIX_DO_IF(status, apr_thread_mutex_lock(logger->deliverLock));
status = CELIX_DO_IF(status, apr_thread_mutex_lock(logger->listenerLock));
@@ -229,11 +231,16 @@ celix_status_t log_removeLogListener(log
arrayList_removeElement(logger->listeners, listener);
if (arrayList_size(logger->listeners) == 0) {
status = log_stopListenerThread(logger);
+ last=true;
}
status = CELIX_DO_IF(status, apr_thread_mutex_unlock(logger->listenerLock));
status = CELIX_DO_IF(status, apr_thread_mutex_unlock(logger->deliverLock));
+
+ if(last){
status = CELIX_DO_IF(status, apr_thread_join(&threadStatus, logger->listenerThread));
+ }
+
if (status == CELIX_SUCCESS) {
logger->listenerThread = NULL;
}
@@ -283,11 +290,9 @@ static celix_status_t log_startListenerT
static celix_status_t log_stopListenerThread(log_pt logger) {
celix_status_t status = CELIX_SUCCESS;
- apr_status_t apr_status = APR_SUCCESS;
logger->running = false;
- status = apr_thread_cond_signal(logger->entriesToDeliver);
- if (status != APR_SUCCESS) {
+ if( apr_thread_cond_signal(logger->entriesToDeliver) != APR_SUCCESS){
status = CELIX_SERVICE_EXCEPTION;
}
@@ -317,6 +322,7 @@ void * APR_THREAD_FUNC log_listenerThrea
log_listener_pt listener = arrayListIterator_next(it);
listener->logged(listener, entry);
}
+ arrayListIterator_destroy(it);
status = apr_thread_mutex_unlock(logger->listenerLock);
if (status != APR_SUCCESS) {
Modified: incubator/celix/trunk/remote_services/discovery_shm/private/include/discovery.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/discovery_shm/private/include/discovery.h?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/discovery_shm/private/include/discovery.h (original)
+++ incubator/celix/trunk/remote_services/discovery_shm/private/include/discovery.h Fri Jun
13 20:04:59 2014
@@ -72,6 +72,7 @@ typedef struct ipc_shmData *ipc_shmData_
celix_status_t discovery_create(apr_pool_t *pool, bundle_context_pt context, discovery_pt
*discovery);
celix_status_t discovery_stop(discovery_pt discovery);
+celix_status_t discovery_destroy(discovery_pt discovery);
celix_status_t discovery_endpointAdded(void *handle, endpoint_description_pt endpoint, char
*machtedFilter);
celix_status_t discovery_endpointRemoved(void *handle, endpoint_description_pt endpoint,
char *machtedFilter);
Modified: incubator/celix/trunk/remote_services/discovery_shm/private/src/discovery.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/discovery_shm/private/src/discovery.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/discovery_shm/private/src/discovery.c (original)
+++ incubator/celix/trunk/remote_services/discovery_shm/private/src/discovery.c Fri Jun 13
20:04:59 2014
@@ -192,6 +192,7 @@ celix_status_t discovery_addService(disc
bundleContext_getService(discovery->context, reference, (void**) &listener);
discovery_informListener(discovery, listener, endpoint);
}
+ filter_destroy(filter);
}
hashMapIterator_destroy(iter);
@@ -639,6 +640,7 @@ celix_status_t discovery_endpointRemoved
char *url = arrayList_get(discovery->registered, i);
if (strcmp(url, endpoint->service) == 0) {
arrayList_remove(discovery->registered, i);
+ free(url);
}
}
}
Modified: incubator/celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c
(original)
+++ incubator/celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c
Fri Jun 13 20:04:59 2014
@@ -131,7 +131,13 @@ celix_status_t bundleActivator_stop(void
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
celix_status_t status = CELIX_SUCCESS;
- return status;
+
+ struct activator *activator = userData;
+ if(activator==NULL || (activator->discovery)==NULL){
+ return CELIX_BUNDLE_EXCEPTION;
+ }
+
+ return discovery_destroy(activator->discovery);
}
Modified: incubator/celix/trunk/remote_services/discovery_slp/private/src/discovery.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/discovery_slp/private/src/discovery.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/discovery_slp/private/src/discovery.c (original)
+++ incubator/celix/trunk/remote_services/discovery_slp/private/src/discovery.c Fri Jun 13
20:04:59 2014
@@ -162,6 +162,7 @@ celix_status_t discovery_removeService(d
bundleContext_getService(discovery->context, reference, (void**)&listener);
discovery_informListenerOfRemoval(discovery, listener, endpoint);
}
+ hashMapIterator_destroy(iter);
return status;
}
@@ -190,6 +191,7 @@ celix_status_t discovery_addService(disc
discovery_informListener(discovery, listener, endpoint);
}
}
+ hashMapIterator_destroy(iter);
return status;
}
@@ -267,6 +269,7 @@ celix_status_t discovery_endpointAdded(v
}
attributes = apr_pstrcat(discovery->pool, attributes, "(", key, "=", value, ")", NULL);
}
+ hashMapIterator_destroy(iter);
err = SLPReg(slp, serviceUrl, SLP_LIFETIME_MAXIMUM, 0, attributes, SLP_TRUE, discovery_registrationReport,
&callbackerr);
if ((err != SLP_OK) || (callbackerr != SLP_OK)) {
status = CELIX_ILLEGAL_STATE;
@@ -375,6 +378,7 @@ celix_status_t discovery_updateEndpointL
endpoint_description_pt value = hashMapEntry_getValue(entry);
discovery_informListener(discovery, service, value);
}
+ hashMapIterator_destroy(iter);
return status;
}
@@ -426,6 +430,7 @@ static void *APR_THREAD_FUNC discovery_p
hashMapIterator_remove(iter);
}
}
+ hashMapIterator_destroy(iter);
sleep(1);
}
Modified: incubator/celix/trunk/remote_services/remote_service_admin/private/include/remote_service_admin_impl.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/remote_service_admin/private/include/remote_service_admin_impl.h?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/remote_service_admin/private/include/remote_service_admin_impl.h
(original)
+++ incubator/celix/trunk/remote_services/remote_service_admin/private/include/remote_service_admin_impl.h
Fri Jun 13 20:04:59 2014
@@ -43,6 +43,7 @@ struct import_reference {
};
celix_status_t remoteServiceAdmin_create(apr_pool_t *pool, bundle_context_pt context, remote_service_admin_pt
*admin);
+celix_status_t remoteServiceAdmin_destroy(remote_service_admin_pt admin);
celix_status_t remoteServiceAdmin_send(remote_service_admin_pt rsa, endpoint_description_pt
endpointDescription, char *methodSignature, char *request, char **reply, int* replyStatus);
Modified: incubator/celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
(original)
+++ incubator/celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
Fri Jun 13 20:04:59 2014
@@ -118,6 +118,7 @@ celix_status_t remoteServiceAdmin_stop(r
exportRegistration_stopTracking(export);
}
}
+ hashMapIterator_destroy(iter);
iter = hashMapIterator_create(admin->importedServices);
while (hashMapIterator_hasNext(iter)) {
array_list_pt exports = hashMapIterator_nextValue(iter);
@@ -127,6 +128,7 @@ celix_status_t remoteServiceAdmin_stop(r
importRegistration_stopTracking(export);
}
}
+ hashMapIterator_destroy(iter);
return status;
}
@@ -183,6 +185,7 @@ static int remoteServiceAdmin_callback(s
}
}
}
+ hashMapIterator_destroy(iter);
}
}
@@ -202,6 +205,7 @@ celix_status_t remoteServiceAdmin_handle
}
}
}
+ hashMapIterator_destroy(iter);
return CELIX_SUCCESS;
}
@@ -225,6 +229,10 @@ celix_status_t remoteServiceAdmin_export
}
}
+ if(references!=NULL){
+ arrayList_destroy(references);
+ }
+
if (reference == NULL) {
printf("ERROR: expected a reference for service id %s\n", serviceId);
return CELIX_ILLEGAL_STATE;
@@ -317,6 +325,8 @@ celix_status_t remoteServiceAdmin_instal
properties_set(endpointProperties, key, value);
}
+ hashMapIterator_destroy(iter);
+
char *serviceId = (char *) hashMap_remove(endpointProperties, (void *) OSGI_FRAMEWORK_SERVICE_ID);
char *uuid = NULL;
bundleContext_getProperty(admin->context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid);
Modified: incubator/celix/trunk/remote_services/remote_service_admin_shm/private/include/remote_service_admin_shm_impl.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/remote_service_admin_shm/private/include/remote_service_admin_shm_impl.h?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/remote_service_admin_shm/private/include/remote_service_admin_shm_impl.h
(original)
+++ incubator/celix/trunk/remote_services/remote_service_admin_shm/private/include/remote_service_admin_shm_impl.h
Fri Jun 13 20:04:59 2014
@@ -29,7 +29,7 @@
#include "remote_service_admin_impl.h"
-#define RSA_SHM_MEMSIZE 327680
+#define RSA_SHM_MEMSIZE 1310720
#define RSA_SHM_PATH_PROPERTYNAME "shmPath"
#define RSA_SEM_PATH_PROPERTYNAME "semPath"
#define RSA_SHM_FTOK_ID_PROPERTYNAME "shmFtokId"
Modified: incubator/celix/trunk/remote_services/remote_service_admin_shm/private/src/remote_service_admin_activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/remote_service_admin_shm/private/src/remote_service_admin_activator.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/remote_service_admin_shm/private/src/remote_service_admin_activator.c
(original)
+++ incubator/celix/trunk/remote_services/remote_service_admin_shm/private/src/remote_service_admin_activator.c
Fri Jun 13 20:04:59 2014
@@ -118,7 +118,12 @@ celix_status_t bundleActivator_stop(void
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
celix_status_t status = CELIX_SUCCESS;
struct activator *activator = userData;
- return status;
+
+ if(activator==NULL || activator->admin==NULL){
+ return CELIX_BUNDLE_EXCEPTION;
+ }
+
+ return remoteServiceAdmin_destroy(activator->admin);
}
Modified: incubator/celix/trunk/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c
(original)
+++ incubator/celix/trunk/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c
Fri Jun 13 20:04:59 2014
@@ -155,6 +155,7 @@ celix_status_t remoteServiceAdmin_stop(r
}
}
}
+ hashMapIterator_destroy(iter);
iter = hashMapIterator_create(admin->importedIpcSegment);
while (hashMapIterator_hasNext(iter))
@@ -539,6 +540,9 @@ celix_status_t remoteServiceAdmin_export
{
reference = arrayList_get(references, 0);
}
+ }
+
+ if(references!=NULL){
arrayList_destroy(references);
}
@@ -654,6 +658,9 @@ celix_status_t remoteServiceAdmin_remove
ipc_segment_pt ipc = NULL;
apr_thread_t *pollThread = NULL;
+ if(admin==NULL){
+ return CELIX_BUNDLE_EXCEPTION;
+ }
hashMap_remove(admin->exportedServices, registration->reference);
if ((pollThreadRunning = hashMap_get(admin->pollThreadRunning, registration->endpointDescription))
!= NULL)
@@ -816,6 +823,8 @@ celix_status_t remoteServiceAdmin_instal
properties_set(endpointProperties, key, value);
}
+ hashMapIterator_destroy(iter);
+
char *serviceId = (char *) hashMap_remove(endpointProperties, (void *) OSGI_FRAMEWORK_SERVICE_ID);
properties_set(endpointProperties, (char *) OSGI_FRAMEWORK_OBJECTCLASS, interface);
properties_set(endpointProperties, (char *) OSGI_RSA_ENDPOINT_SERVICE_ID, serviceId);
Modified: incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c (original)
+++ incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c Fri Jun
13 20:04:59 2014
@@ -169,6 +169,12 @@ celix_status_t bundleActivator_stop(void
}
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- return status;
+
+ struct activator *activator = userData;
+ if(activator==NULL || activator->manager==NULL){
+ return CELIX_BUNDLE_EXCEPTION;
+ }
+
+ return topologyManager_destroy(activator->manager);
+
}
Modified: incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c
(original)
+++ incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c
Fri Jun 13 20:04:59 2014
@@ -80,6 +80,19 @@ celix_status_t topologyManager_create(bu
return status;
}
+celix_status_t topologyManager_destroy(topology_manager_pt manager) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ arrayList_destroy(manager->rsaList);
+
+ hashMap_destroy(manager->exportedServices,false,false);
+ hashMap_destroy(manager->importedServices,false,false);
+ hashMap_destroy(manager->importInterests,false,false);
+
+ return status;
+}
+
+
celix_status_t topologyManager_rsaAdding(void * handle, service_reference_pt reference, void
**service) {
celix_status_t status = CELIX_SUCCESS;
topology_manager_pt manager = handle;
@@ -167,6 +180,7 @@ celix_status_t topologyManager_endpointR
import_registration_pt import = hashMapEntry_getValue(entry);
rsa->importRegistration_close(import);
}
+ hashMapIterator_destroy(iter);
}
return status;
@@ -245,8 +259,13 @@ celix_status_t topologyManager_notifyLis
}
}
}
+ filter_destroy(filter);
+ }
}
}
+
+ if(endpointListeners!=NULL){
+ arrayList_destroy(endpointListeners);
}
return status;
@@ -303,6 +322,7 @@ celix_status_t topologyManager_removeSer
}
}
+ hashMapIterator_destroy(iter);
}
return status;
@@ -335,6 +355,10 @@ celix_status_t topologyManager_notifyLis
}
}
+ if(endpointListeners!=NULL){
+ arrayList_destroy(endpointListeners);
+ }
+
return status;
}
Modified: incubator/celix/trunk/remote_shell/private/src/remote_shell.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_shell/private/src/remote_shell.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/remote_shell/private/src/remote_shell.c (original)
+++ incubator/celix/trunk/remote_shell/private/src/remote_shell.c Fri Jun 13 20:04:59 2014
@@ -98,6 +98,7 @@ static apr_status_t remoteShell_cleanup(
apr_thread_mutex_lock(instance->mutex);
arrayList_destroy(instance->connections);
+ apr_thread_pool_destroy(instance->threadPool);
apr_thread_mutex_unlock(instance->mutex);
return APR_SUCCESS;
Modified: incubator/celix/trunk/shell/private/src/inspect_command.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/src/inspect_command.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/src/inspect_command.c (original)
+++ incubator/celix/trunk/shell/private/src/inspect_command.c Fri Jun 13 20:04:59 2014
@@ -179,6 +179,7 @@ celix_status_t inspectCommand_printExpor
sprintf(line, "%s = %s\n", hashMapEntry_getKey(entry), hashMapEntry_getValue(entry));
out(line);
}
+ hashMapIterator_destroy(iter);
// objectClass = properties_get(props, (char *) OSGI_FRAMEWORK_OBJECTCLASS);
// sprintf(line, "ObjectClass = %s\n", objectClass);
@@ -277,6 +278,7 @@ celix_status_t inspectCommand_printImpor
sprintf(line, "%s = %s\n", hashMapEntry_getKey(entry),
hashMapEntry_getValue(entry));
out(line);
}
+ hashMapIterator_destroy(iter);
// objectClass = properties_get(props, (char *) OSGI_FRAMEWORK_OBJECTCLASS);
// sprintf(line, "ObjectClass = %s\n", objectClass);
Modified: incubator/celix/trunk/shell/private/src/log_command.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/src/log_command.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/src/log_command.c (original)
+++ incubator/celix/trunk/shell/private/src/log_command.c Fri Jun 13 20:04:59 2014
@@ -92,6 +92,7 @@ void logCommand_execute(command_pt comma
}
}
}
+ linkedListIterator_destroy(iter);
apr_pool_destroy(memory_pool);
} else {
out("Log reader service: out of memory!\n");
Modified: incubator/celix/trunk/shell/private/src/shell.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/private/src/shell.c?rev=1602509&r1=1602508&r2=1602509&view=diff
==============================================================================
--- incubator/celix/trunk/shell/private/src/shell.c (original)
+++ incubator/celix/trunk/shell/private/src/shell.c Fri Jun 13 20:04:59 2014
@@ -114,6 +114,7 @@ array_list_pt shell_getCommands(shell_pt
char * name = hashMapIterator_nextKey(iter);
arrayList_add(commands, name);
}
+ hashMapIterator_destroy(iter);
return commands;
}
@@ -136,6 +137,7 @@ service_reference_pt shell_getCommandRef
return (service_reference_pt) hashMapEntry_getValue(entry);
}
}
+ hashMapIterator_destroy(iter);
return NULL;
}
|