LRN: Here's a patch. See if it doesn't break anything for you.
authorChristian Grothoff <christian@grothoff.org>
Sat, 26 Jan 2013 09:50:37 +0000 (09:50 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 26 Jan 2013 09:50:37 +0000 (09:50 +0000)
Arm service is started with -c <configname> only when the process that
runs arm service has "[arm]/CONFIG" defined in the configuration used
to run arm service (usually - process' own configuration).

Since default [arm] config has no CONFIG defined anymore (thanks to
your r25908), we need to add this code to put the config file that was
passed to gnunet-arm tool via -c as "[arm]/CONFIG" for arm service to
receive it.

Otherwise arm service is run without config and reads default config
(~/.gnunet/gnunet.conf) instead, which is clearly not what we need.

src/arm/gnunet-arm.c
src/arm/test_arm_api.c
src/arm/test_exponential_backoff.c
src/arm/test_gnunet_service_arm.c

index ca4193837e2fa7cae82667d3bb7fd7a70c62b76a..1b17e2dfeac23b75088b7111fab3d8141c659697 100644 (file)
@@ -291,6 +291,7 @@ static void
 run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
+  char *armconfig;
   cfg = c;
   config_file = cfgfile;
   if (GNUNET_CONFIGURATION_get_value_string
@@ -300,6 +301,18 @@ run (void *cls, char *const *args, const char *cfgfile,
                               "PATHS", "SERVICEHOME");
     return;
     }
+  if (NULL != cfgfile)
+  {
+    if (GNUNET_OK !=
+        GNUNET_CONFIGURATION_get_value_filename (cfg, "arm", "CONFIG",
+                                              &armconfig))
+    {
+      GNUNET_CONFIGURATION_set_value_string (cfg, "arm", "CONFIG",
+                                             cfgfile);
+    }
+    else
+      GNUNET_free (armconfig);
+  }
   if (NULL == (h = GNUNET_ARM_connect (cfg, NULL)))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
index e9bda410b0c33faa4bccddad8541f90c58f2f690..608c75cd34fc4d44ba12b7c78ada2c662352861b 100644 (file)
@@ -118,7 +118,20 @@ static void
 task (void *cls, char *const *args, const char *cfgfile,
       const struct GNUNET_CONFIGURATION_Handle *c)
 {
+  char *armconfig;
   cfg = c;
+  if (NULL != cfgfile)
+  {
+    if (GNUNET_OK !=
+        GNUNET_CONFIGURATION_get_value_filename (cfg, "arm", "CONFIG",
+                                              &armconfig))
+    {
+      GNUNET_CONFIGURATION_set_value_string (cfg, "arm", "CONFIG",
+                                             cfgfile);
+    }
+    else
+      GNUNET_free (armconfig);
+  }
   arm = GNUNET_ARM_connect (cfg, NULL);
 #if START_ARM
   GNUNET_ARM_start_service (arm, "arm", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, START_TIMEOUT, &arm_notify, NULL);
index 34ebad1644a5da739456c0fdd27ead26adf3c09b..19ca5852112cacf81aa2389ef55e6d192e3f93ab 100644 (file)
@@ -355,7 +355,20 @@ static void
 task (void *cls, char *const *args, const char *cfgfile,
       const struct GNUNET_CONFIGURATION_Handle *c)
 {
+  char *armconfig;
   cfg = c;
+  if (NULL != cfgfile)
+  {
+    if (GNUNET_OK !=
+        GNUNET_CONFIGURATION_get_value_filename (cfg, "arm", "CONFIG",
+                                              &armconfig))
+    {
+      GNUNET_CONFIGURATION_set_value_string (cfg, "arm", "CONFIG",
+                                             cfgfile);
+    }
+    else
+      GNUNET_free (armconfig);
+  }
 
   arm = GNUNET_ARM_connect (cfg, NULL);
 #if START_ARM
index 98d8c6354fd3c077b99b6f20f682c0983cb33fc2..d367bc6fef46e5170120555b97b518abe9d8bd24 100644 (file)
@@ -107,6 +107,20 @@ static void
 run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
+  char *armconfig;
+
+  if (NULL != cfgfile)
+  {
+    if (GNUNET_OK !=
+        GNUNET_CONFIGURATION_get_value_filename (c, "arm", "CONFIG",
+                                              &armconfig))
+    {
+      GNUNET_CONFIGURATION_set_value_string (c, "arm", "CONFIG",
+                                             cfgfile);
+    }
+    else
+      GNUNET_free (armconfig);
+  }
   arm = GNUNET_ARM_connect (c, NULL);
   GNUNET_ARM_start_service (arm, "arm",
                            GNUNET_OS_INHERIT_STD_OUT_AND_ERR, START_TIMEOUT,