last XDG change: use GNUNET_RUNTIME_DIR instead of /tmp for UNIXPATHs by default
[oweals/gnunet.git] / src / regex / gnunet-daemon-regexprofiler.c
index 86f7d451b45f17889536ba2973c0653131e09c63..bcb99aaf5ea61742f6d5d442bd81ff87587483e9 100644 (file)
@@ -93,7 +93,7 @@ static char *rx_with_pfx;
 /**
  * How many put rounds should we do.
  */
-static unsigned int rounds = 5;
+static unsigned int rounds = 3;
 
 /**
  * Private key for this peer.
@@ -124,7 +124,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     GNUNET_DHT_disconnect (dht_handle);
     dht_handle = NULL;
   }
-  GNUNET_CRYPTO_ecc_key_free (my_private_key);
+  GNUNET_free (my_private_key);
   my_private_key = NULL;
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -135,7 +135,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
 /**
  * Announce a previously announced regex re-using cached data.
- * 
+ *
  * @param cls Closure (regex to announce if needed).
  * @param tc TaskContext.
  */
@@ -277,10 +277,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
       GNUNET_CONFIGURATION_get_value_string (cfg, "REGEXPROFILER",
                                              "POLICY_DIR", &policy_dir))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _
-                ("%s service is lacking key configuration settings (%s).  Exiting.\n"),
-                "regexprofiler", "policy_dir");
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "REGEXPROFILER", "POLICY_DIR");
     global_ret = GNUNET_SYSERR;
     GNUNET_SCHEDULER_shutdown ();
     return;
@@ -289,11 +286,9 @@ run (void *cls, char *const *args GNUNET_UNUSED,
       GNUNET_CONFIGURATION_get_value_number (cfg, "TESTBED",
                                              "PEERID", &peer_id))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _
-                ("%s service is lacking key configuration settings (%s).  Exiting.\n"),
-                "regexprofiler", "policy_file");
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "TESTBED", "PEERID");
     global_ret = GNUNET_SYSERR;
+    GNUNET_free (policy_dir);
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
@@ -302,11 +297,9 @@ run (void *cls, char *const *args GNUNET_UNUSED,
       GNUNET_CONFIGURATION_get_value_string (cfg, "REGEXPROFILER",
                                              "REGEX_PREFIX", &regex_prefix))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _
-                ("%s service is lacking key configuration settings (%s).  Exiting.\n"),
-                "regexprofiler", "regex_prefix");
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "REGEXPROFILER", "REGEX_PREFIX");
     global_ret = GNUNET_SYSERR;
+    GNUNET_free (policy_dir);
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
@@ -316,7 +309,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
                                            "REANNOUNCE_PERIOD_MAX",
                                            &reannounce_period_max))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "reannounce_period_max not given. Using 10 minutes.\n");
     reannounce_period_max =
       GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10);
@@ -331,6 +324,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Could not acquire dht handle. Exiting.\n");
     global_ret = GNUNET_SYSERR;
+    GNUNET_free (policy_dir);
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
@@ -344,14 +338,16 @@ run (void *cls, char *const *args GNUNET_UNUSED,
                 "Policy file %s contains no policies. Exiting.\n",
                 policy_filename);
     global_ret = GNUNET_SYSERR;
+    GNUNET_free (policy_dir);
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
+  GNUNET_free (policy_dir);
   regex = REGEX_TEST_combine (components);
   REGEX_TEST_free_from_file (components);
 
   /* Announcing regexes from policy_filename */
-  GNUNET_asprintf (&rx_with_pfx, "%s(%s)(0|1)*", regex_prefix, regex);
+  GNUNET_asprintf (&rx_with_pfx, "%s(%s)(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f)*", regex_prefix, regex);
   announce_regex (rx_with_pfx);
   GNUNET_free (regex);
   GNUNET_free (rx_with_pfx);