diff options
Diffstat (limited to 'src/testing/testing_group.c')
-rw-r--r-- | src/testing/testing_group.c | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 7322fc44a..8697044e3 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -481,11 +481,6 @@ struct StatsCoreContext | |||
481 | struct GNUNET_TESTING_PeerGroup | 481 | struct GNUNET_TESTING_PeerGroup |
482 | { | 482 | { |
483 | /** | 483 | /** |
484 | * Our scheduler. | ||
485 | */ | ||
486 | struct GNUNET_SCHEDULER_Handle *sched; | ||
487 | |||
488 | /** | ||
489 | * Configuration template. | 484 | * Configuration template. |
490 | */ | 485 | */ |
491 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 486 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
@@ -2252,7 +2247,7 @@ static void schedule_connect(void *cls, const struct GNUNET_SCHEDULER_TaskContex | |||
2252 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2247 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2253 | _("Delaying connect, we have too many outstanding connections!\n")); | 2248 | _("Delaying connect, we have too many outstanding connections!\n")); |
2254 | #endif | 2249 | #endif |
2255 | GNUNET_SCHEDULER_add_delayed(connect_context->ct_ctx->pg->sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &schedule_connect, connect_context); | 2250 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &schedule_connect, connect_context); |
2256 | } | 2251 | } |
2257 | else | 2252 | else |
2258 | { | 2253 | { |
@@ -2296,7 +2291,7 @@ connect_iterator (void *cls, | |||
2296 | connect_context->first = first->daemon; | 2291 | connect_context->first = first->daemon; |
2297 | connect_context->second = second; | 2292 | connect_context->second = second; |
2298 | connect_context->ct_ctx = ct_ctx; | 2293 | connect_context->ct_ctx = ct_ctx; |
2299 | GNUNET_SCHEDULER_add_now(first->pg->sched, &schedule_connect, connect_context); | 2294 | GNUNET_SCHEDULER_add_now(&schedule_connect, connect_context); |
2300 | 2295 | ||
2301 | return GNUNET_YES; | 2296 | return GNUNET_YES; |
2302 | } | 2297 | } |
@@ -2404,7 +2399,7 @@ connect_topology (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_NotifyComp | |||
2404 | connect_context->pg = pg; | 2399 | connect_context->pg = pg; |
2405 | connect_context->first = FIXME; | 2400 | connect_context->first = FIXME; |
2406 | connect_context->second = connection_iter->daemon; | 2401 | connect_context->second = connection_iter->daemon; |
2407 | GNUNET_SCHEDULER_add_now(pg->sched, &schedule_connect, connect_context); | 2402 | GNUNET_SCHEDULER_add_now(&schedule_connect, connect_context); |
2408 | connection_iter = connection_iter->next; | 2403 | connection_iter = connection_iter->next; |
2409 | } | 2404 | } |
2410 | #endif | 2405 | #endif |
@@ -3156,7 +3151,7 @@ schedule_get_topology(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
3156 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3151 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3157 | _("Delaying connect, we have too many outstanding connections!\n")); | 3152 | _("Delaying connect, we have too many outstanding connections!\n")); |
3158 | #endif | 3153 | #endif |
3159 | GNUNET_SCHEDULER_add_delayed(core_context->daemon->sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &schedule_get_topology, core_context); | 3154 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &schedule_get_topology, core_context); |
3160 | } | 3155 | } |
3161 | else | 3156 | else |
3162 | { | 3157 | { |
@@ -3165,7 +3160,7 @@ schedule_get_topology(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
3165 | _("Creating connection, outstanding_connections is %d\n"), outstanding_connects); | 3160 | _("Creating connection, outstanding_connections is %d\n"), outstanding_connects); |
3166 | #endif | 3161 | #endif |
3167 | topology_context->connected++; | 3162 | topology_context->connected++; |
3168 | if (GNUNET_OK != GNUNET_CORE_iterate_peers (core_context->daemon->sched, core_context->daemon->cfg, &internal_topology_callback, core_context)) | 3163 | if (GNUNET_OK != GNUNET_CORE_iterate_peers (core_context->daemon->cfg, &internal_topology_callback, core_context)) |
3169 | internal_topology_callback(core_context, NULL, GNUNET_TIME_relative_get_zero(), 0); | 3164 | internal_topology_callback(core_context, NULL, GNUNET_TIME_relative_get_zero(), 0); |
3170 | 3165 | ||
3171 | } | 3166 | } |
@@ -3197,7 +3192,7 @@ GNUNET_TESTING_get_topology (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING | |||
3197 | core_ctx->daemon = pg->peers[i].daemon; | 3192 | core_ctx->daemon = pg->peers[i].daemon; |
3198 | /* Set back pointer to topology iteration context */ | 3193 | /* Set back pointer to topology iteration context */ |
3199 | core_ctx->iter_context = topology_context; | 3194 | core_ctx->iter_context = topology_context; |
3200 | GNUNET_SCHEDULER_add_now(pg->sched, &schedule_get_topology, core_ctx); | 3195 | GNUNET_SCHEDULER_add_now(&schedule_get_topology, core_ctx); |
3201 | total_count++; | 3196 | total_count++; |
3202 | } | 3197 | } |
3203 | } | 3198 | } |
@@ -3276,7 +3271,7 @@ schedule_get_statistics(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
3276 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3271 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3277 | _("Delaying connect, we have too many outstanding connections!\n")); | 3272 | _("Delaying connect, we have too many outstanding connections!\n")); |
3278 | #endif | 3273 | #endif |
3279 | GNUNET_SCHEDULER_add_delayed(core_context->daemon->sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &schedule_get_statistics, core_context); | 3274 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &schedule_get_statistics, core_context); |
3280 | } | 3275 | } |
3281 | else | 3276 | else |
3282 | { | 3277 | { |
@@ -3286,7 +3281,7 @@ schedule_get_statistics(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
3286 | #endif | 3281 | #endif |
3287 | 3282 | ||
3288 | stats_context->connected++; | 3283 | stats_context->connected++; |
3289 | core_context->stats_handle = GNUNET_STATISTICS_create(core_context->daemon->sched, "testing", core_context->daemon->cfg); | 3284 | core_context->stats_handle = GNUNET_STATISTICS_create("testing", core_context->daemon->cfg); |
3290 | if (core_context->stats_handle == NULL) | 3285 | if (core_context->stats_handle == NULL) |
3291 | { | 3286 | { |
3292 | internal_stats_cont (core_context, GNUNET_NO); | 3287 | internal_stats_cont (core_context, GNUNET_NO); |
@@ -3394,7 +3389,7 @@ GNUNET_TESTING_get_statistics (struct GNUNET_TESTING_PeerGroup *pg, | |||
3394 | core_ctx->daemon = pg->peers[i].daemon; | 3389 | core_ctx->daemon = pg->peers[i].daemon; |
3395 | /* Set back pointer to topology iteration context */ | 3390 | /* Set back pointer to topology iteration context */ |
3396 | core_ctx->iter_context = stats_context; | 3391 | core_ctx->iter_context = stats_context; |
3397 | GNUNET_SCHEDULER_add_now(pg->sched, &schedule_get_statistics, core_ctx); | 3392 | GNUNET_SCHEDULER_add_now(&schedule_get_statistics, core_ctx); |
3398 | total_count++; | 3393 | total_count++; |
3399 | } | 3394 | } |
3400 | } | 3395 | } |
@@ -3626,7 +3621,7 @@ internal_continue_startup (void *cls, const struct GNUNET_SCHEDULER_TaskContext | |||
3626 | } | 3621 | } |
3627 | else | 3622 | else |
3628 | { | 3623 | { |
3629 | GNUNET_SCHEDULER_add_delayed(internal_context->peer->pg->sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &internal_continue_startup, internal_context); | 3624 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &internal_continue_startup, internal_context); |
3630 | } | 3625 | } |
3631 | } | 3626 | } |
3632 | 3627 | ||
@@ -3697,7 +3692,7 @@ static void schedule_churn_restart(void *cls, const struct GNUNET_SCHEDULER_Task | |||
3697 | struct ChurnRestartContext *startup_ctx = peer_restart_ctx->churn_restart_ctx; | 3692 | struct ChurnRestartContext *startup_ctx = peer_restart_ctx->churn_restart_ctx; |
3698 | 3693 | ||
3699 | if (startup_ctx->outstanding > MAX_CONCURRENT_STARTING) | 3694 | if (startup_ctx->outstanding > MAX_CONCURRENT_STARTING) |
3700 | GNUNET_SCHEDULER_add_delayed(peer_restart_ctx->daemon->sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &schedule_churn_restart, peer_restart_ctx); | 3695 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &schedule_churn_restart, peer_restart_ctx); |
3701 | else | 3696 | else |
3702 | { | 3697 | { |
3703 | GNUNET_TESTING_daemon_start_stopped(peer_restart_ctx->daemon, | 3698 | GNUNET_TESTING_daemon_start_stopped(peer_restart_ctx->daemon, |
@@ -3721,8 +3716,7 @@ internal_start (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
3721 | if (internal_context->peer->pg->starting < MAX_CONCURRENT_HOSTKEYS) | 3716 | if (internal_context->peer->pg->starting < MAX_CONCURRENT_HOSTKEYS) |
3722 | { | 3717 | { |
3723 | internal_context->peer->pg->starting++; | 3718 | internal_context->peer->pg->starting++; |
3724 | internal_context->peer->daemon = GNUNET_TESTING_daemon_start (internal_context->peer->pg->sched, | 3719 | internal_context->peer->daemon = GNUNET_TESTING_daemon_start (internal_context->peer->cfg, |
3725 | internal_context->peer->cfg, | ||
3726 | internal_context->timeout, | 3720 | internal_context->timeout, |
3727 | internal_context->hostname, | 3721 | internal_context->hostname, |
3728 | internal_context->username, | 3722 | internal_context->username, |
@@ -3734,7 +3728,7 @@ internal_start (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
3734 | } | 3728 | } |
3735 | else | 3729 | else |
3736 | { | 3730 | { |
3737 | GNUNET_SCHEDULER_add_delayed(internal_context->peer->pg->sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &internal_start, internal_context); | 3731 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &internal_start, internal_context); |
3738 | } | 3732 | } |
3739 | } | 3733 | } |
3740 | 3734 | ||
@@ -3753,7 +3747,7 @@ GNUNET_TESTING_daemons_continue_startup(struct GNUNET_TESTING_PeerGroup *pg) | |||
3753 | pg->starting = 0; | 3747 | pg->starting = 0; |
3754 | for (i = 0; i < pg->total; i++) | 3748 | for (i = 0; i < pg->total; i++) |
3755 | { | 3749 | { |
3756 | GNUNET_SCHEDULER_add_now (pg->sched, &internal_continue_startup, &pg->peers[i].internal_context); | 3750 | GNUNET_SCHEDULER_add_now (&internal_continue_startup, &pg->peers[i].internal_context); |
3757 | //GNUNET_TESTING_daemon_continue_startup(pg->peers[i].daemon); | 3751 | //GNUNET_TESTING_daemon_continue_startup(pg->peers[i].daemon); |
3758 | } | 3752 | } |
3759 | } | 3753 | } |
@@ -3764,7 +3758,6 @@ GNUNET_TESTING_daemons_continue_startup(struct GNUNET_TESTING_PeerGroup *pg) | |||
3764 | * adjusted to ensure that no two peers running on the same system | 3758 | * adjusted to ensure that no two peers running on the same system |
3765 | * have the same port(s) in their respective configurations. | 3759 | * have the same port(s) in their respective configurations. |
3766 | * | 3760 | * |
3767 | * @param sched scheduler to use | ||
3768 | * @param cfg configuration template to use | 3761 | * @param cfg configuration template to use |
3769 | * @param total number of daemons to start | 3762 | * @param total number of daemons to start |
3770 | * @param timeout total time allowed for peers to start | 3763 | * @param timeout total time allowed for peers to start |
@@ -3782,8 +3775,7 @@ GNUNET_TESTING_daemons_continue_startup(struct GNUNET_TESTING_PeerGroup *pg) | |||
3782 | * @return NULL on error, otherwise handle to control peer group | 3775 | * @return NULL on error, otherwise handle to control peer group |
3783 | */ | 3776 | */ |
3784 | struct GNUNET_TESTING_PeerGroup * | 3777 | struct GNUNET_TESTING_PeerGroup * |
3785 | GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, | 3778 | GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
3786 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
3787 | unsigned int total, | 3779 | unsigned int total, |
3788 | struct GNUNET_TIME_Relative timeout, | 3780 | struct GNUNET_TIME_Relative timeout, |
3789 | GNUNET_TESTING_NotifyHostkeyCreated hostkey_callback, | 3781 | GNUNET_TESTING_NotifyHostkeyCreated hostkey_callback, |
@@ -3822,7 +3814,6 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, | |||
3822 | upnum = 0; | 3814 | upnum = 0; |
3823 | fdnum = 0; | 3815 | fdnum = 0; |
3824 | pg = GNUNET_malloc (sizeof (struct GNUNET_TESTING_PeerGroup)); | 3816 | pg = GNUNET_malloc (sizeof (struct GNUNET_TESTING_PeerGroup)); |
3825 | pg->sched = sched; | ||
3826 | pg->cfg = cfg; | 3817 | pg->cfg = cfg; |
3827 | pg->notify_connection = connect_callback; | 3818 | pg->notify_connection = connect_callback; |
3828 | pg->notify_connection_cls = connect_callback_cls; | 3819 | pg->notify_connection_cls = connect_callback_cls; |
@@ -3980,7 +3971,7 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, | |||
3980 | pg->peers[off].internal_context.start_cb = cb; | 3971 | pg->peers[off].internal_context.start_cb = cb; |
3981 | pg->peers[off].internal_context.start_cb_cls = cb_cls; | 3972 | pg->peers[off].internal_context.start_cb_cls = cb_cls; |
3982 | 3973 | ||
3983 | GNUNET_SCHEDULER_add_now (sched, &internal_start, &pg->peers[off].internal_context); | 3974 | GNUNET_SCHEDULER_add_now (&internal_start, &pg->peers[off].internal_context); |
3984 | 3975 | ||
3985 | } | 3976 | } |
3986 | return pg; | 3977 | return pg; |
@@ -4156,7 +4147,7 @@ schedule_churn_shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskConte | |||
4156 | GNUNET_assert(shutdown_ctx != NULL); | 4147 | GNUNET_assert(shutdown_ctx != NULL); |
4157 | 4148 | ||
4158 | if (shutdown_ctx->outstanding > MAX_CONCURRENT_SHUTDOWN) | 4149 | if (shutdown_ctx->outstanding > MAX_CONCURRENT_SHUTDOWN) |
4159 | GNUNET_SCHEDULER_add_delayed(peer_shutdown_ctx->daemon->sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &schedule_churn_shutdown_task, peer_shutdown_ctx); | 4150 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &schedule_churn_shutdown_task, peer_shutdown_ctx); |
4160 | else | 4151 | else |
4161 | { | 4152 | { |
4162 | shutdown_ctx->outstanding++; | 4153 | shutdown_ctx->outstanding++; |
@@ -4309,7 +4300,7 @@ GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg, | |||
4309 | peer_shutdown_ctx = GNUNET_malloc(sizeof(struct PeerShutdownContext)); | 4300 | peer_shutdown_ctx = GNUNET_malloc(sizeof(struct PeerShutdownContext)); |
4310 | peer_shutdown_ctx->daemon = pg->peers[running_arr[running_permute[i]]].daemon; | 4301 | peer_shutdown_ctx->daemon = pg->peers[running_arr[running_permute[i]]].daemon; |
4311 | peer_shutdown_ctx->shutdown_ctx = shutdown_ctx; | 4302 | peer_shutdown_ctx->shutdown_ctx = shutdown_ctx; |
4312 | GNUNET_SCHEDULER_add_now(peer_shutdown_ctx->daemon->sched, &schedule_churn_shutdown_task, peer_shutdown_ctx); | 4303 | GNUNET_SCHEDULER_add_now(&schedule_churn_shutdown_task, peer_shutdown_ctx); |
4313 | 4304 | ||
4314 | /* | 4305 | /* |
4315 | GNUNET_TESTING_daemon_stop (pg->peers[running_arr[running_permute[i]]].daemon, | 4306 | GNUNET_TESTING_daemon_stop (pg->peers[running_arr[running_permute[i]]].daemon, |
@@ -4334,7 +4325,7 @@ GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg, | |||
4334 | peer_restart_ctx = GNUNET_malloc(sizeof(struct PeerRestartContext)); | 4325 | peer_restart_ctx = GNUNET_malloc(sizeof(struct PeerRestartContext)); |
4335 | peer_restart_ctx->churn_restart_ctx = churn_startup_ctx; | 4326 | peer_restart_ctx->churn_restart_ctx = churn_startup_ctx; |
4336 | peer_restart_ctx->daemon = pg->peers[stopped_arr[stopped_permute[i]]].daemon; | 4327 | peer_restart_ctx->daemon = pg->peers[stopped_arr[stopped_permute[i]]].daemon; |
4337 | GNUNET_SCHEDULER_add_now(peer_restart_ctx->daemon->sched, &schedule_churn_restart, peer_restart_ctx); | 4328 | GNUNET_SCHEDULER_add_now(&schedule_churn_restart, peer_restart_ctx); |
4338 | /* | 4329 | /* |
4339 | GNUNET_TESTING_daemon_start_stopped(pg->peers[stopped_arr[stopped_permute[i]]].daemon, | 4330 | GNUNET_TESTING_daemon_start_stopped(pg->peers[stopped_arr[stopped_permute[i]]].daemon, |
4340 | timeout, &churn_start_callback, churn_ctx);*/ | 4331 | timeout, &churn_start_callback, churn_ctx);*/ |
@@ -4485,7 +4476,7 @@ schedule_shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext * t | |||
4485 | GNUNET_assert(shutdown_ctx != NULL); | 4476 | GNUNET_assert(shutdown_ctx != NULL); |
4486 | 4477 | ||
4487 | if (shutdown_ctx->outstanding > MAX_CONCURRENT_SHUTDOWN) | 4478 | if (shutdown_ctx->outstanding > MAX_CONCURRENT_SHUTDOWN) |
4488 | GNUNET_SCHEDULER_add_delayed(peer_shutdown_ctx->daemon->sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &schedule_shutdown_task, peer_shutdown_ctx); | 4479 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100), &schedule_shutdown_task, peer_shutdown_ctx); |
4489 | else | 4480 | else |
4490 | { | 4481 | { |
4491 | shutdown_ctx->outstanding++; | 4482 | shutdown_ctx->outstanding++; |
@@ -4527,7 +4518,7 @@ GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg, | |||
4527 | peer_shutdown_ctx = GNUNET_malloc(sizeof(struct PeerShutdownContext)); | 4518 | peer_shutdown_ctx = GNUNET_malloc(sizeof(struct PeerShutdownContext)); |
4528 | peer_shutdown_ctx->daemon = pg->peers[off].daemon; | 4519 | peer_shutdown_ctx->daemon = pg->peers[off].daemon; |
4529 | peer_shutdown_ctx->shutdown_ctx = shutdown_ctx; | 4520 | peer_shutdown_ctx->shutdown_ctx = shutdown_ctx; |
4530 | GNUNET_SCHEDULER_add_now(pg->peers[off].daemon->sched, &schedule_shutdown_task, peer_shutdown_ctx); | 4521 | GNUNET_SCHEDULER_add_now(&schedule_shutdown_task, peer_shutdown_ctx); |
4531 | //GNUNET_TESTING_daemon_stop (pg->peers[off].daemon, timeout, shutdown_cb, shutdown_ctx, GNUNET_YES, GNUNET_NO); | 4522 | //GNUNET_TESTING_daemon_stop (pg->peers[off].daemon, timeout, shutdown_cb, shutdown_ctx, GNUNET_YES, GNUNET_NO); |
4532 | if (NULL != pg->peers[off].cfg) | 4523 | if (NULL != pg->peers[off].cfg) |
4533 | GNUNET_CONFIGURATION_destroy (pg->peers[off].cfg); | 4524 | GNUNET_CONFIGURATION_destroy (pg->peers[off].cfg); |