gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r26087 - gnunet/src/regex


From: gnunet
Subject: [GNUnet-SVN] r26087 - gnunet/src/regex
Date: Wed, 13 Feb 2013 11:37:34 +0100

Author: bartpolot
Date: 2013-02-13 11:37:34 +0100 (Wed, 13 Feb 2013)
New Revision: 26087

Modified:
   gnunet/src/regex/gnunet-daemon-regexprofiler.c
Log:
- remove regex daemon dependency to peers' public keys: allow to use HEAD regex 
with 0.9.5a core and others, allowing also committing regex changes to svn HEAD

Modified: gnunet/src/regex/gnunet-daemon-regexprofiler.c
===================================================================
--- gnunet/src/regex/gnunet-daemon-regexprofiler.c      2013-02-13 10:32:08 UTC 
(rev 26086)
+++ gnunet/src/regex/gnunet-daemon-regexprofiler.c      2013-02-13 10:37:34 UTC 
(rev 26087)
@@ -59,11 +59,6 @@
 static struct GNUNET_REGEX_announce_handle *announce_handle;
 
 /**
- * Hostkey generation context
- */
-static struct GNUNET_CRYPTO_EccKeyGenerationContext *keygen;
-
-/**
  * Periodically reannounce regex.
  */
 static GNUNET_SCHEDULER_TaskIdentifier reannounce_task;
@@ -79,11 +74,6 @@
 static struct GNUNET_TIME_Relative announce_delay;
 
 /**
- * Local peer's PeerID.
- */
-static struct GNUNET_PeerIdentity my_full_id;
-
-/**
  * Maximal path compression length for regex announcing.
  */
 static unsigned long long max_path_compression;
@@ -116,11 +106,6 @@
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutting down\n");
 
-  if (NULL != keygen)
-  {
-    GNUNET_CRYPTO_ecc_key_create_stop (keygen);
-    keygen = NULL;
-  }
   if (NULL != announce_handle)
   {
     GNUNET_REGEX_announce_cancel (announce_handle);
@@ -146,7 +131,9 @@
 static void
 reannounce_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
+  struct GNUNET_PeerIdentity id;
   char *regex = cls;
+
   reannounce_task = GNUNET_SCHEDULER_NO_TASK;
   if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
   {
@@ -161,8 +148,9 @@
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "First time, creating regex: %s\n",
                 regex);
+    memset (&id, 0, sizeof (struct GNUNET_PeerIdentity));
     announce_handle = GNUNET_REGEX_announce (dht_handle,
-                                            &my_full_id,
+                                            &id,
                                             regex,
                                             (unsigned int) 
max_path_compression,
                                             stats_handle);
@@ -273,42 +261,6 @@
 
 
 /**
- * Callback for hostkey read/generation
- *
- * @param cls Closure (not used).
- * @param pk The private key of the local peer.
- * @param emsg Error message if applicable.
- */
-static void
-key_generation_cb (void *cls,
-                   struct GNUNET_CRYPTO_EccPrivateKey *pk,
-                   const char *emsg)
-{
-  struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded my_public_key;
-
-  keygen = NULL;
-  if (NULL == pk)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _("Regexprofiler could not access hostkey: %s. Exiting.\n"),
-                emsg);
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-
-  GNUNET_CRYPTO_ecc_key_get_public (pk, &my_public_key);
-  GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key),
-                      &my_full_id.hashPubKey);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Regexprofiler for peer [%s] starting\n",
-              GNUNET_i2s(&my_full_id));
-  announce_regex (rx_with_pfx);
-  GNUNET_free (rx_with_pfx);
-}
-
-
-/**
  * @brief Main function that will be run by the scheduler.
  *
  * @param cls closure
@@ -322,23 +274,10 @@
      const struct GNUNET_CONFIGURATION_Handle *cfg_)
 {
   char *regex = NULL;
-  char *keyfile;
 
   cfg = cfg_;
 
   if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_filename (cfg, "PEER", "PRIVATE_KEY",
-                                               &keyfile))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _
-                ("%s service is lacking key configuration settings (%s).  
Exiting.\n"),
-                "regexdaemon", "peer/privatekey");
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-
-  if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_number (cfg, "REGEXPROFILER", 
"MAX_PATH_COMPRESSION",
                                              &max_path_compression))
   {
@@ -417,13 +356,10 @@
 
   /* Announcing regexes from policy_filename */
   GNUNET_asprintf (&rx_with_pfx, "%s(%s)", regex_prefix, regex);
+  announce_regex (rx_with_pfx);
   GNUNET_free (regex);
+  GNUNET_free (rx_with_pfx);
 
-  keygen = GNUNET_CRYPTO_ecc_key_create_start (keyfile,
-                                               &key_generation_cb,
-                                               NULL);
-  GNUNET_free (keyfile);
-
   /* Scheduled the task to clean up when shutdown is called */
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
                                 NULL);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]