aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-17 20:46:31 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-17 20:46:31 +0000
commitd17a12c46c3b32cea91be8b8330066e3301b3f08 (patch)
tree214266b193b2e727532dba00d9f03b968ae26cab /src
parent81db86ef83d70d2072a4e2efb6151adc81cc24f3 (diff)
downloadgnunet-d17a12c46c3b32cea91be8b8330066e3301b3f08.tar.gz
gnunet-d17a12c46c3b32cea91be8b8330066e3301b3f08.zip
removing reply bf entirely, problem was with UID removal
Diffstat (limited to 'src')
-rw-r--r--src/dht/dht.h15
-rw-r--r--src/dht/gnunet-service-dht.c44
2 files changed, 3 insertions, 56 deletions
diff --git a/src/dht/dht.h b/src/dht/dht.h
index 72b721c5e..9fb71a8d1 100644
--- a/src/dht/dht.h
+++ b/src/dht/dht.h
@@ -34,13 +34,7 @@
34 * Should NEVER be enabled in production and makes the DHT incompatible 34 * Should NEVER be enabled in production and makes the DHT incompatible
35 * (since this changes the message format). 35 * (since this changes the message format).
36 */ 36 */
37#define HAVE_UID_FOR_TESTING GNUNET_NO 37#define HAVE_UID_FOR_TESTING GNUNET_YES
38
39/**
40 * Include a bf for replies? Should not be needed (see Mantis #1769), but if I remove
41 * this code it stops to work!?
42 */
43#define HAVE_REPLY_BLOOMFILTER GNUNET_YES
44 38
45/** 39/**
46 * Needs to be GNUNET_YES for logging to dhtlog to work! 40 * Needs to be GNUNET_YES for logging to dhtlog to work!
@@ -334,13 +328,6 @@ struct GNUNET_DHT_P2PRouteResultMessage
334 uint64_t unique_id GNUNET_PACKED; 328 uint64_t unique_id GNUNET_PACKED;
335#endif 329#endif
336 330
337#if HAVE_REPLY_BLOOMFILTER
338 /**
339 * Bloomfilter to stop circular routes
340 */
341 char bloomfilter[DHT_BLOOM_SIZE];
342#endif
343
344 /** 331 /**
345 * The key that was searched for 332 * The key that was searched for
346 */ 333 */
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index d1d054a8b..489d51440 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -1072,13 +1072,6 @@ forward_result_message (const struct GNUNET_MessageHeader *msg,
1072 } 1072 }
1073 result_message->options = htonl (msg_ctx->msg_options); 1073 result_message->options = htonl (msg_ctx->msg_options);
1074 result_message->hop_count = htonl (msg_ctx->hop_count + 1); 1074 result_message->hop_count = htonl (msg_ctx->hop_count + 1);
1075#if HAVE_REPLY_BLOOMFILTER
1076 GNUNET_assert (GNUNET_OK ==
1077 GNUNET_CONTAINER_bloomfilter_get_raw_data (msg_ctx->bloom,
1078 result_message->
1079 bloomfilter,
1080 DHT_BLOOM_SIZE));
1081#endif
1082#if HAVE_UID_FOR_TESTING 1075#if HAVE_UID_FOR_TESTING
1083 result_message->unique_id = GNUNET_htonll (msg_ctx->unique_id); 1076 result_message->unique_id = GNUNET_htonll (msg_ctx->unique_id);
1084#endif 1077#endif
@@ -1927,13 +1920,6 @@ route_result_message (struct GNUNET_MessageHeader *msg,
1927 NULL); 1920 NULL);
1928 } 1921 }
1929#endif 1922#endif
1930#if HAVE_REPLY_BLOOMFILTER
1931 if (msg_ctx->bloom != NULL)
1932 {
1933 GNUNET_CONTAINER_bloomfilter_free (msg_ctx->bloom);
1934 msg_ctx->bloom = NULL;
1935 }
1936#endif
1937 return 0; 1923 return 0;
1938 } 1924 }
1939 1925
@@ -2000,18 +1986,6 @@ route_result_message (struct GNUNET_MessageHeader *msg,
2000 pos = pos->next; 1986 pos = pos->next;
2001 continue; 1987 continue;
2002 } 1988 }
2003#if HAVE_REPLY_BLOOMFILTER
2004 if (msg_ctx->bloom == NULL)
2005 msg_ctx->bloom =
2006 GNUNET_CONTAINER_bloomfilter_init (NULL, DHT_BLOOM_SIZE,
2007 DHT_BLOOM_K);
2008 GNUNET_CONTAINER_bloomfilter_add (msg_ctx->bloom,
2009 &my_identity.hashPubKey);
2010 if ((GNUNET_NO ==
2011 GNUNET_CONTAINER_bloomfilter_test (msg_ctx->bloom,
2012 &peer_info->id.hashPubKey)))
2013 {{{
2014#endif
2015#if DEBUG_DHT 1989#if DEBUG_DHT
2016 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1990 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2017 "`%s:%s': Forwarding response key %s uid %llu to peer %s\n", 1991 "`%s:%s': Forwarding response key %s uid %llu to peer %s\n",
@@ -2035,19 +2009,9 @@ route_result_message (struct GNUNET_MessageHeader *msg,
2035 pos->delete_task = 2009 pos->delete_task =
2036 GNUNET_SCHEDULER_add_now (&remove_forward_entry, pos); 2010 GNUNET_SCHEDULER_add_now (&remove_forward_entry, pos);
2037 } 2011 }
2038#if HAVE_REPLY_BLOOMFILTER
2039 }}}
2040#endif
2041 } 2012 }
2042 pos = pos->next; 2013 pos = pos->next;
2043 } 2014 }
2044#if HAVE_REPLY_BLOOMFILTER
2045 if (msg_ctx->bloom != NULL)
2046 {
2047 GNUNET_CONTAINER_bloomfilter_free (msg_ctx->bloom);
2048 msg_ctx->bloom = NULL;
2049 }
2050#endif
2051 return 0; 2015 return 0;
2052} 2016}
2053 2017
@@ -3281,6 +3245,8 @@ route_message (const struct GNUNET_MessageHeader *msg,
3281 3245
3282 3246
3283 GNUNET_CONTAINER_bloomfilter_add (msg_ctx->bloom, &my_identity.hashPubKey); 3247 GNUNET_CONTAINER_bloomfilter_add (msg_ctx->bloom, &my_identity.hashPubKey);
3248 /* BUG HERE: recent uses unique_id! So if all unique-IDs are 0, we get
3249 easily into trouble!!! FIXME! */
3284 hash_from_uid (msg_ctx->unique_id, &unique_hash); 3250 hash_from_uid (msg_ctx->unique_id, &unique_hash);
3285 if (GNUNET_YES == 3251 if (GNUNET_YES ==
3286 GNUNET_CONTAINER_multihashmap_contains (recent.hashmap, &unique_hash)) 3252 GNUNET_CONTAINER_multihashmap_contains (recent.hashmap, &unique_hash))
@@ -4252,12 +4218,6 @@ handle_dht_p2p_route_result (void *cls, const struct GNUNET_PeerIdentity *peer,
4252 } 4218 }
4253#endif 4219#endif
4254 } 4220 }
4255#if HAVE_REPLY_BLOOMFILTER
4256 msg_ctx.bloom =
4257 GNUNET_CONTAINER_bloomfilter_init (incoming->bloomfilter, DHT_BLOOM_SIZE,
4258 DHT_BLOOM_K);
4259 GNUNET_assert (msg_ctx.bloom != NULL);
4260#endif
4261 route_result_message (enc_msg, &msg_ctx); 4221 route_result_message (enc_msg, &msg_ctx);
4262 return GNUNET_YES; 4222 return GNUNET_YES;
4263} 4223}