stuff
authorChristian Grothoff <christian@grothoff.org>
Wed, 28 Sep 2011 08:57:33 +0000 (08:57 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 28 Sep 2011 08:57:33 +0000 (08:57 +0000)
src/dht/gnunet-service-dht_hello.c
src/dht/gnunet-service-dht_neighbours.c
src/dht/test_dht_multipeer.c

index db10bb68c791f4201f8dd4c12a419fb27c89ceb3..5be0cbfec1c3b74dab482605519d521e3abba10d 100644 (file)
@@ -52,6 +52,8 @@ static struct GNUNET_CONTAINER_MultiHashMap *peer_to_hello;
 const struct GNUNET_HELLO_Message *
 GDS_HELLO_get (const struct GNUNET_PeerIdentity *peer)
 {
+  if (NULL == peer_to_hello)
+    return NULL;
   return GNUNET_CONTAINER_multihashmap_get (peer_to_hello,
                                            &peer->hashPubKey);
 }
@@ -133,10 +135,13 @@ GDS_HELLO_done ()
     GNUNET_PEERINFO_notify_cancel (pnc);
     pnc = NULL;
   }
-  GNUNET_CONTAINER_multihashmap_iterate (peer_to_hello,
-                                        &free_hello,
-                                        NULL);
-  GNUNET_CONTAINER_multihashmap_destroy (peer_to_hello);
+  if (NULL != peer_to_hello)
+  {
+    GNUNET_CONTAINER_multihashmap_iterate (peer_to_hello,
+                                          &free_hello,
+                                          NULL);
+    GNUNET_CONTAINER_multihashmap_destroy (peer_to_hello);
+  }
 }
 
 /* end of gnunet-service-dht_hello.c */
index 0622533f5d69916db1ad02b2f9b4c05fb00dad3c..5e632ef68801b4218a2165c4743eee2d9adfc55f 100644 (file)
@@ -1583,8 +1583,9 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender,
   if (NULL != GDS_my_hello)
   {
     GNUNET_BLOCK_mingle_hash (&my_identity.hashPubKey, bf_mutator, &mhash);
-    if (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (bf, &mhash))
-      
+    if ( (NULL == bf) ||
+        (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (bf, &mhash)) )
+    {
       GDS_NEIGHBOURS_handle_reply (sender,
                                   GNUNET_BLOCK_TYPE_DHT_HELLO,
                                   GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION),
@@ -1593,6 +1594,19 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender,
                                   0, NULL,
                                   GDS_my_hello,
                                   GNUNET_HELLO_size ((const struct GNUNET_HELLO_Message*) GDS_my_hello));
+    }
+    else
+    {
+      GNUNET_STATISTICS_update (GDS_stats,
+                               gettext_noop ("# FIND PEER requests ignored due to Bloomfilter"), 1,
+                               GNUNET_NO);
+    }
+  }
+  else
+  {
+    GNUNET_STATISTICS_update (GDS_stats,
+                             gettext_noop ("# FIND PEER requests ignored due to lack of HELLO"), 1,
+                             GNUNET_NO);
   }
 
   /* then, also consider sending a random HELLO from the closest bucket */
@@ -1743,6 +1757,12 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer,
                                       get->bf_mutator);
     }
   }
+  else
+  {
+    GNUNET_STATISTICS_update (GDS_stats,
+                             gettext_noop ("# P2P GET requests ONLY routed"), 1,
+                             GNUNET_NO);
+  }
   
   /* P2P forwarding */
   if (eval != GNUNET_BLOCK_EVALUATION_OK_LAST)
index 8133c7576672edb8efb2091f8c91b01829fe5bb9..9b6159312504271d44736626696ef99d16306ee7 100644 (file)
@@ -28,7 +28,7 @@
 #include "gnunet_dht_service.h"
 
 /* DEFINES */
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
 /* Timeout for entire testcase */
 #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5)