diff options
author | Julius Bünger <buenger@mytum.de> | 2019-01-24 13:30:42 +0100 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2019-01-25 01:39:12 +0100 |
commit | 92d1fd704da83c27e9aac3d385b8dd6cf0c18a8a (patch) | |
tree | a85879a97ca327290954b230b906675731a0c0fe /src | |
parent | b7578171dd1d81b4ff54c42d0f72661e373a4597 (diff) | |
download | gnunet-92d1fd704da83c27e9aac3d385b8dd6cf0c18a8a.tar.gz gnunet-92d1fd704da83c27e9aac3d385b8dd6cf0c18a8a.zip |
ATS test: Give ATS time to come up with suggestion
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/test_ats2_lib.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/ats/test_ats2_lib.c b/src/ats/test_ats2_lib.c index b23493239..437e8baf2 100644 --- a/src/ats/test_ats2_lib.c +++ b/src/ats/test_ats2_lib.c | |||
@@ -33,6 +33,12 @@ static int ret; | |||
33 | 33 | ||
34 | 34 | ||
35 | /** | 35 | /** |
36 | * @brief The time available until the test shuts down | ||
37 | */ | ||
38 | static struct GNUNET_TIME_Relative timeout; | ||
39 | |||
40 | |||
41 | /** | ||
36 | * @brief ATS Application Handle | 42 | * @brief ATS Application Handle |
37 | * | 43 | * |
38 | * Handle to the application-side of ATS. | 44 | * Handle to the application-side of ATS. |
@@ -181,7 +187,16 @@ get_suggestion (void) | |||
181 | &other_peer, | 187 | &other_peer, |
182 | GNUNET_MQ_PREFERENCE_NONE, | 188 | GNUNET_MQ_PREFERENCE_NONE, |
183 | GNUNET_BANDWIDTH_VALUE_MAX); | 189 | GNUNET_BANDWIDTH_VALUE_MAX); |
184 | GNUNET_ATS_application_suggest_cancel (ash); | 190 | GNUNET_assert (NULL != ash); |
191 | } | ||
192 | |||
193 | |||
194 | static void | ||
195 | on_shutdown (void *cls) | ||
196 | { | ||
197 | provide_info_end (); | ||
198 | finish_both (); | ||
199 | GNUNET_SCHEDULER_shutdown (); | ||
185 | } | 200 | } |
186 | 201 | ||
187 | 202 | ||
@@ -200,8 +215,7 @@ run (void *cls, | |||
200 | init_both (cfg); | 215 | init_both (cfg); |
201 | provide_info_start (); | 216 | provide_info_start (); |
202 | get_suggestion (); | 217 | get_suggestion (); |
203 | provide_info_end (); | 218 | (void) GNUNET_SCHEDULER_add_delayed (timeout, &on_shutdown, NULL); |
204 | finish_both (); | ||
205 | } | 219 | } |
206 | 220 | ||
207 | 221 | ||
@@ -219,6 +233,7 @@ main (int argc, | |||
219 | { | 233 | { |
220 | ret = 1; | 234 | ret = 1; |
221 | memset (&other_peer, 0, sizeof (struct GNUNET_PeerIdentity)); | 235 | memset (&other_peer, 0, sizeof (struct GNUNET_PeerIdentity)); |
236 | timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 500); | ||
222 | if (0 != GNUNET_TESTING_peer_run ("test-ats2-lib", | 237 | if (0 != GNUNET_TESTING_peer_run ("test-ats2-lib", |
223 | "test_ats2_lib.conf", | 238 | "test_ats2_lib.conf", |
224 | &run, NULL)) | 239 | &run, NULL)) |