gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: have sanity checks for DHT


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: have sanity checks for DHT path construction
Date: Thu, 02 Feb 2017 10:19:06 +0100

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

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new b1f8b32c7 have sanity checks for DHT path construction
b1f8b32c7 is described below

commit b1f8b32c7bf518e10f6c87bd0479b5110a7fec26
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Feb 2 10:17:38 2017 +0100

    have sanity checks for DHT path construction
---
 src/dht/gnunet-service-dht_neighbours.c | 33 +++++++++++++++++++++++++++++++++
 src/dht/gnunet-service-dht_routing.c    | 19 ++++++++++++-------
 2 files changed, 45 insertions(+), 7 deletions(-)

diff --git a/src/dht/gnunet-service-dht_neighbours.c 
b/src/dht/gnunet-service-dht_neighbours.c
index 20bdc0ce4..7f3a44588 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -49,6 +49,11 @@
 #define LOG_TRAFFIC(kind,...) GNUNET_log_from (kind, "dht-traffic",__VA_ARGS__)
 
 /**
+ * Enable slow sanity checks to debug issues.
+ */ 
+#define SANITY_CHECKS 1
+
+/**
  * How many buckets will we allow total.
  */
 #define MAX_BUCKETS sizeof (struct GNUNET_HashCode) * 8
@@ -1746,6 +1751,20 @@ handle_dht_p2p_put (void *cls,
     /* extend 'put path' by sender */
     if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE))
     {
+#if SANITY_CHECKS
+      for (unsigned int i=0;i<=putlen;i++)
+      {
+       for (unsigned int j=0;j<i;j++)
+       {
+         GNUNET_break (0 != memcmp (&pp[i],
+                                    &pp[j],
+                                    sizeof (struct GNUNET_PeerIdentity)));
+       }
+       GNUNET_break (0 != memcmp (&pp[i],
+                                  peer->id,
+                                  sizeof (struct GNUNET_PeerIdentity)));       
+      }
+#endif
       GNUNET_memcpy (pp,
                     put_path,
                     putlen * sizeof (struct GNUNET_PeerIdentity));
@@ -2280,6 +2299,20 @@ handle_dht_p2p_result (void *cls,
   {
     struct GNUNET_PeerIdentity xget_path[get_path_length + 1];
 
+#if SANITY_CHECKS
+    for (unsigned int i=0;i<=get_path_length;i++)
+    {
+      for (unsigned int j=0;j<i;j++)
+      {
+       GNUNET_break (0 != memcmp (&get_path[i],
+                                  &get_path[j],
+                                  sizeof (struct GNUNET_PeerIdentity)));
+      }
+      GNUNET_break (0 != memcmp (&get_path[i],
+                                peer->id,
+                                sizeof (struct GNUNET_PeerIdentity))); 
+    }
+#endif
     GNUNET_memcpy (xget_path,
                   get_path,
                   get_path_length * sizeof (struct GNUNET_PeerIdentity));
diff --git a/src/dht/gnunet-service-dht_routing.c 
b/src/dht/gnunet-service-dht_routing.c
index 978c46d73..71240a503 100644
--- a/src/dht/gnunet-service-dht_routing.c
+++ b/src/dht/gnunet-service-dht_routing.c
@@ -128,17 +128,17 @@ struct ProcessContext
   struct GNUNET_TIME_Absolute expiration_time;
 
   /**
-   * Number of entries in 'put_path'.
+   * Number of entries in @e put_path.
    */
   unsigned int put_path_length;
 
   /**
-   * Number of entries in 'get_path'.
+   * Number of entries in @e get_path.
    */
   unsigned int get_path_length;
 
   /**
-   * Number of bytes in 'data'.
+   * Number of bytes in @e data.
    */
   size_t data_size;
 
@@ -223,8 +223,13 @@ process (void *cls,
                               gettext_noop
                               ("# Good REPLIES matched against routing table"),
                               1, GNUNET_NO);
-    GDS_NEIGHBOURS_handle_reply (&rr->peer, pc->type, pc->expiration_time, key,
-                                 ppl, pc->put_path, gpl, pc->get_path, 
pc->data,
+    GDS_NEIGHBOURS_handle_reply (&rr->peer,
+                                pc->type,
+                                pc->expiration_time,
+                                key,
+                                 ppl, pc->put_path,
+                                gpl, pc->get_path,
+                                pc->data,
                                  pc->data_size);
     break;
   case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE:
@@ -275,9 +280,9 @@ process (void *cls,
  * @param type type of the block
  * @param expiration_time when does the content expire
  * @param key key for the content
- * @param put_path_length number of entries in put_path
+ * @param put_path_length number of entries in @a put_path
  * @param put_path peers the original PUT traversed (if tracked)
- * @param get_path_length number of entries in get_path
+ * @param get_path_length number of entries in @a get_path
  * @param get_path peers this reply has traversed so far (if tracked)
  * @param data payload of the reply
  * @param data_size number of bytes in data

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



reply via email to

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