From 969cb768a0afbd921ec9ee05ce2d545f9f740fda Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 27 Sep 2011 20:39:18 +0000 Subject: [PATCH] fixes --- src/dht/Makefile.am | 2 +- src/dht/gnunet-service-dht_neighbours.c | 28 ++++++++++++------------- src/dht/test_dht_twopeer_get_put.c | 14 +++++++------ src/dht/test_dht_twopeer_put_get.c | 10 ++++----- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am index 67fe9ac2e..1e1e69dc6 100644 --- a/src/dht/Makefile.am +++ b/src/dht/Makefile.am @@ -239,7 +239,7 @@ test_dht_twopeer_get_put_SOURCES = \ test_dht_twopeer_get_put_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/testing/libgnunettesting.la \ - $(top_builddir)/src/dht/libgnunetdht.la + $(top_builddir)/src/dht/libgnunetdhtnew.la test_dht_twopeer_path_tracking_SOURCES = \ test_dht_twopeer_path_tracking.c diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 17e6f0dec..1dfd1fbb1 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c @@ -1288,7 +1288,7 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type, desired_replication_level, &targets); if (0 == target_count) - return; + return; reply_bf_size = GNUNET_CONTAINER_bloomfilter_get_size (reply_bf); msize = xquery_size + sizeof (struct PeerGetMessage) + reply_bf_size; if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) @@ -1843,22 +1843,20 @@ handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer, GNUNET_break_op (0); return GNUNET_YES; } - if (0 == memcmp (&my_identity, &pid, sizeof (struct GNUNET_PeerIdentity))) + if (0 != memcmp (&my_identity, &pid, sizeof (struct GNUNET_PeerIdentity))) { - /* got my own HELLO */ - return GNUNET_YES; + bucket = find_bucket (&pid.hashPubKey); + if ( (bucket >= 0) && + (k_buckets[bucket].peers_size < bucket_size) ) + { + if (NULL != GDS_transport_handle) + GNUNET_TRANSPORT_offer_hello (GDS_transport_handle, + h, NULL, NULL); + (void) GNUNET_CORE_peer_request_connect (coreAPI, + &pid, + NULL, NULL); + } } - bucket = find_bucket (&pid.hashPubKey); - if ( (bucket >= 0) && - (k_buckets[bucket].peers_size < bucket_size) ) - { - if (NULL != GDS_transport_handle) - GNUNET_TRANSPORT_offer_hello (GDS_transport_handle, - h, NULL, NULL); - (void) GNUNET_CORE_peer_request_connect (coreAPI, - &pid, - NULL, NULL); - } } /* append 'peer' to 'get_path' */ diff --git a/src/dht/test_dht_twopeer_get_put.c b/src/dht/test_dht_twopeer_get_put.c index 4a04027bb..100f964cf 100644 --- a/src/dht/test_dht_twopeer_get_put.c +++ b/src/dht/test_dht_twopeer_get_put.c @@ -39,7 +39,7 @@ #include "platform.h" #include "gnunet_testing_lib.h" #include "gnunet_core_service.h" -#include "gnunet_dht_service.h" +#include "gnunet_dht_service_new.h" #include "block_dns.h" #include "gnunet_signatures.h" @@ -215,8 +215,10 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) void get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp, const GNUNET_HashCode * key, - const struct GNUNET_PeerIdentity *const *get_path, - const struct GNUNET_PeerIdentity *const *put_path, + const struct GNUNET_PeerIdentity *get_path, + unsigned int get_path_size, + const struct GNUNET_PeerIdentity *put_path, + unsigned int put_path_size, enum GNUNET_BLOCK_Type type, size_t size, const void *result_data) { @@ -277,8 +279,8 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) #else GNUNET_BLOCK_TYPE_TEST, #endif - &key, DEFAULT_GET_REPLICATION, GNUNET_DHT_RO_NONE, - NULL, 0, NULL, 0, &get_result_iterator, NULL); + &key, 1, GNUNET_DHT_RO_NONE, + NULL, 0, &get_result_iterator, NULL); GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), &do_put, NULL); } @@ -311,7 +313,7 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) memset (data, 43, sizeof (data)); /* Insert the data at the first peer */ - GNUNET_DHT_put (peer1dht, &key, DEFAULT_PUT_REPLICATION, GNUNET_DHT_RO_NONE, + GNUNET_DHT_put (peer1dht, &key, 1, GNUNET_DHT_RO_NONE, GNUNET_BLOCK_TYPE_TEST, sizeof (data), data, GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_FOREVER_REL, &put_finished, NULL); diff --git a/src/dht/test_dht_twopeer_put_get.c b/src/dht/test_dht_twopeer_put_get.c index cf5291346..ccb421cae 100644 --- a/src/dht/test_dht_twopeer_put_get.c +++ b/src/dht/test_dht_twopeer_put_get.c @@ -44,7 +44,7 @@ #include "gnunet_signatures.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) @@ -254,10 +254,10 @@ put_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) memset (&key, 42, sizeof (GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */ global_get_handle = - GNUNET_DHT_get_start (peer2dht, GNUNET_TIME_relative_get_forever (), - GNUNET_BLOCK_TYPE_TEST, - &key, 1, GNUNET_DHT_RO_NONE, - NULL, 0, &get_result_iterator, NULL); + GNUNET_DHT_get_start (peer2dht, GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_BLOCK_TYPE_TEST, + &key, 1, GNUNET_DHT_RO_NONE, + NULL, 0, &get_result_iterator, NULL); } -- 2.25.1