[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24951 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24951 - gnunet/src/dht |
Date: |
Wed, 14 Nov 2012 14:05:28 +0100 |
Author: grothoff
Date: 2012-11-14 14:05:28 +0100 (Wed, 14 Nov 2012)
New Revision: 24951
Modified:
gnunet/src/dht/gnunet-service-dht_neighbours.c
Log:
-extra logging, minor code cleanup
Modified: gnunet/src/dht/gnunet-service-dht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_neighbours.c 2012-11-14 13:03:21 UTC
(rev 24950)
+++ gnunet/src/dht/gnunet-service-dht_neighbours.c 2012-11-14 13:05:28 UTC
(rev 24951)
@@ -94,7 +94,12 @@
*/
#define GET_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 2)
+/**
+ * Should routing details be logged to stderr (for debugging)?
+ */
+#define LOG_ROUTE_DETAILS_STDERR GNUNET_NO
+
GNUNET_NETWORK_STRUCT_BEGIN
/**
@@ -816,7 +821,7 @@
return;
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop
- ("# Bytes of bandwdith requested from core"),
+ ("# Bytes of bandwidth requested from core"),
ntohs (pending->msg->size), GNUNET_NO);
peer->th =
GNUNET_CORE_notify_transmit_ready (coreAPI, GNUNET_YES,
@@ -1090,19 +1095,16 @@
count = 0;
for (bc = 0; bc <= closest_bucket; bc++)
{
- pos = k_buckets[bc].head;
- while ((pos != NULL) && (count < bucket_size))
+ for (pos = k_buckets[bc].head; ((pos != NULL) && (count < bucket_size));
pos = pos->next)
{
if ((bloom != NULL) &&
(GNUNET_YES ==
GNUNET_CONTAINER_bloomfilter_test (bloom, &pos->id.hashPubKey)))
{
- pos = pos->next;
continue; /* Ignore bloomfiltered peers */
}
if (0 == selected--)
return pos;
- pos = pos->next;
}
}
GNUNET_break (0);
@@ -1124,7 +1126,7 @@
* @return number of peers returned in 'targets'.
*/
static unsigned int
-get_target_peers (const struct GNUNET_HashCode * key,
+get_target_peers (const struct GNUNET_HashCode *key,
struct GNUNET_CONTAINER_BloomFilter *bloom,
uint32_t hop_count, uint32_t target_replication,
struct PeerInfo ***targets)
@@ -1135,7 +1137,7 @@
struct PeerInfo *nxt;
GNUNET_assert (NULL != bloom);
- ret = get_forward_count (hop_count, target_replication);
+ ret = get_forward_count (hop_count, target_replication);
if (ret == 0)
{
*targets = NULL;
@@ -1164,6 +1166,11 @@
return 0;
}
*targets = rtargets;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Forwarding query `%s' to %u peers (goal was %u peers)\n",
+ GNUNET_h2s (key),
+ off,
+ ret);
return off;
}
@@ -1585,6 +1592,17 @@
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "PUT for `%s' from %s\n",
GNUNET_h2s (&put->key), GNUNET_i2s (peer));
+
+ if (LOG_ROUTE_DETAILS_STDERR)
+ {
+ char *tmp;
+
+ tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
+ fprintf (stderr, "XDHT PUT %s: %s<-%s\n", GNUNET_h2s (&put->key), tmp,
GNUNET_i2s (peer));
+ GNUNET_free (tmp);
+ }
+
+
bf = GNUNET_CONTAINER_bloomfilter_init (put->bloomfilter, DHT_BLOOM_SIZE,
GNUNET_CONSTANTS_BLOOMFILTER_K);
GNUNET_break_op (GNUNET_YES ==
@@ -1832,6 +1850,17 @@
1, GNUNET_NO);
}
+ if (LOG_ROUTE_DETAILS_STDERR)
+ {
+ char *tmp;
+
+ tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
+ fprintf (stderr, "XDHT GET %s: %s<-%s\n", GNUNET_h2s (&get->key), tmp,
GNUNET_i2s (peer));
+ GNUNET_free (tmp);
+ }
+
+
+
/* FIXME Path */
GDS_CLIENTS_process_get (options,
type,
@@ -1954,6 +1983,16 @@
}
}
+
+ if (LOG_ROUTE_DETAILS_STDERR)
+ {
+ char *tmp;
+
+ tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
+ fprintf (stderr, "XDHT RESULT %s: %s<-%s\n", GNUNET_h2s (&prm->key), tmp,
GNUNET_i2s (peer));
+ GNUNET_free (tmp);
+ }
+
/* append 'peer' to 'get_path' */
{
struct GNUNET_PeerIdentity xget_path[get_path_length + 1];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24951 - gnunet/src/dht,
gnunet <=