aboutsummaryrefslogtreecommitdiff
path: root/src/dht/test_dht_monitor.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-05-18 05:34:34 +0000
committerChristian Grothoff <christian@grothoff.org>2012-05-18 05:34:34 +0000
commit45a6c8033e511e2d3dc3f20cb62248c77ee90725 (patch)
treec6ee2c18875b6bd4f950e463f04dcee3db8d2937 /src/dht/test_dht_monitor.c
parent04630c5e40fc4de16393894d0b5ff2ca9055f4e2 (diff)
downloadgnunet-45a6c8033e511e2d3dc3f20cb62248c77ee90725.tar.gz
gnunet-45a6c8033e511e2d3dc3f20cb62248c77ee90725.zip
-code cleanup
Diffstat (limited to 'src/dht/test_dht_monitor.c')
-rw-r--r--src/dht/test_dht_monitor.c31
1 files changed, 3 insertions, 28 deletions
diff --git a/src/dht/test_dht_monitor.c b/src/dht/test_dht_monitor.c
index 62d1dcbde..62210e85c 100644
--- a/src/dht/test_dht_monitor.c
+++ b/src/dht/test_dht_monitor.c
@@ -31,8 +31,6 @@
31#include "gnunet_testing_lib.h" 31#include "gnunet_testing_lib.h"
32#include "gnunet_dht_service.h" 32#include "gnunet_dht_service.h"
33 33
34#define VERBOSE GNUNET_YES
35
36#define REMOVE_DIR GNUNET_YES 34#define REMOVE_DIR GNUNET_YES
37 35
38 36
@@ -137,17 +135,14 @@ shutdown_callback (void *cls, const char *emsg)
137{ 135{
138 if (emsg != NULL) 136 if (emsg != NULL)
139 { 137 {
140#if VERBOSE 138 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "test: Shutdown of peers failed: %s\n",
141 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Shutdown of peers failed!\n"); 139 emsg);
142#endif
143 ok++; 140 ok++;
144 } 141 }
145 else 142 else
146 { 143 {
147#if VERBOSE
148 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 144 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
149 "test: All peers successfully shut down!\n"); 145 "test: All peers successfully shut down!\n");
150#endif
151 } 146 }
152 GNUNET_CONFIGURATION_destroy (testing_cfg); 147 GNUNET_CONFIGURATION_destroy (testing_cfg);
153} 148}
@@ -156,16 +151,12 @@ shutdown_callback (void *cls, const char *emsg)
156static void 151static void
157shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 152shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
158{ 153{
159#if VERBOSE
160 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Ending test.\n"); 154 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Ending test.\n");
161#endif
162
163 if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) 155 if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
164 { 156 {
165 GNUNET_SCHEDULER_cancel (disconnect_task); 157 GNUNET_SCHEDULER_cancel (disconnect_task);
166 disconnect_task = GNUNET_SCHEDULER_NO_TASK; 158 disconnect_task = GNUNET_SCHEDULER_NO_TASK;
167 } 159 }
168
169 if (data_file != NULL) 160 if (data_file != NULL)
170 GNUNET_DISK_file_close (data_file); 161 GNUNET_DISK_file_close (data_file);
171 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); 162 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
@@ -448,15 +439,9 @@ peergroup_ready (void *cls, const char *emsg)
448 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); 439 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
449 return; 440 return;
450 } 441 }
451#if VERBOSE
452 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
453 "************************************************************\n");
454 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 442 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
455 "test: Peer Group started successfully!\n"); 443 "test: Peer Group started successfully with %u connections\n",
456 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Have %u connections\n",
457 total_connections); 444 total_connections);
458#endif
459
460 if (data_file != NULL) 445 if (data_file != NULL)
461 { 446 {
462 buf = NULL; 447 buf = NULL;
@@ -564,19 +549,12 @@ run (void *cls, char *const *args, const char *cfgfile,
564 testing_cfg = GNUNET_CONFIGURATION_dup (cfg); 549 testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
565 550
566 GNUNET_log_setup ("test_dht_monitor", 551 GNUNET_log_setup ("test_dht_monitor",
567#if VERBOSE
568 "DEBUG",
569#else
570 "WARNING", 552 "WARNING",
571#endif
572 NULL); 553 NULL);
573 554
574#if VERBOSE
575 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Starting daemons.\n"); 555 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Starting daemons.\n");
576 GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing", 556 GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing",
577 "use_progressbars", "YES"); 557 "use_progressbars", "YES");
578#endif
579
580 if (GNUNET_OK != 558 if (GNUNET_OK !=
581 GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing", 559 GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing",
582 "num_peers", &num_peers)) 560 "num_peers", &num_peers))
@@ -664,9 +642,6 @@ main (int xargc, char *xargv[])
664 char *const argv[] = { "test-dht-monitor", 642 char *const argv[] = { "test-dht-monitor",
665 "-c", 643 "-c",
666 "test_dht_line.conf", 644 "test_dht_line.conf",
667#if VERBOSE
668 "-L", "DEBUG",
669#endif
670 NULL 645 NULL
671 }; 646 };
672 647