*/
static unsigned int paper_forwarding;
+/**
+ * PUT Peer Identities of peers we know about into
+ * the datacache.
+ */
+static unsigned int put_peer_identities;
+
/**
* Use the "real" distance metric when selecting the
* next routing hop. Can be less accurate.
if (reply_times[i].rel_value > max_time.rel_value)
max_time.rel_value = reply_times[i].rel_value;
}
-
+#if DEBUG_DHT
if (max_time.rel_value > MAX_REQUEST_TIME.rel_value)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Max send delay was %llu\n",
(unsigned long long) max_time.rel_value);
+#endif
return max_time;
}
&peer->id.hashPubKey);
if (matching >= 64)
{
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Peer identifier matches by %u bits, only shifting as much as we can!\n",
matching);
+#endif
matching = 63;
}
preference = 1LL << matching;
for (i = 0; i < msg_ctx->path_history_len; i++)
{
path_offset = &msg_ctx->path_history[i * sizeof(struct GNUNET_PeerIdentity)];
+#if DEBUG_DHT > 1
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "(before client) Key %s Found peer %d:%s\n", GNUNET_h2s(&msg_ctx->key), i, GNUNET_i2s((struct GNUNET_PeerIdentity *)path_offset));
+#endif
}
send_reply_to_client (pos->client, msg, msg_ctx);
}
&msg_ctx->key, NULL,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
{
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Adding recent remove task for key `%s`!\n",
GNUNET_h2s (&msg_ctx->key));
+#endif
/* Only add a task if there wasn't one for this key already! */
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 30),
else
{
GNUNET_free (recent_hash);
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received duplicate find peer request too soon!\n");
+#endif
}
/* Simplistic find_peer functionality, always return our hello */
find_peer_result->type = htons (GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_RESULT);
find_peer_result->size = htons (tsize);
memcpy (&find_peer_result[1], my_hello, hello_size);
-
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"`%s': Sending hello size %d to requesting peer.\n",
"DHT", hello_size);
+#endif
new_msg_ctx = GNUNET_malloc (sizeof (struct DHT_MessageContext));
memcpy (new_msg_ctx, msg_ctx, sizeof (struct DHT_MessageContext));
GNUNET_CONTAINER_multihashmap_contains (all_known_peers,
&peer->hashPubKey))
{
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"%s:%s Received %s message for peer %s, but already have peer in RT!",
my_short_id, "DHT", "CORE CONNECT", GNUNET_i2s (peer));
+#endif
return;
}
- if (datacache != NULL)
+ if ((datacache != NULL) && (GNUNET_YES == put_peer_identities))
{
put_entry = GNUNET_malloc(sizeof(struct DHTPutEntry) + sizeof (struct GNUNET_PeerIdentity));
put_entry->path_length = 0;
/* Check for disconnect from self message */
if (0 == memcmp(&my_identity, peer, sizeof(struct GNUNET_PeerIdentity)))
return;
-
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"%s:%s: Received peer disconnect message for peer `%s' from %s\n",
my_short_id, "DHT", GNUNET_i2s (peer), "CORE");
+#endif
if (GNUNET_YES !=
GNUNET_CONTAINER_multihashmap_contains (all_known_peers,
&peer->hashPubKey))
{
+#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"%s:%s: do not have peer `%s' in RT, can't disconnect!\n",
my_short_id, "DHT", GNUNET_i2s (peer));
+#endif
return;
}
increment_stats (STAT_DISCONNECTS);
GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", "paper_forwarding"))
paper_forwarding = GNUNET_YES;
+ if (GNUNET_YES ==
+ GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", "put_peer_identities"))
+ put_peer_identities = GNUNET_YES;
+
stats = GNUNET_STATISTICS_create ("dht", cfg);
if (stats != NULL)