aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-05-05 14:09:06 +0000
committerChristian Grothoff <christian@grothoff.org>2011-05-05 14:09:06 +0000
commitbb83cd2d04ff5a3f7a8d05fc9a724b0246e958b6 (patch)
treec4871898c122cb581453f98fd6d85e2aaecc8b6e
parentaf628f3f58cd9d3cf5c1708cdc81fd743aea8076 (diff)
downloadgnunet-bb83cd2d04ff5a3f7a8d05fc9a724b0246e958b6.tar.gz
gnunet-bb83cd2d04ff5a3f7a8d05fc9a724b0246e958b6.zip
proper shutdown
-rw-r--r--src/fs/fs_test_lib.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c
index c379d91ad..522967f13 100644
--- a/src/fs/fs_test_lib.c
+++ b/src/fs/fs_test_lib.c
@@ -528,6 +528,7 @@ GNUNET_FS_TEST_daemons_stop (unsigned int total,
528 unsigned int i; 528 unsigned int i;
529 struct GNUNET_TESTING_PeerGroup *pg; 529 struct GNUNET_TESTING_PeerGroup *pg;
530 struct GNUNET_CONFIGURATION_Handle *gcfg; 530 struct GNUNET_CONFIGURATION_Handle *gcfg;
531 struct GNUNET_FS_TestDaemon *daemon;
531 532
532 GNUNET_assert (total > 0); 533 GNUNET_assert (total > 0);
533 GNUNET_assert (daemons[0] != NULL); 534 GNUNET_assert (daemons[0] != NULL);
@@ -535,18 +536,34 @@ GNUNET_FS_TEST_daemons_stop (unsigned int total,
535 gcfg = daemons[0]->gcfg; 536 gcfg = daemons[0]->gcfg;
536 for (i=0;i<total;i++) 537 for (i=0;i<total;i++)
537 { 538 {
538 if (daemons[i]->fs != NULL) 539 daemon = daemons[i];
539 GNUNET_FS_stop (daemons[i]->fs); 540 if (daemon->download_timeout_task != GNUNET_SCHEDULER_NO_TASK)
540 if (daemons[i]->cfg != NULL) 541 {
541 GNUNET_CONFIGURATION_destroy (daemons[i]->cfg); 542 GNUNET_SCHEDULER_cancel (daemon->download_timeout_task);
542 if (NULL != daemons[i]->publish_tmp_file) 543 daemon->download_timeout_task = GNUNET_SCHEDULER_NO_TASK;
544 }
545 if (daemon->publish_timeout_task != GNUNET_SCHEDULER_NO_TASK)
546 {
547 GNUNET_SCHEDULER_cancel (daemon->publish_timeout_task);
548 daemon->publish_timeout_task = GNUNET_SCHEDULER_NO_TASK;
549 }
550 if (NULL != daemon->download_context)
551 {
552 GNUNET_FS_download_stop (daemon->download_context, GNUNET_YES);
553 daemon->download_context = NULL;
554 }
555 if (daemon->fs != NULL)
556 GNUNET_FS_stop (daemon->fs);
557 if (daemon->cfg != NULL)
558 GNUNET_CONFIGURATION_destroy (daemon->cfg);
559 if (NULL != daemon->publish_tmp_file)
543 { 560 {
544 GNUNET_break (GNUNET_OK == 561 GNUNET_break (GNUNET_OK ==
545 GNUNET_DISK_directory_remove (daemons[i]->publish_tmp_file)); 562 GNUNET_DISK_directory_remove (daemon->publish_tmp_file));
546 GNUNET_free (daemons[i]->publish_tmp_file); 563 GNUNET_free (daemon->publish_tmp_file);
547 daemons[i]->publish_tmp_file = NULL; 564 daemon->publish_tmp_file = NULL;
548 } 565 }
549 GNUNET_free (daemons[i]); 566 GNUNET_free (daemon);
550 daemons[i] = NULL; 567 daemons[i] = NULL;
551 } 568 }
552 GNUNET_TESTING_daemons_stop (pg, 569 GNUNET_TESTING_daemons_stop (pg,