aboutsummaryrefslogtreecommitdiff
path: root/src/testing/test_testing_topology_churn.c
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-11-05 18:21:50 +0000
committerNathan S. Evans <evans@in.tum.de>2010-11-05 18:21:50 +0000
commit75a33a1499cf60ea4364c9aa673816629a6c1413 (patch)
tree0620da4312bb04de4d7b65074fdd3b0c3dd6cc0e /src/testing/test_testing_topology_churn.c
parent7217c601ad30760872823193d62307e7a335d226 (diff)
downloadgnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.tar.gz
gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.zip
big scheduler refactoring, expect some issues
Diffstat (limited to 'src/testing/test_testing_topology_churn.c')
-rw-r--r--src/testing/test_testing_topology_churn.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/testing/test_testing_topology_churn.c b/src/testing/test_testing_topology_churn.c
index a4b80e4a4..0e3647015 100644
--- a/src/testing/test_testing_topology_churn.c
+++ b/src/testing/test_testing_topology_churn.c
@@ -51,8 +51,6 @@ static unsigned long long peers_left;
51 51
52static struct GNUNET_TESTING_PeerGroup *pg; 52static struct GNUNET_TESTING_PeerGroup *pg;
53 53
54static struct GNUNET_SCHEDULER_Handle *sched;
55
56const struct GNUNET_CONFIGURATION_Handle *main_cfg; 54const struct GNUNET_CONFIGURATION_Handle *main_cfg;
57 55
58GNUNET_SCHEDULER_TaskIdentifier die_task; 56GNUNET_SCHEDULER_TaskIdentifier die_task;
@@ -104,7 +102,7 @@ finish_testing ()
104 GNUNET_assert (pg != NULL); 102 GNUNET_assert (pg != NULL);
105 103
106 if (die_task != GNUNET_SCHEDULER_NO_TASK) 104 if (die_task != GNUNET_SCHEDULER_NO_TASK)
107 GNUNET_SCHEDULER_cancel(sched, die_task); 105 GNUNET_SCHEDULER_cancel(die_task);
108 106
109#if VERBOSE 107#if VERBOSE
110 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 108 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -161,13 +159,13 @@ void churn_callback(void *cls,
161 if (emsg == NULL) 159 if (emsg == NULL)
162 { 160 {
163 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Successfully churned peers!\n", emsg); 161 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Successfully churned peers!\n", emsg);
164 GNUNET_SCHEDULER_add_now(sched, churn_ctx.next_task, NULL); 162 GNUNET_SCHEDULER_add_now(churn_ctx.next_task, NULL);
165 } 163 }
166 else 164 else
167 { 165 {
168 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Failed to churn peers with error `%s'\n", emsg); 166 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Failed to churn peers with error `%s'\n", emsg);
169 GNUNET_SCHEDULER_cancel(sched, die_task); 167 GNUNET_SCHEDULER_cancel(die_task);
170 die_task = GNUNET_SCHEDULER_add_now(sched, &end_badly, NULL); 168 die_task = GNUNET_SCHEDULER_add_now(&end_badly, NULL);
171 } 169 }
172} 170}
173 171
@@ -225,11 +223,10 @@ peers_started_callback (void *cls,
225 "All %d daemons started, now testing churn!\n", 223 "All %d daemons started, now testing churn!\n",
226 num_peers); 224 num_peers);
227#endif 225#endif
228 GNUNET_SCHEDULER_cancel (sched, die_task); 226 GNUNET_SCHEDULER_cancel (die_task);
229 /* Set up task in case topology creation doesn't finish 227 /* Set up task in case topology creation doesn't finish
230 * within a reasonable amount of time */ 228 * within a reasonable amount of time */
231 die_task = GNUNET_SCHEDULER_add_delayed (sched, 229 die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
232 GNUNET_TIME_relative_multiply
233 (GNUNET_TIME_UNIT_MINUTES, 5), 230 (GNUNET_TIME_UNIT_MINUTES, 5),
234 &end_badly, "from peers_started_callback"); 231 &end_badly, "from peers_started_callback");
235 churn_peers_off (); 232 churn_peers_off ();
@@ -240,11 +237,9 @@ peers_started_callback (void *cls,
240 237
241static void 238static void
242run (void *cls, 239run (void *cls,
243 struct GNUNET_SCHEDULER_Handle *s,
244 char *const *args, 240 char *const *args,
245 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) 241 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
246{ 242{
247 sched = s;
248 ok = 1; 243 ok = 1;
249 244
250#if VERBOSE 245#if VERBOSE
@@ -278,12 +273,11 @@ run (void *cls,
278 273
279 274
280 /* Set up a task to end testing if peer start fails */ 275 /* Set up a task to end testing if peer start fails */
281 die_task = GNUNET_SCHEDULER_add_delayed (sched, 276 die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
282 GNUNET_TIME_relative_multiply
283 (GNUNET_TIME_UNIT_MINUTES, 5), 277 (GNUNET_TIME_UNIT_MINUTES, 5),
284 &end_badly, "didn't start all daemons in reasonable amount of time!!!"); 278 &end_badly, "didn't start all daemons in reasonable amount of time!!!");
285 279
286 pg = GNUNET_TESTING_daemons_start (sched, cfg, 280 pg = GNUNET_TESTING_daemons_start (cfg,
287 peers_left, TIMEOUT, NULL, NULL, &peers_started_callback, NULL, 281 peers_left, TIMEOUT, NULL, NULL, &peers_started_callback, NULL,
288 NULL, NULL, NULL); 282 NULL, NULL, NULL);
289 283