aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arm/arm_api.c7
-rw-r--r--src/arm/gnunet-service-arm.c10
2 files changed, 14 insertions, 3 deletions
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,
399{ 399{
400 struct RequestContext *sctx; 400 struct RequestContext *sctx;
401 size_t slen; 401 size_t slen;
402 402#if DEBUG_ARM
403 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 403 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
404 _("Asked to start service `%s' within %llu ms\n"), service_name, 404 _("Asked to start service `%s' within %llu ms\n"), service_name,
405 (unsigned long long) timeout.value); 405 (unsigned long long) timeout.value);
406#endif
406 if (0 == strcasecmp ("arm", service_name)) 407 if (0 == strcasecmp ("arm", service_name))
407 { 408 {
408 slen = strlen ("arm") + 1; 409 slen = strlen ("arm") + 1;
@@ -592,6 +593,8 @@ GNUNET_ARM_start_services (const struct GNUNET_CONFIGURATION_Handle *cfg,
592/** 593/**
593 * Stop multiple services in the specified order. Convenience 594 * Stop multiple services in the specified order. Convenience
594 * function. Works asynchronously, failures are not reported. 595 * function. Works asynchronously, failures are not reported.
596 * Should normally only be called from gnunet-arm or testcases,
597 * stopping a service is generally otherwise a bad idea.
595 * 598 *
596 * @param cfg configuration to use (needed to contact ARM; 599 * @param cfg configuration to use (needed to contact ARM;
597 * the ARM service may internally use a different 600 * 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
112 */ 112 */
113 struct GNUNET_TIME_Absolute restartAt; 113 struct GNUNET_TIME_Absolute restartAt;
114 114
115#if RC
115 /** 116 /**
116 * Reference counter (counts how many times we've been 117 * Reference counter (counts how many times we've been
117 * asked to start the service). We only actually stop 118 * asked to start the service). We only actually stop
118 * it once rc hits zero. 119 * it once rc hits zero.
119 */ 120 */
120 unsigned int rc; 121 unsigned int rc;
122#endif
121 123
122}; 124};
123 125
@@ -468,9 +470,11 @@ start_service (struct GNUNET_SERVER_Client *client, const char *servicename)
468 if (sl != NULL) 470 if (sl != NULL)
469 { 471 {
470 /* already running, just increment RC */ 472 /* already running, just increment RC */
471 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 473 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
472 _("Service `%s' already running.\n"), servicename); 474 _("Service `%s' already running.\n"), servicename);
475#if RC
473 sl->rc++; 476 sl->rc++;
477#endif
474 sl->next = running; 478 sl->next = running;
475 running = sl; 479 running = sl;
476 signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_UP); 480 signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_UP);
@@ -504,7 +508,9 @@ start_service (struct GNUNET_SERVER_Client *client, const char *servicename)
504 sl = GNUNET_malloc (sizeof (struct ServiceList)); 508 sl = GNUNET_malloc (sizeof (struct ServiceList));
505 sl->name = GNUNET_strdup (servicename); 509 sl->name = GNUNET_strdup (servicename);
506 sl->next = running; 510 sl->next = running;
511#if RC
507 sl->rc = 1; 512 sl->rc = 1;
513#endif
508 sl->binary = binary; 514 sl->binary = binary;
509 sl->config = config; 515 sl->config = config;
510 sl->mtime = sbuf.st_mtime; 516 sl->mtime = sbuf.st_mtime;
@@ -538,6 +544,7 @@ stop_service (struct GNUNET_SERVER_Client *client, const char *servicename)
538 GNUNET_SERVER_receive_done (client, GNUNET_OK); 544 GNUNET_SERVER_receive_done (client, GNUNET_OK);
539 return; 545 return;
540 } 546 }
547#if RC
541 if (pos->rc > 1) 548 if (pos->rc > 1)
542 { 549 {
543 /* RC>1, just decrement RC */ 550 /* RC>1, just decrement RC */
@@ -555,6 +562,7 @@ stop_service (struct GNUNET_SERVER_Client *client, const char *servicename)
555 } 562 }
556 if (pos->rc == 1) 563 if (pos->rc == 1)
557 pos->rc--; /* decrement RC to zero */ 564 pos->rc--; /* decrement RC to zero */
565#endif
558 if (pos->killing_client != NULL) 566 if (pos->killing_client != NULL)
559 { 567 {
560 /* killing already in progress */ 568 /* killing already in progress */