Skip to content
Permalink
Browse files
Add missing bundleContext_ungetService to eliminate warnings in RSA.
  • Loading branch information
PengZheng committed Jan 18, 2022
1 parent 6d02559 commit 4f3dcfd8211586047966ae7671778d9a838f2a40
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
@@ -176,6 +176,7 @@ celix_status_t discovery_informEndpointListeners(discovery_t *discovery, endpoin

listener->endpointRemoved(listener->handle, endpoint, (char*)scope);
}
bundleContext_ungetService(discovery->context, reference, NULL);
}

celix_filter_destroy(filter);
@@ -154,6 +154,7 @@ celix_status_t exportRegistration_endpointAdded(void * handle, service_reference
status = bundleContext_getService(registration->context, registration->reference, &service);
if (status == CELIX_SUCCESS) {
endpoint->setService(endpoint->endpoint, service);
bundleContext_ungetService(registration->context, registration->reference, NULL);
}
}

@@ -778,6 +778,7 @@ celix_status_t topologyManager_notifyListenersEndpointAdded(topology_manager_pt
}
}
filter_destroy(filter);
bundleContext_ungetService(manager->context, reference, NULL);
}
}
hashMapIterator_destroy(iter);
@@ -788,40 +789,35 @@ celix_status_t topologyManager_notifyListenersEndpointAdded(topology_manager_pt
}

celix_status_t topologyManager_notifyListenersEndpointRemoved(topology_manager_pt manager, remote_service_admin_service_t *rsa, export_registration_t *export) {
celix_status_t status = CELIX_SUCCESS;
celix_status_t status = CELIX_SUCCESS;

if (celixThreadMutex_lock(&manager->listenerListLock) == CELIX_SUCCESS) {
hash_map_iterator_pt iter = hashMapIterator_create(manager->listenerList);
while (hashMapIterator_hasNext(iter)) {
endpoint_description_t *endpoint = NULL;
endpoint_listener_t *epl = NULL;
celix_status_t substatus;
const char* scope = NULL;
if (celixThreadMutex_lock(&manager->listenerListLock) == CELIX_SUCCESS) {
hash_map_iterator_pt iter = hashMapIterator_create(manager->listenerList);
while (hashMapIterator_hasNext(iter)) {
endpoint_description_t *endpoint = NULL;
endpoint_listener_t *epl = NULL;
celix_status_t substatus;
const char* scope = NULL;

service_reference_pt reference = hashMapIterator_nextKey(iter);
serviceReference_getProperty(reference, OSGI_ENDPOINT_LISTENER_SCOPE, &scope);

substatus = bundleContext_getService(manager->context, reference, (void **) &epl);

if (substatus == CELIX_SUCCESS) {
substatus = topologyManager_getEndpointDescriptionForExportRegistration(rsa, export, &endpoint);
}
service_reference_pt reference = hashMapIterator_nextKey(iter);
serviceReference_getProperty(reference, OSGI_ENDPOINT_LISTENER_SCOPE, &scope);

if (substatus == CELIX_SUCCESS) {
substatus = epl->endpointRemoved(epl->handle, endpoint, NULL);
}
substatus = bundleContext_getService(manager->context, reference, (void **) &epl);

/* if (substatus != CELIX_SUCCESS) {
status = substatus;
if (substatus == CELIX_SUCCESS) {
substatus = topologyManager_getEndpointDescriptionForExportRegistration(rsa, export, &endpoint);
}

}
*/
}
hashMapIterator_destroy(iter);
celixThreadMutex_unlock(&manager->listenerListLock);
}
if (substatus == CELIX_SUCCESS) {
substatus = epl->endpointRemoved(epl->handle, endpoint, NULL);
}
bundleContext_ungetService(manager->context, reference, NULL);
}
hashMapIterator_destroy(iter);
celixThreadMutex_unlock(&manager->listenerListLock);
}

return status;
return status;
}

static celix_status_t topologyManager_extendFilter(topology_manager_pt manager, const char *filter, char **updatedFilter) {

0 comments on commit 4f3dcfd

Please sign in to comment.