continue;
}
else
+ {
GNUNET_CONTAINER_bloomfilter_add (pos->find_peers_responded,
&new_peer.hashPubKey);
+ }
}
#endif
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++;
(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... */
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)
* @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)
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);
"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);
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)
{
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);
"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
0, NULL, 0, &get_result_iterator, get_context);
}
+
static void
stop_retry_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
GNUNET_SCHEDULER_add_now (&get_stop_finished, get_context);
}
+
static void
do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{