diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-11-05 18:21:50 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-11-05 18:21:50 +0000 |
commit | 75a33a1499cf60ea4364c9aa673816629a6c1413 (patch) | |
tree | 0620da4312bb04de4d7b65074fdd3b0c3dd6cc0e /src/core/test_core_api.c | |
parent | 7217c601ad30760872823193d62307e7a335d226 (diff) | |
download | gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.tar.gz gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.zip |
big scheduler refactoring, expect some issues
Diffstat (limited to 'src/core/test_core_api.c')
-rw-r--r-- | src/core/test_core_api.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index 3fbeca419..65b09c835 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c | |||
@@ -62,7 +62,6 @@ static struct PeerContext p1; | |||
62 | 62 | ||
63 | static struct PeerContext p2; | 63 | static struct PeerContext p2; |
64 | 64 | ||
65 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
66 | 65 | ||
67 | static int ok; | 66 | static int ok; |
68 | 67 | ||
@@ -168,8 +167,8 @@ process_mtype (void *cls, | |||
168 | "Receiving message from `%4s'.\n", GNUNET_i2s (peer)); | 167 | "Receiving message from `%4s'.\n", GNUNET_i2s (peer)); |
169 | GNUNET_assert (ok == 5); | 168 | GNUNET_assert (ok == 5); |
170 | OKPP; | 169 | OKPP; |
171 | GNUNET_SCHEDULER_cancel (sched, err_task); | 170 | GNUNET_SCHEDULER_cancel (err_task); |
172 | GNUNET_SCHEDULER_add_now (sched, &terminate_task, NULL); | 171 | GNUNET_SCHEDULER_add_now (&terminate_task, NULL); |
173 | return GNUNET_OK; | 172 | return GNUNET_OK; |
174 | } | 173 | } |
175 | 174 | ||
@@ -194,8 +193,7 @@ transmit_ready (void *cls, size_t size, void *buf) | |||
194 | m->type = htons (MTYPE); | 193 | m->type = htons (MTYPE); |
195 | m->size = htons (sizeof (struct GNUNET_MessageHeader)); | 194 | m->size = htons (sizeof (struct GNUNET_MessageHeader)); |
196 | err_task = | 195 | err_task = |
197 | GNUNET_SCHEDULER_add_delayed (sched, | 196 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 120), &terminate_task_error, NULL); |
198 | GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 120), &terminate_task_error, NULL); | ||
199 | 197 | ||
200 | return sizeof (struct GNUNET_MessageHeader); | 198 | return sizeof (struct GNUNET_MessageHeader); |
201 | } | 199 | } |
@@ -221,8 +219,7 @@ init_notify (void *cls, | |||
221 | GNUNET_assert (ok == 2); | 219 | GNUNET_assert (ok == 2); |
222 | OKPP; | 220 | OKPP; |
223 | /* connect p2 */ | 221 | /* connect p2 */ |
224 | GNUNET_CORE_connect (sched, | 222 | GNUNET_CORE_connect (p2.cfg, |
225 | p2.cfg, | ||
226 | TIMEOUT, | 223 | TIMEOUT, |
227 | &p2, | 224 | &p2, |
228 | &init_notify, | 225 | &init_notify, |
@@ -297,7 +294,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
297 | "-c", cfgname, NULL); | 294 | "-c", cfgname, NULL); |
298 | #endif | 295 | #endif |
299 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | 296 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); |
300 | p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, p, NULL, NULL, NULL); | 297 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL); |
301 | GNUNET_assert (p->th != NULL); | 298 | GNUNET_assert (p->th != NULL); |
302 | GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); | 299 | GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); |
303 | } | 300 | } |
@@ -305,18 +302,15 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
305 | 302 | ||
306 | static void | 303 | static void |
307 | run (void *cls, | 304 | run (void *cls, |
308 | struct GNUNET_SCHEDULER_Handle *s, | ||
309 | char *const *args, | 305 | char *const *args, |
310 | const char *cfgfile, | 306 | const char *cfgfile, |
311 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 307 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
312 | { | 308 | { |
313 | GNUNET_assert (ok == 1); | 309 | GNUNET_assert (ok == 1); |
314 | OKPP; | 310 | OKPP; |
315 | sched = s; | ||
316 | setup_peer (&p1, "test_core_api_peer1.conf"); | 311 | setup_peer (&p1, "test_core_api_peer1.conf"); |
317 | setup_peer (&p2, "test_core_api_peer2.conf"); | 312 | setup_peer (&p2, "test_core_api_peer2.conf"); |
318 | GNUNET_CORE_connect (sched, | 313 | GNUNET_CORE_connect (p1.cfg, |
319 | p1.cfg, | ||
320 | TIMEOUT, | 314 | TIMEOUT, |
321 | &p1, | 315 | &p1, |
322 | &init_notify, | 316 | &init_notify, |