gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r21542 - gnunet/src/dht


From: gnunet
Subject: [GNUnet-SVN] r21542 - gnunet/src/dht
Date: Fri, 18 May 2012 07:34:34 +0200

Author: grothoff
Date: 2012-05-18 07:34:34 +0200 (Fri, 18 May 2012)
New Revision: 21542

Modified:
   gnunet/src/dht/test_dht_monitor.c
   gnunet/src/dht/test_dht_multipeer.c
   gnunet/src/dht/test_dht_topo.c
   gnunet/src/dht/test_dht_twopeer.c
   gnunet/src/dht/test_dht_twopeer_get_put.c
   gnunet/src/dht/test_dht_twopeer_put_get.c
Log:
-code cleanup

Modified: gnunet/src/dht/test_dht_monitor.c
===================================================================
--- gnunet/src/dht/test_dht_monitor.c   2012-05-17 15:48:17 UTC (rev 21541)
+++ gnunet/src/dht/test_dht_monitor.c   2012-05-18 05:34:34 UTC (rev 21542)
@@ -31,8 +31,6 @@
 #include "gnunet_testing_lib.h"
 #include "gnunet_dht_service.h"
 
-#define VERBOSE GNUNET_YES
-
 #define REMOVE_DIR GNUNET_YES
 
 
@@ -137,17 +135,14 @@
 {
   if (emsg != NULL)
   {
-#if VERBOSE
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Shutdown of peers failed!\n");
-#endif
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "test: Shutdown of peers failed: 
%s\n",
+               emsg);
     ok++;
   }
   else
   {
-#if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "test: All peers successfully shut down!\n");
-#endif
   }
   GNUNET_CONFIGURATION_destroy (testing_cfg);
 }
@@ -156,16 +151,12 @@
 static void
 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-#if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Ending test.\n");
-#endif
-
   if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
   {
     GNUNET_SCHEDULER_cancel (disconnect_task);
     disconnect_task = GNUNET_SCHEDULER_NO_TASK;
   }
-
   if (data_file != NULL)
     GNUNET_DISK_file_close (data_file);
   GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
@@ -448,15 +439,9 @@
     GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
     return;
   }
-#if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              
"************************************************************\n");
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: Peer Group started successfully!\n");
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Have %u connections\n",
+              "test: Peer Group started successfully with %u connections\n",
               total_connections);
-#endif
-
   if (data_file != NULL)
   {
     buf = NULL;
@@ -564,19 +549,12 @@
   testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
 
   GNUNET_log_setup ("test_dht_monitor",
-#if VERBOSE
-                    "DEBUG",
-#else
                     "WARNING",
-#endif
                     NULL);
 
-#if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Starting daemons.\n");
   GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing",
                                          "use_progressbars", "YES");
-#endif
-
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing",
                                              "num_peers", &num_peers))
@@ -664,9 +642,6 @@
   char *const argv[] = { "test-dht-monitor",
     "-c",
     "test_dht_line.conf",
-#if VERBOSE
-    "-L", "DEBUG",
-#endif
     NULL
   };
 

Modified: gnunet/src/dht/test_dht_multipeer.c
===================================================================
--- gnunet/src/dht/test_dht_multipeer.c 2012-05-17 15:48:17 UTC (rev 21541)
+++ gnunet/src/dht/test_dht_multipeer.c 2012-05-18 05:34:34 UTC (rev 21542)
@@ -27,9 +27,6 @@
 #include "gnunet_core_service.h"
 #include "gnunet_dht_service.h"
 
-/* DEFINES */
-#define VERBOSE GNUNET_NO
-
 /* Timeout for entire testcase */
 #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 30)
 
@@ -658,10 +655,9 @@
   unsigned long long j;
   struct TestGetContext *test_get;
 
