From: Christian Grothoff Date: Wed, 28 Sep 2011 08:57:33 +0000 (+0000) Subject: stuff X-Git-Tag: initial-import-from-subversion-38251~16899 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=676a03149617636a25d5d9185b24e17b8980bbb1;p=oweals%2Fgnunet.git stuff --- diff --git a/src/dht/gnunet-service-dht_hello.c b/src/dht/gnunet-service-dht_hello.c index db10bb68c..5be0cbfec 100644 --- a/src/dht/gnunet-service-dht_hello.c +++ b/src/dht/gnunet-service-dht_hello.c @@ -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 */ diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 0622533f5..5e632ef68 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c @@ -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) diff --git a/src/dht/test_dht_multipeer.c b/src/dht/test_dht_multipeer.c index 8133c7576..9b6159312 100644 --- a/src/dht/test_dht_multipeer.c +++ b/src/dht/test_dht_multipeer.c @@ -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)