[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17131 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17131 - gnunet/src/dht |
Date: |
Fri, 30 Sep 2011 03:06:19 +0200 |
Author: grothoff
Date: 2011-09-30 03:06:19 +0200 (Fri, 30 Sep 2011)
New Revision: 17131
Modified:
gnunet/src/dht/dht.h
gnunet/src/dht/gnunet-service-dht_neighbours.c
gnunet/src/dht/test_dht_multipeer.c
Log:
re-add logging, move BF add operations to the latest possible time to avoid
polluting tests needlessly
Modified: gnunet/src/dht/dht.h
===================================================================
--- gnunet/src/dht/dht.h 2011-09-30 01:05:11 UTC (rev 17130)
+++ gnunet/src/dht/dht.h 2011-09-30 01:06:19 UTC (rev 17131)
@@ -31,7 +31,7 @@
/**
* Size of the bloom filter the DHT uses to filter peers.
*/
-#define DHT_BLOOM_SIZE 128
+#define DHT_BLOOM_SIZE 1024
/**
Modified: gnunet/src/dht/gnunet-service-dht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_neighbours.c 2011-09-30 01:05:11 UTC
(rev 17130)
+++ gnunet/src/dht/gnunet-service-dht_neighbours.c 2011-09-30 01:06:19 UTC
(rev 17131)
@@ -640,6 +640,10 @@
/* Check for connect to self message */
if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity)))
return;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Connected %s to %s\n",
+ GNUNET_i2s (&my_identity),
+ GNUNET_h2s (&peer->hashPubKey));
if (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_contains (all_known_peers,
&peer->hashPubKey))
@@ -698,6 +702,10 @@
/* Check for disconnect from self message */
if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity)))
return;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Disconnected %s from %s\n",
+ GNUNET_i2s (&my_identity),
+ GNUNET_h2s (&peer->hashPubKey));
to_remove =
GNUNET_CONTAINER_multihashmap_get (all_known_peers, &peer->hashPubKey);
if (NULL == to_remove)
@@ -1022,9 +1030,10 @@
count = 0;
while ((pos != NULL) && (count < bucket_size))
{
- if (GNUNET_NO ==
- GNUNET_CONTAINER_bloomfilter_test (bloom, &pos->id.hashPubKey))
- {
+ if ( (bloom == NULL) ||
+ (GNUNET_NO ==
+ GNUNET_CONTAINER_bloomfilter_test (bloom, &pos->id.hashPubKey)) )
+ {
dist = get_distance (key, &pos->id.hashPubKey);
if (dist < smallest_distance)
{
@@ -1033,7 +1042,11 @@
}
}
else
- {
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Excluded peer `%s' due to BF match in greedy routing for
%s\n",
+ GNUNET_i2s (&pos->id),
+ GNUNET_h2s (key));
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# Peers excluded from
routing due to Bloomfilter"), 1,
GNUNET_NO);
@@ -1064,6 +1077,10 @@
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# Peers excluded from routing
due to Bloomfilter"), 1,
GNUNET_NO);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Excluded peer `%s' due to BF match in random routing for
%s\n",
+ GNUNET_i2s (&pos->id),
+ GNUNET_h2s (key));
pos = pos->next;
continue; /* Ignore bloomfiltered peers */
}
@@ -1144,8 +1161,15 @@
rtargets[off] = nxt;
GNUNET_break (GNUNET_NO ==
GNUNET_CONTAINER_bloomfilter_test (bloom,
&nxt->id.hashPubKey));
- GNUNET_CONTAINER_bloomfilter_add (bloom, &nxt->id.hashPubKey);
}
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Selected %u/%u peers at hop %u for %s (target was %u)\n",
+ off,
+ GNUNET_CONTAINER_multihashmap_size (all_known_peers),
+ (unsigned int) hop_count,
+ GNUNET_h2s (key),
+ ret);
+
if (0 == off)
{
GNUNET_free (rtargets);
@@ -1153,6 +1177,8 @@
return 0;
}
*targets = rtargets;
+ for (ret = 0; ret < off; ret++)
+ GNUNET_CONTAINER_bloomfilter_add (bloom, &rtargets[ret].hashPubKey);
return off;
}
@@ -1207,7 +1233,12 @@
desired_replication_level,
&targets);
if (0 == target_count)
- {
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Routing PUT for %s terminates after %u hops at %s\n",
+ GNUNET_h2s (key),
+ (unsigned int) hop_count,
+ GNUNET_i2s (&my_identity));
return;
}
msize = put_path_length * sizeof (struct GNUNET_PeerIdentity) + data_size +
sizeof (struct PeerPutMessage);
@@ -1227,6 +1258,11 @@
for (i=0;i<target_count;i++)
{
target = targets[i];
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Routing PUT for %s after %u hops to %s\n",
+ GNUNET_h2s (key),
+ (unsigned int) hop_count,
+ GNUNET_i2s (&target->id));
pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize);
pending->importance = 0; /* FIXME */
pending->timeout = expiration_time;
@@ -1299,15 +1335,20 @@
size_t reply_bf_size;
GNUNET_assert (NULL != peer_bf);
- GNUNET_CONTAINER_bloomfilter_add (peer_bf, &my_identity.hashPubKey);
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# GET requests routed"), 1,
GNUNET_NO);
target_count = get_target_peers (key, peer_bf, hop_count,
desired_replication_level,
&targets);
+ GNUNET_CONTAINER_bloomfilter_add (peer_bf, &my_identity.hashPubKey);
if (0 == target_count)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Routing GET for %s terminates after %u hops at %s\n",
+ GNUNET_h2s (key),
+ (unsigned int) hop_count,
+ GNUNET_i2s (&my_identity));
return;
}
reply_bf_size = GNUNET_CONTAINER_bloomfilter_get_size (reply_bf);
@@ -1324,6 +1365,11 @@
for (i=0;i<target_count;i++)
{
target = targets[i];
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Routing GET for %s after %u hops to %s\n",
+ GNUNET_h2s (key),
+ (unsigned int) hop_count,
+ GNUNET_i2s (&target->id));
pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize);
pending->importance = 0; /* FIXME */
pending->timeout = GNUNET_TIME_relative_to_absolute (GET_TIMEOUT);
@@ -1527,6 +1573,10 @@
/* cannot verify, good luck */
break;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "PUT for %s at %s\n",
+ GNUNET_h2s (&put->key),
+ GNUNET_i2s (&my_identity));
bf = GNUNET_CONTAINER_bloomfilter_init (put->bloomfilter,
DHT_BLOOM_SIZE,
GNUNET_CONSTANTS_BLOOMFILTER_K);
@@ -1757,12 +1807,16 @@
&get->key,
xquery, xquery_size,
reply_bf, get->bf_mutator);
-
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "GET for %s at %s after %u hops\n",
+ GNUNET_h2s (&get->key),
+ GNUNET_i2s (&my_identity),
+ (unsigned int) ntohl (get->hop_count));
/* local lookup (this may update the reply_bf) */
if ( (0 != (options & GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE)) ||
(am_closest_peer (&get->key,
peer_bf) ) )
- {
+ {
if ( (0 != (options & GNUNET_DHT_RO_FIND_PEER)))
{
GNUNET_STATISTICS_update (GDS_stats,
Modified: gnunet/src/dht/test_dht_multipeer.c
===================================================================
--- gnunet/src/dht/test_dht_multipeer.c 2011-09-30 01:05:11 UTC (rev 17130)
+++ gnunet/src/dht/test_dht_multipeer.c 2011-09-30 01:06:19 UTC (rev 17131)
@@ -36,6 +36,9 @@
/* Timeout for waiting for replies to get requests */
#define GET_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 60)
+/* */
+#define START_DELAY GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 60)
+
/* Timeout for waiting for gets to complete */
#define GET_DELAY GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS,
50)
@@ -554,35 +557,16 @@
}
-
-/**
- * This function is called once testing has finished setting up the topology.
- *
- * @param cls unused
- * @param emsg variable is NULL on success (peers connected), and non-NULL on
- * failure (peers failed to connect).
- */
static void
-run_dht_test (void *cls, const char *emsg)
-{
+run_dht_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
unsigned long long i;
struct TestPutContext *test_put;
- if (emsg != NULL)
- {
- fprintf (stderr,
- "Failed to setup topology: %s\n",
- emsg);
- die_task =
- GNUNET_SCHEDULER_add_now (&end_badly,
- "topology setup failed");
- return;
- }
-
#if PATH_TRACKING
route_option = GNUNET_DHT_RO_RECORD_ROUTE |
GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE;
#else
- route_option = GNUNET_DHT_RO_NONE | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE;
+ route_option = GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE;
#endif
die_task =
GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
@@ -603,7 +587,33 @@
}
+/**
+ * This function is called once testing has finished setting up the topology.
+ *
+ * @param cls unused
+ * @param emsg variable is NULL on success (peers connected), and non-NULL on
+ * failure (peers failed to connect).
+ */
static void
+startup_done (void *cls, const char *emsg)
+{
+ if (emsg != NULL)
+ {
+ fprintf (stderr,
+ "Failed to setup topology: %s\n",
+ emsg);
+ die_task =
+ GNUNET_SCHEDULER_add_now (&end_badly,
+ "topology setup failed");
+ return;
+ }
+ die_task =
+ GNUNET_SCHEDULER_add_delayed (START_DELAY, &run_dht_test,
+ "from setup puts/gets");
+}
+
+
+static void
run (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
@@ -624,7 +634,7 @@
num_peers,
TIMEOUT,
NULL,
- &run_dht_test,
+ &startup_done,
NULL,
NULL);
GNUNET_assert (NULL != pg);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17131 - gnunet/src/dht,
gnunet <=