gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated (5f627ce1a -> 645b26ba8)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (5f627ce1a -> 645b26ba8)
Date: Sat, 05 May 2018 23:52:54 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a change to branch master
in repository gnunet.

    from 5f627ce1a man: gnunet.conf.5: Document GNUNET_TMP
     new b8344df89 fix profiler build, signature of callback changed
     new 04a5c5051 fix simplify profiler logic, n_puts_failed no longer used
     new 645b26ba8 update namestore monitor API users to use new _next call 
where needed

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/dht/gnunet_dht_profiler.c                      | 26 +++------
 src/namestore/gnunet-namestore.c                   | 62 ++++++++++++++++++----
 src/namestore/test_namestore_api_monitoring.c      |  5 +-
 .../test_namestore_api_monitoring_existing.c       | 55 +++++++++++++------
 src/zonemaster/gnunet-service-zonemaster.c         | 16 ++++++
 5 files changed, 117 insertions(+), 47 deletions(-)

diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c
index a8807bea8..4a703399e 100644
--- a/src/dht/gnunet_dht_profiler.c
+++ b/src/dht/gnunet_dht_profiler.c
@@ -191,11 +191,6 @@ static unsigned int n_puts;
 static unsigned int n_puts_ok;
 
 /**
- * Number of DHT PUTs failed
- */
-static unsigned int n_puts_fail;
-
-/**
  * Number of DHT GETs made
  */
 static unsigned int n_gets;
@@ -464,7 +459,6 @@ summarize ()
 {
   INFO ("# PUTS made: %u\n", n_puts);
   INFO ("# PUTS succeeded: %u\n", n_puts_ok);
-  INFO ("# PUTS failed: %u\n", n_puts_fail);
   INFO ("# GETS made: %u\n", n_gets);
   INFO ("# GETS succeeded: %u\n", n_gets_ok);
   INFO ("# GETS failed: %u\n", n_gets_fail);
@@ -640,25 +634,18 @@ teardown_dht_connection (void *cls)
  * Queue up a delayed task for doing DHT GET
  *
  * @param cls the active context
- * @param success #GNUNET_OK if the PUT was transmitted,
- *                #GNUNET_NO on timeout,
- *                #GNUNET_SYSERR on disconnect from service
- *                after the PUT message was transmitted
- *                (so we don't know if it was received or not)
  */
 static void
-put_cont (void *cls, int success)
+put_cont (void *cls)
 {
   struct ActiveContext *ac = cls;
   struct Context *ctx = ac->ctx;
 
   ac->dht_put = NULL;
-  if (success)
-    n_puts_ok++;
-  else
-    n_puts_fail++;
+  n_puts_ok++;
   GNUNET_assert (NULL != ctx);
-  (void) GNUNET_SCHEDULER_add_now (&teardown_dht_connection, ctx);
+  (void) GNUNET_SCHEDULER_add_now (&teardown_dht_connection,
+                                   ctx);
 }
 
 
@@ -691,7 +678,8 @@ delayed_put (void *cls)
                                 ac->put_data_size,
                                 ac->put_data,
                                 GNUNET_TIME_UNIT_FOREVER_ABS, /* expiration 
time */
-                                &put_cont, ac);                /* continuation 
and its closure */
+                                &put_cont,
+                                ac);                /* continuation and its 
closure */
   n_puts++;
 }
 
