aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht.c
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-07-20 15:13:06 +0000
committerNathan S. Evans <evans@in.tum.de>2010-07-20 15:13:06 +0000
commita27eb5beb5872854d2f7ff540a28019eaa83da70 (patch)
tree261583c14adb7c927bcafb4531a92e4275002d67 /src/dht/gnunet-service-dht.c
parent27ee160b9c2bfd30a192db7f86585da8bc34e1cd (diff)
downloadgnunet-a27eb5beb5872854d2f7ff540a28019eaa83da70.tar.gz
gnunet-a27eb5beb5872854d2f7ff540a28019eaa83da70.zip
add testcases to run on make check, fix dht a bit
Diffstat (limited to 'src/dht/gnunet-service-dht.c')
-rw-r--r--src/dht/gnunet-service-dht.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index eb577de47..6fe910ecd 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -1377,6 +1377,7 @@ handle_dht_find_peer (void *cls,
1377 struct DHT_MessageContext *message_context) 1377 struct DHT_MessageContext *message_context)
1378{ 1378{
1379 struct GNUNET_MessageHeader *find_peer_result; 1379 struct GNUNET_MessageHeader *find_peer_result;
1380 struct DHT_MessageContext *new_msg_ctx;
1380 size_t hello_size; 1381 size_t hello_size;
1381 size_t tsize; 1382 size_t tsize;
1382 1383
@@ -1414,12 +1415,13 @@ handle_dht_find_peer (void *cls,
1414 "`%s': Sending hello size %d to client.\n", 1415 "`%s': Sending hello size %d to client.\n",
1415 "DHT", hello_size); 1416 "DHT", hello_size);
1416#endif 1417#endif
1417 if (message_context->bloom != NULL)
1418 GNUNET_CONTAINER_bloomfilter_clear(message_context->bloom);
1419 1418
1420 message_context->hop_count = 0; 1419 new_msg_ctx = GNUNET_malloc(sizeof(struct DHT_MessageContext));
1421 message_context->peer = &my_identity; 1420 memcpy(new_msg_ctx, message_context, sizeof(struct DHT_MessageContext));
1422 route_result_message(cls, find_peer_result, message_context); 1421 new_msg_ctx->peer = &my_identity;
1422 new_msg_ctx->bloom = GNUNET_CONTAINER_bloomfilter_init (NULL, DHT_BLOOM_SIZE, DHT_BLOOM_K);
1423 new_msg_ctx->hop_count = 0;
1424 route_result_message(cls, find_peer_result, new_msg_ctx);
1423 //send_reply_to_client(message_context->client, find_peer_result, message_context->unique_id); 1425 //send_reply_to_client(message_context->client, find_peer_result, message_context->unique_id);
1424 GNUNET_free(find_peer_result); 1426 GNUNET_free(find_peer_result);
1425} 1427}
@@ -2397,7 +2399,8 @@ void handle_core_connect (void *cls,
2397 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2399 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2398 "%s:%s Receives core connect message for peer %s distance %d!\n", my_short_id, "dht", GNUNET_i2s(peer), distance); 2400 "%s:%s Receives core connect message for peer %s distance %d!\n", my_short_id, "dht", GNUNET_i2s(peer), distance);
2399#endif 2401#endif
2400 2402 if (datacache != NULL)
2403 GNUNET_DATACACHE_put(datacache, &peer->hashPubKey, sizeof(struct GNUNET_PeerIdentity), (const char *)peer, 0, GNUNET_TIME_absolute_get_forever());
2401 ret = try_add_peer(peer, 2404 ret = try_add_peer(peer,
2402 find_current_bucket(&peer->hashPubKey), 2405 find_current_bucket(&peer->hashPubKey),
2403 latency, 2406 latency,