remove reference counts
authorNathan S. Evans <evans@in.tum.de>
Thu, 22 Apr 2010 14:58:36 +0000 (14:58 +0000)
committerNathan S. Evans <evans@in.tum.de>
Thu, 22 Apr 2010 14:58:36 +0000 (14:58 +0000)
src/arm/arm_api.c
src/arm/gnunet-service-arm.c

index 6e707cd1bacb486816fe039107b373a5bb535ee2..69e6ea99eb8711c78ac33e7c325b23fea9993eb2 100644 (file)
@@ -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
index 2cc131c1c5a3a7c6c2193feab09883d3bf00af0d..9de610a01687721dfadbd672b564131b921355e7 100644 (file)
@@ -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 */