gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r6873 - GNUnet/src/applications/dht/tools


From: gnunet
Subject: [GNUnet-SVN] r6873 - GNUnet/src/applications/dht/tools
Date: Fri, 23 May 2008 23:26:39 -0600 (MDT)

Author: grothoff
Date: 2008-05-23 23:26:39 -0600 (Fri, 23 May 2008)
New Revision: 6873

Modified:
   GNUnet/src/applications/dht/tools/dht_twopeer_test.c
Log:
nicer

Modified: GNUnet/src/applications/dht/tools/dht_twopeer_test.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_twopeer_test.c        2008-05-24 
05:16:51 UTC (rev 6872)
+++ GNUnet/src/applications/dht/tools/dht_twopeer_test.c        2008-05-24 
05:26:39 UTC (rev 6873)
@@ -96,17 +96,19 @@
 
   /* wait for DHT's to find each other! */
   sock = GNUNET_client_connection_create (NULL, cfg);
-  left = 60;                    /* how many iterations should we wait? */
+  left = 10;                    /* how many iterations should we wait? */
+  printf ("Waiting for peers to DHT-connect (1->2)");  
   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);
+      printf (".");
+      fflush(stdout);
+      sleep (2);
       left--;
       if (left == 0)
         break;
     }
+  printf (left > 0 ? " OK!\n" : "?\n");
   GNUNET_client_connection_destroy (sock);
   if (ok == 0)
     {
@@ -124,17 +126,19 @@
   /* verify that peer2 also sees the other DHT! */
   ok = 0;
   sock = GNUNET_client_connection_create (NULL, cfg);
-  left = 60;                    /* how many iterations should we wait? */
+  left = 10;                    /* how many iterations should we wait? */
+  printf ("Waiting for peers to DHT-connect (2->1)");  
   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);
+      printf (".");
+      fflush(stdout);
+      sleep (2);
       left--;
       if (left == 0)
         break;
     }
+  printf (left > 0 ? " OK!\n" : "?\n");
   GNUNET_client_connection_destroy (sock);
   if (ok == 0)
     {
@@ -145,27 +149,20 @@
     }
 
 
+  /* actual test code */
   /* switch to peer1 */
   GNUNET_GC_set_configuration_value_string (cfg,
                                             ectx,
                                             "NETWORK", "HOST",
                                             "localhost:2087");
-
-  /* actual test code */
   GNUNET_hash ("key2", 4, &key);
   value = GNUNET_malloc (8);
   memset (value, 'A', 8);
-  printf ("Peer1 stores key2\n");
   CHECK (GNUNET_OK == GNUNET_DHT_put (cfg,
                                       ectx,
                                       &key,
                                       GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
                                       8, value));
-  printf ("Peer1 gets key2\n");
-  CHECK (1 == GNUNET_DHT_get (cfg,
-                              ectx,
-                              GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                              &key, 10 * GNUNET_CRON_SECONDS, NULL, NULL));
   /* switch to peer2 */
   GNUNET_GC_set_configuration_value_string (cfg,
                                             ectx,
@@ -174,20 +171,14 @@
   GNUNET_hash ("key", 3, &key);
   value = GNUNET_malloc (8);
   memset (value, 'B', 8);
-  printf ("Peer2 stores key.\n");
   CHECK (GNUNET_OK == GNUNET_DHT_put (cfg,
                                       ectx,
                                       &key,
                                       GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
                                       8, value));
-  printf ("Peer2 gets key.\n");
-  CHECK (1 == GNUNET_DHT_get (cfg,
-                              ectx,
-                              GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                              &key, 10 * GNUNET_CRON_SECONDS, NULL, NULL));
   GNUNET_hash ("key2", 4, &key);
-  printf ("Peer2 gets key2");
   left = 10;
+  printf("Getting key 2 from peer 2 (stored at peer 1)");
   do
     {
       printf (".");
@@ -195,12 +186,12 @@
       if (1 == GNUNET_DHT_get (cfg,
                                ectx,
                                GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                               &key, 15 * GNUNET_CRON_SECONDS, NULL, NULL))
+                               &key, 2 * GNUNET_CRON_SECONDS, NULL, NULL))
         break;
       left--;
     }
   while (left > 0);
-  printf (left > 0 ? "!\n" : "?\n");
+  printf (left > 0 ? " OK!\n" : "?\n");
 
   CHECK (left > 0);
   /* switch to peer1 */
@@ -208,7 +199,7 @@
                                             ectx,
                                             "NETWORK", "HOST",
                                             "localhost:2087");
-  printf ("Peer1 gets key");
+  printf("Getting key 1 from peer 1 (stored at peer 2)");
   left = 10;
   do
     {
@@ -217,12 +208,12 @@
       if (1 == GNUNET_DHT_get (cfg,
                                ectx,
                                GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                               &key, 15 * GNUNET_CRON_SECONDS, NULL, NULL))
+                               &key, 2 * GNUNET_CRON_SECONDS, NULL, NULL))
         break;
       left--;
     }
   while (left > 0);
-  printf (left > 0 ? "!\n" : "?\n");
+  printf (left > 0 ? " OK!\n" : "?\n");
   CHECK (left > 0);
   /* end of actual test code */
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]