[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5908 - in GNUnet/src/applications/dht: module tools
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5908 - in GNUnet/src/applications/dht: module tools |
Date: |
Sat, 15 Dec 2007 02:44:06 -0700 (MST) |
Author: grothoff
Date: 2007-12-15 02:44:05 -0700 (Sat, 15 Dec 2007)
New Revision: 5908
Modified:
GNUnet/src/applications/dht/module/table.c
GNUnet/src/applications/dht/tools/dhttest.c
Log:
stuff
Modified: GNUnet/src/applications/dht/module/table.c
===================================================================
--- GNUnet/src/applications/dht/module/table.c 2007-12-15 09:30:55 UTC (rev
5907)
+++ GNUnet/src/applications/dht/module/table.c 2007-12-15 09:44:05 UTC (rev
5908)
@@ -359,8 +359,8 @@
unsigned int ec;
unsigned int i;
int match;
- PeerBucket *bucket;
- PeerInfo *pi;
+ const PeerBucket *bucket;
+ const PeerInfo *pi;
GNUNET_mutex_lock (lock);
if (stats != NULL)
Modified: GNUnet/src/applications/dht/tools/dhttest.c
===================================================================
--- GNUnet/src/applications/dht/tools/dhttest.c 2007-12-15 09:30:55 UTC (rev
5907)
+++ GNUnet/src/applications/dht/tools/dhttest.c 2007-12-15 09:44:05 UTC (rev
5908)
@@ -31,9 +31,17 @@
#include "gnunet_stats_lib.h"
#include "gnunet_util.h"
-#define NUM_PEERS 12
+/**
+ * How many peers should the testcase run? Note that
+ * we create a clique topology so the cost is quadratic!
+ */
+#define NUM_PEERS 8
-#define NUM_ROUNDS 4
+/**
+ * How many times will we try the DHT-GET operation before
+ * giving up for good?
+ */
+#define NUM_ROUNDS 10
static int ok;
@@ -102,34 +110,34 @@
}
}
- /* wait for some DHT's to find each other! */
- sock = GNUNET_client_connection_create (NULL, cfg);
- left = 30; /* how many iterations should we wait? */
- while (GNUNET_OK ==
- GNUNET_STATS_get_statistics (NULL, sock, &waitForConnect, NULL))
- {
- printf ("Waiting for peers to DHT-connect (%u iterations left)...\n",
- left);
- sleep (5);
- left--;
- if (left == 0)
- break;
- }
- GNUNET_client_connection_destroy (sock);
- if (ok == 0)
- {
- GNUNET_TESTING_stop_daemons (peers);
- fprintf (stderr, "Peers' DHTs failed to DHT-connect!\n");
- GNUNET_GC_free (cfg);
- return -1;
- }
-
/* put loop */
for (i = 0; i < NUM_PEERS; i++)
{
GNUNET_snprintf (buf, 128, "localhost:%u", 2087 + i * 10);
GNUNET_GC_set_configuration_value_string (cfg, ectx, "NETWORK", "HOST",
buf);
+ /* wait for some DHT's to find each other! */
+ sock = GNUNET_client_connection_create (NULL, cfg);
+ left = 30; /* how many iterations should we wait? */
+ while (GNUNET_OK ==
+ GNUNET_STATS_get_statistics (NULL, sock, &waitForConnect, NULL))
+ {
+ printf ("Waiting for peer to DHT-connect (%u iterations left)...\n",
+ left);
+ sleep (5);
+ left--;
+ if (left == 0)
+ break;
+ }
+ GNUNET_client_connection_destroy (sock);
+ if (ok == 0)
+ {
+ GNUNET_TESTING_stop_daemons (peers);
+ fprintf (stderr, "Peers' DHTs failed to DHT-connect!\n");
+ GNUNET_GC_free (cfg);
+ return -1;
+ }
+
GNUNET_hash (buf, 4, &key);
value = GNUNET_malloc (8);
value->size = ntohl (8);
@@ -139,42 +147,48 @@
&key,
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
value));
+ GNUNET_free(value);
}
- /* get loops */
- for (k = 0; k < NUM_ROUNDS; k++)
+ /* get loop */
+ found = 0;
+ for (i = 0; i < NUM_PEERS; i++)
{
- found = 0;
- for (i = 0; i < NUM_PEERS; i++)
- {
- GNUNET_snprintf (buf, 128, "localhost:%u", 2087 + i * 10);
- GNUNET_GC_set_configuration_value_string (cfg,
- ectx, "NETWORK", "HOST",
- buf);
- for (j = 0; j < NUM_PEERS; j++)
- {
- GNUNET_snprintf (buf, 128, "localhost:%u", 2087 + j * 10);
- GNUNET_hash (buf, 4, &key);
- fprintf (stderr, "Peer %d gets key %d", i, j);
- if (0 < GNUNET_DHT_get (cfg,
- ectx,
- GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
- &key,
- (NUM_ROUNDS - k) * GNUNET_CRON_SECONDS,
- NULL, NULL))
- {
- fprintf (stderr, " - found!\n");
- found++;
- }
- else
- fprintf (stderr, " - NOT found!\n");
- }
+ GNUNET_snprintf (buf, 128, "localhost:%u", 2087 + i * 10);
+ GNUNET_GC_set_configuration_value_string (cfg,
+ ectx, "NETWORK", "HOST",
+ buf);
+ for (j = 0; j < NUM_PEERS; j++)
+ {
+ GNUNET_snprintf (buf, 128, "localhost:%u", 2087 + j * 10);
+ GNUNET_hash (buf, 4, &key);
+ fprintf (stderr, "Peer %d gets key %d", i, j);
+ for (k = 0; k < NUM_ROUNDS; k++)
+ {
+ fprintf (stderr, ".");
+ if (0 < GNUNET_DHT_get (cfg,
+ ectx,
+ GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+ &key,
+ 15 * GNUNET_CRON_SECONDS,
+ NULL, NULL))
+ break;
+ }
+ if (k < NUM_ROUNDS)
+ {
+ fprintf (stderr, "!\n");
+ found++;
+ }
+ else
+ {
+ fprintf (stderr, "?\n");
+ }
}
- /* end of actual test code */
- fprintf (stderr,
- "Found %u out of %u attempts in round %u.\n",
- found, NUM_PEERS * NUM_PEERS, k);
}
+ /* end of actual test code */
+ fprintf (stderr,
+ "Found %u out of %u attempts.\n",
+ found, NUM_PEERS * NUM_PEERS);
FAILURE:
GNUNET_TESTING_stop_daemons (peers);
GNUNET_GC_free (cfg);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5908 - in GNUnet/src/applications/dht: module tools,
gnunet <=