aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/test_datastore_api.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/datastore/test_datastore_api.c
parent7217c601ad30760872823193d62307e7a335d226 (diff)
downloadgnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.tar.gz
gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.zip
big scheduler refactoring, expect some issues
Diffstat (limited to 'src/datastore/test_datastore_api.c')
-rw-r--r--src/datastore/test_datastore_api.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c
index 3b7202005..06abc0c0f 100644
--- a/src/datastore/test_datastore_api.c
+++ b/src/datastore/test_datastore_api.c
@@ -125,7 +125,6 @@ struct CpsRunContext
125 GNUNET_HashCode key; 125 GNUNET_HashCode key;
126 int i; 126 int i;
127 int rid; 127 int rid;
128 struct GNUNET_SCHEDULER_Handle *sched;
129 const struct GNUNET_CONFIGURATION_Handle *cfg; 128 const struct GNUNET_CONFIGURATION_Handle *cfg;
130 void *data; 129 void *data;
131 size_t size; 130 size_t size;
@@ -150,13 +149,12 @@ check_success (void *cls,
150 ok = 42; 149 ok = 42;
151 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 150 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
152 "%s\n", msg); 151 "%s\n", msg);
153 GNUNET_SCHEDULER_shutdown (crc->sched); 152 GNUNET_SCHEDULER_shutdown ();
154 return; 153 return;
155 } 154 }
156 GNUNET_free_non_null (crc->data); 155 GNUNET_free_non_null (crc->data);
157 crc->data = NULL; 156 crc->data = NULL;
158 GNUNET_SCHEDULER_add_continuation (crc->sched, 157 GNUNET_SCHEDULER_add_continuation (&run_continuation,
159 &run_continuation,
160 crc, 158 crc,
161 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 159 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
162} 160}
@@ -173,8 +171,7 @@ get_reserved (void *cls,
173 "%s\n", msg); 171 "%s\n", msg);
174 GNUNET_assert (0 < success); 172 GNUNET_assert (0 < success);
175 crc->rid = success; 173 crc->rid = success;
176 GNUNET_SCHEDULER_add_continuation (crc->sched, 174 GNUNET_SCHEDULER_add_continuation (&run_continuation,
177 &run_continuation,
178 crc, 175 crc,
179 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 176 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
180} 177}
@@ -201,8 +198,7 @@ check_value (void *cls,
201 crc->phase = RP_DEL; 198 crc->phase = RP_DEL;
202 crc->i = ITERATIONS; 199 crc->i = ITERATIONS;
203 } 200 }
204 GNUNET_SCHEDULER_add_continuation (crc->sched, 201 GNUNET_SCHEDULER_add_continuation (&run_continuation,
205 &run_continuation,
206 crc, 202 crc,
207 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 203 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
208 return; 204 return;
@@ -243,8 +239,7 @@ delete_value (void *cls,
243 { 239 {
244 crc->phase = RP_DO_DEL; 240 crc->phase = RP_DO_DEL;
245 } 241 }
246 GNUNET_SCHEDULER_add_continuation (crc->sched, 242 GNUNET_SCHEDULER_add_continuation (&run_continuation,
247 &run_continuation,
248 crc, 243 crc,
249 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 244 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
250 return; 245 return;
@@ -275,8 +270,7 @@ check_nothing (void *cls,
275 { 270 {
276 crc->phase = RP_RESERVE; 271 crc->phase = RP_RESERVE;
277 } 272 }
278 GNUNET_SCHEDULER_add_continuation (crc->sched, 273 GNUNET_SCHEDULER_add_continuation (&run_continuation,
279 &run_continuation,
280 crc, 274 crc,
281 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 275 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
282} 276}
@@ -309,8 +303,7 @@ check_multiple (void *cls,
309 { 303 {
310 crc->phase = RP_UPDATE; 304 crc->phase = RP_UPDATE;
311 } 305 }
312 GNUNET_SCHEDULER_add_continuation (crc->sched, 306 GNUNET_SCHEDULER_add_continuation (&run_continuation,
313 &run_continuation,
314 crc, 307 crc,
315 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 308 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
316 return; 309 return;
@@ -364,8 +357,7 @@ check_update (void *cls,
364 { 357 {
365 crc->phase = RP_DONE; 358 crc->phase = RP_DONE;
366 } 359 }
367 GNUNET_SCHEDULER_add_continuation (crc->sched, 360 GNUNET_SCHEDULER_add_continuation (&run_continuation,
368 &run_continuation,
369 crc, 361 crc,
370 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 362 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
371 return; 363 return;
@@ -597,8 +589,7 @@ run_tests (void *cls,
597 GNUNET_free (crc); 589 GNUNET_free (crc);
598 return; 590 return;
599 } 591 }
600 GNUNET_SCHEDULER_add_continuation (crc->sched, 592 GNUNET_SCHEDULER_add_continuation (&run_continuation,
601 &run_continuation,
602 crc, 593 crc,
603 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 594 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
604} 595}
@@ -606,7 +597,6 @@ run_tests (void *cls,
606 597
607static void 598static void
608run (void *cls, 599run (void *cls,
609 struct GNUNET_SCHEDULER_Handle *sched,
610 char *const *args, 600 char *const *args,
611 const char *cfgfile, 601 const char *cfgfile,
612 const struct GNUNET_CONFIGURATION_Handle *cfg) 602 const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -615,11 +605,10 @@ run (void *cls,
615 static GNUNET_HashCode zkey; 605 static GNUNET_HashCode zkey;
616 606
617 crc = GNUNET_malloc(sizeof(struct CpsRunContext)); 607 crc = GNUNET_malloc(sizeof(struct CpsRunContext));
618 crc->sched = sched;
619 crc->cfg = cfg; 608 crc->cfg = cfg;
620 crc->phase = RP_PUT; 609 crc->phase = RP_PUT;
621 now = GNUNET_TIME_absolute_get (); 610 now = GNUNET_TIME_absolute_get ();
622 datastore = GNUNET_DATASTORE_connect (cfg, sched); 611 datastore = GNUNET_DATASTORE_connect (cfg);
623 if (NULL == 612 if (NULL ==
624 GNUNET_DATASTORE_put (datastore, 0, 613 GNUNET_DATASTORE_put (datastore, 0,
625 &zkey, 4, "TEST", 614 &zkey, 4, "TEST",