You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2015/09/02 13:44:15 UTC
[01/11] celix git commit: CELIX-237: Enabled testing for travis config
Repository: celix
Updated Branches:
refs/heads/feature/CELIX-237_rsa-ffi b5d2367d8 -> 89968d937
CELIX-237: Enabled testing for travis config
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/b6f2ae4e
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/b6f2ae4e
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/b6f2ae4e
Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: b6f2ae4ea6ee5df3b3841ac4e350b6148431f61b
Parents: b5d2367
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Tue Aug 18 13:31:03 2015 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Tue Aug 18 13:31:03 2015 +0200
----------------------------------------------------------------------
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/b6f2ae4e/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 58d767d..3a3cfb7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,7 +22,7 @@ before_script:
- cd ..
- mkdir build install
- cd build
- - cmake -DCMAKE_SKIP_BUILD_RPATH=TRUE -DBUILD_DEPLOYMENT_ADMIN=ON -DBUILD_EXAMPLES=ON -DBUILD_LOG_SERVICE=ON -DBUILD_LOG_WRITER=ON -DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_RSA_DISCOVERY_CONFIGURED=ON -DBUILD_RSA_DISCOVERY_ETCD=ON -DBUILD_RSA_DISCOVERY_SHM=ON -DBUILD_RSA_EXAMPLES=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_SHM=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON -DBUILD_REMOTE_SHELL=ON -DBUILD_SHELL=ON -DBUILD_SHELL_TUI=ON -DCMAKE_INSTALL_PREFIX=../install ..
+ - cmake -DENABLE_TESTING=ON -DCMAKE_SKIP_BUILD_RPATH=TRUE -DBUILD_DEPLOYMENT_ADMIN=ON -DBUILD_EXAMPLES=ON -DBUILD_LOG_SERVICE=ON -DBUILD_LOG_WRITER=ON -DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_RSA_DISCOVERY_CONFIGURED=ON -DBUILD_RSA_DISCOVERY_ETCD=ON -DBUILD_RSA_DISCOVERY_SHM=ON -DBUILD_RSA_EXAMPLES=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_SHM=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON -DBUILD_REMOTE_SHELL=ON -DBUILD_SHELL=ON -DBUILD_SHELL_TUI=ON -DCMAKE_INSTALL_PREFIX=../install ..
script:
- make all
[06/11] celix git commit: CELIX-254: Applied mem leak patch for
deployment_admin
Posted by pn...@apache.org.
CELIX-254: Applied mem leak patch for deployment_admin
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/5c5a0ebc
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/5c5a0ebc
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/5c5a0ebc
Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 5c5a0ebc575cc103a65bd4cdcee4bca3204b75c9
Parents: 052a611
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Tue Sep 1 16:22:01 2015 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Tue Sep 1 16:22:01 2015 +0200
----------------------------------------------------------------------
deployment_admin/private/src/deployment_admin.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/5c5a0ebc/deployment_admin/private/src/deployment_admin.c
----------------------------------------------------------------------
diff --git a/deployment_admin/private/src/deployment_admin.c b/deployment_admin/private/src/deployment_admin.c
index f1ab5bc..74a5ce4 100644
--- a/deployment_admin/private/src/deployment_admin.c
+++ b/deployment_admin/private/src/deployment_admin.c
@@ -460,6 +460,7 @@ celix_status_t deploymentAdmin_stopDeploymentPackageBundles(deployment_admin_pt
fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DEPLOYMENT_ADMIN: Bundle %s not found", info->symbolicName);
}
}
+ arrayList_destroy(infos);
}
return status;
@@ -500,7 +501,7 @@ celix_status_t deploymentAdmin_updateDeploymentPackageBundles(deployment_admin_p
bundleContext_installBundle2(admin->context, bsn, bundlePath, &updateBundle);
}
}
-
+ arrayList_destroy(infos);
return status;
}
@@ -524,6 +525,7 @@ celix_status_t deploymentAdmin_startDeploymentPackageCustomizerBundles(deploymen
}
}
}
+ arrayList_destroy(sourceInfos);
if (target != NULL) {
array_list_pt targetInfos = NULL;
@@ -538,6 +540,7 @@ celix_status_t deploymentAdmin_startDeploymentPackageCustomizerBundles(deploymen
}
}
}
+ arrayList_destroy(targetInfos);
}
for (i = 0; i < arrayList_size(bundles); i++) {
@@ -668,6 +671,7 @@ celix_status_t deploymentAdmin_dropDeploymentPackageBundles(deployment_admin_pt
}
}
}
+ arrayList_destroy(targetInfos);
}
return status;
@@ -691,6 +695,7 @@ celix_status_t deploymentAdmin_startDeploymentPackageBundles(deployment_admin_pt
}
}
}
+ arrayList_destroy(infos);
return status;
}
[11/11] celix git commit: CELIX-237: Added callback from
export/import registration to rsa to remove the export/import from internal
registration
Posted by pn...@apache.org.
CELIX-237: Added callback from export/import registration to rsa to remove the export/import from internal registration
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/89968d93
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/89968d93
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/89968d93
Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 89968d937fd239b93382d419dd6354469f107bbb
Parents: 3853a7c
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Wed Sep 2 13:42:50 2015 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Wed Sep 2 13:42:50 2015 +0200
----------------------------------------------------------------------
.../private/include/export_registration_dfi.h | 2 +-
.../private/include/import_registration_dfi.h | 4 +-
.../private/include/remote_service_admin_dfi.h | 56 +++++++++++++++
.../include/remote_service_admin_http_impl.h | 73 -------------------
.../rsa/private/src/export_registration_dfi.c | 75 +++++++++++++++++---
.../rsa/private/src/import_registration_dfi.c | 23 ++++--
.../src/remote_service_admin_activator.c | 4 +-
.../rsa/private/src/remote_service_admin_dfi.c | 11 +--
.../rsa_tst/bundle/tst_activator.c | 2 +-
9 files changed, 153 insertions(+), 97 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/89968d93/remote_services/remote_service_admin_dfi/rsa/private/include/export_registration_dfi.h
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/include/export_registration_dfi.h b/remote_services/remote_service_admin_dfi/rsa/private/include/export_registration_dfi.h
index 4356646..100294c 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/include/export_registration_dfi.h
+++ b/remote_services/remote_service_admin_dfi/rsa/private/include/export_registration_dfi.h
@@ -9,7 +9,7 @@
#include "log_helper.h"
#include "endpoint_description.h"
-celix_status_t exportRegistration_create(log_helper_pt helper, service_reference_pt reference, endpoint_description_pt endpoint, bundle_context_pt context, export_registration_pt *registration);
+celix_status_t exportRegistration_create(log_helper_pt helper, void (*closedCallback)(void *handle, export_registration_pt reg), void *handle, service_reference_pt reference, endpoint_description_pt endpoint, bundle_context_pt context, export_registration_pt *registration);
void exportRegistration_destroy(export_registration_pt registration);
celix_status_t exportRegistration_start(export_registration_pt registration);
http://git-wip-us.apache.org/repos/asf/celix/blob/89968d93/remote_services/remote_service_admin_dfi/rsa/private/include/import_registration_dfi.h
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/include/import_registration_dfi.h b/remote_services/remote_service_admin_dfi/rsa/private/include/import_registration_dfi.h
index ec885fd..6f2a232 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/include/import_registration_dfi.h
+++ b/remote_services/remote_service_admin_dfi/rsa/private/include/import_registration_dfi.h
@@ -10,7 +10,9 @@
typedef void (*send_func_type)(void *handle, endpoint_description_pt endpointDescription, char *request, char **reply, int* replyStatus);
-celix_status_t importRegistration_create(bundle_context_pt context, endpoint_description_pt description, const char *classObject, import_registration_pt *import);
+celix_status_t importRegistration_create(bundle_context_pt context, void (*rsaCallback)(void *, import_registration_pt),
+ void *rsaHandle, endpoint_description_pt description, const char *classObject,
+ import_registration_pt *import);
void importRegistration_destroy(import_registration_pt import);
celix_status_t importRegistration_setSendFn(import_registration_pt reg,
http://git-wip-us.apache.org/repos/asf/celix/blob/89968d93/remote_services/remote_service_admin_dfi/rsa/private/include/remote_service_admin_dfi.h
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/include/remote_service_admin_dfi.h b/remote_services/remote_service_admin_dfi/rsa/private/include/remote_service_admin_dfi.h
new file mode 100644
index 0000000..64e69e4
--- /dev/null
+++ b/remote_services/remote_service_admin_dfi/rsa/private/include/remote_service_admin_dfi.h
@@ -0,0 +1,56 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements. See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership. The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * remote_service_admin_http_impl.h
+ *
+ * \date Sep 30, 2011
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef REMOTE_SERVICE_ADMIN_HTTP_IMPL_H_
+#define REMOTE_SERVICE_ADMIN_HTTP_IMPL_H_
+
+#include "bundle_context.h"
+#include "endpoint_description.h"
+
+typedef struct remote_service_admin *remote_service_admin_pt;
+
+celix_status_t remoteServiceAdmin_create(bundle_context_pt context, remote_service_admin_pt *admin);
+celix_status_t remoteServiceAdmin_destroy(remote_service_admin_pt *admin);
+
+celix_status_t remoteServiceAdmin_stop(remote_service_admin_pt admin);
+
+celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt admin, char *serviceId, properties_pt properties, array_list_pt *registrations);
+celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_pt admin, export_registration_pt registration);
+celix_status_t remoteServiceAdmin_getExportedServices(remote_service_admin_pt admin, array_list_pt *services);
+celix_status_t remoteServiceAdmin_getImportedEndpoints(remote_service_admin_pt admin, array_list_pt *services);
+celix_status_t remoteServiceAdmin_importService(remote_service_admin_pt admin, endpoint_description_pt endpoint, import_registration_pt *registration);
+celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_pt admin, import_registration_pt registration);
+
+
+celix_status_t exportReference_getExportedEndpoint(export_reference_pt reference, endpoint_description_pt *endpoint);
+celix_status_t exportReference_getExportedService(export_reference_pt reference);
+
+celix_status_t importReference_getImportedEndpoint(import_reference_pt reference);
+celix_status_t importReference_getImportedService(import_reference_pt reference);
+
+celix_status_t remoteServiceAdmin_destroyEndpointDescription(endpoint_description_pt *description);
+
+#endif /* REMOTE_SERVICE_ADMIN_HTTP_IMPL_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/89968d93/remote_services/remote_service_admin_dfi/rsa/private/include/remote_service_admin_http_impl.h
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/include/remote_service_admin_http_impl.h b/remote_services/remote_service_admin_dfi/rsa/private/include/remote_service_admin_http_impl.h
deleted file mode 100644
index 65ca83b..0000000
--- a/remote_services/remote_service_admin_dfi/rsa/private/include/remote_service_admin_http_impl.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements. See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership. The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * remote_service_admin_http_impl.h
- *
- * \date Sep 30, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef REMOTE_SERVICE_ADMIN_HTTP_IMPL_H_
-#define REMOTE_SERVICE_ADMIN_HTTP_IMPL_H_
-
-#include "remote_service_admin.h"
-#include "log_helper.h"
-#include "civetweb.h"
-
-struct remote_service_admin {
- bundle_context_pt context;
- log_helper_pt loghelper;
-
- celix_thread_mutex_t exportedServicesLock;
- hash_map_pt exportedServices;
-
- celix_thread_mutex_t importedServicesLock;
- hash_map_pt importedServices;
-
- char *port;
- char *ip;
-
- struct mg_context *ctx;
-};
-
-
-celix_status_t remoteServiceAdmin_create(bundle_context_pt context, remote_service_admin_pt *admin);
-celix_status_t remoteServiceAdmin_destroy(remote_service_admin_pt *admin);
-
-celix_status_t remoteServiceAdmin_stop(remote_service_admin_pt admin);
-celix_status_t remoteServiceAdmin_send(remote_service_admin_pt rsa, endpoint_description_pt endpointDescription, char *methodSignature, char **reply, int* replyStatus);
-
-celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt admin, char *serviceId, properties_pt properties, array_list_pt *registrations);
-celix_status_t remoteServiceAdmin_removeExportedService(export_registration_pt registration);
-celix_status_t remoteServiceAdmin_getExportedServices(remote_service_admin_pt admin, array_list_pt *services);
-celix_status_t remoteServiceAdmin_getImportedEndpoints(remote_service_admin_pt admin, array_list_pt *services);
-celix_status_t remoteServiceAdmin_importService(remote_service_admin_pt admin, endpoint_description_pt endpoint, import_registration_pt *registration);
-celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_pt admin, import_registration_pt registration);
-
-
-celix_status_t exportReference_getExportedEndpoint(export_reference_pt reference, endpoint_description_pt *endpoint);
-celix_status_t exportReference_getExportedService(export_reference_pt reference);
-
-celix_status_t importReference_getImportedEndpoint(import_reference_pt reference);
-celix_status_t importReference_getImportedService(import_reference_pt reference);
-
-celix_status_t remoteServiceAdmin_destroyEndpointDescription(endpoint_description_pt *description);
-
-#endif /* REMOTE_SERVICE_ADMIN_HTTP_IMPL_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/89968d93/remote_services/remote_service_admin_dfi/rsa/private/src/export_registration_dfi.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/src/export_registration_dfi.c b/remote_services/remote_service_admin_dfi/rsa/private/src/export_registration_dfi.c
index 85ecb43..b5f0fec 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/src/export_registration_dfi.c
+++ b/remote_services/remote_service_admin_dfi/rsa/private/src/export_registration_dfi.c
@@ -5,7 +5,9 @@
#include <dyn_interface.h>
#include <json_serializer.h>
#include <remote_constants.h>
-#include "export_registration.h"
+#include <remote_service_admin.h>
+#include <service_tracker_customizer.h>
+#include <service_tracker.h>
#include "export_registration_dfi.h"
struct export_reference {
@@ -15,28 +17,50 @@ struct export_reference {
struct export_registration {
bundle_context_pt context;
+ void (*rsaCloseExportCallback)(void *handle, export_registration_pt reg);
+ void *handle;
struct export_reference exportReference;
- void *service;
+ char *servId;
dyn_interface_type *intf; //owner
+ service_tracker_pt tracker;
+
+ celix_thread_mutex_t mutex;
+ void *service; //protected by mutex
//TODO add tracker and lock
bool closed;
};
-celix_status_t exportRegistration_create(log_helper_pt helper, service_reference_pt reference, endpoint_description_pt endpoint, bundle_context_pt context, export_registration_pt *out) {
+static void exportRegistration_addServ(export_registration_pt reg, service_reference_pt ref, void *service);
+static void exportRegistration_removeServ(export_registration_pt reg, service_reference_pt ref, void *service);
+
+celix_status_t exportRegistration_create(log_helper_pt helper, void (*closedCallback)(void *handle, export_registration_pt reg), void *handle, service_reference_pt reference, endpoint_description_pt endpoint, bundle_context_pt context, export_registration_pt *out) {
celix_status_t status = CELIX_SUCCESS;
- export_registration_pt reg = calloc(1, sizeof(*reg));
+ char *servId = NULL;
+ status = serviceReference_getProperty(reference, "service.id", &servId);
+ if (status != CELIX_SUCCESS) {
+ logHelper_log(helper, OSGI_LOGSERVICE_WARNING, "Cannot find service.id for ref");
+ }
- if (reg == NULL) {
- status = CELIX_ENOMEM;
+ export_registration_pt reg = NULL;
+ if (status == CELIX_SUCCESS) {
+ reg = calloc(1, sizeof(*reg));
+ if (reg == NULL) {
+ status = CELIX_ENOMEM;
+ }
}
+
if (status == CELIX_SUCCESS) {
reg->context = context;
+ reg->rsaCloseExportCallback = closedCallback;
+ reg->handle = handle;
reg->exportReference.endpoint = endpoint;
reg->exportReference.reference = reference;
reg->closed = false;
+
+ celixThreadMutex_create(®->mutex, NULL);
}
char *exports = NULL;
@@ -75,6 +99,17 @@ celix_status_t exportRegistration_create(log_helper_pt helper, service_reference
}
if (status == CELIX_SUCCESS) {
+ service_tracker_customizer_pt cust = NULL;
+ status = serviceTrackerCustomizer_create(reg, NULL, exportRegistration_addServ, NULL,
+ exportRegistration_removeServ, &cust);
+ if (status == CELIX_SUCCESS) {
+ char filter[32];
+ snprintf(filter, 32, "(service.id=%s)", servId);
+ status = serviceTracker_createWithFilter(reg->context, filter, cust, ®->tracker);
+ }
+ }
+
+ if (status == CELIX_SUCCESS) {
*out = reg;
} else {
logHelper_log(helper, OSGI_LOGSERVICE_ERROR, "Error creating export registration");
@@ -88,9 +123,9 @@ celix_status_t exportRegistration_call(export_registration_pt export, char *data
int status = CELIX_SUCCESS;
*responseLength = -1;
- //TODO lock service
+ celixThreadMutex_lock(&export->mutex);
status = jsonSerializer_call(export->intf, export->service, data, responseOut);
- //TODO unlock service
+ celixThreadMutex_unlock(&export->mutex);
return status;
}
@@ -108,6 +143,10 @@ void exportRegistration_destroy(export_registration_pt reg) {
reg->exportReference.endpoint = NULL;
endpointDescription_destroy(ep);
}
+ if (reg->tracker != NULL) {
+ serviceTracker_destroy(reg->tracker);
+ }
+ celixThreadMutex_destroy(®->mutex);
free(reg);
}
@@ -115,10 +154,25 @@ void exportRegistration_destroy(export_registration_pt reg) {
celix_status_t exportRegistration_start(export_registration_pt reg) {
celix_status_t status = CELIX_SUCCESS;
- status = bundleContext_getService(reg->context, reg->exportReference.reference, ®->service); //TODO use tracker
+
+ serviceTracker_open(reg->tracker);
return status;
}
+static void exportRegistration_addServ(export_registration_pt reg, service_reference_pt ref, void *service) {
+ celixThreadMutex_lock(®->mutex);
+ reg->service = service;
+ celixThreadMutex_unlock(®->mutex);
+}
+
+static void exportRegistration_removeServ(export_registration_pt reg, service_reference_pt ref, void *service) {
+ celixThreadMutex_lock(®->mutex);
+ if (reg->service == service) {
+ reg->service == NULL;
+ }
+ celixThreadMutex_unlock(®->mutex);
+}
+
celix_status_t exportRegistration_stop(export_registration_pt reg) {
celix_status_t status = CELIX_SUCCESS;
status = bundleContext_ungetService(reg->context, reg->exportReference.reference, NULL);
@@ -128,7 +182,7 @@ celix_status_t exportRegistration_stop(export_registration_pt reg) {
celix_status_t exportRegistration_close(export_registration_pt reg) {
celix_status_t status = CELIX_SUCCESS;
exportRegistration_stop(reg);
- //TODO callback to rsa to remove from list
+ reg->rsaCloseExportCallback(reg->handle, reg);
return status;
}
@@ -146,7 +200,6 @@ celix_status_t exportRegistration_getExportReference(export_registration_pt regi
ref->reference = registration->exportReference.reference;
} else {
status = CELIX_ENOMEM;
- //TODO log
}
if (status == CELIX_SUCCESS) {
http://git-wip-us.apache.org/repos/asf/celix/blob/89968d93/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c b/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
index 09ad25b..9667fa9 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
+++ b/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
@@ -16,6 +16,9 @@ struct import_registration {
service_registration_pt factoryReg;
hash_map_pt proxies; //key -> bundle, value -> service_proxy
+
+ void (*rsaCloseImportCallback)(void *, import_registration_pt);
+ void *rsaHandle;
};
struct service_proxy {
@@ -29,7 +32,9 @@ static celix_status_t importRegistration_createProxy(import_registration_pt impo
static void importRegistration_proxyFunc(void *userData, void *args[], void *returnVal);
static void importRegistration_destroyProxy(struct service_proxy *proxy);
-celix_status_t importRegistration_create(bundle_context_pt context, endpoint_description_pt endpoint, const char *classObject, import_registration_pt *out) {
+celix_status_t importRegistration_create(bundle_context_pt context, void (*rsaCallback)(void *, import_registration_pt),
+ void *rsaHandle, endpoint_description_pt endpoint, const char *classObject,
+ import_registration_pt *out) {
celix_status_t status = CELIX_SUCCESS;
import_registration_pt reg = calloc(1, sizeof(*reg));
@@ -39,6 +44,8 @@ celix_status_t importRegistration_create(bundle_context_pt context, endpoint_des
if (reg != NULL && reg->factory != NULL) {
reg->context = context;
+ reg->rsaCloseImportCallback = rsaCallback;
+ reg->rsaHandle = rsaHandle;
reg->endpoint = endpoint;
reg->classObject = classObject;
reg->proxies = hashMap_create(NULL, NULL, NULL, NULL);
@@ -97,7 +104,7 @@ celix_status_t importRegistration_stop(import_registration_pt import) {
if (import->factoryReg != NULL) {
serviceRegistration_unregister(import->factoryReg);
}
- //TODO unregister every serv instance?
+ //TODO unregister every serv instance? Needed for factory?
return status;
}
@@ -273,13 +280,21 @@ celix_status_t importRegistration_ungetService(import_registration_pt import, bu
}
static void importRegistration_destroyProxy(struct service_proxy *proxy) {
- //TODO
+ if (proxy != NULL) {
+ if (proxy->intf != NULL) {
+ dynInterface_destroy(proxy->intf);
+ }
+ if (proxy->service != NULL) {
+ free(proxy->service);
+ }
+ free(proxy);
+ }
}
celix_status_t importRegistration_close(import_registration_pt registration) {
celix_status_t status = CELIX_SUCCESS;
- //TODO
+ registration->rsaCloseImportCallback(registration->rsaHandle, registration);
return status;
}
http://git-wip-us.apache.org/repos/asf/celix/blob/89968d93/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_activator.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_activator.c b/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_activator.c
index 9961a9b..40fb288 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_activator.c
+++ b/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_activator.c
@@ -24,11 +24,13 @@
* \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
+#include <remote_service_admin.h>
+
+#include "remote_service_admin_dfi.h"
#include "bundle_activator.h"
#include "service_registration.h"
-#include "remote_service_admin_http_impl.h"
#include "export_registration_dfi.h"
#include "import_registration_dfi.h"
http://git-wip-us.apache.org/repos/asf/celix/blob/89968d93/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_dfi.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_dfi.c b/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_dfi.c
index a092a63..00a4b0f 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_dfi.c
+++ b/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_dfi.c
@@ -34,13 +34,14 @@
#include <curl/curl.h>
#include <jansson.h>
-#include <json_serializer.h>
+#include "json_serializer.h"
+#include "remote_service_admin.h"
#include "import_registration_dfi.h"
#include "export_registration_dfi.h"
+#include "remote_service_admin_dfi.h"
#include "dyn_interface.h"
-#include "remote_service_admin.h"
#include "remote_constants.h"
#include "constants.h"
#include "civetweb.h"
@@ -412,7 +413,7 @@ celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt admin, c
remoteServiceAdmin_createEndpointDescription(admin, reference, interface, &endpoint);
printf("RSA: Creating export registration with endpoint pointer %p\n", endpoint);
//TOOD precheck if descriptor exists
- status = exportRegistration_create(admin->loghelper, reference, endpoint, admin->context, ®istration);
+ status = exportRegistration_create(admin->loghelper, remoteServiceAdmin_removeExportedService, admin, reference, endpoint, admin->context, ®istration);
if (status == CELIX_SUCCESS) {
status = exportRegistration_start(registration);
if (status == CELIX_SUCCESS) {
@@ -431,7 +432,7 @@ celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt admin, c
return status;
}
-celix_status_t remoteServiceAdmin_removeExportedService(export_registration_pt registration) {
+celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_pt admin, export_registration_pt registration) {
celix_status_t status = CELIX_SUCCESS;
//TODO
/*
@@ -580,7 +581,7 @@ celix_status_t remoteServiceAdmin_importService(remote_service_admin_pt admin, e
import_registration_pt import = NULL;
if (objectClass != NULL) {
- status = importRegistration_create(admin->context, endpointDescription, objectClass, &import);
+ status = importRegistration_create(admin->context, NULL, NULL, endpointDescription, objectClass, &import);
}
if (status == CELIX_SUCCESS) {
importRegistration_setSendFn(import, remoteServiceAdmin_send, admin);
http://git-wip-us.apache.org/repos/asf/celix/blob/89968d93/remote_services/remote_service_admin_dfi/rsa_tst/bundle/tst_activator.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa_tst/bundle/tst_activator.c b/remote_services/remote_service_admin_dfi/rsa_tst/bundle/tst_activator.c
index 1f72db1..c067abf 100644
--- a/remote_services/remote_service_admin_dfi/rsa_tst/bundle/tst_activator.c
+++ b/remote_services/remote_service_admin_dfi/rsa_tst/bundle/tst_activator.c
@@ -125,7 +125,7 @@ static int test(void *handle) {
int rc;
if (act->calc != NULL) {
rc = act->calc->sqrt(act->calc->calculator, 4, &result);
- printf("calc result is %d\n", result);
+ printf("calc result is %f\n", result);
} else {
printf("calc not ready\n");
}
[04/11] celix git commit: CELIX-159: Added -pthread flag. Among other
things, this will define _REENTRANT.
Posted by pn...@apache.org.
CELIX-159: Added -pthread flag. Among other things, this will define _REENTRANT.
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/5e6d2f2c
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/5e6d2f2c
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/5e6d2f2c
Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 5e6d2f2c374b3c8d738e167c492a541042ea257f
Parents: 1010f71
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Tue Sep 1 16:00:13 2015 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Tue Sep 1 16:04:43 2015 +0200
----------------------------------------------------------------------
CMakeLists.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/5e6d2f2c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4bee365..a885df5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,7 +29,8 @@ set(CMAKE_INSTALL_NAME_DIR "@rpath")
SET(CMAKE_BUILD_TYPE "Debug")
IF(UNIX)
- SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall ${CMAKE_C_FLAGS}")
+ SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall -pthread ${CMAKE_C_FLAGS}")
+ set(CMAKE_EXE_LINKER_FLAGS "-pthread ${CMAKE_EXE_LINKER_FLAGS}")
ENDIF()
IF(WIN32)
SET(CMAKE_C_FLAGS "-D_CRT_SECURE_NO_WARNINGS ${CMAKE_C_FLAGS}")
[02/11] celix git commit: CELIX-252: added separate hashmap to
double-check whether expired key belongs to imported services
Posted by pn...@apache.org.
CELIX-252: added separate hashmap to double-check whether expired key belongs to imported services
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/c396aeed
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/c396aeed
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/c396aeed
Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: c396aeed17b7618d5b2109a7a83f0c4213ce70f3
Parents: f32a233
Author: Bjoern Petri <bp...@apache.org>
Authored: Sun Aug 23 21:42:50 2015 +0200
Committer: Bjoern Petri <bp...@apache.org>
Committed: Sun Aug 23 21:42:50 2015 +0200
----------------------------------------------------------------------
.../discovery_etcd/private/include/etcd.h | 2 +-
.../discovery_etcd/private/src/etcd.c | 135 ++++++++++---------
.../discovery_etcd/private/src/etcd_watcher.c | 69 ++++++++--
3 files changed, 136 insertions(+), 70 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/c396aeed/remote_services/discovery_etcd/private/include/etcd.h
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/private/include/etcd.h b/remote_services/discovery_etcd/private/include/etcd.h
index e36fccb..f5624d0 100644
--- a/remote_services/discovery_etcd/private/include/etcd.h
+++ b/remote_services/discovery_etcd/private/include/etcd.h
@@ -54,6 +54,6 @@ bool etcd_get(char* key, char* value, char*action, int* modifiedIndex);
bool etcd_getNodes(char* directory, char** nodeNames, int* size);
bool etcd_set(char* key, char* value, int ttl, bool prevExist);
bool etcd_del(char* key);
-bool etcd_watch(char* key, int index, char* action, char* prevValue, char* value);
+bool etcd_watch(char* key, int index, char* action, char* prevValue, char* value, char* rkey, int *modifiedIndex);
#endif /* ETCD_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/c396aeed/remote_services/discovery_etcd/private/src/etcd.c
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/private/src/etcd.c b/remote_services/discovery_etcd/private/src/etcd.c
index 2c74856..d38f6bd 100644
--- a/remote_services/discovery_etcd/private/src/etcd.c
+++ b/remote_services/discovery_etcd/private/src/etcd.c
@@ -304,66 +304,79 @@ bool etcd_del(char* key) {
}
///watch
-bool etcd_watch(char* key, int index, char* action, char* prevValue, char* value) {
- json_error_t error;
- json_t* js_root = NULL;
- json_t* js_node = NULL;
- json_t* js_prevNode = NULL;
- json_t* js_action = NULL;
- json_t* js_value = NULL;
- json_t* js_prevValue = NULL;
- bool retVal = false;
- char url[MAX_URL_LENGTH];
- int res;
- struct MemoryStruct reply;
-
- reply.memory = malloc(1); /* will be grown as needed by the realloc above */
- reply.size = 0; /* no data at this point */
- if (index != 0)
- snprintf(url, MAX_URL_LENGTH, "http://%s:%d/v2/keys/%s?wait=true&recursive=true&waitIndex=%d", etcd_server, etcd_port, key,
- index);
- else
- snprintf(url, MAX_URL_LENGTH, "http://%s:%d/v2/keys/%s?wait=true&recursive=true", etcd_server, etcd_port, key);
-
- res = performRequest(url, GET, WriteMemoryCallback, NULL, (void*) &reply);
-
- if (res == CURLE_OK) {
- js_root = json_loads(reply.memory, 0, &error);
-
- if (js_root != NULL) {
- js_action = json_object_get(js_root, ETCD_JSON_ACTION);
- js_node = json_object_get(js_root, ETCD_JSON_NODE);
- js_prevNode = json_object_get(js_root, ETCD_JSON_PREVNODE);
- }
- if (js_prevNode != NULL) {
- js_prevValue = json_object_get(js_prevNode, ETCD_JSON_VALUE);
- }
- if (js_node != NULL) {
- js_value = json_object_get(js_node, ETCD_JSON_VALUE);
- }
- if (js_prevNode != NULL) {
- js_prevValue = json_object_get(js_prevNode, ETCD_JSON_VALUE);
- }
- if ((js_prevValue != NULL) && (json_is_string(js_prevValue))) {
- strncpy(prevValue, json_string_value(js_prevValue), MAX_VALUE_LENGTH);
- }
- if ((js_value != NULL) && (json_is_string(js_value))) {
- strncpy(value, json_string_value(js_value), MAX_VALUE_LENGTH);
- }
- if ((js_action != NULL) && (json_is_string(js_action))) {
- strncpy(action, json_string_value(js_action), MAX_ACTION_LENGTH);
-
- retVal = true;
- }
- if (js_root != NULL) {
- json_decref(js_root);
- }
- }
-
- if (reply.memory) {
- free(reply.memory);
- }
-
- return retVal;
+bool etcd_watch(char* key, int index, char* action, char* prevValue, char* value, char* rkey, int* modifiedIndex) {
+ json_error_t error;
+ json_t* js_root = NULL;
+ json_t* js_node = NULL;
+ json_t* js_prevNode = NULL;
+ json_t* js_action = NULL;
+ json_t* js_value = NULL;
+ json_t* js_rkey = NULL;
+ json_t* js_prevValue = NULL;
+ json_t* js_modIndex = NULL;
+ bool retVal = false;
+ char url[MAX_URL_LENGTH];
+ int res;
+ struct MemoryStruct reply;
+
+ reply.memory = malloc(1); /* will be grown as needed by the realloc above */
+ reply.size = 0; /* no data at this point */
+
+ if (index != 0)
+ snprintf(url, MAX_URL_LENGTH, "http://%s:%d/v2/keys/%s?wait=true&recursive=true&waitIndex=%d", etcd_server, etcd_port, key, index);
+ else
+ snprintf(url, MAX_URL_LENGTH, "http://%s:%d/v2/keys/%s?wait=true&recursive=true", etcd_server, etcd_port, key);
+
+ res = performRequest(url, GET, WriteMemoryCallback, NULL, (void*) &reply);
+
+ if (res == CURLE_OK) {
+
+ js_root = json_loads(reply.memory, 0, &error);
+
+ if (js_root != NULL) {
+ js_action = json_object_get(js_root, ETCD_JSON_ACTION);
+ js_node = json_object_get(js_root, ETCD_JSON_NODE);
+ js_prevNode = json_object_get(js_root, ETCD_JSON_PREVNODE);
+ }
+ if (js_prevNode != NULL) {
+ js_prevValue = json_object_get(js_prevNode, ETCD_JSON_VALUE);
+ }
+ if (js_node != NULL) {
+ js_rkey = json_object_get(js_node, ETCD_JSON_KEY);
+ js_value = json_object_get(js_node, ETCD_JSON_VALUE);
+ js_modIndex = json_object_get(js_node, ETCD_JSON_MODIFIEDINDEX);
+ }
+ if (js_prevNode != NULL) {
+ js_prevValue = json_object_get(js_prevNode, ETCD_JSON_VALUE);
+ }
+ if ((js_prevValue != NULL) && (json_is_string(js_prevValue))) {
+ strncpy(prevValue, json_string_value(js_prevValue), MAX_VALUE_LENGTH);
+ }
+ if ((js_value != NULL) && (json_is_string(js_value))) {
+ strncpy(value, json_string_value(js_value), MAX_VALUE_LENGTH);
+ }
+ if ((js_modIndex != NULL) && (json_is_integer(js_modIndex))) {
+ *modifiedIndex = json_integer_value(js_modIndex);
+ } else {
+ *modifiedIndex = index;
+ }
+
+ if ((js_rkey != NULL) && (js_action != NULL) && (json_is_string(js_rkey)) && (json_is_string(js_action))) {
+ strncpy(rkey, json_string_value(js_rkey), MAX_KEY_LENGTH);
+ strncpy(action, json_string_value(js_action), MAX_ACTION_LENGTH);
+
+ retVal = true;
+ }
+ if (js_root != NULL) {
+ json_decref(js_root);
+ }
+
+ }
+
+ if (reply.memory) {
+ free(reply.memory);
+ }
+
+ return retVal;
}
http://git-wip-us.apache.org/repos/asf/celix/blob/c396aeed/remote_services/discovery_etcd/private/src/etcd_watcher.c
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/private/src/etcd_watcher.c b/remote_services/discovery_etcd/private/src/etcd_watcher.c
index eefd28f..89be84e 100644
--- a/remote_services/discovery_etcd/private/src/etcd_watcher.c
+++ b/remote_services/discovery_etcd/private/src/etcd_watcher.c
@@ -31,6 +31,7 @@
#include "log_helper.h"
#include "log_service.h"
#include "constants.h"
+#include "utils.h"
#include "discovery.h"
#include "discovery_impl.h"
@@ -42,6 +43,7 @@
struct etcd_watcher {
discovery_pt discovery;
log_helper_pt* loghelper;
+ hash_map_pt entries;
celix_thread_mutex_t watcherLock;
celix_thread_t watcherThread;
@@ -200,6 +202,52 @@ static celix_status_t etcdWatcher_addOwnFramework(etcd_watcher_pt watcher)
return status;
}
+
+
+
+static celix_status_t etcdWatcher_addEntry(etcd_watcher_pt watcher, char* key, char* value) {
+ celix_status_t status = CELIX_BUNDLE_EXCEPTION;
+ endpoint_discovery_poller_pt poller = watcher->discovery->poller;
+
+ if (!hashMap_containsKey(watcher->entries, key)) {
+ status = endpointDiscoveryPoller_addDiscoveryEndpoint(poller, value);
+
+ if (status == CELIX_SUCCESS) {
+ hashMap_put(watcher->entries, key, value);
+ }
+ }
+
+ return status;
+}
+
+
+static celix_status_t etcdWatcher_removeEntry(etcd_watcher_pt watcher, char* key, char* value) {
+ celix_status_t status = CELIX_BUNDLE_EXCEPTION;
+ endpoint_discovery_poller_pt poller = watcher->discovery->poller;
+
+ if (hashMap_containsKey(watcher->entries, key)) {
+
+ hashMap_remove(watcher->entries, key);
+
+ // check if there is another entry with the same value
+ hash_map_iterator_pt iter = hashMapIterator_create(watcher->entries);
+ unsigned int valueFound = 0;
+
+ while (hashMapIterator_hasNext(iter) && valueFound <= 1) {
+ if (strcmp(value, hashMapIterator_nextValue(iter)) == 0)
+ valueFound++;
+ }
+
+ if (valueFound == 0)
+ status = endpointDiscoveryPoller_removeDiscoveryEndpoint(poller, value);
+
+ }
+
+ return status;
+
+}
+
+
/*
* performs (blocking) etcd_watch calls to check for
* changing discovery endpoint information within etcd.
@@ -211,29 +259,32 @@ static void* etcdWatcher_run(void* data) {
int highestModified = 0;
bundle_context_pt context = watcher->discovery->context;
- endpoint_discovery_poller_pt poller = watcher->discovery->poller;
etcdWatcher_addAlreadyExistingWatchpoints(watcher->discovery, &highestModified);
etcdWatcher_getRootPath(context, &rootPath[0]);
while (watcher->running) {
+
+ char rkey[MAX_KEY_LENGTH];
char value[MAX_VALUE_LENGTH];
char preValue[MAX_VALUE_LENGTH];
char action[MAX_ACTION_LENGTH];
+ int modIndex;
- if (etcd_watch(rootPath, highestModified+1, &action[0], &preValue[0], &value[0]) == true) {
+ if (etcd_watch(rootPath, highestModified + 1, &action[0], &preValue[0], &value[0], &rkey[0], &modIndex) == true) {
if (strcmp(action, "set") == 0) {
- endpointDiscoveryPoller_addDiscoveryEndpoint(poller, strdup(&value[0]));
+ etcdWatcher_addEntry(watcher, &rkey[0], &value[0]);
} else if (strcmp(action, "delete") == 0) {
- endpointDiscoveryPoller_removeDiscoveryEndpoint(poller, &preValue[0]);
+ etcdWatcher_removeEntry(watcher, &rkey[0], &value[0]);
} else if (strcmp(action, "expire") == 0) {
- endpointDiscoveryPoller_removeDiscoveryEndpoint(poller, &preValue[0]);
+ etcdWatcher_removeEntry(watcher, &rkey[0], &value[0]);
} else if (strcmp(action, "update") == 0) {
- // TODO
+ etcdWatcher_addEntry(watcher, &rkey[0], &value[0]);
} else {
logHelper_log(*watcher->loghelper, OSGI_LOGSERVICE_INFO, "Unexpected action: %s", action);
}
- highestModified++;
+
+ highestModified = modIndex;
}
// update own framework uuid
@@ -263,7 +314,6 @@ celix_status_t etcdWatcher_create(discovery_pt discovery, bundle_context_pt cont
return CELIX_BUNDLE_EXCEPTION;
}
-
(*watcher) = calloc(1, sizeof(struct etcd_watcher));
if (!*watcher) {
return CELIX_ENOMEM;
@@ -272,6 +322,7 @@ celix_status_t etcdWatcher_create(discovery_pt discovery, bundle_context_pt cont
{
(*watcher)->discovery = discovery;
(*watcher)->loghelper = &discovery->loghelper;
+ (*watcher)->entries = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
}
if ((bundleContext_getProperty(context, CFG_ETCD_SERVER_IP, &etcd_server) != CELIX_SUCCESS) || !etcd_server) {
@@ -338,6 +389,8 @@ celix_status_t etcdWatcher_destroy(etcd_watcher_pt watcher) {
watcher->loghelper = NULL;
+ hashMap_destroy(watcher->entries, true, true);
+
free(watcher);
return status;
[05/11] celix git commit: CELIX-253: Applied bug fix patch for
deployment_admin. Added .idea to .gitignore
Posted by pn...@apache.org.
CELIX-253: Applied bug fix patch for deployment_admin. Added .idea to .gitignore
The path fixes an issue in deployment admin where strcmp result was compared gt instead of !=.
This resulted in some changes (version 9.0.0 -> version 10.0.0) not being triggered.
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/052a6116
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/052a6116
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/052a6116
Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 052a611656df5870af6672605e9a87b27b7f4884
Parents: 5e6d2f2
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Tue Sep 1 16:14:53 2015 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Tue Sep 1 16:14:53 2015 +0200
----------------------------------------------------------------------
.gitignore | 1 +
deployment_admin/private/src/deployment_admin.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/052a6116/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index eb89068..98033a5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,4 +17,5 @@
/.project
.DS_Store
+.idea
build
http://git-wip-us.apache.org/repos/asf/celix/blob/052a6116/deployment_admin/private/src/deployment_admin.c
----------------------------------------------------------------------
diff --git a/deployment_admin/private/src/deployment_admin.c b/deployment_admin/private/src/deployment_admin.c
index 9f29866..f1ab5bc 100644
--- a/deployment_admin/private/src/deployment_admin.c
+++ b/deployment_admin/private/src/deployment_admin.c
@@ -218,7 +218,7 @@ static void *deploymentAdmin_poll(void *deploymentAdmin) {
char *last = arrayList_get(versions, arrayList_size(versions) - 1);
if (last != NULL) {
- if (admin->current == NULL || strcmp(last, admin->current) > 0) {
+ if (admin->current == NULL || strcmp(last, admin->current) != 0) {
int length = strlen(admin->pollUrl) + strlen(last) + 2;
char request[length];
if (admin->current == NULL) {
[09/11] celix git commit: CELIX-255: BUILD_UTILS default to ON
instead of OFF
Posted by pn...@apache.org.
CELIX-255: BUILD_UTILS default to ON instead of OFF
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/10944465
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/10944465
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/10944465
Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 1094446526b7df47d332933a16dd8f7fbeb1de15
Parents: e0a5195
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Tue Sep 1 16:42:18 2015 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Tue Sep 1 16:42:18 2015 +0200
----------------------------------------------------------------------
utils/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/10944465/utils/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index a6b2f4f..bb27a0c 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-celix_subproject(UTILS "Option to build the utilities library" "OFF")
+celix_subproject(UTILS "Option to build the utilities library" ON)
if (UTILS)
cmake_minimum_required(VERSION 2.6)
[07/11] celix git commit: CELIX-255: Changed default values to ON for
a set of BUILD_* options.
Posted by pn...@apache.org.
CELIX-255: Changed default values to ON for a set of BUILD_* options.
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/e0a51953
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/e0a51953
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/e0a51953
Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: e0a51953fc2de5f589a207fc08bce80a50e8a944
Parents: 5c5a0eb
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Tue Sep 1 16:27:34 2015 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Tue Sep 1 16:27:34 2015 +0200
----------------------------------------------------------------------
dependency_manager_2/CMakeLists.txt | 2 +-
deployment_admin/CMakeLists.txt | 2 +-
log_service/CMakeLists.txt | 2 +-
log_writer/CMakeLists.txt | 2 +-
remote_services/discovery_configured/CMakeLists.txt | 2 +-
remote_services/discovery_etcd/CMakeLists.txt | 2 +-
remote_services/examples/CMakeLists.txt | 2 +-
remote_services/remote_service_admin_http/CMakeLists.txt | 2 +-
remote_shell/CMakeLists.txt | 4 ++--
shell/CMakeLists.txt | 2 +-
shell_tui/CMakeLists.txt | 2 +-
11 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/e0a51953/dependency_manager_2/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/dependency_manager_2/CMakeLists.txt b/dependency_manager_2/CMakeLists.txt
index 7aecc61..373cd34 100644
--- a/dependency_manager_2/CMakeLists.txt
+++ b/dependency_manager_2/CMakeLists.txt
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-celix_subproject(DEPENDENCY_MANAGER2 "Option to build the dependency manager static library" "OFF" DEPS framework)
+celix_subproject(DEPENDENCY_MANAGER2 "Option to build the dependency manager static library" ON DEPS framework)
if (DEPENDENCY_MANAGER2)
# Add -fPIC for x86_64 Unix platforms; this lib will be linked to a shared lib
if(UNIX AND NOT WIN32)
http://git-wip-us.apache.org/repos/asf/celix/blob/e0a51953/deployment_admin/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/deployment_admin/CMakeLists.txt b/deployment_admin/CMakeLists.txt
index cd267bf..cff425d 100644
--- a/deployment_admin/CMakeLists.txt
+++ b/deployment_admin/CMakeLists.txt
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-celix_subproject(DEPLOYMENT_ADMIN "Option to enable building the Deployment Admin Service bundles" OFF DEPS framework launcher shell_tui log_writer)
+celix_subproject(DEPLOYMENT_ADMIN "Option to enable building the Deployment Admin Service bundles" ON DEPS framework launcher shell_tui log_writer)
if (DEPLOYMENT_ADMIN)
find_package(CURL REQUIRED)
http://git-wip-us.apache.org/repos/asf/celix/blob/e0a51953/log_service/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/log_service/CMakeLists.txt b/log_service/CMakeLists.txt
index 933c2fb..b431db0 100644
--- a/log_service/CMakeLists.txt
+++ b/log_service/CMakeLists.txt
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-celix_subproject(LOG_SERVICE "Option to enable building the Log Service bundles" "OFF" DEPS framework)
+celix_subproject(LOG_SERVICE "Option to enable building the Log Service bundles" ON DEPS framework)
if (LOG_SERVICE)
SET_HEADER(BUNDLE_VERSION "1.0.0")
http://git-wip-us.apache.org/repos/asf/celix/blob/e0a51953/log_writer/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/log_writer/CMakeLists.txt b/log_writer/CMakeLists.txt
index d98b311..4692d7a 100644
--- a/log_writer/CMakeLists.txt
+++ b/log_writer/CMakeLists.txt
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-celix_subproject(LOG_WRITER "Option to enable building the Log Writer bundles" "OFF" DEPS FRAMEWORK LOG_SERVICE)
+celix_subproject(LOG_WRITER "Option to enable building the Log Writer bundles" ON DEPS FRAMEWORK LOG_SERVICE)
if (LOG_WRITER)
add_subdirectory(log_writer_stdout)
add_subdirectory(log_writer_syslog)
http://git-wip-us.apache.org/repos/asf/celix/blob/e0a51953/remote_services/discovery_configured/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/discovery_configured/CMakeLists.txt b/remote_services/discovery_configured/CMakeLists.txt
index 9b8fa09..9fc6a81 100644
--- a/remote_services/discovery_configured/CMakeLists.txt
+++ b/remote_services/discovery_configured/CMakeLists.txt
@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-celix_subproject(RSA_DISCOVERY_CONFIGURED "Option to enable building the Discovery (Configured) bundle" OFF)
+celix_subproject(RSA_DISCOVERY_CONFIGURED "Option to enable building the Discovery (Configured) bundle" ON)
if (RSA_DISCOVERY_CONFIGURED)
find_package(CURL REQUIRED)
find_package(LibXml2 REQUIRED)
http://git-wip-us.apache.org/repos/asf/celix/blob/e0a51953/remote_services/discovery_etcd/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/CMakeLists.txt b/remote_services/discovery_etcd/CMakeLists.txt
index abc5905..aa1e08c 100644
--- a/remote_services/discovery_etcd/CMakeLists.txt
+++ b/remote_services/discovery_etcd/CMakeLists.txt
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-celix_subproject(RSA_DISCOVERY_ETCD "Option to enable building the Discovery (ETCD) bundle" OFF)
+celix_subproject(RSA_DISCOVERY_ETCD "Option to enable building the Discovery (ETCD) bundle" ON)
if (RSA_DISCOVERY_ETCD)
find_package(CURL REQUIRED)
find_package(LibXml2 REQUIRED)
http://git-wip-us.apache.org/repos/asf/celix/blob/e0a51953/remote_services/examples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/examples/CMakeLists.txt b/remote_services/examples/CMakeLists.txt
index d975cc2..9246a0f 100644
--- a/remote_services/examples/CMakeLists.txt
+++ b/remote_services/examples/CMakeLists.txt
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-celix_subproject(RSA_EXAMPLES "Option to enable building the RSA examples" OFF DEPS LAUNCHER shell_tui log_writer RSA_TOPOLOGY_MANAGER)
+celix_subproject(RSA_EXAMPLES "Option to enable building the RSA examples" ON DEPS LAUNCHER shell_tui log_writer RSA_TOPOLOGY_MANAGER)
if (RSA_EXAMPLES)
add_subdirectory(calculator_service)
http://git-wip-us.apache.org/repos/asf/celix/blob/e0a51953/remote_services/remote_service_admin_http/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_http/CMakeLists.txt b/remote_services/remote_service_admin_http/CMakeLists.txt
index f066407..a147a37 100644
--- a/remote_services/remote_service_admin_http/CMakeLists.txt
+++ b/remote_services/remote_service_admin_http/CMakeLists.txt
@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-celix_subproject(RSA_REMOTE_SERVICE_ADMIN_HTTP "Option to enable building the Remote Service Admin Service HTTP bundle" OFF)
+celix_subproject(RSA_REMOTE_SERVICE_ADMIN_HTTP "Option to enable building the Remote Service Admin Service HTTP bundle" ON)
if (RSA_REMOTE_SERVICE_ADMIN_HTTP)
find_package(CURL REQUIRED)
find_package(UUID REQUIRED)
http://git-wip-us.apache.org/repos/asf/celix/blob/e0a51953/remote_shell/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_shell/CMakeLists.txt b/remote_shell/CMakeLists.txt
index 892fc48..e945415 100644
--- a/remote_shell/CMakeLists.txt
+++ b/remote_shell/CMakeLists.txt
@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-celix_subproject(REMOTE_SHELL "Option to enable building the Remote Shell bundles" OFF DEPS LAUNCHER SHELL_TUI)
+celix_subproject(REMOTE_SHELL "Option to enable building the Remote Shell bundles" ON DEPS LAUNCHER SHELL_TUI)
if (REMOTE_SHELL)
SET_HEADER(BUNDLE_SYMBOLICNAME "apache_celix_remote_shell")
@@ -41,4 +41,4 @@ if (REMOTE_SHELL)
include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
target_link_libraries(remote_shell celix_framework)
-endif (REMOTE_SHELL)
\ No newline at end of file
+endif (REMOTE_SHELL)
http://git-wip-us.apache.org/repos/asf/celix/blob/e0a51953/shell/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/shell/CMakeLists.txt b/shell/CMakeLists.txt
index 07f4c6e..8f7c94a 100644
--- a/shell/CMakeLists.txt
+++ b/shell/CMakeLists.txt
@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-celix_subproject(SHELL "Option to enable building the Shell bundles" "OFF" DEPS LAUNCHER LOG_SERVICE)
+celix_subproject(SHELL "Option to enable building the Shell bundles" ON DEPS LAUNCHER LOG_SERVICE)
if (SHELL)
find_package(CURL REQUIRED)
http://git-wip-us.apache.org/repos/asf/celix/blob/e0a51953/shell_tui/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/shell_tui/CMakeLists.txt b/shell_tui/CMakeLists.txt
index 65a8e9c..ab56f73 100644
--- a/shell_tui/CMakeLists.txt
+++ b/shell_tui/CMakeLists.txt
@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-celix_subproject(SHELL_TUI "Option to enable building the Shell Textual User Interface bundles" OFF DEPS LAUNCHER SHELL)
+celix_subproject(SHELL_TUI "Option to enable building the Shell Textual User Interface bundles" ON DEPS LAUNCHER SHELL)
if (SHELL_TUI)
SET_HEADER(BUNDLE_VERSION "1.0.0")
[10/11] celix git commit: CELIX-237: Merge branch 'develop' into ffi
Posted by pn...@apache.org.
CELIX-237: Merge branch 'develop' into ffi
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/3853a7c9
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/3853a7c9
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/3853a7c9
Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 3853a7c9d1f32636a679fbcfddb4db30766c5375
Parents: 9937ce1 1094446
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Tue Sep 1 16:43:38 2015 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Tue Sep 1 16:43:38 2015 +0200
----------------------------------------------------------------------
utils/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/3853a7c9/utils/CMakeLists.txt
----------------------------------------------------------------------
[08/11] celix git commit: CELIX-237: Merge branch 'develop' into ffi
Posted by pn...@apache.org.
CELIX-237: Merge branch 'develop' into ffi
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/9937ce13
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/9937ce13
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/9937ce13
Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 9937ce132caabdfa4e2de27f13558258d5c584f7
Parents: b6f2ae4 e0a5195
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Tue Sep 1 16:37:41 2015 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Tue Sep 1 16:37:41 2015 +0200
----------------------------------------------------------------------
.gitignore | 1 +
CMakeLists.txt | 3 +-
dependency_manager_2/CMakeLists.txt | 2 +-
deployment_admin/CMakeLists.txt | 2 +-
deployment_admin/private/src/deployment_admin.c | 9 +-
log_service/CMakeLists.txt | 2 +-
log_writer/CMakeLists.txt | 2 +-
.../private/src/endpoint_discovery_poller.c | 72 +++++-----
.../discovery_configured/CMakeLists.txt | 2 +-
remote_services/discovery_etcd/CMakeLists.txt | 2 +-
.../discovery_etcd/private/include/etcd.h | 2 +-
.../discovery_etcd/private/src/etcd.c | 135 ++++++++++---------
.../discovery_etcd/private/src/etcd_watcher.c | 70 ++++++++--
.../discovery_shm/private/src/shm_watcher.c | 2 +-
remote_services/examples/CMakeLists.txt | 2 +-
.../remote_service_admin_http/CMakeLists.txt | 2 +-
remote_shell/CMakeLists.txt | 4 +-
shell/CMakeLists.txt | 2 +-
shell_tui/CMakeLists.txt | 2 +-
19 files changed, 200 insertions(+), 118 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/9937ce13/.gitignore
----------------------------------------------------------------------
diff --cc .gitignore
index 159da4f,98033a5..f630756
--- a/.gitignore
+++ b/.gitignore
@@@ -17,7 -17,5 +17,8 @@@
/.project
.DS_Store
+ .idea
build
+*~
+*.swp
+.idea
http://git-wip-us.apache.org/repos/asf/celix/blob/9937ce13/CMakeLists.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/9937ce13/remote_services/discovery/private/src/endpoint_discovery_poller.c
----------------------------------------------------------------------
[03/11] celix git commit: CELIX-252: Aligned memory allocation
Posted by pn...@apache.org.
CELIX-252: Aligned memory allocation
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/1010f712
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/1010f712
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/1010f712
Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 1010f71262e1438d08c30b179bb35c0393df9e71
Parents: c396aee
Author: Bjoern Petri <bp...@apache.org>
Authored: Tue Aug 25 23:05:28 2015 +0200
Committer: Bjoern Petri <bp...@apache.org>
Committed: Tue Aug 25 23:05:28 2015 +0200
----------------------------------------------------------------------
.../private/src/endpoint_discovery_poller.c | 72 +++++++++++---------
.../discovery_etcd/private/src/etcd_watcher.c | 9 ++-
.../discovery_shm/private/src/shm_watcher.c | 2 +-
3 files changed, 46 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/1010f712/remote_services/discovery/private/src/endpoint_discovery_poller.c
----------------------------------------------------------------------
diff --git a/remote_services/discovery/private/src/endpoint_discovery_poller.c b/remote_services/discovery/private/src/endpoint_discovery_poller.c
index 569d7a9..ae269cf 100644
--- a/remote_services/discovery/private/src/endpoint_discovery_poller.c
+++ b/remote_services/discovery/private/src/endpoint_discovery_poller.c
@@ -172,60 +172,66 @@ celix_status_t endpointDiscoveryPoller_getDiscoveryEndpoints(endpoint_discovery_
* Adds a new endpoint URL to the list of polled endpoints.
*/
celix_status_t endpointDiscoveryPoller_addDiscoveryEndpoint(endpoint_discovery_poller_pt poller, char *url) {
- celix_status_t status;
+ celix_status_t status;
- status = celixThreadMutex_lock(&(poller)->pollerLock);
- if (status != CELIX_SUCCESS) {
- return CELIX_BUNDLE_EXCEPTION;
- }
+ status = celixThreadMutex_lock(&(poller)->pollerLock);
+ if (status != CELIX_SUCCESS) {
+ return CELIX_BUNDLE_EXCEPTION;
+ }
// Avoid memory leaks when adding an already existing URL...
array_list_pt endpoints = hashMap_get(poller->entries, url);
- if (endpoints == NULL) {
+ if (endpoints == NULL) {
status = arrayList_createWithEquals(endpointDiscoveryPoller_endpointDescriptionEquals, &endpoints);
if (status == CELIX_SUCCESS) {
- hashMap_put(poller->entries, url, endpoints);
+ logHelper_log(*poller->loghelper, OSGI_LOGSERVICE_DEBUG, "ENDPOINT_POLLER: add new discovery endpoint with url %s", url);
+ hashMap_put(poller->entries, strdup(url), endpoints);
}
- }
+ }
status = celixThreadMutex_unlock(&poller->pollerLock);
- return status;
+ return status;
}
/**
* Removes an endpoint URL from the list of polled endpoints.
*/
celix_status_t endpointDiscoveryPoller_removeDiscoveryEndpoint(endpoint_discovery_poller_pt poller, char *url) {
- celix_status_t status;
+ celix_status_t status = CELIX_SUCCESS;
- status = celixThreadMutex_lock(&poller->pollerLock);
- if (status != CELIX_SUCCESS) {
- return CELIX_BUNDLE_EXCEPTION;
- }
+ if (celixThreadMutex_lock(&poller->pollerLock) != CELIX_SUCCESS) {
+ status = CELIX_BUNDLE_EXCEPTION;
+ } else {
+ hash_map_entry_pt entry = hashMap_getEntry(poller->entries, url);
- hash_map_entry_pt entry = hashMap_getEntry(poller->entries, url);
- char* origKey = hashMapEntry_getKey(entry);
+ if (entry == NULL) {
+ logHelper_log(*poller->loghelper, OSGI_LOGSERVICE_DEBUG, "ENDPOINT_POLLER: There was no entry found belonging to url %s - maybe already removed?", url);
+ } else {
+ char* origKey = hashMapEntry_getKey(entry);
- array_list_pt entries = hashMap_remove(poller->entries, url);
+ logHelper_log(*poller->loghelper, OSGI_LOGSERVICE_DEBUG, "ENDPOINT_POLLER: remove discovery endpoint with url %s", url);
- for (unsigned int i = arrayList_size(entries); i > 0 ; i--) {
- endpoint_description_pt endpoint = arrayList_get(entries, i-1);
- discovery_removeDiscoveredEndpoint(poller->discovery, endpoint);
- arrayList_remove(entries, i-1);
- endpointDescription_destroy(endpoint);
- }
+ array_list_pt entries = hashMap_remove(poller->entries, url);
- if (entries != NULL) {
- arrayList_destroy(entries);
- }
+ for (unsigned int i = arrayList_size(entries); i > 0; i--) {
+ endpoint_description_pt endpoint = arrayList_get(entries, i - 1);
+ discovery_removeDiscoveredEndpoint(poller->discovery, endpoint);
+ arrayList_remove(entries, i - 1);
+ endpointDescription_destroy(endpoint);
+ }
+ if (entries != NULL) {
+ arrayList_destroy(entries);
+ }
- free(origKey);
- status = celixThreadMutex_unlock(&poller->pollerLock);
+ free(origKey);
+ }
+ status = celixThreadMutex_unlock(&poller->pollerLock);
+ }
- return status;
+ return status;
}
static void *endpointDiscoveryPoller_poll(void *data) {
@@ -243,6 +249,7 @@ static void *endpointDiscoveryPoller_poll(void *data) {
}
hash_map_iterator_pt iterator = hashMapIterator_create(poller->entries);
+
while (hashMapIterator_hasNext(iterator)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
@@ -251,9 +258,9 @@ static void *endpointDiscoveryPoller_poll(void *data) {
array_list_pt updatedEndpoints = NULL;
// create an arraylist with a custom equality test to ensure we can find endpoints properly...
- status = arrayList_createWithEquals(endpointDiscoveryPoller_endpointDescriptionEquals, &updatedEndpoints);
-
+ arrayList_createWithEquals(endpointDiscoveryPoller_endpointDescriptionEquals, &updatedEndpoints);
status = endpointDiscoveryPoller_getEndpoints(poller, url, &updatedEndpoints);
+
if (status != CELIX_SUCCESS) {
status = celixThreadMutex_unlock(&poller->pollerLock);
continue;
@@ -262,6 +269,7 @@ static void *endpointDiscoveryPoller_poll(void *data) {
if (updatedEndpoints) {
for (unsigned int i = arrayList_size(currentEndpoints); i > 0 ; i--) {
endpoint_description_pt endpoint = arrayList_get(currentEndpoints, i-1);
+
if (!arrayList_contains(updatedEndpoints, endpoint)) {
status = discovery_removeDiscoveredEndpoint(poller->discovery, endpoint);
arrayList_remove(currentEndpoints, i-1);
@@ -339,6 +347,8 @@ static celix_status_t endpointDiscoveryPoller_getEndpoints(endpoint_discovery_po
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, endpointDiscoveryPoller_writeMemory);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
+ curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 5L);
+ curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10L);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
http://git-wip-us.apache.org/repos/asf/celix/blob/1010f712/remote_services/discovery_etcd/private/src/etcd_watcher.c
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/private/src/etcd_watcher.c b/remote_services/discovery_etcd/private/src/etcd_watcher.c
index 89be84e..c54fcdc 100644
--- a/remote_services/discovery_etcd/private/src/etcd_watcher.c
+++ b/remote_services/discovery_etcd/private/src/etcd_watcher.c
@@ -131,7 +131,7 @@ static celix_status_t etcdWatcher_addAlreadyExistingWatchpoints(discovery_pt dis
if (etcd_get(key, &value[0], &action[0], &modIndex) == true) {
// TODO: check that this is not equals to the local endpoint
- endpointDiscoveryPoller_addDiscoveryEndpoint(discovery->poller, strdup(&value[0]));
+ endpointDiscoveryPoller_addDiscoveryEndpoint(discovery->poller, &value[0]);
if (modIndex > *highestModified) {
*highestModified = modIndex;
@@ -206,23 +206,22 @@ static celix_status_t etcdWatcher_addOwnFramework(etcd_watcher_pt watcher)
static celix_status_t etcdWatcher_addEntry(etcd_watcher_pt watcher, char* key, char* value) {
- celix_status_t status = CELIX_BUNDLE_EXCEPTION;
+ celix_status_t status = CELIX_BUNDLE_EXCEPTION;
endpoint_discovery_poller_pt poller = watcher->discovery->poller;
if (!hashMap_containsKey(watcher->entries, key)) {
status = endpointDiscoveryPoller_addDiscoveryEndpoint(poller, value);
if (status == CELIX_SUCCESS) {
- hashMap_put(watcher->entries, key, value);
+ hashMap_put(watcher->entries, strdup(key), strdup(value));
}
}
return status;
}
-
static celix_status_t etcdWatcher_removeEntry(etcd_watcher_pt watcher, char* key, char* value) {
- celix_status_t status = CELIX_BUNDLE_EXCEPTION;
+ celix_status_t status = CELIX_BUNDLE_EXCEPTION;
endpoint_discovery_poller_pt poller = watcher->discovery->poller;
if (hashMap_containsKey(watcher->entries, key)) {
http://git-wip-us.apache.org/repos/asf/celix/blob/1010f712/remote_services/discovery_shm/private/src/shm_watcher.c
----------------------------------------------------------------------
diff --git a/remote_services/discovery_shm/private/src/shm_watcher.c b/remote_services/discovery_shm/private/src/shm_watcher.c
index 212af55..2152345 100644
--- a/remote_services/discovery_shm/private/src/shm_watcher.c
+++ b/remote_services/discovery_shm/private/src/shm_watcher.c
@@ -111,7 +111,7 @@ static celix_status_t shmWatcher_syncEndpoints(shm_watcher_pt watcher) {
}
if (elementFound == false) {
- endpointDiscoveryPoller_addDiscoveryEndpoint(watcher->poller, strdup(url));
+ endpointDiscoveryPoller_addDiscoveryEndpoint(watcher->poller, url);
}
}
}