diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-02 20:00:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-02 20:00:00 +0000 |
commit | f5578375b94757504d58994e4af829250d1330e6 (patch) | |
tree | 085667fc2801383a6f5ceeb7e9260b2797c00aa5 /src/pt/test_gns_vpn.c | |
parent | 80a401db776bf42db639cb501a3214b1a71c50e6 (diff) | |
download | gnunet-f5578375b94757504d58994e4af829250d1330e6.tar.gz gnunet-f5578375b94757504d58994e4af829250d1330e6.zip |
-fix testcase shutdown
Diffstat (limited to 'src/pt/test_gns_vpn.c')
-rw-r--r-- | src/pt/test_gns_vpn.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c index 7e5bb503d..467a15310 100644 --- a/src/pt/test_gns_vpn.c +++ b/src/pt/test_gns_vpn.c | |||
@@ -54,6 +54,8 @@ static struct GNUNET_SCHEDULER_Task *mhd_task_id; | |||
54 | 54 | ||
55 | static struct GNUNET_SCHEDULER_Task *curl_task_id; | 55 | static struct GNUNET_SCHEDULER_Task *curl_task_id; |
56 | 56 | ||
57 | static struct GNUNET_SCHEDULER_Task *timeout_task; | ||
58 | |||
57 | static struct GNUNET_IDENTITY_Handle *identity; | 59 | static struct GNUNET_IDENTITY_Handle *identity; |
58 | 60 | ||
59 | static struct GNUNET_NAMESTORE_QueueEntry *qe; | 61 | static struct GNUNET_NAMESTORE_QueueEntry *qe; |
@@ -142,16 +144,21 @@ mhd_ahc (void *cls, | |||
142 | static void | 144 | static void |
143 | do_shutdown (void *cls) | 145 | do_shutdown (void *cls) |
144 | { | 146 | { |
145 | if (mhd_task_id != NULL) | 147 | if (NULL != mhd_task_id) |
146 | { | 148 | { |
147 | GNUNET_SCHEDULER_cancel (mhd_task_id); | 149 | GNUNET_SCHEDULER_cancel (mhd_task_id); |
148 | mhd_task_id = NULL; | 150 | mhd_task_id = NULL; |
149 | } | 151 | } |
150 | if (curl_task_id != NULL) | 152 | if (NULL != curl_task_id) |
151 | { | 153 | { |
152 | GNUNET_SCHEDULER_cancel (curl_task_id); | 154 | GNUNET_SCHEDULER_cancel (curl_task_id); |
153 | curl_task_id = NULL; | 155 | curl_task_id = NULL; |
154 | } | 156 | } |
157 | if (NULL != timeout_task) | ||
158 | { | ||
159 | GNUNET_SCHEDULER_cancel (timeout_task); | ||
160 | timeout_task = NULL; | ||
161 | } | ||
155 | if (NULL != mhd) | 162 | if (NULL != mhd) |
156 | { | 163 | { |
157 | MHD_stop_daemon (mhd); | 164 | MHD_stop_daemon (mhd); |
@@ -172,6 +179,14 @@ do_shutdown (void *cls) | |||
172 | } | 179 | } |
173 | 180 | ||
174 | 181 | ||
182 | static void | ||
183 | do_timeout (void *cls) | ||
184 | { | ||
185 | timeout_task = NULL; | ||
186 | GNUNET_SCHEDULER_shutdown (); | ||
187 | } | ||
188 | |||
189 | |||
175 | /** | 190 | /** |
176 | * Function to run the HTTP client. | 191 | * Function to run the HTTP client. |
177 | */ | 192 | */ |
@@ -236,7 +251,8 @@ curl_main () | |||
236 | GNUNET_break (0); | 251 | GNUNET_break (0); |
237 | global_ret = 3; | 252 | global_ret = 3; |
238 | } | 253 | } |
239 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download complete, shutting down!\n"); | 254 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
255 | "Download complete, shutting down!\n"); | ||
240 | GNUNET_SCHEDULER_shutdown (); | 256 | GNUNET_SCHEDULER_shutdown (); |
241 | return; | 257 | return; |
242 | } | 258 | } |
@@ -622,9 +638,11 @@ run (void *cls, | |||
622 | NULL | 638 | NULL |
623 | }; | 639 | }; |
624 | GNUNET_TESTING_peer_get_identity (peer, &id); | 640 | GNUNET_TESTING_peer_get_identity (peer, &id); |
625 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 641 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, |
626 | &do_shutdown, | 642 | NULL); |
627 | NULL); | 643 | timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
644 | &do_timeout, | ||
645 | NULL); | ||
628 | bin = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR); | 646 | bin = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR); |
629 | GNUNET_asprintf (&bin_identity, | 647 | GNUNET_asprintf (&bin_identity, |
630 | "%s/%s", | 648 | "%s/%s", |