X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fhostlist%2Ftest_gnunet_daemon_hostlist_learning.c;h=5fcbd538b826391224581ba4b1450352a12217f3;hb=1f09f4f7716db5939ec1c9a278b5661616dd72d6;hp=c6b04ac7e6c242823f037a295f5002e863e6479b;hpb=67b718e21f1ba7d46f1969ab70b72041f8711b07;p=oweals%2Fgnunet.git diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index c6b04ac7e..5fcbd538b 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c @@ -30,7 +30,7 @@ #include "gnunet_resolver_service.h" #include "gnunet_statistics_service.h" -#define VERBOSE GNUNET_EXTRA_LOGGING +#define VERBOSE GNUNET_NO #define START_ARM GNUNET_YES @@ -109,6 +109,16 @@ shutdown_testcase () GNUNET_STATISTICS_get_cancel (advsent_stat); advsent_stat = NULL; } + if (NULL != adv_peer.stats) + { + GNUNET_STATISTICS_destroy (adv_peer.stats, GNUNET_NO); + adv_peer.stats = NULL; + } + if (NULL != learn_peer.stats) + { + GNUNET_STATISTICS_destroy (learn_peer.stats, GNUNET_NO); + learn_peer.stats = NULL; + } if (check_task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (check_task); @@ -146,7 +156,7 @@ shutdown_testcase () GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); if (GNUNET_OS_process_wait (adv_peer.arm_proc) != GNUNET_OK) GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); - GNUNET_OS_process_close (adv_peer.arm_proc); + GNUNET_OS_process_destroy (adv_peer.arm_proc); adv_peer.arm_proc = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Killing hostlist client ARM process.\n"); @@ -154,7 +164,7 @@ shutdown_testcase () GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); if (GNUNET_OS_process_wait (learn_peer.arm_proc) != GNUNET_OK) GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); - GNUNET_OS_process_close (learn_peer.arm_proc); + GNUNET_OS_process_destroy (learn_peer.arm_proc); learn_peer.arm_proc = NULL; #endif GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown complete....\n"); @@ -181,6 +191,14 @@ process_downloads_done (void *cls, int success) } +static void +do_shutdown (void *cls, + const struct GNUNET_SCHEDULER_TaskContext *tc) +{ + shutdown_testcase (); +} + + static int process_downloads (void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent) @@ -191,7 +209,9 @@ process_downloads (void *cls, const char *subsystem, const char *name, "Peer has successfully downloaded advertised URI\n"); learned_hostlist_downloaded = GNUNET_YES; if ((learned_hostlist_saved == GNUNET_YES) && (adv_sent == GNUNET_YES)) - shutdown_testcase (); + { + GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); + } } return GNUNET_OK; } @@ -298,7 +318,8 @@ check_statistics (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static int ad_arrive_handler (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_TRANSPORT_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { char *hostname; char *expected_uri; @@ -369,7 +390,7 @@ setup_learn_peer (struct PeerContext *p, const char *cfgname) p->cfg = GNUNET_CONFIGURATION_create (); #if START_ARM p->arm_proc = - GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", + GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", "gnunet-service-arm", #if VERBOSE "-L", "DEBUG", @@ -391,8 +412,8 @@ setup_learn_peer (struct PeerContext *p, const char *cfgname) GNUNET_free (filename); } p->core = - GNUNET_CORE_connect (p->cfg, 1, NULL, NULL, NULL, NULL, NULL, - GNUNET_NO, NULL, GNUNET_NO, learn_handlers); + GNUNET_CORE_connect (p->cfg, 1, NULL, NULL, NULL, NULL, NULL, GNUNET_NO, + NULL, GNUNET_NO, learn_handlers); GNUNET_assert (NULL != p->core); p->stats = GNUNET_STATISTICS_create ("hostlist", p->cfg); GNUNET_assert (NULL != p->stats); @@ -405,7 +426,7 @@ setup_adv_peer (struct PeerContext *p, const char *cfgname) p->cfg = GNUNET_CONFIGURATION_create (); #if START_ARM p->arm_proc = - GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", + GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", "gnunet-service-arm", #if VERBOSE "-L", "DEBUG",