@@ -791,7 +779,7 @@ dht_disconnect (void *cls, void *op_result)
   switch (mode)
   {
   case MODE_PUT:
-    if ((n_puts_ok + n_puts_fail) != n_active)
+    if (n_puts_ok != n_active)
       return;
     /* Start GETs if all PUTs have been made */
     mode = MODE_GET;
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index d329dcb3b..32b1a39d0 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -374,16 +374,12 @@ zone_iteration_error_cb (void *cls)
 /**
  * Process a record that was stored in the namestore.
  *
- * @param cls closure
- * @param zone_key private key of the zone
  * @param rname name that is being mapped (at most 255 characters long)
  * @param rd_len number of entries in @a rd array
  * @param rd array of records with data to store
  */
 static void
-display_record (void *cls,
-               const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
-               const char *rname,
+display_record (const char *rname,
                unsigned int rd_len,
                const struct GNUNET_GNSRECORD_Data *rd)
 {
@@ -393,8 +389,6 @@ display_record (void *cls,
   struct GNUNET_TIME_Absolute at;
   struct GNUNET_TIME_Relative rt;
 
-  (void) cls;
-  (void) zone_key;
   if ( (NULL != name) &&
        (0 != strcmp (name, rname)) )
   {
@@ -442,12 +436,62 @@ display_record (void *cls,
     GNUNET_free (s);
   }
   FPRINTF (stdout, "%s", "\n");
+}
+
+
+/**
+ * Process a record that was stored in the namestore.
+ *
+ * @param cls closure
+ * @param zone_key private key of the zone
+ * @param rname name that is being mapped (at most 255 characters long)
+ * @param rd_len number of entries in @a rd array
+ * @param rd array of records with data to store
+ */
+static void
+display_record_iterator (void *cls,
+                         const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
+                         const char *rname,
+                         unsigned int rd_len,
+                         const struct GNUNET_GNSRECORD_Data *rd)
+{
+  (void) cls;
+  (void) zone_key;
+  display_record (rname,
+                  rd_len,
+                  rd);
   GNUNET_NAMESTORE_zone_iterator_next (list_it,
                                        1);
 }
 
 
 /**
+ * Process a record that was stored in the namestore.
+ *
+ * @param cls closure
+ * @param zone_key private key of the zone
+ * @param rname name that is being mapped (at most 255 characters long)
+ * @param rd_len number of entries in @a rd array
+ * @param rd array of records with data to store
+ */
+static void
+display_record_monitor (void *cls,
+                        const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
+                        const char *rname,
+                        unsigned int rd_len,
+                        const struct GNUNET_GNSRECORD_Data *rd)
+{
+  (void) cls;
+  (void) zone_key;
+  display_record (rname,
+                  rd_len,
+                  rd);
+  GNUNET_NAMESTORE_zone_monitor_next (zm,
+                                      1);
+}
+
+
+/**
  * Function called once we are in sync in monitor mode.
  *
  * @param cls NULL
@@ -956,7 +1000,7 @@ identity_cb (void *cls,
                                                      &zone_pkey,
                                                      &zone_iteration_error_cb,
                                                      NULL,
-                                                     &display_record,
+                                                     &display_record_iterator,
                                                      NULL,
                                                      &zone_iteration_finished,
                                                      NULL);
@@ -1054,7 +1098,7 @@ identity_cb (void *cls,
                                               GNUNET_YES,
                                               &monitor_error_cb,
                                               NULL,
-                                             &display_record,
+                                             &display_record_monitor,
                                               NULL,
                                              &sync_cb,
                                              NULL);
diff --git a/src/namestore/test_namestore_api_monitoring.c 
b/src/namestore/test_namestore_api_monitoring.c
index f6d4fe226..cd38b2c80 100644
--- a/src/namestore/test_namestore_api_monitoring.c
+++ b/src/namestore/test_namestore_api_monitoring.c
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2013 GNUnet e.V.
+     Copyright (C) 2013, 2018 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -192,7 +192,8 @@ zone_proc (void *cls,
     GNUNET_break (0);
     fail = GNUNET_YES;
   }
-
+  GNUNET_NAMESTORE_zone_monitor_next (zm,
+                                      1);
   if (2 == ++returned_records)
   {
     if (endbadly_task != NULL)
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c 
b/src/namestore/test_namestore_api_monitoring_existing.c
index 17f726eb1..f6a74609e 100644
--- a/src/namestore/test_namestore_api_monitoring_existing.c
+++ b/src/namestore/test_namestore_api_monitoring_existing.c
@@ -159,19 +159,24 @@ zone_proc (void *cls,
              "Comparing results name %s\n",
              name);
 
-  if (0 != memcmp (zone_key, privkey, sizeof (struct 
GNUNET_CRYPTO_EcdsaPrivateKey)))
+  if (0 != memcmp (zone_key,
+                   privkey,
+                   sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Monitoring returned wrong zone key\n");
     GNUNET_break (0);
     GNUNET_SCHEDULER_cancel (endbadly_task);
-    endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
+    endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly,
+                                              NULL);
     return;
   }
 
   if (0 == strcmp (name, s_name_1))
   {
-    if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp(rd, s_rd_1))
+    if (GNUNET_YES !=
+        GNUNET_GNSRECORD_records_cmp (rd,
+                                      s_rd_1))
     {
       GNUNET_break (0);
        fail = GNUNET_YES;
@@ -179,7 +184,9 @@ zone_proc (void *cls,
   }
   else if (0 == strcmp (name, s_name_2))
   {
-    if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp(rd, s_rd_2))
+    if (GNUNET_YES !=
+        GNUNET_GNSRECORD_records_cmp (rd,
+                                      s_rd_2))
     {
       GNUNET_break (0);
        fail = GNUNET_YES;
@@ -192,7 +199,8 @@ zone_proc (void *cls,
        GNUNET_break (0);
     fail = GNUNET_YES;
   }
-
+  GNUNET_NAMESTORE_zone_monitor_next (zm,
+                                      1);
   if (2 == ++returned_records)
   {
     if (endbadly_task != NULL)
@@ -201,9 +209,11 @@ zone_proc (void *cls,
       endbadly_task = NULL;
     }
     if (GNUNET_YES == fail)
-      GNUNET_SCHEDULER_add_now (&endbadly, NULL);
+      GNUNET_SCHEDULER_add_now (&endbadly,
+                                NULL);
     else
-       GNUNET_SCHEDULER_add_now (&end, NULL);
+      GNUNET_SCHEDULER_add_now (&end,
+                                NULL);
   }
 }
 
@@ -223,7 +233,9 @@ sync_cb (void *cls)
 
 
 static void
-put_cont (void *cls, int32_t success, const char *emsg)
+put_cont (void *cls,
+          int32_t success,
+          const char *emsg)
 {
   static int c = 0;
   char *label = cls;
@@ -238,11 +250,15 @@ put_cont (void *cls, int32_t success, const char *emsg)
   if (success == GNUNET_OK)
   {
     c++;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record %u: `%s'\n", c, 
label);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Created record %u: `%s'\n",
+                c,
+                label);
   }
   else
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to created records\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Failed to created records\n");
     GNUNET_break (0);
     GNUNET_SCHEDULER_cancel (endbadly_task);
     endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
@@ -262,9 +278,11 @@ put_cont (void *cls, int32_t success, const char *emsg)
                                               NULL);
     if (NULL == zm)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create zone monitor\n");
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Failed to create zone monitor\n");
       GNUNET_break (0);
-      endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
+      endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly,
+                                                NULL);
       return;
     }
   }
@@ -354,14 +372,17 @@ run (void *cls,
   GNUNET_assert (NULL != (ns_ops[0] = GNUNET_NAMESTORE_records_store(nsh, 
privkey, s_name_1,
                1, s_rd_1, &put_cont, s_name_1)));
 
-
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 2 \n");
   GNUNET_asprintf(&s_name_2, "dummy2");
   s_rd_2 = create_record(1);
-  GNUNET_assert (NULL != (ns_ops[1] = GNUNET_NAMESTORE_records_store(nsh, 
privkey, s_name_2,
-               1, s_rd_2, &put_cont, s_name_2)));
-
-
+  GNUNET_assert (NULL != (ns_ops[1] =
+                          GNUNET_NAMESTORE_records_store (nsh,
+                                                          privkey,
+                                                          s_name_2,
+                                                          1,
+                                                          s_rd_2,
+                                                          &put_cont,
+                                                          s_name_2)));
 }
 
 
diff --git a/src/zonemaster/gnunet-service-zonemaster.c 
b/src/zonemaster/gnunet-service-zonemaster.c
index 7129cf44f..cbb890589 100644
--- a/src/zonemaster/gnunet-service-zonemaster.c
+++ b/src/zonemaster/gnunet-service-zonemaster.c
@@ -60,6 +60,12 @@
 #define DHT_QUEUE_LIMIT 2000
 
 /**
+ * How many events may the namestore give us before it has to wait
+ * for us to keep up?
+ */
+#define NAMESTORE_QUEUE_LIMIT 50
+
+/**
  * The initial interval in milliseconds btween puts in
  * a zone iteration
  */
@@ -374,6 +380,8 @@ dht_put_monitor_continuation (void *cls)
 {
   struct DhtPutActivity *ma = cls;
 
+  GNUNET_NAMESTORE_zone_monitor_next (zmon,
+                                      1);
   ma_queue_length--;
   GNUNET_CONTAINER_DLL_remove (ma_head,
                                ma_tail,
@@ -924,7 +932,11 @@ handle_monitor_event (void *cls,
                                                 rd_count,
                                                 rd_public);
   if (0 == rd_public_count)
+  {
+    GNUNET_NAMESTORE_zone_monitor_next (zmon,
+                                        1);
     return; /* nothing to do */
+  }
   num_public_records++;
   ma = GNUNET_new (struct DhtPutActivity);
   ma->start_date = GNUNET_TIME_absolute_get ();
@@ -938,6 +950,8 @@ handle_monitor_event (void *cls,
   {
     /* PUT failed, do not remember operation */
     GNUNET_free (ma);
+    GNUNET_NAMESTORE_zone_monitor_next (zmon,
+                                        1);
     return;
   }
   GNUNET_CONTAINER_DLL_insert_tail (ma_head,
@@ -1097,6 +1111,8 @@ run (void *cls,
                                               NULL,
                                               &monitor_sync_event,
                                               NULL);
+  GNUNET_NAMESTORE_zone_monitor_next (zmon,
+                                      NAMESTORE_QUEUE_LIMIT - 1);
   GNUNET_break (NULL != zmon);
   GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
                                 NULL);

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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