[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r16968 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r16968 - gnunet/src/dht |
Date: |
Mon, 19 Sep 2011 22:49:42 +0200 |
Author: grothoff
Date: 2011-09-19 22:49:42 +0200 (Mon, 19 Sep 2011)
New Revision: 16968
Modified:
gnunet/src/dht/gnunet-service-dht.c
gnunet/src/dht/test_dht_twopeer.c
Log:
stuff
Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2011-09-19 20:25:37 UTC (rev 16967)
+++ gnunet/src/dht/gnunet-service-dht.c 2011-09-19 20:49:42 UTC (rev 16968)
@@ -1941,8 +1941,10 @@
continue;
}
else
+ {
GNUNET_CONTAINER_bloomfilter_add (pos->find_peers_responded,
&new_peer.hashPubKey);
+ }
}
#endif
@@ -2988,6 +2990,7 @@
GNUNET_CONTAINER_bloomfilter_test (bloom, &pos->id.hashPubKey))
{
pos = pos->next;
+ increment_stats ("# peer blocked from selection by Bloom filter");
continue; /* Ignore bloomfiltered peers */
}
count++;
@@ -3250,8 +3253,6 @@
(ntohs (msg->type) != GNUNET_MESSAGE_TYPE_DHT_FIND_PEER))
target_forward_count = 0;
-
- GNUNET_CONTAINER_bloomfilter_add (msg_ctx->bloom, &my_identity.hashPubKey);
#if HAVE_UID_FOR_TESTING > 1
/* BUG HERE: recent uses unique_id! So if all unique-IDs are 0, we get
easily into trouble!!! Also, this should not even be necessary... */
@@ -3304,52 +3305,50 @@
for (i = 0; i < target_forward_count; i++)
{
selected = select_peer (&msg_ctx->key, msg_ctx->bloom, msg_ctx->hop_count);
-
- if (selected != NULL)
+ if (selected == NULL)
+ break;
+ forward_count++;
+ if (GNUNET_CRYPTO_hash_matching_bits
+ (&selected->id.hashPubKey,
+ &msg_ctx->key) >=
+ GNUNET_CRYPTO_hash_matching_bits (&my_identity.hashPubKey,
+ &msg_ctx->key))
+ GNUNET_asprintf (&temp_stat_str,
+ "# requests routed to close(r) peer hop %u",
+ msg_ctx->hop_count);
+ else
+ GNUNET_asprintf (&temp_stat_str,
+ "# requests routed to less close peer hop %u",
+ msg_ctx->hop_count);
+ if (temp_stat_str != NULL)
{
- forward_count++;
- if (GNUNET_CRYPTO_hash_matching_bits
- (&selected->id.hashPubKey,
- &msg_ctx->key) >=
- GNUNET_CRYPTO_hash_matching_bits (&my_identity.hashPubKey,
- &msg_ctx->key))
- GNUNET_asprintf (&temp_stat_str,
- "# requests routed to close(r) peer hop %u",
- msg_ctx->hop_count);
- else
- GNUNET_asprintf (&temp_stat_str,
- "# requests routed to less close peer hop %u",
- msg_ctx->hop_count);
- if (temp_stat_str != NULL)
- {
- increment_stats (temp_stat_str);
- GNUNET_free (temp_stat_str);
- }
- GNUNET_CONTAINER_bloomfilter_add (msg_ctx->bloom,
- &selected->id.hashPubKey);
+ increment_stats (temp_stat_str);
+ GNUNET_free (temp_stat_str);
+ }
+ GNUNET_CONTAINER_bloomfilter_add (msg_ctx->bloom,
+ &selected->id.hashPubKey);
#if DEBUG_DHT_ROUTING > 1
- nearest = find_closest_peer (&msg_ctx->key);
- nearest_buf = GNUNET_strdup (GNUNET_i2s (&nearest->id));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "`%s:%s': Forwarding request key %s uid %llu to peer %s
(closest %s, bits %d, distance %u)\n",
- my_short_id, "DHT", GNUNET_h2s (&msg_ctx->key),
- msg_ctx->unique_id, GNUNET_i2s (&selected->id), nearest_buf,
- GNUNET_CRYPTO_hash_matching_bits (&nearest->id.hashPubKey,
- msg_ctx->key),
- distance (&nearest->id.hashPubKey, msg_ctx->key));
- GNUNET_free (nearest_buf);
+ nearest = find_closest_peer (&msg_ctx->key);
+ nearest_buf = GNUNET_strdup (GNUNET_i2s (&nearest->id));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "`%s:%s': Forwarding request key %s uid %llu to peer %s
(closest %s, bits %d, distance %u)\n",
+ my_short_id, "DHT", GNUNET_h2s (&msg_ctx->key),
+ msg_ctx->unique_id, GNUNET_i2s (&selected->id), nearest_buf,
+ GNUNET_CRYPTO_hash_matching_bits (&nearest->id.hashPubKey,
+ msg_ctx->key),
+ distance (&nearest->id.hashPubKey, msg_ctx->key));
+ GNUNET_free (nearest_buf);
#endif
#if DEBUG_DHT_ROUTING
- if ((debug_routes_extended) && (dhtlog_handle != NULL))
- {
- dhtlog_handle->insert_route (NULL, msg_ctx->unique_id, DHTLOG_ROUTE,
- msg_ctx->hop_count, GNUNET_NO,
- &my_identity, &msg_ctx->key,
&msg_ctx->peer,
- &selected->id);
- }
-#endif
- forward_message (msg, selected, msg_ctx);
+ if ((debug_routes_extended) && (dhtlog_handle != NULL))
+ {
+ dhtlog_handle->insert_route (NULL, msg_ctx->unique_id, DHTLOG_ROUTE,
+ msg_ctx->hop_count, GNUNET_NO,
+ &my_identity, &msg_ctx->key, &msg_ctx->peer,
+ &selected->id);
}
+#endif
+ forward_message (msg, selected, msg_ctx);
}
if (msg_ctx->bloom != NULL)
@@ -4343,7 +4342,7 @@
* @param identity the public identity of this peer
* @param publicKey the public key of this peer
*/
-void
+static void
core_init (void *cls, struct GNUNET_CORE_Handle *server,
const struct GNUNET_PeerIdentity *identity,
const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey)
Modified: gnunet/src/dht/test_dht_twopeer.c
===================================================================
--- gnunet/src/dht/test_dht_twopeer.c 2011-09-19 20:25:37 UTC (rev 16967)
+++ gnunet/src/dht/test_dht_twopeer.c 2011-09-19 20:49:42 UTC (rev 16968)
@@ -178,6 +178,7 @@
if (0 !=
memcmp (&get_context->peer->hashPubKey, key, sizeof (GNUNET_HashCode)))
{
+ fprintf (stderr, "??\n");
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Key returned is not the same key as was searched for!\n");
GNUNET_SCHEDULER_cancel (die_task);
@@ -186,7 +187,7 @@
"key mismatch in get response!\n");
return;
}
-
+ fprintf (stderr, "!\n");
if (get_context->retry_task != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_SCHEDULER_cancel (get_context->retry_task);
@@ -216,6 +217,7 @@
static void
stop_retry_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+
static void
get_stop_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
@@ -227,6 +229,7 @@
get_context->get_attempts);
else
{
+ fprintf (stderr, "?\n");
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Too many attempts failed, ending test!\n",
get_context->get_attempts);
@@ -236,6 +239,7 @@
"GET attempt failed, ending test!\n");
return;
}
+ fprintf (stderr, ".");
get_context->get_attempts++;
get_context->retry_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
@@ -251,6 +255,7 @@
0, NULL, 0, &get_result_iterator, get_context);
}
+
static void
stop_retry_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
@@ -265,6 +270,7 @@
GNUNET_SCHEDULER_add_now (&get_stop_finished, get_context);
}
+
static void
do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r16968 - gnunet/src/dht,
gnunet <=