aboutsummaryrefslogtreecommitdiff
path: root/src/nse/gnunet-nse-profiler.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-20 10:55:25 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-20 10:55:25 +0000
commit9d6fd1aba0f830853426f718061c859ea7ebad5f (patch)
tree619dc8bf9530b3e62ac8998ab8be60e8cdbe1365 /src/nse/gnunet-nse-profiler.c
parentace68a1c47140651fe78396be2f07bce725aad49 (diff)
downloadgnunet-9d6fd1aba0f830853426f718061c859ea7ebad5f.tar.gz
gnunet-9d6fd1aba0f830853426f718061c859ea7ebad5f.zip
-check misc return values
Diffstat (limited to 'src/nse/gnunet-nse-profiler.c')
-rw-r--r--src/nse/gnunet-nse-profiler.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c
index cf88690d5..19adb2064 100644
--- a/src/nse/gnunet-nse-profiler.c
+++ b/src/nse/gnunet-nse-profiler.c
@@ -182,17 +182,13 @@ shutdown_callback (void *cls, const char *emsg)
182{ 182{
183 if (emsg != NULL) 183 if (emsg != NULL)
184 { 184 {
185#if VERBOSE
186 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n"); 185 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n");
187#endif
188 if (ok == 0) 186 if (ok == 0)
189 ok = 666; 187 ok = 666;
190 } 188 }
191 else 189 else
192 { 190 {
193#if VERBOSE
194 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers successfully shut down!\n"); 191 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers successfully shut down!\n");
195#endif
196 ok = 0; 192 ok = 0;
197 } 193 }
198} 194}
@@ -203,10 +199,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
203{ 199{
204 struct NSEPeer *pos; 200 struct NSEPeer *pos;
205 201
206#if VERBOSE 202 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n");
207 FPRINTF (stderr, "%s", "Ending test.\n");
208#endif
209
210 if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) 203 if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
211 { 204 {
212 GNUNET_SCHEDULER_cancel (disconnect_task); 205 GNUNET_SCHEDULER_cancel (disconnect_task);
@@ -366,19 +359,15 @@ connect_nse_service (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
366 struct NSEPeer *current_peer; 359 struct NSEPeer *current_peer;
367 unsigned int i; 360 unsigned int i;
368 361
369#if VERBOSE
370 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to nse service of peers\n"); 362 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to nse service of peers\n");
371#endif
372 for (i = 0; i < num_peers; i++) 363 for (i = 0; i < num_peers; i++)
373 { 364 {
374 if ((connection_limit > 0) && 365 if ((connection_limit > 0) &&
375 (num_peers > connection_limit) && 366 (num_peers > connection_limit) &&
376 (i % (num_peers / connection_limit) != 0)) 367 (i % (num_peers / connection_limit) != 0))
377 continue; 368 continue;
378#if VERBOSE 369 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
379 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
380 "nse-profiler: connecting to nse service of peer %d\n", i); 370 "nse-profiler: connecting to nse service of peer %d\n", i);
381#endif
382 current_peer = GNUNET_malloc (sizeof (struct NSEPeer)); 371 current_peer = GNUNET_malloc (sizeof (struct NSEPeer));
383 current_peer->daemon = GNUNET_TESTING_daemon_get (pg, i); 372 current_peer->daemon = GNUNET_TESTING_daemon_get (pg, i);
384 if (GNUNET_YES == 373 if (GNUNET_YES ==
@@ -747,10 +736,8 @@ my_cb (void *cls, const char *emsg)
747 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); 736 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
748 return; 737 return;
749 } 738 }
750#if VERBOSE
751 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 739 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
752 "Peer Group started successfully, connecting to NSE service for each peer!\n"); 740 "Peer Group started successfully, connecting to NSE service for each peer!\n");
753#endif
754 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Have %u connections\n", 741 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Have %u connections\n",
755 total_connections); 742 total_connections);
756 if (data_file != NULL) 743 if (data_file != NULL)
@@ -806,8 +793,8 @@ run (void *cls, char *const *args, const char *cfgfile,
806 ok = 1; 793 ok = 1;
807 //testing_cfg = GNUNET_CONFIGURATION_create (); 794 //testing_cfg = GNUNET_CONFIGURATION_create ();
808 testing_cfg = GNUNET_CONFIGURATION_dup (cfg); 795 testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
809#if VERBOSE
810 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n"); 796 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n");
797#if VERBOSE
811 GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing", 798 GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing",
812 "use_progressbars", "YES"); 799 "use_progressbars", "YES");
813#endif 800#endif
@@ -920,16 +907,14 @@ main (int argc, char *const *argv)
920 return 2; 907 return 2;
921 908
922 GNUNET_log_setup ("nse-profiler", 909 GNUNET_log_setup ("nse-profiler",
923#if VERBOSE
924 "DEBUG",
925#else
926 "WARNING", 910 "WARNING",
927#endif
928 NULL); 911 NULL);
929 GNUNET_PROGRAM_run (argc, argv, "nse-profiler", 912 if (GNUNET_OK !=
930 gettext_noop 913 GNUNET_PROGRAM_run (argc, argv, "nse-profiler",
931 ("Measure quality and performance of the NSE service."), 914 gettext_noop
932 options, &run, NULL); 915 ("Measure quality and performance of the NSE service."),
916 options, &run, NULL))
917 ok = 1;
933#if REMOVE_DIR 918#if REMOVE_DIR
934 GNUNET_DISK_directory_remove ("/tmp/nse-profiler"); 919 GNUNET_DISK_directory_remove ("/tmp/nse-profiler");
935#endif 920#endif