diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-07-23 14:27:40 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-07-23 14:27:40 +0000 |
commit | fdd29c5663f10fadca628793e72ef9d56a9d2fe6 (patch) | |
tree | d17370de7bdf1e504e573cd19d8f88b5e8f852b8 /src/nse/test_nse_api.c | |
parent | 924311893e9ea66d32edd0d477ba32c8861b3528 (diff) | |
download | gnunet-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.c | 38 |
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 | ||
48 | static struct PeerContext p1; | 48 | static struct PeerContext p1; |
49 | 49 | ||
50 | |||
51 | static void | ||
52 | stop_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 | */ |
56 | static void end_test (void *cls, | 70 | static void |
57 | const struct GNUNET_SCHEDULER_TaskContext * tc) | 71 | end_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 | ||
109 | static void | ||
110 | stop_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 | ||
123 | static void | 125 | static void |