/**
* How many put rounds should we do.
*/
-static unsigned int rounds = 5;
+static unsigned int rounds = 3;
+
+/**
+ * Private key for this peer.
+ */
+static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key;
+
/**
GNUNET_DHT_disconnect (dht_handle);
dht_handle = NULL;
}
+ GNUNET_free (my_private_key);
+ my_private_key = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Daemon for %s shutting down\n",
/**
* Announce a previously announced regex re-using cached data.
- *
+ *
* @param cls Closure (regex to announce if needed).
* @param tc TaskContext.
*/
static void
reannounce_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct GNUNET_PeerIdentity id;
struct GNUNET_TIME_Relative random_delay;
char *regex = cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"First time, creating regex: %s\n",
regex);
- memset (&id, 0, sizeof (struct GNUNET_PeerIdentity));
announce_handle = REGEX_INTERNAL_announce (dht_handle,
- &id,
- regex,
- (unsigned int) max_path_compression,
- stats_handle);
+ my_private_key,
+ regex,
+ (unsigned int) max_path_compression,
+ stats_handle);
}
else
{
}
random_delay =
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,
GNUNET_CRYPTO_random_u32 (
GNUNET_CRYPTO_QUALITY_WEAK,
- reannounce_period_max.rel_value));
+ reannounce_period_max.rel_value_us));
reannounce_task = GNUNET_SCHEDULER_add_delayed (random_delay,
&reannounce_regex, cls);
}
cfg = cfg_;
+ my_private_key = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg);
+ GNUNET_assert (NULL != my_private_key);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg, "REGEXPROFILER",
"MAX_PATH_COMPRESSION",
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;
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;
}
GNUNET_CONFIGURATION_get_value_string (cfg, "REGEXPROFILER",
"REGEX_PREFIX", ®ex_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;
}
"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);
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;
}
"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);