aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaximilian Szengel <gnunet@maxsz.de>2012-11-04 17:48:11 +0000
committerMaximilian Szengel <gnunet@maxsz.de>2012-11-04 17:48:11 +0000
commit70466ec3c34f9a920e9e798e3169f886e9486a59 (patch)
treedd2d5638fe893cfcf22c38cf7b37482b8e9dd7df /src
parentb8eba0f1435c1a1738e779ef0167df3961a1aa8d (diff)
downloadgnunet-70466ec3c34f9a920e9e798e3169f886e9486a59.tar.gz
gnunet-70466ec3c34f9a920e9e798e3169f886e9486a59.zip
regex profiler cleanup
Diffstat (limited to 'src')
-rw-r--r--src/mesh/gnunet-regex-profiler.c48
1 files changed, 20 insertions, 28 deletions
diff --git a/src/mesh/gnunet-regex-profiler.c b/src/mesh/gnunet-regex-profiler.c
index 28af3b476..6c519717d 100644
--- a/src/mesh/gnunet-regex-profiler.c
+++ b/src/mesh/gnunet-regex-profiler.c
@@ -273,11 +273,6 @@ static unsigned int linking_factor;
273static unsigned int num_links; 273static unsigned int num_links;
274 274
275/** 275/**
276 * Number of timeout failures to tolerate
277 */
278static unsigned int num_cont_fails;
279
280/**
281 * Number of times we try overlay connect operations 276 * Number of times we try overlay connect operations
282 */ 277 */
283static unsigned int retry_links; 278static unsigned int retry_links;
@@ -450,6 +445,11 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
450 unsigned int peer_cnt; 445 unsigned int peer_cnt;
451 unsigned int search_str_cnt; 446 unsigned int search_str_cnt;
452 447
448 if (GNUNET_SCHEDULER_NO_TASK != abort_task)
449 GNUNET_SCHEDULER_cancel (abort_task);
450 if (GNUNET_SCHEDULER_NO_TASK != register_hosts_task)
451 GNUNET_SCHEDULER_cancel (register_hosts_task);
452
453 for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++) 453 for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++)
454 { 454 {
455 if (NULL != peers[peer_cnt].mesh_op_handle) 455 if (NULL != peers[peer_cnt].mesh_op_handle)
@@ -457,15 +457,14 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
457 if (NULL != peers[peer_cnt].stats_op_handle) 457 if (NULL != peers[peer_cnt].stats_op_handle)
458 GNUNET_TESTBED_operation_done (peers[peer_cnt].stats_op_handle); 458 GNUNET_TESTBED_operation_done (peers[peer_cnt].stats_op_handle);
459 } 459 }
460
461 if (NULL != data_file)
462 GNUNET_DISK_file_close (data_file);
463
460 for (search_str_cnt = 0; search_str_cnt < num_search_strings; search_str_cnt++) 464 for (search_str_cnt = 0; search_str_cnt < num_search_strings; search_str_cnt++)
461 {
462 GNUNET_free (search_strings[search_str_cnt]); 465 GNUNET_free (search_strings[search_str_cnt]);
463 }
464 GNUNET_free (search_strings); 466 GNUNET_free (search_strings);
465 if (GNUNET_SCHEDULER_NO_TASK != abort_task) 467
466 GNUNET_SCHEDULER_cancel (abort_task);
467 if (GNUNET_SCHEDULER_NO_TASK != register_hosts_task)
468 GNUNET_SCHEDULER_cancel (register_hosts_task);
469 if (NULL != reg_handle) 468 if (NULL != reg_handle)
470 GNUNET_TESTBED_cancel_registration (reg_handle); 469 GNUNET_TESTBED_cancel_registration (reg_handle);
471 if (NULL != topology_op) 470 if (NULL != topology_op)
@@ -474,6 +473,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
474 if (NULL != hosts[nhost]) 473 if (NULL != hosts[nhost])
475 GNUNET_TESTBED_host_destroy (hosts[nhost]); 474 GNUNET_TESTBED_host_destroy (hosts[nhost]);
476 GNUNET_free_non_null (hosts); 475 GNUNET_free_non_null (hosts);
476
477 while (NULL != (dll_op = dll_op_head)) 477 while (NULL != (dll_op = dll_op_head))
478 { 478 {
479 GNUNET_TESTBED_operation_done (dll_op->op); 479 GNUNET_TESTBED_operation_done (dll_op->op);
@@ -486,8 +486,6 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
486 GNUNET_TESTBED_controller_stop (mc_proc); 486 GNUNET_TESTBED_controller_stop (mc_proc);
487 if (NULL != cfg) 487 if (NULL != cfg)
488 GNUNET_CONFIGURATION_destroy (cfg); 488 GNUNET_CONFIGURATION_destroy (cfg);
489 if (NULL != data_file)
490 GNUNET_DISK_file_close (data_file);
491 489
492 GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */ 490 GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */
493} 491}
@@ -540,7 +538,12 @@ stats_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
540static void 538static void
541stats_da (void *cls, void *op_result) 539stats_da (void *cls, void *op_result)
542{ 540{
543 GNUNET_STATISTICS_destroy (op_result, GNUNET_NO); 541 struct RegexPeer *peer = cls;
542
543 GNUNET_assert (op_result == peer->stats_handle);
544
545 GNUNET_STATISTICS_destroy (peer->stats_handle, GNUNET_NO);
546 peer->stats_handle = NULL;
544} 547}
545 548
546 549
@@ -1392,15 +1395,7 @@ controller_event_cb (void *cls,
1392 printf ("F"); 1395 printf ("F");
1393 fflush (stdout); 1396 fflush (stdout);
1394 retry_links++; 1397 retry_links++;
1395 1398 }
1396 if (++cont_fails > num_cont_fails)
1397 {
1398 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1399 "We have a very high peer linking failure rate: %u (threshold: %u)\n",
1400 cont_fails,
1401 num_cont_fails);
1402 }
1403 }
1404 /* We do no retries, consider this link as established */ 1399 /* We do no retries, consider this link as established */
1405 /* break; */ 1400 /* break; */
1406 case GNUNET_TESTBED_ET_CONNECT: 1401 case GNUNET_TESTBED_ET_CONNECT:
@@ -1797,12 +1792,9 @@ main (int argc, char *const *argv)
1797 {'d', "details", "FILENAME", 1792 {'d', "details", "FILENAME",
1798 gettext_noop ("name of the file for writing statistics"), 1793 gettext_noop ("name of the file for writing statistics"),
1799 1, &GNUNET_GETOPT_set_string, &data_filename}, 1794 1, &GNUNET_GETOPT_set_string, &data_filename},
1800 {'n', "linking-factor", "FACTOR", 1795 {'n', "num-links", "COUNT",
1801 gettext_noop ("create FACTOR times number of peers random links"), 1796 gettext_noop ("create COUNT number of random links between peers"),
1802 GNUNET_YES, &GNUNET_GETOPT_set_uint, &linking_factor }, 1797 GNUNET_YES, &GNUNET_GETOPT_set_uint, &linking_factor },
1803 {'e', "num-errors", "COUNT",
1804 gettext_noop ("tolerate COUNT number of continious timeout failures"),
1805 GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_cont_fails },
1806 {'t', "matching-timeout", "TIMEOUT", 1798 {'t', "matching-timeout", "TIMEOUT",
1807 gettext_noop ("wait TIMEOUT before considering a string match as failed"), 1799 gettext_noop ("wait TIMEOUT before considering a string match as failed"),
1808 GNUNET_YES, &GNUNET_GETOPT_set_relative_time, &search_timeout }, 1800 GNUNET_YES, &GNUNET_GETOPT_set_relative_time, &search_timeout },