aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht_neighbours.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-02-20 17:19:47 +0100
committerChristian Grothoff <christian@grothoff.org>2017-02-20 17:19:47 +0100
commitf6f7fbbe98c110867febbcca647da8308be123c7 (patch)
treeaf69447cf4f08c417197685855c097c132aea8a1 /src/dht/gnunet-service-dht_neighbours.c
parenta3882b58f1c5976677aa65b0af8a48e8e946b06e (diff)
downloadgnunet-f6f7fbbe98c110867febbcca647da8308be123c7.tar.gz
gnunet-f6f7fbbe98c110867febbcca647da8308be123c7.zip
completed big block refactoring in preparation for SET-BLOCK integration
Diffstat (limited to 'src/dht/gnunet-service-dht_neighbours.c')
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c196
1 files changed, 87 insertions, 109 deletions
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index 7f3a44588..1bbc95a06 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009-2016 GNUnet e.V. 3 Copyright (C) 2009-2017 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -27,6 +27,7 @@
27#include "platform.h" 27#include "platform.h"
28#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
29#include "gnunet_block_lib.h" 29#include "gnunet_block_lib.h"
30#include "gnunet_block_group_lib.h"
30#include "gnunet_hello_lib.h" 31#include "gnunet_hello_lib.h"
31#include "gnunet_constants.h" 32#include "gnunet_constants.h"
32#include "gnunet_protocols.h" 33#include "gnunet_protocols.h"
@@ -50,7 +51,7 @@
50 51
51/** 52/**
52 * Enable slow sanity checks to debug issues. 53 * Enable slow sanity checks to debug issues.
53 */ 54 */
54#define SANITY_CHECKS 1 55#define SANITY_CHECKS 1
55 56
56/** 57/**
@@ -602,27 +603,10 @@ update_connect_preferences ()
602 603
603 604
604/** 605/**
605 * Closure for #add_known_to_bloom().
606 */
607struct BloomConstructorContext
608{
609 /**
610 * Bloom filter under construction.
611 */
612 struct GNUNET_CONTAINER_BloomFilter *bloom;
613
614 /**
615 * Mutator to use.
616 */
617 uint32_t bf_mutator;
618};
619
620
621/**
622 * Add each of the peers we already know to the bloom filter of 606 * Add each of the peers we already know to the bloom filter of
623 * the request so that we don't get duplicate HELLOs. 607 * the request so that we don't get duplicate HELLOs.
624 * 608 *
625 * @param cls the 'struct BloomConstructorContext'. 609 * @param cls the `struct GNUNET_BLOCK_Group`
626 * @param key peer identity to add to the bloom filter 610 * @param key peer identity to add to the bloom filter
627 * @param value value the peer information (unused) 611 * @param value value the peer information (unused)
628 * @return #GNUNET_YES (we should continue to iterate) 612 * @return #GNUNET_YES (we should continue to iterate)
@@ -632,22 +616,17 @@ add_known_to_bloom (void *cls,
632 const struct GNUNET_PeerIdentity *key, 616 const struct GNUNET_PeerIdentity *key,
633 void *value) 617 void *value)
634{ 618{
635 struct BloomConstructorContext *ctx = cls; 619 struct GNUNET_BLOCK_Group *bg = cls;
636 struct GNUNET_HashCode key_hash; 620 struct GNUNET_HashCode key_hash;
637 struct GNUNET_HashCode mh;
638 621
639 GNUNET_CRYPTO_hash (key, 622 GNUNET_CRYPTO_hash (key,
640 sizeof (struct GNUNET_PeerIdentity), 623 sizeof (struct GNUNET_PeerIdentity),
641 &key_hash); 624 &key_hash);
642 GNUNET_BLOCK_mingle_hash (&key_hash, 625 GNUNET_BLOCK_GROUP_bf_test_and_set (bg,
643 ctx->bf_mutator, 626 &key_hash);
644 &mh);
645 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 627 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
646 "Adding known peer (%s) to bloomfilter for FIND PEER with mutation %u\n", 628 "Adding known peer (%s) to bloomfilter for FIND PEER\n",
647 GNUNET_i2s (key), 629 GNUNET_i2s (key));
648 ctx->bf_mutator);
649 GNUNET_CONTAINER_bloomfilter_add (ctx->bloom,
650 &mh);
651 return GNUNET_YES; 630 return GNUNET_YES;
652} 631}
653 632
@@ -663,7 +642,7 @@ static void
663send_find_peer_message (void *cls) 642send_find_peer_message (void *cls)
664{ 643{
665 struct GNUNET_TIME_Relative next_send_time; 644 struct GNUNET_TIME_Relative next_send_time;
666 struct BloomConstructorContext bcc; 645 struct GNUNET_BLOCK_Group *bg;
667 struct GNUNET_CONTAINER_BloomFilter *peer_bf; 646 struct GNUNET_CONTAINER_BloomFilter *peer_bf;
668 647
669 find_peer_task = NULL; 648 find_peer_task = NULL;
@@ -677,30 +656,37 @@ send_find_peer_message (void *cls)
677 newly_found_peers = 0; 656 newly_found_peers = 0;
678 return; 657 return;
679 } 658 }
680 bcc.bf_mutator = 659 bg = GNUNET_BLOCK_GROUP_bf_create (NULL,
681 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 660 DHT_BLOOM_SIZE,
682 UINT32_MAX); 661 GNUNET_CONSTANTS_BLOOMFILTER_K,
683 bcc.bloom = 662 GNUNET_BLOCK_TYPE_DHT_HELLO,
684 GNUNET_CONTAINER_bloomfilter_init (NULL, DHT_BLOOM_SIZE, 663 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
685 GNUNET_CONSTANTS_BLOOMFILTER_K); 664 UINT32_MAX),
665 NULL,
666 0);
686 GNUNET_CONTAINER_multipeermap_iterate (all_connected_peers, 667 GNUNET_CONTAINER_multipeermap_iterate (all_connected_peers,
687 &add_known_to_bloom, 668 &add_known_to_bloom,
688 &bcc); 669 bg);
689 GNUNET_STATISTICS_update (GDS_stats, 670 GNUNET_STATISTICS_update (GDS_stats,
690 gettext_noop ("# FIND PEER messages initiated"), 671 gettext_noop ("# FIND PEER messages initiated"),
691 1, 672 1,
692 GNUNET_NO); 673 GNUNET_NO);
693 peer_bf = 674 peer_bf
694 GNUNET_CONTAINER_bloomfilter_init (NULL, DHT_BLOOM_SIZE, 675 = GNUNET_CONTAINER_bloomfilter_init (NULL,
676 DHT_BLOOM_SIZE,
695 GNUNET_CONSTANTS_BLOOMFILTER_K); 677 GNUNET_CONSTANTS_BLOOMFILTER_K);
696 // FIXME: pass priority!? 678 // FIXME: pass priority!?
697 GDS_NEIGHBOURS_handle_get (GNUNET_BLOCK_TYPE_DHT_HELLO, 679 GDS_NEIGHBOURS_handle_get (GNUNET_BLOCK_TYPE_DHT_HELLO,
698 GNUNET_DHT_RO_FIND_PEER, 680 GNUNET_DHT_RO_FIND_PEER,
699 FIND_PEER_REPLICATION_LEVEL, 0, 681 FIND_PEER_REPLICATION_LEVEL,
700 &my_identity_hash, NULL, 0, bcc.bloom, 682 0,
701 bcc.bf_mutator, peer_bf); 683 &my_identity_hash,
684 NULL,
685 0,
686 bg,
687 peer_bf);
702 GNUNET_CONTAINER_bloomfilter_free (peer_bf); 688 GNUNET_CONTAINER_bloomfilter_free (peer_bf);
703 GNUNET_CONTAINER_bloomfilter_free (bcc.bloom); 689 GNUNET_BLOCK_group_destroy (bg);
704 /* schedule next round */ 690 /* schedule next round */
705 next_send_time.rel_value_us = 691 next_send_time.rel_value_us =
706 DHT_MINIMUM_FIND_PEER_INTERVAL.rel_value_us + 692 DHT_MINIMUM_FIND_PEER_INTERVAL.rel_value_us +
@@ -1357,8 +1343,7 @@ GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type type,
1357 * @param key key for the content 1343 * @param key key for the content
1358 * @param xquery extended query 1344 * @param xquery extended query
1359 * @param xquery_size number of bytes in @a xquery 1345 * @param xquery_size number of bytes in @a xquery
1360 * @param reply_bf bloomfilter to filter duplicates 1346 * @param bg group to use for filtering replies
1361 * @param reply_bf_mutator mutator for @a reply_bf
1362 * @param peer_bf filter for peers not to select (again) 1347 * @param peer_bf filter for peers not to select (again)
1363 * @return #GNUNET_OK if the request was forwarded, #GNUNET_NO if not 1348 * @return #GNUNET_OK if the request was forwarded, #GNUNET_NO if not
1364 */ 1349 */
@@ -1366,14 +1351,14 @@ int
1366GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type, 1351GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1367 enum GNUNET_DHT_RouteOption options, 1352 enum GNUNET_DHT_RouteOption options,
1368 uint32_t desired_replication_level, 1353 uint32_t desired_replication_level,
1369 uint32_t hop_count, const struct GNUNET_HashCode * key, 1354 uint32_t hop_count,
1370 const void *xquery, size_t xquery_size, 1355 const struct GNUNET_HashCode *key,
1371 const struct GNUNET_CONTAINER_BloomFilter *reply_bf, 1356 const void *xquery,
1372 uint32_t reply_bf_mutator, 1357 size_t xquery_size,
1358 struct GNUNET_BLOCK_Group *bg,
1373 struct GNUNET_CONTAINER_BloomFilter *peer_bf) 1359 struct GNUNET_CONTAINER_BloomFilter *peer_bf)
1374{ 1360{
1375 unsigned int target_count; 1361 unsigned int target_count;
1376 unsigned int i;
1377 struct PeerInfo **targets; 1362 struct PeerInfo **targets;
1378 struct PeerInfo *target; 1363 struct PeerInfo *target;
1379 struct GNUNET_MQ_Envelope *env; 1364 struct GNUNET_MQ_Envelope *env;
@@ -1381,7 +1366,9 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1381 struct PeerGetMessage *pgm; 1366 struct PeerGetMessage *pgm;
1382 char *xq; 1367 char *xq;
1383 size_t reply_bf_size; 1368 size_t reply_bf_size;
1369 void *reply_bf;
1384 unsigned int skip_count; 1370 unsigned int skip_count;
1371 uint32_t bf_nonce;
1385 1372
1386 GNUNET_assert (NULL != peer_bf); 1373 GNUNET_assert (NULL != peer_bf);
1387 GNUNET_STATISTICS_update (GDS_stats, 1374 GNUNET_STATISTICS_update (GDS_stats,
@@ -1408,11 +1395,22 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1408 GNUNET_i2s (&my_identity)); 1395 GNUNET_i2s (&my_identity));
1409 return GNUNET_NO; 1396 return GNUNET_NO;
1410 } 1397 }
1411 reply_bf_size = GNUNET_CONTAINER_bloomfilter_get_size (reply_bf); 1398 if (GNUNET_OK !=
1399 GNUNET_BLOCK_group_serialize (bg,
1400 &bf_nonce,
1401 &reply_bf,
1402 &reply_bf_size))
1403 {
1404 reply_bf = NULL;
1405 reply_bf_size = 0;
1406 bf_nonce = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
1407 UINT32_MAX);
1408 }
1412 msize = xquery_size + reply_bf_size; 1409 msize = xquery_size + reply_bf_size;
1413 if (msize + sizeof (struct PeerGetMessage) >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 1410 if (msize + sizeof (struct PeerGetMessage) >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
1414 { 1411 {
1415 GNUNET_break (0); 1412 GNUNET_break (0);
1413 GNUNET_free_non_null (reply_bf);
1416 GNUNET_free (targets); 1414 GNUNET_free (targets);
1417 return GNUNET_NO; 1415 return GNUNET_NO;
1418 } 1416 }
@@ -1422,7 +1420,7 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1422 GNUNET_NO); 1420 GNUNET_NO);
1423 /* forward request */ 1421 /* forward request */
1424 skip_count = 0; 1422 skip_count = 0;
1425 for (i = 0; i < target_count; i++) 1423 for (unsigned int i = 0; i < target_count; i++)
1426 { 1424 {
1427 target = targets[i]; 1425 target = targets[i];
1428 if (GNUNET_MQ_get_length (target->mq) >= MAXIMUM_PENDING_PER_PEER) 1426 if (GNUNET_MQ_get_length (target->mq) >= MAXIMUM_PENDING_PER_PEER)
@@ -1447,7 +1445,7 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1447 pgm->hop_count = htonl (hop_count + 1); 1445 pgm->hop_count = htonl (hop_count + 1);
1448 pgm->desired_replication_level = htonl (desired_replication_level); 1446 pgm->desired_replication_level = htonl (desired_replication_level);
1449 pgm->xquery_size = htonl (xquery_size); 1447 pgm->xquery_size = htonl (xquery_size);
1450 pgm->bf_mutator = reply_bf_mutator; 1448 pgm->bf_mutator = bf_nonce;
1451 GNUNET_break (GNUNET_YES == 1449 GNUNET_break (GNUNET_YES ==
1452 GNUNET_CONTAINER_bloomfilter_test (peer_bf, 1450 GNUNET_CONTAINER_bloomfilter_test (peer_bf,
1453 &target->phash)); 1451 &target->phash));
@@ -1460,16 +1458,14 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1460 GNUNET_memcpy (xq, 1458 GNUNET_memcpy (xq,
1461 xquery, 1459 xquery,
1462 xquery_size); 1460 xquery_size);
1463 if (NULL != reply_bf) 1461 GNUNET_memcpy (&xq[xquery_size],
1464 GNUNET_assert (GNUNET_OK == 1462 reply_bf,
1465 GNUNET_CONTAINER_bloomfilter_get_raw_data (reply_bf, 1463 reply_bf_size);
1466 &xq
1467 [xquery_size],
1468 reply_bf_size));
1469 GNUNET_MQ_send (target->mq, 1464 GNUNET_MQ_send (target->mq,
1470 env); 1465 env);
1471 } 1466 }
1472 GNUNET_free (targets); 1467 GNUNET_free (targets);
1468 GNUNET_free_non_null (reply_bf);
1473 return (skip_count < target_count) ? GNUNET_OK : GNUNET_NO; 1469 return (skip_count < target_count) ? GNUNET_OK : GNUNET_NO;
1474} 1470}
1475 1471
@@ -1717,11 +1713,12 @@ handle_dht_p2p_put (void *cls,
1717 { 1713 {
1718 switch (GNUNET_BLOCK_evaluate (GDS_block_context, 1714 switch (GNUNET_BLOCK_evaluate (GDS_block_context,
1719 ntohl (put->type), 1715 ntohl (put->type),
1716 NULL, /* query group */
1720 GNUNET_BLOCK_EO_NONE, 1717 GNUNET_BLOCK_EO_NONE,
1721 NULL, /* query */ 1718 NULL, /* query */
1722 NULL, 0, /* bloom filer */
1723 NULL, 0, /* xquery */ 1719 NULL, 0, /* xquery */
1724 payload, payload_size)) 1720 payload,
1721 payload_size))
1725 { 1722 {
1726 case GNUNET_BLOCK_EVALUATION_OK_MORE: 1723 case GNUNET_BLOCK_EVALUATION_OK_MORE:
1727 case GNUNET_BLOCK_EVALUATION_OK_LAST: 1724 case GNUNET_BLOCK_EVALUATION_OK_LAST:
@@ -1762,7 +1759,7 @@ handle_dht_p2p_put (void *cls,
1762 } 1759 }
1763 GNUNET_break (0 != memcmp (&pp[i], 1760 GNUNET_break (0 != memcmp (&pp[i],
1764 peer->id, 1761 peer->id,
1765 sizeof (struct GNUNET_PeerIdentity))); 1762 sizeof (struct GNUNET_PeerIdentity)));
1766 } 1763 }
1767#endif 1764#endif
1768 GNUNET_memcpy (pp, 1765 GNUNET_memcpy (pp,
@@ -1830,30 +1827,25 @@ handle_dht_p2p_put (void *cls,
1830 * 1827 *
1831 * @param sender sender of the FIND PEER request 1828 * @param sender sender of the FIND PEER request
1832 * @param key peers close to this key are desired 1829 * @param key peers close to this key are desired
1833 * @param bf peers matching this bf are excluded 1830 * @param bg group for filtering peers
1834 * @param bf_mutator mutator for bf
1835 */ 1831 */
1836static void 1832static void
1837handle_find_peer (const struct GNUNET_PeerIdentity *sender, 1833handle_find_peer (const struct GNUNET_PeerIdentity *sender,
1838 const struct GNUNET_HashCode *key, 1834 const struct GNUNET_HashCode *key,
1839 struct GNUNET_CONTAINER_BloomFilter *bf, 1835 struct GNUNET_BLOCK_Group *bg)
1840 uint32_t bf_mutator)
1841{ 1836{
1842 int bucket_idx; 1837 int bucket_idx;
1843 struct PeerBucket *bucket; 1838 struct PeerBucket *bucket;
1844 struct PeerInfo *peer; 1839 struct PeerInfo *peer;
1845 unsigned int choice; 1840 unsigned int choice;
1846 struct GNUNET_HashCode mhash;
1847 const struct GNUNET_HELLO_Message *hello; 1841 const struct GNUNET_HELLO_Message *hello;
1848 1842
1849 /* first, check about our own HELLO */ 1843 /* first, check about our own HELLO */
1850 if (NULL != GDS_my_hello) 1844 if (NULL != GDS_my_hello)
1851 { 1845 {
1852 GNUNET_BLOCK_mingle_hash (&my_identity_hash, 1846 if (GNUNET_YES !=
1853 bf_mutator, 1847 GNUNET_BLOCK_GROUP_bf_test_and_set (bg,
1854 &mhash); 1848 &my_identity_hash))
1855 if ((NULL == bf) ||
1856 (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (bf, &mhash)))
1857 { 1849 {
1858 size_t hello_size; 1850 size_t hello_size;
1859 1851
@@ -1913,18 +1905,15 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender,
1913 do 1905 do
1914 { 1906 {
1915 peer = peer->next; 1907 peer = peer->next;
1916 if (choice-- == 0) 1908 if (0 == choice--)
1917 return; /* no non-masked peer available */ 1909 return; /* no non-masked peer available */
1918 if (NULL == peer) 1910 if (NULL == peer)
1919 peer = bucket->head; 1911 peer = bucket->head;
1920 GNUNET_BLOCK_mingle_hash (&peer->phash,
1921 bf_mutator,
1922 &mhash);
1923 hello = GDS_HELLO_get (peer->id); 1912 hello = GDS_HELLO_get (peer->id);
1924 } while ( (hello == NULL) || 1913 } while ( (NULL == hello) ||
1925 (GNUNET_YES == 1914 (GNUNET_YES ==
1926 GNUNET_CONTAINER_bloomfilter_test (bf, 1915 GNUNET_BLOCK_GROUP_bf_test_and_set (bg,
1927 &mhash)) ); 1916 &peer->phash)) );
1928 GDS_NEIGHBOURS_handle_reply (sender, 1917 GDS_NEIGHBOURS_handle_reply (sender,
1929 GNUNET_BLOCK_TYPE_DHT_HELLO, 1918 GNUNET_BLOCK_TYPE_DHT_HELLO,
1930 GNUNET_TIME_relative_to_absolute 1919 GNUNET_TIME_relative_to_absolute
@@ -2019,7 +2008,7 @@ handle_dht_p2p_get (void *cls,
2019 enum GNUNET_BLOCK_Type type; 2008 enum GNUNET_BLOCK_Type type;
2020 enum GNUNET_DHT_RouteOption options; 2009 enum GNUNET_DHT_RouteOption options;
2021 enum GNUNET_BLOCK_EvaluationResult eval; 2010 enum GNUNET_BLOCK_EvaluationResult eval;
2022 struct GNUNET_CONTAINER_BloomFilter *reply_bf; 2011 struct GNUNET_BLOCK_Group *bg;
2023 struct GNUNET_CONTAINER_BloomFilter *peer_bf; 2012 struct GNUNET_CONTAINER_BloomFilter *peer_bf;
2024 const char *xquery; 2013 const char *xquery;
2025 int forwarded; 2014 int forwarded;
@@ -2036,7 +2025,6 @@ handle_dht_p2p_get (void *cls,
2036 type = ntohl (get->type); 2025 type = ntohl (get->type);
2037 options = ntohl (get->options); 2026 options = ntohl (get->options);
2038 xquery = (const char *) &get[1]; 2027 xquery = (const char *) &get[1];
2039 reply_bf = NULL;
2040 GNUNET_STATISTICS_update (GDS_stats, 2028 GNUNET_STATISTICS_update (GDS_stats,
2041 gettext_noop ("# P2P GET requests received"), 2029 gettext_noop ("# P2P GET requests received"),
2042 1, 2030 1,
@@ -2064,19 +2052,17 @@ handle_dht_p2p_get (void *cls,
2064 xquery); 2052 xquery);
2065 GNUNET_free (tmp); 2053 GNUNET_free (tmp);
2066 } 2054 }
2067 2055 bg = GNUNET_BLOCK_group_create (GDS_block_context,
2068 if (reply_bf_size > 0) 2056 type,
2069 reply_bf = 2057 get->bf_mutator,
2070 GNUNET_CONTAINER_bloomfilter_init (&xquery[xquery_size], 2058 &xquery[xquery_size],
2071 reply_bf_size, 2059 reply_bf_size);
2072 GNUNET_CONSTANTS_BLOOMFILTER_K); 2060 eval
2073 eval = 2061 = GNUNET_BLOCK_evaluate (GDS_block_context,
2074 GNUNET_BLOCK_evaluate (GDS_block_context,
2075 type, 2062 type,
2063 bg,
2076 GNUNET_BLOCK_EO_NONE, 2064 GNUNET_BLOCK_EO_NONE,
2077 &get->key, 2065 &get->key,
2078 &reply_bf,
2079 get->bf_mutator,
2080 xquery, 2066 xquery,
2081 xquery_size, 2067 xquery_size,
2082 NULL, 2068 NULL,
@@ -2085,8 +2071,7 @@ handle_dht_p2p_get (void *cls,
2085 { 2071 {
2086 /* request invalid or block type not supported */ 2072 /* request invalid or block type not supported */
2087 GNUNET_break_op (eval == GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED); 2073 GNUNET_break_op (eval == GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED);
2088 if (NULL != reply_bf) 2074 GNUNET_BLOCK_group_destroy (bg);
2089 GNUNET_CONTAINER_bloomfilter_free (reply_bf);
2090 return; 2075 return;
2091 } 2076 }
2092 peer_bf = GNUNET_CONTAINER_bloomfilter_init (get->bloomfilter, 2077 peer_bf = GNUNET_CONTAINER_bloomfilter_init (get->bloomfilter,
@@ -2098,12 +2083,11 @@ handle_dht_p2p_get (void *cls,
2098 /* remember request for routing replies */ 2083 /* remember request for routing replies */
2099 GDS_ROUTING_add (peer->id, 2084 GDS_ROUTING_add (peer->id,
2100 type, 2085 type,
2086 bg, /* bg now owned by routing, but valid at least until end of this function! */
2101 options, 2087 options,
2102 &get->key, 2088 &get->key,
2103 xquery, 2089 xquery,
2104 xquery_size, 2090 xquery_size);
2105 reply_bf,
2106 get->bf_mutator);
2107 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2091 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2108 "GET for %s at %s after %u hops\n", 2092 "GET for %s at %s after %u hops\n",
2109 GNUNET_h2s (&get->key), 2093 GNUNET_h2s (&get->key),
@@ -2122,8 +2106,7 @@ handle_dht_p2p_get (void *cls,
2122 GNUNET_NO); 2106 GNUNET_NO);
2123 handle_find_peer (peer->id, 2107 handle_find_peer (peer->id,
2124 &get->key, 2108 &get->key,
2125 reply_bf, 2109 bg);
2126 get->bf_mutator);
2127 } 2110 }
2128 else 2111 else
2129 { 2112 {
@@ -2131,8 +2114,7 @@ handle_dht_p2p_get (void *cls,
2131 type, 2114 type,
2132 xquery, 2115 xquery,
2133 xquery_size, 2116 xquery_size,
2134 &reply_bf, 2117 bg,
2135 get->bf_mutator,
2136 &handle_local_result, 2118 &handle_local_result,
2137 NULL); 2119 NULL);
2138 } 2120 }
@@ -2155,8 +2137,7 @@ handle_dht_p2p_get (void *cls,
2155 &get->key, 2137 &get->key,
2156 xquery, 2138 xquery,
2157 xquery_size, 2139 xquery_size,
2158 reply_bf, 2140 bg,
2159 get->bf_mutator,
2160 peer_bf); 2141 peer_bf);
2161 GDS_CLIENTS_process_get (options 2142 GDS_CLIENTS_process_get (options
2162 | (GNUNET_OK == forwarded) 2143 | (GNUNET_OK == forwarded)
@@ -2168,10 +2149,7 @@ handle_dht_p2p_get (void *cls,
2168 NULL, 2149 NULL,
2169 &get->key); 2150 &get->key);
2170 2151
2171 2152 /* clean up; note that 'bg' is owned by routing now! */
2172 /* clean up */
2173 if (NULL != reply_bf)
2174 GNUNET_CONTAINER_bloomfilter_free (reply_bf);
2175 GNUNET_CONTAINER_bloomfilter_free (peer_bf); 2153 GNUNET_CONTAINER_bloomfilter_free (peer_bf);
2176} 2154}
2177 2155
@@ -2310,7 +2288,7 @@ handle_dht_p2p_result (void *cls,
2310 } 2288 }
2311 GNUNET_break (0 != memcmp (&get_path[i], 2289 GNUNET_break (0 != memcmp (&get_path[i],
2312 peer->id, 2290 peer->id,
2313 sizeof (struct GNUNET_PeerIdentity))); 2291 sizeof (struct GNUNET_PeerIdentity)));
2314 } 2292 }
2315#endif 2293#endif
2316 GNUNET_memcpy (xget_path, 2294 GNUNET_memcpy (xget_path,