aboutsummaryrefslogtreecommitdiff
path: root/src/nse/test_nse_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-07-23 14:27:40 +0000
committerChristian Grothoff <christian@grothoff.org>2011-07-23 14:27:40 +0000
commitfdd29c5663f10fadca628793e72ef9d56a9d2fe6 (patch)
treed17370de7bdf1e504e573cd19d8f88b5e8f852b8 /src/nse/test_nse_api.c
parent924311893e9ea66d32edd0d477ba32c8861b3528 (diff)
downloadgnunet-fdd29c5663f10fadca628793e72ef9d56a9d2fe6.tar.gz
gnunet-fdd29c5663f10fadca628793e72ef9d56a9d2fe6.zip
fix shutdown
Diffstat (limited to 'src/nse/test_nse_api.c')
-rw-r--r--src/nse/test_nse_api.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/nse/test_nse_api.c b/src/nse/test_nse_api.c
index 273cff294..03ea41d18 100644
--- a/src/nse/test_nse_api.c
+++ b/src/nse/test_nse_api.c
@@ -47,14 +47,29 @@ struct PeerContext
47 47
48static struct PeerContext p1; 48static struct PeerContext p1;
49 49
50
51static void
52stop_arm (struct PeerContext *p)
53{
54#if START_ARM
55 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
56 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
57 GNUNET_OS_process_wait (p->arm_proc);
58 GNUNET_OS_process_close (p->arm_proc);
59 p->arm_proc = NULL;
60#endif
61 GNUNET_CONFIGURATION_destroy (p->cfg);
62}
63
50/** 64/**
51 * Signature of the main function of a task. 65 * Signature of the main function of a task.
52 * 66 *
53 * @param cls closure 67 * @param cls closure
54 * @param tc context information (why was this task triggered now) 68 * @param tc context information (why was this task triggered now)
55 */ 69 */
56static void end_test (void *cls, 70static void
57 const struct GNUNET_SCHEDULER_TaskContext * tc) 71end_test (void *cls,
72 const struct GNUNET_SCHEDULER_TaskContext * tc)
58{ 73{
59 if (h != NULL) 74 if (h != NULL)
60 { 75 {
@@ -78,11 +93,10 @@ check_nse_message (void *cls, double estimate, double std_dev)
78{ 93{
79 int *ok = cls; 94 int *ok = cls;
80 95
81 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 96 fprintf (stderr,
82 "Received NSE message, estimate %f, standard deviation %f.\n"); 97 "Received NSE message, estimate %f, standard deviation %f.\n");
83 /* Fantastic check below. Expect NaN, the only thing not equal to itself. */ 98 /* Fantastic check below. Expect NaN, the only thing not equal to itself. */
84 if ((estimate != estimate) && (std_dev != std_dev)) 99 (*ok) = 0;
85 (*ok) = 0;
86 if (die_task != GNUNET_SCHEDULER_NO_TASK) 100 if (die_task != GNUNET_SCHEDULER_NO_TASK)
87 GNUNET_SCHEDULER_cancel(die_task); 101 GNUNET_SCHEDULER_cancel(die_task);
88 die_task = GNUNET_SCHEDULER_add_now(&end_test, NULL); 102 die_task = GNUNET_SCHEDULER_add_now(&end_test, NULL);
@@ -106,18 +120,6 @@ setup_peer (struct PeerContext *p, const char *cfgname)
106 120
107} 121}
108 122
109static void
110stop_arm (struct PeerContext *p)
111{
112#if START_ARM
113 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
114 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
115 GNUNET_OS_process_wait (p->arm_proc);
116 GNUNET_OS_process_close (p->arm_proc);
117 p->arm_proc = NULL;
118#endif
119 GNUNET_CONFIGURATION_destroy (p->cfg);
120}
121 123
122 124
123static void 125static void