From: Nathan S. Evans Date: Thu, 22 Apr 2010 14:58:36 +0000 (+0000) Subject: remove reference counts X-Git-Tag: initial-import-from-subversion-38251~22030 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ac715837a25032b460c00a97d957d1eeafc36c48;p=oweals%2Fgnunet.git remove reference counts --- diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index 6e707cd1b..69e6ea99e 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c @@ -399,10 +399,11 @@ GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h, { struct RequestContext *sctx; size_t slen; - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, +#if DEBUG_ARM + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Asked to start service `%s' within %llu ms\n"), service_name, (unsigned long long) timeout.value); +#endif if (0 == strcasecmp ("arm", service_name)) { slen = strlen ("arm") + 1; @@ -592,6 +593,8 @@ GNUNET_ARM_start_services (const struct GNUNET_CONFIGURATION_Handle *cfg, /** * Stop multiple services in the specified order. Convenience * function. Works asynchronously, failures are not reported. + * Should normally only be called from gnunet-arm or testcases, + * stopping a service is generally otherwise a bad idea. * * @param cfg configuration to use (needed to contact ARM; * the ARM service may internally use a different diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index 2cc131c1c..9de610a01 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c @@ -112,12 +112,14 @@ struct ServiceList */ struct GNUNET_TIME_Absolute restartAt; +#if RC /** * Reference counter (counts how many times we've been * asked to start the service). We only actually stop * it once rc hits zero. */ unsigned int rc; +#endif }; @@ -468,9 +470,11 @@ start_service (struct GNUNET_SERVER_Client *client, const char *servicename) if (sl != NULL) { /* already running, just increment RC */ - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Service `%s' already running.\n"), servicename); +#if RC sl->rc++; +#endif sl->next = running; running = sl; signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_UP); @@ -504,7 +508,9 @@ start_service (struct GNUNET_SERVER_Client *client, const char *servicename) sl = GNUNET_malloc (sizeof (struct ServiceList)); sl->name = GNUNET_strdup (servicename); sl->next = running; +#if RC sl->rc = 1; +#endif sl->binary = binary; sl->config = config; sl->mtime = sbuf.st_mtime; @@ -538,6 +544,7 @@ stop_service (struct GNUNET_SERVER_Client *client, const char *servicename) GNUNET_SERVER_receive_done (client, GNUNET_OK); return; } +#if RC if (pos->rc > 1) { /* RC>1, just decrement RC */ @@ -555,6 +562,7 @@ stop_service (struct GNUNET_SERVER_Client *client, const char *servicename) } if (pos->rc == 1) pos->rc--; /* decrement RC to zero */ +#endif if (pos->killing_client != NULL) { /* killing already in progress */