From 5ddb40a745091645318b98d51bdca913e3706385 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 27 Sep 2011 14:40:09 +0000 Subject: [PATCH 1/1] fix --- src/block/plugin_block_test.c | 23 +++++++++++++---------- src/dht/gnunet-service-dht-new.c | 15 +++++++++------ 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/block/plugin_block_test.c b/src/block/plugin_block_test.c index 6fa535afe..76853a1f0 100644 --- a/src/block/plugin_block_test.c +++ b/src/block/plugin_block_test.c @@ -70,18 +70,21 @@ block_plugin_test_evaluate (void *cls, enum GNUNET_BLOCK_Type type, if (reply_block_size == 0) return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; - GNUNET_CRYPTO_hash (reply_block, reply_block_size, &chash); - GNUNET_BLOCK_mingle_hash (&chash, bf_mutator, &mhash); - if (NULL != *bf) + if (NULL != bf) { - if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (*bf, &mhash)) - return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; + GNUNET_CRYPTO_hash (reply_block, reply_block_size, &chash); + GNUNET_BLOCK_mingle_hash (&chash, bf_mutator, &mhash); + if (NULL != *bf) + { + if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (*bf, &mhash)) + return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; + } + else + { + *bf = GNUNET_CONTAINER_bloomfilter_init (NULL, 8, BLOOMFILTER_K); + } + GNUNET_CONTAINER_bloomfilter_add (*bf, &mhash); } - else - { - *bf = GNUNET_CONTAINER_bloomfilter_init (NULL, 8, BLOOMFILTER_K); - } - GNUNET_CONTAINER_bloomfilter_add (*bf, &mhash); return GNUNET_BLOCK_EVALUATION_OK_MORE; } diff --git a/src/dht/gnunet-service-dht-new.c b/src/dht/gnunet-service-dht-new.c index 4a61b122f..45c235d40 100644 --- a/src/dht/gnunet-service-dht-new.c +++ b/src/dht/gnunet-service-dht-new.c @@ -114,7 +114,6 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GDS_NEIGHBOURS_done (); GDS_DATACACHE_done (); GDS_ROUTING_done (); - GDS_CLIENTS_done (); GDS_HELLO_done (); GDS_NSE_done (); if (GDS_block_context != NULL) @@ -182,11 +181,15 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, int main (int argc, char *const *argv) { - return (GNUNET_OK == - GNUNET_SERVICE_run (argc, argv, - "dht", - GNUNET_SERVICE_OPTION_NONE, - &run, NULL)) ? 0 : 1; + int ret; + + ret = (GNUNET_OK == + GNUNET_SERVICE_run (argc, argv, + "dht", + GNUNET_SERVICE_OPTION_NONE, + &run, NULL)) ? 0 : 1; + GDS_CLIENTS_done (); + return ret; } /* end of gnunet-service-dht.c */ -- 2.25.1