From dev-return-857-apmail-celix-dev-archive=celix.apache.org@celix.apache.org Fri Oct 17 13:22:48 2014 Return-Path: X-Original-To: apmail-celix-dev-archive@www.apache.org Delivered-To: apmail-celix-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6880217A75 for ; Fri, 17 Oct 2014 13:22:48 +0000 (UTC) Received: (qmail 5320 invoked by uid 500); 17 Oct 2014 13:22:48 -0000 Delivered-To: apmail-celix-dev-archive@celix.apache.org Received: (qmail 5286 invoked by uid 500); 17 Oct 2014 13:22:48 -0000 Mailing-List: contact dev-help@celix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@celix.apache.org Delivered-To: mailing list dev@celix.apache.org Received: (qmail 5275 invoked by uid 99); 17 Oct 2014 13:22:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Oct 2014 13:22:47 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [85.13.132.30] (HELO dd7632.kasserver.com) (85.13.132.30) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Oct 2014 13:22:20 +0000 Received: by dd7632.kasserver.com (Postfix, from userid 1085) id 953B715803D7; Fri, 17 Oct 2014 15:22:19 +0200 (CEST) To: dev@celix.apache.org Subject: Re: svn commit: r1632480 - in =?UTF-8?Q?/celix/trunk/remote=5Fser?= =?UTF-8?Q?vices/discovery=5Fetcd/private/src=3A=20discovery=5Fimpl=2Ec=20?= =?UTF-8?Q?etcd=5Fwatcher=2Ec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Fri, 17 Oct 2014 15:22:19 +0200 From: Bjoern Petri In-Reply-To: References: <20141017071630.4244923888E4@eris.apache.org> Message-ID: <53a1107a1a3579dc1b2e298660d9a80f@mail.sundevil.de> X-Sender: bjoern.petri@sundevil.de User-Agent: Roundcube Webmail/1.0.0 X-Virus-Checked: Checked by ClamAV on apache.org Hi Alexander, Currently, I cannot find the problem. The etcd_watcher.h should not contain the function signature shown in the error message any more. Could you do me the favor and shortly check whether the etcd_watcher.h (rev 1632567) still contains this? Regards, Bjoern On 2014-10-17 15:05, Alexander Broekhuis wrote: > Hi Bjoern, > > I think you forgot to add a file to the commit. It is not building for > me: > > remote_services/discovery_etcd/private/src/etcd_watcher.c:237:16: > error: > conflicting types for ‘etcdWatcher_create’ > celix_status_t etcdWatcher_create(discovery_pt discovery, > bundle_context_pt > context, > > remote_services/discovery_etcd/private/include/etcd_watcher.h:36:16: > note: > previous declaration of ‘etcdWatcher_create’ was here > celix_status_t etcdWatcher_create(endpoint_discovery_poller_pt poller, > bundle_context_pt context, etcd_watcher_pt *watcher); > > > 2014-10-17 3:16 GMT-04:00 : > >> Author: bpetri >> Date: Fri Oct 17 07:16:29 2014 >> New Revision: 1632480 >> >> URL: http://svn.apache.org/r1632480 >> Log: >> CELIX-168: Added new property DISCOVERY_ETCD_ROOT_PATH, which allows >> to >> change the etcd root path >> >> Modified: >> >> celix/trunk/remote_services/discovery_etcd/private/src/discovery_impl.c >> >> celix/trunk/remote_services/discovery_etcd/private/src/etcd_watcher.c >> >> Modified: >> celix/trunk/remote_services/discovery_etcd/private/src/discovery_impl.c >> URL: >> http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_etcd/private/src/discovery_impl.c?rev=1632480&r1=1632479&r2=1632480&view=diff >> >> ============================================================================== >> --- >> celix/trunk/remote_services/discovery_etcd/private/src/discovery_impl.c >> (original) >> +++ >> celix/trunk/remote_services/discovery_etcd/private/src/discovery_impl.c >> Fri >> Oct 17 07:16:29 2014 >> @@ -124,12 +124,12 @@ celix_status_t discovery_start(discovery >> return CELIX_BUNDLE_EXCEPTION; >> } >> >> - status = etcdWatcher_create(discovery->poller, >> discovery->context, >> &discovery->watcher); >> + status = endpointDiscoveryServer_create(discovery, >> discovery->context, &discovery->server); >> if (status != CELIX_SUCCESS) { >> - return CELIX_BUNDLE_EXCEPTION; >> + return CELIX_BUNDLE_EXCEPTION; >> } >> >> - status = endpointDiscoveryServer_create(discovery, >> discovery->context, &discovery->server); >> + status = etcdWatcher_create(discovery, discovery->context, >> &discovery->watcher); >> if (status != CELIX_SUCCESS) { >> return CELIX_BUNDLE_EXCEPTION; >> } >> @@ -140,12 +140,12 @@ celix_status_t discovery_start(discovery >> celix_status_t discovery_stop(discovery_pt discovery) { >> celix_status_t status; >> >> - status = endpointDiscoveryServer_destroy(discovery->server); >> + status = etcdWatcher_destroy(discovery->watcher); >> if (status != CELIX_SUCCESS) { >> return CELIX_BUNDLE_EXCEPTION; >> } >> >> - status = etcdWatcher_destroy(discovery->watcher); >> + status = endpointDiscoveryServer_destroy(discovery->server); >> if (status != CELIX_SUCCESS) { >> return CELIX_BUNDLE_EXCEPTION; >> } >> >> Modified: >> celix/trunk/remote_services/discovery_etcd/private/src/etcd_watcher.c >> URL: >> http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_etcd/private/src/etcd_watcher.c?rev=1632480&r1=1632479&r2=1632480&view=diff >> >> ============================================================================== >> --- >> celix/trunk/remote_services/discovery_etcd/private/src/etcd_watcher.c >> (original) >> +++ >> celix/trunk/remote_services/discovery_etcd/private/src/etcd_watcher.c >> Fri Oct 17 07:16:29 2014 >> @@ -38,8 +38,7 @@ >> #include "endpoint_discovery_poller.h" >> >> struct etcd_watcher { >> - endpoint_discovery_poller_pt poller; >> - bundle_context_pt context; >> + discovery_pt discovery; >> >> celix_thread_mutex_t watcherLock; >> celix_thread_t watcherThread; >> @@ -47,6 +46,9 @@ struct etcd_watcher { >> volatile bool running; >> }; >> >> +#define CFG_ETCD_ROOT_PATH "DISCOVERY_ETCD_ROOT_PATH" >> +#define DEFAULT_ETCD_ROOTPATH "discovery" >> + >> #define CFG_ETCD_SERVER_IP "DISCOVERY_ETCD_SERVER_IP" >> #define DEFAULT_ETCD_SERVER_IP "127.0.0.1" >> >> @@ -59,10 +61,16 @@ struct etcd_watcher { >> >> >> // note that the rootNode shouldn't have a leading slash >> -static celix_status_t etcdWatcher_getRootPath(char* rootNode) { >> +static celix_status_t etcdWatcher_getRootPath(bundle_context_pt >> context, >> char* rootNode) { >> celix_status_t status = CELIX_SUCCESS; >> + char* rootPath = NULL; >> >> - strcpy(rootNode, "discovery"); >> + if (((bundleContext_getProperty(context, CFG_ETCD_ROOT_PATH, >> &rootPath)) != CELIX_SUCCESS) || (!rootPath)) { >> + strcpy(rootNode, DEFAULT_ETCD_ROOTPATH); >> + } >> + else { >> + strcpy(rootNode, rootPath); >> + } >> >> return status; >> } >> @@ -73,7 +81,7 @@ static celix_status_t etcdWatcher_getLoc >> char rootPath[MAX_ROOTNODE_LENGTH]; >> char* uuid = NULL; >> >> - if (((etcdWatcher_getRootPath(&rootPath[0]) != CELIX_SUCCESS)) || >> (!rootPath)) { >> + if ((etcdWatcher_getRootPath(context, &rootPath[0]) != >> CELIX_SUCCESS)) { >> status = CELIX_ILLEGAL_STATE; >> } >> else if (((bundleContext_getProperty(context, >> OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid)) != CELIX_SUCCESS) || (!uuid)) { >> @@ -95,7 +103,7 @@ static celix_status_t etcdWatcher_getLoc >> * returns the modifiedIndex of the last modified >> * discovery endpoint (see etcd documentation). >> */ >> -static celix_status_t >> etcdWatcher_addAlreadyExistingWatchpoints(endpoint_discovery_poller_pt >> poller, int* highestModified) { >> +static celix_status_t >> etcdWatcher_addAlreadyExistingWatchpoints(discovery_pt discovery, int* >> highestModified) { >> celix_status_t status = CELIX_SUCCESS; >> char** nodeArr = calloc(MAX_NODES, sizeof(*nodeArr)); >> char rootPath[MAX_ROOTNODE_LENGTH]; >> @@ -108,7 +116,7 @@ static celix_status_t etcdWatcher_addAlr >> } >> >> // we need to go though all nodes and get the highest >> modifiedIndex >> - if (((status = etcdWatcher_getRootPath(&rootPath[0])) == >> CELIX_SUCCESS) && >> + if (((status = etcdWatcher_getRootPath(discovery->context, >> &rootPath[0])) == CELIX_SUCCESS) && >> (etcd_getNodes(rootPath, nodeArr, &size) == true)) { >> for (i = 0; i < size; i++) { >> char* key = nodeArr[i]; >> @@ -118,7 +126,7 @@ static celix_status_t etcdWatcher_addAlr >> >> if (etcd_get(key, &value[0], &action[0], >> &modIndex) == true) { >> // check that this is not equals to >> the >> local endpoint >> - >> endpointDiscoveryPoller_addDiscoveryEndpoint(poller, >> strdup(&value[0])); >> + >> endpointDiscoveryPoller_addDiscoveryEndpoint(discovery->poller, >> strdup(&value[0])); >> >> if (modIndex > *highestModified) { >> *highestModified = modIndex; >> @@ -193,8 +201,11 @@ static void* etcdWatcher_run(void* data) >> static char rootPath[MAX_ROOTNODE_LENGTH]; >> int highestModified = 0; >> >> - etcdWatcher_addAlreadyExistingWatchpoints(watcher->poller, >> &highestModified); >> - etcdWatcher_getRootPath(&rootPath[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 value[MAX_VALUE_LENGTH]; >> @@ -204,16 +215,16 @@ static void* etcdWatcher_run(void* data) >> if (etcd_watch(rootPath, highestModified + 1, >> &action[0], >> &preValue[0], &value[0]) == true) { >> >> if (strcmp(action, "set") == 0) { >> - >> endpointDiscoveryPoller_removeDiscoveryEndpoint(watcher->poller, >> &preValue[0]); >> - >> endpointDiscoveryPoller_addDiscoveryEndpoint(watcher->poller, >> &value[0]); >> + >> endpointDiscoveryPoller_removeDiscoveryEndpoint(poller, >> &preValue[0]); >> + >> endpointDiscoveryPoller_addDiscoveryEndpoint(poller, &value[0]); >> } else if (strcmp(action, "delete") == 0) { >> - >> endpointDiscoveryPoller_removeDiscoveryEndpoint(watcher->poller, >> &preValue[0]); >> + >> endpointDiscoveryPoller_removeDiscoveryEndpoint(poller, >> &preValue[0]); >> } else { >> fw_log(logger, >> OSGI_FRAMEWORK_LOG_INFO, >> "Unexpected action: %s", action); >> } >> } >> // update own framework uuid in any case; >> - etcdWatcher_addOwnFramework(watcher->context); >> + etcdWatcher_addOwnFramework(context); >> } >> >> return NULL; >> @@ -223,7 +234,7 @@ static void* etcdWatcher_run(void* data) >> * the ectdWatcher needs to have access to the >> endpoint_discovery_poller >> and therefore is only >> * allowed to be created after the endpoint_discovery_poller >> */ >> -celix_status_t etcdWatcher_create(endpoint_discovery_poller_pt >> poller, >> bundle_context_pt context, >> +celix_status_t etcdWatcher_create(discovery_pt discovery, >> bundle_context_pt context, >> etcd_watcher_pt *watcher) >> { >> celix_status_t status = CELIX_SUCCESS; >> @@ -232,7 +243,7 @@ celix_status_t etcdWatcher_create(endpoi >> char* etcd_port_string = NULL; >> int etcd_port = 0; >> >> - if (poller == NULL) { >> + if (discovery == NULL) { >> return CELIX_BUNDLE_EXCEPTION; >> } >> >> @@ -242,8 +253,7 @@ celix_status_t etcdWatcher_create(endpoi >> } >> else >> { >> - (*watcher)->poller = poller; >> - (*watcher)->context = context; >> + (*watcher)->discovery = discovery; >> } >> >> if ((bundleContext_getProperty(context, CFG_ETCD_SERVER_IP, >> &etcd_server) != CELIX_SUCCESS) || !etcd_server) { >> @@ -263,8 +273,6 @@ celix_status_t etcdWatcher_create(endpoi >> } >> } >> >> - >> - >> if (etcd_init(etcd_server, etcd_port) == false) >> { >> return CELIX_BUNDLE_EXCEPTION; >> @@ -302,7 +310,8 @@ celix_status_t etcdWatcher_destroy(etcd_ >> celixThread_join(watcher->watcherThread, NULL); >> >> // register own framework >> - if ((status = etcdWatcher_getLocalNodePath(watcher->context, >> &localNodePath[0])) != CELIX_SUCCESS) { >> + if ((status = etcdWatcher_getLocalNodePath( >> + watcher->discovery->context, >> &localNodePath[0])) >> != CELIX_SUCCESS) { >> return status; >> } >> >> >> >>