-#if VERBOSE
-  FPRINTF (stderr, "Issuing %llu GETs\n",
-           (unsigned long long) (num_peers * num_peers));
-#endif
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Issuing %llu GETs\n",
+             (unsigned long long) (num_peers * num_peers));
   for (i = 0; i < num_peers; i++)
     for (j = 0; j < num_peers; j++)
     {
@@ -719,10 +715,9 @@
   test_put->dht_handle = GNUNET_DHT_connect (test_put->daemon->cfg, 10);
   GNUNET_assert (test_put->dht_handle != NULL);
   outstanding_puts++;
-#if VERBOSE > 2
-  FPRINTF (stderr, "PUT %u at `%s'\n", test_put->uid,
-           GNUNET_i2s (&test_put->daemon->id));
-#endif
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "PUT %u at `%s'\n", test_put->uid,
+             GNUNET_i2s (&test_put->daemon->id));
   GNUNET_DHT_put (test_put->dht_handle, &key, 1, route_option,
                   GNUNET_BLOCK_TYPE_TEST, sizeof (data), data,
                   GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_FOREVER_REL,
@@ -822,9 +817,6 @@
   char *const argv[] = { "test-dht-multipeer",  /* Name to give running binary 
*/
     "-c",
     "test_dht_multipeer_data.conf",     /* Config file to use */
-#if VERBOSE
-    "-L", "DEBUG",
-#endif
     NULL
   };
   struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -848,13 +840,8 @@
 {
   int ret;
 
-
   GNUNET_log_setup ("test-dht-multipeer",
-#if VERBOSE
-                    "DEBUG",
-#else
                     "WARNING",
-#endif
                     NULL);
   ret = check ();
   /**

Modified: gnunet/src/dht/test_dht_topo.c
===================================================================
--- gnunet/src/dht/test_dht_topo.c      2012-05-17 15:48:17 UTC (rev 21541)
+++ gnunet/src/dht/test_dht_topo.c      2012-05-18 05:34:34 UTC (rev 21542)
@@ -30,8 +30,6 @@
 #include "gnunet_testing_lib.h"
 #include "gnunet_dht_service.h"
 
-#define VERBOSE GNUNET_NO
-
 #define REMOVE_DIR GNUNET_YES
 
 /**
@@ -401,15 +399,9 @@
     GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
     return;
   }
-#if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              
"************************************************************\n");
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Peer Group started successfully!\n");
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Have %u connections\n",
+              "Peer Group started successfully with %u connections\n",
               total_connections);
-#endif
-
   if (data_file != NULL)
   {
     buf = NULL;
@@ -493,19 +485,11 @@
   testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
 
   GNUNET_log_setup ("test_dht_topo",
-#if VERBOSE
-                    "DEBUG",
-#else
                     "WARNING",
-#endif
                     NULL);
-
-#if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n");
   GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing",
                                          "use_progressbars", "YES");
-#endif
-
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing",
                                              "num_peers", &num_peers))
@@ -593,17 +577,11 @@
   char *const argv_torus[] = { "test-dht-2dtorus",
     "-c",
     "test_dht_2dtorus.conf",
-#if VERBOSE
-    "-L", "DEBUG",
-#endif
     NULL
   };
   char *const argv_line[] = { "test-dht-line",
     "-c",
     "test_dht_line.conf",
-#if VERBOSE
-    "-L", "DEBUG",
-#endif
     NULL
   };
   char *const *argv;

Modified: gnunet/src/dht/test_dht_twopeer.c
===================================================================
--- gnunet/src/dht/test_dht_twopeer.c   2012-05-17 15:48:17 UTC (rev 21541)
+++ gnunet/src/dht/test_dht_twopeer.c   2012-05-18 05:34:34 UTC (rev 21542)
@@ -306,7 +306,6 @@
   if (emsg == NULL)
   {
     total_connections++;
-#if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "connected peer %s to peer %s, distance %u\n",
                 first_daemon->shortname, second_daemon->shortname, distance);
@@ -314,19 +313,16 @@
   else
   {
     failed_connections++;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "Failed to connect peer %s to peer %s with error :\n%s\n",
                 first_daemon->shortname, second_daemon->shortname, emsg);
-#endif
   }
 
   if (total_connections == expected_connections)
   {
-#if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Created %d total connections, which is our target number!  
Starting next phase of testing.\n",
                 total_connections);
-#endif
     GNUNET_SCHEDULER_cancel (die_task);
     die_task =
         GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
@@ -409,10 +405,8 @@
 
   if (peers_left == 0)
   {
-#if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "All %d daemons started, now connecting peers!\n", num_peers);
-#endif
     GNUNET_SCHEDULER_cancel (die_task);
     /* Set up task in case topology creation doesn't finish
      * within a reasonable amount of time */
@@ -466,9 +460,6 @@
   char *const argv[] = { "test-dht-twopeer",
     "-c",
     "test_dht_twopeer_data.conf",
-#if VERBOSE
-    "-L", "DEBUG",
-#endif
     NULL
   };
   struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -491,11 +482,7 @@
   int ret;
 
   GNUNET_log_setup ("test-dht-twopeer",
-#if VERBOSE
-                    "DEBUG",
-#else
                     "WARNING",
-#endif
                     NULL);
   ret = check ();
   /**

Modified: gnunet/src/dht/test_dht_twopeer_get_put.c
===================================================================
--- gnunet/src/dht/test_dht_twopeer_get_put.c   2012-05-17 15:48:17 UTC (rev 
21541)
+++ gnunet/src/dht/test_dht_twopeer_get_put.c   2012-05-18 05:34:34 UTC (rev 
21542)
@@ -391,29 +391,23 @@
   if (emsg == NULL)
   {
     total_connections++;
-#if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "connected peer %s to peer %s, distance %u\n",
                 first_daemon->shortname, second_daemon->shortname, distance);
-#endif
   }
-#if VERBOSE
   else
   {
     failed_connections++;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "Failed to connect peer %s to peer %s with error :\n%s\n",
                 first_daemon->shortname, second_daemon->shortname, emsg);
   }
-#endif
 
   if (total_connections == expected_connections)
   {
-#if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Created %d total connections, which is our target number!  
Starting next phase of testing.\n",
                 total_connections);
-#endif
     GNUNET_SCHEDULER_cancel (die_task);
     die_task =
         GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, "from test gets");
@@ -482,10 +476,8 @@
 
   if (peers_left == 0)          /* Indicates all peers started */
   {
-#if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "All %d daemons started, now connecting peers!\n", num_peers);
-#endif
     expected_connections = -1;
     if ((pg != NULL))           /* Sanity check */
     {
@@ -556,9 +548,6 @@
   char *const argv[] = { "test-dht-twopeer-get-put",    /* Name to give 
running binary */
     "-c",
     "test_dht_twopeer_data.conf",       /* Config file to use */
-#if VERBOSE
-    "-L", "DEBUG",
-#endif
     NULL
   };
   struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -583,11 +572,7 @@
   int ret;
 
   GNUNET_log_setup ("test-dht-twopeer",
-#if VERBOSE
-                    "DEBUG",
-#else
                     "WARNING",
-#endif
                     NULL);
   ret = check ();
   /**

Modified: gnunet/src/dht/test_dht_twopeer_put_get.c
===================================================================
--- gnunet/src/dht/test_dht_twopeer_put_get.c   2012-05-17 15:48:17 UTC (rev 
21541)
+++ gnunet/src/dht/test_dht_twopeer_put_get.c   2012-05-18 05:34:34 UTC (rev 
21542)
@@ -312,29 +312,23 @@
   if (emsg == NULL)
   {
     total_connections++;
-#if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "connected peer %s to peer %s, distance %u\n",
                 first_daemon->shortname, second_daemon->shortname, distance);
-#endif
   }
-#if VERBOSE
   else
   {
     failed_connections++;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "Failed to connect peer %s to peer %s with error :\n%s\n",
                 first_daemon->shortname, second_daemon->shortname, emsg);
   }
-#endif
 
   if (total_connections == expected_connections)
   {
-#if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Created %d total connections, which is our target number!  
Starting next phase of testing.\n",
                 total_connections);
-#endif
     GNUNET_SCHEDULER_cancel (die_task);
     die_task =
         GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, "from test gets");
@@ -402,10 +396,8 @@
 
   if (peers_left == 0)          /* Indicates all peers started */
   {
-#if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "All %d daemons started, now connecting peers!\n", num_peers);
-#endif
     expected_connections = -1;
     if ((pg != NULL))           /* Sanity check */
     {
@@ -476,9 +468,6 @@
   char *const argv[] = { "test-dht-twopeer-put-get",    /* Name to give 
running binary */
     "-c",
     "test_dht_twopeer_data.conf",       /* Config file to use */
-#if VERBOSE
-    "-L", "DEBUG",
-#endif
     NULL
   };
   struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -503,11 +492,7 @@
   int ret;
 
   GNUNET_log_setup ("test-dht-twopeer",
-#if VERBOSE
-                    "DEBUG",
-#else
                     "WARNING",
-#endif
                     NULL);
   ret = check ();
   /**




reply via email to

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