/** * Kill a #Slave object * * @param slave the #Slave object */ static void kill_slave (struct Slave *slave) { struct HostRegistration *hr_entry; while (NULL != (hr_entry = slave->hr_dll_head)) { GNUNET_CONTAINER_DLL_remove (slave->hr_dll_head, slave->hr_dll_tail, hr_entry); GNUNET_free (hr_entry); } if (NULL != slave->rhandle) GNUNET_TESTBED_cancel_registration (slave->rhandle); GNUNET_assert (GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap_iterate (slave->reghost_map, reghost_free_iterator, slave)); GNUNET_CONTAINER_multihashmap_destroy (slave->reghost_map); if (NULL != slave->controller) GNUNET_TESTBED_controller_disconnect (slave->controller); if (NULL != slave->controller_proc) { LOG_DEBUG ("Stopping a slave\n"); GNUNET_TESTBED_controller_kill_ (slave->controller_proc); } }
/** * Shutdown nicely * * @param cls NULL * @param tc the task context */ static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct DLLOperation *dll_op; unsigned int nhost; shutdown_task = GNUNET_SCHEDULER_NO_TASK; if (GNUNET_SCHEDULER_NO_TASK != abort_task) GNUNET_SCHEDULER_cancel (abort_task); if (GNUNET_SCHEDULER_NO_TASK != register_hosts_task) GNUNET_SCHEDULER_cancel (register_hosts_task); if (NULL != reg_handle) GNUNET_TESTBED_cancel_registration (reg_handle); if (NULL != topology_op) GNUNET_TESTBED_operation_done (topology_op); for (nhost = 0; nhost < num_hosts; nhost++) if (NULL != hosts[nhost]) GNUNET_TESTBED_host_destroy (hosts[nhost]); GNUNET_free_non_null (hosts); while (NULL != (dll_op = dll_op_head)) { GNUNET_TESTBED_operation_done (dll_op->op); GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op); GNUNET_free (dll_op); } if (NULL != mc) GNUNET_TESTBED_controller_disconnect (mc); if (NULL != mc_proc) GNUNET_TESTBED_controller_stop (mc_proc); if (NULL != cfg) GNUNET_CONFIGURATION_destroy (cfg); GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */ }
/** * Shutdown nicely * * @param cls NULL * @param tc the task context */ static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); if (NULL != delay_task_id) { GNUNET_SCHEDULER_cancel (delay_task_id); delay_task_id = NULL; } if (NULL != hc_handle) GNUNET_TESTBED_is_host_habitable_cancel (hc_handle); if (NULL != mc) GNUNET_TESTBED_controller_disconnect (mc); if (NULL != cp) GNUNET_TESTBED_controller_stop (cp); if (NULL != slave3) GNUNET_TESTBED_host_destroy (slave3); if (NULL != slave2) GNUNET_TESTBED_host_destroy (slave2); if (NULL != slave) GNUNET_TESTBED_host_destroy (slave); if (NULL != host) GNUNET_TESTBED_host_destroy (host); if (NULL != cfg) GNUNET_CONFIGURATION_destroy (cfg); if (NULL != cfg3) GNUNET_CONFIGURATION_destroy (cfg3); if (NULL != rh) GNUNET_TESTBED_cancel_registration (rh); }
/** * Shutdown nicely * * @param cls NULL * @param tc the task context */ static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); if (NULL != hc_handle) GNUNET_TESTBED_is_host_habitable_cancel (hc_handle); GNUNET_assert (NULL == delayed_connect_task); if (NULL != common_operation) GNUNET_TESTBED_operation_done (common_operation); if (NULL != reg_handle) GNUNET_TESTBED_cancel_registration (reg_handle); if (NULL != controller1) GNUNET_TESTBED_controller_disconnect (controller1); GNUNET_CONFIGURATION_destroy (cfg); if (NULL != cfg2) GNUNET_CONFIGURATION_destroy (cfg2); if (NULL != cp1) GNUNET_TESTBED_controller_stop (cp1); if (NULL != host) GNUNET_TESTBED_host_destroy (host); if (NULL != neighbour1) GNUNET_TESTBED_host_destroy (neighbour1); if (NULL != neighbour2) GNUNET_TESTBED_host_destroy (neighbour2); }
/** * Cancels operations and tasks which are assigned to the given run context * * @param rc the RunContext */ static void rc_cleanup_operations (struct GNUNET_TESTBED_RunHandle *rc) { struct CompatibilityCheckContext *hc; unsigned int nhost; if (NULL != rc->hclist) { for (nhost = 0; nhost < rc->num_hosts; nhost++) { hc = &rc->hclist[nhost]; if (NULL != hc->h) GNUNET_TESTBED_is_host_habitable_cancel (hc->h); } GNUNET_free (rc->hclist); rc->hclist = NULL; } /* Stop register hosts task if it is running */ if (NULL != rc->register_hosts_task) { GNUNET_SCHEDULER_cancel (rc->register_hosts_task); rc->register_hosts_task = NULL; } if (NULL != rc->timeout_task) { GNUNET_SCHEDULER_cancel (rc->timeout_task); rc->timeout_task = NULL; } if (NULL != rc->reg_handle) { GNUNET_TESTBED_cancel_registration (rc->reg_handle); rc->reg_handle = NULL; } if (NULL != rc->topology_operation) { GNUNET_TESTBED_operation_done (rc->topology_operation); rc->topology_operation = NULL; } /* cancel any exiting operations */ GNUNET_assert (GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap32_iterate (rc->rcop_map, &rcop_cleanup_iterator, rc)); }
/** * Shutdown nicely * * @param cls NULL * @param tc the task context */ static void do_shutdown (void *cls) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down...\n"); if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); if (NULL != reg_handle) GNUNET_TESTBED_cancel_registration (reg_handle); if (NULL != controller) GNUNET_TESTBED_controller_disconnect (controller); if (NULL != cfg) GNUNET_CONFIGURATION_destroy (cfg); if (NULL != cp) GNUNET_TESTBED_controller_stop (cp); if (NULL != neighbour) GNUNET_TESTBED_host_destroy (neighbour); if (NULL != host) GNUNET_TESTBED_host_destroy (host); }
/** * Shutdown nicely * * @param cls NULL * @param tc the task context */ static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { if (GNUNET_SCHEDULER_NO_TASK != abort_task) GNUNET_SCHEDULER_cancel (abort_task); if (NULL != slave3) GNUNET_TESTBED_host_destroy (slave3); if (NULL != slave2) GNUNET_TESTBED_host_destroy (slave2); if (NULL != slave) GNUNET_TESTBED_host_destroy (slave); if (NULL != host) GNUNET_TESTBED_host_destroy (host); if (NULL != mc) GNUNET_TESTBED_controller_disconnect (mc); if (NULL != cfg) GNUNET_CONFIGURATION_destroy (cfg); if (NULL != cfg3) GNUNET_CONFIGURATION_destroy (cfg3); if (NULL != cp) GNUNET_TESTBED_controller_stop (cp); if (NULL != rh) GNUNET_TESTBED_cancel_registration (rh); }