move ARM/config logic to util/ where it doesn't need to cast away a 'const' and is...
authorChristian Grothoff <christian@grothoff.org>
Fri, 24 Apr 2015 07:04:18 +0000 (07:04 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 24 Apr 2015 07:04:18 +0000 (07:04 +0000)
src/arm/test_arm_api.c
src/arm/test_exponential_backoff.c
src/gns/gnunet-gns-proxy.c
src/util/program.c

index 67bf458714f757b7b2556caa76952aded08bbbae..6bd5132ee871e4b887186a968014a43a9fbb98a4 100644 (file)
@@ -185,22 +185,7 @@ 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 ((struct GNUNET_CONFIGURATION_Handle
-                                              *) cfg, "arm", "CONFIG",
-                                             cfgfile);
-    }
-    else
-      GNUNET_free (armconfig);
-  }
   arm = GNUNET_ARM_connect (cfg, &arm_conn, NULL);
   if (NULL == arm)
     return;
index a14103be0655def18179057748f602a219ac3598..d0277523b4f3c660c4c35e3c3ea6616c46dea5b1 100644 (file)
@@ -356,21 +356,7 @@ 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 ((struct GNUNET_CONFIGURATION_Handle
-                                              *) cfg, "arm", "CONFIG",
-                                             cfgfile);
-    }
-    else
-      GNUNET_free (armconfig);
-  }
-
   arm = GNUNET_ARM_connect (cfg, NULL, NULL);
   if (NULL != arm)
   {
index d52b3b57fad9883ca9d266a7075183d76b85a457..08cfdf4dff9028ac5ea58d9c8ec783da1accf3bf 100644 (file)
@@ -522,7 +522,7 @@ struct Socks5Request
    * HTTP request headers for the curl request.
    */
   struct curl_slist *headers;
-  
+
   /**
    * DNS->IP mappings resolved through GNS
    */
@@ -1032,7 +1032,7 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls)
       GNUNET_free (cors_hdr);
     }
     /* force connection to be closed after each request, as we
-       do not support HTTP pipelining */
+       do not support HTTP pipelining (yet, FIXME!) */
     GNUNET_break (MHD_YES ==
                  MHD_add_response_header (s5r->response,
                                           MHD_HTTP_HEADER_CONNECTION,
index 865d9c690337b163042f7180076bbdeb475bb1cf..08858af3782cea8155882678037d821ed7860f16 100644 (file)
@@ -279,6 +279,22 @@ GNUNET_PROGRAM_run2 (int argc, char *const *argv, const char *binaryName,
     clock_offset = skew_offset - skew_variance;
     GNUNET_TIME_set_offset (clock_offset);
   }
+  /* ARM needs to know which configuration file to use when starting
+     services.  If we got a command-line option *and* if nothing is
+     specified in the configuration, remember the command-line option
+     in "cfg".  This is typically really only having an effect if we
+     are running code in src/arm/, as obviously the rest of the code
+     has little business with ARM-specific options. */
+  if (GNUNET_YES !=
+      GNUNET_CONFIGURATION_have_value (cfg,
+                                       "arm",
+                                       "CONFIG"))
+  {
+    GNUNET_CONFIGURATION_set_value_string (cfg,
+                                           "arm", "CONFIG",
+                                           cc.cfgfile);
+  }
+
   /* run */
   cc.args = &argv[ret];
   if (GNUNET_NO == run_without_scheduler)