diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-12-24 01:10:47 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-12-24 01:10:47 +0000 |
commit | f1f603c7d0b3f03dca46a4f313472288eb080eb1 (patch) | |
tree | 3a29966b02dfb83e0a8a8d5c42b3116380209fb0 | |
parent | 53cd5b8eda2fa8db86b0907a62a39598981d008a (diff) |
making GNUNET_SCHEDULER_cancel() perform in O(1) instead of O(n) to help or even fully address #3247
315 files changed, 2751 insertions, 2754 deletions
diff --git a/doc/testbed_test.c b/doc/testbed_test.c index bdda338b06..e48bb28d89 100644 --- a/doc/testbed_test.c +++ b/doc/testbed_test.c @@ -11,7 +11,7 @@ static struct GNUNET_TESTBED_Operation *dht_op; static struct GNUNET_DHT_Handle *dht_handle; -static GNUNET_SCHEDULER_TaskIdentifier shutdown_tid; +static struct GNUNET_SCHEDULER_Task * shutdown_tid; /** @@ -39,7 +39,7 @@ static int result; static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - shutdown_tid = GNUNET_SCHEDULER_NO_TASK; + shutdown_tid = NULL; if (NULL != dht_op) { GNUNET_TESTBED_operation_done (dht_op); /* indirectly calls the dht_da() for closing diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index 1b83c31063..4b68f19def 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c @@ -91,7 +91,7 @@ struct GNUNET_ARM_Handle /** * ID of the reconnect task (if any). */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Current delay we use for re-trying to connect to core. @@ -166,7 +166,7 @@ struct ARMControlMessage /** * Task to run when request times out. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task_id; + struct GNUNET_SCHEDULER_Task * timeout_task_id; /** * Flags for passing std descriptors to ARM (when starting ARM). @@ -212,7 +212,7 @@ reconnect_arm_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_ARM_Handle *h = cls; - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to ARM service after delay\n"); reconnect_arm (h); } @@ -240,7 +240,7 @@ reconnect_arm_later (struct GNUNET_ARM_Handle *h) h->client = NULL; } h->currently_down = GNUNET_YES; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task); + GNUNET_assert (NULL == h->reconnect_task); h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->retry_backoff, &reconnect_arm_task, h); /* Don't clear pending messages on disconnection, deliver them later @@ -408,7 +408,7 @@ client_notify_handler (void *cls, fail = GNUNET_YES; break; } - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != cm->timeout_task_id); + GNUNET_assert (NULL != cm->timeout_task_id); GNUNET_SCHEDULER_cancel (cm->timeout_task_id); GNUNET_CONTAINER_DLL_remove (h->control_sent_head, h->control_sent_tail, cm); @@ -493,7 +493,7 @@ transmit_arm_message (void *cls, size_t size, void *buf) LOG (GNUNET_ERROR_TYPE_DEBUG, "transmit_arm_message is running with %p buffer of size %lu. ARM is known to be %s\n", buf, size, h->currently_down ? "unconnected" : "connected"); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task); + GNUNET_assert (NULL == h->reconnect_task); h->cth = NULL; if ((GNUNET_YES == h->currently_down) && (NULL != buf)) { @@ -643,7 +643,7 @@ GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, h = GNUNET_new (struct GNUNET_ARM_Handle); h->cfg = GNUNET_CONFIGURATION_dup (cfg); h->currently_down = GNUNET_YES; - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; h->conn_status = conn_status; h->conn_status_cls = cls; if (GNUNET_OK != reconnect_arm (h)) @@ -680,7 +680,7 @@ GNUNET_ARM_disconnect_and_free (struct GNUNET_ARM_Handle *h) else GNUNET_CONTAINER_DLL_remove (h->control_sent_head, h->control_sent_tail, cm); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != cm->timeout_task_id); + GNUNET_assert (NULL != cm->timeout_task_id); GNUNET_SCHEDULER_cancel (cm->timeout_task_id); if (NULL != cm->result_cont) cm->result_cont (cm->cont_cls, GNUNET_ARM_REQUEST_DISCONNECTED, @@ -694,10 +694,10 @@ GNUNET_ARM_disconnect_and_free (struct GNUNET_ARM_Handle *h) GNUNET_CLIENT_disconnect (h->client); h->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->reconnect_task) + if (NULL != h->reconnect_task) { GNUNET_SCHEDULER_cancel (h->reconnect_task); - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; } if (GNUNET_NO == h->service_test_is_active) { @@ -984,10 +984,10 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, GNUNET_CLIENT_disconnect (h->client); h->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->reconnect_task) + if (NULL != h->reconnect_task) { GNUNET_SCHEDULER_cancel (h->reconnect_task); - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; } LOG (GNUNET_ERROR_TYPE_DEBUG, diff --git a/src/arm/arm_monitor_api.c b/src/arm/arm_monitor_api.c index 676543f266..c03f5df0fc 100644 --- a/src/arm/arm_monitor_api.c +++ b/src/arm/arm_monitor_api.c @@ -57,7 +57,7 @@ struct GNUNET_ARM_MonitorHandle /** * ID of the reconnect task (if any). */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Current delay we use for re-trying to connect to core. @@ -82,7 +82,7 @@ struct GNUNET_ARM_MonitorHandle /** * ID of a task to run if we fail to get a reply to the init message in time. */ - GNUNET_SCHEDULER_TaskIdentifier init_timeout_task_id; + struct GNUNET_SCHEDULER_Task * init_timeout_task_id; }; static void @@ -102,7 +102,7 @@ reconnect_arm_monitor_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext { struct GNUNET_ARM_MonitorHandle *h = cls; - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to ARM service for monitoring after delay\n"); reconnect_arm_monitor (h); } @@ -129,13 +129,13 @@ reconnect_arm_monitor_later (struct GNUNET_ARM_MonitorHandle *h) h->monitor = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->init_timeout_task_id) + if (NULL != h->init_timeout_task_id) { GNUNET_SCHEDULER_cancel (h->init_timeout_task_id); - h->init_timeout_task_id = GNUNET_SCHEDULER_NO_TASK; + h->init_timeout_task_id = NULL; } - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task); + GNUNET_assert (NULL == h->reconnect_task); h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->retry_backoff, &reconnect_arm_monitor_task, h); @@ -156,7 +156,7 @@ init_timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) LOG (GNUNET_ERROR_TYPE_DEBUG, "Init message timed out\n"); - h->init_timeout_task_id = GNUNET_SCHEDULER_NO_TASK; + h->init_timeout_task_id = NULL; reconnect_arm_monitor_later (h); } @@ -176,8 +176,8 @@ transmit_monitoring_init_message (void *cls, size_t size, void *buf) struct GNUNET_MessageHeader *msg; uint16_t msize; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->init_timeout_task_id); + GNUNET_assert (NULL == h->reconnect_task); + GNUNET_assert (NULL == h->init_timeout_task_id); h->cth = NULL; if (NULL == buf) { @@ -254,8 +254,8 @@ GNUNET_ARM_monitor (const struct GNUNET_CONFIGURATION_Handle *cfg, h = GNUNET_new (struct GNUNET_ARM_MonitorHandle); h->cfg = GNUNET_CONFIGURATION_dup (cfg); h->currently_down = GNUNET_YES; - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; - h->init_timeout_task_id = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; + h->init_timeout_task_id = NULL; h->service_status = cont; h->cls = cont_cls; if (GNUNET_OK != reconnect_arm_monitor (h)) @@ -281,20 +281,20 @@ GNUNET_ARM_monitor_disconnect_and_free (struct GNUNET_ARM_MonitorHandle *h) GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth); h->cth = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->init_timeout_task_id) + if (NULL != h->init_timeout_task_id) { GNUNET_SCHEDULER_cancel (h->init_timeout_task_id); - h->init_timeout_task_id = GNUNET_SCHEDULER_NO_TASK; + h->init_timeout_task_id = NULL; } if (NULL != h->monitor) { GNUNET_CLIENT_disconnect (h->monitor); h->monitor = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->reconnect_task) + if (NULL != h->reconnect_task) { GNUNET_SCHEDULER_cancel (h->reconnect_task); - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; } GNUNET_CONFIGURATION_destroy (h->cfg); GNUNET_free (h); @@ -335,10 +335,10 @@ monitor_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) reconnect_arm_monitor_later (h); return; } - if (GNUNET_SCHEDULER_NO_TASK != h->init_timeout_task_id) + if (NULL != h->init_timeout_task_id) { GNUNET_SCHEDULER_cancel (h->init_timeout_task_id); - h->init_timeout_task_id = GNUNET_SCHEDULER_NO_TASK; + h->init_timeout_task_id = NULL; } res = (const struct GNUNET_ARM_StatusMessage *) msg; LOG (GNUNET_ERROR_TYPE_DEBUG, diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index c6259c273d..630816d1dd 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c @@ -81,7 +81,7 @@ struct ServiceListeningInfo /** * Task doing the accepting. */ - GNUNET_SCHEDULER_TaskIdentifier accept_task; + struct GNUNET_SCHEDULER_Task * accept_task; }; @@ -200,13 +200,13 @@ static char *final_option; /** * ID of task called whenever we get a SIGCHILD. */ -static GNUNET_SCHEDULER_TaskIdentifier child_death_task; +static struct GNUNET_SCHEDULER_Task * child_death_task; /** * ID of task called whenever the timeout for restarting a child * expires. */ -static GNUNET_SCHEDULER_TaskIdentifier child_restart_task; +static struct GNUNET_SCHEDULER_Task * child_restart_task; /** * Pipe used to communicate shutdown via signal. @@ -421,10 +421,10 @@ start_process (struct ServiceList *sl, { GNUNET_array_append (lsocks, ls, GNUNET_NETWORK_get_fd (sli->listen_socket)); - if (sli->accept_task != GNUNET_SCHEDULER_NO_TASK) + if (sli->accept_task != NULL) { GNUNET_SCHEDULER_cancel (sli->accept_task); - sli->accept_task = GNUNET_SCHEDULER_NO_TASK; + sli->accept_task = NULL; } } #if WINDOWS @@ -586,7 +586,7 @@ accept_connection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct ServiceListeningInfo *sli = cls; struct ServiceList *sl = sli->sl; - sli->accept_task = GNUNET_SCHEDULER_NO_TASK; + sli->accept_task = NULL; GNUNET_assert (GNUNET_NO == in_shutdown); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; @@ -971,10 +971,10 @@ do_shutdown () GNUNET_SERVER_destroy (server); server = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != child_death_task) + if (NULL != child_death_task) { GNUNET_SCHEDULER_cancel (child_death_task); - child_death_task = GNUNET_SCHEDULER_NO_TASK; + child_death_task = NULL; } } @@ -1015,10 +1015,10 @@ shutdown_task (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "First shutdown phase\n"); - if (GNUNET_SCHEDULER_NO_TASK != child_restart_task) + if (NULL != child_restart_task) { GNUNET_SCHEDULER_cancel (child_restart_task); - child_restart_task = GNUNET_SCHEDULER_NO_TASK; + child_restart_task = NULL; } in_shutdown = GNUNET_YES; /* first, stop listening */ @@ -1028,10 +1028,10 @@ shutdown_task (void *cls, { GNUNET_CONTAINER_DLL_remove (pos->listen_head, pos->listen_tail, sli); - if (sli->accept_task != GNUNET_SCHEDULER_NO_TASK) + if (sli->accept_task != NULL) { GNUNET_SCHEDULER_cancel (sli->accept_task); - sli->accept_task = GNUNET_SCHEDULER_NO_TASK; + sli->accept_task = NULL; } GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sli->listen_socket)); @@ -1082,7 +1082,7 @@ delayed_restart_task (void *cls, struct GNUNET_TIME_Relative lowestRestartDelay; struct ServiceListeningInfo *sli; - child_restart_task = GNUNET_SCHEDULER_NO_TASK; + child_restart_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_assert (GNUNET_NO == in_shutdown); @@ -1110,7 +1110,7 @@ delayed_restart_task (void *cls, { /* process is run on-demand, ensure it is re-started if there is demand */ for (sli = sl->listen_head; NULL != sli; sli = sli->next) - if (GNUNET_SCHEDULER_NO_TASK == sli->accept_task) + if (NULL == sli->accept_task) { /* accept was actually paused, so start it again */ sli->accept_task = @@ -1164,7 +1164,7 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) const struct GNUNET_DISK_FileHandle *pr; pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); - child_death_task = GNUNET_SCHEDULER_NO_TASK; + child_death_task = NULL; if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) { /* shutdown scheduled us, ignore! */ @@ -1239,7 +1239,7 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /* process can still be re-started on-demand, ensure it is re-started if there is demand */ for (sli = pos->listen_head; NULL != sli; sli = sli->next) { - GNUNET_break (GNUNET_SCHEDULER_NO_TASK == sli->accept_task); + GNUNET_break (NULL == sli->accept_task); sli->accept_task = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, sli->listen_socket, &accept_connection, sli); @@ -1255,7 +1255,7 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /* schedule restart */ pos->restart_at = GNUNET_TIME_relative_to_absolute (pos->backoff); pos->backoff = GNUNET_TIME_STD_BACKOFF (pos->backoff); - if (GNUNET_SCHEDULER_NO_TASK != child_restart_task) + if (NULL != child_restart_task) GNUNET_SCHEDULER_cancel (child_restart_task); child_restart_task = GNUNET_SCHEDULER_add_with_priority ( GNUNET_SCHEDULER_PRIORITY_IDLE, &delayed_restart_task, NULL); diff --git a/src/arm/test_exponential_backoff.c b/src/arm/test_exponential_backoff.c index 7a552cc7c7..17aa8a04ca 100644 --- a/src/arm/test_exponential_backoff.c +++ b/src/arm/test_exponential_backoff.c @@ -90,7 +90,7 @@ struct ShutdownContext /** * Task set up to cancel the shutdown request on timeout. */ - GNUNET_SCHEDULER_TaskIdentifier cancel_task; + struct GNUNET_SCHEDULER_Task * cancel_task; /** * Task to call once shutdown complete diff --git a/src/ats-tests/ats-testing-experiment.c b/src/ats-tests/ats-testing-experiment.c index b07d8fdcd6..05c27cbc48 100644 --- a/src/ats-tests/ats-testing-experiment.c +++ b/src/ats-tests/ats-testing-experiment.c @@ -420,13 +420,13 @@ static void timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) { struct Experiment *e = cls; - e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->experiment_timeout_task = NULL; fprintf (stderr, "Experiment timeout!\n"); - if (GNUNET_SCHEDULER_NO_TASK != e->episode_timeout_task) + if (NULL != e->episode_timeout_task) { GNUNET_SCHEDULER_cancel (e->episode_timeout_task); - e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->episode_timeout_task = NULL; } e->e_done_cb (e, GNUNET_TIME_absolute_get_duration(e->start_time), @@ -578,7 +578,7 @@ static void timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) { struct Experiment *e = cls; - e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->episode_timeout_task = NULL; if (NULL != e->ep_done_cb) e->ep_done_cb (e->cur); @@ -588,10 +588,10 @@ timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) { /* done */ fprintf (stderr, "Last episode done!\n"); - if (GNUNET_SCHEDULER_NO_TASK != e->experiment_timeout_task) + if (NULL != e->experiment_timeout_task) { GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); - e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->experiment_timeout_task = NULL; } e->e_done_cb (e, GNUNET_TIME_absolute_get_duration(e->start_time), GNUNET_OK); return; @@ -728,15 +728,15 @@ GNUNET_ATS_TEST_experimentation_load (char *filename) void GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e) { - if (GNUNET_SCHEDULER_NO_TASK != e->experiment_timeout_task) + if (NULL != e->experiment_timeout_task) { GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); - e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->experiment_timeout_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != e->episode_timeout_task) + if (NULL != e->episode_timeout_task) { GNUNET_SCHEDULER_cancel (e->episode_timeout_task); - e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->episode_timeout_task = NULL; } free_experiment (e); } diff --git a/src/ats-tests/ats-testing-log.c b/src/ats-tests/ats-testing-log.c index e2367cc78f..5b7a206b9e 100644 --- a/src/ats-tests/ats-testing-log.c +++ b/src/ats-tests/ats-testing-log.c @@ -233,7 +233,7 @@ struct LoggingHandle /** * Logging task */ - GNUNET_SCHEDULER_TaskIdentifier log_task; + struct GNUNET_SCHEDULER_Task * log_task; /** * Reference to perf_ats' masters @@ -815,7 +815,7 @@ static void collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct LoggingHandle *l = cls; - l->log_task = GNUNET_SCHEDULER_NO_TASK; + l->log_task = NULL; GNUNET_ATS_TEST_logging_now (l); @@ -837,9 +837,9 @@ GNUNET_ATS_TEST_logging_stop (struct LoggingHandle *l) if (GNUNET_YES!= l->running) return; - if (GNUNET_SCHEDULER_NO_TASK != l->log_task) + if (NULL != l->log_task) GNUNET_SCHEDULER_cancel (l->log_task); - l->log_task = GNUNET_SCHEDULER_NO_TASK; + l->log_task = NULL; l->running = GNUNET_NO; GNUNET_log(GNUNET_ERROR_TYPE_INFO, diff --git a/src/ats-tests/ats-testing-preferences.c b/src/ats-tests/ats-testing-preferences.c index 1b11bd9246..ba69ae8c5d 100644 --- a/src/ats-tests/ats-testing-preferences.c +++ b/src/ats-tests/ats-testing-preferences.c @@ -96,7 +96,7 @@ set_pref_task (void *cls, { struct BenchmarkPartner *p = cls; double pref_value; - p->pg->set_task = GNUNET_SCHEDULER_NO_TASK; + p->pg->set_task = NULL; pref_value = get_preference (p->pg); @@ -214,10 +214,10 @@ GNUNET_ATS_TEST_generate_preferences_stop (struct PreferenceGenerator *pg) GNUNET_CONTAINER_DLL_remove (pg_head, pg_tail, pg); pg->dest->pg = NULL; - if (GNUNET_SCHEDULER_NO_TASK != pg->set_task) + if (NULL != pg->set_task) { GNUNET_SCHEDULER_cancel (pg->set_task); - pg->set_task = GNUNET_SCHEDULER_NO_TASK; + pg->set_task = NULL; } GNUNET_free (pg); diff --git a/src/ats-tests/ats-testing-traffic.c b/src/ats-tests/ats-testing-traffic.c index fca65b9009..ffeaad126c 100644 --- a/src/ats-tests/ats-testing-traffic.c +++ b/src/ats-tests/ats-testing-traffic.c @@ -171,7 +171,7 @@ comm_schedule_send (void *cls, { struct BenchmarkPartner *p = cls; - p->tg->send_task = GNUNET_SCHEDULER_NO_TASK; + p->tg->send_task = NULL; p->last_message_sent = GNUNET_TIME_absolute_get(); if (GNUNET_YES == top->test_core) { @@ -389,10 +389,10 @@ GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg) GNUNET_CONTAINER_DLL_remove (tg_head, tg_tail, tg); tg->dest->tg = NULL; - if (GNUNET_SCHEDULER_NO_TASK != tg->send_task) + if (NULL != tg->send_task) { GNUNET_SCHEDULER_cancel (tg->send_task); - tg->send_task = GNUNET_SCHEDULER_NO_TASK; + tg->send_task = NULL; } if (top->test_core) { diff --git a/src/ats-tests/ats-testing.c b/src/ats-tests/ats-testing.c index 23634974bc..f64fa1822b 100644 --- a/src/ats-tests/ats-testing.c +++ b/src/ats-tests/ats-testing.c @@ -66,7 +66,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) int c_op; struct BenchmarkPeer *p; - top->shutdown_task = GNUNET_SCHEDULER_NO_TASK; + top->shutdown_task = NULL; top->state.benchmarking = GNUNET_NO; GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Benchmarking done\n")); @@ -82,9 +82,9 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) p->peer_id_op = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != p->ats_task) + if (NULL != p->ats_task) GNUNET_SCHEDULER_cancel (p->ats_task); - p->ats_task = GNUNET_SCHEDULER_NO_TASK; + p->ats_task = NULL; for (c_op = 0; c_op < p->num_partners; c_op++) { @@ -419,7 +419,7 @@ connect_completion_callback (void *cls, struct GNUNET_TESTBED_Operation *op, _("Failed to connect master peer [%u] with slave [%u]\n"), cop->master->no, cop->slave->no); GNUNET_break(0); - if (GNUNET_SCHEDULER_NO_TASK != top->shutdown_task) + if (NULL != top->shutdown_task) GNUNET_SCHEDULER_cancel (top->shutdown_task); top->shutdown_task = GNUNET_SCHEDULER_add_now (do_shutdown, NULL ); } @@ -470,7 +470,7 @@ do_connect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) _("Could not connect master [%u] and slave [%u]\n"), p->no, top->sps[c_s].no); GNUNET_break(0); - if (GNUNET_SCHEDULER_NO_TASK != top->shutdown_task) + if (NULL != top->shutdown_task) GNUNET_SCHEDULER_cancel (top->shutdown_task); top->shutdown_task = GNUNET_SCHEDULER_add_now (do_shutdown, NULL ); return; @@ -489,7 +489,7 @@ comm_connect_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op, { GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Initialization failed, shutdown\n")); GNUNET_break(0); - if (GNUNET_SCHEDULER_NO_TASK != top->shutdown_task) + if (NULL != top->shutdown_task) GNUNET_SCHEDULER_cancel (top->shutdown_task); top->shutdown_task = GNUNET_SCHEDULER_add_now (do_shutdown, NULL ); return; @@ -676,7 +676,7 @@ ats_connect_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op, { GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Initialization failed, shutdown\n")); GNUNET_break(0); - if (GNUNET_SCHEDULER_NO_TASK != top->shutdown_task) + if (NULL != top->shutdown_task) GNUNET_SCHEDULER_cancel (top->shutdown_task); top->shutdown_task = GNUNET_SCHEDULER_add_now (do_shutdown, NULL ); return; diff --git a/src/ats-tests/ats-testing.h b/src/ats-tests/ats-testing.h index c74a460f00..0be6aa914b 100644 --- a/src/ats-tests/ats-testing.h +++ b/src/ats-tests/ats-testing.h @@ -167,7 +167,7 @@ struct BenchmarkPeer * Masters only * Progress task */ - GNUNET_SCHEDULER_TaskIdentifier ats_task; + struct GNUNET_SCHEDULER_Task * ats_task; /** * Masters only @@ -232,7 +232,7 @@ struct TrafficGenerator long int max_rate; struct GNUNET_TIME_Relative duration_period; - GNUNET_SCHEDULER_TaskIdentifier send_task; + struct GNUNET_SCHEDULER_Task * send_task; struct GNUNET_TIME_Absolute next_ping_transmission; struct GNUNET_TIME_Absolute time_start; }; @@ -255,7 +255,7 @@ struct PreferenceGenerator struct GNUNET_TIME_Relative duration_period; struct GNUNET_TIME_Relative frequency; - GNUNET_SCHEDULER_TaskIdentifier set_task; + struct GNUNET_SCHEDULER_Task * set_task; struct GNUNET_TIME_Absolute next_ping_transmission; struct GNUNET_TIME_Absolute time_start; }; @@ -381,12 +381,12 @@ struct GNUNET_ATS_TEST_Topology /** * Shutdown task */ - GNUNET_SCHEDULER_TaskIdentifier shutdown_task; + struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Progress task */ - GNUNET_SCHEDULER_TaskIdentifier progress_task; + struct GNUNET_SCHEDULER_Task * progress_task; /** * Test result @@ -524,8 +524,8 @@ struct Experiment unsigned int num_episodes; struct Episode *start; - GNUNET_SCHEDULER_TaskIdentifier experiment_timeout_task; - GNUNET_SCHEDULER_TaskIdentifier episode_timeout_task; + struct GNUNET_SCHEDULER_Task * experiment_timeout_task; + struct GNUNET_SCHEDULER_Task * episode_timeout_task; struct Episode *cur; GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb; diff --git a/src/ats-tests/gnunet-ats-sim.c b/src/ats-tests/gnunet-ats-sim.c index 0659af05dd..10a85702f5 100644 --- a/src/ats-tests/gnunet-ats-sim.c +++ b/src/ats-tests/gnunet-ats-sim.c @@ -57,7 +57,7 @@ static int opt_plot; */ static int opt_verbose; -GNUNET_SCHEDULER_TaskIdentifier timeout_task; +struct GNUNET_SCHEDULER_Task * timeout_task; struct Experiment *e; struct LoggingHandle *l; @@ -183,10 +183,10 @@ experiment_done_cb (struct Experiment *e, struct GNUNET_TIME_Relative duration,i GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES)); else GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment failed \n"); - if (GNUNET_SCHEDULER_NO_TASK != timeout_task) + if (NULL != timeout_task) { GNUNET_SCHEDULER_cancel (timeout_task); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; } /* Stop logging */ GNUNET_ATS_TEST_logging_stop (l); diff --git a/src/ats-tests/gnunet-solver-eval.c b/src/ats-tests/gnunet-solver-eval.c index 9432f429d2..91185f6450 100644 --- a/src/ats-tests/gnunet-solver-eval.c +++ b/src/ats-tests/gnunet-solver-eval.c @@ -422,13 +422,13 @@ static void timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) { struct Experiment *e = cls; - e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->experiment_timeout_task = NULL; fprintf (stderr, "Experiment timeout!\n"); - if (GNUNET_SCHEDULER_NO_TASK != e->episode_timeout_task) + if (NULL != e->episode_timeout_task) { GNUNET_SCHEDULER_cancel (e->episode_timeout_task); - e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->episode_timeout_task = NULL; } e->e_done_cb (e, GNUNET_TIME_absolute_get_duration(e->start_time), @@ -588,7 +588,7 @@ static void timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) { struct Experiment *e = cls; - e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->episode_timeout_task = NULL; if (NULL != e->ep_done_cb) e->ep_done_cb (e->cur); @@ -598,10 +598,10 @@ timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) { /* done */ fprintf (stderr, "Last episode done!\n"); - if (GNUNET_SCHEDULER_NO_TASK != e->experiment_timeout_task) + if (NULL != e->experiment_timeout_task) { GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); - e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->experiment_timeout_task = NULL; } e->e_done_cb (e, GNUNET_TIME_absolute_get_duration(e->start_time), GNUNET_OK); return; @@ -738,15 +738,15 @@ GNUNET_ATS_solvers_experimentation_load (char *filename) void GNUNET_ATS_solvers_experimentation_stop (struct Experiment *e) { - if (GNUNET_SCHEDULER_NO_TASK != e->experiment_timeout_task) + if (NULL != e->experiment_timeout_task) { GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); - e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->experiment_timeout_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != e->episode_timeout_task) + if (NULL != e->episode_timeout_task) { GNUNET_SCHEDULER_cancel (e->episode_timeout_task); - e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->episode_timeout_task = NULL; } free_experiment (e); } diff --git a/src/ats-tests/perf_ats.c b/src/ats-tests/perf_ats.c index 7b5a903beb..f57ac19f0b 100644 --- a/src/ats-tests/perf_ats.c +++ b/src/ats-tests/perf_ats.c @@ -46,12 +46,12 @@ /** * Shutdown task */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Progress task */ -static GNUNET_SCHEDULER_TaskIdentifier progress_task; +static struct GNUNET_SCHEDULER_Task * progress_task; /** * Test result @@ -194,13 +194,13 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (GNUNET_YES == logging) GNUNET_ATS_TEST_logging_clean_up(l); - shutdown_task = GNUNET_SCHEDULER_NO_TASK; - if (GNUNET_SCHEDULER_NO_TASK != progress_task) + shutdown_task = NULL; + if (NULL != progress_task) { fprintf (stderr, "0\n"); GNUNET_SCHEDULER_cancel (progress_task); } - progress_task = GNUNET_SCHEDULER_NO_TASK; + progress_task = NULL; evaluate (); GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Benchmarking done\n")); @@ -213,7 +213,7 @@ static void print_progress () { static int calls; - progress_task = GNUNET_SCHEDULER_NO_TASK; + progress_task = NULL; fprintf (stderr, "%llu..", (long long unsigned) perf_duration.rel_value_us / (1000 * 1000) - calls); @@ -228,7 +228,7 @@ ats_pref_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct BenchmarkPeer *me = cls; - me->ats_task = GNUNET_SCHEDULER_NO_TASK; + me->ats_task = NULL; GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, " Master [%u] set preference for slave [%u] to %f\n", me->no, me->pref_partner->no, me->pref_value); @@ -248,7 +248,7 @@ start_benchmark() GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Benchmarking start\n")); - if (GNUNET_SCHEDULER_NO_TASK != shutdown_task) + if (NULL != shutdown_task) GNUNET_SCHEDULER_cancel(shutdown_task); shutdown_task = GNUNET_SCHEDULER_add_delayed(perf_duration, &do_shutdown, NULL ); diff --git a/src/ats-tests/perf_ats.h b/src/ats-tests/perf_ats.h index cad1943136..4ea6af2cc5 100644 --- a/src/ats-tests/perf_ats.h +++ b/src/ats-tests/perf_ats.h @@ -196,7 +196,7 @@ struct BenchmarkPeer * Masters only * Progress task */ - GNUNET_SCHEDULER_TaskIdentifier ats_task; + struct GNUNET_SCHEDULER_Task * ats_task; /** * Masters only diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c index 823cfaf38f..740a827fe0 100644 --- a/src/ats-tests/perf_ats_logging.c +++ b/src/ats-tests/perf_ats_logging.c @@ -72,7 +72,7 @@ /** * Logging task */ -static GNUNET_SCHEDULER_TaskIdentifier log_task; +static struct GNUNET_SCHEDULER_Task * log_task; /** * Reference to perf_ats' masters @@ -639,7 +639,7 @@ collect_log_now (void) static void collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - log_task = GNUNET_SCHEDULER_NO_TASK; + log_task = NULL; collect_log_now(); @@ -661,9 +661,9 @@ perf_logging_stop () if (GNUNET_YES!= running) return; - if (GNUNET_SCHEDULER_NO_TASK != log_task) + if (NULL != log_task) GNUNET_SCHEDULER_cancel (log_task); - log_task = GNUNET_SCHEDULER_NO_TASK; + log_task = NULL; tc.reason = GNUNET_SCHEDULER_REASON_SHUTDOWN; collect_log_task (NULL, &tc); diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c index 69fbcf7a3b..217c075b21 100644 --- a/src/ats-tool/gnunet-ats.c +++ b/src/ats-tool/gnunet-ats.c @@ -124,7 +124,7 @@ static struct GNUNET_CONFIGURATION_Handle *cfg; /** * Shutdown task */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Hashmap to store addresses @@ -345,7 +345,7 @@ transport_addr_to_str_cb (void *cls, if ((GNUNET_YES == stat_receive_done) && (0 == stat_pending)) { /* All messages received and no resolutions pending*/ - if (shutdown_task != GNUNET_SCHEDULER_NO_TASK) + if (shutdown_task != NULL) GNUNET_SCHEDULER_cancel (shutdown_task); shutdown_task = GNUNET_SCHEDULER_add_now (end, NULL); } @@ -637,7 +637,7 @@ ats_perf_cb (void *cls, if (0 == stat_pending) { /* All messages received and no resolutions pending*/ - if (shutdown_task != GNUNET_SCHEDULER_NO_TASK) + if (shutdown_task != NULL) GNUNET_SCHEDULER_cancel (shutdown_task); shutdown_task = GNUNET_SCHEDULER_add_now (end, NULL); } diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c index b1c48bdde5..6d59920333 100644 --- a/src/ats/ats_api_performance.c +++ b/src/ats/ats_api_performance.c @@ -221,7 +221,7 @@ struct GNUNET_ATS_PerformanceHandle /** * Task to trigger reconnect. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * Monitor request multiplexing @@ -255,7 +255,7 @@ reconnect_task (void *cls, { struct GNUNET_ATS_PerformanceHandle *ph = cls; - ph->task = GNUNET_SCHEDULER_NO_TASK; + ph->task = NULL; reconnect (ph); } @@ -740,10 +740,10 @@ GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph) GNUNET_free (rc); } - if (GNUNET_SCHEDULER_NO_TASK != ph->task) + if (NULL != ph->task) { GNUNET_SCHEDULER_cancel (ph->task); - ph->task = GNUNET_SCHEDULER_NO_TASK; + ph->task = NULL; } if (NULL != ph->client) { diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c index b5bbf073d7..6bb5953914 100644 --- a/src/ats/ats_api_scheduling.c +++ b/src/ats/ats_api_scheduling.c @@ -177,12 +177,12 @@ struct GNUNET_ATS_SchedulingHandle /** * Task to trigger reconnect. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * Task retrieving interfaces from the system */ - GNUNET_SCHEDULER_TaskIdentifier interface_task; + struct GNUNET_SCHEDULER_Task * interface_task; /** @@ -217,7 +217,7 @@ reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_ATS_SchedulingHandle *sh = cls; - sh->task = GNUNET_SCHEDULER_NO_TASK; + sh->task = NULL; reconnect (sh); } @@ -825,7 +825,7 @@ static void get_addresses (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_ATS_SchedulingHandle * sh = cls; - sh->interface_task = GNUNET_SCHEDULER_NO_TASK; + sh->interface_task = NULL; delete_networks (sh); GNUNET_OS_network_interfaces_list(interface_proc, sh); sh->interface_task = GNUNET_SCHEDULER_add_delayed (INTERFACE_PROCESSING_INTERVALL, @@ -1005,10 +1005,10 @@ GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh) GNUNET_CLIENT_disconnect (sh->client); sh->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != sh->task) + if (NULL != sh->task) { GNUNET_SCHEDULER_cancel (sh->task); - sh->task = GNUNET_SCHEDULER_NO_TASK; + sh->task = NULL; } next = sh->sug_head; @@ -1020,10 +1020,10 @@ GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh) } delete_networks (sh); - if (sh->interface_task != GNUNET_SCHEDULER_NO_TASK) + if (sh->interface_task != NULL) { GNUNET_SCHEDULER_cancel(sh->interface_task); - sh->interface_task = GNUNET_SCHEDULER_NO_TASK; + sh->interface_task = NULL; } GNUNET_array_grow (sh->session_array, sh->session_array_size, 0); GNUNET_free (sh); diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index 86930d3924..0fa83d741e 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c @@ -244,7 +244,7 @@ static void logging_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct LoggingHandle *l = cls; - l->logging_task = GNUNET_SCHEDULER_NO_TASK; + l->logging_task = NULL; GNUNET_ATS_solver_logging_now (l); @@ -268,12 +268,12 @@ GNUNET_ATS_solver_logging_start (struct GNUNET_TIME_Relative freq) void GNUNET_ATS_solver_logging_stop (struct LoggingHandle *l) { - if (GNUNET_SCHEDULER_NO_TASK != l->logging_task) + if (NULL != l->logging_task) GNUNET_SCHEDULER_cancel (l->logging_task); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stop logging\n"); - l->logging_task = GNUNET_SCHEDULER_NO_TASK; + l->logging_task = NULL; } static struct LoggingFileHandle * @@ -513,9 +513,9 @@ GNUNET_ATS_solver_logging_free (struct LoggingHandle *l) struct LoggingAddress *log_a_cur; struct LoggingAddress *log_a_next; - if (GNUNET_SCHEDULER_NO_TASK != l->logging_task) + if (NULL != l->logging_task) GNUNET_SCHEDULER_cancel (l->logging_task); - l->logging_task = GNUNET_SCHEDULER_NO_TASK; + l->logging_task = NULL; lts_next = l->head; while (NULL != (lts_cur = lts_next)) @@ -621,7 +621,7 @@ set_prop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) double prop_value; struct GNUNET_ATS_Information atsi; - pg->set_task = GNUNET_SCHEDULER_NO_TASK; + pg->set_task = NULL; if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains_value (sh->addresses, &pg->test_peer->peer_id, pg->test_address->ats_addr)) @@ -702,10 +702,10 @@ GNUNET_ATS_solver_generate_property_stop (struct PropertyGenerator *pg) { GNUNET_CONTAINER_DLL_remove (prop_gen_head, prop_gen_tail, pg); - if (GNUNET_SCHEDULER_NO_TASK != pg->set_task) + if (NULL != pg->set_task) { GNUNET_SCHEDULER_cancel (pg->set_task); - pg->set_task = GNUNET_SCHEDULER_NO_TASK; + pg->set_task = NULL; } GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Removing old up preference generator peer [%u] address [%u] `%s'\n", @@ -897,7 +897,7 @@ set_feedback_task (void *cls, struct GNUNET_TIME_Relative dur; double p_new; - pg->feedback_task = GNUNET_SCHEDULER_NO_TASK; + pg->feedback_task = NULL; if (NULL == (p = find_peer_by_id (pg->peer))) { @@ -966,7 +966,7 @@ set_pref_task (void *cls, struct PreferenceGenerator *pg = cls; struct TestPeer *p; double pref_value; - pg->set_task = GNUNET_SCHEDULER_NO_TASK; + pg->set_task = NULL; if (NULL == (p = find_peer_by_id (pg->peer))) { @@ -1030,16 +1030,16 @@ GNUNET_ATS_solver_generate_preferences_stop (struct PreferenceGenerator *pg) { GNUNET_CONTAINER_DLL_remove (pref_gen_head, pref_gen_tail, pg); - if (GNUNET_SCHEDULER_NO_TASK != pg->feedback_task) + if (NULL != pg->feedback_task) { GNUNET_SCHEDULER_cancel (pg->feedback_task); - pg->feedback_task = GNUNET_SCHEDULER_NO_TASK; + pg->feedback_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != pg->set_task) + if (NULL != pg->set_task) { GNUNET_SCHEDULER_cancel (pg->set_task); - pg->set_task = GNUNET_SCHEDULER_NO_TASK; + pg->set_task = NULL; } GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Removing old up preference generator peer [%u] `%s'\n", @@ -2146,13 +2146,13 @@ static void timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) { struct Experiment *e = cls; - e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->experiment_timeout_task = NULL; fprintf (stderr, "Experiment timeout!\n"); - if (GNUNET_SCHEDULER_NO_TASK != e->episode_timeout_task) + if (NULL != e->episode_timeout_task) { GNUNET_SCHEDULER_cancel (e->episode_timeout_task); - e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->episode_timeout_task = NULL; } e->e_done_cb (e, GNUNET_TIME_absolute_get_duration(e->start_time), @@ -2524,7 +2524,7 @@ static void timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) { struct Experiment *e = cls; - e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->episode_timeout_task = NULL; if (NULL != e->ep_done_cb) e->ep_done_cb (e->cur); @@ -2534,10 +2534,10 @@ timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) { /* done */ fprintf (stderr, "Last episode done!\n"); - if (GNUNET_SCHEDULER_NO_TASK != e->experiment_timeout_task) + if (NULL != e->experiment_timeout_task) { GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); - e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->experiment_timeout_task = NULL; } e->e_done_cb (e, GNUNET_TIME_absolute_get_duration(e->start_time), GNUNET_OK); return; @@ -2589,15 +2589,15 @@ GNUNET_ATS_solvers_experimentation_run (struct Experiment *e, void GNUNET_ATS_solvers_experimentation_stop (struct Experiment *e) { - if (GNUNET_SCHEDULER_NO_TASK != e->experiment_timeout_task) + if (NULL != e->experiment_timeout_task) { GNUNET_SCHEDULER_cancel (e->experiment_timeout_task); - e->experiment_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->experiment_timeout_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != e->episode_timeout_task) + if (NULL != e->episode_timeout_task) { GNUNET_SCHEDULER_cancel (e->episode_timeout_task); - e->episode_timeout_task = GNUNET_SCHEDULER_NO_TASK; + e->episode_timeout_task = NULL; } if (NULL != e->cfg) { diff --git a/src/ats/gnunet-ats-solver-eval.h b/src/ats/gnunet-ats-solver-eval.h index 9893dc9f11..808f524dab 100644 --- a/src/ats/gnunet-ats-solver-eval.h +++ b/src/ats/gnunet-ats-solver-eval.h @@ -231,7 +231,7 @@ struct Episode struct LoggingHandle { - GNUNET_SCHEDULER_TaskIdentifier logging_task; + struct GNUNET_SCHEDULER_Task * logging_task; struct GNUNET_TIME_Relative log_freq; /* DLL list for logging time steps */ @@ -256,8 +256,8 @@ struct Experiment struct GNUNET_CONFIGURATION_Handle *cfg; - GNUNET_SCHEDULER_TaskIdentifier experiment_timeout_task; - GNUNET_SCHEDULER_TaskIdentifier episode_timeout_task; + struct GNUNET_SCHEDULER_Task * experiment_timeout_task; + struct GNUNET_SCHEDULER_Task * episode_timeout_task; struct Episode *cur; GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb; @@ -282,8 +282,8 @@ struct PreferenceGenerator struct GNUNET_TIME_Relative frequency; struct GNUNET_TIME_Relative feedback_frequency; - GNUNET_SCHEDULER_TaskIdentifier set_task; - GNUNET_SCHEDULER_TaskIdentifier feedback_task; + struct GNUNET_SCHEDULER_Task * set_task; + struct GNUNET_SCHEDULER_Task * feedback_task; struct GNUNET_TIME_Absolute next_ping_transmission; struct GNUNET_TIME_Absolute time_start; @@ -326,7 +326,7 @@ struct PropertyGenerator struct GNUNET_TIME_Relative duration_period; struct GNUNET_TIME_Relative frequency; - GNUNET_SCHEDULER_TaskIdentifier set_task; + struct GNUNET_SCHEDULER_Task * set_task; struct GNUNET_TIME_Absolute next_ping_transmission; struct GNUNET_TIME_Absolute time_start; }; diff --git a/src/ats/gnunet-service-ats_normalization.c b/src/ats/gnunet-service-ats_normalization.c index 17edf282de..5e03edcdf5 100644 --- a/src/ats/gnunet-service-ats_normalization.c +++ b/src/ats/gnunet-service-ats_normalization.c @@ -194,7 +194,7 @@ static struct PreferenceClient *pc_tail; */ static struct PeerRelative defvalues; -static GNUNET_SCHEDULER_TaskIdentifier aging_task; +static struct GNUNET_SCHEDULER_Task * aging_task; /** * Application Preference Normalization @@ -385,7 +385,7 @@ preference_aging (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) int values_to_update; double backup; - aging_task = GNUNET_SCHEDULER_NO_TASK; + aging_task = NULL; values_to_update = 0; cur_client = NULL; @@ -542,7 +542,7 @@ GAS_normalization_normalize_preference (void *client, run_preference_update (c_cur, p_cur, kind, score_abs); /* Start aging task */ - if (GNUNET_SCHEDULER_NO_TASK == aging_task) + if (NULL == aging_task) aging_task = GNUNET_SCHEDULER_add_delayed (PREF_AGING_INTERVAL, &preference_aging, NULL ); @@ -959,7 +959,7 @@ GAS_normalization_start (GAS_Normalization_preference_changed_cb pref_ch_cb, for (i = 0; i < GNUNET_ATS_PreferenceCount; i++) defvalues.f_rel[i] = DEFAULT_REL_PREFERENCE; - aging_task = GNUNET_SCHEDULER_NO_TASK; + aging_task = NULL; return; } @@ -992,10 +992,10 @@ GAS_normalization_stop () struct PreferenceClient *pc; struct PreferenceClient *next_pc; - if (GNUNET_SCHEDULER_NO_TASK != aging_task) + if (NULL != aging_task) { GNUNET_SCHEDULER_cancel (aging_task); - aging_task = GNUNET_SCHEDULER_NO_TASK; + aging_task = NULL; } next_pc = pc_head; diff --git a/src/ats/plugin_ats_ril.c b/src/ats/plugin_ats_ril.c index 4feb0fd9ad..c87876ea10 100644 --- a/src/ats/plugin_ats_ril.c +++ b/src/ats/plugin_ats_ril.c @@ -412,7 +412,7 @@ struct GAS_RIL_Handle /** * Task identifier of the next time-step to be executed */ - GNUNET_SCHEDULER_TaskIdentifier step_next_task_id; + struct GNUNET_SCHEDULER_Task * step_next_task_id; /** * Variable discount factor, dependent on time between steps @@ -1546,7 +1546,7 @@ ril_step_scheduler_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *t { struct GAS_RIL_Handle *solver = cls; - solver->step_next_task_id = GNUNET_SCHEDULER_NO_TASK; + solver->step_next_task_id = NULL; ril_step (solver); } @@ -1875,7 +1875,7 @@ ril_step_schedule_next (struct GAS_RIL_Handle *solver) time_next = GNUNET_TIME_UNIT_ZERO; } - if ((GNUNET_SCHEDULER_NO_TASK == solver->step_next_task_id) && (GNUNET_NO == solver->done)) + if ((NULL == solver->step_next_task_id) && (GNUNET_NO == solver->done)) { solver->step_next_task_id = GNUNET_SCHEDULER_add_delayed (time_next, &ril_step_scheduler_task, solver); @@ -2939,7 +2939,7 @@ libgnunet_plugin_ats_ril_done (void *cls) cur_agent = next_agent; } - if (GNUNET_SCHEDULER_NO_TASK != s->step_next_task_id) + if (NULL != s->step_next_task_id) { GNUNET_SCHEDULER_cancel (s->step_next_task_id); } diff --git a/src/ats/test_ats_api_bandwidth_consumption.c b/src/ats/test_ats_api_bandwidth_consumption.c index b05a7cf221..9ab0de7a9f 100644 --- a/src/ats/test_ats_api_bandwidth_consumption.c +++ b/src/ats/test_ats_api_bandwidth_consumption.c @@ -31,9 +31,9 @@ #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier consume_task; +static struct GNUNET_SCHEDULER_Task * consume_task; static struct GNUNET_ATS_SchedulingHandle *ats; @@ -77,11 +77,11 @@ struct PeerContext static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; - if (consume_task != GNUNET_SCHEDULER_NO_TASK) + die_task = NULL; + if (consume_task != NULL) { GNUNET_SCHEDULER_cancel (consume_task); - consume_task = GNUNET_SCHEDULER_NO_TASK; + consume_task = NULL; } if (sh != NULL) GNUNET_ATS_reserve_bandwidth_cancel (sh); @@ -98,15 +98,15 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end () { - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } - if (consume_task != GNUNET_SCHEDULER_NO_TASK) + if (consume_task != NULL) { GNUNET_SCHEDULER_cancel (consume_task); - consume_task = GNUNET_SCHEDULER_NO_TASK; + consume_task = NULL; } GNUNET_ATS_scheduling_done (ats); GNUNET_ATS_performance_done (atp); @@ -142,7 +142,7 @@ reservation_cb (void *cls, const struct GNUNET_PeerIdentity *peer, static void consume_bandwidth (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - consume_task = GNUNET_SCHEDULER_NO_TASK; + consume_task = NULL; int32_t to_reserve = 500; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, diff --git a/src/ats/test_ats_api_performance_list_all_addresses.c b/src/ats/test_ats_api_performance_list_all_addresses.c index e846d0d43c..253598d495 100644 --- a/src/ats/test_ats_api_performance_list_all_addresses.c +++ b/src/ats/test_ats_api_performance_list_all_addresses.c @@ -30,7 +30,7 @@ #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -165,7 +165,7 @@ address_suggest_cb (void *cls, static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } @@ -174,10 +174,10 @@ static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK ) + if (die_task != NULL ) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) diff --git a/src/ats/test_ats_api_performance_list_all_addresses_active.c b/src/ats/test_ats_api_performance_list_all_addresses_active.c index 5cc4d4c656..8385203c59 100644 --- a/src/ats/test_ats_api_performance_list_all_addresses_active.c +++ b/src/ats/test_ats_api_performance_list_all_addresses_active.c @@ -30,7 +30,7 @@ #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -172,7 +172,7 @@ address_suggest_cb (void *cls, static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } @@ -181,10 +181,10 @@ static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK ) + if (die_task != NULL ) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) diff --git a/src/ats/test_ats_api_performance_list_peer_addresses.c b/src/ats/test_ats_api_performance_list_peer_addresses.c index f19727b2da..3eb5b8e50d 100644 --- a/src/ats/test_ats_api_performance_list_peer_addresses.c +++ b/src/ats/test_ats_api_performance_list_peer_addresses.c @@ -30,7 +30,7 @@ #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -176,10 +176,10 @@ end (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK ) + if (die_task != NULL ) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) { @@ -216,7 +216,7 @@ static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end (NULL, NULL); ret = GNUNET_SYSERR; } diff --git a/src/ats/test_ats_api_performance_monitor.c b/src/ats/test_ats_api_performance_monitor.c index 4b6b08b744..0c17ded876 100644 --- a/src/ats/test_ats_api_performance_monitor.c +++ b/src/ats/test_ats_api_performance_monitor.c @@ -31,7 +31,7 @@ #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) #define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -167,7 +167,7 @@ address_suggest_cb (void *cls, static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } @@ -176,10 +176,10 @@ static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK ) + if (die_task != NULL ) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) diff --git a/src/ats/test_ats_api_performance_monitor_initial_callback.c b/src/ats/test_ats_api_performance_monitor_initial_callback.c index 377686673f..42d2951f76 100644 --- a/src/ats/test_ats_api_performance_monitor_initial_callback.c +++ b/src/ats/test_ats_api_performance_monitor_initial_callback.c @@ -31,7 +31,7 @@ #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) #define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -174,7 +174,7 @@ address_suggest_cb (void *cls, static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } @@ -183,10 +183,10 @@ static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK ) + if (die_task != NULL ) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) diff --git a/src/ats/test_ats_api_scheduling_add_address.c b/src/ats/test_ats_api_scheduling_add_address.c index 332e46d198..92bd049f45 100644 --- a/src/ats/test_ats_api_scheduling_add_address.c +++ b/src/ats/test_ats_api_scheduling_add_address.c @@ -32,7 +32,7 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -103,10 +103,10 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) @@ -130,7 +130,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } diff --git a/src/ats/test_ats_api_scheduling_add_address_duplicate.c b/src/ats/test_ats_api_scheduling_add_address_duplicate.c index f2c2b4fd6d..6130c0f7e0 100644 --- a/src/ats/test_ats_api_scheduling_add_address_duplicate.c +++ b/src/ats/test_ats_api_scheduling_add_address_duplicate.c @@ -32,9 +32,9 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier wait_task; +static struct GNUNET_SCHEDULER_Task * wait_task; /** * Statistics handle @@ -95,13 +95,13 @@ stat_cb(void *cls, const char *subsystem, subsystem,name, value); if (1 < value) { - if (GNUNET_SCHEDULER_NO_TASK != wait_task) + if (NULL != wait_task) GNUNET_SCHEDULER_cancel (wait_task); GNUNET_SCHEDULER_add_now (&end_badly, NULL); } if (1 == value) { - if (GNUNET_SCHEDULER_NO_TASK == wait_task) + if (NULL == wait_task) wait_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &end, NULL); } return GNUNET_OK; @@ -112,12 +112,12 @@ static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); - wait_task = GNUNET_SCHEDULER_NO_TASK; + wait_task = NULL; - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) @@ -141,7 +141,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } diff --git a/src/ats/test_ats_api_scheduling_add_address_inbound.c b/src/ats/test_ats_api_scheduling_add_address_inbound.c index fb4ddd2da5..2c3ab9c02c 100644 --- a/src/ats/test_ats_api_scheduling_add_address_inbound.c +++ b/src/ats/test_ats_api_scheduling_add_address_inbound.c @@ -32,7 +32,7 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -109,10 +109,10 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) @@ -136,7 +136,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } diff --git a/src/ats/test_ats_api_scheduling_add_session.c b/src/ats/test_ats_api_scheduling_add_session.c index 9d7fd99d1c..243ecd22e5 100644 --- a/src/ats/test_ats_api_scheduling_add_session.c +++ b/src/ats/test_ats_api_scheduling_add_session.c @@ -32,7 +32,7 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -116,10 +116,10 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) @@ -143,7 +143,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } diff --git a/src/ats/test_ats_api_scheduling_destroy_address.c b/src/ats/test_ats_api_scheduling_destroy_address.c index bc1b7bd83f..5cc2094c20 100644 --- a/src/ats/test_ats_api_scheduling_destroy_address.c +++ b/src/ats/test_ats_api_scheduling_destroy_address.c @@ -33,7 +33,7 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -114,10 +114,10 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) @@ -141,7 +141,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } diff --git a/src/ats/test_ats_api_scheduling_destroy_address_twice.c b/src/ats/test_ats_api_scheduling_destroy_address_twice.c index 9b34effd1c..1991199ab4 100644 --- a/src/ats/test_ats_api_scheduling_destroy_address_twice.c +++ b/src/ats/test_ats_api_scheduling_destroy_address_twice.c @@ -33,7 +33,7 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -116,10 +116,10 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) @@ -143,7 +143,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } diff --git a/src/ats/test_ats_api_scheduling_destroy_session.c b/src/ats/test_ats_api_scheduling_destroy_session.c index ae236ea327..0c6cf156d7 100644 --- a/src/ats/test_ats_api_scheduling_destroy_session.c +++ b/src/ats/test_ats_api_scheduling_destroy_session.c @@ -36,7 +36,7 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -120,10 +120,10 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) @@ -147,7 +147,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } diff --git a/src/ats/test_ats_api_scheduling_init.c b/src/ats/test_ats_api_scheduling_init.c index a7914d5c67..d6e823a56e 100644 --- a/src/ats/test_ats_api_scheduling_init.c +++ b/src/ats/test_ats_api_scheduling_init.c @@ -32,7 +32,7 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Initial statistics get request handle @@ -86,10 +86,10 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) @@ -110,7 +110,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } diff --git a/src/ats/test_ats_simplistic_pref_aging.c b/src/ats/test_ats_simplistic_pref_aging.c index c8485856c5..855e22fbf2 100644 --- a/src/ats/test_ats_simplistic_pref_aging.c +++ b/src/ats/test_ats_simplistic_pref_aging.c @@ -40,7 +40,7 @@ #define DEBUG_ATS_INFO GNUNET_NO -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Scheduling handle @@ -102,7 +102,7 @@ unsigned long long wan_quota_in; static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error! Shutting down\n"); if (sched_ats != NULL) { @@ -123,10 +123,10 @@ static void end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } GNUNET_ATS_suggest_address_cancel (sched_ats, &p[0].id); diff --git a/src/ats/test_ats_solver_add_address.c b/src/ats/test_ats_solver_add_address.c index 0c62d51973..37c37cc84e 100644 --- a/src/ats/test_ats_solver_add_address.c +++ b/src/ats/test_ats_solver_add_address.c @@ -32,7 +32,7 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -89,10 +89,10 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) @@ -117,7 +117,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } diff --git a/src/ats/test_ats_solver_add_address_and_request.c b/src/ats/test_ats_solver_add_address_and_request.c index 55a7469e76..1f07f46af4 100644 --- a/src/ats/test_ats_solver_add_address_and_request.c +++ b/src/ats/test_ats_solver_add_address_and_request.c @@ -38,7 +38,7 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -94,10 +94,10 @@ static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) @@ -122,7 +122,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } diff --git a/src/ats/test_ats_solver_alternative_after_delete_address.c b/src/ats/test_ats_solver_alternative_after_delete_address.c index 27f34217e9..1f713801f1 100644 --- a/src/ats/test_ats_solver_alternative_after_delete_address.c +++ b/src/ats/test_ats_solver_alternative_after_delete_address.c @@ -32,7 +32,7 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -114,10 +114,10 @@ stat_cb(void *cls, const char *subsystem, const char *name, uint64_t value, static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) @@ -144,7 +144,7 @@ static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } @@ -152,10 +152,10 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly_now () { - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } GNUNET_SCHEDULER_add_now (&end_badly, NULL); } diff --git a/src/ats/test_ats_solver_convergence.c b/src/ats/test_ats_solver_convergence.c index b99cab809a..aa8704ccfa 100644 --- a/src/ats/test_ats_solver_convergence.c +++ b/src/ats/test_ats_solver_convergence.c @@ -33,7 +33,7 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier end_task; +static struct GNUNET_SCHEDULER_Task * end_task; /** * Statistics handle @@ -113,10 +113,10 @@ static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done!\n"); - if (end_task == GNUNET_SCHEDULER_NO_TASK) + if (end_task == NULL) { GNUNET_SCHEDULER_cancel (end_task); - end_task = GNUNET_SCHEDULER_NO_TASK; + end_task = NULL; } if (NULL != sched_ats) diff --git a/src/ats/test_ats_solver_preferences.c b/src/ats/test_ats_solver_preferences.c index 4de3d9a5bd..946cb54766 100644 --- a/src/ats/test_ats_solver_preferences.c +++ b/src/ats/test_ats_solver_preferences.c @@ -38,7 +38,7 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -99,10 +99,10 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Done!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK ) + if (die_task != NULL ) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) @@ -132,7 +132,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end (NULL, NULL ); ret = GNUNET_SYSERR; } diff --git a/src/ats/test_ats_solver_request_and_add_address.c b/src/ats/test_ats_solver_request_and_add_address.c index 1eced520d4..3c7b8a522c 100644 --- a/src/ats/test_ats_solver_request_and_add_address.c +++ b/src/ats/test_ats_solver_request_and_add_address.c @@ -38,7 +38,7 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -94,10 +94,10 @@ static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) @@ -122,7 +122,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; } diff --git a/src/ats/test_ats_solver_request_and_delete_address.c b/src/ats/test_ats_solver_request_and_delete_address.c index 05a045e3bc..1e4644b2cb 100644 --- a/src/ats/test_ats_solver_request_and_delete_address.c +++ b/src/ats/test_ats_solver_request_and_delete_address.c @@ -38,7 +38,7 @@ /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Statistics handle @@ -96,10 +96,10 @@ static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != sched_ats) @@ -124,7 +124,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; end ( NULL, NULL); ret = GNUNET_SYSERR; diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index ddd1755cc9..43fe3535f3 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c @@ -78,7 +78,7 @@ struct GNUNET_CADET_TransmitHandle /** * Task triggering a timeout, can be NO_TASK if the timeout is FOREVER. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Size of 'data' -- or the desired size of 'notify' if 'data' is NULL. @@ -210,7 +210,7 @@ struct GNUNET_CADET_Handle /** * Task for trying to reconnect. */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Callback for an info task (only one active at a time). @@ -496,7 +496,7 @@ destroy_channel (struct GNUNET_CADET_Channel *ch, int call_cleaner) GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th); /* clean up request */ - if (GNUNET_SCHEDULER_NO_TASK != th->timeout_task) + if (NULL != th->timeout_task) GNUNET_SCHEDULER_cancel (th->timeout_task); GNUNET_free (th); } @@ -528,7 +528,7 @@ timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_CADET_TransmitHandle *th = cls; struct GNUNET_CADET_Handle *cadet = th->channel->cadet; - th->timeout_task = GNUNET_SCHEDULER_NO_TASK; + th->timeout_task = NULL; th->channel->packet_size = 0; GNUNET_CONTAINER_DLL_remove (cadet->th_head, cadet->th_tail, th); if (GNUNET_YES == th_is_payload (th)) @@ -711,7 +711,7 @@ reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_CADET_Handle *h = cls; - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; do_reconnect (h); @@ -740,7 +740,7 @@ reconnect (struct GNUNET_CADET_Handle *h) next = ch->next; destroy_channel (ch, GNUNET_YES); } - if (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task) + if (NULL == h->reconnect_task) h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_time, &reconnect_cbk, h); } @@ -1382,7 +1382,7 @@ send_callback (void *cls, size_t size, void *buf) psize = th->size; } GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= psize); - if (th->timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (th->timeout_task != NULL) GNUNET_SCHEDULER_cancel (th->timeout_task); GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th); GNUNET_free (th); @@ -1487,7 +1487,7 @@ GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, h->ports = ports; h->next_chid = GNUNET_CADET_LOCAL_CHANNEL_ID_CLI; h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS; - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; if (NULL != ports && ports[0] != 0 && NULL == new_channel) { @@ -1576,10 +1576,10 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle) GNUNET_CLIENT_disconnect (handle->client); handle->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != handle->reconnect_task) + if (NULL != handle->reconnect_task) { GNUNET_SCHEDULER_cancel(handle->reconnect_task); - handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + handle->reconnect_task = NULL; } GNUNET_free (handle); } @@ -1761,7 +1761,7 @@ GNUNET_CADET_notify_transmit_ready_cancel (struct GNUNET_CADET_TransmitHandle *t th->channel->packet_size = 0; cadet = th->channel->cadet; - if (th->timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (th->timeout_task != NULL) GNUNET_SCHEDULER_cancel (th->timeout_task); GNUNET_CONTAINER_DLL_remove (cadet->th_head, cadet->th_tail, th); GNUNET_free (th); diff --git a/src/cadet/cadet_path.c b/src/cadet/cadet_path.c index d1aa9dcf2e..c00e417b1c 100644 --- a/src/cadet/cadet_path.c +++ b/src/cadet/cadet_path.c @@ -48,7 +48,7 @@ path_destroy_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct CadetPeer *peer; LOG (GNUNET_ERROR_TYPE_INFO, "Destroy delayed %p (%u)\n", path, path->length); - path->path_delete = GNUNET_SCHEDULER_NO_TASK; + path->path_delete = NULL; peer = GCP_get_short (path->peers[path->length - 1]); if (2 < path->length) GCP_remove_path (peer, path); @@ -150,7 +150,7 @@ path_get_length (struct CadetPeerPath *path) void path_invalidate (struct CadetPeerPath *p) { - if (GNUNET_SCHEDULER_NO_TASK != p->path_delete) + if (NULL != p->path_delete) return; LOG (GNUNET_ERROR_TYPE_INFO, "Invalidating path %p (%u)\n", p, p->length); @@ -267,7 +267,7 @@ path_equivalent (const struct CadetPeerPath *p1, int path_is_valid (const struct CadetPeerPath *path) { - return (GNUNET_SCHEDULER_NO_TASK == path->path_delete); + return (NULL == path->path_delete); } @@ -287,7 +287,7 @@ path_destroy (struct CadetPeerPath *p) LOG (GNUNET_ERROR_TYPE_INFO, "destroying path %p (%u)\n", p, p->length); GNUNET_PEER_decrement_rcs (p->peers, p->length); GNUNET_free_non_null (p->peers); - if (GNUNET_SCHEDULER_NO_TASK != p->path_delete) + if (NULL != p->path_delete) GNUNET_SCHEDULER_cancel (p->path_delete); GNUNET_free (p); return GNUNET_OK; diff --git a/src/cadet/cadet_path.h b/src/cadet/cadet_path.h index 761e511566..326626f9d5 100644 --- a/src/cadet/cadet_path.h +++ b/src/cadet/cadet_path.h @@ -78,7 +78,7 @@ struct CadetPeerPath * Task to delete the path. * We tried it, it didn't work, don't try again in a while. */ - GNUNET_SCHEDULER_TaskIdentifier path_delete; + struct GNUNET_SCHEDULER_Task * path_delete; }; diff --git a/src/cadet/gnunet-cadet-profiler.c b/src/cadet/gnunet-cadet-profiler.c index c944caa755..2cfbfdaa4c 100644 --- a/src/cadet/gnunet-cadet-profiler.c +++ b/src/cadet/gnunet-cadet-profiler.c @@ -147,7 +147,7 @@ struct CadetPeer /** * Task to do the next ping. */ - GNUNET_SCHEDULER_TaskIdentifier ping_task; + struct GNUNET_SCHEDULER_Task * ping_task; float mean[number_rounds]; float var[number_rounds]; @@ -209,17 +209,17 @@ static struct GNUNET_CADET_TEST_Context *test_ctx; /** * Task called to shutdown test. */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle; +static struct GNUNET_SCHEDULER_Task * shutdown_handle; /** * Task called to disconnect peers, before shutdown. */ -static GNUNET_SCHEDULER_TaskIdentifier disconnect_task; +static struct GNUNET_SCHEDULER_Task * disconnect_task; /** * Task to perform tests */ -static GNUNET_SCHEDULER_TaskIdentifier test_task; +static struct GNUNET_SCHEDULER_Task * test_task; /** * Round number. @@ -320,7 +320,7 @@ static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Ending test.\n"); - shutdown_handle = GNUNET_SCHEDULER_NO_TASK; + shutdown_handle = NULL; } @@ -338,7 +338,7 @@ disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "disconnecting cadet service, called from line %ld\n", line); - disconnect_task = GNUNET_SCHEDULER_NO_TASK; + disconnect_task = NULL; for (i = 0; i < peers_total; i++) { if (NULL != peers[i].op) @@ -366,7 +366,7 @@ disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc } } GNUNET_CADET_TEST_cleanup (test_ctx); - if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle) + if (NULL != shutdown_handle) { GNUNET_SCHEDULER_cancel (shutdown_handle); } @@ -382,7 +382,7 @@ disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc static void abort_test (long line) { - if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) + if (disconnect_task != NULL) { GNUNET_SCHEDULER_cancel (disconnect_task); disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, @@ -405,7 +405,7 @@ stats_cont (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) GNUNET_log (GNUNET_ERROR_TYPE_INFO, "... collecting statistics done.\n"); GNUNET_TESTBED_operation_done (stats_op); - if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) + if (NULL != disconnect_task) GNUNET_SCHEDULER_cancel (disconnect_task); disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, (void *) __LINE__); @@ -513,9 +513,9 @@ adjust_running_peers (unsigned int target) GNUNET_log (GNUNET_ERROR_TYPE_INFO, "St%s peer %u: %s\n", run ? "arting" : "opping", r, GNUNET_i2s (&peers[r].id)); - if (GNUNET_SCHEDULER_NO_TASK != peers[r].ping_task) + if (NULL != peers[r].ping_task) GNUNET_SCHEDULER_cancel (peers[r].ping_task); - peers[r].ping_task = GNUNET_SCHEDULER_NO_TASK; + peers[r].ping_task = NULL; peers[r].up = run; @@ -615,7 +615,7 @@ ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct CadetPeer *peer = (struct CadetPeer *) cls; - peer->ping_task = GNUNET_SCHEDULER_NO_TASK; + peer->ping_task = NULL; if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0 || GNUNET_YES == test_finished) @@ -797,7 +797,7 @@ incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel, peers_warmup++; if (peers_warmup < peers_total) return NULL; - if (GNUNET_SCHEDULER_NO_TASK != test_task) + if (NULL != test_task) { GNUNET_SCHEDULER_cancel (test_task); test_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, @@ -873,7 +873,7 @@ start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) enum GNUNET_CADET_ChannelOption flags; unsigned long i; - test_task = GNUNET_SCHEDULER_NO_TASK; + test_task = NULL; if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) return; @@ -898,7 +898,7 @@ start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) &ping, &peers[i]); } peers_running = peers_total; - if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) + if (NULL != disconnect_task) GNUNET_SCHEDULER_cancel (disconnect_task); disconnect_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(round_time, diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c index d6ae663316..2b28685c94 100644 --- a/src/cadet/gnunet-cadet.c +++ b/src/cadet/gnunet-cadet.c @@ -87,7 +87,7 @@ struct GNUNET_TIME_Absolute echo_time; /** * Task for next echo request. */ -GNUNET_SCHEDULER_TaskIdentifier echo_task; +struct GNUNET_SCHEDULER_Task * echo_task; /** * Peer to connect to. @@ -118,7 +118,7 @@ static struct GNUNET_CADET_Channel *ch; /** * Shutdown task handle. */ -GNUNET_SCHEDULER_TaskIdentifier sd; +struct GNUNET_SCHEDULER_Task * sd; diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index cc9cc699a1..bb9fa6060f 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c @@ -183,7 +183,7 @@ struct CadetChannelReliability /** * Task to resend/poll in case no ACK is received. */ - GNUNET_SCHEDULER_TaskIdentifier retry_task; + struct GNUNET_SCHEDULER_Task * retry_task; /** * Counter for exponential backoff. @@ -729,7 +729,7 @@ channel_retransmit_message (void *cls, struct GNUNET_CADET_Data *payload; int fwd; - rel->retry_task = GNUNET_SCHEDULER_NO_TASK; + rel->retry_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -763,7 +763,7 @@ channel_recreate (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct CadetChannelReliability *rel = cls; - rel->retry_task = GNUNET_SCHEDULER_NO_TASK; + rel->retry_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -815,7 +815,7 @@ ch_message_sent (void *cls, GNUNET_assert (chq == copy->chq); copy->timestamp = GNUNET_TIME_absolute_get (); rel = copy->rel; - if (GNUNET_SCHEDULER_NO_TASK == rel->retry_task) + if (NULL == rel->retry_task) { LOG (GNUNET_ERROR_TYPE_DEBUG, "!! scheduling retry in 4 * %s\n", GNUNET_STRINGS_relative_time_to_string (rel->expected_delay, @@ -859,7 +859,7 @@ ch_message_sent (void *cls, && GNUNET_MESSAGE_TYPE_CADET_DATA_ACK != type && GNUNET_NO == rel->ch->destroy) { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == rel->retry_task); + GNUNET_assert (NULL == rel->retry_task); LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! STD BACKOFF %s\n", GNUNET_STRINGS_relative_time_to_string (rel->retry_timer, GNUNET_NO)); @@ -1006,10 +1006,10 @@ channel_rel_free_all (struct CadetChannelReliability *rel) GCT_cancel (rel->uniq->tq); /* ch_message_sent is called freeing uniq */ } - if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task) + if (NULL != rel->retry_task) { GNUNET_SCHEDULER_cancel (rel->retry_task); - rel->retry_task = GNUNET_SCHEDULER_NO_TASK; + rel->retry_task = NULL; } GNUNET_free (rel); } @@ -1174,10 +1174,10 @@ channel_confirm (struct CadetChannel *ch, int fwd) if (GCT_get_connections_buffer (ch->t) > 0 || GCT_is_loopback (ch->t)) send_client_ack (ch, fwd); - if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task) + if (NULL != rel->retry_task) { GNUNET_SCHEDULER_cancel (rel->retry_task); - rel->retry_task = GNUNET_SCHEDULER_NO_TASK; + rel->retry_task = NULL; } else if (NULL != rel->uniq) { @@ -2079,10 +2079,10 @@ GCCH_handle_data_ack (struct CadetChannel *ch, /* If some message was free'd, update the retransmission delay */ if (GNUNET_YES == work) { - if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task) + if (NULL != rel->retry_task) { GNUNET_SCHEDULER_cancel (rel->retry_task); - rel->retry_task = GNUNET_SCHEDULER_NO_TASK; + rel->retry_task = NULL; if (NULL != rel->head_sent && NULL == rel->head_sent->chq) { struct GNUNET_TIME_Absolute new_target; @@ -2179,12 +2179,12 @@ GCCH_handle_create (struct CadetTunnel *t, else { LOG (GNUNET_ERROR_TYPE_DEBUG, " duplicate create channel\n"); - if (GNUNET_SCHEDULER_NO_TASK != ch->dest_rel->retry_task) + if (NULL != ch->dest_rel->retry_task) { LOG (GNUNET_ERROR_TYPE_DEBUG, " clearing retry task\n"); /* we were waiting to re-send our 'SYNACK', wait no more! */ GNUNET_SCHEDULER_cancel (ch->dest_rel->retry_task); - ch->dest_rel->retry_task = GNUNET_SCHEDULER_NO_TASK; + ch->dest_rel->retry_task = NULL; } else if (NULL != ch->dest_rel->uniq) { diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index 50768d413e..548eeb9b36 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c @@ -95,7 +95,7 @@ struct CadetFlowControl /** * Task to poll the peer in case of a lost ACK causes stall. */ - GNUNET_SCHEDULER_TaskIdentifier poll_task; + struct GNUNET_SCHEDULER_Task * poll_task; /** * How frequently to poll for ACKs. @@ -190,13 +190,13 @@ struct CadetConnection * Task to keep the used paths alive at the owner, * time tunnel out on all the other peers. */ - GNUNET_SCHEDULER_TaskIdentifier fwd_maintenance_task; + struct GNUNET_SCHEDULER_Task * fwd_maintenance_task; /** * Task to keep the used paths alive at the destination, * time tunnel out on all the other peers. */ - GNUNET_SCHEDULER_TaskIdentifier bck_maintenance_task; + struct GNUNET_SCHEDULER_Task * bck_maintenance_task; /** * Queue handle for maintainance traffic. One handle for FWD and BCK since @@ -400,7 +400,7 @@ fc_init (struct CadetFlowControl *fc) fc->last_pid_recv = (uint32_t) -1; fc->last_ack_sent = (uint32_t) 0; fc->last_ack_recv = (uint32_t) 0; - fc->poll_task = GNUNET_SCHEDULER_NO_TASK; + fc->poll_task = NULL; fc->poll_time = GNUNET_TIME_UNIT_SECONDS; fc->queue_n = 0; fc->queue_max = (max_msgs_queue / max_connections) + 1; @@ -1008,9 +1008,9 @@ connection_keepalive (struct CadetConnection *c, int fwd, int shutdown) GC_f2s (fwd), GCC_2s (c)); if (fwd) - c->fwd_maintenance_task = GNUNET_SCHEDULER_NO_TASK; + c->fwd_maintenance_task = NULL; else - c->bck_maintenance_task = GNUNET_SCHEDULER_NO_TASK; + c->bck_maintenance_task = NULL; if (GNUNET_NO != shutdown) return; @@ -1066,8 +1066,8 @@ static void schedule_next_keepalive (struct CadetConnection *c, int fwd) { struct GNUNET_TIME_Relative delay; - GNUNET_SCHEDULER_TaskIdentifier *task_id; - GNUNET_SCHEDULER_Task keepalive_task; + struct GNUNET_SCHEDULER_Task * *task_id; + GNUNET_SCHEDULER_TaskCallback keepalive_task; if (GNUNET_NO == GCC_is_origin (c, fwd)) return; @@ -1100,7 +1100,7 @@ schedule_next_keepalive (struct CadetConnection *c, int fwd) } /* Check that no one scheduled it before us */ - if (GNUNET_SCHEDULER_NO_TASK != *task_id) + if (NULL != *task_id) { /* No need for a _break. It can happen for instance when sending a SYNACK * for a duplicate SYN: the first SYNACK scheduled the task. */ @@ -1168,10 +1168,10 @@ connection_cancel_queues (struct CadetConnection *c, int fwd) } fc = fwd ? &c->fwd_fc : &c->bck_fc; - if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task) + if (NULL != fc->poll_task) { GNUNET_SCHEDULER_cancel (fc->poll_task); - fc->poll_task = GNUNET_SCHEDULER_NO_TASK; + fc->poll_task = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Cancel POLL in ccq for fc %p\n", fc); } peer = get_hop (c, fwd); @@ -1236,7 +1236,7 @@ connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_CADET_Poll msg; struct CadetConnection *c; - fc->poll_task = GNUNET_SCHEDULER_NO_TASK; + fc->poll_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { return; @@ -1316,7 +1316,7 @@ connection_fwd_timeout (void *cls, { struct CadetConnection *c = cls; - c->fwd_maintenance_task = GNUNET_SCHEDULER_NO_TASK; + c->fwd_maintenance_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -1358,7 +1358,7 @@ connection_bck_timeout (void *cls, { struct CadetConnection *c = cls; - c->bck_maintenance_task = GNUNET_SCHEDULER_NO_TASK; + c->bck_maintenance_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -1410,12 +1410,12 @@ connection_reset_timeout (struct CadetConnection *c, int fwd) else /* Relay, endpoint. */ { struct GNUNET_TIME_Relative delay; - GNUNET_SCHEDULER_TaskIdentifier *ti; - GNUNET_SCHEDULER_Task f; + struct GNUNET_SCHEDULER_Task * *ti; + GNUNET_SCHEDULER_TaskCallback f; ti = fwd ? &c->fwd_maintenance_task : &c->bck_maintenance_task; - if (GNUNET_SCHEDULER_NO_TASK != *ti) + if (NULL != *ti) GNUNET_SCHEDULER_cancel (*ti); delay = GNUNET_TIME_relative_multiply (refresh_connection_time, 4); LOG (GNUNET_ERROR_TYPE_DEBUG, " timing out in %s\n", @@ -2376,12 +2376,12 @@ GCC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer, fc->last_ack_recv = ack; /* Cancel polling if the ACK is big enough. */ - if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task && + if (NULL != fc->poll_task && GC_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent)) { LOG (GNUNET_ERROR_TYPE_DEBUG, " Cancel poll\n"); GNUNET_SCHEDULER_cancel (fc->poll_task); - fc->poll_task = GNUNET_SCHEDULER_NO_TASK; + fc->poll_task = NULL; fc->poll_time = GNUNET_TIME_UNIT_SECONDS; } @@ -2690,16 +2690,16 @@ GCC_destroy (struct CadetConnection *c) if (GNUNET_NO == GCC_is_origin (c, GNUNET_YES) && NULL != c->path) path_destroy (c->path); - if (GNUNET_SCHEDULER_NO_TASK != c->fwd_maintenance_task) + if (NULL != c->fwd_maintenance_task) GNUNET_SCHEDULER_cancel (c->fwd_maintenance_task); - if (GNUNET_SCHEDULER_NO_TASK != c->bck_maintenance_task) + if (NULL != c->bck_maintenance_task) GNUNET_SCHEDULER_cancel (c->bck_maintenance_task); - if (GNUNET_SCHEDULER_NO_TASK != c->fwd_fc.poll_task) + if (NULL != c->fwd_fc.poll_task) { GNUNET_SCHEDULER_cancel (c->fwd_fc.poll_task); LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL FWD canceled\n"); } - if (GNUNET_SCHEDULER_NO_TASK != c->bck_fc.poll_task) + if (NULL != c->bck_fc.poll_task) { GNUNET_SCHEDULER_cancel (c->bck_fc.poll_task); LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL BCK canceled\n"); @@ -3268,7 +3268,7 @@ GCC_start_poll (struct CadetConnection *c, int fwd) fc = fwd ? &c->fwd_fc : &c->bck_fc; LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL %s requested\n", GC_f2s (fwd)); - if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task || NULL != fc->poll_msg) + if (NULL != fc->poll_task || NULL != fc->poll_msg) { LOG (GNUNET_ERROR_TYPE_DEBUG, " *** not needed (%u, %p)\n", fc->poll_task, fc->poll_msg); @@ -3295,10 +3295,10 @@ GCC_stop_poll (struct CadetConnection *c, int fwd) struct CadetFlowControl *fc; fc = fwd ? &c->fwd_fc : &c->bck_fc; - if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task) + if (NULL != fc->poll_task) { GNUNET_SCHEDULER_cancel (fc->poll_task); - fc->poll_task = GNUNET_SCHEDULER_NO_TASK; + fc->poll_task = NULL; } } diff --git a/src/cadet/gnunet-service-cadet_dht.c b/src/cadet/gnunet-service-cadet_dht.c index a449384842..7307ba0015 100644 --- a/src/cadet/gnunet-service-cadet_dht.c +++ b/src/cadet/gnunet-service-cadet_dht.c @@ -93,7 +93,7 @@ static unsigned long long dht_replication_level; /** * Task to periodically announce itself in the network. */ -static GNUNET_SCHEDULER_TaskIdentifier announce_id_task; +static struct GNUNET_SCHEDULER_Task * announce_id_task; /** * GET requests to stop on shutdown. @@ -214,7 +214,7 @@ announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { - announce_id_task = GNUNET_SCHEDULER_NO_TASK; + announce_id_task = NULL; return; } LOG (GNUNET_ERROR_TYPE_DEBUG, "Announce ID\n"); @@ -332,10 +332,10 @@ GCD_shutdown (void) GNUNET_DHT_disconnect (dht_handle); dht_handle = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != announce_id_task) + if (NULL != announce_id_task) { GNUNET_SCHEDULER_cancel (announce_id_task); - announce_id_task = GNUNET_SCHEDULER_NO_TASK; + announce_id_task = NULL; } } diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c index e19a60961f..9740e41d99 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.c +++ b/src/cadet/gnunet-service-cadet_tunnel.c @@ -117,7 +117,7 @@ struct CadetTunnelKXCtx * Task for delayed destruction of the Key eXchange context, to allow delayed * messages with the old key to be decrypted successfully. */ - GNUNET_SCHEDULER_TaskIdentifier finish_task; + struct GNUNET_SCHEDULER_Task * finish_task; }; /** @@ -164,7 +164,7 @@ struct CadetTunnel /** * Task to start the rekey process. */ - GNUNET_SCHEDULER_TaskIdentifier rekey_task; + struct GNUNET_SCHEDULER_Task * rekey_task; /** * Paths that are actively used to reach the destination peer. @@ -191,7 +191,7 @@ struct CadetTunnel /** * Destroy flag: if true, destroy on last message. */ - GNUNET_SCHEDULER_TaskIdentifier destroy_task; + struct GNUNET_SCHEDULER_Task * destroy_task; /** * Queued messages, to transmit once tunnel gets connected. @@ -202,7 +202,7 @@ struct CadetTunnel /** * Task to trim connections if too many are present. */ - GNUNET_SCHEDULER_TaskIdentifier trim_connections_task; + struct GNUNET_SCHEDULER_Task * trim_connections_task; /** * Ephemeral message in the queue (to avoid queueing more than one). @@ -326,7 +326,7 @@ static struct GNUNET_CADET_KX_Ephemeral kx_msg; /** * Task to generate a new ephemeral key. */ -static GNUNET_SCHEDULER_TaskIdentifier rekey_task; +static struct GNUNET_SCHEDULER_Task * rekey_task; /** * Rekey period. @@ -604,7 +604,7 @@ select_key (const struct CadetTunnel *t) const struct GNUNET_CRYPTO_SymmetricSessionKey *key; if (NULL != t->kx_ctx - && GNUNET_SCHEDULER_NO_TASK == t->kx_ctx->finish_task) + && NULL == t->kx_ctx->finish_task) { struct GNUNET_TIME_Relative age; @@ -912,11 +912,11 @@ create_kx_ctx (struct CadetTunnel *t) if (NULL != t->kx_ctx) { - if (GNUNET_SCHEDULER_NO_TASK != t->kx_ctx->finish_task) + if (NULL != t->kx_ctx->finish_task) { LOG (GNUNET_ERROR_TYPE_INFO, " resetting exisiting finish task\n"); GNUNET_SCHEDULER_cancel (t->kx_ctx->finish_task); - t->kx_ctx->finish_task = GNUNET_SCHEDULER_NO_TASK; + t->kx_ctx->finish_task = NULL; } } else @@ -975,7 +975,7 @@ destroy_kx_ctx (struct CadetTunnel *t) { struct GNUNET_TIME_Relative delay; - if (NULL == t->kx_ctx || GNUNET_SCHEDULER_NO_TASK != t->kx_ctx->finish_task) + if (NULL == t->kx_ctx || NULL != t->kx_ctx->finish_task) return; if (is_key_null (&t->kx_ctx->e_key_old)) @@ -1182,7 +1182,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, if (NULL == c) { /* Why is tunnel 'ready'? Should have been queued! */ - if (GNUNET_SCHEDULER_NO_TASK != t->destroy_task) + if (NULL != t->destroy_task) { GNUNET_break (0); GCT_debug (t, GNUNET_ERROR_TYPE_WARNING); @@ -1387,7 +1387,7 @@ send_kx (struct CadetTunnel *t, c = tunnel_get_connection (t); if (NULL == c) { - if (GNUNET_SCHEDULER_NO_TASK == t->destroy_task + if (NULL == t->destroy_task && CADET_TUNNEL_READY == t->cstate) { GNUNET_break (0); @@ -1488,7 +1488,7 @@ rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct CadetTunnel *t = cls; - t->rekey_task = GNUNET_SCHEDULER_NO_TASK; + t->rekey_task = NULL; LOG (GNUNET_ERROR_TYPE_INFO, "Re-key Tunnel %s\n", GCT_2s (t)); if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) @@ -1571,7 +1571,7 @@ rekey_iterator (void *cls, long n = (long) cls; uint32_t r; - if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) + if (NULL != t->rekey_task) return GNUNET_YES; if (GNUNET_YES == GCT_is_loopback (t)) @@ -1599,7 +1599,7 @@ rekey (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_TIME_Absolute time; long n; - rekey_task = GNUNET_SCHEDULER_NO_TASK; + rekey_task = NULL; if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; @@ -1949,7 +1949,7 @@ handle_ephemeral (struct CadetTunnel *t, { GCT_change_estate (t, CADET_TUNNEL_KEY_REKEY); } - if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) + if (NULL != t->rekey_task) GNUNET_SCHEDULER_cancel (t->rekey_task); t->rekey_task = GNUNET_SCHEDULER_add_now (rekey_tunnel, t); } @@ -1987,7 +1987,7 @@ handle_pong (struct CadetTunnel *t, uint32_t challenge; LOG (GNUNET_ERROR_TYPE_INFO, "<=== PONG for %s\n", GCT_2s (t)); - if (GNUNET_SCHEDULER_NO_TASK == t->rekey_task) + if (NULL == t->rekey_task) { GNUNET_STATISTICS_update (stats, "# duplicate PONG messages", 1, GNUNET_NO); return; @@ -2008,7 +2008,7 @@ handle_pong (struct CadetTunnel *t, return; } GNUNET_SCHEDULER_cancel (t->rekey_task); - t->rekey_task = GNUNET_SCHEDULER_NO_TASK; + t->rekey_task = NULL; /* Don't free the old keys right away, but after a delay. * Rationale: the KX could have happened over a very fast connection, @@ -2223,10 +2223,10 @@ GCT_init (const struct GNUNET_CONFIGURATION_Handle *c, void GCT_shutdown (void) { - if (GNUNET_SCHEDULER_NO_TASK != rekey_task) + if (NULL != rekey_task) { GNUNET_SCHEDULER_cancel (rekey_task); - rekey_task = GNUNET_SCHEDULER_NO_TASK; + rekey_task = NULL; } GNUNET_CONTAINER_multipeermap_iterate (tunnels, &destroy_iterator, NULL); GNUNET_CONTAINER_multipeermap_destroy (tunnels); @@ -2285,7 +2285,7 @@ GCT_change_cstate (struct CadetTunnel* t, enum CadetTunnelCState cstate) else if (CADET_TUNNEL_KEY_UNINITIALIZED == t->estate) { LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered rekey\n"); - if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) + if (NULL != t->rekey_task) GNUNET_SCHEDULER_cancel (t->rekey_task); create_kx_ctx (t); rekey_tunnel (t, NULL); @@ -2347,7 +2347,7 @@ trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct CadetTunnel *t = cls; - t->trim_connections_task = GNUNET_SCHEDULER_NO_TASK; + t->trim_connections_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -2409,7 +2409,7 @@ GCT_add_connection (struct CadetTunnel *t, struct CadetConnection *c) if (CADET_TUNNEL_SEARCHING == t->cstate) GCT_change_estate (t, CADET_TUNNEL_WAITING); - if (GNUNET_SCHEDULER_NO_TASK != t->trim_connections_task) + if (NULL != t->trim_connections_task) t->trim_connections_task = GNUNET_SCHEDULER_add_now (&trim_connections, t); } @@ -2442,7 +2442,7 @@ GCT_remove_connection (struct CadetTunnel *t, conns = GCT_count_connections (t); if (0 == conns - && GNUNET_SCHEDULER_NO_TASK == t->destroy_task + && NULL == t->destroy_task && CADET_TUNNEL_SHUTDOWN != t->cstate && GNUNET_NO == shutting_down) { @@ -2454,7 +2454,7 @@ GCT_remove_connection (struct CadetTunnel *t, /* Start new connections if needed */ if (CONNECTIONS_PER_TUNNEL > conns - && GNUNET_SCHEDULER_NO_TASK == t->destroy_task + && NULL == t->destroy_task && CADET_TUNNEL_SHUTDOWN != t->cstate && GNUNET_NO == shutting_down) { @@ -2501,10 +2501,10 @@ GCT_add_channel (struct CadetTunnel *t, struct CadetChannel *ch) LOG (GNUNET_ERROR_TYPE_DEBUG, " adding %p to %p\n", aux, t->channel_head); GNUNET_CONTAINER_DLL_insert_tail (t->channel_head, t->channel_tail, aux); - if (GNUNET_SCHEDULER_NO_TASK != t->destroy_task) + if (NULL != t->destroy_task) { GNUNET_SCHEDULER_cancel (t->destroy_task); - t->destroy_task = GNUNET_SCHEDULER_NO_TASK; + t->destroy_task = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, " undo destroy!\n"); } } @@ -2585,7 +2585,7 @@ delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) "Tunnel at %p should have been freed by GCT_shutdown\n", t); return; } - t->destroy_task = GNUNET_SCHEDULER_NO_TASK; + t->destroy_task = NULL; t->cstate = CADET_TUNNEL_SHUTDOWN; for (iter = t->connection_head; NULL != iter; iter = iter->next) @@ -2609,7 +2609,7 @@ GCT_destroy_empty (struct CadetTunnel *t) if (GNUNET_YES == shutting_down) return; /* Will be destroyed immediately anyway */ - if (GNUNET_SCHEDULER_NO_TASK != t->destroy_task) + if (NULL != t->destroy_task) { LOG (GNUNET_ERROR_TYPE_WARNING, "Tunnel %s is already scheduled for destruction. Tunnel debug dump:\n", @@ -2690,32 +2690,32 @@ GCT_destroy (struct CadetTunnel *t) /* Should only happen on shutdown, but it's ok. */ } - if (GNUNET_SCHEDULER_NO_TASK != t->destroy_task) + if (NULL != t->destroy_task) { LOG (GNUNET_ERROR_TYPE_DEBUG, "cancelling dest: %llX\n", t->destroy_task); GNUNET_SCHEDULER_cancel (t->destroy_task); - t->destroy_task = GNUNET_SCHEDULER_NO_TASK; + t->destroy_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != t->trim_connections_task) + if (NULL != t->trim_connections_task) { LOG (GNUNET_ERROR_TYPE_DEBUG, "cancelling trim: %llX\n", t->trim_connections_task); GNUNET_SCHEDULER_cancel (t->trim_connections_task); - t->trim_connections_task = GNUNET_SCHEDULER_NO_TASK; + t->trim_connections_task = NULL; } GNUNET_STATISTICS_update (stats, "# tunnels", -1, GNUNET_NO); GCP_set_tunnel (t->peer, NULL); - if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) + if (NULL != t->rekey_task) { GNUNET_SCHEDULER_cancel (t->rekey_task); - t->rekey_task = GNUNET_SCHEDULER_NO_TASK; + t->rekey_task = NULL; } if (NULL != t->kx_ctx) { - if (GNUNET_SCHEDULER_NO_TASK != t->kx_ctx->finish_task) + if (NULL != t->kx_ctx->finish_task) GNUNET_SCHEDULER_cancel (t->kx_ctx->finish_task); GNUNET_free (t->kx_ctx); } diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index b9661a9b7b..df605d0a92 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c @@ -144,17 +144,17 @@ struct GNUNET_CADET_TEST_Context *test_ctx; /** * Task called to disconnect peers. */ -static GNUNET_SCHEDULER_TaskIdentifier disconnect_task; +static struct GNUNET_SCHEDULER_Task * disconnect_task; /** * Task To perform tests */ -static GNUNET_SCHEDULER_TaskIdentifier test_task; +static struct GNUNET_SCHEDULER_Task * test_task; /** * Task called to shutdown test. */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle; +static struct GNUNET_SCHEDULER_Task * shutdown_handle; /** * Cadet handle for the root peer @@ -254,7 +254,7 @@ static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n"); - shutdown_handle = GNUNET_SCHEDULER_NO_TASK; + shutdown_handle = NULL; } @@ -278,7 +278,7 @@ disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "disconnecting cadet service of peers, called from line %ld\n", line); - disconnect_task = GNUNET_SCHEDULER_NO_TASK; + disconnect_task = NULL; for (i = 0; i < 2; i++) { GNUNET_TESTBED_operation_done (t_op[i]); @@ -294,7 +294,7 @@ disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc incoming_ch = NULL; } GNUNET_CADET_TEST_cleanup (test_ctx); - if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle) + if (NULL != shutdown_handle) { GNUNET_SCHEDULER_cancel (shutdown_handle); } @@ -310,7 +310,7 @@ disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc static void abort_test (long line) { - if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) + if (disconnect_task != NULL) { GNUNET_SCHEDULER_cancel (disconnect_task); disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, @@ -474,7 +474,7 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel, if ((ok % 20) == 0) { - if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) + if (NULL != disconnect_task) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, " reschedule timeout\n"); GNUNET_SCHEDULER_cancel (disconnect_task); @@ -573,7 +573,7 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel, } } - if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) + if (NULL != disconnect_task) { GNUNET_SCHEDULER_cancel (disconnect_task); disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, @@ -604,7 +604,7 @@ stats_cont (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) ok--; GNUNET_TESTBED_operation_done (stats_op); - if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) + if (NULL != disconnect_task) GNUNET_SCHEDULER_cancel (disconnect_task); disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, (void *) __LINE__); @@ -657,7 +657,7 @@ check_keepalives (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) return; - disconnect_task = GNUNET_SCHEDULER_NO_TASK; + disconnect_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "check keepalives\n"); GNUNET_CADET_channel_destroy (ch); stats_op = GNUNET_TESTBED_get_statistics (peers_running, testbed_peers, @@ -705,7 +705,7 @@ incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel, "Incoming channel for unknown client %lu\n", (long) cls); GNUNET_break(0); } - if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) + if (NULL != disconnect_task) { GNUNET_SCHEDULER_cancel (disconnect_task); if (KEEPALIVE == test) @@ -761,7 +761,7 @@ channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel, "Unknown peer! %d\n", i); GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok); - if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) + if (NULL != disconnect_task) { GNUNET_SCHEDULER_cancel (disconnect_task); disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, @@ -791,7 +791,7 @@ do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test_task\n"); - if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) + if (NULL != disconnect_task) { GNUNET_SCHEDULER_cancel (disconnect_task); } diff --git a/src/cadet/test_cadet_local.c b/src/cadet/test_cadet_local.c index 0796aaf12c..d66f0a3d4a 100644 --- a/src/cadet/test_cadet_local.c +++ b/src/cadet/test_cadet_local.c @@ -42,9 +42,9 @@ static int result = GNUNET_OK; static int got_data = GNUNET_NO; -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; static struct GNUNET_CADET_TransmitHandle *mth; @@ -66,7 +66,7 @@ static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n"); - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + if (NULL != abort_task) { GNUNET_SCHEDULER_cancel (abort_task); } @@ -95,11 +95,11 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n"); result = GNUNET_SYSERR; - abort_task = GNUNET_SCHEDULER_NO_TASK; - if (GNUNET_SCHEDULER_NO_TASK != shutdown_task) + abort_task = NULL; + if (NULL != shutdown_task) { GNUNET_SCHEDULER_cancel (shutdown_task); - shutdown_task = GNUNET_SCHEDULER_NO_TASK; + shutdown_task = NULL; } do_shutdown (cls, tc); } @@ -123,7 +123,7 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel, { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data callback! Shutting down.\n"); got_data = GNUNET_YES; - if (GNUNET_SCHEDULER_NO_TASK != shutdown_task) + if (NULL != shutdown_task) GNUNET_SCHEDULER_cancel (shutdown_task); shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown, diff --git a/src/cadet/test_cadet_single.c b/src/cadet/test_cadet_single.c index 3780c745ce..29f2bf76f3 100644 --- a/src/cadet/test_cadet_single.c +++ b/src/cadet/test_cadet_single.c @@ -43,9 +43,9 @@ static struct GNUNET_CADET_Channel *ch2; static int result; -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; static unsigned int repetition; @@ -62,7 +62,7 @@ static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n"); - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + if (NULL != abort_task) { GNUNET_SCHEDULER_cancel (abort_task); } @@ -92,11 +92,11 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n"); result = GNUNET_SYSERR; - abort_task = GNUNET_SCHEDULER_NO_TASK; - if (GNUNET_SCHEDULER_NO_TASK != shutdown_task) + abort_task = NULL; + if (NULL != shutdown_task) { GNUNET_SCHEDULER_cancel (shutdown_task); - shutdown_task = GNUNET_SCHEDULER_NO_TASK; + shutdown_task = NULL; } do_shutdown (cls, tc); } @@ -105,7 +105,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void finish (void) { - if (GNUNET_SCHEDULER_NO_TASK != shutdown_task) + if (NULL != shutdown_task) GNUNET_SCHEDULER_cancel (shutdown_task); shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown, NULL); diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c index 2659b939dc..c6bf179c54 100644 --- a/src/consensus/gnunet-service-consensus.c +++ b/src/consensus/gnunet-service-consensus.c @@ -154,7 +154,7 @@ struct ConsensusSession /** * Timeout task identifier for the current round or subround. */ - GNUNET_SCHEDULER_TaskIdentifier round_timeout_tid; + struct GNUNET_SCHEDULER_Task * round_timeout_tid; /** * Number of other peers in the consensus. @@ -440,12 +440,12 @@ round_over (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%d: round over\n", session->local_peer_idx); if (tc != NULL) - session->round_timeout_tid = GNUNET_SCHEDULER_NO_TASK; + session->round_timeout_tid = NULL; - if (session->round_timeout_tid != GNUNET_SCHEDULER_NO_TASK) + if (session->round_timeout_tid != NULL) { GNUNET_SCHEDULER_cancel (session->round_timeout_tid); - session->round_timeout_tid = GNUNET_SCHEDULER_NO_TASK; + session->round_timeout_tid = NULL; } for (i = 0; i < session->num_peers; i++) @@ -726,16 +726,16 @@ subround_over (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (tc != NULL) { - session->round_timeout_tid = GNUNET_SCHEDULER_NO_TASK; + session->round_timeout_tid = NULL; GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "P%u: consensus subround timed out\n", session->local_peer_idx); } /* cancel timeout */ - if (session->round_timeout_tid != GNUNET_SCHEDULER_NO_TASK) + if (session->round_timeout_tid != NULL) { GNUNET_SCHEDULER_cancel (session->round_timeout_tid); - session->round_timeout_tid = GNUNET_SCHEDULER_NO_TASK; + session->round_timeout_tid = NULL; } for (i = 0; i < session->num_peers; i++) diff --git a/src/conversation/gnunet-conversation-test.c b/src/conversation/gnunet-conversation-test.c index cc831a3abf..108ca7b5a1 100644 --- a/src/conversation/gnunet-conversation-test.c +++ b/src/conversation/gnunet-conversation-test.c @@ -74,12 +74,12 @@ static struct GNUNET_SPEAKER_Handle *speaker; /** * Task scheduled to switch from recording to playback. */ -static GNUNET_SCHEDULER_TaskIdentifier switch_task; +static struct GNUNET_SCHEDULER_Task * switch_task; /** * The shutdown task. */ -static GNUNET_SCHEDULER_TaskIdentifier st; +static struct GNUNET_SCHEDULER_Task * st; /** * Head of DLL with recorded frames. @@ -104,7 +104,7 @@ do_shutdown (void *cls, { struct Recording *rec; - if (GNUNET_SCHEDULER_NO_TASK != switch_task) + if (NULL != switch_task) GNUNET_SCHEDULER_cancel (switch_task); if (NULL != microphone) GNUNET_MICROPHONE_destroy (microphone); @@ -134,7 +134,7 @@ switch_to_speaker (void *cls, { struct Recording *rec; - switch_task = GNUNET_SCHEDULER_NO_TASK; + switch_task = NULL; microphone->disable_microphone (microphone->cls); if (GNUNET_OK != speaker->enable_speaker (speaker->cls)) diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c index 4b4c5f5dae..7d5cb990a7 100644 --- a/src/conversation/gnunet-conversation.c +++ b/src/conversation/gnunet-conversation.c @@ -173,7 +173,7 @@ static unsigned int line; /** * Task which handles the commands */ -static GNUNET_SCHEDULER_TaskIdentifier handle_cmd_task; +static struct GNUNET_SCHEDULER_Task * handle_cmd_task; /** * Our speaker. @@ -1036,10 +1036,10 @@ do_stop_task (void *cls, GNUNET_CONVERSATION_phone_destroy (phone); phone = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != handle_cmd_task) + if (NULL != handle_cmd_task) { GNUNET_SCHEDULER_cancel (handle_cmd_task); - handle_cmd_task = GNUNET_SCHEDULER_NO_TASK; + handle_cmd_task = NULL; } if (NULL != id) { diff --git a/src/conversation/test_conversation_api.c b/src/conversation/test_conversation_api.c index 7a55371440..91ece5c11f 100644 --- a/src/conversation/test_conversation_api.c +++ b/src/conversation/test_conversation_api.c @@ -67,9 +67,9 @@ static GNUNET_MICROPHONE_RecordedDataCallback call_rdc; static void *call_rdc_cls; -static GNUNET_SCHEDULER_TaskIdentifier phone_task; +static struct GNUNET_SCHEDULER_Task * phone_task; -static GNUNET_SCHEDULER_TaskIdentifier call_task; +static struct GNUNET_SCHEDULER_Task * call_task; static void @@ -229,14 +229,14 @@ disable_mic (void *cls) phone_rdc = NULL; phone_rdc_cls = NULL; GNUNET_SCHEDULER_cancel (phone_task); - phone_task = GNUNET_SCHEDULER_NO_TASK; + phone_task = NULL; } else { call_rdc = NULL; call_rdc_cls = NULL; GNUNET_SCHEDULER_cancel (call_task); - call_task = GNUNET_SCHEDULER_NO_TASK; + call_task = NULL; } } diff --git a/src/conversation/test_conversation_api_twocalls.c b/src/conversation/test_conversation_api_twocalls.c index 500f0858c4..7226ffba1d 100644 --- a/src/conversation/test_conversation_api_twocalls.c +++ b/src/conversation/test_conversation_api_twocalls.c @@ -73,7 +73,7 @@ static GNUNET_MICROPHONE_RecordedDataCallback phone_rdc; static void *phone_rdc_cls; -static GNUNET_SCHEDULER_TaskIdentifier phone_task; +static struct GNUNET_SCHEDULER_Task * phone_task; /** * Variable for recognizing caller1 @@ -114,7 +114,7 @@ struct MicContext void *rdc_cls; - GNUNET_SCHEDULER_TaskIdentifier call_task; + struct GNUNET_SCHEDULER_Task * call_task; }; @@ -268,14 +268,14 @@ enable_mic (void *cls, { phone_rdc = rdc; phone_rdc_cls = rdc_cls; - GNUNET_break (GNUNET_SCHEDULER_NO_TASK == phone_task); + GNUNET_break (NULL == phone_task); phone_task = GNUNET_SCHEDULER_add_now (&phone_send, NULL); return GNUNET_OK; } mc = (CALLER1 == cls) ? &call1_mic_ctx : &call2_mic_ctx; mc->rdc = rdc; mc->rdc_cls = rdc_cls; - GNUNET_break (GNUNET_SCHEDULER_NO_TASK == mc->call_task); + GNUNET_break (NULL == mc->call_task); mc->call_task = GNUNET_SCHEDULER_add_now (&call_send, mc); return GNUNET_OK; } @@ -294,14 +294,14 @@ disable_mic (void *cls) phone_rdc = NULL; phone_rdc_cls = NULL; GNUNET_SCHEDULER_cancel (phone_task); - phone_task = GNUNET_SCHEDULER_NO_TASK; + phone_task = NULL; return; } mc = (CALLER1 == cls) ? &call1_mic_ctx : &call2_mic_ctx; mc->rdc = NULL; mc->rdc_cls = NULL; GNUNET_SCHEDULER_cancel (mc->call_task); - mc->call_task = GNUNET_SCHEDULER_NO_TASK; + mc->call_task = NULL; } diff --git a/src/core/core_api.c b/src/core/core_api.c index d2a8b56512..1d287bbc64 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c @@ -130,12 +130,12 @@ struct PeerRecord * ID of timeout task for the 'pending_head' handle * which is the one with the smallest timeout. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * ID of task to run 'next_request_transmission'. */ - GNUNET_SCHEDULER_TaskIdentifier ntr_task; + struct GNUNET_SCHEDULER_Task * ntr_task; /** * SendMessageRequest ID generator for this peer. @@ -289,7 +289,7 @@ struct GNUNET_CORE_Handle /** * ID of reconnect task (if any). */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Current delay we use for re-trying to connect to core. @@ -344,7 +344,7 @@ reconnect_task (void *cls, { struct GNUNET_CORE_Handle *h = cls; - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to CORE service after delay\n"); reconnect (h); @@ -369,15 +369,15 @@ disconnect_and_free_peer_entry (void *cls, struct GNUNET_CORE_TransmitHandle *th; struct PeerRecord *pr = value; - if (GNUNET_SCHEDULER_NO_TASK != pr->timeout_task) + if (NULL != pr->timeout_task) { GNUNET_SCHEDULER_cancel (pr->timeout_task); - pr->timeout_task = GNUNET_SCHEDULER_NO_TASK; + pr->timeout_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != pr->ntr_task) + if (NULL != pr->ntr_task) { GNUNET_SCHEDULER_cancel (pr->ntr_task); - pr->ntr_task = GNUNET_SCHEDULER_NO_TASK; + pr->ntr_task = NULL; } if ( (NULL != pr->prev) || (NULL != pr->next) || @@ -401,8 +401,8 @@ disconnect_and_free_peer_entry (void *cls, GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (h->peers, key, pr)); GNUNET_assert (pr->ch == h); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->timeout_task); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->ntr_task); + GNUNET_assert (NULL == pr->timeout_task); + GNUNET_assert (NULL == pr->ntr_task); GNUNET_free (pr); return GNUNET_YES; } @@ -420,7 +420,7 @@ reconnect_later (struct GNUNET_CORE_Handle *h) struct ControlMessage *cm; struct PeerRecord *pr; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task); + GNUNET_assert (NULL == h->reconnect_task); if (NULL != h->cth) { GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth); @@ -432,7 +432,7 @@ reconnect_later (struct GNUNET_CORE_Handle *h) h->client = NULL; } h->currently_down = GNUNET_YES; - GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK); + GNUNET_assert (h->reconnect_task == NULL); h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->retry_backoff, &reconnect_task, h); @@ -496,10 +496,10 @@ request_next_transmission (struct PeerRecord *pr) struct SendMessageRequest *smr; struct GNUNET_CORE_TransmitHandle *th; - if (pr->timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (pr->timeout_task != NULL) { GNUNET_SCHEDULER_cancel (pr->timeout_task); - pr->timeout_task = GNUNET_SCHEDULER_NO_TASK; + pr->timeout_task = NULL; } th = &pr->th; if (NULL == th->peer) @@ -552,11 +552,11 @@ transmission_timeout (void *cls, struct GNUNET_CORE_Handle *h = pr->ch; struct GNUNET_CORE_TransmitHandle *th; - pr->timeout_task = GNUNET_SCHEDULER_NO_TASK; - if (GNUNET_SCHEDULER_NO_TASK != pr->ntr_task) + pr->timeout_task = NULL; + if (NULL != pr->ntr_task) { GNUNET_SCHEDULER_cancel (pr->ntr_task); - pr->ntr_task = GNUNET_SCHEDULER_NO_TASK; + pr->ntr_task = NULL; } th = &pr->th; th->peer = NULL; @@ -609,7 +609,7 @@ transmit_message (void *cls, uint16_t msize; size_t ret; - GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK); + GNUNET_assert (h->reconnect_task == NULL); h->cth = NULL; if (NULL == buf) { @@ -657,10 +657,10 @@ transmit_message (void *cls, h->ready_peer_tail, pr); th->peer = NULL; - if (GNUNET_SCHEDULER_NO_TASK != pr->timeout_task) + if (NULL != pr->timeout_task) { GNUNET_SCHEDULER_cancel (pr->timeout_task); - pr->timeout_task = GNUNET_SCHEDULER_NO_TASK; + pr->timeout_task = NULL; } LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting SEND request to `%s' with %u bytes.\n", @@ -1083,7 +1083,7 @@ init_done_task (void *cls, int success) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to exchange INIT with core, retrying\n"); - if (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK) + if (h->reconnect_task == NULL) reconnect_later (h); return; } @@ -1259,10 +1259,10 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle) GNUNET_CONTAINER_multipeermap_iterate (handle->peers, &disconnect_and_free_peer_entry, handle); - if (handle->reconnect_task != GNUNET_SCHEDULER_NO_TASK) + if (handle->reconnect_task != NULL) { GNUNET_SCHEDULER_cancel (handle->reconnect_task); - handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + handle->reconnect_task = NULL; } GNUNET_CONTAINER_multipeermap_destroy (handle->peers); handle->peers = NULL; @@ -1283,7 +1283,7 @@ run_request_next_transmission (void *cls, { struct PeerRecord *pr = cls; - pr->ntr_task = GNUNET_SCHEDULER_NO_TASK; + pr->ntr_task = NULL; request_next_transmission (pr); } @@ -1361,7 +1361,7 @@ GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, th->priority = priority; th->msize = notify_size; th->cork = cork; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pr->ntr_task); + GNUNET_assert (NULL == pr->ntr_task); pr->ntr_task = GNUNET_SCHEDULER_add_now (&run_request_next_transmission, pr); LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -1409,10 +1409,10 @@ GNUNET_CORE_notify_transmit_ready_cancel (struct GNUNET_CORE_TransmitHandle *th) h->ready_peer_tail, pr); } - if (GNUNET_SCHEDULER_NO_TASK != pr->ntr_task) + if (NULL != pr->ntr_task) { GNUNET_SCHEDULER_cancel (pr->ntr_task); - pr->ntr_task = GNUNET_SCHEDULER_NO_TASK; + pr->ntr_task = NULL; } } diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index a4e964312f..94f3f5c878 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c @@ -302,12 +302,12 @@ struct GSC_KeyExchangeInfo /** * ID of task used for re-trying SET_KEY and PING message. */ - GNUNET_SCHEDULER_TaskIdentifier retry_set_key_task; + struct GNUNET_SCHEDULER_Task * retry_set_key_task; /** * ID of task used for sending keep-alive pings. */ - GNUNET_SCHEDULER_TaskIdentifier keep_alive_task; + struct GNUNET_SCHEDULER_Task * keep_alive_task; /** * Bit map indicating which of the 32 sequence numbers before the last @@ -373,7 +373,7 @@ static struct GSC_KeyExchangeInfo *kx_tail; * Task scheduled for periodic re-generation (and thus rekeying) of our * ephemeral key. */ -static GNUNET_SCHEDULER_TaskIdentifier rekey_task; +static struct GNUNET_SCHEDULER_Task * rekey_task; /** * Notification context for all monitors. @@ -651,7 +651,7 @@ set_key_retry_task (void *cls, { struct GSC_KeyExchangeInfo *kx = cls; - kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK; + kx->retry_set_key_task = NULL; kx->set_key_retry_frequency = GNUNET_TIME_STD_BACKOFF (kx->set_key_retry_frequency); GNUNET_assert (GNUNET_CORE_KX_STATE_DOWN != kx->status); send_key (kx); @@ -746,15 +746,15 @@ GSC_KX_stop (struct GSC_KeyExchangeInfo *kx) GSC_SESSIONS_end (&kx->peer); GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# key exchanges stopped"), 1, GNUNET_NO); - if (kx->retry_set_key_task != GNUNET_SCHEDULER_NO_TASK) + if (kx->retry_set_key_task != NULL) { GNUNET_SCHEDULER_cancel (kx->retry_set_key_task); - kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK; + kx->retry_set_key_task = NULL; } - if (kx->keep_alive_task != GNUNET_SCHEDULER_NO_TASK) + if (kx->keep_alive_task != NULL) { GNUNET_SCHEDULER_cancel (kx->keep_alive_task); - kx->keep_alive_task = GNUNET_SCHEDULER_NO_TASK; + kx->keep_alive_task = NULL; } kx->status = GNUNET_CORE_KX_PEER_DISCONNECT; monitor_notify_all (kx); @@ -929,7 +929,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, switch (kx->status) { case GNUNET_CORE_KX_STATE_DOWN: - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == kx->keep_alive_task); + GNUNET_assert (NULL == kx->keep_alive_task); kx->status = GNUNET_CORE_KX_STATE_KEY_RECEIVED; monitor_notify_all (kx); if (GNUNET_CORE_KX_STATE_KEY_SENT == sender_status) @@ -937,7 +937,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, send_ping (kx); break; case GNUNET_CORE_KX_STATE_KEY_SENT: - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == kx->keep_alive_task); + GNUNET_assert (NULL == kx->keep_alive_task); kx->status = GNUNET_CORE_KX_STATE_KEY_RECEIVED; monitor_notify_all (kx); if (GNUNET_CORE_KX_STATE_KEY_SENT == sender_status) @@ -945,7 +945,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, send_ping (kx); break; case GNUNET_CORE_KX_STATE_KEY_RECEIVED: - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == kx->keep_alive_task); + GNUNET_assert (NULL == kx->keep_alive_task); if (GNUNET_CORE_KX_STATE_KEY_SENT == sender_status) send_key (kx); send_ping (kx); @@ -1069,7 +1069,7 @@ send_keep_alive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_TIME_Relative retry; struct GNUNET_TIME_Relative left; - kx->keep_alive_task = GNUNET_SCHEDULER_NO_TASK; + kx->keep_alive_task = NULL; left = GNUNET_TIME_absolute_get_remaining (kx->timeout); if (0 == left.rel_value_us) { @@ -1122,7 +1122,7 @@ update_timeout (struct GSC_KeyExchangeInfo *kx) are bigger than the threshold (5s) */ monitor_notify_all (kx); } - if (kx->keep_alive_task != GNUNET_SCHEDULER_NO_TASK) + if (kx->keep_alive_task != NULL) GNUNET_SCHEDULER_cancel (kx->keep_alive_task); kx->keep_alive_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_divide @@ -1213,10 +1213,10 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx, "Received PONG from `%s'\n", GNUNET_i2s (&kx->peer)); /* no need to resend key any longer */ - if (GNUNET_SCHEDULER_NO_TASK != kx->retry_set_key_task) + if (NULL != kx->retry_set_key_task) { GNUNET_SCHEDULER_cancel (kx->retry_set_key_task); - kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK; + kx->retry_set_key_task = NULL; } switch (kx->status) { @@ -1234,7 +1234,7 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx, kx->status = GNUNET_CORE_KX_STATE_UP; monitor_notify_all (kx); GSC_SESSIONS_create (&kx->peer, kx); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == kx->keep_alive_task); + GNUNET_assert (NULL == kx->keep_alive_task); update_timeout (kx); break; case GNUNET_CORE_KX_STATE_UP: @@ -1269,10 +1269,10 @@ static void send_key (struct GSC_KeyExchangeInfo *kx) { GNUNET_assert (GNUNET_CORE_KX_STATE_DOWN != kx->status); - if (GNUNET_SCHEDULER_NO_TASK != kx->retry_set_key_task) + if (NULL != kx->retry_set_key_task) { GNUNET_SCHEDULER_cancel (kx->retry_set_key_task); - kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK; + kx->retry_set_key_task = NULL; } /* always update sender status in SET KEY message */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -1402,10 +1402,10 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, gettext_noop ("# sessions terminated by key expiration"), 1, GNUNET_NO); GSC_SESSIONS_end (&kx->peer); - if (GNUNET_SCHEDULER_NO_TASK != kx->keep_alive_task) + if (NULL != kx->keep_alive_task) { GNUNET_SCHEDULER_cancel (kx->keep_alive_task); - kx->keep_alive_task = GNUNET_SCHEDULER_NO_TASK; + kx->keep_alive_task = NULL; } kx->status = GNUNET_CORE_KX_STATE_KEY_SENT; monitor_notify_all (kx); @@ -1684,10 +1684,10 @@ GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk, void GSC_KX_done () { - if (GNUNET_SCHEDULER_NO_TASK != rekey_task) + if (NULL != rekey_task) { GNUNET_SCHEDULER_cancel (rekey_task); - rekey_task = GNUNET_SCHEDULER_NO_TASK; + rekey_task = NULL; } if (NULL != my_ephemeral_key) { diff --git a/src/core/gnunet-service-core_neighbours.c b/src/core/gnunet-service-core_neighbours.c index 20055081b6..4fbe720746 100644 --- a/src/core/gnunet-service-core_neighbours.c +++ b/src/core/gnunet-service-core_neighbours.c @@ -103,7 +103,7 @@ struct Neighbour /** * ID of task used for re-trying plaintext scheduling. */ - GNUNET_SCHEDULER_TaskIdentifier retry_plaintext_task; + struct GNUNET_SCHEDULER_Task * retry_plaintext_task; /** * #GNUNET_YES if this peer currently has excess bandwidth. @@ -172,10 +172,10 @@ free_neighbour (struct Neighbour *n) GSC_KX_stop (n->kxinfo); n->kxinfo = NULL; } - if (n->retry_plaintext_task != GNUNET_SCHEDULER_NO_TASK) + if (n->retry_plaintext_task != NULL) { GNUNET_SCHEDULER_cancel (n->retry_plaintext_task); - n->retry_plaintext_task = GNUNET_SCHEDULER_NO_TASK; + n->retry_plaintext_task = NULL; } GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multipeermap_remove (neighbours, diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c index 83b1147b87..a168eeed3f 100644 --- a/src/core/gnunet-service-core_sessions.c +++ b/src/core/gnunet-service-core_sessions.c @@ -118,12 +118,12 @@ struct Session /** * Task to transmit corked messages with a delay. */ - GNUNET_SCHEDULER_TaskIdentifier cork_task; + struct GNUNET_SCHEDULER_Task * cork_task; /** * Task to transmit our type map. */ - GNUNET_SCHEDULER_TaskIdentifier typemap_task; + struct GNUNET_SCHEDULER_Task * typemap_task; /** * Retransmission delay we currently use for the typemap @@ -213,10 +213,10 @@ GSC_SESSIONS_end (const struct GNUNET_PeerIdentity *pid) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Destroying session for peer `%4s'\n", GNUNET_i2s (&session->peer)); - if (GNUNET_SCHEDULER_NO_TASK != session->cork_task) + if (NULL != session->cork_task) { GNUNET_SCHEDULER_cancel (session->cork_task); - session->cork_task = GNUNET_SCHEDULER_NO_TASK; + session->cork_task = NULL; } while (NULL != (car = session->active_client_request_head)) { @@ -231,10 +231,10 @@ GSC_SESSIONS_end (const struct GNUNET_PeerIdentity *pid) sme); GNUNET_free (sme); } - if (GNUNET_SCHEDULER_NO_TASK != session->typemap_task) + if (NULL != session->typemap_task) { GNUNET_SCHEDULER_cancel (session->typemap_task); - session->typemap_task = GNUNET_SCHEDULER_NO_TASK; + session->typemap_task = NULL; } GSC_CLIENTS_notify_clients_about_neighbour (&session->peer, session->tmap, NULL); @@ -291,7 +291,7 @@ transmit_typemap_task (void *cls, static void start_typemap_task (struct Session *session) { - if (GNUNET_SCHEDULER_NO_TASK != session->typemap_task) + if (NULL != session->typemap_task) GNUNET_SCHEDULER_cancel (session->typemap_task); session->typemap_delay = GNUNET_TIME_UNIT_SECONDS; session->typemap_task = @@ -395,10 +395,10 @@ GSC_SESSIONS_confirm_typemap (const struct GNUNET_PeerIdentity *peer, 1, GNUNET_NO); return; } - if (GNUNET_SCHEDULER_NO_TASK != session->typemap_task) + if (NULL != session->typemap_task) { GNUNET_SCHEDULER_cancel (session->typemap_task); - session->typemap_task = GNUNET_SCHEDULER_NO_TASK; + session->typemap_task = NULL; } GNUNET_STATISTICS_update (GSC_stats, gettext_noop @@ -606,7 +606,7 @@ pop_cork_task (void *cls, { struct Session *session = cls; - session->cork_task = GNUNET_SCHEDULER_NO_TASK; + session->cork_task = NULL; try_transmission (session); } @@ -720,7 +720,7 @@ try_transmission (struct Session *session) "Corking until %s\n", GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (min_deadline), GNUNET_YES)); - if (GNUNET_SCHEDULER_NO_TASK != session->cork_task) + if (NULL != session->cork_task) GNUNET_SCHEDULER_cancel (session->cork_task); session->cork_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining (min_deadline), diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index c570def84b..cc7c931761 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c @@ -48,9 +48,9 @@ static struct PeerContext p1; static struct PeerContext p2; -static GNUNET_SCHEDULER_TaskIdentifier err_task; +static struct GNUNET_SCHEDULER_Task * err_task; -static GNUNET_SCHEDULER_TaskIdentifier con_task; +static struct GNUNET_SCHEDULER_Task * con_task; static int ok; @@ -88,10 +88,10 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) p1.th = NULL; GNUNET_TRANSPORT_disconnect (p2.th); p2.th = NULL; - if (GNUNET_SCHEDULER_NO_TASK != con_task) + if (NULL != con_task) { GNUNET_SCHEDULER_cancel (con_task); - con_task = GNUNET_SCHEDULER_NO_TASK; + con_task = NULL; } ok = 0; } @@ -125,10 +125,10 @@ terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_TRANSPORT_disconnect (p2.th); p2.th = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != con_task) + if (NULL != con_task) { GNUNET_SCHEDULER_cancel (con_task); - con_task = GNUNET_SCHEDULER_NO_TASK; + con_task = NULL; } ok = 42; } @@ -162,10 +162,10 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypted connection established to peer `%4s'\n", GNUNET_i2s (peer)); - if (GNUNET_SCHEDULER_NO_TASK != con_task) + if (NULL != con_task) { GNUNET_SCHEDULER_cancel (con_task); - con_task = GNUNET_SCHEDULER_NO_TASK; + con_task = NULL; } pc->connect_status = 1; if (pc == &p1) @@ -250,7 +250,7 @@ connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { - con_task = GNUNET_SCHEDULER_NO_TASK; + con_task = NULL; return; } con_task = diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index fba153adeb..55d1978acf 100644 --- a/src/core/test_core_api_reliability.c +++ b/src/core/test_core_api_reliability.c @@ -55,9 +55,9 @@ static unsigned long long total_bytes; static struct GNUNET_TIME_Absolute start_time; -static GNUNET_SCHEDULER_TaskIdentifier err_task; +static struct GNUNET_SCHEDULER_Task * err_task; -static GNUNET_SCHEDULER_TaskIdentifier connect_task; +static struct GNUNET_SCHEDULER_Task * connect_task; struct PeerContext @@ -119,7 +119,7 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_CORE_disconnect (p2.ch); p2.ch = NULL; GNUNET_free_non_null (p2.hello); - if (connect_task != GNUNET_SCHEDULER_NO_TASK) + if (connect_task != NULL) GNUNET_SCHEDULER_cancel (connect_task); GNUNET_TRANSPORT_disconnect (p1.th); p1.th = NULL; @@ -148,7 +148,7 @@ terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_CORE_disconnect (p2.ch); p2.ch = NULL; } - if (connect_task != GNUNET_SCHEDULER_NO_TASK) + if (connect_task != NULL) GNUNET_SCHEDULER_cancel (connect_task); if (p1.th != NULL) { diff --git a/src/core/test_core_api_send_to_self.c b/src/core/test_core_api_send_to_self.c index 913ae38481..f5ed7453c7 100644 --- a/src/core/test_core_api_send_to_self.c +++ b/src/core/test_core_api_send_to_self.c @@ -38,7 +38,7 @@ static int ret; /** * Handle to the cleanup task. */ -GNUNET_SCHEDULER_TaskIdentifier die_task; +struct GNUNET_SCHEDULER_Task * die_task; /** * Identity of this peer. @@ -57,7 +57,7 @@ struct GNUNET_CORE_Handle *core; static void cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tskctx) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; if (core != NULL) { @@ -73,7 +73,7 @@ static int receive (void *cls, const struct GNUNET_PeerIdentity *other, const struct GNUNET_MessageHeader *message) { - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received message from peer %s\n", GNUNET_i2s (other)); diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c index 3c14b01eb0..8d46c176b6 100644 --- a/src/core/test_core_api_start_only.c +++ b/src/core/test_core_api_start_only.c @@ -46,7 +46,7 @@ static struct PeerContext p1; static struct PeerContext p2; -static GNUNET_SCHEDULER_TaskIdentifier timeout_task_id; +static struct GNUNET_SCHEDULER_Task * timeout_task_id; static int ok; diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index bf9197f0c1..a20a6c7d09 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c @@ -62,11 +62,11 @@ static unsigned long long total_bytes_recv; static struct GNUNET_TIME_Absolute start_time; -static GNUNET_SCHEDULER_TaskIdentifier err_task; +static struct GNUNET_SCHEDULER_Task * err_task; -static GNUNET_SCHEDULER_TaskIdentifier measure_task; +static struct GNUNET_SCHEDULER_Task * measure_task; -static GNUNET_SCHEDULER_TaskIdentifier connect_task; +static struct GNUNET_SCHEDULER_Task * connect_task; struct PeerContext @@ -118,7 +118,7 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_CORE_Handle *ch; - err_task = GNUNET_SCHEDULER_NO_TASK; + err_task = NULL; GNUNET_STATISTICS_destroy (p1.stats, GNUNET_NO); GNUNET_STATISTICS_destroy (p2.stats, GNUNET_NO); GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); @@ -128,10 +128,10 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_CORE_notify_transmit_ready_cancel (p1.nth); p1.nth = NULL; } - if (connect_task != GNUNET_SCHEDULER_NO_TASK) + if (connect_task != NULL) { GNUNET_SCHEDULER_cancel (connect_task); - connect_task = GNUNET_SCHEDULER_NO_TASK; + connect_task = NULL; } ch = p1.ch; p1.ch = NULL; @@ -151,7 +151,7 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - err_task = GNUNET_SCHEDULER_NO_TASK; + err_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Testcase failed!\n"); @@ -161,12 +161,12 @@ terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_CORE_notify_transmit_ready_cancel (p1.nth); p1.nth = NULL; } - if (measure_task != GNUNET_SCHEDULER_NO_TASK) + if (measure_task != NULL) GNUNET_SCHEDULER_cancel (measure_task); - if (connect_task != GNUNET_SCHEDULER_NO_TASK) + if (connect_task != NULL) { GNUNET_SCHEDULER_cancel (connect_task); - connect_task = GNUNET_SCHEDULER_NO_TASK; + connect_task = NULL; } GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); @@ -231,7 +231,7 @@ measurement_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) unsigned long long quota_delta; enum GNUNET_ErrorType kind = GNUNET_ERROR_TYPE_DEBUG; - measure_task = GNUNET_SCHEDULER_NO_TASK; + measure_task = NULL; FPRINTF (stdout, "%s", "\n"); running = GNUNET_NO; @@ -381,7 +381,7 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking core (1) for transmission to peer `%4s'\n", GNUNET_i2s (&p2.id)); - if (err_task != GNUNET_SCHEDULER_NO_TASK) + if (err_task != NULL) GNUNET_SCHEDULER_cancel (err_task); err_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL); @@ -410,12 +410,12 @@ disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) if (0 == memcmp (&pc->id, peer, sizeof (struct GNUNET_PeerIdentity))) return; /* loopback */ pc->connect_status = 0; - if (GNUNET_SCHEDULER_NO_TASK != measure_task) + if (NULL != measure_task) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Measurement aborted due to disconnect!\n"); GNUNET_SCHEDULER_cancel (measure_task); - measure_task = GNUNET_SCHEDULER_NO_TASK; + measure_task = NULL; } if (pc->nth != NULL) { diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index 6a994fbb04..497e654b23 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c @@ -142,7 +142,7 @@ struct GNUNET_DATASTORE_QueueEntry /** * Task for timeout signalling. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * Timeout for the current operation. @@ -216,7 +216,7 @@ struct GNUNET_DATASTORE_Handle /** * Task for trying to reconnect. */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * How quickly should we retry? Used for exponential back-off on @@ -345,10 +345,10 @@ GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, int drop) GNUNET_CLIENT_disconnect (h->client); h->client = NULL; } - if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK) + if (h->reconnect_task != NULL) { GNUNET_SCHEDULER_cancel (h->reconnect_task); - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; } while (NULL != (qe = h->queue_head)) { @@ -393,7 +393,7 @@ timeout_queue_entry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_STATISTICS_update (h->stats, gettext_noop ("# queue entry timeouts"), 1, GNUNET_NO); - qe->task = GNUNET_SCHEDULER_NO_TASK; + qe->task = NULL; GNUNET_assert (GNUNET_NO == qe->was_transmitted); LOG (GNUNET_ERROR_TYPE_DEBUG, "Timeout of request in datastore queue\n"); @@ -521,7 +521,7 @@ try_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_DATASTORE_Handle *h = cls; h->retry_time = GNUNET_TIME_STD_BACKOFF (h->retry_time); - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; h->client = GNUNET_CLIENT_connect ("datastore", h->cfg); if (h->client == NULL) { @@ -628,7 +628,7 @@ transmit_request (void *cls, size_t size, void *buf) memcpy (buf, &qe[1], msize); qe->was_transmitted = GNUNET_YES; GNUNET_SCHEDULER_cancel (qe->task); - qe->task = GNUNET_SCHEDULER_NO_TASK; + qe->task = NULL; GNUNET_assert (GNUNET_NO == h->in_receive); h->in_receive = GNUNET_YES; GNUNET_CLIENT_receive (h->client, &receive_cb, h, @@ -720,10 +720,10 @@ free_queue_entry (struct GNUNET_DATASTORE_QueueEntry *qe) struct GNUNET_DATASTORE_Handle *h = qe->h; GNUNET_CONTAINER_DLL_remove (h->queue_head, h->queue_tail, qe); - if (qe->task != GNUNET_SCHEDULER_NO_TASK) + if (qe->task != NULL) { GNUNET_SCHEDULER_cancel (qe->task); - qe->task = GNUNET_SCHEDULER_NO_TASK; + qe->task = NULL; } h->queue_size--; qe->was_transmitted = GNUNET_SYSERR; /* use-after-free warning */ diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index 0aa2273b58..ac0b5c0dbf 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c @@ -179,7 +179,7 @@ static unsigned long long payload; * Identity of the task that is used to delete * expired content. */ -static GNUNET_SCHEDULER_TaskIdentifier expired_kill_task; +static struct GNUNET_SCHEDULER_Task * expired_kill_task; /** * Minimum time that content should have to not be discarded instantly @@ -381,7 +381,7 @@ expired_processor (void *cls, static void delete_expired (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - expired_kill_task = GNUNET_SCHEDULER_NO_TASK; + expired_kill_task = NULL; plugin->api->get_expiration (plugin->api->cls, &expired_processor, NULL); } @@ -1423,10 +1423,10 @@ cleaning_task (void *cls, GNUNET_free (tcc->msg); GNUNET_free (tcc); } - if (expired_kill_task != GNUNET_SCHEDULER_NO_TASK) + if (expired_kill_task != NULL) { GNUNET_SCHEDULER_cancel (expired_kill_task); - expired_kill_task = GNUNET_SCHEDULER_NO_TASK; + expired_kill_task = NULL; } if (GNUNET_YES == do_drop) plugin->api->drop (plugin->api->cls); diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c index be699e65eb..5822702e08 100644 --- a/src/dht/dht_api.c +++ b/src/dht/dht_api.c @@ -66,7 +66,7 @@ struct PendingMessage * Continuation to call when the request has been * transmitted (for the first time) to the service; can be NULL. */ - GNUNET_SCHEDULER_Task cont; + GNUNET_SCHEDULER_TaskCallback cont; /** * Closure for 'cont'. @@ -155,7 +155,7 @@ struct GNUNET_DHT_PutHandle /** * Timeout task for this operation. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Unique ID for the PUT operation. @@ -345,7 +345,7 @@ struct GNUNET_DHT_Handle /** * Task for trying to reconnect. */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * How quickly should we retry? Used for exponential back-off on @@ -506,7 +506,7 @@ try_reconnect (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, "Reconnecting with DHT %p\n", handle); handle->retry_time = GNUNET_TIME_STD_BACKOFF (handle->retry_time); - handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + handle->reconnect_task = NULL; if (GNUNET_YES != try_connect (handle)) { LOG (GNUNET_ERROR_TYPE_DEBUG, "dht reconnect failed(!)\n"); @@ -531,7 +531,7 @@ do_disconnect (struct GNUNET_DHT_Handle *handle) if (NULL == handle->client) return; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == handle->reconnect_task); + GNUNET_assert (NULL == handle->reconnect_task); if (NULL != handle->th) GNUNET_CLIENT_notify_transmit_ready_cancel (handle->th); handle->th = NULL; @@ -1126,7 +1126,7 @@ GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle) GNUNET_CLIENT_disconnect (handle->client); handle->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != handle->reconnect_task) + if (NULL != handle->reconnect_task) GNUNET_SCHEDULER_cancel (handle->reconnect_task); GNUNET_CONTAINER_multihashmap_destroy (handle->active_requests); GNUNET_free (handle); @@ -1146,7 +1146,7 @@ timeout_put_request (void *cls, struct GNUNET_DHT_PutHandle *ph = cls; struct GNUNET_DHT_Handle *handle = ph->dht_handle; - ph->timeout_task = GNUNET_SCHEDULER_NO_TASK; + ph->timeout_task = NULL; if (NULL != ph->pending) { GNUNET_CONTAINER_DLL_remove (handle->pending_head, handle->pending_tail, @@ -1283,10 +1283,10 @@ GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph) GNUNET_free (ph->pending); ph->pending = NULL; } - if (ph->timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (ph->timeout_task != NULL) { GNUNET_SCHEDULER_cancel (ph->timeout_task); - ph->timeout_task = GNUNET_SCHEDULER_NO_TASK; + ph->timeout_task = NULL; } GNUNET_CONTAINER_DLL_remove (handle->put_head, handle->put_tail, diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c index b9058dc3b6..09e563245f 100644 --- a/src/dht/gnunet-service-dht_clients.c +++ b/src/dht/gnunet-service-dht_clients.c @@ -265,7 +265,7 @@ static struct GNUNET_CONTAINER_Heap *retry_heap; /** * Task that re-transmits requests (using retry_heap). */ -static GNUNET_SCHEDULER_TaskIdentifier retry_task; +static struct GNUNET_SCHEDULER_Task * retry_task; /** @@ -459,7 +459,7 @@ transmit_next_request_task (void *cls, struct ClientQueryRecord *cqr; struct GNUNET_TIME_Relative delay; - retry_task = GNUNET_SCHEDULER_NO_TASK; + retry_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap))) @@ -628,7 +628,7 @@ handle_dht_local_get (void *cls, struct GNUNET_SERVER_Client *client, GDS_NEIGHBOURS_get_id(), &get->key); /* start remote requests */ - if (GNUNET_SCHEDULER_NO_TASK != retry_task) + if (NULL != retry_task) GNUNET_SCHEDULER_cancel (retry_task); retry_task = GNUNET_SCHEDULER_add_now (&transmit_next_request_task, NULL); /* perform local lookup */ @@ -1496,10 +1496,10 @@ GDS_CLIENTS_done () { GNUNET_assert (client_head == NULL); GNUNET_assert (client_tail == NULL); - if (GNUNET_SCHEDULER_NO_TASK != retry_task) + if (NULL != retry_task) { GNUNET_SCHEDULER_cancel (retry_task); - retry_task = GNUNET_SCHEDULER_NO_TASK; + retry_task = NULL; } if (NULL != retry_heap) { diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 38a9c45ad4..9608405efb 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c @@ -334,7 +334,7 @@ struct PeerInfo /** * Task for scheduling preference updates */ - GNUNET_SCHEDULER_TaskIdentifier preference_task; + struct GNUNET_SCHEDULER_Task * preference_task; /** * What is the identity of the peer? @@ -422,7 +422,7 @@ static unsigned int bucket_size = DEFAULT_BUCKET_SIZE; /** * Task that sends FIND PEER requests. */ -static GNUNET_SCHEDULER_TaskIdentifier find_peer_task; +static struct GNUNET_SCHEDULER_Task * find_peer_task; /** * Identity of this peer. @@ -485,7 +485,7 @@ update_core_preference (void *cls, int bucket; struct GNUNET_HashCode phash; - peer->preference_task = GNUNET_SCHEDULER_NO_TASK; + peer->preference_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; GNUNET_CRYPTO_hash (&peer->id, @@ -586,7 +586,7 @@ send_find_peer_message (void *cls, struct BloomConstructorContext bcc; struct GNUNET_CONTAINER_BloomFilter *peer_bf; - find_peer_task = GNUNET_SCHEDULER_NO_TASK; + find_peer_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; if (newly_found_peers > bucket_size) @@ -729,10 +729,10 @@ handle_core_disconnect (void *cls, GNUNET_CONTAINER_multipeermap_remove (all_known_peers, peer, to_remove)); - if (GNUNET_SCHEDULER_NO_TASK != to_remove->preference_task) + if (NULL != to_remove->preference_task) { GNUNET_SCHEDULER_cancel (to_remove->preference_task); - to_remove->preference_task = GNUNET_SCHEDULER_NO_TASK; + to_remove->preference_task = NULL; } GNUNET_CRYPTO_hash (peer, sizeof (struct GNUNET_PeerIdentity), @@ -2240,10 +2240,10 @@ GDS_NEIGHBOURS_done () GNUNET_assert (0 == GNUNET_CONTAINER_multipeermap_size (all_known_peers)); GNUNET_CONTAINER_multipeermap_destroy (all_known_peers); all_known_peers = NULL; - if (GNUNET_SCHEDULER_NO_TASK != find_peer_task) + if (NULL != find_peer_task) { GNUNET_SCHEDULER_cancel (find_peer_task); - find_peer_task = GNUNET_SCHEDULER_NO_TASK; + find_peer_task = NULL; } } diff --git a/src/dht/gnunet-service-xdht_clients.c b/src/dht/gnunet-service-xdht_clients.c index 3ddb62be12..1c6b5d1bd8 100644 --- a/src/dht/gnunet-service-xdht_clients.c +++ b/src/dht/gnunet-service-xdht_clients.c @@ -268,7 +268,7 @@ static struct GNUNET_CONTAINER_Heap *retry_heap; /** * Task that re-transmits requests (using retry_heap). */ -static GNUNET_SCHEDULER_TaskIdentifier retry_task; +static struct GNUNET_SCHEDULER_Task * retry_task; /** @@ -875,7 +875,7 @@ transmit_next_request_task (void *cls, struct ClientQueryRecord *cqr; struct GNUNET_TIME_Relative delay; - retry_task = GNUNET_SCHEDULER_NO_TASK; + retry_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap))) @@ -1028,7 +1028,7 @@ handle_dht_local_get (void *cls, struct GNUNET_SERVER_Client *client, &my_identity, &get->key); /* start remote requests */ - if (GNUNET_SCHEDULER_NO_TASK != retry_task) + if (NULL != retry_task) GNUNET_SCHEDULER_cancel (retry_task); retry_task = GNUNET_SCHEDULER_add_now (&transmit_next_request_task, NULL); GNUNET_SERVER_receive_done (client, GNUNET_OK); @@ -1422,10 +1422,10 @@ GDS_CLIENTS_done () { GNUNET_assert (client_head == NULL); GNUNET_assert (client_tail == NULL); - if (GNUNET_SCHEDULER_NO_TASK != retry_task) + if (NULL != retry_task) { GNUNET_SCHEDULER_cancel (retry_task); - retry_task = GNUNET_SCHEDULER_NO_TASK; + retry_task = NULL; } if (NULL != retry_heap) { diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c index 8684ada0e4..00bc694241 100644 --- a/src/dht/gnunet-service-xdht_neighbours.c +++ b/src/dht/gnunet-service-xdht_neighbours.c @@ -854,25 +854,25 @@ struct VerifySuccessorContext * Task that sends FIND FINGER TRAIL requests. This task is started when we have * get our first friend. */ -static GNUNET_SCHEDULER_TaskIdentifier find_finger_trail_task; +static struct GNUNET_SCHEDULER_Task * find_finger_trail_task; /** * Task that sends verify successor message. This task is started when we get * our successor for the first time. */ -static GNUNET_SCHEDULER_TaskIdentifier send_verify_successor_task; +static struct GNUNET_SCHEDULER_Task * send_verify_successor_task; /** * Task that sends verify successor message. This task is started when we get * our successor for the first time. */ -static GNUNET_SCHEDULER_TaskIdentifier send_verify_successor_retry_task; +static struct GNUNET_SCHEDULER_Task * send_verify_successor_retry_task; /** * Task that sends verify successor message. This task is started when we get * our successor for the first time. */ -static GNUNET_SCHEDULER_TaskIdentifier send_notify_new_successor_retry_task; +static struct GNUNET_SCHEDULER_Task * send_notify_new_successor_retry_task; /** * Identity of this peer. @@ -3238,7 +3238,7 @@ send_verify_successor_message (void *cls, successor = &finger_table[0]; /* This task will be scheduled when the result for Verify Successor is received. */ - send_verify_successor_task = GNUNET_SCHEDULER_NO_TASK; + send_verify_successor_task = NULL; /* When verify successor is being called for first time *for current context* * cls will be NULL. If send_verify_successor_retry_task is not NO_TASK, we @@ -3259,7 +3259,7 @@ send_verify_successor_message (void *cls, * --> Waiting for notify confirmation. again don't wait for it. notify * confirmation will not succeded. */ - if (send_verify_successor_retry_task != GNUNET_SCHEDULER_NO_TASK) + if (send_verify_successor_retry_task != NULL) { /* FIXME: Are we scheduling retry task as soon as we send verify message. If yes then here before making this task, first check if the message @@ -3374,7 +3374,7 @@ update_current_search_finger_index (unsigned int finger_table_index) current_search_finger_index = PREDECESSOR_FINGER_ID; if (0 != GNUNET_CRYPTO_cmp_peer_identity (&my_identity, &successor->finger_identity)) { - if (GNUNET_SCHEDULER_NO_TASK == send_verify_successor_task) + if (NULL == send_verify_successor_task) { send_verify_successor_task = GNUNET_SCHEDULER_add_now (&send_verify_successor_message, NULL); @@ -5133,7 +5133,7 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ, GNUNET_STATISTICS_set (GDS_stats, key, succ, 0); GNUNET_free (key); } - if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK) + if (send_verify_successor_task == NULL) send_verify_successor_task = GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time, &send_verify_successor_message, @@ -5173,7 +5173,7 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ, successor_times--; - if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK) + if (send_verify_successor_task == NULL) send_verify_successor_task = GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time, &send_verify_successor_message, @@ -5262,7 +5262,7 @@ send_notify_new_successor (void *cls, ctx->target_friend); if (0 == ctx->num_retries_scheduled && - send_notify_new_successor_retry_task != GNUNET_SCHEDULER_NO_TASK) + send_notify_new_successor_retry_task != NULL) { // Result from previous notify successos hasn't arrived, so the retry task // hasn't been cancelled! Already a new notify successor must be called. @@ -5271,7 +5271,7 @@ send_notify_new_successor (void *cls, old_notify_ctx = GNUNET_SCHEDULER_cancel(send_notify_new_successor_retry_task); GNUNET_free (old_notify_ctx->successor_trail); GNUNET_free (old_notify_ctx); - send_notify_new_successor_retry_task = GNUNET_SCHEDULER_NO_TASK; + send_notify_new_successor_retry_task = NULL; } ctx->num_retries_scheduled++; @@ -5337,12 +5337,12 @@ handle_dht_p2p_verify_successor_result(void *cls, if(0 == (GNUNET_CRYPTO_cmp_peer_identity (&querying_peer, &my_identity))) { /* Cancel Retry Task */ - if (GNUNET_SCHEDULER_NO_TASK != send_verify_successor_retry_task) + if (NULL != send_verify_successor_retry_task) { struct VerifySuccessorContext *ctx; ctx = GNUNET_SCHEDULER_cancel(send_verify_successor_retry_task); GNUNET_free(ctx); - send_verify_successor_retry_task = GNUNET_SCHEDULER_NO_TASK; + send_verify_successor_retry_task = NULL; } compare_and_update_successor (current_successor, probable_successor, trail, trail_length); @@ -5533,15 +5533,15 @@ handle_dht_p2p_notify_succ_confirmation (void *cls, */ // TODO: cancel schedule of notify_successor_retry_task - if (send_notify_new_successor_retry_task != GNUNET_SCHEDULER_NO_TASK) + if (send_notify_new_successor_retry_task != NULL) { struct SendNotifyContext *notify_ctx; notify_ctx = GNUNET_SCHEDULER_cancel(send_notify_new_successor_retry_task); GNUNET_free (notify_ctx->successor_trail); GNUNET_free (notify_ctx); - send_notify_new_successor_retry_task = GNUNET_SCHEDULER_NO_TASK; + send_notify_new_successor_retry_task = NULL; } - if (send_verify_successor_task == GNUNET_SCHEDULER_NO_TASK) + if (send_verify_successor_task == NULL) { verify_successor_next_send_time.rel_value_us = DHT_SEND_VERIFY_SUCCESSOR_INTERVAL.rel_value_us + @@ -6063,10 +6063,10 @@ handle_core_disconnect (void *cls, if (0 != GNUNET_CONTAINER_multipeermap_size (friend_peermap)) return; - if (GNUNET_SCHEDULER_NO_TASK != find_finger_trail_task) + if (NULL != find_finger_trail_task) { GNUNET_SCHEDULER_cancel (find_finger_trail_task); - find_finger_trail_task = GNUNET_SCHEDULER_NO_TASK; + find_finger_trail_task = NULL; } else GNUNET_break (0); @@ -6109,7 +6109,7 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer_identity) * selected after some time out. This is to ensure that both peers have added * each other as their friend. */ /* Got a first connection, good time to start with FIND FINGER TRAIL requests...*/ - if (GNUNET_SCHEDULER_NO_TASK == find_finger_trail_task) + if (NULL == find_finger_trail_task) { find_finger_trail_task = GNUNET_SCHEDULER_add_now (&send_find_finger_trail_message, NULL); } @@ -6244,33 +6244,33 @@ GDS_NEIGHBOURS_done (void) GNUNET_CONTAINER_multipeermap_destroy (friend_peermap); friend_peermap = NULL; - if (GNUNET_SCHEDULER_NO_TASK != find_finger_trail_task) + if (NULL != find_finger_trail_task) { GNUNET_SCHEDULER_cancel (find_finger_trail_task); - find_finger_trail_task = GNUNET_SCHEDULER_NO_TASK; + find_finger_trail_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != send_verify_successor_task) + if (NULL != send_verify_successor_task) { GNUNET_SCHEDULER_cancel (send_verify_successor_task); - send_verify_successor_task = GNUNET_SCHEDULER_NO_TASK; + send_verify_successor_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != send_verify_successor_retry_task) + if (NULL != send_verify_successor_retry_task) { struct VerifySuccessorContext *ctx; ctx = GNUNET_SCHEDULER_cancel (send_verify_successor_retry_task); GNUNET_free(ctx); - send_verify_successor_retry_task = GNUNET_SCHEDULER_NO_TASK; + send_verify_successor_retry_task = NULL; } - if (send_notify_new_successor_retry_task != GNUNET_SCHEDULER_NO_TASK) + if (send_notify_new_successor_retry_task != NULL) { struct SendNotifyContext *notify_ctx; notify_ctx = GNUNET_SCHEDULER_cancel(send_notify_new_successor_retry_task); GNUNET_free (notify_ctx->successor_trail); GNUNET_free (notify_ctx); - send_notify_new_successor_retry_task = GNUNET_SCHEDULER_NO_TASK; + send_notify_new_successor_retry_task = NULL; } } diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c index f6223b3dde..668f61aefb 100644 --- a/src/dht/gnunet_dht_profiler.c +++ b/src/dht/gnunet_dht_profiler.c @@ -195,7 +195,7 @@ struct ActiveContext /** * Delay task */ - GNUNET_SCHEDULER_TaskIdentifier delay_task; + struct GNUNET_SCHEDULER_Task * delay_task; /** * The size of the @e put_data @@ -357,7 +357,7 @@ static int flag = 0; /** * Task to collect peer and its current successor statistics. */ -static GNUNET_SCHEDULER_TaskIdentifier successor_stats_task; +static struct GNUNET_SCHEDULER_Task * successor_stats_task; /** * Closure for successor_stats_task. @@ -441,7 +441,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) ac = a_ctx[cnt].ac; if (NULL != ac) { - if (GNUNET_SCHEDULER_NO_TASK != ac->delay_task) + if (NULL != ac->delay_task) GNUNET_SCHEDULER_cancel (ac->delay_task); if (NULL != ac->put_data) GNUNET_free (ac->put_data); @@ -554,7 +554,7 @@ cancel_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct ActiveContext *ac = cls; struct Context *ctx = ac->ctx; - ac->delay_task = GNUNET_SCHEDULER_NO_TASK; + ac->delay_task = NULL; GNUNET_assert (NULL != ac->dht_get); GNUNET_DHT_get_stop (ac->dht_get); ac->dht_get = NULL; @@ -613,9 +613,9 @@ get_iter (void *cls, get_ac->nrefs--; GNUNET_DHT_get_stop (ac->dht_get); ac->dht_get = NULL; - if (ac->delay_task != GNUNET_SCHEDULER_NO_TASK) + if (ac->delay_task != NULL) GNUNET_SCHEDULER_cancel (ac->delay_task); - ac->delay_task = GNUNET_SCHEDULER_NO_TASK; + ac->delay_task = NULL; GNUNET_assert (NULL != ctx->op); GNUNET_TESTBED_operation_done (ctx->op); ctx->op = NULL; @@ -646,7 +646,7 @@ delayed_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct ActiveContext *get_ac; unsigned int r; - ac->delay_task = GNUNET_SCHEDULER_NO_TASK; + ac->delay_task = NULL; get_ac = NULL; while (1) { @@ -735,7 +735,7 @@ delayed_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct ActiveContext *ac = cls; - ac->delay_task = GNUNET_SCHEDULER_NO_TASK; + ac->delay_task = NULL; /* Generate and DHT PUT some random data */ ac->put_data_size = 16; /* minimum */ ac->put_data_size += GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, @@ -1065,7 +1065,7 @@ successor_stats_cont (void *cls, int count; /* Don't schedule the task till we are looking for circle here. */ - successor_stats_task = GNUNET_SCHEDULER_NO_TASK; + successor_stats_task = NULL; GNUNET_TESTBED_operation_done (successor_stats_op); successor_stats_op = NULL; if (0 == max_searches) @@ -1109,7 +1109,7 @@ successor_stats_cont (void *cls, if ((start_val == val) && (count == num_peers)) { DEBUG("CIRCLE COMPLETED after %u tries", tries); - if(GNUNET_SCHEDULER_NO_TASK == successor_stats_task) + if(NULL == successor_stats_task) { start_func(); } @@ -1123,11 +1123,11 @@ successor_stats_cont (void *cls, "Maximum tries %u exceeded while checking successor TOTAL TRIES %u" " circle formation. Exiting\n", max_searches,tries); - if (GNUNET_SCHEDULER_NO_TASK != successor_stats_task) + if (NULL != successor_stats_task) { - successor_stats_task = GNUNET_SCHEDULER_NO_TASK; + successor_stats_task = NULL; } - if(GNUNET_SCHEDULER_NO_TASK == successor_stats_task) + if(NULL == successor_stats_task) { start_func(); } @@ -1255,7 +1255,7 @@ service_started (void *cls, ctx->op = NULL; peers_started++; DEBUG("Peers Started = %d; num_peers = %d \n", peers_started, num_peers); - if (GNUNET_SCHEDULER_NO_TASK == successor_stats_task && peers_started == num_peers) + if (NULL == successor_stats_task && peers_started == num_peers) { DEBUG("successor_stats_task \n"); struct Collect_Stat_Context *collect_stat_cls = GNUNET_new(struct Collect_Stat_Context); diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c index 5c69137406..e4f6e5b56d 100644 --- a/src/dht/test_dht_api.c +++ b/src/dht/test_dht_api.c @@ -59,7 +59,7 @@ struct RetryContext /** * The task identifier of the retry task, so it can be cancelled. */ - GNUNET_SCHEDULER_TaskIdentifier retry_task; + struct GNUNET_SCHEDULER_Task * retry_task; }; @@ -72,7 +72,7 @@ struct RetryContext retry_context; static int ok = 1; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; #if VERBOSE @@ -86,7 +86,7 @@ static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_DHT_disconnect (dht_handle); dht_handle = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -105,7 +105,7 @@ end_badly () GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping get request!\n"); GNUNET_DHT_get_stop (get_handle); } - if (retry_context.retry_task != GNUNET_SCHEDULER_NO_TASK) + if (retry_context.retry_task != NULL) GNUNET_SCHEDULER_cancel (retry_context.retry_task); GNUNET_DHT_disconnect (dht_handle); dht_handle = NULL; diff --git a/src/dht/test_dht_monitor.c b/src/dht/test_dht_monitor.c index 98791d28f7..6fc4498d1f 100644 --- a/src/dht/test_dht_monitor.c +++ b/src/dht/test_dht_monitor.c @@ -90,12 +90,12 @@ static unsigned int NUM_PEERS = 3; /** * Task called to disconnect peers. */ -static GNUNET_SCHEDULER_TaskIdentifier timeout_task; +static struct GNUNET_SCHEDULER_Task * timeout_task; /** * Task to do DHT_puts */ -static GNUNET_SCHEDULER_TaskIdentifier put_task; +static struct GNUNET_SCHEDULER_Task * put_task; static struct GNUNET_DHT_MonitorHandle **monitors; diff --git a/src/dht/test_dht_topo.c b/src/dht/test_dht_topo.c index 311bb5597e..9bd87b21e8 100644 --- a/src/dht/test_dht_topo.c +++ b/src/dht/test_dht_topo.c @@ -71,12 +71,12 @@ static int ok = 1; /** * Task to do DHT_puts */ -static GNUNET_SCHEDULER_TaskIdentifier put_task; +static struct GNUNET_SCHEDULER_Task * put_task; /** * Task to time out / regular shutdown. */ -static GNUNET_SCHEDULER_TaskIdentifier timeout_task; +static struct GNUNET_SCHEDULER_Task * timeout_task; /** * Head of list of active GET operations. diff --git a/src/dns/dns_api.c b/src/dns/dns_api.c index 288b421c6e..916a860f1e 100644 --- a/src/dns/dns_api.c +++ b/src/dns/dns_api.c @@ -119,7 +119,7 @@ struct GNUNET_DNS_Handle /** * Task to reconnect to the service. */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Re-connect counter, to make sure we did not reconnect in the meantime. @@ -169,7 +169,7 @@ reconnect (void *cls, struct ReplyQueueEntry *qe; struct GNUNET_DNS_Register *msg; - dh->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + dh->reconnect_task = NULL; dh->dns_connection = GNUNET_CLIENT_connect ("dns", dh->cfg); if (NULL == dh->dns_connection) return; @@ -508,10 +508,10 @@ GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *dh) { - if (GNUNET_SCHEDULER_NO_TASK != dh->reconnect_task) + if (NULL != dh->reconnect_task) { GNUNET_SCHEDULER_cancel (dh->reconnect_task); - dh->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + dh->reconnect_task = NULL; } disconnect (dh); /* make sure client has no pending requests left over! */ diff --git a/src/dns/dnsstub.c b/src/dns/dnsstub.c index 2e57a88771..6e4f7c7998 100644 --- a/src/dns/dnsstub.c +++ b/src/dns/dnsstub.c @@ -67,7 +67,7 @@ struct GNUNET_DNSSTUB_RequestSocket /** * Task for reading from dnsout4 and dnsout6. */ - GNUNET_SCHEDULER_TaskIdentifier read_task; + struct GNUNET_SCHEDULER_Task * read_task; /** * When should this request time out? @@ -125,10 +125,10 @@ cleanup_rs (struct GNUNET_DNSSTUB_RequestSocket *rs) GNUNET_NETWORK_socket_close (rs->dnsout6); rs->dnsout6 = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != rs->read_task) + if (NULL != rs->read_task) { GNUNET_SCHEDULER_cancel (rs->read_task); - rs->read_task = GNUNET_SCHEDULER_NO_TASK; + rs->read_task = NULL; } } @@ -223,10 +223,10 @@ get_request_socket (struct GNUNET_DNSSTUB_Context *ctx, default: return NULL; } - if (GNUNET_SCHEDULER_NO_TASK != rs->read_task) + if (NULL != rs->read_task) { GNUNET_SCHEDULER_cancel (rs->read_task); - rs->read_task = GNUNET_SCHEDULER_NO_TASK; + rs->read_task = NULL; } if ( (NULL == rs->dnsout4) && (NULL == rs->dnsout6) ) @@ -475,7 +475,7 @@ read_response (void *cls, struct GNUNET_DNSSTUB_RequestSocket *rs = cls; struct GNUNET_NETWORK_FDSet *rset; - rs->read_task = GNUNET_SCHEDULER_NO_TASK; + rs->read_task = NULL; if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) { /* timeout or shutdown */ diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index e0bb89ccf2..d134d88f4b 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c @@ -230,7 +230,7 @@ struct DirectNeighbor * ID of the task we use to (periodically) update our consensus * with this peer. Used if we are the initiating peer. */ - GNUNET_SCHEDULER_TaskIdentifier initiate_task; + struct GNUNET_SCHEDULER_Task * initiate_task; /** * At what offset are we, with respect to inserting our own routes @@ -386,7 +386,7 @@ static struct GNUNET_ATS_PerformanceHandle *ats; /** * Task scheduled to refresh routes based on direct neighbours. */ -static GNUNET_SCHEDULER_TaskIdentifier rr_task; +static struct GNUNET_SCHEDULER_Task * rr_task; /** * #GNUNET_YES if we are shutting down. @@ -1138,7 +1138,7 @@ static void refresh_routes_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - rr_task = GNUNET_SCHEDULER_NO_TASK; + rr_task = NULL; GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, &refresh_routes, NULL); @@ -1152,7 +1152,7 @@ refresh_routes_task (void *cls, static void schedule_refresh_routes () { - if (GNUNET_SCHEDULER_NO_TASK == rr_task) + if (NULL == rr_task) rr_task = GNUNET_SCHEDULER_add_now (&refresh_routes_task, NULL); } @@ -1288,10 +1288,10 @@ handle_direct_disconnect (struct DirectNeighbor *neighbor) GNUNET_SET_listen_cancel (neighbor->listen_handle); neighbor->listen_handle = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != neighbor->initiate_task) + if (NULL != neighbor->initiate_task) { GNUNET_SCHEDULER_cancel (neighbor->initiate_task); - neighbor->initiate_task = GNUNET_SCHEDULER_NO_TASK; + neighbor->initiate_task = NULL; } } @@ -1745,7 +1745,7 @@ initiate_set_union (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Initiating SET union with peer `%s'\n", GNUNET_i2s (&neighbor->peer)); - neighbor->initiate_task = GNUNET_SCHEDULER_NO_TASK; + neighbor->initiate_task = NULL; neighbor->my_set = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_UNION); neighbor->set_op = GNUNET_SET_prepare (&neighbor->peer, @@ -2154,10 +2154,10 @@ shutdown_task (void *cls, consensi[i].array_length, 0); } - if (GNUNET_SCHEDULER_NO_TASK != rr_task) + if (NULL != rr_task) { GNUNET_SCHEDULER_cancel (rr_task); - rr_task = GNUNET_SCHEDULER_NO_TASK; + rr_task = NULL; } } diff --git a/src/dv/test_transport_dv.c b/src/dv/test_transport_dv.c index 6a2cbde947..eec7d31711 100644 --- a/src/dv/test_transport_dv.c +++ b/src/dv/test_transport_dv.c @@ -32,14 +32,14 @@ static int ok; struct GNUNET_TESTBED_Operation *topology_op; -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - shutdown_task = GNUNET_SCHEDULER_NO_TASK; + shutdown_task = NULL; if (NULL != topology_op) { GNUNET_TESTBED_operation_done (topology_op); diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index a76f506ee7..1f8014ce22 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c @@ -422,7 +422,7 @@ static struct GNUNET_DHT_Handle *dht; /** * Task for doing DHT PUTs to advertise exit service. */ -static GNUNET_SCHEDULER_TaskIdentifier dht_task; +static struct GNUNET_SCHEDULER_Task * dht_task; /** * Advertisement message we put into the DHT to advertise us @@ -3198,10 +3198,10 @@ cleanup (void *cls, GNUNET_free (peer_key); peer_key = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != dht_task) + if (NULL != dht_task) { GNUNET_SCHEDULER_cancel (dht_task); - dht_task = GNUNET_SCHEDULER_NO_TASK; + dht_task = NULL; } if (NULL != dht_put) { @@ -3445,7 +3445,7 @@ do_dht_put (void *cls, { struct GNUNET_TIME_Absolute expiration; - dht_task = GNUNET_SCHEDULER_NO_TASK; + dht_task = NULL; expiration = GNUNET_TIME_absolute_ntoh (dns_advertisement.expiration_time); if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us < GNUNET_TIME_UNIT_HOURS.rel_value_us) diff --git a/src/fragmentation/defragmentation.c b/src/fragmentation/defragmentation.c index 478a9c6584..e3cf2298bd 100644 --- a/src/fragmentation/defragmentation.c +++ b/src/fragmentation/defragmentation.c @@ -83,7 +83,7 @@ struct MessageContext * Task scheduled for transmitting the next ACK to the * other peer. */ - GNUNET_SCHEDULER_TaskIdentifier ack_task; + struct GNUNET_SCHEDULER_Task * ack_task; /** * When did we receive which fragment? Used to calculate @@ -236,10 +236,10 @@ GNUNET_DEFRAGMENT_context_destroy (struct GNUNET_DEFRAGMENT_Context *dc) { GNUNET_CONTAINER_DLL_remove (dc->head, dc->tail, mc); dc->list_size--; - if (GNUNET_SCHEDULER_NO_TASK != mc->ack_task) + if (NULL != mc->ack_task) { GNUNET_SCHEDULER_cancel (mc->ack_task); - mc->ack_task = GNUNET_SCHEDULER_NO_TASK; + mc->ack_task = NULL; } GNUNET_free (mc); } @@ -261,7 +261,7 @@ send_ack (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_DEFRAGMENT_Context *dc = mc->dc; struct FragmentAcknowledgement fa; - mc->ack_task = GNUNET_SCHEDULER_NO_TASK; + mc->ack_task = NULL; fa.header.size = htons (sizeof (struct FragmentAcknowledgement)); fa.header.type = htons (GNUNET_MESSAGE_TYPE_FRAGMENT_ACK); fa.fragment_id = htonl (mc->fragment_id); @@ -388,10 +388,10 @@ discard_oldest_mc (struct GNUNET_DEFRAGMENT_Context *dc) GNUNET_assert (NULL != old); GNUNET_CONTAINER_DLL_remove (dc->head, dc->tail, old); dc->list_size--; - if (GNUNET_SCHEDULER_NO_TASK != old->ack_task) + if (NULL != old->ack_task) { GNUNET_SCHEDULER_cancel (old->ack_task); - old->ack_task = GNUNET_SCHEDULER_NO_TASK; + old->ack_task = NULL; } GNUNET_free (old); } @@ -550,7 +550,7 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc, linear sequence; ACK now! */ delay = GNUNET_TIME_UNIT_ZERO; } - if (GNUNET_SCHEDULER_NO_TASK != mc->ack_task) + if (NULL != mc->ack_task) GNUNET_SCHEDULER_cancel (mc->ack_task); mc->ack_task = GNUNET_SCHEDULER_add_delayed (delay, &send_ack, mc); if (duplicate == GNUNET_YES) diff --git a/src/fragmentation/fragmentation.c b/src/fragmentation/fragmentation.c index bf74918159..a72bda4ce2 100644 --- a/src/fragmentation/fragmentation.c +++ b/src/fragmentation/fragmentation.c @@ -98,7 +98,7 @@ struct GNUNET_FRAGMENT_Context /** * Task performing work for the fragmenter. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * Our fragmentation ID. (chosen at random) @@ -157,7 +157,7 @@ transmit_next (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) size_t fsize; int wrap; - fc->task = GNUNET_SCHEDULER_NO_TASK; + fc->task = NULL; GNUNET_assert (GNUNET_NO == fc->proc_busy); if (0 == fc->acks) return; /* all done */ @@ -323,7 +323,7 @@ GNUNET_FRAGMENT_context_transmission_done (struct GNUNET_FRAGMENT_Context *fc) { GNUNET_assert (fc->proc_busy == GNUNET_YES); fc->proc_busy = GNUNET_NO; - GNUNET_assert (fc->task == GNUNET_SCHEDULER_NO_TASK); + GNUNET_assert (fc->task == NULL); fc->task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining (fc->delay_until), &transmit_next, fc); @@ -415,7 +415,7 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, if (0 != fc->acks) { /* more to transmit, do so right now (if tracker permits...) */ - if (fc->task != GNUNET_SCHEDULER_NO_TASK) + if (fc->task != NULL) { /* schedule next transmission now, no point in waiting... */ GNUNET_SCHEDULER_cancel (fc->task); @@ -434,10 +434,10 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, GNUNET_STATISTICS_update (fc->stats, _("# fragmentation transmissions completed"), 1, GNUNET_NO); - if (fc->task != GNUNET_SCHEDULER_NO_TASK) + if (fc->task != NULL) { GNUNET_SCHEDULER_cancel (fc->task); - fc->task = GNUNET_SCHEDULER_NO_TASK; + fc->task = NULL; } return GNUNET_OK; } @@ -458,7 +458,7 @@ GNUNET_FRAGMENT_context_destroy (struct GNUNET_FRAGMENT_Context *fc, struct GNUNET_TIME_Relative *msg_delay, struct GNUNET_TIME_Relative *ack_delay) { - if (fc->task != GNUNET_SCHEDULER_NO_TASK) + if (fc->task != NULL) GNUNET_SCHEDULER_cancel (fc->task); if (NULL != ack_delay) *ack_delay = fc->ack_delay; diff --git a/src/fragmentation/test_fragmentation.c b/src/fragmentation/test_fragmentation.c index 5f102f4392..50779c98b9 100644 --- a/src/fragmentation/test_fragmentation.c +++ b/src/fragmentation/test_fragmentation.c @@ -60,7 +60,7 @@ static struct GNUNET_BANDWIDTH_Tracker trackers[NUM_MSGS]; static struct GNUNET_FRAGMENT_Context *frags[NUM_MSGS]; -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) @@ -68,7 +68,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) unsigned int i; ret = 0; - shutdown_task = GNUNET_SCHEDULER_NO_TASK; + shutdown_task = NULL; GNUNET_DEFRAGMENT_context_destroy (defrag); defrag = NULL; for (i = 0; i < NUM_MSGS; i++) @@ -102,7 +102,7 @@ proc_msgs (void *cls, const struct GNUNET_MessageHeader *hdr) /* tolerate 10% loss, i.e. due to duplicate fragment IDs */ if ((total >= NUM_MSGS - (NUM_MSGS / 10)) && (ret != 0)) { - if (GNUNET_SCHEDULER_NO_TASK == shutdown_task) + if (NULL == shutdown_task) shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); } } diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c index 302020d7d3..6c534ff322 100644 --- a/src/fs/fs_api.c +++ b/src/fs/fs_api.c @@ -131,7 +131,7 @@ process_job_queue (void *cls, int num_downloads_change; int block_limit_hit; - h->queue_job = GNUNET_SCHEDULER_NO_TASK; + h->queue_job = NULL; /* restart_at will be set to the time when it makes sense to re-evaluate the job queue (unless, of course, jobs complete or are added, then we'll be triggered immediately */ @@ -336,7 +336,7 @@ GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, qe->priority = priority; GNUNET_CONTAINER_DLL_insert_after (h->pending_head, h->pending_tail, h->pending_tail, qe); - if (h->queue_job != GNUNET_SCHEDULER_NO_TASK) + if (h->queue_job != NULL) GNUNET_SCHEDULER_cancel (h->queue_job); h->queue_job = GNUNET_SCHEDULER_add_now (&process_job_queue, h); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -364,7 +364,7 @@ GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qe) stop_job (qe); GNUNET_CONTAINER_DLL_remove (h->pending_head, h->pending_tail, qe); GNUNET_free (qe); - if (h->queue_job != GNUNET_SCHEDULER_NO_TASK) + if (h->queue_job != NULL) GNUNET_SCHEDULER_cancel (h->queue_job); h->queue_job = GNUNET_SCHEDULER_add_now (&process_job_queue, h); } @@ -1619,7 +1619,7 @@ deserialize_publish_file (void *cls, /* re-start publishing (if needed)... */ if (GNUNET_YES != pc->all_done) { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task); + GNUNET_assert (NULL == pc->upload_task); pc->upload_task = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, @@ -2140,7 +2140,7 @@ GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc) GNUNET_assert ((GNUNET_YES == GNUNET_FS_uri_test_ksk (sc->uri)) || (GNUNET_YES == GNUNET_FS_uri_test_sks (sc->uri))); uris = GNUNET_FS_uri_to_string (sc->uri); - in_pause = (sc->task != GNUNET_SCHEDULER_NO_TASK) ? 'r' : '\0'; + in_pause = (sc->task != NULL) ? 'r' : '\0'; if ((GNUNET_OK != GNUNET_BIO_write_string (wh, uris)) || (GNUNET_OK != write_start_time (wh, sc->start_time)) || (GNUNET_OK != GNUNET_BIO_write_string (wh, sc->emsg)) || @@ -3130,7 +3130,7 @@ GNUNET_FS_stop (struct GNUNET_FS_Handle *h) { while (h->top_head != NULL) h->top_head->ssf (h->top_head->ssf_cls); - if (h->queue_job != GNUNET_SCHEDULER_NO_TASK) + if (h->queue_job != NULL) GNUNET_SCHEDULER_cancel (h->queue_job); GNUNET_free (h->client_name); GNUNET_free (h); diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h index 157662a65b..5fbdef6c24 100644 --- a/src/fs/fs_api.h +++ b/src/fs/fs_api.h @@ -601,7 +601,7 @@ struct GNUNET_FS_SearchResult * complete on time (and that will need to be cancelled if we clean * up the search result before then). */ - GNUNET_SCHEDULER_TaskIdentifier probe_cancel_task; + struct GNUNET_SCHEDULER_Task * probe_cancel_task; /** * When did the current probe become active? @@ -1170,13 +1170,13 @@ struct GNUNET_FS_Handle * Task that processes the jobs in the running and pending queues * (and moves jobs around as needed). */ - GNUNET_SCHEDULER_TaskIdentifier queue_job; + struct GNUNET_SCHEDULER_Task * queue_job; /** * Task we use to report periodically to the application that * certain search probes (from @e probes_head) are still running. */ - GNUNET_SCHEDULER_TaskIdentifier probe_ping_task; + struct GNUNET_SCHEDULER_Task * probe_ping_task; /** * Average time we take for a single request to be satisfied. @@ -1300,7 +1300,7 @@ struct GNUNET_FS_PublishContext * ID of the task performing the upload. NO_TASK if the upload has * completed. */ - GNUNET_SCHEDULER_TaskIdentifier upload_task; + struct GNUNET_SCHEDULER_Task * upload_task; /** * Storage space to reserve for the operation. @@ -1629,10 +1629,10 @@ struct GNUNET_FS_SearchContext /** * ID of a task that is using this struct and that must be cancelled * when the search is being stopped (if not - * #GNUNET_SCHEDULER_NO_TASK). Used for the task that adds some + * #NULL). Used for the task that adds some * artificial delay when trying to reconnect to the FS service. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * How many of the entries in the search request @@ -1961,12 +1961,12 @@ struct GNUNET_FS_DownloadContext /** * ID of a task that is using this struct and that must be cancelled * when the download is being stopped (if not - * #GNUNET_SCHEDULER_NO_TASK). Used for the task that adds some + * #NULL). Used for the task that adds some * artificial delay when trying to reconnect to the FS service or * the task processing incrementally the data on disk, or the * task requesting blocks, etc. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * What is the first offset that we're interested diff --git a/src/fs/fs_dirmetascan.c b/src/fs/fs_dirmetascan.c index 83e436b168..2477aab4b9 100644 --- a/src/fs/fs_dirmetascan.c +++ b/src/fs/fs_dirmetascan.c @@ -80,7 +80,7 @@ struct GNUNET_FS_DirScanner /** * Task scheduled when we are done. */ - GNUNET_SCHEDULER_TaskIdentifier stop_task; + struct GNUNET_SCHEDULER_Task * stop_task; /** * Arguments for helper. @@ -106,7 +106,7 @@ GNUNET_FS_directory_scan_abort (struct GNUNET_FS_DirScanner *ds) /* free resources */ if (NULL != ds->toplevel) GNUNET_FS_share_tree_free (ds->toplevel); - if (GNUNET_SCHEDULER_NO_TASK != ds->stop_task) + if (NULL != ds->stop_task) GNUNET_SCHEDULER_cancel (ds->stop_task); GNUNET_free_non_null (ds->ex_arg); GNUNET_free (ds->filename_expanded); @@ -230,7 +230,7 @@ finish_scan (void *cls, { struct GNUNET_FS_DirScanner *ds = cls; - ds->stop_task = GNUNET_SCHEDULER_NO_TASK; + ds->stop_task = NULL; if (NULL != ds->helper) { GNUNET_HELPER_stop (ds->helper, GNUNET_NO); @@ -427,7 +427,7 @@ helper_died_cb (void *cls) struct GNUNET_FS_DirScanner *ds = cls; ds->helper = NULL; - if (GNUNET_SCHEDULER_NO_TASK != ds->stop_task) + if (NULL != ds->stop_task) return; /* normal death, was finished */ ds->progress_callback (ds->progress_callback_cls, NULL, GNUNET_SYSERR, diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 348a0bc173..3a6072d8ba 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c @@ -393,10 +393,10 @@ check_completed (struct GNUNET_FS_DownloadContext *dc) GNUNET_FS_dequeue_ (dc->job_queue); dc->job_queue = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != dc->task) + if (NULL != dc->task) { GNUNET_SCHEDULER_cancel (dc->task); - dc->task = GNUNET_SCHEDULER_NO_TASK; + dc->task = NULL; } if (NULL != dc->rfh) { @@ -1380,7 +1380,7 @@ do_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_FS_DownloadContext *dc = cls; struct GNUNET_CLIENT_Connection *client; - dc->task = GNUNET_SCHEDULER_NO_TASK; + dc->task = NULL; client = GNUNET_CLIENT_connect ("fs", dc->h->cfg); if (NULL == client) { @@ -1633,10 +1633,10 @@ reconstruct_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_FS_DownloadContext *dc = cls; /* clean up state from tree encoder */ - if (dc->task != GNUNET_SCHEDULER_NO_TASK) + if (dc->task != NULL) { GNUNET_SCHEDULER_cancel (dc->task); - dc->task = GNUNET_SCHEDULER_NO_TASK; + dc->task = NULL; } if (NULL != dc->rfh) { @@ -1662,7 +1662,7 @@ get_next_block (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_FS_DownloadContext *dc = cls; - dc->task = GNUNET_SCHEDULER_NO_TASK; + dc->task = NULL; GNUNET_FS_tree_encoder_next (dc->te); } @@ -1866,7 +1866,7 @@ GNUNET_FS_download_start_task_ (void *cls, struct GNUNET_DISK_FileHandle *fh; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Start task running...\n"); - dc->task = GNUNET_SCHEDULER_NO_TASK; + dc->task = NULL; if (0 == dc->length) { /* no bytes required! */ @@ -2028,10 +2028,10 @@ GNUNET_FS_download_signal_suspend_ (void *cls) if (NULL != dc->parent) GNUNET_CONTAINER_DLL_remove (dc->parent->child_head, dc->parent->child_tail, dc); - if (GNUNET_SCHEDULER_NO_TASK != dc->task) + if (NULL != dc->task) { GNUNET_SCHEDULER_cancel (dc->task); - dc->task = GNUNET_SCHEDULER_NO_TASK; + dc->task = NULL; } pi.status = GNUNET_FS_STATUS_DOWNLOAD_SUSPEND; GNUNET_FS_download_make_status_ (&pi, dc); @@ -2336,10 +2336,10 @@ GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, int do_delete) if (NULL != dc->top) GNUNET_FS_end_top (dc->h, dc->top); - if (GNUNET_SCHEDULER_NO_TASK != dc->task) + if (NULL != dc->task) { GNUNET_SCHEDULER_cancel (dc->task); - dc->task = GNUNET_SCHEDULER_NO_TASK; + dc->task = NULL; } search_was_null = (NULL == dc->search); if (NULL != dc->search) diff --git a/src/fs/fs_list_indexed.c b/src/fs/fs_list_indexed.c index 7a891155e3..8c25587452 100644 --- a/src/fs/fs_list_indexed.c +++ b/src/fs/fs_list_indexed.c @@ -59,7 +59,7 @@ struct GNUNET_FS_GetIndexedContext /** * Continuation to trigger at the end. */ - GNUNET_SCHEDULER_Task cont; + GNUNET_SCHEDULER_TaskCallback cont; /** * Closure for cont. diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index a8a9a220f1..175e453c64 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c @@ -97,7 +97,7 @@ publish_cleanup (struct GNUNET_FS_PublishContext *pc) GNUNET_CLIENT_disconnect (pc->client); pc->client = NULL; } - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task); + GNUNET_assert (NULL == pc->upload_task); GNUNET_free (pc); } @@ -138,7 +138,7 @@ ds_put_cont (void *cls, int success, GNUNET_FS_unindex_start (pc->h, pc->fi_pos->filename, NULL); } } - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task); + GNUNET_assert (NULL == pc->upload_task); pc->upload_task = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, &GNUNET_FS_publish_main_, pc); @@ -316,7 +316,7 @@ publish_kblocks_cont (void *cls, signal_publish_error (p, pc, emsg); GNUNET_FS_file_information_sync_ (p); GNUNET_FS_publish_sync_ (pc); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task); + GNUNET_assert (NULL == pc->upload_task); pc->upload_task = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, @@ -334,7 +334,7 @@ publish_kblocks_cont (void *cls, else pc->fi_pos = p->dir; GNUNET_FS_publish_sync_ (pc); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task); + GNUNET_assert (NULL == pc->upload_task); pc->upload_task = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, &GNUNET_FS_publish_main_, pc); @@ -449,7 +449,7 @@ encode_cont (void *cls, p->client_info = GNUNET_FS_publish_make_status_ (&pi, pc, p, flen); } /* continue with main */ /* continue with main */ - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task); + GNUNET_assert (NULL == pc->upload_task); pc->upload_task = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, &GNUNET_FS_publish_main_, pc); @@ -487,7 +487,7 @@ block_proc (void *cls, if (NULL == pc->dsh) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Waiting for datastore connection\n"); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task); + GNUNET_assert (NULL == pc->upload_task); pc->upload_task = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, &GNUNET_FS_publish_main_, pc); @@ -947,7 +947,7 @@ GNUNET_FS_publish_main_ (void *cls, struct GNUNET_FS_FileInformation *p; char *fn; - pc->upload_task = GNUNET_SCHEDULER_NO_TASK; + pc->upload_task = NULL; p = pc->fi_pos; if (NULL == p) { @@ -1234,10 +1234,10 @@ GNUNET_FS_publish_signal_suspend_ (void *cls) { struct GNUNET_FS_PublishContext *pc = cls; - if (GNUNET_SCHEDULER_NO_TASK != pc->upload_task) + if (NULL != pc->upload_task) { GNUNET_SCHEDULER_cancel (pc->upload_task); - pc->upload_task = GNUNET_SCHEDULER_NO_TASK; + pc->upload_task = NULL; } pc->skip_next_fi_callback = GNUNET_YES; GNUNET_FS_file_information_inspect (pc->fi, &fip_signal_suspend, pc); @@ -1275,7 +1275,7 @@ finish_reserve (void *cls, int success, return; } pc->rid = success; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task); + GNUNET_assert (NULL == pc->upload_task); pc->upload_task = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, &GNUNET_FS_publish_main_, pc); @@ -1373,7 +1373,7 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, } else { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == ret->upload_task); + GNUNET_assert (NULL == ret->upload_task); ret->upload_task = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, &GNUNET_FS_publish_main_, ret); @@ -1462,10 +1462,10 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc) GNUNET_FS_publish_sks_cancel (pc->sks_pc); pc->sks_pc = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != pc->upload_task) + if (NULL != pc->upload_task) { GNUNET_SCHEDULER_cancel (pc->upload_task); - pc->upload_task = GNUNET_SCHEDULER_NO_TASK; + pc->upload_task = NULL; } pc->skip_next_fi_callback = GNUNET_YES; GNUNET_FS_file_information_inspect (pc->fi, &fip_signal_stop, pc); diff --git a/src/fs/fs_publish_ksk.c b/src/fs/fs_publish_ksk.c index 67157f408b..436bac6334 100644 --- a/src/fs/fs_publish_ksk.c +++ b/src/fs/fs_publish_ksk.c @@ -74,7 +74,7 @@ struct GNUNET_FS_PublishKskContext /** * Current task. */ - GNUNET_SCHEDULER_TaskIdentifier ksk_task; + struct GNUNET_SCHEDULER_Task * ksk_task; /** * Function to call once we're done. @@ -156,7 +156,7 @@ publish_ksk_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_FS_PublishKskContext *pkc = cls; const char *keyword; - pkc->ksk_task = GNUNET_SCHEDULER_NO_TASK; + pkc->ksk_task = NULL; if ( (pkc->i == pkc->ksk_uri->data.ksk.keywordCount) || (NULL == pkc->dsh) ) { @@ -236,10 +236,10 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, void GNUNET_FS_publish_ksk_cancel (struct GNUNET_FS_PublishKskContext *pkc) { - if (GNUNET_SCHEDULER_NO_TASK != pkc->ksk_task) + if (NULL != pkc->ksk_task) { GNUNET_SCHEDULER_cancel (pkc->ksk_task); - pkc->ksk_task = GNUNET_SCHEDULER_NO_TASK; + pkc->ksk_task = NULL; } if (NULL != pkc->uc) { diff --git a/src/fs/fs_publish_ublock.c b/src/fs/fs_publish_ublock.c index 4399b8c8ec..1cba7a4fcc 100644 --- a/src/fs/fs_publish_ublock.c +++ b/src/fs/fs_publish_ublock.c @@ -112,7 +112,7 @@ struct GNUNET_FS_PublishUblockContext /** * Task to run continuation asynchronously. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; }; @@ -155,7 +155,7 @@ run_cont (void *cls, { struct GNUNET_FS_PublishUblockContext *uc = cls; - uc->task = GNUNET_SCHEDULER_NO_TASK; + uc->task = NULL; uc->cont (uc->cont_cls, NULL); GNUNET_free (uc); } @@ -316,7 +316,7 @@ GNUNET_FS_publish_ublock_cancel_ (struct GNUNET_FS_PublishUblockContext *uc) { if (NULL != uc->qre) GNUNET_DATASTORE_cancel (uc->qre); - if (GNUNET_SCHEDULER_NO_TASK != uc->task) + if (NULL != uc->task) GNUNET_SCHEDULER_cancel (uc->task); GNUNET_free (uc); } diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index c85d6d3df6..8f640009a6 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c @@ -223,7 +223,7 @@ probe_failure_handler (void *cls, { struct GNUNET_FS_SearchResult *sr = cls; - sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; + sr->probe_cancel_task = NULL; sr->availability_trials++; GNUNET_FS_download_stop (sr->probe_ctx, GNUNET_YES); sr->probe_ctx = NULL; @@ -249,7 +249,7 @@ probe_success_handler (void *cls, { struct GNUNET_FS_SearchResult *sr = cls; - sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; + sr->probe_cancel_task = NULL; sr->availability_trials++; sr->availability_success++; GNUNET_FS_download_stop (sr->probe_ctx, GNUNET_YES); @@ -303,34 +303,34 @@ GNUNET_FS_search_probe_progress_ (void *cls, /* ignore */ break; case GNUNET_FS_STATUS_DOWNLOAD_ERROR: - if (GNUNET_SCHEDULER_NO_TASK != sr->probe_cancel_task) + if (NULL != sr->probe_cancel_task) { GNUNET_SCHEDULER_cancel (sr->probe_cancel_task); - sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; + sr->probe_cancel_task = NULL; } sr->probe_cancel_task = GNUNET_SCHEDULER_add_delayed (sr->remaining_probe_time, &probe_failure_handler, sr); break; case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: - if (GNUNET_SCHEDULER_NO_TASK != sr->probe_cancel_task) + if (NULL != sr->probe_cancel_task) { GNUNET_SCHEDULER_cancel (sr->probe_cancel_task); - sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; + sr->probe_cancel_task = NULL; } sr->probe_cancel_task = GNUNET_SCHEDULER_add_now (&probe_success_handler, sr); break; case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: - if (GNUNET_SCHEDULER_NO_TASK != sr->probe_cancel_task) + if (NULL != sr->probe_cancel_task) { GNUNET_SCHEDULER_cancel (sr->probe_cancel_task); - sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; + sr->probe_cancel_task = NULL; } sr = NULL; break; case GNUNET_FS_STATUS_DOWNLOAD_ACTIVE: - if (GNUNET_SCHEDULER_NO_TASK == sr->probe_cancel_task) + if (NULL == sr->probe_cancel_task) { sr->probe_active_time = GNUNET_TIME_absolute_get (); sr->probe_cancel_task = @@ -339,10 +339,10 @@ GNUNET_FS_search_probe_progress_ (void *cls, } break; case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE: - if (GNUNET_SCHEDULER_NO_TASK != sr->probe_cancel_task) + if (NULL != sr->probe_cancel_task) { GNUNET_SCHEDULER_cancel (sr->probe_cancel_task); - sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; + sr->probe_cancel_task = NULL; } dur = GNUNET_TIME_absolute_get_duration (sr->probe_active_time); sr->remaining_probe_time = @@ -396,7 +396,7 @@ start_probe_ping_task (struct GNUNET_FS_SearchResult *sr) GNUNET_CONTAINER_DLL_insert (h->probes_head, h->probes_tail, sr); - if (GNUNET_SCHEDULER_NO_TASK == h->probe_ping_task) + if (NULL == h->probe_ping_task) h->probe_ping_task = GNUNET_SCHEDULER_add_now (&probe_ping_task_cb, h); @@ -419,7 +419,7 @@ GNUNET_FS_stop_probe_ping_task_ (struct GNUNET_FS_SearchResult *sr) if (NULL == h->probes_head) { GNUNET_SCHEDULER_cancel (h->probe_ping_task); - h->probe_ping_task = GNUNET_SCHEDULER_NO_TASK; + h->probe_ping_task = NULL; } } @@ -520,10 +520,10 @@ GNUNET_FS_search_stop_probe_ (struct GNUNET_FS_SearchResult *sr) sr->probe_ctx = NULL; GNUNET_FS_stop_probe_ping_task_ (sr); } - if (GNUNET_SCHEDULER_NO_TASK != sr->probe_cancel_task) + if (NULL != sr->probe_cancel_task) { GNUNET_SCHEDULER_cancel (sr->probe_cancel_task); - sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; + sr->probe_cancel_task = NULL; } } @@ -1253,7 +1253,7 @@ do_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_FS_SearchContext *sc = cls; struct GNUNET_CLIENT_Connection *client; - sc->task = GNUNET_SCHEDULER_NO_TASK; + sc->task = NULL; client = GNUNET_CLIENT_connect ("fs", sc->h->cfg); if (NULL == client) { @@ -1446,10 +1446,10 @@ search_result_freeze_probes (void *cls, sr->probe_ctx = NULL; GNUNET_FS_stop_probe_ping_task_ (sr); } - if (GNUNET_SCHEDULER_NO_TASK != sr->probe_cancel_task) + if (NULL != sr->probe_cancel_task) { GNUNET_SCHEDULER_cancel (sr->probe_cancel_task); - sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; + sr->probe_cancel_task = NULL; } if (NULL != sr->update_search) GNUNET_FS_search_pause (sr->update_search); @@ -1545,10 +1545,10 @@ GNUNET_FS_search_signal_suspend_ (void *cls) pi.status = GNUNET_FS_STATUS_SEARCH_SUSPEND; sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc->h, sc); GNUNET_break (NULL == sc->client_info); - if (sc->task != GNUNET_SCHEDULER_NO_TASK) + if (sc->task != NULL) { GNUNET_SCHEDULER_cancel (sc->task); - sc->task = GNUNET_SCHEDULER_NO_TASK; + sc->task = NULL; } if (NULL != sc->client) { @@ -1609,10 +1609,10 @@ GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc) { struct GNUNET_FS_ProgressInfo pi; - if (GNUNET_SCHEDULER_NO_TASK != sc->task) + if (NULL != sc->task) { GNUNET_SCHEDULER_cancel (sc->task); - sc->task = GNUNET_SCHEDULER_NO_TASK; + sc->task = NULL; } if (NULL != sc->client) GNUNET_CLIENT_disconnect (sc->client); @@ -1636,7 +1636,7 @@ GNUNET_FS_search_continue (struct GNUNET_FS_SearchContext *sc) struct GNUNET_FS_ProgressInfo pi; GNUNET_assert (NULL == sc->client); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == sc->task); + GNUNET_assert (NULL == sc->task); do_reconnect (sc, NULL); GNUNET_FS_search_sync_ (sc); pi.status = GNUNET_FS_STATUS_SEARCH_CONTINUED; @@ -1721,7 +1721,7 @@ search_result_free (void *cls, GNUNET_assert (NULL == sr->update_search); } GNUNET_break (NULL == sr->probe_ctx); - GNUNET_break (GNUNET_SCHEDULER_NO_TASK == sr->probe_cancel_task); + GNUNET_break (NULL == sr->probe_cancel_task); GNUNET_break (NULL == sr->client_info); GNUNET_free_non_null (sr->serialization); GNUNET_FS_uri_destroy (sr->uri); @@ -1766,7 +1766,7 @@ GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc) pi.status = GNUNET_FS_STATUS_SEARCH_STOPPED; sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc->h, sc); GNUNET_break (NULL == sc->client_info); - if (GNUNET_SCHEDULER_NO_TASK != sc->task) + if (NULL != sc->task) GNUNET_SCHEDULER_cancel (sc->task); if (NULL != sc->client) GNUNET_CLIENT_disconnect (sc->client); diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c index 1e098bd60e..589f979d63 100644 --- a/src/fs/fs_test_lib.c +++ b/src/fs/fs_test_lib.c @@ -63,7 +63,7 @@ struct TestPublishOperation /** * Task to abort publishing (timeout). */ - GNUNET_SCHEDULER_TaskIdentifier publish_timeout_task; + struct GNUNET_SCHEDULER_Task * publish_timeout_task; /** * Seed for file generation. @@ -131,7 +131,7 @@ struct TestDownloadOperation /** * Function to call when download is done. */ - GNUNET_SCHEDULER_Task download_cont; + GNUNET_SCHEDULER_TaskCallback download_cont; /** * Closure for download_cont. @@ -146,7 +146,7 @@ struct TestDownloadOperation /** * Task to abort downloading (timeout). */ - GNUNET_SCHEDULER_TaskIdentifier download_timeout_task; + struct GNUNET_SCHEDULER_Task * download_timeout_task; /** * Context for current download operation. @@ -215,7 +215,7 @@ publish_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct TestPublishOperation *po = cls; - po->publish_timeout_task = GNUNET_SCHEDULER_NO_TASK; + po->publish_timeout_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout while trying to publish data\n"); GNUNET_TESTBED_operation_done (po->fs_op); @@ -242,7 +242,7 @@ publish_progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) { case GNUNET_FS_STATUS_PUBLISH_COMPLETED: GNUNET_SCHEDULER_cancel (po->publish_timeout_task); - po->publish_timeout_task = GNUNET_SCHEDULER_NO_TASK; + po->publish_timeout_task = NULL; po->publish_uri = GNUNET_FS_uri_dup (info->value.publish.specifics.completed.chk_uri); GNUNET_SCHEDULER_add_continuation (&report_uri, po, @@ -489,7 +489,7 @@ download_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout while trying to download file\n"); - dop->download_timeout_task = GNUNET_SCHEDULER_NO_TASK; + dop->download_timeout_task = NULL; GNUNET_FS_download_stop (dop->download_context, GNUNET_YES); GNUNET_SCHEDULER_add_continuation (dop->download_cont, dop->download_cont_cls, @@ -543,7 +543,7 @@ download_progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) break; case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: GNUNET_SCHEDULER_cancel (dop->download_timeout_task); - dop->download_timeout_task = GNUNET_SCHEDULER_NO_TASK; + dop->download_timeout_task = NULL; GNUNET_SCHEDULER_add_continuation (&report_success, dop, GNUNET_SCHEDULER_REASON_PREREQ_DONE); break; @@ -627,7 +627,7 @@ GNUNET_FS_TEST_download (struct GNUNET_TESTBED_Peer *peer, struct GNUNET_TIME_Relative timeout, uint32_t anonymity, uint32_t seed, const struct GNUNET_FS_Uri *uri, unsigned int verbose, - GNUNET_SCHEDULER_Task cont, void *cont_cls) + GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls) { struct TestDownloadOperation *dop; diff --git a/src/fs/fs_test_lib.h b/src/fs/fs_test_lib.h index 679e0745c2..112ff38930 100644 --- a/src/fs/fs_test_lib.h +++ b/src/fs/fs_test_lib.h @@ -89,7 +89,7 @@ GNUNET_FS_TEST_download (struct GNUNET_TESTBED_Peer *peer, struct GNUNET_TIME_Relative timeout, uint32_t anonymity, uint32_t seed, const struct GNUNET_FS_Uri *uri, unsigned int verbose, - GNUNET_SCHEDULER_Task cont, void *cont_cls); + GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls); diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index 5dc39e4e61..715ecddb15 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c @@ -63,7 +63,7 @@ struct GNUNET_FS_TreeEncoder /** * Function to call once we're done with processing. */ - GNUNET_SCHEDULER_Task cont; + GNUNET_SCHEDULER_TaskCallback cont; /** * Set to an error message (if we had an error). @@ -272,7 +272,7 @@ GNUNET_FS_tree_encoder_create (struct GNUNET_FS_Handle *h, uint64_t size, GNUNET_FS_DataReader reader, GNUNET_FS_TreeBlockProcessor proc, GNUNET_FS_TreeProgressCallback progress, - GNUNET_SCHEDULER_Task cont) + GNUNET_SCHEDULER_TaskCallback cont) { struct GNUNET_FS_TreeEncoder *te; diff --git a/src/fs/fs_tree.h b/src/fs/fs_tree.h index cd25a6dd14..2aef80b858 100644 --- a/src/fs/fs_tree.h +++ b/src/fs/fs_tree.h @@ -142,7 +142,7 @@ GNUNET_FS_tree_encoder_create (struct GNUNET_FS_Handle *h, uint64_t size, void *cls, GNUNET_FS_DataReader reader, GNUNET_FS_TreeBlockProcessor proc, GNUNET_FS_TreeProgressCallback progress, - GNUNET_SCHEDULER_Task cont); + GNUNET_SCHEDULER_TaskCallback cont); /** diff --git a/src/fs/gnunet-auto-share.c b/src/fs/gnunet-auto-share.c index 32725f66f0..c3b19b9edb 100644 --- a/src/fs/gnunet-auto-share.c +++ b/src/fs/gnunet-auto-share.c @@ -97,12 +97,12 @@ static int do_disable_creation_time; /** * Handle for the 'shutdown' task. */ -static GNUNET_SCHEDULER_TaskIdentifier kill_task; +static struct GNUNET_SCHEDULER_Task * kill_task; /** * Handle for the main task that does scanning and working. */ -static GNUNET_SCHEDULER_TaskIdentifier run_task; +static struct GNUNET_SCHEDULER_Task * run_task; /** * Anonymity level option to use for publishing. @@ -322,17 +322,17 @@ save_state () static void do_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - kill_task = GNUNET_SCHEDULER_NO_TASK; + kill_task = NULL; do_shutdown = GNUNET_YES; if (NULL != publish_proc) { GNUNET_OS_process_kill (publish_proc, SIGKILL); return; } - if (GNUNET_SCHEDULER_NO_TASK != run_task) + if (NULL != run_task) { GNUNET_SCHEDULER_cancel (run_task); - run_task = GNUNET_SCHEDULER_NO_TASK; + run_task = NULL; } } @@ -363,7 +363,7 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) const struct GNUNET_DISK_FileHandle *pr; - run_task = GNUNET_SCHEDULER_NO_TASK; + run_task = NULL; pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) { @@ -457,7 +457,7 @@ work (void *cls, const struct GNUNET_DISK_FileHandle *pr; int argc; - run_task = GNUNET_SCHEDULER_NO_TASK; + run_task = NULL; wi = work_head; GNUNET_CONTAINER_DLL_remove (work_head, work_tail, @@ -629,7 +629,7 @@ add_file (void *cls, static void scan (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - run_task = GNUNET_SCHEDULER_NO_TASK; + run_task = NULL; start_time = GNUNET_TIME_absolute_get (); (void) GNUNET_DISK_directory_scan (dir_name, &add_file, diff --git a/src/fs/gnunet-daemon-fsprofiler.c b/src/fs/gnunet-daemon-fsprofiler.c index 1549972a1c..9c4f28351c 100644 --- a/src/fs/gnunet-daemon-fsprofiler.c +++ b/src/fs/gnunet-daemon-fsprofiler.c @@ -69,12 +69,12 @@ struct Pattern /** * Task to run the operation. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * Secondary task to run the operation. */ - GNUNET_SCHEDULER_TaskIdentifier stask; + struct GNUNET_SCHEDULER_Task * stask; /** * X-value. @@ -276,7 +276,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) while (NULL != (p = publish_head)) { - if (GNUNET_SCHEDULER_NO_TASK != p->task) + if (NULL != p->task) GNUNET_SCHEDULER_cancel (p->task); if (NULL != p->ctx) GNUNET_FS_publish_stop (p->ctx); @@ -285,9 +285,9 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } while (NULL != (p = download_head)) { - if (GNUNET_SCHEDULER_NO_TASK != p->task) + if (NULL != p->task) GNUNET_SCHEDULER_cancel (p->task); - if (GNUNET_SCHEDULER_NO_TASK != p->stask) + if (NULL != p->stask) GNUNET_SCHEDULER_cancel (p->stask); if (NULL != p->ctx) GNUNET_FS_download_stop (p->ctx, GNUNET_YES); @@ -320,7 +320,7 @@ publish_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct Pattern *p = cls; - p->task = GNUNET_SCHEDULER_NO_TASK; + p->task = NULL; GNUNET_FS_publish_stop (p->ctx); } @@ -336,7 +336,7 @@ download_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct Pattern *p = cls; - p->task = GNUNET_SCHEDULER_NO_TASK; + p->task = NULL; GNUNET_FS_download_stop (p->ctx, GNUNET_YES); } @@ -352,7 +352,7 @@ search_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct Pattern *p = cls; - p->stask = GNUNET_SCHEDULER_NO_TASK; + p->stask = NULL; GNUNET_FS_search_stop (p->sctx); } @@ -507,7 +507,7 @@ start_publish (void *cls, struct Pattern *p = cls; struct GNUNET_FS_FileInformation *fi; - p->task = GNUNET_SCHEDULER_NO_TASK; + p->task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; fi = make_file (p->x, p->y, p); @@ -532,7 +532,7 @@ start_download (void *cls, struct Pattern *p = cls; struct GNUNET_FS_Uri *keywords; - p->task = GNUNET_SCHEDULER_NO_TASK; + p->task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; keywords = make_keywords (p->x); diff --git a/src/fs/gnunet-fs-profiler.c b/src/fs/gnunet-fs-profiler.c index 56a3084cc4..ba081f7cf6 100644 --- a/src/fs/gnunet-fs-profiler.c +++ b/src/fs/gnunet-fs-profiler.c @@ -50,7 +50,7 @@ static struct GNUNET_TIME_Relative timeout; /** * Handle to the task run during termination. */ -static GNUNET_SCHEDULER_TaskIdentifier terminate_taskid; +static struct GNUNET_SCHEDULER_Task * terminate_taskid; /** @@ -115,7 +115,7 @@ static void terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - terminate_taskid = GNUNET_SCHEDULER_NO_TASK; + terminate_taskid = NULL; GNUNET_TESTBED_get_statistics (0, NULL, NULL, NULL, &process_stats, diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index ceed3109fd..2ec50b14d3 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c @@ -127,7 +127,7 @@ static int do_disable_creation_time; /** * Task run on CTRL-C to kill everything nicely. */ -static GNUNET_SCHEDULER_TaskIdentifier kill_task; +static struct GNUNET_SCHEDULER_Task * kill_task; /** * Handle to the directory scanner (for recursive insertions). @@ -159,7 +159,7 @@ do_stop_task (void *cls, { struct GNUNET_FS_PublishContext *p; - kill_task = GNUNET_SCHEDULER_NO_TASK; + kill_task = NULL; if (NULL != identity) { GNUNET_IDENTITY_disconnect (identity); @@ -188,7 +188,7 @@ do_stop_task (void *cls, static void stop_scanner_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - kill_task = GNUNET_SCHEDULER_NO_TASK; + kill_task = NULL; if (NULL != ds) { GNUNET_FS_directory_scan_abort (ds); @@ -256,10 +256,10 @@ progress_cb (void *cls, case GNUNET_FS_STATUS_PUBLISH_ERROR: FPRINTF (stderr, _("Error publishing: %s.\n"), info->value.publish.specifics.error.message); - if (kill_task != GNUNET_SCHEDULER_NO_TASK) + if (kill_task != NULL) { GNUNET_SCHEDULER_cancel (kill_task); - kill_task = GNUNET_SCHEDULER_NO_TASK; + kill_task = NULL; } kill_task = GNUNET_SCHEDULER_add_now (&do_stop_task, NULL); break; @@ -284,7 +284,7 @@ progress_cb (void *cls, } if (NULL == info->value.publish.pctx) { - if (GNUNET_SCHEDULER_NO_TASK != kill_task) + if (NULL != kill_task) GNUNET_SCHEDULER_cancel (kill_task); kill_task = GNUNET_SCHEDULER_add_now (&do_stop_task, NULL); } @@ -669,10 +669,10 @@ directory_scan_cb (void *cls, FPRINTF (stdout, "%s", _("Internal error scanning directory.\n")); - if (kill_task != GNUNET_SCHEDULER_NO_TASK) + if (kill_task != NULL) { GNUNET_SCHEDULER_cancel (kill_task); - kill_task = GNUNET_SCHEDULER_NO_TASK; + kill_task = NULL; } kill_task = GNUNET_SCHEDULER_add_now (&stop_scanner_task, NULL); break; diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 7c8833ce82..4d33626c21 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -167,7 +167,7 @@ static struct GNUNET_CRYPTO_EddsaPrivateKey *pk; /** * ID of our task that we use to age the cover counters. */ -static GNUNET_SCHEDULER_TaskIdentifier cover_age_task; +static struct GNUNET_SCHEDULER_Task * cover_age_task; /** * Datastore 'GET' load tracking. @@ -569,10 +569,10 @@ shutdown_task (void *cls, block_cfg = NULL; GNUNET_STATISTICS_destroy (GSF_stats, GNUNET_NO); GSF_stats = NULL; - if (GNUNET_SCHEDULER_NO_TASK != cover_age_task) + if (NULL != cover_age_task) { GNUNET_SCHEDULER_cancel (cover_age_task); - cover_age_task = GNUNET_SCHEDULER_NO_TASK; + cover_age_task = NULL; } GNUNET_FS_indexing_done (); GNUNET_LOAD_value_free (datastore_get_load); diff --git a/src/fs/gnunet-service-fs_cadet_client.c b/src/fs/gnunet-service-fs_cadet_client.c index f0905e6c3f..88014f2042 100644 --- a/src/fs/gnunet-service-fs_cadet_client.c +++ b/src/fs/gnunet-service-fs_cadet_client.c @@ -140,14 +140,14 @@ struct CadetHandle * a few seconds to give the application a chance to give * us another query). */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Task to reset cadets that had errors (asynchronously, * as we may not be able to do it immediately during a * callback from the cadet API). */ - GNUNET_SCHEDULER_TaskIdentifier reset_task; + struct GNUNET_SCHEDULER_Task * reset_task; }; @@ -258,7 +258,7 @@ cadet_timeout (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Timeout on cadet channel to %s\n", GNUNET_i2s (&mh->target)); - mh->timeout_task = GNUNET_SCHEDULER_NO_TASK; + mh->timeout_task = NULL; tun = mh->channel; mh->channel = NULL; if(NULL != tun) @@ -278,7 +278,7 @@ reset_cadet_task (void *cls, { struct CadetHandle *mh = cls; - mh->reset_task = GNUNET_SCHEDULER_NO_TASK; + mh->reset_task = NULL; reset_cadet (mh); } @@ -292,7 +292,7 @@ reset_cadet_task (void *cls, static void reset_cadet_async (struct CadetHandle *mh) { - if (GNUNET_SCHEDULER_NO_TASK != mh->reset_task) + if (NULL != mh->reset_task) GNUNET_SCHEDULER_cancel (mh->reset_task); mh->reset_task = GNUNET_SCHEDULER_add_now (&reset_cadet_task, mh); @@ -527,10 +527,10 @@ get_cadet (const struct GNUNET_PeerIdentity *target) target); if (NULL != mh) { - if (GNUNET_SCHEDULER_NO_TASK != mh->timeout_task) + if (NULL != mh->timeout_task) { GNUNET_SCHEDULER_cancel (mh->timeout_task); - mh->timeout_task = GNUNET_SCHEDULER_NO_TASK; + mh->timeout_task = NULL; } return mh; } @@ -698,9 +698,9 @@ cleaner_cb (void *cls, mh); if (NULL != mh->wh) GNUNET_CADET_notify_transmit_ready_cancel (mh->wh); - if (GNUNET_SCHEDULER_NO_TASK != mh->timeout_task) + if (NULL != mh->timeout_task) GNUNET_SCHEDULER_cancel (mh->timeout_task); - if (GNUNET_SCHEDULER_NO_TASK != mh->reset_task) + if (NULL != mh->reset_task) GNUNET_SCHEDULER_cancel (mh->reset_task); GNUNET_assert (0 == GNUNET_CONTAINER_multihashmap_size (mh->waiting_map)); diff --git a/src/fs/gnunet-service-fs_cadet_server.c b/src/fs/gnunet-service-fs_cadet_server.c index 6ce18afb55..74251e4b79 100644 --- a/src/fs/gnunet-service-fs_cadet_server.c +++ b/src/fs/gnunet-service-fs_cadet_server.c @@ -108,12 +108,12 @@ struct CadetClient /** * Task that is scheduled to asynchronously terminate the connection. */ - GNUNET_SCHEDULER_TaskIdentifier terminate_task; + struct GNUNET_SCHEDULER_Task * terminate_task; /** * Task that is scheduled to terminate idle connections. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Size of the last write that was initiated. @@ -163,7 +163,7 @@ timeout_cadet_task (void *cls, struct CadetClient *sc = cls; struct GNUNET_CADET_Channel *tun; - sc->timeout_task = GNUNET_SCHEDULER_NO_TASK; + sc->timeout_task = NULL; tun = sc->channel; sc->channel = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -181,7 +181,7 @@ timeout_cadet_task (void *cls, static void refresh_timeout_task (struct CadetClient *sc) { - if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task) + if (NULL != sc->timeout_task) GNUNET_SCHEDULER_cancel (sc->timeout_task); sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT, &timeout_cadet_task, @@ -530,9 +530,9 @@ cleaner_cb (void *cls, GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# cadet connections active"), -1, GNUNET_NO); - if (GNUNET_SCHEDULER_NO_TASK != sc->terminate_task) + if (NULL != sc->terminate_task) GNUNET_SCHEDULER_cancel (sc->terminate_task); - if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task) + if (NULL != sc->timeout_task) GNUNET_SCHEDULER_cancel (sc->timeout_task); if (NULL != sc->wh) GNUNET_CADET_notify_transmit_ready_cancel (sc->wh); diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index 030d8b6432..8c956c2749 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c @@ -86,7 +86,7 @@ struct GSF_PeerTransmitHandle /** * Task called on timeout, or 0 for none. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Function to call to get the actual message. @@ -155,7 +155,7 @@ struct GSF_DelayedHandle /** * Task for the delay. */ - GNUNET_SCHEDULER_TaskIdentifier delay_task; + struct GNUNET_SCHEDULER_Task * delay_task; /** * Size of the message. @@ -184,7 +184,7 @@ struct PeerRequest /** * Task for asynchronous stopping of this request. */ - GNUNET_SCHEDULER_TaskIdentifier kill_task; + struct GNUNET_SCHEDULER_Task * kill_task; }; @@ -209,7 +209,7 @@ struct GSF_ConnectedPeer /** * Task scheduled to revive migration to this peer. */ - GNUNET_SCHEDULER_TaskIdentifier mig_revive_task; + struct GNUNET_SCHEDULER_Task * mig_revive_task; /** * Messages (replies, queries, content migration) we would like to @@ -248,7 +248,7 @@ struct GSF_ConnectedPeer /** * Task scheduled if we need to retry bandwidth reservation later. */ - GNUNET_SCHEDULER_TaskIdentifier rc_delay_task; + struct GNUNET_SCHEDULER_Task * rc_delay_task; /** * Active requests from this neighbour, map of query to 'struct PeerRequest'. @@ -472,10 +472,10 @@ peer_transmit_ready_cb (void *cls, size_t size, void *buf) schedule_transmission (pth); return 0; } - if (GNUNET_SCHEDULER_NO_TASK != pth->timeout_task) + if (NULL != pth->timeout_task) { GNUNET_SCHEDULER_cancel (pth->timeout_task); - pth->timeout_task = GNUNET_SCHEDULER_NO_TASK; + pth->timeout_task = NULL; } GNUNET_CONTAINER_DLL_remove (cp->pth_head, cp->pth_tail, pth); if (GNUNET_YES == pth->is_query) @@ -516,7 +516,7 @@ retry_reservation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_PeerIdentity target; GNUNET_PEER_resolve (cp->ppd.pid, &target); - cp->rc_delay_task = GNUNET_SCHEDULER_NO_TASK; + cp->rc_delay_task = NULL; cp->rc = GNUNET_ATS_reserve_bandwidth (GSF_ats, &target, DBLOCK_SIZE, &ats_reserve_callback, cp); @@ -652,7 +652,7 @@ revive_migration (void *cls, struct GSF_ConnectedPeer *cp = cls; struct GNUNET_TIME_Relative bt; - cp->mig_revive_task = GNUNET_SCHEDULER_NO_TASK; + cp->mig_revive_task = NULL; bt = GNUNET_TIME_absolute_get_remaining (cp->ppd.migration_blocked_until); if (0 != bt.rel_value_us) { @@ -715,7 +715,7 @@ GSF_handle_p2p_migration_stop_ (void *cls, GNUNET_i2s (other), GNUNET_STRINGS_relative_time_to_string (bt, GNUNET_YES)); cp->ppd.migration_blocked_until = GNUNET_TIME_relative_to_absolute (bt); - if (GNUNET_SCHEDULER_NO_TASK == cp->mig_revive_task) + if (NULL == cp->mig_revive_task) { GSF_push_stop_ (cp); cp->mig_revive_task = @@ -773,10 +773,10 @@ free_pending_request (struct PeerRequest *peerreq, { struct GSF_ConnectedPeer *cp = peerreq->cp; - if (GNUNET_SCHEDULER_NO_TASK != peerreq->kill_task) + if (NULL != peerreq->kill_task) { GNUNET_SCHEDULER_cancel (peerreq->kill_task); - peerreq->kill_task = GNUNET_SCHEDULER_NO_TASK; + peerreq->kill_task = NULL; } GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# P2P searches active"), -1, GNUNET_NO); @@ -825,7 +825,7 @@ peer_request_destroy (void *cls, struct GSF_PendingRequest *pr = peerreq->pr; struct GSF_PendingRequestData *prd; - peerreq->kill_task = GNUNET_SCHEDULER_NO_TASK; + peerreq->kill_task = NULL; prd = GSF_pending_request_get_data_ (pr); cancel_pending_request (NULL, &prd->query, peerreq); } @@ -987,7 +987,7 @@ handle_p2p_reply (void *cls, } if (GNUNET_BLOCK_EVALUATION_OK_LAST != eval) return; - if (GNUNET_SCHEDULER_NO_TASK == peerreq->kill_task) + if (NULL == peerreq->kill_task) { GNUNET_STATISTICS_update (GSF_stats, gettext_noop @@ -1356,7 +1356,7 @@ peer_transmit_timeout (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Timeout trying to transmit to other peer\n"); - pth->timeout_task = GNUNET_SCHEDULER_NO_TASK; + pth->timeout_task = NULL; cp = pth->cp; GNUNET_CONTAINER_DLL_remove (cp->pth_head, cp->pth_tail, pth); if (GNUNET_YES == pth->is_query) @@ -1440,10 +1440,10 @@ GSF_peer_transmit_cancel_ (struct GSF_PeerTransmitHandle *pth) { struct GSF_ConnectedPeer *cp; - if (GNUNET_SCHEDULER_NO_TASK != pth->timeout_task) + if (NULL != pth->timeout_task) { GNUNET_SCHEDULER_cancel (pth->timeout_task); - pth->timeout_task = GNUNET_SCHEDULER_NO_TASK; + pth->timeout_task = NULL; } cp = pth->cp; GNUNET_CONTAINER_DLL_remove (cp->pth_head, cp->pth_tail, pth); @@ -1586,10 +1586,10 @@ GSF_peer_disconnect_handler_ (void *cls, GNUNET_ATS_reserve_bandwidth_cancel (cp->rc); cp->rc = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != cp->rc_delay_task) + if (NULL != cp->rc_delay_task) { GNUNET_SCHEDULER_cancel (cp->rc_delay_task); - cp->rc_delay_task = GNUNET_SCHEDULER_NO_TASK; + cp->rc_delay_task = NULL; } GNUNET_CONTAINER_multihashmap_iterate (cp->request_map, &cancel_pending_request, cp); @@ -1608,10 +1608,10 @@ GSF_peer_disconnect_handler_ (void *cls, GNUNET_assert (0 == cp->cth_in_progress); while (NULL != (pth = cp->pth_head)) { - if (pth->timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (pth->timeout_task != NULL) { GNUNET_SCHEDULER_cancel (pth->timeout_task); - pth->timeout_task = GNUNET_SCHEDULER_NO_TASK; + pth->timeout_task = NULL; } GNUNET_CONTAINER_DLL_remove (cp->pth_head, cp->pth_tail, pth); pth->gmc (pth->gmc_cls, 0, NULL); @@ -1625,10 +1625,10 @@ GSF_peer_disconnect_handler_ (void *cls, GNUNET_free (dh); } GNUNET_PEER_change_rc (cp->ppd.pid, -1); - if (GNUNET_SCHEDULER_NO_TASK != cp->mig_revive_task) + if (NULL != cp->mig_revive_task) { GNUNET_SCHEDULER_cancel (cp->mig_revive_task); - cp->mig_revive_task = GNUNET_SCHEDULER_NO_TASK; + cp->mig_revive_task = NULL; } GNUNET_free (cp); } diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c index 6d3b761bed..0bb5e3f389 100644 --- a/src/fs/gnunet-service-fs_lc.c +++ b/src/fs/gnunet-service-fs_lc.c @@ -59,7 +59,7 @@ struct ClientRequest /** * Task scheduled to destroy the request. */ - GNUNET_SCHEDULER_TaskIdentifier kill_task; + struct GNUNET_SCHEDULER_Task * kill_task; }; @@ -193,7 +193,7 @@ client_request_destroy (void *cls, struct ClientRequest *cr = cls; struct GSF_LocalClient *lc; - cr->kill_task = GNUNET_SCHEDULER_NO_TASK; + cr->kill_task = NULL; lc = cr->lc; GNUNET_CONTAINER_DLL_remove (lc->cr_head, lc->cr_tail, cr); GSF_pending_request_cancel_ (cr->pr, GNUNET_YES); @@ -242,7 +242,7 @@ client_response_handler (void *cls, if (NULL == data) { /* local-only request, with no result, clean up. */ - if (GNUNET_SCHEDULER_NO_TASK == cr->kill_task) + if (NULL == cr->kill_task) cr->kill_task = GNUNET_SCHEDULER_add_now (&client_request_destroy, cr); return; @@ -285,7 +285,7 @@ client_response_handler (void *cls, (int) eval); return; } - if (GNUNET_SCHEDULER_NO_TASK == cr->kill_task) + if (NULL == cr->kill_task) cr->kill_task = GNUNET_SCHEDULER_add_now (&client_request_destroy, cr); } @@ -497,7 +497,7 @@ GSF_client_disconnect_handler_ (void *cls, return; while (NULL != (cr = pos->cr_head)) { - if (GNUNET_SCHEDULER_NO_TASK != cr->kill_task) + if (NULL != cr->kill_task) GNUNET_SCHEDULER_cancel (cr->kill_task); client_request_destroy (cr, NULL); } diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c index 07b6b4d652..6b793a1e09 100644 --- a/src/fs/gnunet-service-fs_pe.c +++ b/src/fs/gnunet-service-fs_pe.c @@ -196,7 +196,7 @@ struct PeerPlan /** * Current task for executing the plan. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; }; @@ -337,7 +337,7 @@ plan (struct PeerPlan *pp, struct GSF_RequestPlan *rp) GNUNET_CONTAINER_multihashmap_contains_value (pp->plan_map, get_rp_key (rp), rp)); - if (GNUNET_SCHEDULER_NO_TASK != pp->task) + if (NULL != pp->task) GNUNET_SCHEDULER_cancel (pp->task); pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp); #undef N @@ -391,7 +391,7 @@ transmit_message_callback (void *cls, size_t buf_size, void *buf) if (NULL == buf) { /* failed, try again... */ - if (GNUNET_SCHEDULER_NO_TASK != pp->task) + if (NULL != pp->task) GNUNET_SCHEDULER_cancel (pp->task); pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp); @@ -404,7 +404,7 @@ transmit_message_callback (void *cls, size_t buf_size, void *buf) rp = GNUNET_CONTAINER_heap_peek (pp->priority_heap); if (NULL == rp) { - if (GNUNET_SCHEDULER_NO_TASK != pp->task) + if (NULL != pp->task) GNUNET_SCHEDULER_cancel (pp->task); pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp); return 0; @@ -412,7 +412,7 @@ transmit_message_callback (void *cls, size_t buf_size, void *buf) msize = GSF_pending_request_get_message_ (get_latest (rp), buf_size, buf); if (msize > buf_size) { - if (GNUNET_SCHEDULER_NO_TASK != pp->task) + if (NULL != pp->task) GNUNET_SCHEDULER_cancel (pp->task); /* buffer to small (message changed), try again */ pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp); @@ -451,7 +451,7 @@ schedule_peer_transmission (void *cls, size_t msize; struct GNUNET_TIME_Relative delay; - pp->task = GNUNET_SCHEDULER_NO_TASK; + pp->task = NULL; if (NULL != pp->pth) { GSF_peer_transmit_cancel_ (pp->pth); @@ -661,10 +661,10 @@ GSF_plan_notify_peer_disconnect_ (const struct GSF_ConnectedPeer *cp) GSF_peer_transmit_cancel_ (pp->pth); pp->pth = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != pp->task) + if (NULL != pp->task) { GNUNET_SCHEDULER_cancel (pp->task); - pp->task = GNUNET_SCHEDULER_NO_TASK; + pp->task = NULL; } while (NULL != (rp = GNUNET_CONTAINER_heap_remove_root (pp->priority_heap))) { diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index f809efd6ce..5dc03393a3 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c @@ -157,7 +157,7 @@ struct GSF_PendingRequest /** * Task that warns us if the local datastore lookup takes too long. */ - GNUNET_SCHEDULER_TaskIdentifier warn_task; + struct GNUNET_SCHEDULER_Task * warn_task; /** * Current offset for querying our local datastore for results. @@ -632,10 +632,10 @@ clean_request (void *cls, const struct GNUNET_HashCode *key, void *value) GNUNET_DHT_get_stop (pr->gh); pr->gh = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != pr->warn_task) + if (NULL != pr->warn_task) { GNUNET_SCHEDULER_cancel (pr->warn_task); - pr->warn_task = GNUNET_SCHEDULER_NO_TASK; + pr->warn_task = NULL; } GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_remove (pr_map, @@ -690,10 +690,10 @@ GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr, int full_cleanup) GNUNET_DHT_get_stop (pr->gh); pr->gh = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != pr->warn_task) + if (NULL != pr->warn_task) { GNUNET_SCHEDULER_cancel (pr->warn_task); - pr->warn_task = GNUNET_SCHEDULER_NO_TASK; + pr->warn_task = NULL; } return; } @@ -1307,7 +1307,7 @@ process_local_reply (void *cls, const struct GNUNET_HashCode * key, size_t size, unsigned int old_rf; GNUNET_SCHEDULER_cancel (pr->warn_task); - pr->warn_task = GNUNET_SCHEDULER_NO_TASK; + pr->warn_task = NULL; if (NULL != pr->qe) { pr->qe = NULL; @@ -1514,10 +1514,10 @@ process_local_reply (void *cls, const struct GNUNET_HashCode * key, size_t size, check_error_and_continue: if (NULL != pr->qe) return; - if (GNUNET_SCHEDULER_NO_TASK != pr->warn_task) + if (NULL != pr->warn_task) { GNUNET_SCHEDULER_cancel (pr->warn_task); - pr->warn_task = GNUNET_SCHEDULER_NO_TASK; + pr->warn_task = NULL; } if (NULL == (cont = pr->llc_cont)) return; /* no continuation */ @@ -1620,7 +1620,7 @@ GSF_local_lookup_ (struct GSF_PendingRequest *pr, ("# Datastore lookups concluded (error queueing)"), 1, GNUNET_NO); GNUNET_SCHEDULER_cancel (pr->warn_task); - pr->warn_task = GNUNET_SCHEDULER_NO_TASK; + pr->warn_task = NULL; pr->llc_cont = NULL; if (NULL != cont) cont (cont_cls, pr, pr->local_result); diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c index f099f7fdce..88c92828f5 100644 --- a/src/fs/gnunet-service-fs_push.c +++ b/src/fs/gnunet-service-fs_push.c @@ -163,7 +163,7 @@ static struct GNUNET_DATASTORE_QueueEntry *mig_qe; /** * ID of task that collects blocks for migration. */ -static GNUNET_SCHEDULER_TaskIdentifier mig_task; +static struct GNUNET_SCHEDULER_Task * mig_task; /** * What is the maximum frequency at which we are allowed to @@ -452,7 +452,7 @@ consider_gathering () return; if (NULL != mig_qe) return; - if (GNUNET_SCHEDULER_NO_TASK != mig_task) + if (NULL != mig_task) return; if (mig_size >= MAX_MIGRATION_QUEUE) return; @@ -575,7 +575,7 @@ static void gather_migration_blocks (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - mig_task = GNUNET_SCHEDULER_NO_TASK; + mig_task = NULL; if (mig_size >= MAX_MIGRATION_QUEUE) return; if (NULL == GSF_dsh) @@ -682,10 +682,10 @@ GSF_push_init_ () void GSF_push_done_ () { - if (GNUNET_SCHEDULER_NO_TASK != mig_task) + if (NULL != mig_task) { GNUNET_SCHEDULER_cancel (mig_task); - mig_task = GNUNET_SCHEDULER_NO_TASK; + mig_task = NULL; } if (NULL != mig_qe) { diff --git a/src/fs/gnunet-service-fs_put.c b/src/fs/gnunet-service-fs_put.c index 8e9d70f72c..9eef491daa 100644 --- a/src/fs/gnunet-service-fs_put.c +++ b/src/fs/gnunet-service-fs_put.c @@ -63,7 +63,7 @@ struct PutOperator /** * ID of task that collects blocks for DHT PUTs. */ - GNUNET_SCHEDULER_TaskIdentifier dht_task; + struct GNUNET_SCHEDULER_Task * dht_task; /** * How many entires with zero anonymity of our type do we currently @@ -158,7 +158,7 @@ delay_dht_put_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct PutOperator *po = cls; - po->dht_task = GNUNET_SCHEDULER_NO_TASK; + po->dht_task = NULL; schedule_next_put (po); } @@ -219,7 +219,7 @@ gather_dht_put_blocks (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct PutOperator *po = cls; - po->dht_task = GNUNET_SCHEDULER_NO_TASK; + po->dht_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; po->dht_qe = @@ -263,10 +263,10 @@ GSF_put_done_ () i = 0; while ((po = &operators[i])->dht_put_type != GNUNET_BLOCK_TYPE_ANY) { - if (GNUNET_SCHEDULER_NO_TASK != po->dht_task) + if (NULL != po->dht_task) { GNUNET_SCHEDULER_cancel (po->dht_task); - po->dht_task = GNUNET_SCHEDULER_NO_TASK; + po->dht_task = NULL; } if (NULL != po->dht_put) { diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c index 8dee249126..94e7e0733d 100644 --- a/src/fs/test_fs_download.c +++ b/src/fs/test_fs_download.c @@ -57,7 +57,7 @@ static struct GNUNET_FS_DownloadContext *download; static struct GNUNET_FS_PublishContext *publish; -static GNUNET_SCHEDULER_TaskIdentifier timeout_kill; +static struct GNUNET_SCHEDULER_Task * timeout_kill; static char *fn; @@ -80,7 +80,7 @@ timeout_kill_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) publish = NULL; } GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout downloading file\n"); - timeout_kill = GNUNET_SCHEDULER_NO_TASK; + timeout_kill = NULL; err = 1; } @@ -120,7 +120,7 @@ abort_download_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_free (fn); fn = NULL; GNUNET_SCHEDULER_cancel (timeout_kill); - timeout_kill = GNUNET_SCHEDULER_NO_TASK; + timeout_kill = NULL; } diff --git a/src/fs/test_fs_download_persistence.c b/src/fs/test_fs_download_persistence.c index a9b9980139..7e1f01ae71 100644 --- a/src/fs/test_fs_download_persistence.c +++ b/src/fs/test_fs_download_persistence.c @@ -54,7 +54,7 @@ static struct GNUNET_FS_DownloadContext *download; static struct GNUNET_FS_PublishContext *publish; -static GNUNET_SCHEDULER_TaskIdentifier timeout_kill; +static struct GNUNET_SCHEDULER_Task * timeout_kill; static char *fn; @@ -75,7 +75,7 @@ timeout_kill_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_FS_publish_stop (publish); publish = NULL; } - timeout_kill = GNUNET_SCHEDULER_NO_TASK; + timeout_kill = NULL; err = 1; } @@ -107,7 +107,7 @@ abort_download_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_free (fn); fn = NULL; GNUNET_SCHEDULER_cancel (timeout_kill); - timeout_kill = GNUNET_SCHEDULER_NO_TASK; + timeout_kill = NULL; } diff --git a/src/fs/test_fs_namespace.c b/src/fs/test_fs_namespace.c index c780081222..461bfdcdd6 100644 --- a/src/fs/test_fs_namespace.c +++ b/src/fs/test_fs_namespace.c @@ -41,7 +41,7 @@ static struct GNUNET_FS_SearchContext *sks_search; static struct GNUNET_FS_SearchContext *ksk_search; -static GNUNET_SCHEDULER_TaskIdentifier kill_task; +static struct GNUNET_SCHEDULER_Task * kill_task; static int update_started; @@ -58,7 +58,7 @@ abort_ksk_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (sks_search == NULL) { GNUNET_FS_stop (fs); - if (GNUNET_SCHEDULER_NO_TASK != kill_task) + if (NULL != kill_task) GNUNET_SCHEDULER_cancel (kill_task); } } @@ -75,7 +75,7 @@ abort_sks_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (ksk_search == NULL) { GNUNET_FS_stop (fs); - if (GNUNET_SCHEDULER_NO_TASK != kill_task) + if (NULL != kill_task) GNUNET_SCHEDULER_cancel (kill_task); } } @@ -86,7 +86,7 @@ do_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { err = 1; FPRINTF (stderr, "%s", "Operation timed out\n"); - kill_task = GNUNET_SCHEDULER_NO_TASK; + kill_task = NULL; abort_sks_search_task (NULL, tc); abort_ksk_search_task (NULL, tc); } diff --git a/src/fs/test_fs_publish_persistence.c b/src/fs/test_fs_publish_persistence.c index 8e5e5f53bf..3c8b6e34e9 100644 --- a/src/fs/test_fs_publish_persistence.c +++ b/src/fs/test_fs_publish_persistence.c @@ -60,7 +60,7 @@ static char *fn2; static int err; -static GNUNET_SCHEDULER_TaskIdentifier rtask; +static struct GNUNET_SCHEDULER_Task * rtask; static void @@ -76,10 +76,10 @@ abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) fn2 = NULL; GNUNET_FS_stop (fs); fs = NULL; - if (GNUNET_SCHEDULER_NO_TASK != rtask) + if (NULL != rtask) { GNUNET_SCHEDULER_cancel (rtask); - rtask = GNUNET_SCHEDULER_NO_TASK; + rtask = NULL; } } @@ -91,7 +91,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event); static void restart_fs_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - rtask = GNUNET_SCHEDULER_NO_TASK; + rtask = NULL; GNUNET_FS_stop (fs); fs = GNUNET_FS_start (cfg, "test-fs-publish-persistence", &progress_cb, NULL, diff --git a/src/fs/test_fs_search.c b/src/fs/test_fs_search.c index f525fb474a..caf2898b28 100644 --- a/src/fs/test_fs_search.c +++ b/src/fs/test_fs_search.c @@ -52,7 +52,7 @@ static struct GNUNET_FS_SearchContext *search; static struct GNUNET_FS_PublishContext *publish; -static GNUNET_SCHEDULER_TaskIdentifier timeout_task; +static struct GNUNET_SCHEDULER_Task * timeout_task; static int err; @@ -65,10 +65,10 @@ abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_FS_publish_stop (publish); publish = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != timeout_task) + if (NULL != timeout_task) { GNUNET_SCHEDULER_cancel (timeout_task); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; } } @@ -78,7 +78,7 @@ abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { fprintf (stderr, "Timeout\n"); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; if (NULL != search) { GNUNET_FS_search_stop (search); diff --git a/src/fs/test_fs_search_persistence.c b/src/fs/test_fs_search_persistence.c index 34ea04acad..780f21d994 100644 --- a/src/fs/test_fs_search_persistence.c +++ b/src/fs/test_fs_search_persistence.c @@ -54,7 +54,7 @@ static struct GNUNET_FS_PublishContext *publish; static const struct GNUNET_CONFIGURATION_Handle *cfg; -static GNUNET_SCHEDULER_TaskIdentifier timeout_task; +static struct GNUNET_SCHEDULER_Task * timeout_task; static int err; @@ -62,7 +62,7 @@ static int err; static void abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; fprintf (stderr, "Timeout\n"); if (NULL != search) @@ -86,10 +86,10 @@ abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_FS_publish_stop (publish); publish = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != timeout_task) + if (NULL != timeout_task) { GNUNET_SCHEDULER_cancel (timeout_task); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; } } diff --git a/src/fs/test_fs_search_probes.c b/src/fs/test_fs_search_probes.c index beae34763c..c7abd073f1 100644 --- a/src/fs/test_fs_search_probes.c +++ b/src/fs/test_fs_search_probes.c @@ -53,7 +53,7 @@ static struct GNUNET_FS_SearchContext *search; static struct GNUNET_FS_PublishContext *publish; -static GNUNET_SCHEDULER_TaskIdentifier timeout_task; +static struct GNUNET_SCHEDULER_Task * timeout_task; static int err; @@ -61,7 +61,7 @@ static int err; static void abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; fprintf (stderr, "Timeout\n"); if (NULL != search) @@ -86,10 +86,10 @@ abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_FS_publish_stop (publish); publish = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != timeout_task) + if (NULL != timeout_task) { GNUNET_SCHEDULER_cancel (timeout_task); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; } } diff --git a/src/fs/test_fs_search_with_and.c b/src/fs/test_fs_search_with_and.c index 80cd03213a..cca0e342e2 100644 --- a/src/fs/test_fs_search_with_and.c +++ b/src/fs/test_fs_search_with_and.c @@ -58,7 +58,7 @@ static struct GNUNET_FS_SearchContext *search; static struct GNUNET_FS_PublishContext *publish; -static GNUNET_SCHEDULER_TaskIdentifier timeout_task; +static struct GNUNET_SCHEDULER_Task * timeout_task; static int err; @@ -73,10 +73,10 @@ abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_FS_publish_stop (publish); publish = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != timeout_task) + if (NULL != timeout_task) { GNUNET_SCHEDULER_cancel (timeout_task); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; } } @@ -86,7 +86,7 @@ abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { fprintf (stderr, "Timeout\n"); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; if (NULL != search) { GNUNET_FS_search_stop (search); diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index 9f7f28b718..327f89976c 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c @@ -154,7 +154,7 @@ struct GNUNET_GNS_Handle /** * Reconnect task */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * How long do we wait until we try to reconnect? @@ -210,7 +210,7 @@ reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_GNS_Handle *handle = cls; - handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + handle->reconnect_task = NULL; reconnect (handle); } @@ -484,10 +484,10 @@ GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle) GNUNET_CLIENT_disconnect (handle->client); handle->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != handle->reconnect_task) + if (NULL != handle->reconnect_task) { GNUNET_SCHEDULER_cancel (handle->reconnect_task); - handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + handle->reconnect_task = NULL; } GNUNET_assert (NULL == handle->lookup_head); GNUNET_free (handle); diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c index 4e018c12d6..200591f412 100644 --- a/src/gns/gnunet-bcd.c +++ b/src/gns/gnunet-bcd.c @@ -51,7 +51,7 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; /** * Our primary task for the HTTPD. */ -static GNUNET_SCHEDULER_TaskIdentifier http_task; +static struct GNUNET_SCHEDULER_Task * http_task; /** * Our main website. @@ -278,7 +278,7 @@ access_handler_callback (void *cls, struct MHD_Connection *connection, * Function that queries MHD's select sets and * starts the task waiting for them. */ -static GNUNET_SCHEDULER_TaskIdentifier +static struct GNUNET_SCHEDULER_Task * prepare_daemon (struct MHD_Daemon *daemon_handle); @@ -291,7 +291,7 @@ run_daemon (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct MHD_Daemon *daemon_handle = cls; - http_task = GNUNET_SCHEDULER_NO_TASK; + http_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_assert (MHD_YES == MHD_run (daemon_handle)); @@ -303,10 +303,10 @@ run_daemon (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Function that queries MHD's select sets and * starts the task waiting for them. */ -static GNUNET_SCHEDULER_TaskIdentifier +static struct GNUNET_SCHEDULER_Task * prepare_daemon (struct MHD_Daemon *daemon_handle) { - GNUNET_SCHEDULER_TaskIdentifier ret; + struct GNUNET_SCHEDULER_Task * ret; fd_set rs; fd_set ws; fd_set es; @@ -389,10 +389,10 @@ server_stop (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "HTTP server shutdown\n"); - if (GNUNET_SCHEDULER_NO_TASK != http_task) + if (NULL != http_task) { GNUNET_SCHEDULER_cancel (http_task); - http_task = GNUNET_SCHEDULER_NO_TASK; + http_task = NULL; } if (NULL != daemon_handle) { diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c index bd909f9382..0e347ca7e2 100644 --- a/src/gns/gnunet-dns2gns.c +++ b/src/gns/gnunet-dns2gns.c @@ -80,7 +80,7 @@ struct Request * Task run on timeout or shutdown to clean up without * response. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Number of bytes in 'addr'. @@ -113,12 +113,12 @@ static struct GNUNET_NETWORK_Handle *listen_socket6; /** * Task for IPv4 socket. */ -static GNUNET_SCHEDULER_TaskIdentifier t4; +static struct GNUNET_SCHEDULER_Task * t4; /** * Task for IPv6 socket. */ -static GNUNET_SCHEDULER_TaskIdentifier t6; +static struct GNUNET_SCHEDULER_Task * t6; /** * DNS suffix, suffix of this gateway in DNS; defaults to '.zkey.eu' @@ -176,9 +176,9 @@ static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - if (GNUNET_SCHEDULER_NO_TASK != t4) + if (NULL != t4) GNUNET_SCHEDULER_cancel (t4); - if (GNUNET_SCHEDULER_NO_TASK != t6) + if (NULL != t6) GNUNET_SCHEDULER_cancel (t6); if (NULL != listen_socket4) { diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index 93aee20040..47875281bf 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c @@ -356,7 +356,7 @@ struct MhdHttpList /** * The task ID */ - GNUNET_SCHEDULER_TaskIdentifier httpd_task; + struct GNUNET_SCHEDULER_Task * httpd_task; /** * is this an ssl daemon? @@ -456,17 +456,17 @@ struct Socks5Request /** * Client socket read task */ - GNUNET_SCHEDULER_TaskIdentifier rtask; + struct GNUNET_SCHEDULER_Task * rtask; /** * Client socket write task */ - GNUNET_SCHEDULER_TaskIdentifier wtask; + struct GNUNET_SCHEDULER_Task * wtask; /** * Timeout task */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Read buffer @@ -593,17 +593,17 @@ static struct GNUNET_NETWORK_Handle *lsock6; /** * The listen task ID for IPv4 */ -static GNUNET_SCHEDULER_TaskIdentifier ltask4; +static struct GNUNET_SCHEDULER_Task * ltask4; /** * The listen task ID for IPv6 */ -static GNUNET_SCHEDULER_TaskIdentifier ltask6; +static struct GNUNET_SCHEDULER_Task * ltask6; /** * The cURL download task (curl multi API). */ -static GNUNET_SCHEDULER_TaskIdentifier curl_download_task; +static struct GNUNET_SCHEDULER_Task * curl_download_task; /** * The cURL multi handle @@ -716,11 +716,11 @@ cleanup_s5r (struct Socks5Request *s5r) if ( (NULL != s5r->response) && (curl_failure_response != s5r->response) ) MHD_destroy_response (s5r->response); - if (GNUNET_SCHEDULER_NO_TASK != s5r->rtask) + if (NULL != s5r->rtask) GNUNET_SCHEDULER_cancel (s5r->rtask); - if (GNUNET_SCHEDULER_NO_TASK != s5r->timeout_task) + if (NULL != s5r->timeout_task) GNUNET_SCHEDULER_cancel (s5r->timeout_task); - if (GNUNET_SCHEDULER_NO_TASK != s5r->wtask) + if (NULL != s5r->wtask) GNUNET_SCHEDULER_cancel (s5r->wtask); if (NULL != s5r->gns_lookup) GNUNET_GNS_lookup_cancel (s5r->gns_lookup); @@ -1266,10 +1266,10 @@ curl_download_prepare () long to; struct GNUNET_TIME_Relative rtime; - if (GNUNET_SCHEDULER_NO_TASK != curl_download_task) + if (NULL != curl_download_task) { GNUNET_SCHEDULER_cancel (curl_download_task); - curl_download_task = GNUNET_SCHEDULER_NO_TASK; + curl_download_task = NULL; } max = -1; FD_ZERO (&rs); @@ -1327,7 +1327,7 @@ curl_task_download (void *cls, CURLMcode mret; struct Socks5Request *s5r; - curl_download_task = GNUNET_SCHEDULER_NO_TASK; + curl_download_task = NULL; do { running = 0; @@ -1750,7 +1750,7 @@ mhd_log_callback (void *cls, } s5r->url = GNUNET_strdup (url); GNUNET_SCHEDULER_cancel (s5r->timeout_task); - s5r->timeout_task = GNUNET_SCHEDULER_NO_TASK; + s5r->timeout_task = NULL; return s5r; } } @@ -1772,10 +1772,10 @@ kill_httpd (struct MhdHttpList *hd) hd); GNUNET_free_non_null (hd->domain); MHD_stop_daemon (hd->daemon); - if (GNUNET_SCHEDULER_NO_TASK != hd->httpd_task) + if (NULL != hd->httpd_task) { GNUNET_SCHEDULER_cancel (hd->httpd_task); - hd->httpd_task = GNUNET_SCHEDULER_NO_TASK; + hd->httpd_task = NULL; } GNUNET_free_non_null (hd->proxy_cert); if (hd == httpd) @@ -1796,7 +1796,7 @@ kill_httpd_task (void *cls, { struct MhdHttpList *hd = cls; - hd->httpd_task = GNUNET_SCHEDULER_NO_TASK; + hd->httpd_task = NULL; kill_httpd (hd); } @@ -1858,7 +1858,7 @@ schedule_httpd (struct MhdHttpList *hd) wrs = NULL; wws = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != hd->httpd_task) + if (NULL != hd->httpd_task) GNUNET_SCHEDULER_cancel (hd->httpd_task); if ( (MHD_YES != haveto) && (-1 == max) && @@ -1895,7 +1895,7 @@ do_httpd (void *cls, { struct MhdHttpList *hd = cls; - hd->httpd_task = GNUNET_SCHEDULER_NO_TASK; + hd->httpd_task = NULL; MHD_run (hd->daemon); schedule_httpd (hd); } @@ -1909,7 +1909,7 @@ do_httpd (void *cls, static void run_mhd_now (struct MhdHttpList *hd) { - if (GNUNET_SCHEDULER_NO_TASK != + if (NULL != hd->httpd_task) GNUNET_SCHEDULER_cancel (hd->httpd_task); hd->httpd_task = GNUNET_SCHEDULER_add_now (&do_httpd, @@ -2146,7 +2146,7 @@ timeout_s5r_handshake (void *cls, { struct Socks5Request *s5r = cls; - s5r->timeout_task = GNUNET_SCHEDULER_NO_TASK; + s5r->timeout_task = NULL; cleanup_s5r (s5r); } @@ -2221,7 +2221,7 @@ do_write (void *cls, struct Socks5Request *s5r = cls; ssize_t len; - s5r->wtask = GNUNET_SCHEDULER_NO_TASK; + s5r->wtask = NULL; len = GNUNET_NETWORK_socket_send (s5r->sock, s5r->wbuf, s5r->wbuf_len); @@ -2253,7 +2253,7 @@ do_write (void *cls, GNUNET_assert (0); break; case SOCKS5_REQUEST: - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != s5r->rtask); + GNUNET_assert (NULL != s5r->rtask); break; case SOCKS5_DATA_TRANSFER: setup_data_transfer (s5r); @@ -2285,7 +2285,7 @@ signal_socks_failure (struct Socks5Request *s5r, s_resp->version = SOCKS_VERSION_5; s_resp->reply = sc; s5r->state = SOCKS5_WRITE_THEN_CLEANUP; - if (GNUNET_SCHEDULER_NO_TASK != s5r->wtask) + if (NULL != s5r->wtask) s5r->wtask = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, s5r->sock, @@ -2314,7 +2314,7 @@ signal_socks_success (struct Socks5Request *s5r) sizeof (struct in_addr) + sizeof (uint16_t)); s5r->wbuf_len += sizeof (struct Socks5ServerResponseMessage) + sizeof (struct in_addr) + sizeof (uint16_t); - if (GNUNET_SCHEDULER_NO_TASK == s5r->wtask) + if (NULL == s5r->wtask) s5r->wtask = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, s5r->sock, @@ -2482,7 +2482,7 @@ do_s5r_read (void *cls, ssize_t rlen; size_t alen; - s5r->rtask = GNUNET_SCHEDULER_NO_TASK; + s5r->rtask = NULL; if ( (NULL != tc->read_ready) && (GNUNET_NETWORK_fdset_isset (tc->read_ready, s5r->sock)) ) { @@ -2527,7 +2527,7 @@ do_s5r_read (void *cls, s5r->wbuf_len = sizeof (struct Socks5ServerHelloMessage); s_hello->version = SOCKS_VERSION_5; s_hello->auth_method = SOCKS_AUTH_NONE; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == s5r->wtask); + GNUNET_assert (NULL == s5r->wtask); s5r->wtask = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, s5r->sock, &do_write, s5r); @@ -2666,7 +2666,7 @@ do_s5r_read (void *cls, } /* We are done reading right now */ GNUNET_SCHEDULER_cancel (s5r->rtask); - s5r->rtask = GNUNET_SCHEDULER_NO_TASK; + s5r->rtask = NULL; return; case SOCKS5_RESOLVING: GNUNET_assert (0); @@ -2696,9 +2696,9 @@ do_accept (void *cls, struct Socks5Request *s5r; if (lsock == lsock4) - ltask4 = GNUNET_SCHEDULER_NO_TASK; + ltask4 = NULL; else - ltask6 = GNUNET_SCHEDULER_NO_TASK; + ltask6 = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; if (lsock == lsock4) @@ -2778,20 +2778,20 @@ do_shutdown (void *cls, GNUNET_GNS_disconnect (gns_handle); gns_handle = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != curl_download_task) + if (NULL != curl_download_task) { GNUNET_SCHEDULER_cancel (curl_download_task); - curl_download_task = GNUNET_SCHEDULER_NO_TASK; + curl_download_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != ltask4) + if (NULL != ltask4) { GNUNET_SCHEDULER_cancel (ltask4); - ltask4 = GNUNET_SCHEDULER_NO_TASK; + ltask4 = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != ltask6) + if (NULL != ltask6) { GNUNET_SCHEDULER_cancel (ltask6); - ltask6 = GNUNET_SCHEDULER_NO_TASK; + ltask6 = NULL; } gnutls_x509_crt_deinit (proxy_ca.cert); gnutls_x509_privkey_deinit (proxy_ca.key); diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index 57cdbc5f5a..d95c284501 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c @@ -218,7 +218,7 @@ static struct GNUNET_TIME_Relative zone_publish_time_window; /** * zone publish task */ -static GNUNET_SCHEDULER_TaskIdentifier zone_publish_task; +static struct GNUNET_SCHEDULER_Task * zone_publish_task; /** * #GNUNET_YES if zone has never been published before @@ -281,10 +281,10 @@ shutdown_task (void *cls, GNUNET_STATISTICS_destroy (statistics, GNUNET_NO); statistics = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != zone_publish_task) + if (NULL != zone_publish_task) { GNUNET_SCHEDULER_cancel (zone_publish_task); - zone_publish_task = GNUNET_SCHEDULER_NO_TASK; + zone_publish_task = NULL; } if (NULL != namestore_iter) { @@ -329,7 +329,7 @@ static void publish_zone_dht_next (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - zone_publish_task = GNUNET_SCHEDULER_NO_TASK; + zone_publish_task = NULL; GNUNET_NAMESTORE_zone_iterator_next (namestore_iter); } @@ -609,7 +609,7 @@ static void publish_zone_dht_start (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - zone_publish_task = GNUNET_SCHEDULER_NO_TASK; + zone_publish_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting DHT zone update!\n"); diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 897a8b2189..9e901f60c9 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -334,7 +334,7 @@ struct GNS_ResolverHandle /** * ID of a task associated with the resolution process. */ - GNUNET_SCHEDULER_TaskIdentifier task_id; + struct GNUNET_SCHEDULER_Task * task_id; /** * The name to resolve @@ -549,7 +549,7 @@ fail_resolution (void *cls, { struct GNS_ResolverHandle *rh = cls; - rh->task_id = GNUNET_SCHEDULER_NO_TASK; + rh->task_id = NULL; rh->proc (rh->proc_cls, 0, NULL); GNS_resolver_lookup_cancel (rh); } @@ -845,7 +845,7 @@ dns_result_parser (void *cls, rh->dns_request = NULL; GNUNET_SCHEDULER_cancel (rh->task_id); - rh->task_id = GNUNET_SCHEDULER_NO_TASK; + rh->task_id = NULL; p = GNUNET_DNSPARSER_parse ((const char *) dns, dns_len); if (NULL == p) @@ -2232,7 +2232,7 @@ recursive_resolution (void *cls, { struct GNS_ResolverHandle *rh = cls; - rh->task_id = GNUNET_SCHEDULER_NO_TASK; + rh->task_id = NULL; if (MAX_RECURSION < rh->loop_limiter++) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, @@ -2456,10 +2456,10 @@ GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh) GNUNET_free (rh->g2dc); rh->g2dc = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != rh->task_id) + if (NULL != rh->task_id) { GNUNET_SCHEDULER_cancel (rh->task_id); - rh->task_id = GNUNET_SCHEDULER_NO_TASK; + rh->task_id = NULL; } if (NULL != rh->get_handle) { diff --git a/src/gns/gnunet-service-gns_shorten.c b/src/gns/gnunet-service-gns_shorten.c index 34dcd42f6b..f744c3d6f8 100644 --- a/src/gns/gnunet-service-gns_shorten.c +++ b/src/gns/gnunet-service-gns_shorten.c @@ -106,7 +106,7 @@ struct GetPseuAuthorityHandle /** * Task to abort DHT lookup operation. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; }; @@ -160,10 +160,10 @@ free_get_pseu_authority_handle (struct GetPseuAuthorityHandle *gph) GNUNET_NAMECACHE_cancel (gph->namecache_task); gph->namecache_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != gph->timeout_task) + if (NULL != gph->timeout_task) { GNUNET_SCHEDULER_cancel (gph->timeout_task); - gph->timeout_task = GNUNET_SCHEDULER_NO_TASK; + gph->timeout_task = NULL; } GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph); GNUNET_free_non_null (gph->current_label); diff --git a/src/gns/test_gns_proxy.c b/src/gns/test_gns_proxy.c index 9e2c29fb44..1f7cc7d938 100644 --- a/src/gns/test_gns_proxy.c +++ b/src/gns/test_gns_proxy.c @@ -45,9 +45,9 @@ static struct GNUNET_NAMESTORE_Handle *namestore; static struct MHD_Daemon *mhd; -static GNUNET_SCHEDULER_TaskIdentifier mhd_task_id; +static struct GNUNET_SCHEDULER_Task * mhd_task_id; -static GNUNET_SCHEDULER_TaskIdentifier curl_task_id; +static struct GNUNET_SCHEDULER_Task * curl_task_id; static CURL *curl; @@ -117,15 +117,15 @@ mhd_ahc (void *cls, static void do_shutdown () { - if (mhd_task_id != GNUNET_SCHEDULER_NO_TASK) + if (mhd_task_id != NULL) { GNUNET_SCHEDULER_cancel (mhd_task_id); - mhd_task_id = GNUNET_SCHEDULER_NO_TASK; + mhd_task_id = NULL; } - if (curl_task_id != GNUNET_SCHEDULER_NO_TASK) + if (curl_task_id != NULL) { GNUNET_SCHEDULER_cancel (curl_task_id); - curl_task_id = GNUNET_SCHEDULER_NO_TASK; + curl_task_id = NULL; } if (NULL != mhd) { @@ -164,7 +164,7 @@ static void curl_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - curl_task_id = GNUNET_SCHEDULER_NO_TASK; + curl_task_id = NULL; curl_main (); } @@ -314,7 +314,7 @@ static void mhd_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - mhd_task_id = GNUNET_SCHEDULER_NO_TASK; + mhd_task_id = NULL; MHD_run (mhd); mhd_main (); } @@ -332,7 +332,7 @@ mhd_main () unsigned MHD_LONG_LONG timeout; struct GNUNET_TIME_Relative delay; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == mhd_task_id); + GNUNET_assert (NULL == mhd_task_id); FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index 62ecc5dfd1..833f24ece0 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c @@ -275,16 +275,24 @@ run (void *cls, return; } stats = GNUNET_STATISTICS_create ("hostlist", cfg); + if (NULL == stats) + { + GNUNET_break (0); + return; + } if (bootstrapping) - GNUNET_HOSTLIST_client_start (cfg, stats, &client_ch, &client_dh, - &client_adv_handler, learning); + GNUNET_HOSTLIST_client_start (cfg, stats, + &client_ch, + &client_dh, + &client_adv_handler, + learning); core = GNUNET_CORE_connect (cfg, NULL, &core_init, &connect_handler, - &disconnect_handler, NULL, - GNUNET_NO, NULL, - GNUNET_NO, + &disconnect_handler, + NULL, GNUNET_NO, + NULL, GNUNET_NO, learning ? learn_handlers : no_learn_handlers); @@ -346,7 +354,8 @@ main (int argc, char *const *argv) GNUNET_log_setup ("hostlist", "WARNING", NULL); ret = (GNUNET_OK == - GNUNET_PROGRAM_run (argc, argv, "hostlist", + GNUNET_PROGRAM_run (argc, argv, + "hostlist", _("GNUnet hostlist server and client"), options, &run, NULL)) ? 0 : 1; diff --git a/src/hostlist/gnunet-daemon-hostlist_client.c b/src/hostlist/gnunet-daemon-hostlist_client.c index b92f195f88..0751668b33 100644 --- a/src/hostlist/gnunet-daemon-hostlist_client.c +++ b/src/hostlist/gnunet-daemon-hostlist_client.c @@ -205,27 +205,27 @@ static struct GNUNET_TIME_Relative hostlist_delay; /** * ID of the task, checking if hostlist download should take plate */ -static GNUNET_SCHEDULER_TaskIdentifier ti_check_download; +static struct GNUNET_SCHEDULER_Task * ti_check_download; /** * ID of the task downloading the hostlist */ -static GNUNET_SCHEDULER_TaskIdentifier ti_download; +static struct GNUNET_SCHEDULER_Task * ti_download; /** * ID of the task saving the hostlsit in a regular intervall */ -static GNUNET_SCHEDULER_TaskIdentifier ti_saving_task; +static struct GNUNET_SCHEDULER_Task * ti_saving_task; /** * ID of the task called to initiate a download */ -static GNUNET_SCHEDULER_TaskIdentifier ti_download_dispatcher_task; +static struct GNUNET_SCHEDULER_Task * ti_download_dispatcher_task; /** * ID of the task controlling the locking between two hostlist tests */ -static GNUNET_SCHEDULER_TaskIdentifier ti_testing_intervall_task; +static struct GNUNET_SCHEDULER_Task * ti_testing_intervall_task; /** * At what time MUST the current hostlist request be done? @@ -846,7 +846,7 @@ task_download (void *cls, struct CURLMsg *msg; CURLMcode mret; - ti_download = GNUNET_SCHEDULER_NO_TASK; + ti_download = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -1044,7 +1044,7 @@ static void task_download_dispatcher (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - ti_download_dispatcher_task = GNUNET_SCHEDULER_NO_TASK; + ti_download_dispatcher_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download is initiated...\n"); @@ -1075,7 +1075,7 @@ task_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static int once; struct GNUNET_TIME_Relative delay; - ti_check_download = GNUNET_SCHEDULER_NO_TASK; + ti_check_download = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; if (stats == NULL) @@ -1084,7 +1084,7 @@ task_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) return; /* in shutdown */ } if ( (stat_connection_count < MIN_CONNECTIONS) && - (GNUNET_SCHEDULER_NO_TASK == ti_download_dispatcher_task) ) + (NULL == ti_download_dispatcher_task) ) ti_download_dispatcher_task = GNUNET_SCHEDULER_add_now (&task_download_dispatcher, NULL); @@ -1126,7 +1126,7 @@ static void task_testing_intervall_reset (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - ti_testing_intervall_task = GNUNET_SCHEDULER_NO_TASK; + ti_testing_intervall_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; stat_testing_allowed = GNUNET_OK; @@ -1144,7 +1144,7 @@ task_testing_intervall_reset (void *cls, static void task_hostlist_saving (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - ti_saving_task = GNUNET_SCHEDULER_NO_TASK; + ti_saving_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; save_hostlist_file (GNUNET_NO); @@ -1284,7 +1284,7 @@ static void primary_task (void *cls, int success) { sget = NULL; - GNUNET_assert (stats != NULL); + GNUNET_assert (NULL != stats); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Statistics request done, scheduling hostlist download\n"); ti_check_download = GNUNET_SCHEDULER_add_now (&task_check, NULL); @@ -1310,7 +1310,8 @@ process_stat (void *cls, hostlist_delay.rel_value_us = value * 1000LL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Initial time between hostlist downloads is %s\n", - GNUNET_STRINGS_relative_time_to_string (hostlist_delay, GNUNET_YES)); + GNUNET_STRINGS_relative_time_to_string (hostlist_delay, + GNUNET_YES)); return GNUNET_OK; } @@ -1441,13 +1442,14 @@ save_hostlist_file (int shutdown) if (NULL == wh) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - _ - ("Could not open file `%s' for writing to save hostlists: %s\n"), - filename, STRERROR (errno)); + _("Could not open file `%s' for writing to save hostlists: %s\n"), + filename, + STRERROR (errno)); GNUNET_free (filename); return; } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Writing %u hostlist URIs to `%s'\n"), + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + _("Writing %u hostlist URIs to `%s'\n"), linked_list_size, filename); /* add code to write hostlists to file using bio */ ok = GNUNET_YES; @@ -1525,6 +1527,7 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, transport = GNUNET_TRANSPORT_connect (c, NULL, NULL, NULL, NULL, NULL); if (NULL == transport) { + GNUNET_break (0); curl_global_cleanup (); return GNUNET_SYSERR; } @@ -1532,8 +1535,9 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, stats = st; /* Read proxy configuration */ - if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, - "HOSTLIST", "PROXY", &proxy)) + if (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_string (cfg, + "HOSTLIST", "PROXY", &proxy)) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found proxy host: `%s'\n", @@ -1557,23 +1561,26 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, } /* proxy type */ - if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, - "HOSTLIST", "PROXY_TYPE", &proxytype_str)) + if (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_string (cfg, + "HOSTLIST", + "PROXY_TYPE", + &proxytype_str)) { - GNUNET_STRINGS_utf8_toupper (proxytype_str, proxytype_str); - + GNUNET_STRINGS_utf8_toupper (proxytype_str, + proxytype_str); proxy_type = CURLPROXY_HTTP; - if (0 == strcmp(proxytype_str, "HTTP")) + if (0 == strcmp (proxytype_str, "HTTP")) proxy_type = CURLPROXY_HTTP; - else if (0 == strcmp(proxytype_str, "HTTP_1_0")) + else if (0 == strcmp (proxytype_str, "HTTP_1_0")) proxy_type = CURLPROXY_HTTP_1_0; - else if (0 == strcmp(proxytype_str, "SOCKS4")) + else if (0 == strcmp (proxytype_str, "SOCKS4")) proxy_type = CURLPROXY_SOCKS4; - else if (0 == strcmp(proxytype_str, "SOCKS5")) + else if (0 == strcmp (proxytype_str, "SOCKS5")) proxy_type = CURLPROXY_SOCKS5; - else if (0 == strcmp(proxytype_str, "SOCKS4A")) + else if (0 == strcmp (proxytype_str, "SOCKS4A")) proxy_type = CURLPROXY_SOCKS4A; - else if (0 == strcmp(proxytype_str, "SOCKS5_HOSTNAME")) + else if (0 == strcmp (proxytype_str, "SOCKS5_HOSTNAME")) proxy_type = CURLPROXY_SOCKS5_HOSTNAME; else { @@ -1613,7 +1620,8 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, "Hostlists will be saved to file again in %s\n", GNUNET_STRINGS_relative_time_to_string (SAVING_INTERVAL, GNUNET_YES)); ti_saving_task = - GNUNET_SCHEDULER_add_delayed (SAVING_INTERVAL, &task_hostlist_saving, + GNUNET_SCHEDULER_add_delayed (SAVING_INTERVAL, + &task_hostlist_saving, NULL); } else @@ -1628,22 +1636,26 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, if (GNUNET_YES == GNUNET_DISK_file_test (filename)) { result = remove (filename); - if (result == 0) + if (0 == result) GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _ - ("Since learning is not enabled on this peer, hostlist file `%s' was removed\n"), + _("Since learning is not enabled on this peer, hostlist file `%s' was removed\n"), filename); else - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _("Hostlist file `%s' could not be removed\n"), filename); + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, + "remove", + filename); } } GNUNET_free (filename); } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Loading stats value on hostlist download frequency\n"); sget = GNUNET_STATISTICS_get (stats, "hostlist", gettext_noop ("# milliseconds between hostlist downloads"), - GNUNET_TIME_UNIT_MINUTES, &primary_task, &process_stat, + GNUNET_TIME_UNIT_MINUTES, + &primary_task, + &process_stat, NULL); return GNUNET_OK; } @@ -1664,31 +1676,31 @@ GNUNET_HOSTLIST_client_stop () stats = NULL; if (GNUNET_YES == stat_learning) save_hostlist_file (GNUNET_YES); - if (ti_saving_task != GNUNET_SCHEDULER_NO_TASK) + if (ti_saving_task != NULL) { GNUNET_SCHEDULER_cancel (ti_saving_task); - ti_saving_task = GNUNET_SCHEDULER_NO_TASK; + ti_saving_task = NULL; } - if (ti_download_dispatcher_task != GNUNET_SCHEDULER_NO_TASK) + if (ti_download_dispatcher_task != NULL) { GNUNET_SCHEDULER_cancel (ti_download_dispatcher_task); - ti_download_dispatcher_task = GNUNET_SCHEDULER_NO_TASK; + ti_download_dispatcher_task = NULL; } - if (ti_testing_intervall_task != GNUNET_SCHEDULER_NO_TASK) + if (ti_testing_intervall_task != NULL) { GNUNET_SCHEDULER_cancel (ti_testing_intervall_task); - ti_testing_intervall_task = GNUNET_SCHEDULER_NO_TASK; + ti_testing_intervall_task = NULL; } - if (ti_download != GNUNET_SCHEDULER_NO_TASK) + if (ti_download != NULL) { GNUNET_SCHEDULER_cancel (ti_download); - ti_download = GNUNET_SCHEDULER_NO_TASK; + ti_download = NULL; } - if (ti_check_download != GNUNET_SCHEDULER_NO_TASK) + if (ti_check_download != NULL) { GNUNET_SCHEDULER_cancel (ti_check_download); - ti_check_download = GNUNET_SCHEDULER_NO_TASK; + ti_check_download = NULL; curl_global_cleanup (); } if (NULL != transport) diff --git a/src/hostlist/gnunet-daemon-hostlist_server.c b/src/hostlist/gnunet-daemon-hostlist_server.c index 9c8b145981..542fa1a98d 100644 --- a/src/hostlist/gnunet-daemon-hostlist_server.c +++ b/src/hostlist/gnunet-daemon-hostlist_server.c @@ -74,12 +74,12 @@ static struct GNUNET_PEERINFO_NotifyContext *notify; /** * Our primary task for IPv4. */ -static GNUNET_SCHEDULER_TaskIdentifier hostlist_task_v4; +static struct GNUNET_SCHEDULER_Task * hostlist_task_v4; /** * Our primary task for IPv6. */ -static GNUNET_SCHEDULER_TaskIdentifier hostlist_task_v6; +static struct GNUNET_SCHEDULER_Task * hostlist_task_v6; /** * Our canonical response. @@ -618,7 +618,7 @@ process_notify (void *cls, * Function that queries MHD's select sets and * starts the task waiting for them. */ -static GNUNET_SCHEDULER_TaskIdentifier +static struct GNUNET_SCHEDULER_Task * prepare_daemon (struct MHD_Daemon *daemon_handle); @@ -636,9 +636,9 @@ run_daemon (void *cls, struct MHD_Daemon *daemon_handle = cls; if (daemon_handle == daemon_handle_v4) - hostlist_task_v4 = GNUNET_SCHEDULER_NO_TASK; + hostlist_task_v4 = NULL; else - hostlist_task_v6 = GNUNET_SCHEDULER_NO_TASK; + hostlist_task_v6 = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -656,10 +656,10 @@ run_daemon (void *cls, * * @param daemon_handle HTTP server to prepare to run */ -static GNUNET_SCHEDULER_TaskIdentifier +static struct GNUNET_SCHEDULER_Task * prepare_daemon (struct MHD_Daemon *daemon_handle) { - GNUNET_SCHEDULER_TaskIdentifier ret; + struct GNUNET_SCHEDULER_Task * ret; fd_set rs; fd_set ws; fd_set es; @@ -917,15 +917,15 @@ GNUNET_HOSTLIST_server_stop () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Hostlist server shutdown\n"); - if (GNUNET_SCHEDULER_NO_TASK != hostlist_task_v6) + if (NULL != hostlist_task_v6) { GNUNET_SCHEDULER_cancel (hostlist_task_v6); - hostlist_task_v6 = GNUNET_SCHEDULER_NO_TASK; + hostlist_task_v6 = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != hostlist_task_v4) + if (NULL != hostlist_task_v4) { GNUNET_SCHEDULER_cancel (hostlist_task_v4); - hostlist_task_v4 = GNUNET_SCHEDULER_NO_TASK; + hostlist_task_v4 = NULL; } if (NULL != daemon_handle_v4) { diff --git a/src/hostlist/test_gnunet_daemon_hostlist.c b/src/hostlist/test_gnunet_daemon_hostlist.c index a39f346aea..21cd164bc2 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist.c +++ b/src/hostlist/test_gnunet_daemon_hostlist.c @@ -35,7 +35,7 @@ static int ok; -static GNUNET_SCHEDULER_TaskIdentifier timeout_task; +static struct GNUNET_SCHEDULER_Task * timeout_task; struct PeerContext { @@ -83,7 +83,7 @@ clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void timeout_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout trying to connect peers, test failed.\n"); clean_up (NULL, tc); @@ -106,10 +106,10 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) return; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected, shutting down.\n"); ok = 0; - if (timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (timeout_task != NULL) { GNUNET_SCHEDULER_cancel (timeout_task); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; } GNUNET_SCHEDULER_add_now (&clean_up, NULL); } diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index 9f4d8e3d70..5f497f2429 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c @@ -64,9 +64,9 @@ static char *current_adv_uri; static const struct GNUNET_CONFIGURATION_Handle *cfg; -static GNUNET_SCHEDULER_TaskIdentifier timeout_task; +static struct GNUNET_SCHEDULER_Task * timeout_task; -static GNUNET_SCHEDULER_TaskIdentifier check_task; +static struct GNUNET_SCHEDULER_Task * check_task; static struct PeerContext adv_peer; @@ -83,10 +83,10 @@ static void shutdown_testcase () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown testcase....\n"); - if (timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (timeout_task != NULL) { GNUNET_SCHEDULER_cancel (timeout_task); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; } if (NULL != download_stats) { @@ -113,10 +113,10 @@ shutdown_testcase () GNUNET_STATISTICS_destroy (learn_peer.stats, GNUNET_NO); learn_peer.stats = NULL; } - if (check_task != GNUNET_SCHEDULER_NO_TASK) + if (check_task != NULL) { GNUNET_SCHEDULER_cancel (check_task); - check_task = GNUNET_SCHEDULER_NO_TASK; + check_task = NULL; } if (NULL != current_adv_uri) { @@ -168,7 +168,7 @@ shutdown_testcase () static void timeout_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout while executing testcase, test failed.\n"); timeout = GNUNET_YES; @@ -269,7 +269,7 @@ check_statistics (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { char *stat; - check_task = GNUNET_SCHEDULER_NO_TASK; + check_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_asprintf (&stat, gettext_noop ("# advertised URI `%s' downloaded"), diff --git a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c index 1962bcd457..5ff97ff6ba 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c @@ -35,7 +35,7 @@ static int ok; -static GNUNET_SCHEDULER_TaskIdentifier timeout_task; +static struct GNUNET_SCHEDULER_Task * timeout_task; struct PeerContext { @@ -83,7 +83,7 @@ clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void timeout_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout trying to connect peers, test failed.\n"); clean_up (NULL, tc); @@ -106,10 +106,10 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) return; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected, shutting down.\n"); ok = 0; - if (timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (timeout_task != NULL) { GNUNET_SCHEDULER_cancel (timeout_task); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; } GNUNET_SCHEDULER_add_now (&clean_up, NULL); } diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c index 3028ff3fd4..d4ee6c01bd 100644 --- a/src/identity/identity_api.c +++ b/src/identity/identity_api.c @@ -155,7 +155,7 @@ struct GNUNET_IDENTITY_Handle /** * Task doing exponential back-off trying to reconnect. */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Time for next connect retry. @@ -210,7 +210,7 @@ reconnect (void *cls, static void reschedule_connect (struct GNUNET_IDENTITY_Handle *h) { - GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK); + GNUNET_assert (h->reconnect_task == NULL); if (NULL != h->th) { @@ -542,7 +542,7 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_IDENTITY_Operation *op; struct GNUNET_MessageHeader msg; - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to identity service.\n"); GNUNET_assert (NULL == h->client); @@ -966,10 +966,10 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h) struct GNUNET_IDENTITY_Operation *op; GNUNET_assert (NULL != h); - if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK) + if (h->reconnect_task != NULL) { GNUNET_SCHEDULER_cancel (h->reconnect_task); - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; } if (NULL != h->th) { diff --git a/src/identity/test_identity.c b/src/identity/test_identity.c index 6797afe3cd..0dca384114 100644 --- a/src/identity/test_identity.c +++ b/src/identity/test_identity.c @@ -50,7 +50,7 @@ static struct GNUNET_IDENTITY_Operation *op; /** * Handle for task for timeout termination. */ -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; /** @@ -107,10 +107,10 @@ end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end () { - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, &end_normally, NULL); diff --git a/src/identity/test_identity_defaults.c b/src/identity/test_identity_defaults.c index 980f4abd25..0d9c2ee272 100644 --- a/src/identity/test_identity_defaults.c +++ b/src/identity/test_identity_defaults.c @@ -50,7 +50,7 @@ static struct GNUNET_IDENTITY_Operation *op; /** * Handle for task for timeout termination. */ -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; /** @@ -107,10 +107,10 @@ end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end () { - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, &end_normally, NULL); diff --git a/src/include/gnunet_bandwidth_lib.h b/src/include/gnunet_bandwidth_lib.h index 9bd037dfa6..ad8f3a2b9c 100644 --- a/src/include/gnunet_bandwidth_lib.h +++ b/src/include/gnunet_bandwidth_lib.h @@ -113,7 +113,7 @@ struct GNUNET_BANDWIDTH_Tracker * Task scheduled to call the @e excess_cb once we have * reached the maximum bandwidth the tracker can hold. */ - GNUNET_SCHEDULER_TaskIdentifier excess_task; + struct GNUNET_SCHEDULER_Task * excess_task; /** * Time when we last updated the tracker. diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h index ec605a3fd5..4ee21e1930 100644 --- a/src/include/gnunet_scheduler_lib.h +++ b/src/include/gnunet_scheduler_lib.h @@ -40,14 +40,7 @@ extern "C" /** * Opaque reference to a task. */ -typedef unsigned long long GNUNET_SCHEDULER_TaskIdentifier; - - -/** - * Constant used to indicate that the scheduled - * task has no others as prerequisites. - */ -#define GNUNET_SCHEDULER_NO_TASK ((GNUNET_SCHEDULER_TaskIdentifier) 0) +struct GNUNET_SCHEDULER_Task; /** * Reasons why the schedule may have triggered @@ -56,36 +49,41 @@ typedef unsigned long long GNUNET_SCHEDULER_TaskIdentifier; enum GNUNET_SCHEDULER_Reason { /** + * This task is not ready. + */ + GNUNET_SCHEDULER_REASON_NONE = 0, + + /** * This is the very first task run during startup. */ - GNUNET_SCHEDULER_REASON_STARTUP = 0, + GNUNET_SCHEDULER_REASON_STARTUP = 1, /** * We are shutting down and are running all shutdown-related tasks * (regardless of timeout, etc.). */ - GNUNET_SCHEDULER_REASON_SHUTDOWN = 1, + GNUNET_SCHEDULER_REASON_SHUTDOWN = 2, /** * The specified timeout has expired. * (also set if the delay given was 0). */ - GNUNET_SCHEDULER_REASON_TIMEOUT = 2, + GNUNET_SCHEDULER_REASON_TIMEOUT = 4, /** * The reading socket is ready. */ - GNUNET_SCHEDULER_REASON_READ_READY = 4, + GNUNET_SCHEDULER_REASON_READ_READY = 8, /** * The writing socket is ready. */ - GNUNET_SCHEDULER_REASON_WRITE_READY = 8, + GNUNET_SCHEDULER_REASON_WRITE_READY = 16, /** * The prerequisite task is done. */ - GNUNET_SCHEDULER_REASON_PREREQ_DONE = 16 + GNUNET_SCHEDULER_REASON_PREREQ_DONE = 32 }; @@ -193,9 +191,9 @@ struct GNUNET_SCHEDULER_TaskContext * @param cls closure * @param tc context information (why was this task triggered now) */ -typedef void (*GNUNET_SCHEDULER_Task) (void *cls, - const struct GNUNET_SCHEDULER_TaskContext - * tc); +typedef void +(*GNUNET_SCHEDULER_TaskCallback) (void *cls, + const struct GNUNET_SCHEDULER_TaskContext *tc); /** @@ -209,11 +207,12 @@ typedef void (*GNUNET_SCHEDULER_Task) (void *cls, * @param timeout relative value when to return * @return number of selected sockets, #GNUNET_SYSERR on error */ -typedef int (*GNUNET_SCHEDULER_select) (void *cls, - struct GNUNET_NETWORK_FDSet *rfds, - struct GNUNET_NETWORK_FDSet *wfds, - struct GNUNET_NETWORK_FDSet *efds, - struct GNUNET_TIME_Relative timeout); +typedef int +(*GNUNET_SCHEDULER_select) (void *cls, + struct GNUNET_NETWORK_FDSet *rfds, + struct GNUNET_NETWORK_FDSet *wfds, + struct GNUNET_NETWORK_FDSet *efds, + struct GNUNET_TIME_Relative timeout); /** @@ -231,7 +230,8 @@ typedef int (*GNUNET_SCHEDULER_select) (void *cls, * @param task_cls closure of task */ void -GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls); +GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task, + void *task_cls); /** @@ -279,7 +279,7 @@ GNUNET_SCHEDULER_get_reason (void); * @return the closure of the callback of the cancelled task */ void * -GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_TaskIdentifier task); +GNUNET_SCHEDULER_cancel (struct GNUNET_SCHEDULER_Task *task); /** @@ -292,7 +292,8 @@ GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_TaskIdentifier task); * @param reason reason for task invocation */ void -GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_Task task, void *task_cls, +GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_TaskCallback task, + void *task_cls, enum GNUNET_SCHEDULER_Reason reason); @@ -307,7 +308,8 @@ GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_Task task, void *task_cls, * @param priority priority to use for the task */ void -GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_Task task, void *task_cls, +GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_TaskCallback task, + void *task_cls, enum GNUNET_SCHEDULER_Reason reason, enum GNUNET_SCHEDULER_Priority priority); @@ -321,9 +323,10 @@ GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_Task task, voi * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, - GNUNET_SCHEDULER_Task task, void *task_cls); + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls); /** @@ -341,8 +344,9 @@ GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier -GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task task, void *task_cls); +struct GNUNET_SCHEDULER_Task * +GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_TaskCallback task, + void *task_cls); /** @@ -359,9 +363,9 @@ GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task task, void *task_cls); * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, - GNUNET_SCHEDULER_Task task, + GNUNET_SCHEDULER_TaskCallback task, void *task_cls); @@ -377,9 +381,10 @@ GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, - GNUNET_SCHEDULER_Task task, void *task_cls); + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls); /** @@ -394,10 +399,11 @@ GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, - GNUNET_SCHEDULER_Task task, void *task_cls); + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls); /** @@ -415,10 +421,11 @@ GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, struct GNUNET_NETWORK_Handle *rfd, - GNUNET_SCHEDULER_Task task, void *task_cls); + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls); /** @@ -438,11 +445,12 @@ GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_read_net_with_priority (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, struct GNUNET_NETWORK_Handle *rfd, - GNUNET_SCHEDULER_Task task, void *task_cls); + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls); /** @@ -460,10 +468,11 @@ GNUNET_SCHEDULER_add_read_net_with_priority (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, struct GNUNET_NETWORK_Handle *wfd, - GNUNET_SCHEDULER_Task task, void *task_cls); + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls); /** @@ -484,12 +493,14 @@ GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until "task" is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_net_with_priority (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, struct GNUNET_NETWORK_Handle *fd, - int on_read, int on_write, - GNUNET_SCHEDULER_Task task, void *task_cls); + int on_read, + int on_write, + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls); /** * Schedule a new task to be run with a specified delay or when the @@ -506,10 +517,11 @@ GNUNET_SCHEDULER_add_net_with_priority (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until "task" is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, const struct GNUNET_DISK_FileHandle *rfd, - GNUNET_SCHEDULER_Task task, void *task_cls); + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls); /** @@ -527,10 +539,11 @@ GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, const struct GNUNET_DISK_FileHandle *wfd, - GNUNET_SCHEDULER_Task task, void *task_cls); + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls); /** @@ -551,12 +564,13 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_file_with_priority (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, const struct GNUNET_DISK_FileHandle *fd, int on_read, int on_write, - GNUNET_SCHEDULER_Task task, void *task_cls); + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls); /** @@ -586,12 +600,13 @@ GNUNET_SCHEDULER_add_file_with_priority (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until "task" is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, struct GNUNET_TIME_Relative delay, const struct GNUNET_NETWORK_FDSet *rs, const struct GNUNET_NETWORK_FDSet *ws, - GNUNET_SCHEDULER_Task task, void *task_cls); + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls); /** * Sets the select function to use in the scheduler (scheduler_select). diff --git a/src/include/gnunet_sensor_util_lib.h b/src/include/gnunet_sensor_util_lib.h index 3cb88904bf..86e017d979 100644 --- a/src/include/gnunet_sensor_util_lib.h +++ b/src/include/gnunet_sensor_util_lib.h @@ -124,7 +124,7 @@ struct GNUNET_SENSOR_SensorInfo char *gnunet_stat_name; /** - * Handle to statistics get request (OR GNUNET_SCHEDULER_NO_TASK) + * Handle to statistics get request (OR NULL) */ struct GNUNET_STATISTICS_GetHandle *gnunet_stat_get_handle; @@ -178,9 +178,9 @@ struct GNUNET_SENSOR_SensorInfo int report_anomalies; /** - * Execution task (OR GNUNET_SCHEDULER_NO_TASK) + * Execution task (OR NULL) */ - GNUNET_SCHEDULER_TaskIdentifier execution_task; + struct GNUNET_SCHEDULER_Task * execution_task; /** * Is the sensor being executed diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index 79fd88f44e..d1b341a8c6 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h @@ -432,7 +432,7 @@ struct GNUNET_TRANSPORT_OfferHelloHandle; struct GNUNET_TRANSPORT_OfferHelloHandle * GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, const struct GNUNET_MessageHeader *hello, - GNUNET_SCHEDULER_Task cont, void *cls); + GNUNET_SCHEDULER_TaskCallback cont, void *cls); /** diff --git a/src/multicast/test_multicast.c b/src/multicast/test_multicast.c index a8a8cb6119..a6b0c7dd6f 100644 --- a/src/multicast/test_multicast.c +++ b/src/multicast/test_multicast.c @@ -45,7 +45,7 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; /** * Handle for task for timeout termination. */ -static GNUNET_SCHEDULER_TaskIdentifier end_badly_task; +static struct GNUNET_SCHEDULER_Task * end_badly_task; /** @@ -96,10 +96,10 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending tests.\n"); - if (end_badly_task != GNUNET_SCHEDULER_NO_TASK) + if (end_badly_task != NULL) { GNUNET_SCHEDULER_cancel (end_badly_task); - end_badly_task = GNUNET_SCHEDULER_NO_TASK; + end_badly_task = NULL; } GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, &end_normally, NULL); diff --git a/src/namecache/namecache_api.c b/src/namecache/namecache_api.c index 26d80f4bff..9f979d9922 100644 --- a/src/namecache/namecache_api.c +++ b/src/namecache/namecache_api.c @@ -159,7 +159,7 @@ struct GNUNET_NAMECACHE_Handle /** * Reconnect task */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Delay introduced before we reconnect. @@ -503,7 +503,7 @@ reconnect_task (void *cls, { struct GNUNET_NAMECACHE_Handle *h = cls; - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; reconnect (h); } @@ -601,10 +601,10 @@ GNUNET_NAMECACHE_disconnect (struct GNUNET_NAMECACHE_Handle *h) GNUNET_CLIENT_disconnect (h->client); h->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->reconnect_task) + if (NULL != h->reconnect_task) { GNUNET_SCHEDULER_cancel (h->reconnect_task); - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; } GNUNET_free (h); } diff --git a/src/namecache/test_namecache_api_cache_block.c b/src/namecache/test_namecache_api_cache_block.c index ec3ddf0a94..b15dc96451 100644 --- a/src/namecache/test_namecache_api_cache_block.c +++ b/src/namecache/test_namecache_api_cache_block.c @@ -36,7 +36,7 @@ static struct GNUNET_NAMECACHE_Handle *nsh; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; @@ -122,17 +122,17 @@ name_lookup_proc (void *cls, GNUNET_assert (NULL != cls); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } if (NULL == block) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Namecache returned no block\n")); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c index 5286b90566..c82977b287 100644 --- a/src/namestore/gnunet-namestore-fcfsd.c +++ b/src/namestore/gnunet-namestore-fcfsd.c @@ -194,7 +194,7 @@ static struct MHD_Daemon *httpd; /** * Main HTTP task. */ -static GNUNET_SCHEDULER_TaskIdentifier httpd_task; +static struct GNUNET_SCHEDULER_Task * httpd_task; /** * Handle to the namestore. @@ -239,10 +239,10 @@ do_httpd (void *cls, static void run_httpd_now () { - if (GNUNET_SCHEDULER_NO_TASK != httpd_task) + if (NULL != httpd_task) { GNUNET_SCHEDULER_cancel (httpd_task); - httpd_task = GNUNET_SCHEDULER_NO_TASK; + httpd_task = NULL; } httpd_task = GNUNET_SCHEDULER_add_now (&do_httpd, NULL); } @@ -846,7 +846,7 @@ static void do_httpd (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - httpd_task = GNUNET_SCHEDULER_NO_TASK; + httpd_task = NULL; MHD_run (httpd); run_httpd (); } @@ -862,10 +862,10 @@ static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - if (GNUNET_SCHEDULER_NO_TASK != httpd_task) + if (NULL != httpd_task) { GNUNET_SCHEDULER_cancel (httpd_task); - httpd_task = GNUNET_SCHEDULER_NO_TASK; + httpd_task = NULL; } if (NULL != ns) { diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 1f42262977..9716a73b6a 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -152,7 +152,7 @@ struct ZoneMonitor /** * Task active during initial iteration. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * Offset of the zone iteration used to address next result of the zone @@ -355,10 +355,10 @@ client_disconnect_notification (void *cls, GNUNET_CONTAINER_DLL_remove (monitor_head, monitor_tail, zm); - if (GNUNET_SCHEDULER_NO_TASK != zm->task) + if (NULL != zm->task) { GNUNET_SCHEDULER_cancel (zm->task); - zm->task = GNUNET_SCHEDULER_NO_TASK; + zm->task = NULL; } GNUNET_free (zm); break; @@ -1614,7 +1614,7 @@ monitor_next (void *cls, struct ZoneMonitor *zm = cls; int ret; - zm->task = GNUNET_SCHEDULER_NO_TASK; + zm->task = NULL; ret = GSN_database->iterate_records (GSN_database->cls, (0 == memcmp (&zm->zone, &zero, sizeof (zero))) ? NULL diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index c089929a64..eca65f116c 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c @@ -214,7 +214,7 @@ struct GNUNET_NAMESTORE_Handle /** * Reconnect task */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Delay introduced before we reconnect. @@ -874,7 +874,7 @@ reconnect_task (void *cls, { struct GNUNET_NAMESTORE_Handle *h = cls; - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; reconnect (h); } @@ -979,10 +979,10 @@ GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h) GNUNET_CLIENT_disconnect (h->client); h->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->reconnect_task) + if (NULL != h->reconnect_task) { GNUNET_SCHEDULER_cancel (h->reconnect_task); - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; } GNUNET_free (h); } diff --git a/src/namestore/test_namestore_api_lookup_nick.c b/src/namestore/test_namestore_api_lookup_nick.c index 2a3933e795..1f7647ca5a 100644 --- a/src/namestore/test_namestore_api_lookup_nick.c +++ b/src/namestore/test_namestore_api_lookup_nick.c @@ -37,7 +37,7 @@ static struct GNUNET_NAMESTORE_Handle *nsh; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; @@ -206,14 +206,14 @@ void lookup_it (void *cls, if ((GNUNET_YES == found_nick) && (GNUNET_YES == found_record)) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; GNUNET_SCHEDULER_add_now (&end, NULL ); } else { GNUNET_break (0); GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; GNUNET_SCHEDULER_add_now (&endbadly, NULL ); } } diff --git a/src/namestore/test_namestore_api_lookup_private.c b/src/namestore/test_namestore_api_lookup_private.c index 87b580bb9c..51ec5f4a15 100644 --- a/src/namestore/test_namestore_api_lookup_private.c +++ b/src/namestore/test_namestore_api_lookup_private.c @@ -35,7 +35,7 @@ static struct GNUNET_NAMESTORE_Handle *nsh; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; @@ -136,7 +136,7 @@ void lookup_it (void *cls, /* Done */ GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; GNUNET_SCHEDULER_add_now (&end, NULL ); } diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c index df54f906c1..7d4c2e69d8 100644 --- a/src/namestore/test_namestore_api_lookup_public.c +++ b/src/namestore/test_namestore_api_lookup_public.c @@ -39,7 +39,7 @@ static struct GNUNET_NAMESTORE_Handle *nsh; static struct GNUNET_NAMECACHE_Handle *nch; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; @@ -139,17 +139,17 @@ name_lookup_proc (void *cls, ncqe = NULL; GNUNET_assert (NULL != cls); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } if (NULL == block) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Namestore returned no block\n")); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; diff --git a/src/namestore/test_namestore_api_lookup_shadow.c b/src/namestore/test_namestore_api_lookup_shadow.c index e423dbb3eb..373aa116de 100644 --- a/src/namestore/test_namestore_api_lookup_shadow.c +++ b/src/namestore/test_namestore_api_lookup_shadow.c @@ -41,7 +41,7 @@ static struct GNUNET_NAMESTORE_Handle *nsh; static struct GNUNET_NAMECACHE_Handle *nch; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; @@ -171,17 +171,17 @@ name_lookup_proc (void *cls, ncqe = NULL; GNUNET_assert (NULL != cls); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } if (NULL == block) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Namestore returned no block\n")); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; diff --git a/src/namestore/test_namestore_api_lookup_shadow_filter.c b/src/namestore/test_namestore_api_lookup_shadow_filter.c index 825c4d0a4c..9a18d84b79 100644 --- a/src/namestore/test_namestore_api_lookup_shadow_filter.c +++ b/src/namestore/test_namestore_api_lookup_shadow_filter.c @@ -42,9 +42,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; static struct GNUNET_NAMECACHE_Handle *nch; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; -static GNUNET_SCHEDULER_TaskIdentifier delayed_lookup_task; +static struct GNUNET_SCHEDULER_Task * delayed_lookup_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; @@ -99,10 +99,10 @@ cleanup () static void endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - if (GNUNET_SCHEDULER_NO_TASK != delayed_lookup_task) + if (NULL != delayed_lookup_task) { GNUNET_SCHEDULER_cancel (delayed_lookup_task); - delayed_lookup_task = GNUNET_SCHEDULER_NO_TASK; + delayed_lookup_task = NULL; } if (NULL != nsqe) { @@ -222,17 +222,17 @@ name_lookup_active_proc (void *cls, ncqe = NULL; ncqe_shadow = NULL; - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } if (NULL == block) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Namestore returned no block\n")); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; @@ -249,7 +249,7 @@ name_lookup_shadow (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Performing lookup for shadow record \n"); - delayed_lookup_task = GNUNET_SCHEDULER_NO_TASK; + delayed_lookup_task = NULL; ncqe_shadow = GNUNET_NAMECACHE_lookup_block (nch, &derived_hash, &name_lookup_active_proc, &records[1]); } diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c index f7eb5fd89c..0477f23de4 100644 --- a/src/namestore/test_namestore_api_monitoring.c +++ b/src/namestore/test_namestore_api_monitoring.c @@ -32,7 +32,7 @@ static struct GNUNET_NAMESTORE_Handle * nsh; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; @@ -196,10 +196,10 @@ zone_proc (void *cls, if (2 == ++returned_records) { - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } if (GNUNET_YES == fail) GNUNET_SCHEDULER_add_now (&endbadly, NULL); diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c index ae922d30e6..a02860c862 100644 --- a/src/namestore/test_namestore_api_monitoring_existing.c +++ b/src/namestore/test_namestore_api_monitoring_existing.c @@ -33,7 +33,7 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; static struct GNUNET_NAMESTORE_Handle * nsh; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; @@ -194,10 +194,10 @@ zone_proc (void *cls, if (2 == ++returned_records) { - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } if (GNUNET_YES == fail) GNUNET_SCHEDULER_add_now (&endbadly, NULL); diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index a6b4731d20..771c900423 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c @@ -36,7 +36,7 @@ static struct GNUNET_NAMESTORE_Handle *nsh; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; @@ -103,7 +103,7 @@ remove_cont (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Records could not be removed: `%s'\n"), emsg); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; @@ -111,7 +111,7 @@ remove_cont (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Records were removed, perform lookup\n"); removed = GNUNET_YES; - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); GNUNET_SCHEDULER_add_now (&end, NULL); } @@ -130,7 +130,7 @@ put_cont (void *cls, int32_t success, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Namestore could not store record: `%s'\n", emsg); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c index b87aec6a9a..9e08efa1b8 100644 --- a/src/namestore/test_namestore_api_remove_not_existing_record.c +++ b/src/namestore/test_namestore_api_remove_not_existing_record.c @@ -36,7 +36,7 @@ static struct GNUNET_NAMESTORE_Handle *nsh; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; @@ -98,10 +98,10 @@ put_cont (void *cls, int32_t success, const char *emsg) { GNUNET_assert (NULL != cls); nsqe = NULL; - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } switch (success) { diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c index 5fd0e9b816..2eea1b0bda 100644 --- a/src/namestore/test_namestore_api_store.c +++ b/src/namestore/test_namestore_api_store.c @@ -36,7 +36,7 @@ static struct GNUNET_NAMESTORE_Handle *nsh; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; @@ -104,7 +104,7 @@ put_cont (void *cls, int32_t success, const char *emsg) name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; GNUNET_SCHEDULER_add_now (&end, NULL); } diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c index 73515e1305..475fafa44a 100644 --- a/src/namestore/test_namestore_api_store_update.c +++ b/src/namestore/test_namestore_api_store_update.c @@ -47,7 +47,7 @@ static struct GNUNET_NAMESTORE_Handle *nsh; static struct GNUNET_NAMECACHE_Handle *nch; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; @@ -168,7 +168,7 @@ rd_decrypt_cb (void *cls, GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN2)); GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; GNUNET_SCHEDULER_add_now (&end, NULL); } } @@ -187,7 +187,7 @@ name_lookup_proc (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Namecache returned no block for `%s'\n"), name); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c index 933845206e..85f3b3fac4 100644 --- a/src/namestore/test_namestore_api_zone_iteration.c +++ b/src/namestore/test_namestore_api_zone_iteration.c @@ -32,7 +32,7 @@ static struct GNUNET_NAMESTORE_Handle * nsh; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; @@ -117,10 +117,10 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_NAMESTORE_zone_iteration_stop (zi); zi = NULL; } - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } if (privkey != NULL) @@ -292,7 +292,7 @@ put_cont (void *cls, int32_t success, const char *emsg) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to created records: `%s'\n", emsg); GNUNET_break (0); - if (GNUNET_SCHEDULER_NO_TASK != endbadly_task) + if (NULL != endbadly_task) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; @@ -311,7 +311,7 @@ put_cont (void *cls, int32_t success, const char *emsg) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create zone iterator\n"); GNUNET_break (0); - if (GNUNET_SCHEDULER_NO_TASK != endbadly_task) + if (NULL != endbadly_task) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; @@ -360,7 +360,7 @@ empty_zone_proc (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Expected empty zone but received zone private key\n")); GNUNET_break (0); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; @@ -370,7 +370,7 @@ empty_zone_proc (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Expected no zone content but received data\n")); GNUNET_break (0); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; diff --git a/src/namestore/test_namestore_api_zone_iteration_nick.c b/src/namestore/test_namestore_api_zone_iteration_nick.c index 6ea4e39c01..5b8f5bde1e 100644 --- a/src/namestore/test_namestore_api_zone_iteration_nick.c +++ b/src/namestore/test_namestore_api_zone_iteration_nick.c @@ -34,7 +34,7 @@ static struct GNUNET_NAMESTORE_Handle * nsh; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; @@ -120,10 +120,10 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_NAMESTORE_zone_iteration_stop (zi); zi = NULL; } - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } if (privkey != NULL) @@ -268,7 +268,7 @@ put_cont (void *cls, int32_t success, const char *emsg) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to created records: `%s'\n", emsg); GNUNET_break (0); - if (GNUNET_SCHEDULER_NO_TASK != endbadly_task) + if (NULL != endbadly_task) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; @@ -287,7 +287,7 @@ put_cont (void *cls, int32_t success, const char *emsg) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create zone iterator\n"); GNUNET_break (0); - if (GNUNET_SCHEDULER_NO_TASK != endbadly_task) + if (NULL != endbadly_task) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; @@ -385,7 +385,7 @@ empty_zone_proc (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Expected empty zone but received zone private key\n")); GNUNET_break (0); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; @@ -395,7 +395,7 @@ empty_zone_proc (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Expected no zone content but received data\n")); GNUNET_break (0); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c index ed393af8e7..3f8d481d1c 100644 --- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c +++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c @@ -33,7 +33,7 @@ static struct GNUNET_NAMESTORE_Handle * nsh; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; @@ -118,10 +118,10 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) zi = NULL; } - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } if (privkey != NULL) @@ -275,7 +275,7 @@ put_cont (void *cls, int32_t success, const char *emsg) "Failed to created records: `%s'\n", emsg); GNUNET_break (0); - if (GNUNET_SCHEDULER_NO_TASK != endbadly_task) + if (NULL != endbadly_task) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; @@ -296,7 +296,7 @@ put_cont (void *cls, int32_t success, const char *emsg) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create zone iterator\n"); GNUNET_break (0); - if (GNUNET_SCHEDULER_NO_TASK != endbadly_task) + if (NULL != endbadly_task) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; @@ -345,7 +345,7 @@ empty_zone_proc (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Expected empty zone but received zone private key\n")); GNUNET_break (0); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; @@ -355,7 +355,7 @@ empty_zone_proc (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Expected no zone content but received data\n")); GNUNET_break (0); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c index 38aae9b6df..942c381a3c 100644 --- a/src/namestore/test_namestore_api_zone_iteration_stop.c +++ b/src/namestore/test_namestore_api_zone_iteration_stop.c @@ -32,7 +32,7 @@ static struct GNUNET_NAMESTORE_Handle * nsh; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; @@ -118,10 +118,10 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) zi = NULL; } - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } if (privkey != NULL) @@ -266,10 +266,10 @@ zone_proc (void *cls, "Telling namestore to stop zone iteration\n"); GNUNET_NAMESTORE_zone_iteration_stop (zi); zi = NULL; - if (GNUNET_SCHEDULER_NO_TASK != endbadly_task) + if (NULL != endbadly_task) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } res = 0; GNUNET_SCHEDULER_add_delayed (WAIT, &end, NULL); @@ -303,7 +303,7 @@ put_cont (void *cls, int32_t success, const char *emsg) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to created records: `%s'\n", emsg); GNUNET_break (0); - if (GNUNET_SCHEDULER_NO_TASK != endbadly_task) + if (NULL != endbadly_task) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; @@ -322,7 +322,7 @@ put_cont (void *cls, int32_t success, const char *emsg) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create zone iterator\n"); GNUNET_break (0); - if (GNUNET_SCHEDULER_NO_TASK != endbadly_task) + if (NULL != endbadly_task) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; @@ -371,7 +371,7 @@ empty_zone_proc (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Expected empty zone but received zone private key\n")); GNUNET_break (0); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; @@ -381,7 +381,7 @@ empty_zone_proc (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Expected no zone content but received data\n")); GNUNET_break (0); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) GNUNET_SCHEDULER_cancel (endbadly_task); endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c index 9ade0cfc15..5c75fcb91f 100644 --- a/src/namestore/test_namestore_api_zone_to_name.c +++ b/src/namestore/test_namestore_api_zone_to_name.c @@ -39,7 +39,7 @@ static struct GNUNET_NAMESTORE_Handle * nsh; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; @@ -81,10 +81,10 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + if (endbadly_task != NULL) { GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; } if (privkey != NULL) GNUNET_free (privkey); diff --git a/src/nat/nat.c b/src/nat/nat.c index 85d069e07e..0225508a6e 100644 --- a/src/nat/nat.c +++ b/src/nat/nat.c @@ -230,27 +230,27 @@ struct GNUNET_NAT_Handle /** * ID of select gnunet-helper-nat-server stdout read task */ - GNUNET_SCHEDULER_TaskIdentifier server_read_task; + struct GNUNET_SCHEDULER_Task * server_read_task; /** * ID of interface IP-scan task */ - GNUNET_SCHEDULER_TaskIdentifier ifc_task; + struct GNUNET_SCHEDULER_Task * ifc_task; /** * ID of hostname DNS lookup task */ - GNUNET_SCHEDULER_TaskIdentifier hostname_task; + struct GNUNET_SCHEDULER_Task * hostname_task; /** * ID of DynDNS lookup task */ - GNUNET_SCHEDULER_TaskIdentifier dns_task; + struct GNUNET_SCHEDULER_Task * dns_task; /** * ID of task to add addresses from bind. */ - GNUNET_SCHEDULER_TaskIdentifier bind_task; + struct GNUNET_SCHEDULER_Task * bind_task; /** * How often do we scan for changes in our IP address from our local @@ -758,7 +758,7 @@ process_interfaces (void *cls, const char *name, int isDefault, return GNUNET_OK; } if ((h->internal_address == NULL) && (h->server_proc == NULL) && - (h->server_read_task == GNUNET_SCHEDULER_NO_TASK) && + (h->server_read_task == NULL) && (GNUNET_YES == isDefault) && ((addr->sa_family == AF_INET) || (addr->sa_family == AF_INET6))) { @@ -784,7 +784,7 @@ restart_nat_server (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_NAT_Handle *h = cls; - h->server_read_task = GNUNET_SCHEDULER_NO_TASK; + h->server_read_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; start_gnunet_nat_server (h); @@ -811,7 +811,7 @@ nat_server_read (void *cls, const char *port_start; struct sockaddr_in sin_addr; - h->server_read_task = GNUNET_SCHEDULER_NO_TASK; + h->server_read_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; memset (mybuf, 0, sizeof (mybuf)); @@ -946,7 +946,7 @@ list_interfaces (void *cls, { struct GNUNET_NAT_Handle *h = cls; - h->ifc_task = GNUNET_SCHEDULER_NO_TASK; + h->ifc_task = NULL; remove_from_address_list_by_source (h, LAL_INTERFACE_ADDRESS); GNUNET_OS_network_interfaces_list (&process_interfaces, h); h->ifc_task = @@ -967,7 +967,7 @@ resolve_hostname (void *cls, { struct GNUNET_NAT_Handle *h = cls; - h->hostname_task = GNUNET_SCHEDULER_NO_TASK; + h->hostname_task = NULL; remove_from_address_list_by_source (h, LAL_HOSTNAME_DNS); h->hostname_dns = GNUNET_RESOLVER_hostname_resolve (AF_UNSPEC, HOSTNAME_RESOLVE_TIMEOUT, @@ -989,7 +989,7 @@ resolve_dns (void *cls, struct GNUNET_NAT_Handle *h = cls; struct LocalAddressList *pos; - h->dns_task = GNUNET_SCHEDULER_NO_TASK; + h->dns_task = NULL; for (pos = h->lal_head; NULL != pos; pos = pos->next) if (pos->source == LAL_EXTERNAL_IP) pos->source = LAL_EXTERNAL_IP_OLD; @@ -1124,7 +1124,7 @@ add_from_bind (void *cls, struct sockaddr *sa; const struct sockaddr_in *v4; - h->bind_task = GNUNET_SCHEDULER_NO_TASK; + h->bind_task = NULL; for (i = 0; i < h->num_local_addrs; i++) { sa = h->local_addrs[i]; @@ -1384,30 +1384,30 @@ GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h) GNUNET_RESOLVER_request_cancel (h->hostname_dns); h->hostname_dns = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->server_read_task) + if (NULL != h->server_read_task) { GNUNET_SCHEDULER_cancel (h->server_read_task); - h->server_read_task = GNUNET_SCHEDULER_NO_TASK; + h->server_read_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->bind_task) + if (NULL != h->bind_task) { GNUNET_SCHEDULER_cancel (h->bind_task); - h->bind_task = GNUNET_SCHEDULER_NO_TASK; + h->bind_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->ifc_task) + if (NULL != h->ifc_task) { GNUNET_SCHEDULER_cancel (h->ifc_task); - h->ifc_task = GNUNET_SCHEDULER_NO_TASK; + h->ifc_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->hostname_task) + if (NULL != h->hostname_task) { GNUNET_SCHEDULER_cancel (h->hostname_task); - h->hostname_task = GNUNET_SCHEDULER_NO_TASK; + h->hostname_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->dns_task) + if (NULL != h->dns_task) { GNUNET_SCHEDULER_cancel (h->dns_task); - h->dns_task = GNUNET_SCHEDULER_NO_TASK; + h->dns_task = NULL; } if (NULL != h->server_proc) { diff --git a/src/nat/nat_auto.c b/src/nat/nat_auto.c index 8fc85d7a71..33ce8c1f15 100644 --- a/src/nat/nat_auto.c +++ b/src/nat/nat_auto.c @@ -129,7 +129,7 @@ struct GNUNET_NAT_AutoHandle /** * Task identifier for the timeout. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * Where are we in the test? @@ -196,7 +196,7 @@ reversal_test (void *cls, { struct GNUNET_NAT_AutoHandle *ah = cls; - ah->task = GNUNET_SCHEDULER_NO_TASK; + ah->task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Testing connection reversal with ICMP server.\n")); GNUNET_RESOLVER_connect (ah->cfg); @@ -603,10 +603,10 @@ GNUNET_NAT_autoconfig_cancel (struct GNUNET_NAT_AutoHandle *ah) GNUNET_NAT_mini_get_external_ipv4_cancel (ah->eh); ah->eh = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != ah->task) + if (NULL != ah->task) { GNUNET_SCHEDULER_cancel (ah->task); - ah->task = GNUNET_SCHEDULER_NO_TASK; + ah->task = NULL; } GNUNET_CONFIGURATION_destroy (ah->cfg); GNUNET_CONFIGURATION_destroy (ah->initial_cfg); diff --git a/src/nat/nat_mini.c b/src/nat/nat_mini.c index 1e8ab7ecc2..47ba27de86 100644 --- a/src/nat/nat_mini.c +++ b/src/nat/nat_mini.c @@ -66,7 +66,7 @@ struct GNUNET_NAT_ExternalHandle /** * Read task. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * Handle to 'external-ip' process. @@ -120,7 +120,7 @@ read_external_ipv4 (void *cls, ssize_t ret; struct in_addr addr; - eh->task = GNUNET_SCHEDULER_NO_TASK; + eh->task = NULL; if (GNUNET_YES == GNUNET_NETWORK_fdset_handle_isset (tc->read_ready, eh->r)) ret = GNUNET_DISK_file_read (eh->r, &eh->buf[eh->off], @@ -170,7 +170,7 @@ signal_external_ip_error (void *cls, { struct GNUNET_NAT_ExternalHandle *eh = cls; - eh->task = GNUNET_SCHEDULER_NO_TASK; + eh->task = NULL; eh->cb (eh->cb_cls, NULL, eh->ret); @@ -254,7 +254,7 @@ GNUNET_NAT_mini_get_external_ipv4_cancel (struct GNUNET_NAT_ExternalHandle *eh) } if (NULL != eh->opipe) GNUNET_DISK_pipe_close (eh->opipe); - if (GNUNET_SCHEDULER_NO_TASK != eh->task) + if (NULL != eh->task) GNUNET_SCHEDULER_cancel (eh->task); GNUNET_free (eh); } @@ -300,7 +300,7 @@ struct GNUNET_NAT_MiniHandle * We check the mapping periodically to see if it * still works. This task triggers the check. */ - GNUNET_SCHEDULER_TaskIdentifier refresh_task; + struct GNUNET_SCHEDULER_Task * refresh_task; /** * Are we mapping TCP or UDP? @@ -543,7 +543,7 @@ process_map_output (void *cls, GNUNET_SYSERR, NULL, 0, GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED); - if (GNUNET_SCHEDULER_NO_TASK == mini->refresh_task) + if (NULL == mini->refresh_task) mini->refresh_task = GNUNET_SCHEDULER_add_delayed (MAP_REFRESH_FREQ, &do_refresh, mini); return; @@ -664,10 +664,10 @@ GNUNET_NAT_mini_map_stop (struct GNUNET_NAT_MiniHandle *mini) { char pstr[6]; - if (GNUNET_SCHEDULER_NO_TASK != mini->refresh_task) + if (NULL != mini->refresh_task) { GNUNET_SCHEDULER_cancel (mini->refresh_task); - mini->refresh_task = GNUNET_SCHEDULER_NO_TASK; + mini->refresh_task = NULL; } if (NULL != mini->refresh_cmd) { diff --git a/src/nat/nat_test.c b/src/nat/nat_test.c index b96ee60ed1..33fbb10705 100644 --- a/src/nat/nat_test.c +++ b/src/nat/nat_test.c @@ -60,7 +60,7 @@ struct NatActivity /** * Task reading from the incoming connection. */ - GNUNET_SCHEDULER_TaskIdentifier rtask; + struct GNUNET_SCHEDULER_Task * rtask; }; @@ -141,12 +141,12 @@ struct GNUNET_NAT_Test /** * Identity of task for the listen socket (if any) */ - GNUNET_SCHEDULER_TaskIdentifier ltask; + struct GNUNET_SCHEDULER_Task * ltask; /** * Task identifier for the timeout (if any) */ - GNUNET_SCHEDULER_TaskIdentifier ttask; + struct GNUNET_SCHEDULER_Task * ttask; /** * GNUNET_YES if we're testing TCP @@ -250,7 +250,7 @@ do_read (void *cls, struct GNUNET_NAT_Test *tst; uint16_t data; - na->rtask = GNUNET_SCHEDULER_NO_TASK; + na->rtask = NULL; tst = na->h; GNUNET_CONTAINER_DLL_remove (tst->na_head, tst->na_tail, na); if ((NULL != tc->write_ready) && @@ -287,7 +287,7 @@ do_accept (void *cls, struct GNUNET_NETWORK_Handle *s; struct NatActivity *wl; - tst->ltask = GNUNET_SCHEDULER_NO_TASK; + tst->ltask = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; tst->ltask = @@ -386,7 +386,7 @@ do_timeout (void *cls, { struct GNUNET_NAT_Test *nh = cls; - nh->ttask = GNUNET_SCHEDULER_NO_TASK; + nh->ttask = NULL; nh->report (nh->report_cls, (GNUNET_NAT_ERROR_SUCCESS == nh->status) ? GNUNET_NAT_ERROR_TIMEOUT @@ -495,10 +495,10 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, { LOG (GNUNET_ERROR_TYPE_ERROR, _("NAT test failed to start NAT library\n")); - if (GNUNET_SCHEDULER_NO_TASK != nh->ltask) + if (NULL != nh->ltask) { GNUNET_SCHEDULER_cancel (nh->ltask); - nh->ltask = GNUNET_SCHEDULER_NO_TASK; + nh->ltask = NULL; } if (NULL != nh->lsock) { @@ -541,9 +541,9 @@ GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst) GNUNET_NETWORK_socket_close (pos->sock); GNUNET_free (pos); } - if (GNUNET_SCHEDULER_NO_TASK != tst->ttask) + if (NULL != tst->ttask) GNUNET_SCHEDULER_cancel (tst->ttask); - if (GNUNET_SCHEDULER_NO_TASK != tst->ltask) + if (NULL != tst->ltask) GNUNET_SCHEDULER_cancel (tst->ltask); if (NULL != tst->lsock) GNUNET_NETWORK_socket_close (tst->lsock); diff --git a/src/nat/test_nat_test.c b/src/nat/test_nat_test.c index d32015b560..a5e6ba2098 100644 --- a/src/nat/test_nat_test.c +++ b/src/nat/test_nat_test.c @@ -36,7 +36,7 @@ static int ret = 1; static struct GNUNET_NAT_Test *tst; -static GNUNET_SCHEDULER_TaskIdentifier tsk; +static struct GNUNET_SCHEDULER_Task * tsk; static void @@ -54,7 +54,7 @@ report_result (void *cls, GNUNET_NAT_test_stop (tst); tst = NULL; GNUNET_SCHEDULER_cancel (tsk); - tsk = GNUNET_SCHEDULER_NO_TASK; + tsk = NULL; } @@ -62,7 +62,7 @@ static void failed_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - tsk = GNUNET_SCHEDULER_NO_TASK; + tsk = NULL; fprintf (stderr, "NAT test failed to terminate on timeout\n"); ret = 2; diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c index 3e39056be6..bdba7bbafd 100644 --- a/src/nse/gnunet-nse-profiler.c +++ b/src/nse/gnunet-nse-profiler.c @@ -179,7 +179,7 @@ static struct GNUNET_CONFIGURATION_Handle *testing_cfg; /** * The shutdown task */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task_id; +static struct GNUNET_SCHEDULER_Task * shutdown_task_id; /** * Maximum number of connections to NSE services. @@ -270,7 +270,7 @@ close_monitor_connections () static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - shutdown_task_id = GNUNET_SCHEDULER_NO_TASK; + shutdown_task_id = NULL; if (GNUNET_YES == shutting_down) return; shutting_down = GNUNET_YES; @@ -298,7 +298,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void shutdown_now () { - if (GNUNET_SCHEDULER_NO_TASK != shutdown_task_id) + if (NULL != shutdown_task_id) GNUNET_SCHEDULER_cancel (shutdown_task_id); shutdown_task_id = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); } diff --git a/src/nse/gnunet-nse.c b/src/nse/gnunet-nse.c index ec2ad26d37..8fb5afde3e 100644 --- a/src/nse/gnunet-nse.c +++ b/src/nse/gnunet-nse.c @@ -45,7 +45,7 @@ static struct GNUNET_CLIENT_TestHandle *test; /** * Shutdown task */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * The program status; 0 for success. @@ -62,7 +62,7 @@ static int status; static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - shutdown_task = GNUNET_SCHEDULER_NO_TASK; + shutdown_task = NULL; if (NULL != test) GNUNET_CLIENT_service_test_cancel (test); if (NULL != nse) diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 317750b70a..e83e94eb07 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c @@ -130,7 +130,7 @@ struct NSEPeerEntry /** * Task scheduled to send message to this peer. */ - GNUNET_SCHEDULER_TaskIdentifier transmit_task; + struct GNUNET_SCHEDULER_Task * transmit_task; /** * Did we receive or send a message about the previous round @@ -275,12 +275,12 @@ static unsigned int estimate_count; /** * Task scheduled to update our flood message for the next round. */ -static GNUNET_SCHEDULER_TaskIdentifier flood_task; +static struct GNUNET_SCHEDULER_Task * flood_task; /** * Task scheduled to compute our proof. */ -static GNUNET_SCHEDULER_TaskIdentifier proof_task; +static struct GNUNET_SCHEDULER_Task * proof_task; /** * Notification context, simplifies client broadcasts. @@ -635,7 +635,7 @@ transmit_ready (void *cls, peer_entry); } if ((0 == ntohl (size_estimate_messages[idx].hop_count)) && - (GNUNET_SCHEDULER_NO_TASK != proof_task)) + (NULL != proof_task)) { GNUNET_STATISTICS_update (stats, "# flood messages not generated (no proof yet)", @@ -681,7 +681,7 @@ transmit_task_cb (void *cls, { struct NSEPeerEntry *peer_entry = cls; - peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; + peer_entry->transmit_task = NULL; GNUNET_assert (NULL == peer_entry->th); peer_entry->th = @@ -772,7 +772,7 @@ schedule_current_round (void *cls, peer_entry->previous_round = GNUNET_NO; return GNUNET_OK; } - if (GNUNET_SCHEDULER_NO_TASK != peer_entry->transmit_task) + if (NULL != peer_entry->transmit_task) { GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); peer_entry->previous_round = GNUNET_NO; @@ -806,7 +806,7 @@ update_flood_message (void *cls, struct GNUNET_TIME_Relative offset; unsigned int i; - flood_task = GNUNET_SCHEDULER_NO_TASK; + flood_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; offset = GNUNET_TIME_absolute_get_remaining (next_timestamp); @@ -931,7 +931,7 @@ find_proof (void *cls, struct GNUNET_HashCode result; unsigned int i; - proof_task = GNUNET_SCHEDULER_NO_TASK; + proof_task = NULL; memcpy (&buf[sizeof (uint64_t)], &my_identity, sizeof (struct GNUNET_PeerIdentity)); i = 0; @@ -1034,17 +1034,17 @@ update_flood_times (void *cls, { /* still stuck in previous round, no point to update, check that * we are active here though... */ - if ( (GNUNET_SCHEDULER_NO_TASK == peer_entry->transmit_task) && + if ( (NULL == peer_entry->transmit_task) && (NULL == peer_entry->th) ) { GNUNET_break (0); } return GNUNET_OK; } - if (GNUNET_SCHEDULER_NO_TASK != peer_entry->transmit_task) + if (NULL != peer_entry->transmit_task) { GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); - peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; + peer_entry->transmit_task = NULL; } delay = get_transmit_delay (0); peer_entry->transmit_task = @@ -1169,10 +1169,10 @@ handle_p2p_size_estimate (void *cls, } /* got up-to-date information for current round, cancel transmission to * this peer altogether */ - if (GNUNET_SCHEDULER_NO_TASK != peer_entry->transmit_task) + if (NULL != peer_entry->transmit_task) { GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); - peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; + peer_entry->transmit_task = NULL; } if (NULL != peer_entry->th) { @@ -1189,7 +1189,7 @@ handle_p2p_size_estimate (void *cls, /* push back our result now, that peer is spreading bad information... */ if (NULL == peer_entry->th) { - if (peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK) + if (peer_entry->transmit_task != NULL) GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); peer_entry->transmit_task = GNUNET_SCHEDULER_add_now (&transmit_task_cb, peer_entry); @@ -1214,10 +1214,10 @@ handle_p2p_size_estimate (void *cls, if (idx == estimate_index) { /* cancel any activity for current round */ - if (peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK) + if (peer_entry->transmit_task != NULL) { GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); - peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; + peer_entry->transmit_task = NULL; } if (peer_entry->th != NULL) { @@ -1303,9 +1303,9 @@ handle_core_disconnect (void *cls, GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (peers, peer, pos)); - if (pos->transmit_task != GNUNET_SCHEDULER_NO_TASK) { + if (pos->transmit_task != NULL) { GNUNET_SCHEDULER_cancel (pos->transmit_task); - pos->transmit_task = GNUNET_SCHEDULER_NO_TASK; + pos->transmit_task = NULL; } if (NULL != pos->th) { @@ -1345,15 +1345,15 @@ static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - if (GNUNET_SCHEDULER_NO_TASK != flood_task) + if (NULL != flood_task) { GNUNET_SCHEDULER_cancel (flood_task); - flood_task = GNUNET_SCHEDULER_NO_TASK; + flood_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != proof_task) + if (NULL != proof_task) { GNUNET_SCHEDULER_cancel (proof_task); - proof_task = GNUNET_SCHEDULER_NO_TASK; + proof_task = NULL; write_proof (); /* remember progress */ } if (NULL != nc) diff --git a/src/nse/nse_api.c b/src/nse/nse_api.c index bc927f4814..edd05b71a2 100644 --- a/src/nse/nse_api.c +++ b/src/nse/nse_api.c @@ -57,7 +57,7 @@ struct GNUNET_NSE_Handle /** * Task doing exponential back-off trying to reconnect. */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Time for next connect retry. @@ -133,7 +133,7 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg) static void reschedule_connect (struct GNUNET_NSE_Handle *h) { - GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK); + GNUNET_assert (h->reconnect_task == NULL); if (NULL != h->th) { @@ -206,7 +206,7 @@ reconnect (void *cls, { struct GNUNET_NSE_Handle *h = cls; - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to network size estimation service.\n"); GNUNET_assert (NULL == h->client); @@ -256,10 +256,10 @@ void GNUNET_NSE_disconnect (struct GNUNET_NSE_Handle *h) { GNUNET_assert (NULL != h); - if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK) + if (h->reconnect_task != NULL) { GNUNET_SCHEDULER_cancel (h->reconnect_task); - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; } if (NULL != h->th) { diff --git a/src/nse/test_nse_api.c b/src/nse/test_nse_api.c index 324d4ff167..5eff16c79b 100644 --- a/src/nse/test_nse_api.c +++ b/src/nse/test_nse_api.c @@ -29,7 +29,7 @@ static struct GNUNET_NSE_Handle *h; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** @@ -69,7 +69,7 @@ check_nse_message (void *cls, struct GNUNET_TIME_Absolute timestamp, estimate, std_dev); /* Fantastic check below. Expect NaN, the only thing not equal to itself. */ (*ok) = 0; - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_test, NULL); } diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c index b00333d2c4..05ae99e8d3 100644 --- a/src/peerinfo-tool/gnunet-peerinfo.c +++ b/src/peerinfo-tool/gnunet-peerinfo.c @@ -175,7 +175,7 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; /** * Main state machine task (if active). */ -static GNUNET_SCHEDULER_TaskIdentifier tt; +static struct GNUNET_SCHEDULER_Task * tt; /** * Pending #GNUNET_TRANSPORT_get_hello() operation. @@ -626,10 +626,10 @@ shutdown_task (void *cls, GNUNET_PEERINFO_add_peer_cancel (ac); ac = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != tt) + if (NULL != tt) { GNUNET_SCHEDULER_cancel (tt); - tt = GNUNET_SCHEDULER_NO_TASK; + tt = NULL; } if (NULL != pic) { @@ -806,7 +806,7 @@ static void state_machine (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - tt = GNUNET_SCHEDULER_NO_TASK; + tt = NULL; if (NULL != put_uri) { diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index 20042f8e3e..e2539bd556 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c @@ -110,7 +110,7 @@ struct GNUNET_PEERINFO_IteratorContext /** * Task responsible for timeout. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Timeout for the operation. @@ -179,7 +179,7 @@ struct GNUNET_PEERINFO_Handle /** * ID for a reconnect task. */ - GNUNET_SCHEDULER_TaskIdentifier r_task; + struct GNUNET_SCHEDULER_Task * r_task; /** * Are we now receiving? @@ -247,10 +247,10 @@ GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h) GNUNET_CLIENT_disconnect (h->client); h->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->r_task) + if (NULL != h->r_task) { GNUNET_SCHEDULER_cancel (h->r_task); - h->r_task = GNUNET_SCHEDULER_NO_TASK; + h->r_task = NULL; } GNUNET_free (h); } @@ -287,7 +287,7 @@ reconnect_task (void *cls, { struct GNUNET_PEERINFO_Handle *h = cls; - h->r_task = GNUNET_SCHEDULER_NO_TASK; + h->r_task = NULL; reconnect (h); } @@ -300,10 +300,10 @@ reconnect_task (void *cls, static void reconnect (struct GNUNET_PEERINFO_Handle *h) { - if (GNUNET_SCHEDULER_NO_TASK != h->r_task) + if (NULL != h->r_task) { GNUNET_SCHEDULER_cancel (h->r_task); - h->r_task = GNUNET_SCHEDULER_NO_TASK; + h->r_task = NULL; } if (NULL != h->th) { @@ -709,7 +709,7 @@ signal_timeout (void *cls, GNUNET_PEERINFO_Processor cb; void *cb_cls; - ic->timeout_task = GNUNET_SCHEDULER_NO_TASK; + ic->timeout_task = NULL; cb = ic->callback; cb_cls = ic->callback_cls; GNUNET_PEERINFO_iterate_cancel (ic); @@ -811,10 +811,10 @@ GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic) struct GNUNET_PEERINFO_Handle *h; h = ic->h; - if (GNUNET_SCHEDULER_NO_TASK != ic->timeout_task) + if (NULL != ic->timeout_task) { GNUNET_SCHEDULER_cancel (ic->timeout_task); - ic->timeout_task = GNUNET_SCHEDULER_NO_TASK; + ic->timeout_task = NULL; } ic->callback = NULL; if (GNUNET_YES == ic->request_transmitted) diff --git a/src/peerinfo/peerinfo_api_notify.c b/src/peerinfo/peerinfo_api_notify.c index af41b08f95..aaa62588ea 100644 --- a/src/peerinfo/peerinfo_api_notify.c +++ b/src/peerinfo/peerinfo_api_notify.c @@ -66,7 +66,7 @@ struct GNUNET_PEERINFO_NotifyContext /** * Tasked used for delayed re-connection attempt. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * Include friend only HELLOs in callbacks @@ -107,7 +107,7 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_PEERINFO_NotifyContext *nc = cls; - nc->task = GNUNET_SCHEDULER_NO_TASK; + nc->task = NULL; nc->client = GNUNET_CLIENT_connect ("peerinfo", nc->cfg); if (NULL == nc->client) { @@ -295,7 +295,7 @@ GNUNET_PEERINFO_notify_cancel (struct GNUNET_PEERINFO_NotifyContext *nc) } if (NULL != nc->client) GNUNET_CLIENT_disconnect (nc->client); - if (GNUNET_SCHEDULER_NO_TASK != nc->task) + if (NULL != nc->task) GNUNET_SCHEDULER_cancel (nc->task); GNUNET_free (nc); } diff --git a/src/peerinfo/test_peerinfo_api_notify_friend_only.c b/src/peerinfo/test_peerinfo_api_notify_friend_only.c index c47fe63877..0b252621e9 100644 --- a/src/peerinfo/test_peerinfo_api_notify_friend_only.c +++ b/src/peerinfo/test_peerinfo_api_notify_friend_only.c @@ -58,12 +58,12 @@ static int res_cb_wo_fo; struct GNUNET_PeerIdentity pid; -GNUNET_SCHEDULER_TaskIdentifier timeout_task; +struct GNUNET_SCHEDULER_Task * timeout_task; static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; GNUNET_break(0); if (NULL != pnc_wo_fo) { @@ -95,10 +95,10 @@ done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_PEERINFO_disconnect (h); h = NULL; - if (GNUNET_SCHEDULER_NO_TASK != timeout_task) + if (NULL != timeout_task) { GNUNET_SCHEDULER_cancel (timeout_task); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; } if ((GNUNET_YES == res_cb_w_fo) && (GNUNET_NO == res_cb_wo_fo)) diff --git a/src/peerstore/peerstore_api.c b/src/peerstore/peerstore_api.c index 39f37b0229..2138b23ff3 100644 --- a/src/peerstore/peerstore_api.c +++ b/src/peerstore/peerstore_api.c @@ -213,7 +213,7 @@ struct GNUNET_PEERSTORE_IterateContext * Task identifier for the function called * on iterate request timeout */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; }; @@ -367,7 +367,7 @@ iterate_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_PEERSTORE_Processor callback; void *callback_cls; - ic->timeout_task = GNUNET_SCHEDULER_NO_TASK; + ic->timeout_task = NULL; callback = ic->callback; callback_cls = ic->callback_cls; GNUNET_PEERSTORE_iterate_cancel (ic); @@ -729,10 +729,10 @@ handle_iterate_result (void *cls, const struct GNUNET_MessageHeader *msg) void GNUNET_PEERSTORE_iterate_cancel (struct GNUNET_PEERSTORE_IterateContext *ic) { - if (GNUNET_SCHEDULER_NO_TASK != ic->timeout_task) + if (NULL != ic->timeout_task) { GNUNET_SCHEDULER_cancel (ic->timeout_task); - ic->timeout_task = GNUNET_SCHEDULER_NO_TASK; + ic->timeout_task = NULL; } if (GNUNET_NO == ic->iterating) { diff --git a/src/psyc/test_psyc.c b/src/psyc/test_psyc.c index 134ba8cb78..02b6d3d9a4 100644 --- a/src/psyc/test_psyc.c +++ b/src/psyc/test_psyc.c @@ -52,7 +52,7 @@ struct GNUNET_PeerIdentity this_peer; /** * Handle for task for timeout termination. */ -GNUNET_SCHEDULER_TaskIdentifier end_badly_task; +struct GNUNET_SCHEDULER_Task * end_badly_task; struct GNUNET_PSYC_Master *mst; struct GNUNET_PSYC_Slave *slv; @@ -187,10 +187,10 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending tests.\n"); - if (end_badly_task != GNUNET_SCHEDULER_NO_TASK) + if (end_badly_task != NULL) { GNUNET_SCHEDULER_cancel (end_badly_task); - end_badly_task = GNUNET_SCHEDULER_NO_TASK; + end_badly_task = NULL; } GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, &end_normally, NULL); diff --git a/src/psycstore/psycstore_api.c b/src/psycstore/psycstore_api.c index 9ef1fb61af..7b71c9d3ad 100644 --- a/src/psycstore/psycstore_api.c +++ b/src/psycstore/psycstore_api.c @@ -131,7 +131,7 @@ struct GNUNET_PSYCSTORE_Handle /** * Task doing exponential back-off trying to reconnect. */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Time for next connect retry. @@ -200,7 +200,7 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); static void reschedule_connect (struct GNUNET_PSYCSTORE_Handle *h) { - GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK); + GNUNET_assert (h->reconnect_task == NULL); if (NULL != h->th) { @@ -545,7 +545,7 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_PSYCSTORE_Handle *h = cls; - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to PSYCstore service.\n"); GNUNET_assert (NULL == h->client); @@ -582,10 +582,10 @@ void GNUNET_PSYCSTORE_disconnect (struct GNUNET_PSYCSTORE_Handle *h) { GNUNET_assert (NULL != h); - if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK) + if (h->reconnect_task != NULL) { GNUNET_SCHEDULER_cancel (h->reconnect_task); - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; } if (NULL != h->th) { diff --git a/src/psycstore/test_psycstore.c b/src/psycstore/test_psycstore.c index 125e64f582..8ece3c1b75 100644 --- a/src/psycstore/test_psycstore.c +++ b/src/psycstore/test_psycstore.c @@ -54,7 +54,7 @@ static struct GNUNET_PSYCSTORE_OperationHandle *op; /** * Handle for task for timeout termination. */ -static GNUNET_SCHEDULER_TaskIdentifier end_badly_task; +static struct GNUNET_SCHEDULER_Task * end_badly_task; static struct GNUNET_CRYPTO_EddsaPrivateKey *channel_key; static struct GNUNET_CRYPTO_EcdsaPrivateKey *slave_key; @@ -143,10 +143,10 @@ end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end () { - if (end_badly_task != GNUNET_SCHEDULER_NO_TASK) + if (end_badly_task != NULL) { GNUNET_SCHEDULER_cancel (end_badly_task); - end_badly_task = GNUNET_SCHEDULER_NO_TASK; + end_badly_task = NULL; } GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, &end_normally, NULL); diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c index 832d51d637..72fef144a8 100644 --- a/src/pt/gnunet-daemon-pt.c +++ b/src/pt/gnunet-daemon-pt.c @@ -228,7 +228,7 @@ struct RequestContext /** * Task used to abort this operation with timeout. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Length of the request message that follows this struct. diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c index eaf94dfa73..e9c89b42a9 100644 --- a/src/pt/test_gns_vpn.c +++ b/src/pt/test_gns_vpn.c @@ -45,9 +45,9 @@ static struct GNUNET_NAMESTORE_Handle *namestore; static struct MHD_Daemon *mhd; -static GNUNET_SCHEDULER_TaskIdentifier mhd_task_id; +static struct GNUNET_SCHEDULER_Task * mhd_task_id; -static GNUNET_SCHEDULER_TaskIdentifier curl_task_id; +static struct GNUNET_SCHEDULER_Task * curl_task_id; static CURL *curl; @@ -131,15 +131,15 @@ mhd_ahc (void *cls, static void do_shutdown () { - if (mhd_task_id != GNUNET_SCHEDULER_NO_TASK) + if (mhd_task_id != NULL) { GNUNET_SCHEDULER_cancel (mhd_task_id); - mhd_task_id = GNUNET_SCHEDULER_NO_TASK; + mhd_task_id = NULL; } - if (curl_task_id != GNUNET_SCHEDULER_NO_TASK) + if (curl_task_id != NULL) { GNUNET_SCHEDULER_cancel (curl_task_id); - curl_task_id = GNUNET_SCHEDULER_NO_TASK; + curl_task_id = NULL; } if (NULL != mhd) { @@ -162,7 +162,7 @@ static void curl_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - curl_task_id = GNUNET_SCHEDULER_NO_TASK; + curl_task_id = NULL; curl_main (); } @@ -311,7 +311,7 @@ static void mhd_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - mhd_task_id = GNUNET_SCHEDULER_NO_TASK; + mhd_task_id = NULL; MHD_run (mhd); mhd_main (); } @@ -329,7 +329,7 @@ mhd_main () unsigned MHD_LONG_LONG timeout; struct GNUNET_TIME_Relative delay; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == mhd_task_id); + GNUNET_assert (NULL == mhd_task_id); FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); diff --git a/src/pt/test_gnunet_vpn.c b/src/pt/test_gnunet_vpn.c index 7e83fdcd11..ce6fbdd530 100644 --- a/src/pt/test_gnunet_vpn.c +++ b/src/pt/test_gnunet_vpn.c @@ -43,11 +43,11 @@ static struct GNUNET_VPN_Handle *vpn; static struct MHD_Daemon *mhd; -static GNUNET_SCHEDULER_TaskIdentifier mhd_task_id; +static struct GNUNET_SCHEDULER_Task * mhd_task_id; -static GNUNET_SCHEDULER_TaskIdentifier curl_task_id; +static struct GNUNET_SCHEDULER_Task * curl_task_id; -static GNUNET_SCHEDULER_TaskIdentifier ctrl_c_task_id; +static struct GNUNET_SCHEDULER_Task * ctrl_c_task_id; static struct GNUNET_VPN_RedirectionRequest *rr; @@ -128,20 +128,20 @@ mhd_ahc (void *cls, struct MHD_Connection *connection, const char *url, static void do_shutdown () { - if (mhd_task_id != GNUNET_SCHEDULER_NO_TASK) + if (mhd_task_id != NULL) { GNUNET_SCHEDULER_cancel (mhd_task_id); - mhd_task_id = GNUNET_SCHEDULER_NO_TASK; + mhd_task_id = NULL; } - if (curl_task_id != GNUNET_SCHEDULER_NO_TASK) + if (curl_task_id != NULL) { GNUNET_SCHEDULER_cancel (curl_task_id); - curl_task_id = GNUNET_SCHEDULER_NO_TASK; + curl_task_id = NULL; } - if (ctrl_c_task_id != GNUNET_SCHEDULER_NO_TASK) + if (ctrl_c_task_id != NULL) { GNUNET_SCHEDULER_cancel (ctrl_c_task_id); - ctrl_c_task_id = GNUNET_SCHEDULER_NO_TASK; + ctrl_c_task_id = NULL; } if (NULL != mhd) { @@ -173,7 +173,7 @@ curl_main (void); static void curl_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - curl_task_id = GNUNET_SCHEDULER_NO_TASK; + curl_task_id = NULL; curl_main (); } @@ -301,7 +301,7 @@ mhd_main (void); static void mhd_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - mhd_task_id = GNUNET_SCHEDULER_NO_TASK; + mhd_task_id = NULL; MHD_run (mhd); mhd_main (); } @@ -310,7 +310,7 @@ mhd_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void ctrl_c_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - ctrl_c_task_id = GNUNET_SCHEDULER_NO_TASK; + ctrl_c_task_id = NULL; do_shutdown (); GNUNET_break (0); global_ret = 1; @@ -329,7 +329,7 @@ mhd_main () unsigned MHD_LONG_LONG timeout; struct GNUNET_TIME_Relative delay; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == mhd_task_id); + GNUNET_assert (NULL == mhd_task_id); FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c index 3d6624cb8f..6831a850c5 100644 --- a/src/regex/gnunet-daemon-regexprofiler.c +++ b/src/regex/gnunet-daemon-regexprofiler.c @@ -62,7 +62,7 @@ static struct REGEX_INTERNAL_Announcement *announce_handle; /** * Periodically reannounce regex. */ -static GNUNET_SCHEDULER_TaskIdentifier reannounce_task; +static struct GNUNET_SCHEDULER_Task * reannounce_task; /** * What's the maximum reannounce period. @@ -145,7 +145,7 @@ reannounce_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_TIME_Relative random_delay; char *regex = cls; - reannounce_task = GNUNET_SCHEDULER_NO_TASK; + reannounce_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { GNUNET_free (regex); @@ -208,7 +208,7 @@ announce_regex (const char * regex) GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Daemon for %s starting\n", policy_filename); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == reannounce_task); + GNUNET_assert (NULL == reannounce_task); copy = GNUNET_strdup (regex); reannounce_task = GNUNET_SCHEDULER_add_now (reannounce_regex, (void *) copy); } diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c index 5a7cb9acdf..0e87565c46 100644 --- a/src/regex/gnunet-regex-profiler.c +++ b/src/regex/gnunet-regex-profiler.c @@ -170,7 +170,7 @@ struct RegexPeer /** * Operation timeout */ - GNUNET_SCHEDULER_TaskIdentifier timeout; + struct GNUNET_SCHEDULER_Task * timeout; /** * Deamon start @@ -211,17 +211,17 @@ static struct GNUNET_CONFIGURATION_Handle *cfg; /** * Abort task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; /** * Shutdown task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Host registration task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier register_hosts_task; +static struct GNUNET_SCHEDULER_Task * register_hosts_task; /** * Global event mask for all testbed events @@ -296,7 +296,7 @@ static unsigned int next_search; /** * Search timeout task identifier. */ -static GNUNET_SCHEDULER_TaskIdentifier search_timeout_task; +static struct GNUNET_SCHEDULER_Task * search_timeout_task; /** * Search timeout in seconds. @@ -410,10 +410,10 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) char output_buffer[512]; size_t size; - shutdown_task = GNUNET_SCHEDULER_NO_TASK; - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + shutdown_task = NULL; + if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); - if (GNUNET_SCHEDULER_NO_TASK != register_hosts_task) + if (NULL != register_hosts_task) GNUNET_SCHEDULER_cancel (register_hosts_task); for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++) @@ -479,9 +479,9 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) unsigned long i = (unsigned long) cls; GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Aborting from line %lu...\n", i); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; result = GNUNET_SYSERR; - if (GNUNET_SCHEDULER_NO_TASK != shutdown_task) + if (NULL != shutdown_task) GNUNET_SCHEDULER_cancel (shutdown_task); shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); } @@ -734,10 +734,10 @@ regex_found_handler (void *cls, strings_found++; parallel_searches--; - if (GNUNET_SCHEDULER_NO_TASK != peer->timeout) + if (NULL != peer->timeout) { GNUNET_SCHEDULER_cancel (peer->timeout); - peer->timeout = GNUNET_SCHEDULER_NO_TASK; + peer->timeout = NULL; if (GNUNET_NO == in_shutdown) GNUNET_SCHEDULER_add_now (&announce_next_regex, NULL); } @@ -791,10 +791,10 @@ regex_found_handler (void *cls, "All strings successfully matched in %s\n", GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); - if (GNUNET_SCHEDULER_NO_TASK != search_timeout_task) + if (NULL != search_timeout_task) { GNUNET_SCHEDULER_cancel (search_timeout_task); - search_timeout_task = GNUNET_SCHEDULER_NO_TASK; + search_timeout_task = NULL; } GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Collecting stats.\n"); @@ -853,7 +853,7 @@ find_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct RegexPeer *p = cls; - p->timeout = GNUNET_SCHEDULER_NO_TASK; + p->timeout = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -996,7 +996,7 @@ announce_next_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (strings_found != num_peers) { struct GNUNET_TIME_Relative new_delay; - if (GNUNET_SCHEDULER_NO_TASK != search_timeout_task) + if (NULL != search_timeout_task) GNUNET_SCHEDULER_cancel (search_timeout_task); new_delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15); search_timeout_task = GNUNET_SCHEDULER_add_delayed (new_delay, @@ -1130,10 +1130,10 @@ test_master (void *cls, "Testbed started in %s\n", GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + if (NULL != abort_task) { GNUNET_SCHEDULER_cancel (abort_task); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; } for (i = 0; i < num_peers; i++) diff --git a/src/regex/gnunet-regex-simulation-profiler.c b/src/regex/gnunet-regex-simulation-profiler.c index f001080110..9c25678954 100644 --- a/src/regex/gnunet-regex-simulation-profiler.c +++ b/src/regex/gnunet-regex-simulation-profiler.c @@ -91,17 +91,17 @@ static struct ProgressMeter *meter; /** * Abort task identifier. */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; /** * Shutdown task identifier. */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Scan task identifier; */ -static GNUNET_SCHEDULER_TaskIdentifier scan_task; +static struct GNUNET_SCHEDULER_Task * scan_task; /** * Global testing status. @@ -276,8 +276,8 @@ free_meter (struct ProgressMeter *meter) static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - shutdown_task = GNUNET_SCHEDULER_NO_TASK; - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + shutdown_task = NULL; + if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); if (NULL != mysql_ctx) GNUNET_MYSQL_context_destroy (mysql_ctx); @@ -298,9 +298,9 @@ static void do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Aborting\n"); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; GNUNET_SCHEDULER_cancel (scan_task); - scan_task = GNUNET_SCHEDULER_NO_TASK; + scan_task = NULL; result = GNUNET_SYSERR; GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); } diff --git a/src/regex/gnunet-service-regex.c b/src/regex/gnunet-service-regex.c index 6daab0be3b..419829cc1b 100644 --- a/src/regex/gnunet-service-regex.c +++ b/src/regex/gnunet-service-regex.c @@ -69,7 +69,7 @@ struct ClientEntry /** * Task for re-announcing. */ - GNUNET_SCHEDULER_TaskIdentifier refresh_task; + struct GNUNET_SCHEDULER_Task * refresh_task; }; @@ -143,10 +143,10 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) nx = ce->next; if (ce->client == client) { - if (GNUNET_SCHEDULER_NO_TASK != ce->refresh_task) + if (NULL != ce->refresh_task) { GNUNET_SCHEDULER_cancel (ce->refresh_task); - ce->refresh_task = GNUNET_SCHEDULER_NO_TASK; + ce->refresh_task = NULL; } if (NULL != ce->ah) { diff --git a/src/regex/test_regex_api.c b/src/regex/test_regex_api.c index a35934c9cd..1603d19faa 100644 --- a/src/regex/test_regex_api.c +++ b/src/regex/test_regex_api.c @@ -45,14 +45,14 @@ static struct GNUNET_REGEX_Search *s; static int ok = 1; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_REGEX_announce_cancel (a); a = NULL; GNUNET_REGEX_search_cancel (s); @@ -64,7 +64,7 @@ end (void *cls, static void end_badly () { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; FPRINTF (stderr, "%s", "Testcase failed (timeout).\n"); GNUNET_REGEX_announce_cancel (a); a = NULL; diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index 8e5f554ed5..ab4069dab3 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c @@ -68,7 +68,7 @@ struct PeerEntry /** * Tasked used to trigger the set union operation. */ - GNUNET_SCHEDULER_TaskIdentifier transmit_task; + struct GNUNET_SCHEDULER_Task * transmit_task; /** * Handle to active set union operation (over revocation sets). @@ -468,7 +468,7 @@ transmit_task_cb (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting set exchange with peer `%s'\n", GNUNET_i2s (&peer_entry->id)); - peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; + peer_entry->transmit_task = NULL; peer_entry->so = GNUNET_SET_prepare (&peer_entry->id, &revocation_set_union_app_id, NULL, @@ -570,10 +570,10 @@ handle_core_disconnect (void *cls, GNUNET_CONTAINER_multipeermap_remove (peers, peer, pos)); GNUNET_MQ_destroy (pos->mq); - if (pos->transmit_task != GNUNET_SCHEDULER_NO_TASK) + if (pos->transmit_task != NULL) { GNUNET_SCHEDULER_cancel (pos->transmit_task); - pos->transmit_task = GNUNET_SCHEDULER_NO_TASK; + pos->transmit_task = NULL; } if (NULL != pos->so) { diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 09ed5de488..e09db5ca67 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -695,7 +695,7 @@ float beta; /** * Identifier for the main task that runs periodically. */ -GNUNET_SCHEDULER_TaskIdentifier do_round_task; +struct GNUNET_SCHEDULER_Task * do_round_task; /** * Time inverval the do_round task runs in. @@ -1318,10 +1318,10 @@ shutdown_task (void *cls, { LOG(GNUNET_ERROR_TYPE_DEBUG, "RPS is going down\n"); - if ( GNUNET_SCHEDULER_NO_TASK != do_round_task ) + if ( NULL != do_round_task ) { GNUNET_SCHEDULER_cancel (do_round_task); - do_round_task = GNUNET_SCHEDULER_NO_TASK; + do_round_task = NULL; } GNUNET_NSE_disconnect(nse); diff --git a/src/sensor/gnunet-sensor-profiler.c b/src/sensor/gnunet-sensor-profiler.c index 21574774d8..74b1fa8a27 100644 --- a/src/sensor/gnunet-sensor-profiler.c +++ b/src/sensor/gnunet-sensor-profiler.c @@ -87,7 +87,7 @@ static const char *sensor_dst_dir = "/tmp/gnunet-sensor-profiler"; /** * Scheduled task to shutdown */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task = GNUNET_SCHEDULER_NO_TASK; +static struct GNUNET_SCHEDULER_Task * shutdown_task = NULL; /** * GNUnet configuration @@ -157,7 +157,7 @@ static unsigned int sensor_names_size = 0; /** * Task run after any waiting period */ -static GNUNET_SCHEDULER_TaskIdentifier delayed_task = GNUNET_SCHEDULER_NO_TASK; +static struct GNUNET_SCHEDULER_Task * delayed_task = NULL; /** @@ -180,10 +180,10 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) int i; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down.\n"); - if (GNUNET_SCHEDULER_NO_TASK != delayed_task) + if (NULL != delayed_task) { GNUNET_SCHEDULER_cancel (delayed_task); - delayed_task = GNUNET_SCHEDULER_NO_TASK; + delayed_task = NULL; } for (i = 0; i < num_peers; i++) { @@ -536,7 +536,7 @@ simulate_anomalies (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) uint32_t an_peer; struct GNUNET_TIME_Relative shutdown_delay; - delayed_task = GNUNET_SCHEDULER_NO_TASK; + delayed_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Training period over, simulating anomalies now.\n"); GNUNET_assert (anomalous_peers <= num_peers); @@ -572,7 +572,7 @@ peers_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) unsigned long long int training_points; struct GNUNET_TIME_Relative training_period; - delayed_task = GNUNET_SCHEDULER_NO_TASK; + delayed_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers are ready.\n"); GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, diff --git a/src/sensor/gnunet-service-sensor_monitoring.c b/src/sensor/gnunet-service-sensor_monitoring.c index 4f1f9472ad..f473c3a75b 100644 --- a/src/sensor/gnunet-service-sensor_monitoring.c +++ b/src/sensor/gnunet-service-sensor_monitoring.c @@ -410,7 +410,7 @@ schedule_sensor (void *cls, const struct GNUNET_HashCode *key, void *value) LOG (GNUNET_ERROR_TYPE_DEBUG, "Scheduling sensor `%s' to run after %" PRIu64 " microseconds\n", sensorinfo->name, sensorinfo->interval.rel_value_us); - if (GNUNET_SCHEDULER_NO_TASK != sensorinfo->execution_task) + if (NULL != sensorinfo->execution_task) { LOG (GNUNET_ERROR_TYPE_ERROR, _("Sensor `%s' execution task already set, this should not happen\n"), diff --git a/src/sensor/gnunet-service-sensor_reporting.c b/src/sensor/gnunet-service-sensor_reporting.c index 8d69836a01..d08d67449f 100644 --- a/src/sensor/gnunet-service-sensor_reporting.c +++ b/src/sensor/gnunet-service-sensor_reporting.c @@ -162,9 +162,9 @@ struct ValueInfo struct GNUNET_PEERSTORE_WatchContext *wc; /** - * Collection point reporting task (or #GNUNET_SCHEDULER_NO_TASK) + * Collection point reporting task (or #NULL) */ - GNUNET_SCHEDULER_TaskIdentifier reporting_task; + struct GNUNET_SCHEDULER_Task * reporting_task; }; @@ -237,7 +237,7 @@ struct CadetPeer /** * Task used to try reconnection to collection point after failure */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Are we currently destroying the channel and its context? @@ -400,10 +400,10 @@ destroy_value_info (struct ValueInfo *vi) GNUNET_PEERSTORE_watch_cancel (vi->wc); vi->wc = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != vi->reporting_task) + if (NULL != vi->reporting_task) { GNUNET_SCHEDULER_cancel (vi->reporting_task); - vi->reporting_task = GNUNET_SCHEDULER_NO_TASK; + vi->reporting_task = NULL; } if (NULL != vi->last_value) { @@ -463,10 +463,10 @@ static void destroy_cadet_peer (struct CadetPeer *cadetp) { cadetp->destroying = GNUNET_YES; - if (GNUNET_SCHEDULER_NO_TASK != cadetp->reconnect_task) + if (NULL != cadetp->reconnect_task) { GNUNET_SCHEDULER_cancel (cadetp->reconnect_task); - cadetp->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + cadetp->reconnect_task = NULL; } if (NULL != cadetp->mq) { @@ -625,7 +625,7 @@ cp_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) LOG (GNUNET_ERROR_TYPE_INFO, "Retrying connection to collection point `%s'.\n", GNUNET_i2s (&cadetp->peer_id)); - cadetp->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + cadetp->reconnect_task = NULL; GNUNET_assert (NULL == cadetp->channel); cadetp->channel = GNUNET_CADET_channel_create (cadet, cadetp, &cadetp->peer_id, @@ -740,7 +740,7 @@ get_cadet_peer (struct GNUNET_PeerIdentity pid) GNUNET_APPLICATION_TYPE_SENSORDASHBOARD, GNUNET_CADET_OPTION_RELIABLE); cadetp->mq = cp_mq_create (cadetp); - cadetp->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + cadetp->reconnect_task = NULL; GNUNET_CONTAINER_DLL_insert (cadetp_head, cadetp_tail, cadetp); return cadetp; } diff --git a/src/sensor/gnunet-service-sensor_update.c b/src/sensor/gnunet-service-sensor_update.c index aa7716f1c3..a6390b6dd0 100644 --- a/src/sensor/gnunet-service-sensor_update.c +++ b/src/sensor/gnunet-service-sensor_update.c @@ -168,7 +168,7 @@ static int updating; /** * GNUnet scheduler task that starts the update check process. */ -static GNUNET_SCHEDULER_TaskIdentifier update_task; +static struct GNUNET_SCHEDULER_Task * update_task; /** * Pointer to service reset function called when we have new sensor updates. @@ -237,10 +237,10 @@ SENSOR_update_stop () up_default = NULL; up = up_head; - if (GNUNET_SCHEDULER_NO_TASK != update_task) + if (NULL != update_task) { GNUNET_SCHEDULER_cancel (update_task); - update_task = GNUNET_SCHEDULER_NO_TASK; + update_task = NULL; } while (NULL != up) { @@ -390,7 +390,7 @@ check_for_updates (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_MessageHeader *msg; size_t msg_size; - update_task = GNUNET_SCHEDULER_NO_TASK; + update_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; if (GNUNET_YES == updating) diff --git a/src/sensor/perf_pow_sign.c b/src/sensor/perf_pow_sign.c index b553544907..d89fe46ef5 100644 --- a/src/sensor/perf_pow_sign.c +++ b/src/sensor/perf_pow_sign.c @@ -71,7 +71,7 @@ static int ok = 1; /** * Task used to shutdown / expire the test */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Message to be exchanged diff --git a/src/sensor/sensor_api.c b/src/sensor/sensor_api.c index 628873f917..8d72d16cbe 100644 --- a/src/sensor/sensor_api.c +++ b/src/sensor/sensor_api.c @@ -121,7 +121,7 @@ struct GNUNET_SENSOR_IterateContext /** * Task responsible for timeout. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; }; @@ -365,7 +365,7 @@ signal_sensor_iteration_timeout (void *cls, GNUNET_SENSOR_SensorIterateCB cb; void *cb_cls; - ic->timeout_task = GNUNET_SCHEDULER_NO_TASK; + ic->timeout_task = NULL; cb = ic->callback; cb_cls = ic->callback_cls; GNUNET_SENSOR_iterate_cancel (ic); @@ -417,10 +417,10 @@ GNUNET_SENSOR_iterate_cancel (struct GNUNET_SENSOR_IterateContext *ic) ic->callback_cls = NULL; return; } - if (GNUNET_SCHEDULER_NO_TASK != ic->timeout_task) + if (NULL != ic->timeout_task) { GNUNET_SCHEDULER_cancel (ic->timeout_task); - ic->timeout_task = GNUNET_SCHEDULER_NO_TASK; + ic->timeout_task = NULL; } GNUNET_CONTAINER_DLL_remove (h->ic_head, h->ic_tail, ic); GNUNET_free (ic); diff --git a/src/sensor/sensor_util_lib.c b/src/sensor/sensor_util_lib.c index fd5337343a..381465d229 100644 --- a/src/sensor/sensor_util_lib.c +++ b/src/sensor/sensor_util_lib.c @@ -274,7 +274,7 @@ load_sensor_from_cfg (struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_free (dummy); } //execution task - sensor->execution_task = GNUNET_SCHEDULER_NO_TASK; + sensor->execution_task = NULL; //running sensor->running = GNUNET_NO; return sensor; @@ -479,10 +479,10 @@ destroy_sensor (void *cls, const struct GNUNET_HashCode *key, void *value) { struct GNUNET_SENSOR_SensorInfo *sensor = value; - if (GNUNET_SCHEDULER_NO_TASK != sensor->execution_task) + if (NULL != sensor->execution_task) { GNUNET_SCHEDULER_cancel (sensor->execution_task); - sensor->execution_task = GNUNET_SCHEDULER_NO_TASK; + sensor->execution_task = NULL; } if (NULL != sensor->gnunet_stat_get_handle) { diff --git a/src/sensor/sensor_util_lib_crypto.c b/src/sensor/sensor_util_lib_crypto.c index 41cba19915..154b7667ce 100644 --- a/src/sensor/sensor_util_lib_crypto.c +++ b/src/sensor/sensor_util_lib_crypto.c @@ -65,7 +65,7 @@ struct GNUNET_SENSOR_crypto_pow_context /** * Task that calculates the proof-of-work */ - GNUNET_SCHEDULER_TaskIdentifier calculate_pow_task; + struct GNUNET_SCHEDULER_Task * calculate_pow_task; /** * Size of msg (allocated after this struct) @@ -157,7 +157,7 @@ calculate_pow (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) cx->matching_bits)) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Found pow %" PRIu64 ".\n", cx->pow); - cx->calculate_pow_task = GNUNET_SCHEDULER_NO_TASK; + cx->calculate_pow_task = NULL; result_block = GNUNET_malloc (sizeof (struct GNUNET_SENSOR_crypto_pow_block) + cx->msg_size); @@ -197,10 +197,10 @@ void GNUNET_SENSOR_crypto_pow_sign_cancel (struct GNUNET_SENSOR_crypto_pow_context *cx) { - if (GNUNET_SCHEDULER_NO_TASK != cx->calculate_pow_task) + if (NULL != cx->calculate_pow_task) { GNUNET_SCHEDULER_cancel (cx->calculate_pow_task); - cx->calculate_pow_task = GNUNET_SCHEDULER_NO_TASK; + cx->calculate_pow_task = NULL; } GNUNET_free (cx); cx = NULL; diff --git a/src/sensor/test_gnunet-service-sensor_reporting.c b/src/sensor/test_gnunet-service-sensor_reporting.c index 4a58647ad9..dd9a2125ae 100644 --- a/src/sensor/test_gnunet-service-sensor_reporting.c +++ b/src/sensor/test_gnunet-service-sensor_reporting.c @@ -89,7 +89,7 @@ struct TestPeer /** * GNUNET scheduler task that forces the anomaly after a stabilization delay */ - GNUNET_SCHEDULER_TaskIdentifier delay_task; + struct GNUNET_SCHEDULER_Task * delay_task; }; @@ -152,7 +152,7 @@ static struct GNUNET_PEERSTORE_Handle *peerstore; /** * Task used to shutdown / expire the test */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Status of the test to be returned by main() @@ -163,10 +163,10 @@ static int ok = 1; static void destroy_peer (struct TestPeer *peer) { - if (GNUNET_SCHEDULER_NO_TASK != peer->delay_task) + if (NULL != peer->delay_task) { GNUNET_SCHEDULER_cancel (peer->delay_task); - peer->delay_task = GNUNET_SCHEDULER_NO_TASK; + peer->delay_task = NULL; } if (NULL != peer->sensor_op) { @@ -280,7 +280,7 @@ force_anomaly_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct TestPeer *peer = cls; - peer->delay_task = GNUNET_SCHEDULER_NO_TASK; + peer->delay_task = NULL; GNUNET_SENSOR_force_anomaly (peer->sensor, (char *) sensor_name, GNUNET_YES, NULL, NULL); } @@ -481,7 +481,7 @@ peer_info_cb (void *cb_cls, struct GNUNET_TESTBED_Operation *op, peer = GNUNET_new (struct TestPeer); peer->testbed_peer = testbed_peer; - peer->delay_task = GNUNET_SCHEDULER_NO_TASK; + peer->delay_task = NULL; GNUNET_CRYPTO_get_peer_identity (pinfo->result.cfg, &peer->peer_id); if (NULL == peer_head) /* First peer (collection point) */ { diff --git a/src/sensor/test_pow_sign.c b/src/sensor/test_pow_sign.c index 71ab6af817..b3039ff25e 100644 --- a/src/sensor/test_pow_sign.c +++ b/src/sensor/test_pow_sign.c @@ -66,7 +66,7 @@ static int ok = 1; /** * Task used to shutdown / expire the test */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Message to be exchanged diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c index 2291bd2f26..dc5a787f64 100644 --- a/src/set/gnunet-service-set.c +++ b/src/set/gnunet-service-set.c @@ -475,10 +475,10 @@ incoming_destroy (struct Operation *incoming) GNUNET_CONTAINER_DLL_remove (incoming_head, incoming_tail, incoming); - if (GNUNET_SCHEDULER_NO_TASK != incoming->timeout_task) + if (NULL != incoming->timeout_task) { GNUNET_SCHEDULER_cancel (incoming->timeout_task); - incoming->timeout_task = GNUNET_SCHEDULER_NO_TASK; + incoming->timeout_task = NULL; } /* make sure that the tunnel end handler will not destroy us again */ incoming->vt = NULL; @@ -543,9 +543,9 @@ incoming_suggest (struct Operation *incoming, incoming->suggest_id = suggest_id++; if (0 == suggest_id) suggest_id++; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != incoming->timeout_task); + GNUNET_assert (NULL != incoming->timeout_task); GNUNET_SCHEDULER_cancel (incoming->timeout_task); - incoming->timeout_task = GNUNET_SCHEDULER_NO_TASK; + incoming->timeout_task = NULL; mqm = GNUNET_MQ_msg_nested_mh (cmsg, GNUNET_MESSAGE_TYPE_SET_REQUEST, incoming->spec->context_msg); @@ -624,7 +624,7 @@ handle_incoming_msg (struct Operation *op, &msg->app_id); if (NULL == listener) { - GNUNET_break (GNUNET_SCHEDULER_NO_TASK != op->timeout_task); + GNUNET_break (NULL != op->timeout_task); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No matching listener for incoming request (op %u, app %s), waiting with timeout\n", ntohl (msg->operation), @@ -1279,7 +1279,7 @@ incoming_timeout_cb (void *cls, { struct Operation *incoming = cls; - incoming->timeout_task = GNUNET_SCHEDULER_NO_TASK; + incoming->timeout_task = NULL; GNUNET_assert (GNUNET_YES == incoming->is_incoming); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; diff --git a/src/set/gnunet-service-set.h b/src/set/gnunet-service-set.h index b2904dc062..d1b957e73f 100644 --- a/src/set/gnunet-service-set.h +++ b/src/set/gnunet-service-set.h @@ -366,7 +366,7 @@ struct Operation * Timeout task, if the incoming peer has not been accepted * after the timeout, it will be disconnected. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Unique request id for the request from a remote peer, sent to the diff --git a/src/set/set_api.c b/src/set/set_api.c index 453a235b20..0327daab19 100644 --- a/src/set/set_api.c +++ b/src/set/set_api.c @@ -204,7 +204,7 @@ struct GNUNET_SET_ListenHandle /** * Task for reconnecting when the listener fails. */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Operation we listen for. @@ -786,7 +786,7 @@ listen_connect (void *cls, "Listener not reconnecting due to shutdown\n"); return; } - lh->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + lh->reconnect_task = NULL; GNUNET_assert (NULL == lh->client); lh->client = GNUNET_CLIENT_connect ("set", lh->cfg); if (NULL == lh->client) @@ -860,10 +860,10 @@ GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh) GNUNET_CLIENT_disconnect (lh->client); lh->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != lh->reconnect_task) + if (NULL != lh->reconnect_task) { GNUNET_SCHEDULER_cancel (lh->reconnect_task); - lh->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + lh->reconnect_task = NULL; } GNUNET_free (lh); } diff --git a/src/social/test_social.c b/src/social/test_social.c index 3205265947..f17892953e 100644 --- a/src/social/test_social.c +++ b/src/social/test_social.c @@ -48,7 +48,7 @@ int res; /** * Handle for task for timeout termination. */ -GNUNET_SCHEDULER_TaskIdentifier end_badly_task; +struct GNUNET_SCHEDULER_Task * end_badly_task; const struct GNUNET_CONFIGURATION_Handle *cfg; @@ -196,10 +196,10 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending tests.\n"); - if (end_badly_task != GNUNET_SCHEDULER_NO_TASK) + if (end_badly_task != NULL) { GNUNET_SCHEDULER_cancel (end_badly_task); - end_badly_task = GNUNET_SCHEDULER_NO_TASK; + end_badly_task = NULL; } GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, &end_normally, NULL); diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c index 52d49308ab..661cca796b 100644 --- a/src/statistics/statistics_api.c +++ b/src/statistics/statistics_api.c @@ -149,7 +149,7 @@ struct GNUNET_STATISTICS_GetHandle /** * Task run on timeout. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Associated value. @@ -230,7 +230,7 @@ struct GNUNET_STATISTICS_Handle /** * Task doing exponential back-off trying to reconnect. */ - GNUNET_SCHEDULER_TaskIdentifier backoff_task; + struct GNUNET_SCHEDULER_Task * backoff_task; /** * Time for next connect retry. @@ -367,10 +367,10 @@ schedule_watch_request (struct GNUNET_STATISTICS_Handle *h, static void free_action_item (struct GNUNET_STATISTICS_GetHandle *gh) { - if (GNUNET_SCHEDULER_NO_TASK != gh->timeout_task) + if (NULL != gh->timeout_task) { GNUNET_SCHEDULER_cancel (gh->timeout_task); - gh->timeout_task = GNUNET_SCHEDULER_NO_TASK; + gh->timeout_task = NULL; } GNUNET_free_non_null (gh->subsystem); GNUNET_free_non_null (gh->name); @@ -426,7 +426,7 @@ try_connect (struct GNUNET_STATISTICS_Handle *h) struct GNUNET_STATISTICS_GetHandle *gn; unsigned int i; - if (GNUNET_SCHEDULER_NO_TASK != h->backoff_task) + if (NULL != h->backoff_task) return GNUNET_NO; if (NULL != h->client) return GNUNET_YES; @@ -470,7 +470,7 @@ reconnect_task (void *cls, { struct GNUNET_STATISTICS_Handle *h = cls; - h->backoff_task = GNUNET_SCHEDULER_NO_TASK; + h->backoff_task = NULL; schedule_action (h); } @@ -502,7 +502,7 @@ reconnect_later (struct GNUNET_STATISTICS_Handle *h) int loss; struct GNUNET_STATISTICS_GetHandle *gh; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->backoff_task); + GNUNET_assert (NULL == h->backoff_task); if (GNUNET_YES == h->do_destroy) { /* So we are shutting down and the service is not reachable. @@ -992,10 +992,10 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, if (NULL == h) return; GNUNET_assert (GNUNET_NO == h->do_destroy); // Don't call twice. - if (GNUNET_SCHEDULER_NO_TASK != h->backoff_task) + if (NULL != h->backoff_task) { GNUNET_SCHEDULER_cancel (h->backoff_task); - h->backoff_task = GNUNET_SCHEDULER_NO_TASK; + h->backoff_task = NULL; } if (sync_first) { @@ -1117,7 +1117,7 @@ schedule_action (struct GNUNET_STATISTICS_Handle *h) struct GNUNET_TIME_Relative timeout; if ( (NULL != h->th) || - (GNUNET_SCHEDULER_NO_TASK != h->backoff_task) ) + (NULL != h->backoff_task) ) return; /* action already pending */ if (GNUNET_YES != try_connect (h)) { @@ -1172,7 +1172,7 @@ run_get_timeout (void *cls, GNUNET_STATISTICS_Callback cont = gh->cont; void *cont_cls = gh->cls; - gh->timeout_task = GNUNET_SCHEDULER_NO_TASK; + gh->timeout_task = NULL; GNUNET_STATISTICS_get_cancel (gh); cont (cont_cls, GNUNET_SYSERR); } @@ -1246,10 +1246,10 @@ GNUNET_STATISTICS_get_cancel (struct GNUNET_STATISTICS_GetHandle *gh) { if (NULL == gh) return; - if (GNUNET_SCHEDULER_NO_TASK != gh->timeout_task) + if (NULL != gh->timeout_task) { GNUNET_SCHEDULER_cancel (gh->timeout_task); - gh->timeout_task = GNUNET_SCHEDULER_NO_TASK; + gh->timeout_task = NULL; } gh->cont = NULL; if (gh->sh->current == gh) diff --git a/src/statistics/test_statistics_api_watch.c b/src/statistics/test_statistics_api_watch.c index 05806ac4be..bd529e3278 100644 --- a/src/statistics/test_statistics_api_watch.c +++ b/src/statistics/test_statistics_api_watch.c @@ -33,7 +33,7 @@ static struct GNUNET_STATISTICS_Handle *h; static struct GNUNET_STATISTICS_Handle *h2; -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; static void diff --git a/src/statistics/test_statistics_api_watch_zero_value.c b/src/statistics/test_statistics_api_watch_zero_value.c index 462c91ebe8..44ac461674 100644 --- a/src/statistics/test_statistics_api_watch_zero_value.c +++ b/src/statistics/test_statistics_api_watch_zero_value.c @@ -33,7 +33,7 @@ static struct GNUNET_STATISTICS_Handle *h; static struct GNUNET_STATISTICS_Handle *h2; -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; static void diff --git a/src/testbed/gnunet-daemon-latency-logger.c b/src/testbed/gnunet-daemon-latency-logger.c index fb9364c280..945cf42f4e 100644 --- a/src/testbed/gnunet-daemon-latency-logger.c +++ b/src/testbed/gnunet-daemon-latency-logger.c @@ -98,7 +98,7 @@ struct sqlite3_stmt *stmt_insert; /** * Shutdown task identifier */ -GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +struct GNUNET_SCHEDULER_Task * shutdown_task; /** @@ -136,7 +136,7 @@ free_iterator (void *cls, static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - shutdown_task = GNUNET_SCHEDULER_NO_TASK; + shutdown_task = NULL; GNUNET_ATS_performance_done (ats); ats = NULL; if (NULL != stmt_insert) diff --git a/src/testbed/gnunet-daemon-testbed-blacklist.c b/src/testbed/gnunet-daemon-testbed-blacklist.c index 95cdda8bda..d437c8c053 100644 --- a/src/testbed/gnunet-daemon-testbed-blacklist.c +++ b/src/testbed/gnunet-daemon-testbed-blacklist.c @@ -72,7 +72,7 @@ struct GNUNET_TRANSPORT_Blacklist *bh; /** * Task for shutdown */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Are we allowing or denying access from peers diff --git a/src/testbed/gnunet-daemon-testbed-underlay.c b/src/testbed/gnunet-daemon-testbed-underlay.c index 59c9331e12..f414192311 100644 --- a/src/testbed/gnunet-daemon-testbed-underlay.c +++ b/src/testbed/gnunet-daemon-testbed-underlay.c @@ -104,7 +104,7 @@ static unsigned int num_hostkeys; /** * Task for shutdown */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** diff --git a/src/testbed/gnunet-helper-testbed.c b/src/testbed/gnunet-helper-testbed.c index 6937d7262e..ccb868e8b9 100644 --- a/src/testbed/gnunet-helper-testbed.c +++ b/src/testbed/gnunet-helper-testbed.c @@ -124,22 +124,22 @@ static struct GNUNET_DISK_PipeHandle *sigpipe; /** * Task identifier for the read task */ -static GNUNET_SCHEDULER_TaskIdentifier read_task_id; +static struct GNUNET_SCHEDULER_Task * read_task_id; /** * Task identifier for the write task */ -static GNUNET_SCHEDULER_TaskIdentifier write_task_id; +static struct GNUNET_SCHEDULER_Task * write_task_id; /** * Task to kill the child */ -static GNUNET_SCHEDULER_TaskIdentifier child_death_task_id; +static struct GNUNET_SCHEDULER_Task * child_death_task_id; /** * shutdown task id */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task_id; +static struct GNUNET_SCHEDULER_Task * shutdown_task_id; /** * Are we done reading messages from stdin? @@ -162,26 +162,26 @@ static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { LOG_DEBUG ("Shutting down\n"); - shutdown_task_id = GNUNET_SCHEDULER_NO_TASK; + shutdown_task_id = NULL; if (NULL != testbed) { LOG_DEBUG ("Killing testbed\n"); GNUNET_break (0 == GNUNET_OS_process_kill (testbed, GNUNET_TERM_SIG)); } - if (GNUNET_SCHEDULER_NO_TASK != read_task_id) + if (NULL != read_task_id) { GNUNET_SCHEDULER_cancel (read_task_id); - read_task_id = GNUNET_SCHEDULER_NO_TASK; + read_task_id = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != write_task_id) + if (NULL != write_task_id) { GNUNET_SCHEDULER_cancel (write_task_id); - write_task_id = GNUNET_SCHEDULER_NO_TASK; + write_task_id = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != child_death_task_id) + if (NULL != child_death_task_id) { GNUNET_SCHEDULER_cancel (child_death_task_id); - child_death_task_id = GNUNET_SCHEDULER_NO_TASK; + child_death_task_id = NULL; } if (NULL != stdin_fd) (void) GNUNET_DISK_file_close (stdin_fd); @@ -209,7 +209,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void shutdown_now (void) { - if (GNUNET_SCHEDULER_NO_TASK != shutdown_task_id) + if (NULL != shutdown_task_id) GNUNET_SCHEDULER_cancel (shutdown_task_id); shutdown_task_id = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); } @@ -228,7 +228,7 @@ write_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) ssize_t bytes_wrote; GNUNET_assert (NULL != wc); - write_task_id = GNUNET_SCHEDULER_NO_TASK; + write_task_id = NULL; if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) { GNUNET_free (wc->data); @@ -275,7 +275,7 @@ child_death_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) int ret; pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); - child_death_task_id = GNUNET_SCHEDULER_NO_TASK; + child_death_task_id = NULL; if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) { child_death_task_id = @@ -518,7 +518,7 @@ read_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE]; ssize_t sread; - read_task_id = GNUNET_SCHEDULER_NO_TASK; + read_task_id = NULL; if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; sread = GNUNET_DISK_file_read (stdin_fd, buf, sizeof (buf)); diff --git a/src/testbed/gnunet-service-testbed-logger.c b/src/testbed/gnunet-service-testbed-logger.c index 6bf33e681b..7d3c834e24 100644 --- a/src/testbed/gnunet-service-testbed-logger.c +++ b/src/testbed/gnunet-service-testbed-logger.c @@ -83,7 +83,7 @@ struct GNUNET_BIO_WriteHandle *bio; /** * The shutdown task handle */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task_id; +static struct GNUNET_SCHEDULER_Task * shutdown_task_id; /** * The number of connections we have @@ -126,7 +126,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct MessageQueue *mq_entry; - shutdown_task_id = GNUNET_SCHEDULER_NO_TASK; + shutdown_task_id = NULL; in_shutdown = GNUNET_YES; if (0 != nconn) { @@ -166,7 +166,7 @@ client_disconnected (void *cls, struct GNUNET_SERVER_Client *client) nconn--; if (GNUNET_YES != in_shutdown) return; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != shutdown_task_id); + GNUNET_assert (NULL != shutdown_task_id); GNUNET_SCHEDULER_cancel (shutdown_task_id); shutdown_task_id = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); } diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c index a1d6aed095..039e0d3462 100644 --- a/src/testbed/gnunet-service-testbed.c +++ b/src/testbed/gnunet-service-testbed.c @@ -132,7 +132,7 @@ static struct MessageQueue *mq_tail; /** * The shutdown task handle */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task_id; +static struct GNUNET_SCHEDULER_Task * shutdown_task_id; /** @@ -736,7 +736,7 @@ GST_clear_fopcq () { GNUNET_CONTAINER_DLL_remove (fopcq_head, fopcq_tail, fopc); GNUNET_TESTBED_forward_operation_msg_cancel_ (fopc->opc); - if (GNUNET_SCHEDULER_NO_TASK != fopc->timeout_task) + if (NULL != fopc->timeout_task) GNUNET_SCHEDULER_cancel (fopc->timeout_task); GNUNET_SERVER_client_drop (fopc->client); switch (fopc->type) @@ -784,7 +784,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct MessageQueue *mq_entry; uint32_t id; - shutdown_task_id = GNUNET_SCHEDULER_NO_TASK; + shutdown_task_id = NULL; LOG_DEBUG ("Shutting down testbed service\n"); /* cleanup any remaining forwarded operations */ GST_clear_fopcq (); diff --git a/src/testbed/gnunet-service-testbed.h b/src/testbed/gnunet-service-testbed.h index 7966864b6e..a4eb8e7e8e 100644 --- a/src/testbed/gnunet-service-testbed.h +++ b/src/testbed/gnunet-service-testbed.h @@ -106,7 +106,7 @@ struct ForwardedOperationContext /** * Task ID for the timeout task */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * The id of the operation that has been forwarded diff --git a/src/testbed/gnunet-service-testbed_barriers.c b/src/testbed/gnunet-service-testbed_barriers.c index de2c175f1c..5e6e391ac1 100644 --- a/src/testbed/gnunet-service-testbed_barriers.c +++ b/src/testbed/gnunet-service-testbed_barriers.c @@ -199,7 +199,7 @@ struct Barrier /** * Identifier for the timeout task */ - GNUNET_SCHEDULER_TaskIdentifier tout_task; + struct GNUNET_SCHEDULER_Task * tout_task; /** * The status of this barrier diff --git a/src/testbed/gnunet-service-testbed_connectionpool.c b/src/testbed/gnunet-service-testbed_connectionpool.c index 6d9a279727..51909ae3ef 100644 --- a/src/testbed/gnunet-service-testbed_connectionpool.c +++ b/src/testbed/gnunet-service-testbed_connectionpool.c @@ -126,12 +126,12 @@ struct PooledConnection /** * The task to expire this connection from the connection pool */ - GNUNET_SCHEDULER_TaskIdentifier expire_task; + struct GNUNET_SCHEDULER_Task * expire_task; /** * The task to notify a waiting #GST_ConnectionPool_GetHandle object */ - GNUNET_SCHEDULER_TaskIdentifier notify_task; + struct GNUNET_SCHEDULER_Task * notify_task; /** * Number of active requests using this pooled connection @@ -286,10 +286,10 @@ destroy_pooled_connection (struct PooledConnection *entry) GNUNET_CONTAINER_multihashmap32_remove (map, entry->index, entry)); - if (GNUNET_SCHEDULER_NO_TASK != entry->notify_task) + if (NULL != entry->notify_task) { GNUNET_SCHEDULER_cancel (entry->notify_task); - entry->notify_task = GNUNET_SCHEDULER_NO_TASK; + entry->notify_task = NULL; } LOG_DEBUG ("Cleaning up handles of a pooled connection\n"); if (NULL != entry->handle_transport) @@ -322,7 +322,7 @@ expire (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct PooledConnection *entry = cls; - entry->expire_task = GNUNET_SCHEDULER_NO_TASK; + entry->expire_task = NULL; destroy_pooled_connection (entry); } @@ -335,10 +335,10 @@ expire (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void expire_task_cancel (struct PooledConnection *entry) { - if (GNUNET_SCHEDULER_NO_TASK != entry->expire_task) + if (NULL != entry->expire_task) { GNUNET_SCHEDULER_cancel (entry->expire_task); - entry->expire_task = GNUNET_SCHEDULER_NO_TASK; + entry->expire_task = NULL; } } @@ -355,7 +355,7 @@ add_to_lru (struct PooledConnection *entry) GNUNET_assert (!entry->in_lru); GNUNET_CONTAINER_DLL_insert_tail (head_lru, tail_lru, entry); entry->in_lru = GNUNET_YES; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == entry->expire_task); + GNUNET_assert (NULL == entry->expire_task); entry->expire_task = GNUNET_SCHEDULER_add_delayed (CACHE_EXPIRY, &expire, entry); } @@ -415,8 +415,8 @@ connection_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GST_ConnectionPool_GetHandle *gh; struct GST_ConnectionPool_GetHandle *gh_next; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != entry->notify_task); - entry->notify_task = GNUNET_SCHEDULER_NO_TASK; + GNUNET_assert (NULL != entry->notify_task); + entry->notify_task = NULL; gh = search_waiting (entry, entry->head_waiting); GNUNET_assert (NULL != gh); gh_next = NULL; @@ -524,7 +524,7 @@ opstart_get_handle_transport (void *cls) } if (0 == entry->demand) return; - if (GNUNET_SCHEDULER_NO_TASK != entry->notify_task) + if (NULL != entry->notify_task) return; if (NULL != search_waiting (entry, entry->head_waiting)) { @@ -597,7 +597,7 @@ core_startup_cb (void *cls, sizeof (struct GNUNET_PeerIdentity)); if (0 == entry->demand) return; - if (GNUNET_SCHEDULER_NO_TASK != entry->notify_task) + if (NULL != entry->notify_task) return; if (NULL != search_waiting (entry, entry->head_waiting)) { @@ -832,7 +832,7 @@ GST_connection_pool_get_handle (unsigned int peer_id, GNUNET_CONTAINER_DLL_insert (entry->head_waiting, entry->tail_waiting, gh); if (NULL != handle) { - if (GNUNET_SCHEDULER_NO_TASK == entry->notify_task) + if (NULL == entry->notify_task) { if (NULL != search_waiting (entry, entry->head_waiting)) entry->notify_task = GNUNET_SCHEDULER_add_now (&connection_ready, entry); @@ -888,10 +888,10 @@ GST_connection_pool_get_handle_done (struct GST_ConnectionPool_GetHandle *gh) { GNUNET_CONTAINER_DLL_remove (entry->head_waiting, entry->tail_waiting, gh); if ( (NULL == search_waiting (entry, entry->head_waiting)) - && (GNUNET_SCHEDULER_NO_TASK != entry->notify_task) ) + && (NULL != entry->notify_task) ) { GNUNET_SCHEDULER_cancel (entry->notify_task); - entry->notify_task = GNUNET_SCHEDULER_NO_TASK; + entry->notify_task = NULL; } } if (gh->notify_waiting) diff --git a/src/testbed/gnunet-service-testbed_cpustatus.c b/src/testbed/gnunet-service-testbed_cpustatus.c index 712df48b3f..fa0ee52c09 100644 --- a/src/testbed/gnunet-service-testbed_cpustatus.c +++ b/src/testbed/gnunet-service-testbed_cpustatus.c @@ -85,7 +85,7 @@ static double agedIOLoad = -1; */ struct GNUNET_BIO_WriteHandle *bw; -GNUNET_SCHEDULER_TaskIdentifier sample_load_task_id; +struct GNUNET_SCHEDULER_Task * sample_load_task_id; #ifdef OSX @@ -656,7 +656,7 @@ sample_load_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) unsigned int mem_usage; unsigned int nproc; - sample_load_task_id = GNUNET_SCHEDULER_NO_TASK; + sample_load_task_id = NULL; if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; ld_cpu = cpu_get_load (); @@ -767,10 +767,10 @@ GST_stats_destroy () #elif OSX GNUNET_free_non_null (prev_cpu_load); #endif - if (GNUNET_SCHEDULER_NO_TASK != sample_load_task_id) + if (NULL != sample_load_task_id) { GNUNET_SCHEDULER_cancel (sample_load_task_id); - sample_load_task_id = GNUNET_SCHEDULER_NO_TASK; + sample_load_task_id = NULL; } GNUNET_break (GNUNET_OK == GNUNET_BIO_write_close (bw)); bw = NULL; diff --git a/src/testbed/gnunet-service-testbed_links.c b/src/testbed/gnunet-service-testbed_links.c index cb908f12bb..4c2e6c58ad 100644 --- a/src/testbed/gnunet-service-testbed_links.c +++ b/src/testbed/gnunet-service-testbed_links.c @@ -92,7 +92,7 @@ struct LCFContext /** * The timeout task */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * The id of the operation which created this context @@ -206,7 +206,7 @@ struct Neighbour /** * Task id for the task to call notifications from the notification list */ - GNUNET_SCHEDULER_TaskIdentifier notify_task; + struct GNUNET_SCHEDULER_Task * notify_task; /** * How many references are present currently to this neighbour's connection @@ -265,7 +265,7 @@ struct NeighbourConnectCtxt /** * Task to be run upon timeout */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * The notification handle associated with the neighbour's connection request @@ -317,7 +317,7 @@ static struct LCFContextQueue *lcfq_tail; /** * The lcf_task handle */ -static GNUNET_SCHEDULER_TaskIdentifier lcf_proc_task_id; +static struct GNUNET_SCHEDULER_Task * lcf_proc_task_id; /** * The size of the route list @@ -602,7 +602,7 @@ lcf_proc_cc (void *cls, const char *emsg) { struct LCFContext *lcf = cls; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == lcf_proc_task_id); + GNUNET_assert (NULL == lcf_proc_task_id); switch (lcf->state) { case INIT: @@ -652,14 +652,14 @@ lcf_forwarded_operation_timeout (void *cls, { struct LCFContext *lcf = cls; - lcf->timeout_task = GNUNET_SCHEDULER_NO_TASK; + lcf->timeout_task = NULL; // GST_forwarded_operation_timeout (lcf->fopc, tc); LOG (GNUNET_ERROR_TYPE_WARNING, "A forwarded controller link operation has timed out\n"); send_controller_link_response (lcf->client, lcf->operation_id, NULL, "A forwarded controller link operation has " "timed out\n"); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == lcf_proc_task_id); + GNUNET_assert (NULL == lcf_proc_task_id); lcf_proc_task_id = GNUNET_SCHEDULER_add_now (&lcf_proc_task, lcf); } @@ -676,7 +676,7 @@ lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct LCFContext *lcf = cls; struct LCFContextQueue *lcfq; - lcf_proc_task_id = GNUNET_SCHEDULER_NO_TASK; + lcf_proc_task_id = NULL; switch (lcf->state) { case INIT: @@ -753,7 +753,7 @@ slave_event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) GNUNET_TESTBED_operation_done (lcf->op); lcf->op = NULL; GNUNET_assert (FINISHED == lcf->state); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != lcf->timeout_task); + GNUNET_assert (NULL != lcf->timeout_task); GNUNET_SCHEDULER_cancel (lcf->timeout_task); if (NULL == event->details.operation_finished.emsg) send_controller_link_response (lcf->client, lcf->operation_id, @@ -764,7 +764,7 @@ slave_event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) send_controller_link_response (lcf->client, lcf->operation_id, NULL, event->details.operation_finished.emsg); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == lcf_proc_task_id); + GNUNET_assert (NULL == lcf_proc_task_id); lcf_proc_task_id = GNUNET_SCHEDULER_add_now (&lcf_proc_task, lcf); return; } @@ -862,8 +862,8 @@ neighbour_connect_notify_task (void *cls, struct NeighbourConnectNotification *h; GNUNET_assert (NULL != (h = n->nl_head)); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != n->notify_task); - n->notify_task = GNUNET_SCHEDULER_NO_TASK; + GNUNET_assert (NULL != n->notify_task); + n->notify_task = NULL; GNUNET_assert (NULL != n->controller); GNUNET_CONTAINER_DLL_remove (n->nl_head, n->nl_tail, h); trigger_notifications (n); @@ -888,7 +888,7 @@ trigger_notifications (struct Neighbour *n) return; if (NULL == n->controller) return; - if (GNUNET_SCHEDULER_NO_TASK != n->notify_task) + if (NULL != n->notify_task) return; if (1 == n->inactive) { @@ -936,7 +936,7 @@ oprelease_neighbour_conn (void *cls) struct Neighbour *n = cls; GNUNET_assert (0 == n->reference_cnt); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == n->notify_task); + GNUNET_assert (NULL == n->notify_task); GNUNET_assert (NULL == n->nl_head); if (NULL != n->controller) { @@ -1006,12 +1006,12 @@ GST_neighbour_get_connection_cancel (struct NeighbourConnectNotification *h) GNUNET_free (h); if (GNUNET_NO == cleanup_task) return; - if (GNUNET_SCHEDULER_NO_TASK == n->notify_task) + if (NULL == n->notify_task) return; GNUNET_assert (0 < n->reference_cnt); n->reference_cnt--; GNUNET_SCHEDULER_cancel (n->notify_task); - n->notify_task = GNUNET_SCHEDULER_NO_TASK; + n->notify_task = NULL; if (NULL == n->nl_head) { if ( (0 == n->reference_cnt) && (0 == n->inactive) ) @@ -1056,7 +1056,7 @@ cleanup_ncc (struct NeighbourConnectCtxt *ncc) { if (NULL != ncc->nh) GST_neighbour_get_connection_cancel (ncc->nh); - if (GNUNET_SCHEDULER_NO_TASK != ncc->timeout_task) + if (NULL != ncc->timeout_task) GNUNET_SCHEDULER_cancel (ncc->timeout_task); GNUNET_SERVER_client_drop (ncc->client); GNUNET_CONTAINER_DLL_remove (ncc_head, ncc_tail, ncc); @@ -1126,7 +1126,7 @@ timeout_neighbour_connect (void *cls, { struct NeighbourConnectCtxt *ncc = cls; - ncc->timeout_task = GNUNET_SCHEDULER_NO_TASK; + ncc->timeout_task = NULL; send_controller_link_response (ncc->client, ncc->op_id, NULL, "Could not connect to delegated controller"); cleanup_ncc (ncc); @@ -1145,7 +1145,7 @@ neighbour_connect_cb (void *cls, struct GNUNET_TESTBED_Controller *c) struct NeighbourConnectCtxt *ncc = cls; GNUNET_SCHEDULER_cancel (ncc->timeout_task); - ncc->timeout_task = GNUNET_SCHEDULER_NO_TASK; + ncc->timeout_task = NULL; ncc->nh = NULL; GST_neighbour_release_connection (ncc->n); send_controller_link_response (ncc->client, ncc->op_id, NULL, NULL); @@ -1314,7 +1314,7 @@ GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client, lcfq->lcf->client = client; if (NULL == lcfq_head) { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == lcf_proc_task_id); + GNUNET_assert (NULL == lcf_proc_task_id); GNUNET_CONTAINER_DLL_insert_tail (lcfq_head, lcfq_tail, lcfq); lcf_proc_task_id = GNUNET_SCHEDULER_add_now (&lcf_proc_task, lcfq->lcf); } @@ -1354,20 +1354,20 @@ GST_free_lcfq () if (NULL != lcfq_head) { - if (GNUNET_SCHEDULER_NO_TASK != lcf_proc_task_id) + if (NULL != lcf_proc_task_id) { GNUNET_SCHEDULER_cancel (lcf_proc_task_id); - lcf_proc_task_id = GNUNET_SCHEDULER_NO_TASK; + lcf_proc_task_id = NULL; } } - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == lcf_proc_task_id); + GNUNET_assert (NULL == lcf_proc_task_id); for (lcfq = lcfq_head; NULL != lcfq; lcfq = lcfq_head) { lcf = lcfq->lcf; GNUNET_SERVER_client_drop (lcf->client); if (NULL != lcf->op) GNUNET_TESTBED_operation_done (lcf->op); - if (GNUNET_SCHEDULER_NO_TASK != lcf->timeout_task) + if (NULL != lcf->timeout_task) GNUNET_SCHEDULER_cancel (lcf->timeout_task); GNUNET_free (lcf); GNUNET_CONTAINER_DLL_remove (lcfq_head, lcfq_tail, lcfq); diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c index c2978728c0..c331fb8f0a 100644 --- a/src/testbed/gnunet-service-testbed_oc.c +++ b/src/testbed/gnunet-service-testbed_oc.c @@ -65,7 +65,7 @@ struct TryConnectContext /** * The task handle */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * The id of the operation which is resposible for this context @@ -250,17 +250,17 @@ struct OverlayConnectContext * The id of the task for sending HELLO of peer 2 to peer 1 and ask peer 1 to * connect to peer 2 */ - GNUNET_SCHEDULER_TaskIdentifier send_hello_task; + struct GNUNET_SCHEDULER_Task * send_hello_task; /** * The id of the overlay connect timeout task */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * The id of the cleanup task */ - GNUNET_SCHEDULER_TaskIdentifier cleanup_task; + struct GNUNET_SCHEDULER_Task * cleanup_task; /** * The type of this context information @@ -321,12 +321,12 @@ struct RemoteOverlayConnectCtx /** * Task for offering HELLO of A to B and doing try_connect */ - GNUNET_SCHEDULER_TaskIdentifier attempt_connect_task_id; + struct GNUNET_SCHEDULER_Task * attempt_connect_task_id; /** * Task to timeout RequestOverlayConnect */ - GNUNET_SCHEDULER_TaskIdentifier timeout_rocc_task_id; + struct GNUNET_SCHEDULER_Task * timeout_rocc_task_id; /** * The id of the operation responsible for creating this context @@ -478,7 +478,7 @@ cleanup_occ_lp2c (struct LocalPeer2Context *lp2c) GST_connection_pool_get_handle_done (lp2c->tcc.cgh_th); if (NULL != lp2c->tcc.tch) GNUNET_TRANSPORT_try_connect_cancel (lp2c->tcc.tch); - if (GNUNET_SCHEDULER_NO_TASK != lp2c->tcc.task) + if (NULL != lp2c->tcc.task) GNUNET_SCHEDULER_cancel (lp2c->tcc.task); } @@ -523,11 +523,11 @@ cleanup_occ (struct OverlayConnectContext *occ) GNUNET_free_non_null (occ->emsg); GNUNET_free_non_null (occ->hello); GNUNET_SERVER_client_drop (occ->client); - if (GNUNET_SCHEDULER_NO_TASK != occ->send_hello_task) + if (NULL != occ->send_hello_task) GNUNET_SCHEDULER_cancel (occ->send_hello_task); - if (GNUNET_SCHEDULER_NO_TASK != occ->cleanup_task) + if (NULL != occ->cleanup_task) GNUNET_SCHEDULER_cancel (occ->cleanup_task); - if (GNUNET_SCHEDULER_NO_TASK != occ->timeout_task) + if (NULL != occ->timeout_task) GNUNET_SCHEDULER_cancel (occ->timeout_task); if (NULL != occ->cgh_ch) GST_connection_pool_get_handle_done (occ->cgh_ch); @@ -571,7 +571,7 @@ do_cleanup_occ (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct OverlayConnectContext *occ = cls; - occ->cleanup_task = GNUNET_SCHEDULER_NO_TASK; + occ->cleanup_task = NULL; cleanup_occ (occ); } @@ -588,8 +588,8 @@ timeout_overlay_connect (void *cls, { struct OverlayConnectContext *occ = cls; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != occ->timeout_task); - occ->timeout_task = GNUNET_SCHEDULER_NO_TASK; + GNUNET_assert (NULL != occ->timeout_task); + occ->timeout_task = NULL; /* LOG (GNUNET_ERROR_TYPE_WARNING, */ /* "0x%llx: Timeout while connecting peers %u and %u: %s\n", occ->op_id, */ /* occ->peer->id, occ->other_peer_id, occ->emsg); */ @@ -653,21 +653,21 @@ overlay_connect_notify (void *cls, const struct GNUNET_PeerIdentity *new_peer) LOG_DEBUG ("0x%llx: Peer %4s connected to peer %4s\n", occ->op_id, other_peer_str, GNUNET_i2s (&occ->peer_identity)); GNUNET_free (other_peer_str); - if (GNUNET_SCHEDULER_NO_TASK != occ->send_hello_task) + if (NULL != occ->send_hello_task) { GNUNET_SCHEDULER_cancel (occ->send_hello_task); - occ->send_hello_task = GNUNET_SCHEDULER_NO_TASK; + occ->send_hello_task = NULL; } - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != occ->timeout_task); + GNUNET_assert (NULL != occ->timeout_task); GNUNET_SCHEDULER_cancel (occ->timeout_task); - occ->timeout_task = GNUNET_SCHEDULER_NO_TASK; + occ->timeout_task = NULL; if (OCC_TYPE_LOCAL == occ->type) { lp2c = &occ->p2ctx.local; - if (GNUNET_SCHEDULER_NO_TASK != lp2c->tcc.task) + if (NULL != lp2c->tcc.task) { GNUNET_SCHEDULER_cancel (lp2c->tcc.task); - lp2c->tcc.task = GNUNET_SCHEDULER_NO_TASK; + lp2c->tcc.task = NULL; } } GNUNET_free_non_null (occ->emsg); @@ -700,7 +700,7 @@ try_connect_cb (void *cls, const int result) struct TryConnectContext *tcc = cls; tcc->tch = NULL; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == tcc->task); + GNUNET_assert (NULL == tcc->task); tcc->task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, @@ -720,7 +720,7 @@ try_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct TryConnectContext *tcc = cls; - tcc->task = GNUNET_SCHEDULER_NO_TASK; + tcc->task = NULL; if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; GNUNET_assert (NULL == tcc->tch); @@ -762,7 +762,7 @@ occ_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_assert (OCC_TYPE_LOCAL == occ->type); lp2c = &occ->p2ctx.local; lp2c->ohh = NULL; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == occ->send_hello_task); + GNUNET_assert (NULL == occ->send_hello_task); if (GNUNET_SCHEDULER_REASON_TIMEOUT == tc->reason) { GNUNET_free_non_null (occ->emsg); @@ -839,7 +839,7 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct LocalPeer2Context *lp2c; char *other_peer_str; - occ->send_hello_task = GNUNET_SCHEDULER_NO_TASK; + occ->send_hello_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_assert (NULL != occ->hello); @@ -1048,7 +1048,7 @@ occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch, struct OverlayConnectContext *occ = cls; const struct GNUNET_MessageHeader *hello; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != occ->timeout_task); + GNUNET_assert (NULL != occ->timeout_task); GNUNET_free_non_null (occ->emsg); if ((NULL == ch) || (NULL == my_identity)) { @@ -1066,7 +1066,7 @@ occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch, { LOG_DEBUG ("0x%llx: Target peer already connected\n", occ->op_id); GNUNET_SCHEDULER_cancel (occ->timeout_task); - occ->timeout_task = GNUNET_SCHEDULER_NO_TASK; + occ->timeout_task = NULL; send_overlay_connect_success_msg (occ); occ->cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup_occ, occ); return; @@ -1114,7 +1114,7 @@ overlay_connect_get_config (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_assert (OCC_TYPE_LOCAL != occ->type); rp2c = &occ->p2ctx.remote; rp2c->opc = NULL; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != occ->timeout_task); + GNUNET_assert (NULL != occ->timeout_task); if (GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION != ntohs (msg->type)) { GNUNET_SCHEDULER_cancel (occ->timeout_task); @@ -1462,7 +1462,7 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, GST_peer_list[p1]->reference_cnt++; occ->peer = GST_peer_list[p1]; occ->op_id = operation_id; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == occ->timeout_task); + GNUNET_assert (NULL == occ->timeout_task); occ->timeout_task = GNUNET_SCHEDULER_add_delayed (GST_timeout, &timeout_overlay_connect, occ); switch (occ->type) @@ -1508,15 +1508,15 @@ static void cleanup_rocc (struct RemoteOverlayConnectCtx *rocc) { LOG_DEBUG ("0x%llx: Cleaning up rocc\n", rocc->op_id); - if (GNUNET_SCHEDULER_NO_TASK != rocc->attempt_connect_task_id) + if (NULL != rocc->attempt_connect_task_id) GNUNET_SCHEDULER_cancel (rocc->attempt_connect_task_id); - if (GNUNET_SCHEDULER_NO_TASK != rocc->timeout_rocc_task_id) + if (NULL != rocc->timeout_rocc_task_id) GNUNET_SCHEDULER_cancel (rocc->timeout_rocc_task_id); if (NULL != rocc->ohh) GNUNET_TRANSPORT_offer_hello_cancel (rocc->ohh); if (NULL != rocc->tcc.tch) GNUNET_TRANSPORT_try_connect_cancel (rocc->tcc.tch); - if (GNUNET_SCHEDULER_NO_TASK != rocc->tcc.task) + if (NULL != rocc->tcc.task) GNUNET_SCHEDULER_cancel (rocc->tcc.task); GST_connection_pool_get_handle_done (rocc->tcc.cgh_th); GNUNET_assert (rocc->peer->reference_cnt > 0); @@ -1541,8 +1541,8 @@ timeout_rocc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct RemoteOverlayConnectCtx *rocc = cls; - GNUNET_assert (rocc->timeout_rocc_task_id != GNUNET_SCHEDULER_NO_TASK); - rocc->timeout_rocc_task_id = GNUNET_SCHEDULER_NO_TASK; + GNUNET_assert (rocc->timeout_rocc_task_id != NULL); + rocc->timeout_rocc_task_id = NULL; LOG_DEBUG ("0x%llx: rocc timed out\n", rocc->op_id); cleanup_rocc (rocc); } @@ -1596,7 +1596,7 @@ rocc_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct RemoteOverlayConnectCtx *rocc = cls; rocc->ohh = NULL; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == rocc->attempt_connect_task_id); + GNUNET_assert (NULL == rocc->attempt_connect_task_id); LOG_DEBUG ("0x%llx: HELLO of peer %4s sent to local peer with id: %u\n", rocc->op_id, GNUNET_i2s (&rocc->a_id), rocc->peer->id); if (GNUNET_SCHEDULER_REASON_TIMEOUT == tc->reason) @@ -1627,8 +1627,8 @@ attempt_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct RemoteOverlayConnectCtx *rocc = cls; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != rocc->attempt_connect_task_id); - rocc->attempt_connect_task_id = GNUNET_SCHEDULER_NO_TASK; + GNUNET_assert (NULL != rocc->attempt_connect_task_id); + rocc->attempt_connect_task_id = NULL; LOG_DEBUG ("0x%llx: Offering HELLO of peer %4s to local peer with id: %u\n", rocc->op_id, GNUNET_i2s (&rocc->a_id), rocc->peer->id); rocc->ohh = diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index 17f1d6ba90..c45a6b0e27 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c @@ -55,12 +55,12 @@ static char *hosts_file; /** * Abort task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; /** * Shutdown task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Global event mask for all testbed events @@ -112,11 +112,11 @@ static int noninteractive; static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - shutdown_task = GNUNET_SCHEDULER_NO_TASK; - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + shutdown_task = NULL; + if (NULL != abort_task) { GNUNET_SCHEDULER_cancel (abort_task); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; } if (NULL != cfg) { @@ -137,9 +137,9 @@ static void do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { LOG (GNUNET_ERROR_TYPE_WARNING, "Aborting\n"); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; result = GNUNET_SYSERR; - if (GNUNET_SCHEDULER_NO_TASK != shutdown_task) + if (NULL != shutdown_task) GNUNET_SCHEDULER_cancel (shutdown_task); shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); } @@ -185,7 +185,7 @@ controller_event_cb (void *cls, { printf ("\nAborting due to very high failure rate\n"); print_overlay_links_summary (); - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); return; @@ -233,7 +233,7 @@ test_run (void *cls, if (noninteractive) { GNUNET_SCHEDULER_cancel (abort_task); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_shutdown, NULL); return; diff --git a/src/testbed/gnunet_testbed_mpi_spawn.c b/src/testbed/gnunet_testbed_mpi_spawn.c index 41d8054711..3fb50cb8fc 100644 --- a/src/testbed/gnunet_testbed_mpi_spawn.c +++ b/src/testbed/gnunet_testbed_mpi_spawn.c @@ -58,17 +58,17 @@ static enum GNUNET_OS_ProcessStatusType child_status; /** * The shutdown task */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task_id; +static struct GNUNET_SCHEDULER_Task * shutdown_task_id; /** * Task to kill the child */ -static GNUNET_SCHEDULER_TaskIdentifier terminate_task_id; +static struct GNUNET_SCHEDULER_Task * terminate_task_id; /** * Task to kill the child */ -static GNUNET_SCHEDULER_TaskIdentifier child_death_task_id; +static struct GNUNET_SCHEDULER_Task * child_death_task_id; /** * The shutdown task @@ -76,7 +76,7 @@ static GNUNET_SCHEDULER_TaskIdentifier child_death_task_id; static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - shutdown_task_id = GNUNET_SCHEDULER_NO_TASK; + shutdown_task_id = NULL; if (0 != child_exit_code) { LOG (GNUNET_ERROR_TYPE_WARNING, "Child exited with error code: %lu\n", @@ -140,7 +140,7 @@ child_death_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) char c[16]; pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); - child_death_task_id = GNUNET_SCHEDULER_NO_TASK; + child_death_task_id = NULL; if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) { child_death_task_id = @@ -152,7 +152,7 @@ child_death_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof (c))); LOG_DEBUG ("Child died\n"); GNUNET_SCHEDULER_cancel (terminate_task_id); - terminate_task_id = GNUNET_SCHEDULER_NO_TASK; + terminate_task_id = NULL; GNUNET_assert (GNUNET_OK == GNUNET_OS_process_status (child, &child_status, &child_exit_code)); GNUNET_OS_process_destroy (child); diff --git a/src/testbed/test_gnunet_helper_testbed.c b/src/testbed/test_gnunet_helper_testbed.c index cf4559c263..43177c8949 100644 --- a/src/testbed/test_gnunet_helper_testbed.c +++ b/src/testbed/test_gnunet_helper_testbed.c @@ -58,12 +58,12 @@ static struct GNUNET_HELPER_SendHandle *shandle; /** * Abort task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; /** * Shutdown task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Configuratin handler @@ -85,7 +85,7 @@ static int result; static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); if (NULL != helper) GNUNET_HELPER_stop (helper, GNUNET_NO); @@ -104,12 +104,12 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); result = GNUNET_SYSERR; if (NULL != shandle) GNUNET_HELPER_send_cancel (shandle); - if (GNUNET_SCHEDULER_NO_TASK == shutdown_task) + if (NULL == shutdown_task) shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); } @@ -167,7 +167,7 @@ mst_cb (void *cls, void *client, const struct GNUNET_MessageHeader *message) uncompress ((Bytef *) config, &config_size, (const Bytef *) &msg[1], xconfig_size)); GNUNET_free (config); - if (GNUNET_SCHEDULER_NO_TASK == shutdown_task) + if (NULL == shutdown_task) shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1), diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c index 47caa06f37..980b3725f8 100644 --- a/src/testbed/test_testbed_api.c +++ b/src/testbed/test_testbed_api.c @@ -90,7 +90,7 @@ static struct GNUNET_ARM_Handle *arm_handle; /** * Abort task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; /** * The testing result @@ -139,7 +139,7 @@ static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down...\n"); - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); if (NULL != reg_handle) GNUNET_TESTBED_cancel_registration (reg_handle); @@ -162,9 +162,9 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) #define FAIL_TEST(cond, ret) do { \ if (!(cond)) { \ GNUNET_break(0); \ - if (GNUNET_SCHEDULER_NO_TASK != abort_task) \ + if (NULL != abort_task) \ GNUNET_SCHEDULER_cancel (abort_task); \ - abort_task = GNUNET_SCHEDULER_NO_TASK; \ + abort_task = NULL; \ GNUNET_SCHEDULER_add_now (do_shutdown, NULL); \ ret; \ } \ @@ -181,7 +181,7 @@ static void do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; do_shutdown (cls, tc); } diff --git a/src/testbed/test_testbed_api_2peers_1controller.c b/src/testbed/test_testbed_api_2peers_1controller.c index 18bff91e99..64963c1a77 100644 --- a/src/testbed/test_testbed_api_2peers_1controller.c +++ b/src/testbed/test_testbed_api_2peers_1controller.c @@ -112,12 +112,12 @@ static struct GNUNET_TESTBED_Operation *common_operation; /** * Abort task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; /** * Delayed connect job identifier */ -static GNUNET_SCHEDULER_TaskIdentifier delayed_connect_task; +static struct GNUNET_SCHEDULER_Task * delayed_connect_task; /** * Different stages in testing @@ -173,9 +173,9 @@ static enum Stage result; #define FAIL_TEST(cond) do { \ if (!(cond)) { \ GNUNET_break(0); \ - if (GNUNET_SCHEDULER_NO_TASK != abort_task) \ + if (NULL != abort_task) \ GNUNET_SCHEDULER_cancel (abort_task); \ - abort_task = GNUNET_SCHEDULER_NO_TASK; \ + abort_task = NULL; \ GNUNET_SCHEDULER_add_now (do_shutdown, NULL); \ return; \ } \ @@ -191,9 +191,9 @@ static enum Stage result; static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); - if (GNUNET_SCHEDULER_NO_TASK != delayed_connect_task) + if (NULL != delayed_connect_task) GNUNET_SCHEDULER_cancel (delayed_connect_task); if (NULL != reg_handle) GNUNET_TESTBED_cancel_registration (reg_handle); @@ -216,7 +216,7 @@ static void do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; do_shutdown (cls, tc); } @@ -242,7 +242,7 @@ op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg); static void do_delayed_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - delayed_connect_task = GNUNET_SCHEDULER_NO_TASK; + delayed_connect_task = NULL; FAIL_TEST (NULL == common_operation); common_operation = GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL, peer1.peer, diff --git a/src/testbed/test_testbed_api_3peers_3controllers.c b/src/testbed/test_testbed_api_3peers_3controllers.c index 6d88490c14..8a44029d49 100644 --- a/src/testbed/test_testbed_api_3peers_3controllers.c +++ b/src/testbed/test_testbed_api_3peers_3controllers.c @@ -151,12 +151,12 @@ struct GNUNET_TESTBED_HostHabitableCheckHandle *hc_handle; /** * Abort task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; /** * Delayed connect job identifier */ -static GNUNET_SCHEDULER_TaskIdentifier delayed_connect_task; +static struct GNUNET_SCHEDULER_Task * delayed_connect_task; /** * Different stages in testing @@ -259,11 +259,11 @@ static enum Stage result; static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); if (NULL != hc_handle) GNUNET_TESTBED_is_host_habitable_cancel (hc_handle); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == delayed_connect_task); + GNUNET_assert (NULL == delayed_connect_task); if (NULL != common_operation) GNUNET_TESTBED_operation_done (common_operation); if (NULL != reg_handle) @@ -294,11 +294,11 @@ static void do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); - abort_task = GNUNET_SCHEDULER_NO_TASK; - if (GNUNET_SCHEDULER_NO_TASK != delayed_connect_task) + abort_task = NULL; + if (NULL != delayed_connect_task) { GNUNET_SCHEDULER_cancel (delayed_connect_task); - delayed_connect_task = GNUNET_SCHEDULER_NO_TASK; + delayed_connect_task = NULL; } do_shutdown (cls, tc); } @@ -306,7 +306,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void abort_test () { - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); } @@ -333,7 +333,7 @@ op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg); static void do_delayed_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - delayed_connect_task = GNUNET_SCHEDULER_NO_TASK; + delayed_connect_task = NULL; if (NULL != common_operation) { GNUNET_break (0); @@ -859,7 +859,7 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *_host, "to use password less SSH logins to localhost.\n" "Skipping test\n"); GNUNET_SCHEDULER_cancel (abort_task); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; (void) GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); result = SKIP; return; diff --git a/src/testbed/test_testbed_api_barriers.c b/src/testbed/test_testbed_api_barriers.c index 648af792bf..dec1b38984 100644 --- a/src/testbed/test_testbed_api_barriers.c +++ b/src/testbed/test_testbed_api_barriers.c @@ -50,7 +50,7 @@ struct GNUNET_TESTBED_Barrier *barrier; /** * Identifier for the shutdown task */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Result of this test case @@ -67,7 +67,7 @@ static int result; static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - shutdown_task = GNUNET_SCHEDULER_NO_TASK; + shutdown_task = NULL; if (NULL != barrier) { GNUNET_TESTBED_barrier_cancel (barrier); diff --git a/src/testbed/test_testbed_api_controllerlink.c b/src/testbed/test_testbed_api_controllerlink.c index 471ab3a94c..2834ea713d 100644 --- a/src/testbed/test_testbed_api_controllerlink.c +++ b/src/testbed/test_testbed_api_controllerlink.c @@ -244,7 +244,7 @@ static struct GNUNET_CONFIGURATION_Handle *cfg3; /** * Abort task */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; /** * Operation handle for linking controllers @@ -279,7 +279,7 @@ struct GNUNET_TESTBED_HostHabitableCheckHandle *hc_handle; /** * The task handle for the delay task */ -GNUNET_SCHEDULER_TaskIdentifier delay_task_id; +struct GNUNET_SCHEDULER_Task * delay_task_id; /** * Event mask @@ -297,9 +297,9 @@ static enum Stage result; #define FAIL_TEST(cond) do { \ if (!(cond)) { \ GNUNET_break(0); \ - if (GNUNET_SCHEDULER_NO_TASK != abort_task) \ + if (NULL != abort_task) \ GNUNET_SCHEDULER_cancel (abort_task); \ - abort_task = GNUNET_SCHEDULER_NO_TASK; \ + abort_task = NULL; \ GNUNET_SCHEDULER_add_now (do_shutdown, NULL); \ return; \ } \ @@ -315,12 +315,12 @@ static enum Stage result; static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); - if (GNUNET_SCHEDULER_NO_TASK != delay_task_id) + if (NULL != delay_task_id) { GNUNET_SCHEDULER_cancel (delay_task_id); - delay_task_id = GNUNET_SCHEDULER_NO_TASK; + delay_task_id = NULL; } if (NULL != hc_handle) GNUNET_TESTBED_is_host_habitable_cancel (hc_handle); @@ -355,7 +355,7 @@ static void do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { LOG (GNUNET_ERROR_TYPE_WARNING, "Aborting\n"); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; do_shutdown (cls, tc); } @@ -369,7 +369,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void do_abort_now (void *cls) { - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); } @@ -394,7 +394,7 @@ registration_cont (void *cls, const char *emsg); static void delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - delay_task_id = GNUNET_SCHEDULER_NO_TASK; + delay_task_id = NULL; switch (result) { case SLAVE2_PEER_CREATE_SUCCESS: @@ -756,7 +756,7 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *_host, "to use password less SSH logins to localhost.\n" "Skipping test\n"); GNUNET_SCHEDULER_cancel (abort_task); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; (void) GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); result = SKIP; return; diff --git a/src/testbed/test_testbed_api_hosts.c b/src/testbed/test_testbed_api_hosts.c index 4d96b23033..6a589e0e8c 100644 --- a/src/testbed/test_testbed_api_hosts.c +++ b/src/testbed/test_testbed_api_hosts.c @@ -61,7 +61,7 @@ static int status; /** * Shutdown task identifier */ -GNUNET_SCHEDULER_TaskIdentifier shutdown_id; +struct GNUNET_SCHEDULER_Task * shutdown_id; /** * The shutdown task diff --git a/src/testbed/test_testbed_api_operations.c b/src/testbed/test_testbed_api_operations.c index ceae76cd4e..b3402868a1 100644 --- a/src/testbed/test_testbed_api_operations.c +++ b/src/testbed/test_testbed_api_operations.c @@ -115,7 +115,7 @@ struct GNUNET_TESTBED_Operation *op9; /** * The delay task identifier */ -GNUNET_SCHEDULER_TaskIdentifier step_task; +struct GNUNET_SCHEDULER_Task * step_task; /** @@ -267,8 +267,8 @@ release_cb (void *cls); static void step (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != step_task); - step_task = GNUNET_SCHEDULER_NO_TASK; + GNUNET_assert (NULL != step_task); + step_task = NULL; switch (result) { case TEST_OP1_STARTED: @@ -344,28 +344,28 @@ start_cb (void *cls) case TEST_INIT: GNUNET_assert (&op1 == cls); result = TEST_OP1_STARTED; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == step_task); + GNUNET_assert (NULL == step_task); step_task = GNUNET_SCHEDULER_add_delayed (STEP_DELAY, &step, NULL); break; case TEST_PAUSE: GNUNET_assert (&op2 == cls); result = TEST_OP2_STARTED; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == step_task); + GNUNET_assert (NULL == step_task); step_task = GNUNET_SCHEDULER_add_delayed (STEP_DELAY, &step, NULL); break; case TEST_OP2_RELEASED: GNUNET_assert (&op3 == cls); result = TEST_OP3_STARTED; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == step_task); + GNUNET_assert (NULL == step_task); step_task = GNUNET_SCHEDULER_add_delayed (STEP_DELAY, &step, NULL); break; case TEST_OP3_RELEASED: GNUNET_assert (&op4 == cls); result = TEST_OP4_STARTED; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == step_task); + GNUNET_assert (NULL == step_task); step_task = GNUNET_SCHEDULER_add_delayed (STEP_DELAY, &step, NULL); break; @@ -422,17 +422,17 @@ release_cb (void *cls) case TEST_OP2_STARTED: GNUNET_assert (&op2 == cls); result = TEST_OP2_RELEASED; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == step_task); + GNUNET_assert (NULL == step_task); break; case TEST_OP3_STARTED: GNUNET_assert (&op3 == cls); result = TEST_OP3_RELEASED; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == step_task); + GNUNET_assert (NULL == step_task); break; case TEST_OP4_STARTED: GNUNET_assert (&op4 == cls); result = TEST_OP4_RELEASED; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == step_task); + GNUNET_assert (NULL == step_task); op5 = GNUNET_TESTBED_operation_create_ (&op5, &start_cb, &release_cb); GNUNET_TESTBED_operation_queue_insert2_ (q1, op5, 1); GNUNET_TESTBED_operation_begin_wait_ (op5); diff --git a/src/testbed/test_testbed_api_peer_reconfiguration.c b/src/testbed/test_testbed_api_peer_reconfiguration.c index 6b5f3e1176..3928274ded 100644 --- a/src/testbed/test_testbed_api_peer_reconfiguration.c +++ b/src/testbed/test_testbed_api_peer_reconfiguration.c @@ -47,7 +47,7 @@ static struct GNUNET_TESTBED_Operation *op; /** * Abort task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; /** * States in this test @@ -77,7 +77,7 @@ enum { #define FAIL_TEST(cond, ret) do { \ if (!(cond)) { \ GNUNET_break(0); \ - if (GNUNET_SCHEDULER_NO_TASK != abort_task) \ + if (NULL != abort_task) \ GNUNET_SCHEDULER_cancel (abort_task); \ abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); \ ret; \ @@ -95,7 +95,7 @@ static void do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting\n"); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; if (NULL != op) { GNUNET_TESTBED_operation_done (op); @@ -134,7 +134,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) GNUNET_TESTBED_operation_done (op); state = STATE_PEER_RECONFIGURED; GNUNET_SCHEDULER_cancel (abort_task); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; GNUNET_SCHEDULER_shutdown (); } diff --git a/src/testbed/test_testbed_api_peers_manage_services.c b/src/testbed/test_testbed_api_peers_manage_services.c index 63c089e199..fedaae2958 100644 --- a/src/testbed/test_testbed_api_peers_manage_services.c +++ b/src/testbed/test_testbed_api_peers_manage_services.c @@ -52,7 +52,7 @@ static void *dummy_cls = (void *) 0xDEAD0001; /** * Abort task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; /** * States in this test @@ -91,7 +91,7 @@ enum { #define FAIL_TEST(cond, ret) do { \ if (!(cond)) { \ GNUNET_break(0); \ - if (GNUNET_SCHEDULER_NO_TASK != abort_task) \ + if (NULL != abort_task) \ GNUNET_SCHEDULER_cancel (abort_task); \ abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); \ ret; \ @@ -109,7 +109,7 @@ static void do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting\n"); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; if (NULL != op) { GNUNET_TESTBED_operation_done (op); @@ -151,7 +151,7 @@ op_comp_cb (void *cls, case STATE_SERVICE_DOWN: state = STATE_SERVICE_UP; GNUNET_SCHEDULER_cancel (abort_task); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; state = STATE_OK; GNUNET_SCHEDULER_shutdown (); break; diff --git a/src/testbed/test_testbed_api_statistics.c b/src/testbed/test_testbed_api_statistics.c index 73c7f97345..158f21e070 100644 --- a/src/testbed/test_testbed_api_statistics.c +++ b/src/testbed/test_testbed_api_statistics.c @@ -51,7 +51,7 @@ static void *dummy_cls = (void *) 0xDEAD0001; /** * Abort task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; /** * Global testing result @@ -75,7 +75,7 @@ static unsigned int num_seen_peers; #define FAIL_TEST(cond, ret) do { \ if (!(cond)) { \ GNUNET_break(0); \ - if (GNUNET_SCHEDULER_NO_TASK != abort_task) \ + if (NULL != abort_task) \ GNUNET_SCHEDULER_cancel (abort_task); \ abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); \ ret; \ @@ -93,7 +93,7 @@ static void do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test timed out -- Aborting\n"); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; if (NULL != op) { GNUNET_TESTBED_operation_done (op); diff --git a/src/testbed/test_testbed_api_test.c b/src/testbed/test_testbed_api_test.c index 7016ad843d..4f52d6638d 100644 --- a/src/testbed/test_testbed_api_test.c +++ b/src/testbed/test_testbed_api_test.c @@ -53,12 +53,12 @@ static struct GNUNET_TESTBED_Operation *op; /** * Abort task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; /** * shutdown task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Testing result @@ -75,8 +75,8 @@ static int result; static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - shutdown_task = GNUNET_SCHEDULER_NO_TASK; - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + shutdown_task = NULL; + if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); if (NULL != op) GNUNET_TESTBED_operation_done (op); @@ -89,10 +89,10 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) #define FAIL_TEST(cond) do { \ if (!(cond)) { \ GNUNET_break(0); \ - if (GNUNET_SCHEDULER_NO_TASK != abort_task) \ + if (NULL != abort_task) \ GNUNET_SCHEDULER_cancel (abort_task); \ - abort_task = GNUNET_SCHEDULER_NO_TASK; \ - if (GNUNET_SCHEDULER_NO_TASK == shutdown_task) \ + abort_task = NULL; \ + if (NULL == shutdown_task) \ shutdown_task = GNUNET_SCHEDULER_add_now (do_shutdown, NULL); \ return; \ } \ @@ -109,8 +109,8 @@ static void do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); - abort_task = GNUNET_SCHEDULER_NO_TASK; - if (GNUNET_SCHEDULER_NO_TASK != shutdown_task) + abort_task = NULL; + if (NULL != shutdown_task) GNUNET_SCHEDULER_cancel (shutdown_task); do_shutdown (cls, tc); } diff --git a/src/testbed/test_testbed_api_testbed_run.c b/src/testbed/test_testbed_api_testbed_run.c index dd8a249e90..14e0d4fa44 100644 --- a/src/testbed/test_testbed_api_testbed_run.c +++ b/src/testbed/test_testbed_api_testbed_run.c @@ -46,7 +46,7 @@ static struct GNUNET_TESTBED_Operation *op; /** * Abort task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; +static struct GNUNET_SCHEDULER_Task * abort_task; /** * Current peer id @@ -73,7 +73,7 @@ static int wait_forever; static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - if (GNUNET_SCHEDULER_NO_TASK != abort_task) + if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */ } @@ -89,7 +89,7 @@ static void do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; (void) GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); } @@ -117,10 +117,10 @@ test_master (void *cls, result = GNUNET_OK; if (GNUNET_YES == wait_forever) { - if (GNUNET_SCHEDULER_NO_TASK == abort_task) + if (NULL == abort_task) return; /* abort already scheduled */ GNUNET_SCHEDULER_cancel (abort_task); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; (void) GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_shutdown, NULL); return; diff --git a/src/testbed/test_testbed_api_topology.c b/src/testbed/test_testbed_api_topology.c index bdd29bfbf2..9c3e1c7a8d 100644 --- a/src/testbed/test_testbed_api_topology.c +++ b/src/testbed/test_testbed_api_topology.c @@ -46,7 +46,7 @@ static struct GNUNET_TESTBED_Operation *op; /** * Shutdown task */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Testing result @@ -68,7 +68,7 @@ static unsigned int overlay_connects; static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - shutdown_task = GNUNET_SCHEDULER_NO_TASK; + shutdown_task = NULL; if (NULL != op) { GNUNET_TESTBED_operation_done (op); diff --git a/src/testbed/test_testbed_api_topology_clique.c b/src/testbed/test_testbed_api_topology_clique.c index 658e33ab9e..d08efcc978 100644 --- a/src/testbed/test_testbed_api_topology_clique.c +++ b/src/testbed/test_testbed_api_topology_clique.c @@ -46,7 +46,7 @@ static struct GNUNET_TESTBED_Operation *op; /** * Shutdown task */ -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Testing result @@ -68,7 +68,7 @@ static unsigned int overlay_connects; static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - shutdown_task = GNUNET_SCHEDULER_NO_TASK; + shutdown_task = NULL; if (NULL != op) { GNUNET_TESTBED_operation_done (op); diff --git a/src/testbed/test_testbed_logger_api.c b/src/testbed/test_testbed_logger_api.c index 11ba7270b5..0a6b314268 100644 --- a/src/testbed/test_testbed_logger_api.c +++ b/src/testbed/test_testbed_logger_api.c @@ -53,16 +53,16 @@ static char *search_dir; /** * Abort task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier abort_task; -static GNUNET_SCHEDULER_TaskIdentifier write_task; +static struct GNUNET_SCHEDULER_Task * abort_task; +static struct GNUNET_SCHEDULER_Task * write_task; static int result; #define CANCEL_TASK(task) do { \ - if (GNUNET_SCHEDULER_NO_TASK != task) \ + if (NULL != task) \ { \ GNUNET_SCHEDULER_cancel (task); \ - task = GNUNET_SCHEDULER_NO_TASK; \ + task = NULL; \ } \ } while (0) @@ -100,7 +100,7 @@ static void do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { LOG (GNUNET_ERROR_TYPE_WARNING, "Aborting\n"); - abort_task = GNUNET_SCHEDULER_NO_TASK; + abort_task = NULL; shutdown_now (); } @@ -178,7 +178,7 @@ do_write (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static int i; char buf[BSIZE]; - write_task = GNUNET_SCHEDULER_NO_TASK; + write_task = NULL; if (0 == i) write_task = GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS(1), &do_write, NULL); (void) memset (buf, i, BSIZE); diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index ed3379d880..292dafadf1 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c @@ -1239,7 +1239,7 @@ struct GNUNET_TESTBED_HostHabitableCheckHandle /** * Task id for the habitability check task */ - GNUNET_SCHEDULER_TaskIdentifier habitability_check_task; + struct GNUNET_SCHEDULER_Task * habitability_check_task; /** * How long we wait before checking the process status. Should grow @@ -1267,7 +1267,7 @@ habitability_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) enum GNUNET_OS_ProcessStatusType type; int ret; - h->habitability_check_task = GNUNET_SCHEDULER_NO_TASK; + h->habitability_check_task = NULL; ret = GNUNET_OS_process_status (h->auxp, &type, &code); if (GNUNET_SYSERR == ret) { diff --git a/src/testbed/testbed_api_operations.c b/src/testbed/testbed_api_operations.c index 8bc38747cb..469d44fe57 100644 --- a/src/testbed/testbed_api_operations.c +++ b/src/testbed/testbed_api_operations.c @@ -400,7 +400,7 @@ static unsigned int n_expired_opqs; /** * The id of the task to process the ready queue */ -GNUNET_SCHEDULER_TaskIdentifier process_rq_task_id; +struct GNUNET_SCHEDULER_Task * process_rq_task_id; /** @@ -534,10 +534,10 @@ rq_remove (struct GNUNET_TESTBED_Operation *op) GNUNET_CONTAINER_DLL_remove (rq_head, rq_tail, op->rq_entry); GNUNET_free (op->rq_entry); op->rq_entry = NULL; - if ( (NULL == rq_head) && (GNUNET_SCHEDULER_NO_TASK != process_rq_task_id) ) + if ( (NULL == rq_head) && (NULL != process_rq_task_id) ) { GNUNET_SCHEDULER_cancel (process_rq_task_id); - process_rq_task_id = GNUNET_SCHEDULER_NO_TASK; + process_rq_task_id = NULL; } } @@ -558,7 +558,7 @@ process_rq_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct OperationQueue *queue; unsigned int cnt; - process_rq_task_id = GNUNET_SCHEDULER_NO_TASK; + process_rq_task_id = NULL; GNUNET_assert (NULL != rq_head); GNUNET_assert (NULL != (op = rq_head->op)); rq_remove (op); @@ -592,7 +592,7 @@ rq_add (struct GNUNET_TESTBED_Operation *op) rq_entry->op = op; GNUNET_CONTAINER_DLL_insert_tail (rq_head, rq_tail, rq_entry); op->rq_entry = rq_entry; - if (GNUNET_SCHEDULER_NO_TASK == process_rq_task_id) + if (NULL == process_rq_task_id) process_rq_task_id = GNUNET_SCHEDULER_add_now (&process_rq_task, NULL); } diff --git a/src/testbed/testbed_api_statistics.c b/src/testbed/testbed_api_statistics.c index e6efc1fb0b..6087a0c148 100644 --- a/src/testbed/testbed_api_statistics.c +++ b/src/testbed/testbed_api_statistics.c @@ -94,7 +94,7 @@ struct GetStatsContext /** * The task for calling the continuation callback */ - GNUNET_SCHEDULER_TaskIdentifier call_completion_task_id; + struct GNUNET_SCHEDULER_Task * call_completion_task_id; /** * The number of peers present in the peers array. This number also @@ -128,7 +128,7 @@ struct PeerGetStatsContext /** * Task to mark the statistics service connect operation as done */ - GNUNET_SCHEDULER_TaskIdentifier op_done_task_id; + struct GNUNET_SCHEDULER_Task * op_done_task_id; /** * The index of this peer in the peers array of GetStatsContext @@ -157,8 +157,8 @@ call_completion_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GetStatsContext *sc = cls; - GNUNET_assert (sc->call_completion_task_id != GNUNET_SCHEDULER_NO_TASK); - sc->call_completion_task_id = GNUNET_SCHEDULER_NO_TASK; + GNUNET_assert (sc->call_completion_task_id != NULL); + sc->call_completion_task_id = NULL; LOG_DEBUG ("Calling get_statistics() continuation callback\n"); sc->cont (sc->cb_cls, sc->main_op, NULL); } @@ -179,7 +179,7 @@ op_done_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_TESTBED_Operation **op; sc = peer_sc->sc; - peer_sc->op_done_task_id = GNUNET_SCHEDULER_NO_TASK; + peer_sc->op_done_task_id = NULL; op = &sc->ops[peer_sc->peer_index]; GNUNET_assert (NULL != *op); GNUNET_TESTBED_operation_done (*op); @@ -312,7 +312,7 @@ statistics_da (void *cls, void *op_result) peer_sc->get_handle = NULL; } GNUNET_STATISTICS_destroy (sh, GNUNET_NO); - if (GNUNET_SCHEDULER_NO_TASK != peer_sc->op_done_task_id) + if (NULL != peer_sc->op_done_task_id) GNUNET_SCHEDULER_cancel (peer_sc->op_done_task_id); GNUNET_free (peer_sc); } @@ -366,7 +366,7 @@ oprelease_get_stats (void *cls) unsigned int peer; LOG_DEBUG ("Cleaning up get_statistics operation\n"); - if (GNUNET_SCHEDULER_NO_TASK != sc->call_completion_task_id) + if (NULL != sc->call_completion_task_id) GNUNET_SCHEDULER_cancel (sc->call_completion_task_id); if (NULL != sc->ops) { diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index 2be565e63c..981a6a9e52 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c @@ -253,17 +253,17 @@ struct GNUNET_TESTBED_RunHandle /** * Host registration task */ - GNUNET_SCHEDULER_TaskIdentifier register_hosts_task; + struct GNUNET_SCHEDULER_Task * register_hosts_task; /** * Task to be run of a timeout */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Task run upon shutdown interrupts */ - GNUNET_SCHEDULER_TaskIdentifier interrupt_task; + struct GNUNET_SCHEDULER_Task * interrupt_task; /** * The event mask for the controller @@ -455,7 +455,7 @@ cleanup (struct GNUNET_TESTBED_RunHandle *rc) { unsigned int hid; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == rc->register_hosts_task); + GNUNET_assert (NULL == rc->register_hosts_task); GNUNET_assert (NULL == rc->reg_handle); GNUNET_assert (NULL == rc->peers); GNUNET_assert (NULL == rc->hclist); @@ -524,15 +524,15 @@ rc_cleanup_operations (struct GNUNET_TESTBED_RunHandle *rc) rc->hclist = NULL; } /* Stop register hosts task if it is running */ - if (GNUNET_SCHEDULER_NO_TASK != rc->register_hosts_task) + if (NULL != rc->register_hosts_task) { GNUNET_SCHEDULER_cancel (rc->register_hosts_task); - rc->register_hosts_task = GNUNET_SCHEDULER_NO_TASK; + rc->register_hosts_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != rc->timeout_task) + if (NULL != rc->timeout_task) { GNUNET_SCHEDULER_cancel (rc->timeout_task); - rc->timeout_task = GNUNET_SCHEDULER_NO_TASK; + rc->timeout_task = NULL; } if (NULL != rc->reg_handle) { @@ -561,7 +561,7 @@ static void cancel_interrupt_task (struct GNUNET_TESTBED_RunHandle *rc) { GNUNET_SCHEDULER_cancel (rc->interrupt_task); - rc->interrupt_task = GNUNET_SCHEDULER_NO_TASK; + rc->interrupt_task = NULL; } @@ -730,7 +730,7 @@ static void call_master (struct GNUNET_TESTBED_RunHandle *rc) { GNUNET_SCHEDULER_cancel (rc->timeout_task); - rc->timeout_task = GNUNET_SCHEDULER_NO_TASK; + rc->timeout_task = NULL; if (NULL != rc->test_master) rc->test_master (rc->test_master_cls, rc, rc->num_peers, rc->peers, rc->links_succeeded, rc->links_failed); @@ -1006,7 +1006,7 @@ register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct RunContextOperation *rcop; unsigned int slave; - rc->register_hosts_task = GNUNET_SCHEDULER_NO_TASK; + rc->register_hosts_task = NULL; if (rc->reg_hosts == rc->num_hosts) { DEBUG ("All hosts successfully registered\n"); @@ -1199,7 +1199,7 @@ timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_TESTBED_RunHandle *rc = cls; - rc->timeout_task = GNUNET_SCHEDULER_NO_TASK; + rc->timeout_task = NULL; LOG (GNUNET_ERROR_TYPE_ERROR, _("Shutting down testbed due to timeout while setup.\n")); GNUNET_SCHEDULER_shutdown (); if (NULL != rc->test_master) diff --git a/src/testbed/testbed_logger_api.c b/src/testbed/testbed_logger_api.c index dab9d66003..091645de31 100644 --- a/src/testbed/testbed_logger_api.c +++ b/src/testbed/testbed_logger_api.c @@ -144,12 +144,12 @@ struct GNUNET_TESTBED_LOGGER_Handle /** * Task to call the flush completion callback */ - GNUNET_SCHEDULER_TaskIdentifier flush_completion_task; + struct GNUNET_SCHEDULER_Task * flush_completion_task; /** * Task to be executed when flushing takes too long */ - GNUNET_SCHEDULER_TaskIdentifier timeout_flush_task; + struct GNUNET_SCHEDULER_Task * timeout_flush_task; }; @@ -162,7 +162,7 @@ static void cancel_timeout_flush (struct GNUNET_TESTBED_LOGGER_Handle *h) { GNUNET_SCHEDULER_cancel (h->timeout_flush_task); - h->timeout_flush_task = GNUNET_SCHEDULER_NO_TASK; + h->timeout_flush_task = NULL; } @@ -180,14 +180,14 @@ call_flush_completion (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) void *cb_cls; size_t bw; - h->flush_completion_task = GNUNET_SCHEDULER_NO_TASK; + h->flush_completion_task = NULL; bw = h->bwrote; h->bwrote = 0; cb = h->cb; h->cb = NULL; cb_cls = h->cb_cls; h->cb_cls = NULL; - if (GNUNET_SCHEDULER_NO_TASK != h->timeout_flush_task) + if (NULL != h->timeout_flush_task) cancel_timeout_flush (h); if (NULL != cb) cb (cb_cls, bw); @@ -202,7 +202,7 @@ call_flush_completion (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void trigger_flush_notification (struct GNUNET_TESTBED_LOGGER_Handle *h) { - if (GNUNET_SCHEDULER_NO_TASK != h->flush_completion_task) + if (NULL != h->flush_completion_task) GNUNET_SCHEDULER_cancel (h->flush_completion_task); h->flush_completion_task = GNUNET_SCHEDULER_add_now (&call_flush_completion, h); } @@ -354,7 +354,7 @@ GNUNET_TESTBED_LOGGER_disconnect (struct GNUNET_TESTBED_LOGGER_Handle *h) struct MessageQueue *mq; unsigned int lost; - if (GNUNET_SCHEDULER_NO_TASK != h->flush_completion_task) + if (NULL != h->flush_completion_task) GNUNET_SCHEDULER_cancel (h->flush_completion_task); lost = 0; while (NULL != (mq = h->mq_head)) @@ -425,15 +425,15 @@ timeout_flush (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_TESTBED_LOGGER_FlushCompletion cb; void *cb_cls; - h->timeout_flush_task = GNUNET_SCHEDULER_NO_TASK; + h->timeout_flush_task = NULL; cb = h->cb; h->cb = NULL; cb_cls = h->cb_cls; h->cb_cls = NULL; - if (GNUNET_SCHEDULER_NO_TASK != h->flush_completion_task) + if (NULL != h->flush_completion_task) { GNUNET_SCHEDULER_cancel (h->flush_completion_task); - h->flush_completion_task = GNUNET_SCHEDULER_NO_TASK; + h->flush_completion_task = NULL; } if (NULL != cb) cb (cb_cls, 0); @@ -456,7 +456,7 @@ GNUNET_TESTBED_LOGGER_flush (struct GNUNET_TESTBED_LOGGER_Handle *h, { h->cb = cb; h->cb_cls = cb_cls; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->timeout_flush_task); + GNUNET_assert (NULL == h->timeout_flush_task); h->timeout_flush_task = GNUNET_SCHEDULER_add_delayed (timeout, &timeout_flush, h); if (NULL == h->buf) @@ -478,12 +478,12 @@ GNUNET_TESTBED_LOGGER_flush (struct GNUNET_TESTBED_LOGGER_Handle *h, void GNUNET_TESTBED_LOGGER_flush_cancel (struct GNUNET_TESTBED_LOGGER_Handle *h) { - if (GNUNET_SCHEDULER_NO_TASK != h->flush_completion_task) + if (NULL != h->flush_completion_task) { GNUNET_SCHEDULER_cancel (h->flush_completion_task); - h->flush_completion_task = GNUNET_SCHEDULER_NO_TASK; + h->flush_completion_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->timeout_flush_task) + if (NULL != h->timeout_flush_task) cancel_timeout_flush (h); h->cb = NULL; h->cb_cls = NULL; diff --git a/src/testing/gnunet-testing.c b/src/testing/gnunet-testing.c index a79e836c73..2db2fd737e 100644 --- a/src/testing/gnunet-testing.c +++ b/src/testing/gnunet-testing.c @@ -76,7 +76,7 @@ static char *tmpfilename; /** * Task identifier of the task that waits for stdin. */ -static GNUNET_SCHEDULER_TaskIdentifier tid; +static struct GNUNET_SCHEDULER_Task * tid; /** * Peer started for '-r'. @@ -207,10 +207,10 @@ cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (0 != UNLINK (tmpfilename)) GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", tmpfilename); } - if (GNUNET_SCHEDULER_NO_TASK != tid) + if (NULL != tid) { GNUNET_SCHEDULER_cancel (tid); - tid = GNUNET_SCHEDULER_NO_TASK; + tid = NULL; } if (NULL != fh) { @@ -231,7 +231,7 @@ stdin_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { int c; - tid = GNUNET_SCHEDULER_NO_TASK; + tid = NULL; if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; GNUNET_assert (0 != (GNUNET_SCHEDULER_REASON_READ_READY & tc->reason)); diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index 640b0fbc0c..87b8998926 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c @@ -135,17 +135,17 @@ struct Peer * ID of task we use to wait for the time to send the next HELLO * to this peer. */ - GNUNET_SCHEDULER_TaskIdentifier hello_delay_task; + struct GNUNET_SCHEDULER_Task * hello_delay_task; /** * Task for issuing GNUNET_TRANSPORT_try_connect for this peer. */ - GNUNET_SCHEDULER_TaskIdentifier attempt_connect_task; + struct GNUNET_SCHEDULER_Task * attempt_connect_task; /** * ID of task we use to clear peers from the greylist. */ - GNUNET_SCHEDULER_TaskIdentifier greylist_clean_task; + struct GNUNET_SCHEDULER_Task * greylist_clean_task; /** * How often have we tried so far? @@ -216,7 +216,7 @@ static struct GNUNET_TIME_Absolute next_connect_attempt; /** * Task scheduled to try to add peers. */ -static GNUNET_SCHEDULER_TaskIdentifier add_task; +static struct GNUNET_SCHEDULER_Task * add_task; /** * Flag to disallow non-friend connections (pure F2F mode). @@ -331,11 +331,11 @@ free_peer (void *cls, const struct GNUNET_PeerIdentity * pid, void *value) GNUNET_CONTAINER_multipeermap_remove (peers, pid, pos)); if (pos->hello_req != NULL) GNUNET_CORE_notify_transmit_ready_cancel (pos->hello_req); - if (pos->hello_delay_task != GNUNET_SCHEDULER_NO_TASK) + if (pos->hello_delay_task != NULL) GNUNET_SCHEDULER_cancel (pos->hello_delay_task); - if (pos->attempt_connect_task != GNUNET_SCHEDULER_NO_TASK) + if (pos->attempt_connect_task != NULL) GNUNET_SCHEDULER_cancel (pos->attempt_connect_task); - if (pos->greylist_clean_task != GNUNET_SCHEDULER_NO_TASK) + if (pos->greylist_clean_task != NULL) GNUNET_SCHEDULER_cancel (pos->greylist_clean_task); GNUNET_free_non_null (pos->hello); if (pos->filter != NULL) @@ -395,7 +395,7 @@ attempt_connect (struct Peer *pos) pos->next_connect_attempt = GNUNET_TIME_absolute_min (pos->next_connect_attempt, GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), MIN_CONNECT_FREQUENCY_DELAY)); - if (pos->greylist_clean_task != GNUNET_SCHEDULER_NO_TASK) + if (pos->greylist_clean_task != NULL) GNUNET_SCHEDULER_cancel (pos->greylist_clean_task); pos->greylist_clean_task = GNUNET_SCHEDULER_add_delayed (rem, &remove_from_greylist, pos); @@ -422,7 +422,7 @@ do_attempt_connect (void *cls, struct Peer *pos = cls; struct GNUNET_TIME_Relative delay; - pos->attempt_connect_task = GNUNET_SCHEDULER_NO_TASK; + pos->attempt_connect_task = NULL; if (GNUNET_YES == pos->is_connected) return; @@ -454,7 +454,7 @@ do_attempt_connect (void *cls, static void schedule_attempt_connect (struct Peer *pos) { - if (GNUNET_SCHEDULER_NO_TASK != pos->attempt_connect_task) + if (NULL != pos->attempt_connect_task) return; pos->attempt_connect_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining (next_connect_attempt), &do_attempt_connect, @@ -475,7 +475,7 @@ remove_from_greylist (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct Peer *pos = cls; struct GNUNET_TIME_Relative rem; - pos->greylist_clean_task = GNUNET_SCHEDULER_NO_TASK; + pos->greylist_clean_task = NULL; rem = GNUNET_TIME_absolute_get_remaining (pos->greylisted_until); if (0 == rem.rel_value_us) { @@ -646,7 +646,7 @@ schedule_next_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) size_t next_want; struct GNUNET_TIME_Relative delay; - pl->hello_delay_task = GNUNET_SCHEDULER_NO_TASK; + pl->hello_delay_task = NULL; GNUNET_assert (GNUNET_YES == pl->is_connected); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; /* we're out of here */ @@ -702,10 +702,10 @@ reschedule_hellos (void *cls, const struct GNUNET_PeerIdentity * pid, void *valu GNUNET_CORE_notify_transmit_ready_cancel (peer->hello_req); peer->hello_req = NULL; } - if (peer->hello_delay_task != GNUNET_SCHEDULER_NO_TASK) + if (peer->hello_delay_task != NULL) { GNUNET_SCHEDULER_cancel (peer->hello_delay_task); - peer->hello_delay_task = GNUNET_SCHEDULER_NO_TASK; + peer->hello_delay_task = NULL; } peer->hello_delay_task = GNUNET_SCHEDULER_add_now (&schedule_next_hello, peer); @@ -787,7 +787,7 @@ try_add_peers (void *cls, const struct GNUNET_PeerIdentity * pid, void *value) static void add_peer_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - add_task = GNUNET_SCHEDULER_NO_TASK; + add_task = NULL; GNUNET_CONTAINER_multipeermap_iterate (peers, &try_add_peers, NULL); } @@ -827,10 +827,10 @@ disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) GNUNET_CORE_notify_transmit_ready_cancel (pos->hello_req); pos->hello_req = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != pos->hello_delay_task) + if (NULL != pos->hello_delay_task) { GNUNET_SCHEDULER_cancel (pos->hello_delay_task); - pos->hello_delay_task = GNUNET_SCHEDULER_NO_TASK; + pos->hello_delay_task = NULL; } GNUNET_STATISTICS_set (stats, gettext_noop ("# peers connected"), connection_count, GNUNET_NO); @@ -842,7 +842,7 @@ disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) } if (((connection_count < target_connection_count) || (friend_count < minimum_friend_count)) && - (GNUNET_SCHEDULER_NO_TASK == add_task)) + (NULL == add_task)) add_task = GNUNET_SCHEDULER_add_now (&add_peer_task, NULL); if ((friend_count < minimum_friend_count) && (blacklist == NULL)) blacklist = GNUNET_TRANSPORT_blacklist (cfg, &blacklist_check, NULL); @@ -1179,7 +1179,7 @@ hello_advertising_ready (void *cls, size_t size, void *buf) GNUNET_NO); } - if (pl->hello_delay_task != GNUNET_SCHEDULER_NO_TASK) + if (pl->hello_delay_task != NULL) GNUNET_SCHEDULER_cancel (pl->hello_delay_task); pl->next_hello_allowed = GNUNET_TIME_relative_to_absolute (HELLO_ADVERTISEMENT_MIN_FREQUENCY); @@ -1211,10 +1211,10 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) handle = NULL; } whitelist_peers (); - if (GNUNET_SCHEDULER_NO_TASK != add_task) + if (NULL != add_task) { GNUNET_SCHEDULER_cancel (add_task); - add_task = GNUNET_SCHEDULER_NO_TASK; + add_task = NULL; } GNUNET_CONTAINER_multipeermap_iterate (peers, &free_peer, NULL); GNUNET_CONTAINER_multipeermap_destroy (peers); diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 63f8f9f68c..cd131ae39f 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -68,7 +68,7 @@ struct SessionKiller /** * The kill task. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; }; struct BlacklistCheckContext @@ -246,7 +246,7 @@ kill_session_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct SessionKiller *sk = cls; - sk->task = GNUNET_SCHEDULER_NO_TASK; + sk->task = NULL; GNUNET_CONTAINER_DLL_remove(sk_head, sk_tail, sk); sk->plugin->disconnect_session (sk->plugin->cls, sk->session); GNUNET_free(sk); diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c index b7303f8ebb..f1904a5d3f 100644 --- a/src/transport/gnunet-service-transport_blacklist.c +++ b/src/transport/gnunet-service-transport_blacklist.c @@ -159,7 +159,7 @@ struct GST_BlacklistCheck /** * Current task performing the check. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; }; @@ -230,7 +230,7 @@ client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client) GNUNET_SERVER_notify_transmit_ready_cancel (bc->th); bc->th = NULL; } - if (bc->task == GNUNET_SCHEDULER_NO_TASK) + if (bc->task == NULL) bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, bc); } GNUNET_CONTAINER_DLL_remove (bl_head, bl_tail, bl); @@ -392,7 +392,7 @@ transmit_blacklist_message (void *cls, size_t size, void *buf) bc->th = NULL; if (size == 0) { - GNUNET_assert (bc->task == GNUNET_SCHEDULER_NO_TASK); + GNUNET_assert (bc->task == NULL); bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, bc); GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to send blacklist test for peer `%s' to client\n", @@ -432,7 +432,7 @@ do_blacklist_check (void *cls, struct GST_BlacklistCheck *bc = cls; struct Blacklisters *bl; - bc->task = GNUNET_SCHEDULER_NO_TASK; + bc->task = NULL; bl = bc->bl_pos; if (bl == NULL) { @@ -642,7 +642,7 @@ GST_blacklist_handle_reply (void *cls, struct GNUNET_SERVER_Client *client, } /* check if any other blacklist checks are waiting for this blacklister */ for (bc = bc_head; bc != NULL; bc = bc->next) - if ((bc->bl_pos == bl) && (GNUNET_SCHEDULER_NO_TASK == bc->task)) + if ((bc->bl_pos == bl) && (NULL == bc->task)) { bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, bc); break; @@ -817,10 +817,10 @@ GST_blacklist_test_cancel (struct GST_BlacklistCheck *bc) bc->bl_pos->bc = NULL; } } - if (GNUNET_SCHEDULER_NO_TASK != bc->task) + if (NULL != bc->task) { GNUNET_SCHEDULER_cancel (bc->task); - bc->task = GNUNET_SCHEDULER_NO_TASK; + bc->task = NULL; } if (NULL != bc->th) { diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c index 49992222da..43c938a5ea 100644 --- a/src/transport/gnunet-service-transport_hello.c +++ b/src/transport/gnunet-service-transport_hello.c @@ -107,7 +107,7 @@ struct OwnAddressList *oal_tail; /** * Identifier of 'refresh_hello' task. */ -static GNUNET_SCHEDULER_TaskIdentifier hello_task; +static struct GNUNET_SCHEDULER_Task * hello_task; /** @@ -164,7 +164,7 @@ refresh_hello_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GeneratorContext gc; int friend_only; - hello_task = GNUNET_SCHEDULER_NO_TASK; + hello_task = NULL; gc.addr_pos = oal_head; gc.expiration = GNUNET_TIME_relative_to_absolute (hello_expiration); @@ -198,7 +198,7 @@ refresh_hello_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void refresh_hello () { - if (hello_task != GNUNET_SCHEDULER_NO_TASK) + if (hello_task != NULL) GNUNET_SCHEDULER_cancel (hello_task); hello_task = GNUNET_SCHEDULER_add_now (&refresh_hello_task, NULL); } @@ -231,10 +231,10 @@ GST_hello_stop () { hello_cb = NULL; hello_cb_cls = NULL; - if (GNUNET_SCHEDULER_NO_TASK != hello_task) + if (NULL != hello_task) { GNUNET_SCHEDULER_cancel (hello_task); - hello_task = GNUNET_SCHEDULER_NO_TASK; + hello_task = NULL; } if (NULL != our_hello) { diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c index bfd2594a8e..0d0249bc26 100644 --- a/src/transport/gnunet-service-transport_manipulation.c +++ b/src/transport/gnunet-service-transport_manipulation.c @@ -92,7 +92,7 @@ struct TM_Peer /** * Task to schedule delayed sendding */ - GNUNET_SCHEDULER_TaskIdentifier send_delay_task; + struct GNUNET_SCHEDULER_Task * send_delay_task; /** * Send queue DLL head @@ -191,7 +191,7 @@ struct DelayQueueEntry *generic_dqe_tail; /** * Task to schedule delayed sending based on general delay */ -GNUNET_SCHEDULER_TaskIdentifier generic_send_delay_task; +struct GNUNET_SCHEDULER_Task * generic_send_delay_task; static void set_metric(struct TM_Peer *dest, int direction, uint32_t type, uint32_t value) @@ -358,7 +358,7 @@ send_delayed(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (NULL != tmp) { GNUNET_break(GNUNET_YES == GST_neighbours_test_connected (&dqe->id)); - tmp->send_delay_task = GNUNET_SCHEDULER_NO_TASK; + tmp->send_delay_task = NULL; GNUNET_CONTAINER_DLL_remove(tmp->send_head, tmp->send_tail, dqe); GST_neighbours_send(&dqe->id, dqe->msg, dqe->msg_size, dqe->timeout, dqe->cont, dqe->cont_cls); @@ -376,7 +376,7 @@ send_delayed(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { /* Remove from generic queue */ GNUNET_break(GNUNET_YES == GST_neighbours_test_connected (&dqe->id)); - generic_send_delay_task = GNUNET_SCHEDULER_NO_TASK; + generic_send_delay_task = NULL; GNUNET_CONTAINER_DLL_remove(generic_dqe_head, generic_dqe_tail, dqe); GST_neighbours_send(&dqe->id, dqe->msg, dqe->msg_size, dqe->timeout, dqe->cont, dqe->cont_cls); @@ -434,7 +434,7 @@ GST_manipulation_send(const struct GNUNET_PeerIdentity *target, const void *msg, dqe->timeout = timeout; memcpy(dqe->msg, msg, msg_size); GNUNET_CONTAINER_DLL_insert_tail(tmp->send_head, tmp->send_tail, dqe); - if (GNUNET_SCHEDULER_NO_TASK == tmp->send_delay_task) + if (NULL == tmp->send_delay_task) tmp->send_delay_task = GNUNET_SCHEDULER_add_delayed(delay, &send_delayed, dqe); GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, @@ -462,7 +462,7 @@ GST_manipulation_send(const struct GNUNET_PeerIdentity *target, const void *msg, dqe->timeout = timeout; memcpy(dqe->msg, msg, msg_size); GNUNET_CONTAINER_DLL_insert_tail(generic_dqe_head, generic_dqe_tail, dqe); - if (GNUNET_SCHEDULER_NO_TASK == generic_send_delay_task) + if (NULL == generic_send_delay_task) { generic_send_delay_task = GNUNET_SCHEDULER_add_delayed(delay, &send_delayed, dqe); @@ -642,10 +642,10 @@ free_tmps(void *cls, const struct GNUNET_PeerIdentity *key, void *value) dqe->cont(dqe->cont_cls, GNUNET_SYSERR, dqe->msg_size, 0); GNUNET_free(dqe); } - if (GNUNET_SCHEDULER_NO_TASK != tmp->send_delay_task) + if (NULL != tmp->send_delay_task) { GNUNET_SCHEDULER_cancel(tmp->send_delay_task); - tmp->send_delay_task = GNUNET_SCHEDULER_NO_TASK; + tmp->send_delay_task = NULL; } GNUNET_free(tmp); } @@ -693,10 +693,10 @@ GST_manipulation_peer_disconnect(const struct GNUNET_PeerIdentity *peer) GNUNET_free(dqe); } } - if (GNUNET_SCHEDULER_NO_TASK != generic_send_delay_task) + if (NULL != generic_send_delay_task) { GNUNET_SCHEDULER_cancel(generic_send_delay_task); - generic_send_delay_task = GNUNET_SCHEDULER_NO_TASK; + generic_send_delay_task = NULL; if (NULL != generic_dqe_head) generic_send_delay_task = GNUNET_SCHEDULER_add_delayed( GNUNET_TIME_absolute_get_remaining(generic_dqe_head->sent_at), @@ -725,10 +725,10 @@ GST_manipulation_stop() cur->cont(cur->cont_cls, GNUNET_SYSERR, cur->msg_size, 0); GNUNET_free(cur); } - if (GNUNET_SCHEDULER_NO_TASK != generic_send_delay_task) + if (NULL != generic_send_delay_task) { GNUNET_SCHEDULER_cancel(generic_send_delay_task); - generic_send_delay_task = GNUNET_SCHEDULER_NO_TASK; + generic_send_delay_task = NULL; } free_metric(&man_handle.general); diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 695adedc9a..b4db4c2cbc 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -344,12 +344,12 @@ struct NeighbourMapEntry * Main task that drives this peer (timeouts, keepalives, etc.). * Always runs the 'master_task'. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * Task to disconnect neighbour after we received a DISCONNECT message */ - GNUNET_SCHEDULER_TaskIdentifier delayed_disconnect_task; + struct GNUNET_SCHEDULER_Task * delayed_disconnect_task; /** * At what time should we sent the next keep-alive message? @@ -539,7 +539,7 @@ static unsigned long long bytes_in_send_queue; /** * Task transmitting utilization data */ -static GNUNET_SCHEDULER_TaskIdentifier util_transmission_tk; +static struct GNUNET_SCHEDULER_Task * util_transmission_tk; static struct GNUNET_CONTAINER_MultiPeerMap *registered_quota_notifications; @@ -956,17 +956,17 @@ free_neighbour (struct NeighbourMapEntry *n, } /* Cancel the disconnect task */ - if (GNUNET_SCHEDULER_NO_TASK != n->delayed_disconnect_task) + if (NULL != n->delayed_disconnect_task) { GNUNET_SCHEDULER_cancel (n->delayed_disconnect_task); - n->delayed_disconnect_task = GNUNET_SCHEDULER_NO_TASK; + n->delayed_disconnect_task = NULL; } /* Cancel the master task */ - if (GNUNET_SCHEDULER_NO_TASK != n->task) + if (NULL != n->task) { GNUNET_SCHEDULER_cancel (n->task); - n->task = GNUNET_SCHEDULER_NO_TASK; + n->task = NULL; } /* free rest of memory */ GNUNET_free (n); @@ -1054,7 +1054,7 @@ send_disconnect_cont (void *cls, const struct GNUNET_PeerIdentity *target, return; /* already gone */ if (GNUNET_TRANSPORT_PS_DISCONNECT != n->state) return; /* have created a fresh entry since */ - if (GNUNET_SCHEDULER_NO_TASK != n->task) + if (NULL != n->task) GNUNET_SCHEDULER_cancel (n->task); n->task = GNUNET_SCHEDULER_add_now (&master_task, n); } @@ -1168,7 +1168,7 @@ disconnect_neighbour (struct NeighbourMapEntry *n) break; } /* schedule timeout to clean up */ - if (GNUNET_SCHEDULER_NO_TASK != n->task) + if (NULL != n->task) GNUNET_SCHEDULER_cancel (n->task); n->task = GNUNET_SCHEDULER_add_delayed (DISCONNECT_SENT_TIMEOUT, &master_task, n); @@ -1202,7 +1202,7 @@ transmit_send_continuation (void *cls, /* this is still "our" neighbour, remove us from its queue and allow it to send the next message now */ n->is_active = NULL; - if (GNUNET_SCHEDULER_NO_TASK != n->task) + if (NULL != n->task) GNUNET_SCHEDULER_cancel (n->task); n->task = GNUNET_SCHEDULER_add_now (&master_task, n); } @@ -1650,7 +1650,7 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target, const void *msg, msg_size, GNUNET_i2s (target)); GNUNET_CONTAINER_DLL_insert_tail (n->messages_head, n->messages_tail, mq); - if (GNUNET_SCHEDULER_NO_TASK != n->task) + if (NULL != n->task) GNUNET_SCHEDULER_cancel (n->task); n->task = GNUNET_SCHEDULER_add_now (&master_task, n); } @@ -2862,7 +2862,7 @@ static void utilization_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - util_transmission_tk = GNUNET_SCHEDULER_NO_TASK; + util_transmission_tk = NULL; if (0 < GNUNET_CONTAINER_multipeermap_size (neighbours)) GNUNET_CONTAINER_multipeermap_iterate (neighbours, send_utilization_data, NULL); @@ -2945,7 +2945,7 @@ master_task (void *cls, struct NeighbourMapEntry *n = cls; struct GNUNET_TIME_Relative delay; - n->task = GNUNET_SCHEDULER_NO_TASK; + n->task = NULL; delay = GNUNET_TIME_absolute_get_remaining (n->timeout); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Master task runs for neighbour `%s' in state %s with timeout in %s\n", @@ -3081,7 +3081,7 @@ master_task (void *cls, delay = GNUNET_TIME_relative_min (GNUNET_TIME_absolute_get_remaining (n->keep_alive_time), delay); } - if (GNUNET_SCHEDULER_NO_TASK == n->task) + if (NULL == n->task) n->task = GNUNET_SCHEDULER_add_delayed (delay, &master_task, n); @@ -3405,7 +3405,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, GNUNET_break (0); break; } - if (GNUNET_SCHEDULER_NO_TASK != n->task) + if (NULL != n->task) GNUNET_SCHEDULER_cancel (n->task); n->task = GNUNET_SCHEDULER_add_now (&master_task, n); return GNUNET_YES; @@ -3577,7 +3577,7 @@ void delayed_disconnect (void *cls, { struct NeighbourMapEntry *n = cls; - n->delayed_disconnect_task = GNUNET_SCHEDULER_NO_TASK; + n->delayed_disconnect_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Disconnecting by request from peer %s\n", GNUNET_i2s (&n->id)); @@ -3884,10 +3884,10 @@ GST_neighbours_stop () if (NULL == neighbours) return; - if (GNUNET_SCHEDULER_NO_TASK != util_transmission_tk) + if (NULL != util_transmission_tk) { GNUNET_SCHEDULER_cancel (util_transmission_tk); - util_transmission_tk = GNUNET_SCHEDULER_NO_TASK; + util_transmission_tk = NULL; } GNUNET_CONTAINER_multipeermap_iterate (neighbours, &disconnect_all_neighbours, diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 3c7edd1403..a6a591c847 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c @@ -206,12 +206,12 @@ struct ValidationEntry /** * ID of task that will clean up this entry if nothing happens. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * ID of task that will trigger address revalidation. */ - GNUNET_SCHEDULER_TaskIdentifier revalidation_task; + struct GNUNET_SCHEDULER_Task * revalidation_task; /** * At what time did we send the latest validation request (PING)? @@ -441,15 +441,15 @@ cleanup_validation_entry (void *cls, GNUNET_CONTAINER_multipeermap_remove (validation_map, &ve->pid, ve)); GNUNET_HELLO_address_free (ve->address); - if (GNUNET_SCHEDULER_NO_TASK != ve->timeout_task) + if (NULL != ve->timeout_task) { GNUNET_SCHEDULER_cancel (ve->timeout_task); - ve->timeout_task = GNUNET_SCHEDULER_NO_TASK; + ve->timeout_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != ve->revalidation_task) + if (NULL != ve->revalidation_task) { GNUNET_SCHEDULER_cancel (ve->revalidation_task); - ve->revalidation_task = GNUNET_SCHEDULER_NO_TASK; + ve->revalidation_task = NULL; } if ((GNUNET_YES == ve->expecting_pong) && (validations_running > 0)) @@ -479,7 +479,7 @@ timeout_hello_validation (void *cls, struct GNUNET_TIME_Absolute max; struct GNUNET_TIME_Relative left; - ve->timeout_task = GNUNET_SCHEDULER_NO_TASK; + ve->timeout_task = NULL; max = GNUNET_TIME_absolute_max (ve->valid_until, ve->revalidation_block); left = GNUNET_TIME_absolute_get_remaining (max); if (left.rel_value_us > 0) @@ -653,7 +653,7 @@ revalidate_address (void *cls, struct GST_BlacklistCheck *bc; uint32_t rdelay; - ve->revalidation_task = GNUNET_SCHEDULER_NO_TASK; + ve->revalidation_task = NULL; delay = GNUNET_TIME_absolute_get_remaining (ve->revalidation_block); /* How long until we can possibly permit the next PING? */ if (GNUNET_YES == ve->in_use) @@ -816,7 +816,7 @@ add_valid_address (void *cls, ve = find_validation_entry (&public_key, address); ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until, expiration); - if (GNUNET_SCHEDULER_NO_TASK == ve->revalidation_task) + if (NULL == ve->revalidation_task) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting revalidations for valid address `%s'\n", @@ -1270,7 +1270,7 @@ validate_address_iterator (void *cls, if (papi == NULL) { /* This plugin is currently unvailable ... retry later */ - if (GNUNET_SCHEDULER_NO_TASK == ve->revalidation_task) + if (NULL == ve->revalidation_task) { if (GNUNET_YES == ve->in_use) canonical_delay = CONNECTED_PING_FREQUENCY; @@ -1292,7 +1292,7 @@ validate_address_iterator (void *cls, } - if (GNUNET_SCHEDULER_NO_TASK == ve->revalidation_task) + if (NULL == ve->revalidation_task) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Validation process started for fresh address `%s'\n", diff --git a/src/transport/gnunet-transport-profiler.c b/src/transport/gnunet-transport-profiler.c index fc3c32a40e..c785653c8b 100644 --- a/src/transport/gnunet-transport-profiler.c +++ b/src/transport/gnunet-transport-profiler.c @@ -142,7 +142,7 @@ static struct GNUNET_PeerIdentity pid; /** * Task scheduled for cleanup / termination of the process. */ -static GNUNET_SCHEDULER_TaskIdentifier end; +static struct GNUNET_SCHEDULER_Task * end; /** * Selected level of verbosity. @@ -370,7 +370,7 @@ iteration_done () if (it_count == benchmark_iterations) { benchmark_running = GNUNET_NO; - if (GNUNET_SCHEDULER_NO_TASK != end) + if (NULL != end) GNUNET_SCHEDULER_cancel (end); end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); return; @@ -490,7 +490,7 @@ try_connect_cb (void *cls, FPRINTF (stderr, "%s", _("Failed to send connect request to transport service\n")); - if (GNUNET_SCHEDULER_NO_TASK != end) + if (NULL != end) GNUNET_SCHEDULER_cancel (end); end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); ret = 1; diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index cd74abde7f..635213c292 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c @@ -208,7 +208,7 @@ struct TestContext /** * Task identifier for the timeout. */ - GNUNET_SCHEDULER_TaskIdentifier tsk; + struct GNUNET_SCHEDULER_Task * tsk; /** * Name of plugin under test. @@ -424,12 +424,12 @@ static struct GNUNET_PeerIdentity pid; /** * Task scheduled for cleanup / termination of the process. */ -static GNUNET_SCHEDULER_TaskIdentifier end; +static struct GNUNET_SCHEDULER_Task * end; /** * Task for operation timeout */ -static GNUNET_SCHEDULER_TaskIdentifier op_timeout; +static struct GNUNET_SCHEDULER_Task * op_timeout; /** * Selected level of verbosity. @@ -522,11 +522,11 @@ shutdown_task (void *cls, struct ValidationResolutionContext *cur; struct ValidationResolutionContext *next; - end = GNUNET_SCHEDULER_NO_TASK; - if (GNUNET_SCHEDULER_NO_TASK != op_timeout) + end = NULL; + if (NULL != op_timeout) { GNUNET_SCHEDULER_cancel (op_timeout); - op_timeout = GNUNET_SCHEDULER_NO_TASK; + op_timeout = NULL; } if (NULL != tc_handle) { @@ -612,13 +612,13 @@ operation_timeout (void *cls, { struct PeerResolutionContext *cur; struct PeerResolutionContext *next; - op_timeout = GNUNET_SCHEDULER_NO_TASK; + op_timeout = NULL; if ((try_connect) || (benchmark_send) || (benchmark_receive)) { FPRINTF (stdout, _("Failed to connect to `%s'\n"), GNUNET_i2s_full (&pid)); - if (GNUNET_SCHEDULER_NO_TASK != end) + if (NULL != end) GNUNET_SCHEDULER_cancel (end); end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); ret = 1; @@ -644,7 +644,7 @@ operation_timeout (void *cls, FPRINTF (stdout, "%s", _("Failed to list connections, timeout occured\n")); - if (GNUNET_SCHEDULER_NO_TASK != end) + if (NULL != end) GNUNET_SCHEDULER_cancel (end); end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); ret = 1; @@ -709,10 +709,10 @@ display_test_result (struct TestContext *tc, _("Configuration for plugin `%s' is working!\n"), tc->name); } - if (GNUNET_SCHEDULER_NO_TASK != tc->tsk) + if (NULL != tc->tsk) { GNUNET_SCHEDULER_cancel (tc->tsk); - tc->tsk = GNUNET_SCHEDULER_NO_TASK; + tc->tsk = NULL; } if (NULL != tc->tst) { @@ -873,15 +873,15 @@ process_validation_string (void *cls, GNUNET_free (vc); if ((0 == address_resolutions) && (iterate_validation)) { - if (GNUNET_SCHEDULER_NO_TASK != end) + if (NULL != end) { GNUNET_SCHEDULER_cancel (end); - end = GNUNET_SCHEDULER_NO_TASK; + end = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != op_timeout) + if (NULL != op_timeout) { GNUNET_SCHEDULER_cancel (op_timeout); - op_timeout = GNUNET_SCHEDULER_NO_TASK; + op_timeout = NULL; } ret = 0; end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); @@ -966,7 +966,7 @@ process_validation_cb (void *cls, /* done */ vic = NULL; - if (GNUNET_SCHEDULER_NO_TASK != end) + if (NULL != end) GNUNET_SCHEDULER_cancel (end); end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); return; @@ -975,7 +975,7 @@ process_validation_cb (void *cls, { /* invalid response */ vic = NULL; - if (GNUNET_SCHEDULER_NO_TASK != end) + if (NULL != end) GNUNET_SCHEDULER_cancel (end); end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); return; @@ -1140,23 +1140,23 @@ notify_connect (void *cls, GNUNET_i2s_full (peer)); ret = 0; - if (GNUNET_SCHEDULER_NO_TASK != op_timeout) + if (NULL != op_timeout) { GNUNET_SCHEDULER_cancel (op_timeout); - op_timeout = GNUNET_SCHEDULER_NO_TASK; + op_timeout = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != end) + if (NULL != end) GNUNET_SCHEDULER_cancel (end); end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); return; } if (benchmark_send) { - if (GNUNET_SCHEDULER_NO_TASK != op_timeout) + if (NULL != op_timeout) { GNUNET_SCHEDULER_cancel (op_timeout); - op_timeout = GNUNET_SCHEDULER_NO_TASK; + op_timeout = NULL; } if (verbosity > 0) FPRINTF (stdout, @@ -1197,13 +1197,13 @@ notify_disconnect (void *cls, GNUNET_i2s_full (peer)); ret = 0; - if (GNUNET_SCHEDULER_NO_TASK != op_timeout) + if (NULL != op_timeout) { GNUNET_SCHEDULER_cancel (op_timeout); - op_timeout = GNUNET_SCHEDULER_NO_TASK; + op_timeout = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != end) + if (NULL != end) GNUNET_SCHEDULER_cancel (end); end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); return; @@ -1218,7 +1218,7 @@ notify_disconnect (void *cls, { FPRINTF (stdout, _("Disconnected from peer `%s' while benchmarking\n"), GNUNET_i2s (&pid)); - if (GNUNET_SCHEDULER_NO_TASK != end) + if (NULL != end) GNUNET_SCHEDULER_cancel (end); return; } @@ -1431,15 +1431,15 @@ process_peer_string (void *cls, GNUNET_free (rc); if ((0 == address_resolutions) && (iterate_connections)) { - if (GNUNET_SCHEDULER_NO_TASK != end) + if (NULL != end) { GNUNET_SCHEDULER_cancel (end); - end = GNUNET_SCHEDULER_NO_TASK; + end = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != op_timeout) + if (NULL != op_timeout) { GNUNET_SCHEDULER_cancel (op_timeout); - op_timeout = GNUNET_SCHEDULER_NO_TASK; + op_timeout = NULL; } ret = 0; end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); @@ -1498,7 +1498,7 @@ process_peer_iteration_cb (void *cls, /* done */ address_resolution_in_progress = GNUNET_NO; pic = NULL; - if (GNUNET_SCHEDULER_NO_TASK != end) + if (NULL != end) GNUNET_SCHEDULER_cancel (end); end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); return; @@ -1508,7 +1508,7 @@ process_peer_iteration_cb (void *cls, (GNUNET_NO == GNUNET_TRANSPORT_is_connected(state))) return; /* Display only connected peers */ - if (GNUNET_SCHEDULER_NO_TASK != op_timeout) + if (NULL != op_timeout) GNUNET_SCHEDULER_cancel (op_timeout); op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout, @@ -1713,7 +1713,7 @@ process_peer_monitoring_cb (void *cls, return; } - if (GNUNET_SCHEDULER_NO_TASK != op_timeout) + if (NULL != op_timeout) GNUNET_SCHEDULER_cancel (op_timeout); op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout, @@ -1792,7 +1792,7 @@ try_connect_cb (void *cls, FPRINTF (stderr, "%s", _("Failed to send connect request to transport service\n")); - if (GNUNET_SCHEDULER_NO_TASK != end) + if (NULL != end) GNUNET_SCHEDULER_cancel (end); ret = 1; end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); @@ -1827,7 +1827,7 @@ try_disconnect_cb (void *cls, } FPRINTF (stderr, "%s", _("Failed to send disconnect request to transport service\n")); - if (GNUNET_SCHEDULER_NO_TASK != end) + if (NULL != end) GNUNET_SCHEDULER_cancel (end); ret = 1; end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); diff --git a/src/transport/plugin_transport_http.h b/src/transport/plugin_transport_http.h index d43eb9baba..9a0edb7190 100644 --- a/src/transport/plugin_transport_http.h +++ b/src/transport/plugin_transport_http.h @@ -118,7 +118,7 @@ struct Plugin /** * Task calling transport service about external address */ - GNUNET_SCHEDULER_TaskIdentifier notify_ext_task; + struct GNUNET_SCHEDULER_Task * notify_ext_task; /** * Plugin name. @@ -206,7 +206,7 @@ struct Plugin /** * MHD IPv4 task */ - GNUNET_SCHEDULER_TaskIdentifier server_v4_task; + struct GNUNET_SCHEDULER_Task * server_v4_task; /** * The IPv4 server is scheduled to run asap @@ -221,7 +221,7 @@ struct Plugin /** * MHD IPv4 task */ - GNUNET_SCHEDULER_TaskIdentifier server_v6_task; + struct GNUNET_SCHEDULER_Task * server_v6_task; /** * The IPv6 server is scheduled to run asap @@ -260,7 +260,7 @@ struct Plugin /** * curl perform task */ - GNUNET_SCHEDULER_TaskIdentifier client_perform_task; + struct GNUNET_SCHEDULER_Task * client_perform_task; }; @@ -426,12 +426,12 @@ struct Session /** * Task to wake up client receive handle when receiving is allowed again */ - GNUNET_SCHEDULER_TaskIdentifier recv_wakeup_task; + struct GNUNET_SCHEDULER_Task * recv_wakeup_task; /** * Session timeout task */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Is client send handle paused since there are no data to send? diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index 4cafaf2c04..cc1f39e9ac 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c @@ -222,17 +222,17 @@ struct Session /** * Session timeout task */ - GNUNET_SCHEDULER_TaskIdentifier put_disconnect_task; + struct GNUNET_SCHEDULER_Task * put_disconnect_task; /** * Session timeout task */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Task to wake up client receive handle when receiving is allowed again */ - GNUNET_SCHEDULER_TaskIdentifier recv_wakeup_task; + struct GNUNET_SCHEDULER_Task * recv_wakeup_task; /** * Absolute time when to receive data again. @@ -326,7 +326,7 @@ struct HTTP_Client_Plugin /** * curl perform task */ - GNUNET_SCHEDULER_TaskIdentifier client_perform_task; + struct GNUNET_SCHEDULER_Task * client_perform_task; /** * Type of proxy server: @@ -440,21 +440,21 @@ client_delete_session (struct Session *s) struct HTTP_Message *next; CURLMcode mret; - if (GNUNET_SCHEDULER_NO_TASK != s->timeout_task) + if (NULL != s->timeout_task) { GNUNET_SCHEDULER_cancel (s->timeout_task); - s->timeout_task = GNUNET_SCHEDULER_NO_TASK; + s->timeout_task = NULL; s->timeout = GNUNET_TIME_UNIT_ZERO_ABS; } - if (GNUNET_SCHEDULER_NO_TASK != s->put_disconnect_task) + if (NULL != s->put_disconnect_task) { GNUNET_SCHEDULER_cancel (s->put_disconnect_task); - s->put_disconnect_task = GNUNET_SCHEDULER_NO_TASK; + s->put_disconnect_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != s->recv_wakeup_task) + if (NULL != s->recv_wakeup_task) { GNUNET_SCHEDULER_cancel (s->recv_wakeup_task); - s->recv_wakeup_task = GNUNET_SCHEDULER_NO_TASK; + s->recv_wakeup_task = NULL; } GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multipeermap_remove (plugin->sessions, @@ -541,7 +541,7 @@ client_delete_session (struct Session *s) static void client_reschedule_session_timeout (struct Session *s) { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != s->timeout_task); + GNUNET_assert (NULL != s->timeout_task); s->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); } @@ -579,10 +579,10 @@ client_schedule (struct HTTP_Client_Plugin *plugin, struct GNUNET_TIME_Relative timeout; /* Cancel previous scheduled task */ - if (plugin->client_perform_task != GNUNET_SCHEDULER_NO_TASK) + if (plugin->client_perform_task != NULL) { GNUNET_SCHEDULER_cancel (plugin->client_perform_task); - plugin->client_perform_task = GNUNET_SCHEDULER_NO_TASK; + plugin->client_perform_task = NULL; } max = -1; FD_ZERO (&rs); @@ -802,9 +802,9 @@ http_client_plugin_send (void *cls, if (H_PAUSED == s->put.state) { /* PUT request was paused, unpause */ - GNUNET_assert (s->put_disconnect_task != GNUNET_SCHEDULER_NO_TASK); + GNUNET_assert (s->put_disconnect_task != NULL); GNUNET_SCHEDULER_cancel (s->put_disconnect_task); - s->put_disconnect_task = GNUNET_SCHEDULER_NO_TASK; + s->put_disconnect_task = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, "Session %p/request %p: unpausing request\n", s, s->put.easyhandle); @@ -851,10 +851,10 @@ http_client_plugin_session_disconnect (void *cls, client_delete_session (s); /* Re-schedule since handles have changed */ - if (plugin->client_perform_task != GNUNET_SCHEDULER_NO_TASK) + if (plugin->client_perform_task != NULL) { GNUNET_SCHEDULER_cancel (plugin->client_perform_task); - plugin->client_perform_task = GNUNET_SCHEDULER_NO_TASK; + plugin->client_perform_task = NULL; } client_schedule (plugin, GNUNET_YES); @@ -1001,7 +1001,7 @@ client_put_disconnect (void *cls, { struct Session *s = cls; - s->put_disconnect_task = GNUNET_SCHEDULER_NO_TASK; + s->put_disconnect_task = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, "Session %p/request %p: will be disconnected due to no activity\n", s, s->put.easyhandle); @@ -1132,7 +1132,7 @@ client_wake_up (void *cls, { struct Session *s = cls; - s->recv_wakeup_task = GNUNET_SCHEDULER_NO_TASK; + s->recv_wakeup_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -1141,9 +1141,9 @@ client_wake_up (void *cls, if (H_PAUSED == s->put.state) { /* PUT request was paused, unpause */ - GNUNET_assert (s->put_disconnect_task != GNUNET_SCHEDULER_NO_TASK); + GNUNET_assert (s->put_disconnect_task != NULL); GNUNET_SCHEDULER_cancel (s->put_disconnect_task); - s->put_disconnect_task = GNUNET_SCHEDULER_NO_TASK; + s->put_disconnect_task = NULL; s->put.state = H_CONNECTED; if (NULL != s->put.easyhandle) curl_easy_pause (s->put.easyhandle, CURLPAUSE_CONT); @@ -1271,10 +1271,10 @@ client_receive (void *stream, s->get.easyhandle, GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES)); - if (s->recv_wakeup_task != GNUNET_SCHEDULER_NO_TASK) + if (s->recv_wakeup_task != NULL) { GNUNET_SCHEDULER_cancel (s->recv_wakeup_task); - s->recv_wakeup_task = GNUNET_SCHEDULER_NO_TASK; + s->recv_wakeup_task = NULL; } s->recv_wakeup_task = GNUNET_SCHEDULER_add_delayed (delta, @@ -1313,7 +1313,7 @@ client_run (void *cls, int put_request; /* GNUNET_YES if easy handle is put, GNUNET_NO for get */ int msgs_left; - plugin->client_perform_task = GNUNET_SCHEDULER_NO_TASK; + plugin->client_perform_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -1918,10 +1918,10 @@ client_connect (struct Session *s) plugin->cur_requests, GNUNET_NO); /* Re-schedule since handles have changed */ - if (plugin->client_perform_task != GNUNET_SCHEDULER_NO_TASK) + if (plugin->client_perform_task != NULL) { GNUNET_SCHEDULER_cancel (plugin->client_perform_task); - plugin->client_perform_task = GNUNET_SCHEDULER_NO_TASK; + plugin->client_perform_task = NULL; } /* Schedule task to run immediately */ @@ -1958,7 +1958,7 @@ client_session_timeout (void *cls, struct Session *s = cls; struct GNUNET_TIME_Relative left; - s->timeout_task = GNUNET_SCHEDULER_NO_TASK; + s->timeout_task = NULL; left = GNUNET_TIME_absolute_get_remaining (s->timeout); if (0 != left.rel_value_us) { @@ -2166,10 +2166,10 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions, &destroy_session_cb, plugin); - if (GNUNET_SCHEDULER_NO_TASK != plugin->client_perform_task) + if (NULL != plugin->client_perform_task) { GNUNET_SCHEDULER_cancel (plugin->client_perform_task); - plugin->client_perform_task = GNUNET_SCHEDULER_NO_TASK; + plugin->client_perform_task = NULL; } if (NULL != plugin->curl_multi_handle) { @@ -2368,7 +2368,7 @@ http_client_plugin_update_inbound_delay (void *cls, "New inbound delay %s\n", GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_NO)); - if (s->recv_wakeup_task != GNUNET_SCHEDULER_NO_TASK) + if (s->recv_wakeup_task != NULL) { GNUNET_SCHEDULER_cancel (s->recv_wakeup_task); s->recv_wakeup_task = GNUNET_SCHEDULER_add_delayed (delay, diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c index acccf39f80..bd6838e1ca 100644 --- a/src/transport/plugin_transport_http_common.c +++ b/src/transport/plugin_transport_http_common.c @@ -205,7 +205,7 @@ struct PrettyPrinterContext /** * Timeout task */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Splitted Address diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 31bd7ba4fc..aaa17b2cff 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c @@ -232,12 +232,12 @@ struct Session /** * Session timeout task */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Task to resume MHD handling when receiving is allowed again */ - GNUNET_SCHEDULER_TaskIdentifier recv_wakeup_task; + struct GNUNET_SCHEDULER_Task * recv_wakeup_task; /** * Number of bytes waiting for transmission to this peer. @@ -374,17 +374,17 @@ struct HTTP_Server_Plugin /** * MHD IPv4 task */ - GNUNET_SCHEDULER_TaskIdentifier server_v4_task; + struct GNUNET_SCHEDULER_Task * server_v4_task; /** * MHD IPv6 task */ - GNUNET_SCHEDULER_TaskIdentifier server_v6_task; + struct GNUNET_SCHEDULER_Task * server_v6_task; /** * Task calling transport service about external address */ - GNUNET_SCHEDULER_TaskIdentifier notify_ext_task; + struct GNUNET_SCHEDULER_Task * notify_ext_task; /** * Notify transport only about external address @@ -499,7 +499,7 @@ server_wake_up (void *cls, { struct Session *s = cls; - s->recv_wakeup_task = GNUNET_SCHEDULER_NO_TASK; + s->recv_wakeup_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -534,16 +534,16 @@ server_delete_session (struct Session *s) struct HTTP_Server_Plugin *plugin = s->plugin; struct HTTP_Message *msg; - if (GNUNET_SCHEDULER_NO_TASK != s->timeout_task) + if (NULL != s->timeout_task) { GNUNET_SCHEDULER_cancel (s->timeout_task); - s->timeout_task = GNUNET_SCHEDULER_NO_TASK; + s->timeout_task = NULL; s->timeout = GNUNET_TIME_UNIT_ZERO_ABS; } - if (GNUNET_SCHEDULER_NO_TASK != s->recv_wakeup_task) + if (NULL != s->recv_wakeup_task) { GNUNET_SCHEDULER_cancel (s->recv_wakeup_task); - s->recv_wakeup_task = GNUNET_SCHEDULER_NO_TASK; + s->recv_wakeup_task = NULL; if (NULL != s->server_recv) MHD_resume_connection (s->server_recv->mhd_conn); } @@ -649,7 +649,7 @@ server_session_timeout (void *cls, struct Session *s = cls; struct GNUNET_TIME_Relative left; - s->timeout_task = GNUNET_SCHEDULER_NO_TASK; + s->timeout_task = NULL; left = GNUNET_TIME_absolute_get_remaining (s->timeout); if (0 != left.rel_value_us) { @@ -680,7 +680,7 @@ server_session_timeout (void *cls, static void server_reschedule_session_timeout (struct Session *s) { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != s->timeout_task); + GNUNET_assert (NULL != s->timeout_task); s->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); } @@ -917,7 +917,7 @@ server_v4_run (void *cls, { struct HTTP_Server_Plugin *plugin = cls; - plugin->server_v4_task = GNUNET_SCHEDULER_NO_TASK; + plugin->server_v4_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; plugin->server_v4_immediately = GNUNET_NO; @@ -939,7 +939,7 @@ server_v6_run (void *cls, { struct HTTP_Server_Plugin *plugin = cls; - plugin->server_v6_task = GNUNET_SCHEDULER_NO_TASK; + plugin->server_v6_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; plugin->server_v6_immediately = GNUNET_NO; @@ -957,12 +957,12 @@ server_v6_run (void *cls, * @param now schedule now * @return gnunet task identifier */ -static GNUNET_SCHEDULER_TaskIdentifier +static struct GNUNET_SCHEDULER_Task * server_schedule (struct HTTP_Server_Plugin *plugin, struct MHD_Daemon *daemon_handle, int now) { - GNUNET_SCHEDULER_TaskIdentifier ret; + struct GNUNET_SCHEDULER_Task * ret; fd_set rs; fd_set ws; fd_set es; @@ -975,9 +975,9 @@ server_schedule (struct HTTP_Server_Plugin *plugin, struct GNUNET_TIME_Relative tv; if (GNUNET_YES == plugin->in_shutdown) - return GNUNET_SCHEDULER_NO_TASK; + return NULL; - ret = GNUNET_SCHEDULER_NO_TASK; + ret = NULL; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); @@ -1015,10 +1015,10 @@ server_schedule (struct HTTP_Server_Plugin *plugin, if (daemon_handle == plugin->server_v4) { - if (plugin->server_v4_task != GNUNET_SCHEDULER_NO_TASK) + if (plugin->server_v4_task != NULL) { GNUNET_SCHEDULER_cancel (plugin->server_v4_task); - plugin->server_v4_task = GNUNET_SCHEDULER_NO_TASK; + plugin->server_v4_task = NULL; } #if 0 LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -1032,10 +1032,10 @@ server_schedule (struct HTTP_Server_Plugin *plugin, } if (daemon_handle == plugin->server_v6) { - if (plugin->server_v6_task != GNUNET_SCHEDULER_NO_TASK) + if (plugin->server_v6_task != NULL) { GNUNET_SCHEDULER_cancel (plugin->server_v6_task); - plugin->server_v6_task = GNUNET_SCHEDULER_NO_TASK; + plugin->server_v6_task = NULL; } #if 0 LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -1073,10 +1073,10 @@ server_reschedule (struct HTTP_Server_Plugin *plugin, if (GNUNET_YES == now) plugin->server_v4_immediately = GNUNET_YES; - if (plugin->server_v4_task != GNUNET_SCHEDULER_NO_TASK) + if (plugin->server_v4_task != NULL) { GNUNET_SCHEDULER_cancel (plugin->server_v4_task); - plugin->server_v4_task = GNUNET_SCHEDULER_NO_TASK; + plugin->server_v4_task = NULL; } plugin->server_v4_task = server_schedule (plugin, plugin->server_v4, now); } @@ -1089,10 +1089,10 @@ server_reschedule (struct HTTP_Server_Plugin *plugin, if (GNUNET_YES == now) plugin->server_v6_immediately = GNUNET_YES; - if (plugin->server_v6_task != GNUNET_SCHEDULER_NO_TASK) + if (plugin->server_v6_task != NULL) { GNUNET_SCHEDULER_cancel (plugin->server_v6_task); - plugin->server_v6_task = GNUNET_SCHEDULER_NO_TASK; + plugin->server_v6_task = NULL; } plugin->server_v6_task = server_schedule (plugin, plugin->server_v6, now); } @@ -1895,7 +1895,7 @@ server_access_cb (void *cls, s, sc, GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); GNUNET_assert(s->server_recv->mhd_conn == mhd_connection); MHD_suspend_connection (s->server_recv->mhd_conn); - if (GNUNET_SCHEDULER_NO_TASK == s->recv_wakeup_task) + if (NULL == s->recv_wakeup_task) s->recv_wakeup_task = GNUNET_SCHEDULER_add_delayed (delay, &server_wake_up, s); } @@ -2881,7 +2881,7 @@ server_notify_external_hostname (void *cls, unsigned int urlen; char *url; - plugin->notify_ext_task = GNUNET_SCHEDULER_NO_TASK; + plugin->notify_ext_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -3175,10 +3175,10 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) _("Shutting down plugin `%s'\n"), plugin->name); - if (GNUNET_SCHEDULER_NO_TASK != plugin->notify_ext_task) + if (NULL != plugin->notify_ext_task) { GNUNET_SCHEDULER_cancel (plugin->notify_ext_task); - plugin->notify_ext_task = GNUNET_SCHEDULER_NO_TASK; + plugin->notify_ext_task = NULL; } if (NULL != plugin->ext_addr) @@ -3213,16 +3213,16 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) MHD_stop_daemon (plugin->server_v6); plugin->server_v6 = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != plugin->server_v4_task) + if (NULL != plugin->server_v4_task) { GNUNET_SCHEDULER_cancel (plugin->server_v4_task); - plugin->server_v4_task = GNUNET_SCHEDULER_NO_TASK; + plugin->server_v4_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != plugin->server_v6_task) + if (NULL != plugin->server_v6_task) { GNUNET_SCHEDULER_cancel (plugin->server_v6_task); - plugin->server_v6_task = GNUNET_SCHEDULER_NO_TASK; + plugin->server_v6_task = NULL; } #if BUILD_HTTPS GNUNET_free_non_null (plugin->crypto_init); @@ -3309,7 +3309,7 @@ http_server_plugin_update_inbound_delay (void *cls, "New inbound delay %s\n", GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_NO)); - if (GNUNET_SCHEDULER_NO_TASK != session->recv_wakeup_task) + if (NULL != session->recv_wakeup_task) { GNUNET_SCHEDULER_cancel (session->recv_wakeup_task); session->recv_wakeup_task diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 021a647adb..4f7b576419 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c @@ -269,7 +269,7 @@ struct Session /** * Task cleaning up a NAT client connection establishment attempt; */ - GNUNET_SCHEDULER_TaskIdentifier nat_connection_timeout; + struct GNUNET_SCHEDULER_Task * nat_connection_timeout; /** * Messages currently pending for transmission @@ -296,12 +296,12 @@ struct Session /** * ID of task used to delay receiving more to throttle sender. */ - GNUNET_SCHEDULER_TaskIdentifier receive_delay_task; + struct GNUNET_SCHEDULER_Task * receive_delay_task; /** * Session timeout task */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * When will this session time out? @@ -435,7 +435,7 @@ struct Plugin /** * ID of task used to update our addresses when one expires. */ - GNUNET_SCHEDULER_TaskIdentifier address_update_task; + struct GNUNET_SCHEDULER_Task * address_update_task; /** * Address options @@ -480,7 +480,7 @@ notify_session_monitor (struct Plugin *plugin, : GNUNET_NO; info.num_msg_pending = session->msgs_in_queue; info.num_bytes_pending = session->bytes_in_queue; - if (GNUNET_SCHEDULER_NO_TASK != session->receive_delay_task) + if (NULL != session->receive_delay_task) info.receive_delay = session->receive_delay; info.session_timeout = session->timeout; info.address = session->address; @@ -813,10 +813,10 @@ tcp_plugin_disconnect_session (void *cls, session->address->address, session->address->address_length)); - if (GNUNET_SCHEDULER_NO_TASK != session->timeout_task) + if (NULL != session->timeout_task) { GNUNET_SCHEDULER_cancel (session->timeout_task); - session->timeout_task = GNUNET_SCHEDULER_NO_TASK; + session->timeout_task = NULL; session->timeout = GNUNET_TIME_UNIT_ZERO_ABS; } @@ -853,10 +853,10 @@ tcp_plugin_disconnect_session (void *cls, session->address, session); - if (GNUNET_SCHEDULER_NO_TASK != session->nat_connection_timeout) + if (NULL != session->nat_connection_timeout) { GNUNET_SCHEDULER_cancel (session->nat_connection_timeout); - session->nat_connection_timeout = GNUNET_SCHEDULER_NO_TASK; + session->nat_connection_timeout = NULL; } while (NULL != (pm = session->pending_messages_head)) @@ -894,7 +894,7 @@ tcp_plugin_disconnect_session (void *cls, session, GNUNET_TRANSPORT_SS_DONE); - if (session->receive_delay_task != GNUNET_SCHEDULER_NO_TASK) + if (session->receive_delay_task != NULL) { GNUNET_SCHEDULER_cancel (session->receive_delay_task); if (NULL != session->client) @@ -941,7 +941,7 @@ session_timeout (void *cls, struct Session *s = cls; struct GNUNET_TIME_Relative left; - s->timeout_task = GNUNET_SCHEDULER_NO_TASK; + s->timeout_task = NULL; left = GNUNET_TIME_absolute_get_remaining (s->timeout); if (0 != left.rel_value_us) { @@ -973,7 +973,7 @@ session_timeout (void *cls, static void reschedule_session_timeout (struct Session *s) { - GNUNET_assert(GNUNET_SCHEDULER_NO_TASK != s->timeout_task); + GNUNET_assert(NULL != s->timeout_task); s->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); } @@ -1417,7 +1417,7 @@ nat_connect_timeout (void *cls, { struct Session *session = cls; - session->nat_connection_timeout = GNUNET_SCHEDULER_NO_TASK; + session->nat_connection_timeout = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, "NAT WAIT connection to `%4s' at `%s' could not be established, removing session\n", GNUNET_i2s (&session->target), @@ -1460,7 +1460,7 @@ delayed_done (void *cls, { struct Session *session = cls; - session->receive_delay_task = GNUNET_SCHEDULER_NO_TASK; + session->receive_delay_task = NULL; reschedule_session_timeout (session); GNUNET_SERVER_receive_done (session->client, GNUNET_OK); @@ -1483,7 +1483,7 @@ tcp_plugin_update_inbound_delay (void *cls, struct Session *session, struct GNUNET_TIME_Relative delay) { - if (GNUNET_SCHEDULER_NO_TASK == session->receive_delay_task) + if (NULL == session->receive_delay_task) return; LOG (GNUNET_ERROR_TYPE_DEBUG, "New inbound delay %s\n", @@ -1846,7 +1846,7 @@ struct PrettyPrinterContext /** * Timeout task */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Resolver handle @@ -2166,10 +2166,10 @@ handle_tcp_nat_probe (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, "Found session for NAT probe!\n"); - if (session->nat_connection_timeout != GNUNET_SCHEDULER_NO_TASK) + if (session->nat_connection_timeout != NULL) { GNUNET_SCHEDULER_cancel (session->nat_connection_timeout); - session->nat_connection_timeout = GNUNET_SCHEDULER_NO_TASK; + session->nat_connection_timeout = NULL; } if (GNUNET_OK != GNUNET_SERVER_client_get_address (client, &vaddr, &alen)) diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 900cb15804..48535f28b8 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c @@ -102,7 +102,7 @@ struct PrettyPrinterContext /** * Timeout task */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * IPv6 address @@ -155,7 +155,7 @@ struct Session /** * Session timeout task */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * When does this session time out? @@ -566,7 +566,7 @@ schedule_select (struct Plugin *plugin) GNUNET_TIME_absolute_get_remaining ( udpw->session->flow_delay_from_other_peer)); - if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK ) + if (plugin->select_task != NULL ) GNUNET_SCHEDULER_cancel (plugin->select_task); /* Schedule with: @@ -587,7 +587,7 @@ schedule_select (struct Plugin *plugin) GNUNET_TIME_absolute_get_remaining ( udpw->session->flow_delay_from_other_peer)); - if (GNUNET_SCHEDULER_NO_TASK != plugin->select_task_v6) + if (NULL != plugin->select_task_v6) GNUNET_SCHEDULER_cancel (plugin->select_task_v6); plugin->select_task_v6 = GNUNET_SCHEDULER_add_select ( GNUNET_SCHEDULER_PRIORITY_DEFAULT, @@ -1332,10 +1332,10 @@ udp_disconnect_session (void *cls, GNUNET_i2s (&s->target), udp_address_to_string (NULL, s->address->address, s->address->address_length)); /* stop timeout task */ - if (GNUNET_SCHEDULER_NO_TASK != s->timeout_task) + if (NULL != s->timeout_task) { GNUNET_SCHEDULER_cancel (s->timeout_task); - s->timeout_task = GNUNET_SCHEDULER_NO_TASK; + s->timeout_task = NULL; } if (NULL != s->frag_ctx) { @@ -1500,7 +1500,7 @@ session_timeout (void *cls, struct Plugin *plugin = s->plugin; struct GNUNET_TIME_Relative left; - s->timeout_task = GNUNET_SCHEDULER_NO_TASK; + s->timeout_task = NULL; left = GNUNET_TIME_absolute_get_remaining (s->timeout); if (left.rel_value_us > 0) { @@ -1534,7 +1534,7 @@ reschedule_session_timeout (struct Session *s) { if (GNUNET_YES == s->in_destroy) return; - GNUNET_assert(GNUNET_SCHEDULER_NO_TASK != s->timeout_task); + GNUNET_assert(NULL != s->timeout_task); s->timeout = GNUNET_TIME_relative_to_absolute (UDP_SESSION_TIME_OUT); } @@ -3027,7 +3027,7 @@ udp_plugin_select (void *cls, { struct Plugin *plugin = cls; - plugin->select_task = GNUNET_SCHEDULER_NO_TASK; + plugin->select_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; if ((0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) @@ -3056,7 +3056,7 @@ udp_plugin_select_v6 (void *cls, { struct Plugin *plugin = cls; - plugin->select_task_v6 = GNUNET_SCHEDULER_NO_TASK; + plugin->select_task_v6 = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; if (((tc->reason & GNUNET_SCHEDULER_REASON_READ_READY) != 0) @@ -3610,15 +3610,15 @@ libgnunet_plugin_transport_udp_done (void *cls) return NULL; } stop_broadcast (plugin); - if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK ) + if (plugin->select_task != NULL ) { GNUNET_SCHEDULER_cancel (plugin->select_task); - plugin->select_task = GNUNET_SCHEDULER_NO_TASK; + plugin->select_task = NULL; } - if (plugin->select_task_v6 != GNUNET_SCHEDULER_NO_TASK ) + if (plugin->select_task_v6 != NULL ) { GNUNET_SCHEDULER_cancel (plugin->select_task_v6); - plugin->select_task_v6 = GNUNET_SCHEDULER_NO_TASK; + plugin->select_task_v6 = NULL; } /* Closing sockets */ diff --git a/src/transport/plugin_transport_udp.h b/src/transport/plugin_transport_udp.h index 3770b3b705..2e77b9010f 100644 --- a/src/transport/plugin_transport_udp.h +++ b/src/transport/plugin_transport_udp.h @@ -155,12 +155,12 @@ struct Plugin /** * ID of select task for IPv4 */ - GNUNET_SCHEDULER_TaskIdentifier select_task; + struct GNUNET_SCHEDULER_Task * select_task; /** * ID of select task for IPv6 */ - GNUNET_SCHEDULER_TaskIdentifier select_task_v6; + struct GNUNET_SCHEDULER_Task * select_task_v6; /** * Tokenizer for inbound messages. diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c index 9ed1bff65a..6566245cdf 100644 --- a/src/transport/plugin_transport_udp_broadcasting.c +++ b/src/transport/plugin_transport_udp_broadcasting.c @@ -84,7 +84,7 @@ struct BroadcastAddress /** * ID of select broadcast task */ - GNUNET_SCHEDULER_TaskIdentifier broadcast_task; + struct GNUNET_SCHEDULER_Task * broadcast_task; struct Plugin *plugin; @@ -302,7 +302,7 @@ udp_ipv4_broadcast_send (void *cls, uint16_t msg_size; char buf[65536] GNUNET_ALIGN; - baddr->broadcast_task = GNUNET_SCHEDULER_NO_TASK; + baddr->broadcast_task = NULL; msg_size = prepare_beacon(plugin, (struct UDP_Beacon_Message *) &buf); if (0 != msg_size) @@ -379,7 +379,7 @@ udp_ipv6_broadcast_send (void *cls, char buf[65536] GNUNET_ALIGN; const struct sockaddr_in6 *s6 = (const struct sockaddr_in6 *) baddr->addr; - baddr->broadcast_task = GNUNET_SCHEDULER_NO_TASK; + baddr->broadcast_task = NULL; msg_size = prepare_beacon(plugin, (struct UDP_Beacon_Message *) &buf); /* Note: unclear if this actually works to limit the multicast to @@ -651,10 +651,10 @@ stop_broadcast (struct Plugin *plugin) { struct BroadcastAddress *p = plugin->broadcast_head; - if (p->broadcast_task != GNUNET_SCHEDULER_NO_TASK) + if (p->broadcast_task != NULL) { GNUNET_SCHEDULER_cancel (p->broadcast_task); - p->broadcast_task = GNUNET_SCHEDULER_NO_TASK; + p->broadcast_task = NULL; } if ((GNUNET_YES == plugin->enable_ipv6) && (NULL != plugin->sockv6) && diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index 7e2601aed4..4608691815 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c @@ -218,7 +218,7 @@ struct Session /** * Session timeout task. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Number of messages we currently have in our write queue. @@ -255,17 +255,17 @@ struct Plugin /** * ID of task used to update our addresses when one expires. */ - GNUNET_SCHEDULER_TaskIdentifier address_update_task; + struct GNUNET_SCHEDULER_Task * address_update_task; /** * ID of read task */ - GNUNET_SCHEDULER_TaskIdentifier read_task; + struct GNUNET_SCHEDULER_Task * read_task; /** * ID of write task */ - GNUNET_SCHEDULER_TaskIdentifier write_task; + struct GNUNET_SCHEDULER_Task * write_task; /** * Number of bytes we currently have in our write queues. @@ -482,10 +482,10 @@ unix_plugin_session_disconnect (void *cls, "# UNIX sessions active", GNUNET_CONTAINER_multipeermap_size (plugin->session_map), GNUNET_NO); - if (GNUNET_SCHEDULER_NO_TASK != session->timeout_task) + if (NULL != session->timeout_task) { GNUNET_SCHEDULER_cancel (session->timeout_task); - session->timeout_task = GNUNET_SCHEDULER_NO_TASK; + session->timeout_task = NULL; session->timeout = GNUNET_TIME_UNIT_ZERO_ABS; } notify_session_monitor (plugin, @@ -512,7 +512,7 @@ session_timeout (void *cls, struct Session *session = cls; struct GNUNET_TIME_Relative left; - session->timeout_task = GNUNET_SCHEDULER_NO_TASK; + session->timeout_task = NULL; left = GNUNET_TIME_absolute_get_remaining (session->timeout); if (0 != left.rel_value_us) { @@ -545,7 +545,7 @@ session_timeout (void *cls, static void reschedule_session_timeout (struct Session *session) { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != session->timeout_task); + GNUNET_assert (NULL != session->timeout_task); session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); } @@ -1226,7 +1226,7 @@ unix_plugin_select_read (void *cls, { struct Plugin *plugin = cls; - plugin->read_task = GNUNET_SCHEDULER_NO_TASK; + plugin->read_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) @@ -1251,7 +1251,7 @@ unix_plugin_select_write (void *cls, { struct Plugin *plugin = cls; - plugin->write_task = GNUNET_SCHEDULER_NO_TASK; + plugin->write_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) @@ -1358,7 +1358,7 @@ unix_plugin_send (void *cls, notify_session_monitor (plugin, session, GNUNET_TRANSPORT_SS_UPDATE); - if (GNUNET_SCHEDULER_NO_TASK == plugin->write_task) + if (NULL == plugin->write_task) plugin->write_task = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, plugin->unix_sock.desc, @@ -1629,7 +1629,7 @@ address_notification (void *cls, unix_path = (char *) &ua[1]; memcpy (unix_path, plugin->unix_socket_path, strlen (plugin->unix_socket_path) + 1); - plugin->address_update_task = GNUNET_SCHEDULER_NO_TASK; + plugin->address_update_task = NULL; address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, PLUGIN_NAME, ua, @@ -1886,20 +1886,20 @@ libgnunet_plugin_transport_unix_done (void *cls) GNUNET_free (msgw); } - if (GNUNET_SCHEDULER_NO_TASK != plugin->read_task) + if (NULL != plugin->read_task) { GNUNET_SCHEDULER_cancel (plugin->read_task); - plugin->read_task = GNUNET_SCHEDULER_NO_TASK; + plugin->read_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != plugin->write_task) + if (NULL != plugin->write_task) { GNUNET_SCHEDULER_cancel (plugin->write_task); - plugin->write_task = GNUNET_SCHEDULER_NO_TASK; + plugin->write_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != plugin->address_update_task) + if (NULL != plugin->address_update_task) { GNUNET_SCHEDULER_cancel (plugin->address_update_task); - plugin->address_update_task = GNUNET_SCHEDULER_NO_TASK; + plugin->address_update_task = NULL; } if (NULL != plugin->unix_sock.desc) { diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index ab9fa4a74c..b0be343463 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c @@ -204,7 +204,7 @@ struct PendingMessage /** * Timeout task (for this message). */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; }; @@ -250,7 +250,7 @@ struct Session /** * Timeout task (for the session). */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; }; @@ -300,7 +300,7 @@ struct FragmentMessage /** * Timeout task. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * Continuation to call when we're done with this message. @@ -379,7 +379,7 @@ struct MacEndpoint /** * Timeout task. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * count of messages in the fragment out queue for this mac endpoint @@ -484,7 +484,7 @@ struct Plugin /** * Task that periodically sends a HELLO beacon via the helper. */ - GNUNET_SCHEDULER_TaskIdentifier beacon_task; + struct GNUNET_SCHEDULER_Task * beacon_task; /** * Tracker for bandwidth limit @@ -777,10 +777,10 @@ wlan_plugin_disconnect_session (void *cls, GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head, endpoint->sessions_tail, session); - if (session->timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (session->timeout_task != NULL) { GNUNET_SCHEDULER_cancel (session->timeout_task); - session->timeout_task = GNUNET_SCHEDULER_NO_TASK; + session->timeout_task = NULL; } GNUNET_STATISTICS_update (plugin->env->stats, _("# Sessions allocated"), @@ -820,7 +820,7 @@ session_timeout (void *cls, struct Session *session = cls; struct GNUNET_TIME_Relative left; - session->timeout_task = GNUNET_SCHEDULER_NO_TASK; + session->timeout_task = NULL; left = GNUNET_TIME_absolute_get_remaining (session->timeout); if (0 != left.rel_value_us) { @@ -1025,10 +1025,10 @@ free_fragment_message (struct FragmentMessage *fm) GNUNET_FRAGMENT_context_destroy (fm->fragcontext, &endpoint->msg_delay, &endpoint->ack_delay); - if (fm->timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (fm->timeout_task != NULL) { GNUNET_SCHEDULER_cancel (fm->timeout_task); - fm->timeout_task = GNUNET_SCHEDULER_NO_TASK; + fm->timeout_task = NULL; } GNUNET_free (fm); } @@ -1046,7 +1046,7 @@ fragmentmessage_timeout (void *cls, { struct FragmentMessage *fm = cls; - fm->timeout_task = GNUNET_SCHEDULER_NO_TASK; + fm->timeout_task = NULL; if (NULL != fm->cont) { fm->cont (fm->cont_cls, @@ -1145,10 +1145,10 @@ free_macendpoint (struct MacEndpoint *endpoint) } plugin->mac_count--; - if (GNUNET_SCHEDULER_NO_TASK != endpoint->timeout_task) + if (NULL != endpoint->timeout_task) { GNUNET_SCHEDULER_cancel (endpoint->timeout_task); - endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK; + endpoint->timeout_task = NULL; } GNUNET_free (endpoint); } @@ -1167,7 +1167,7 @@ macendpoint_timeout (void *cls, struct MacEndpoint *endpoint = cls; struct GNUNET_TIME_Relative timeout; - endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK; + endpoint->timeout_task = NULL; timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout); if (0 == timeout.rel_value_us) { @@ -1923,10 +1923,10 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) GNUNET_HELLO_address_free (address); } - if (GNUNET_SCHEDULER_NO_TASK != plugin->beacon_task) + if (NULL != plugin->beacon_task) { GNUNET_SCHEDULER_cancel (plugin->beacon_task); - plugin->beacon_task = GNUNET_SCHEDULER_NO_TASK; + plugin->beacon_task = NULL; } if (NULL != plugin->suid_helper) { @@ -2077,7 +2077,7 @@ wlan_plugin_update_session_timeout (void *cls, const struct GNUNET_PeerIdentity *peer, struct Session *session) { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != session->timeout_task); + GNUNET_assert (NULL != session->timeout_task); session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); } diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index 83ff7f1c4f..e9942cff95 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c @@ -89,12 +89,12 @@ struct GNUNET_HELPER_Handle *suid_helper; /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier timeout_endbadly; +static struct GNUNET_SCHEDULER_Task * timeout_endbadly; /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier timeout_wait; +static struct GNUNET_SCHEDULER_Task * timeout_wait; /** * Library name @@ -138,10 +138,10 @@ end () int c = 0; ok = 0; - if (GNUNET_SCHEDULER_NO_TASK != timeout_endbadly) + if (NULL != timeout_endbadly) { GNUNET_SCHEDULER_cancel (timeout_endbadly); - timeout_endbadly = GNUNET_SCHEDULER_NO_TASK; + timeout_endbadly = NULL; } if (NULL != api) GNUNET_PLUGIN_unload (libname, api); @@ -183,11 +183,11 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct AddressWrapper *w; int c = 0; - timeout_endbadly = GNUNET_SCHEDULER_NO_TASK; - if (GNUNET_SCHEDULER_NO_TASK != timeout_wait) + timeout_endbadly = NULL; + if (NULL != timeout_wait) { GNUNET_SCHEDULER_cancel (timeout_wait); - timeout_wait = GNUNET_SCHEDULER_NO_TASK; + timeout_wait = NULL; } if (pretty_printers_running > 0) @@ -249,7 +249,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void wait_end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - timeout_wait = GNUNET_SCHEDULER_NO_TASK; + timeout_wait = NULL; if (0 == addresses_reported) GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Plugin did not report any addresses, could not check address conversion functions\n"); @@ -260,15 +260,15 @@ wait_end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly_now () { - if (GNUNET_SCHEDULER_NO_TASK != timeout_wait) + if (NULL != timeout_wait) { GNUNET_SCHEDULER_cancel (timeout_wait); - timeout_wait = GNUNET_SCHEDULER_NO_TASK; + timeout_wait = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != timeout_endbadly) + if (NULL != timeout_endbadly) { GNUNET_SCHEDULER_cancel (timeout_endbadly); - timeout_endbadly = GNUNET_SCHEDULER_NO_TASK; + timeout_endbadly = NULL; } timeout_endbadly = GNUNET_SCHEDULER_add_now (&end_badly, NULL ); } @@ -418,10 +418,10 @@ env_notify_address (void *cls, end_badly_now (); return; } - if (GNUNET_SCHEDULER_NO_TASK != timeout_wait) + if (NULL != timeout_wait) { GNUNET_SCHEDULER_cancel (timeout_wait); - timeout_wait = GNUNET_SCHEDULER_NO_TASK; + timeout_wait = NULL; } timeout_wait = GNUNET_SCHEDULER_add_delayed (WAIT, &wait_end, NULL ); diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index ac43b8d05c..250d3279f4 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c @@ -47,9 +47,9 @@ static char *test_plugin; static char *test_name; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier measure_task; +static struct GNUNET_SCHEDULER_Task * measure_task; struct PeerContext *p1; @@ -153,7 +153,7 @@ end () datarate, quota_out_p1, quota_in_p2); } - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); if (th != NULL) @@ -171,10 +171,10 @@ end () static void end_badly () { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); - if (measure_task != GNUNET_SCHEDULER_NO_TASK) + if (measure_task != NULL) GNUNET_SCHEDULER_cancel (measure_task); if (test_connected == GNUNET_YES) @@ -244,7 +244,7 @@ notify_ready (void *cls, size_t size, void *buf) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready for message %u of %u\n", msg_scheduled, TOTAL_MSGS); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); test_failed = 1; @@ -348,7 +348,7 @@ measure (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { static int counter; - measure_task = GNUNET_SCHEDULER_NO_TASK; + measure_task = NULL; counter++; if ((DURATION.rel_value_us / 1000 / 1000LL) < counter) @@ -472,7 +472,7 @@ run_measurement (unsigned long long p1_quota_in, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; diff --git a/src/transport/test_transport_address_switch.c b/src/transport/test_transport_address_switch.c index fcbd798d04..10815c7abd 100644 --- a/src/transport/test_transport_address_switch.c +++ b/src/transport/test_transport_address_switch.c @@ -67,11 +67,11 @@ GNUNET_NETWORK_STRUCT_END #define DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) #define DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier delayed_end_task; +static struct GNUNET_SCHEDULER_Task * delayed_end_task; -static GNUNET_SCHEDULER_TaskIdentifier measure_task; +static struct GNUNET_SCHEDULER_Task * measure_task; struct PeerContext *p1; char *cfg_file_p1; @@ -142,7 +142,7 @@ stat_start_attempt_cb (void *cls, const char *subsystem, const char *name, else return GNUNET_OK; - if (GNUNET_SCHEDULER_NO_TASK == delayed_end_task) + if (NULL == delayed_end_task) delayed_end_task = GNUNET_SCHEDULER_add_delayed (DELAY, &end, NULL ); return GNUNET_OK; } @@ -207,22 +207,22 @@ stat_addresses_available (void *cls, const char *subsystem, const char *name, static void clean_up () { - if (measure_task != GNUNET_SCHEDULER_NO_TASK ) + if (measure_task != NULL ) { GNUNET_SCHEDULER_cancel (measure_task); - measure_task = GNUNET_SCHEDULER_NO_TASK; + measure_task = NULL; } - if (delayed_end_task != GNUNET_SCHEDULER_NO_TASK ) + if (delayed_end_task != NULL ) { GNUNET_SCHEDULER_cancel (delayed_end_task); - delayed_end_task = GNUNET_SCHEDULER_NO_TASK; + delayed_end_task = NULL; } - if (die_task != GNUNET_SCHEDULER_NO_TASK ) + if (die_task != NULL ) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (NULL != p1_stat) @@ -270,10 +270,10 @@ clean_up () p2_stat = NULL; } - if (die_task != GNUNET_SCHEDULER_NO_TASK ) + if (die_task != NULL ) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (th != NULL ) @@ -308,7 +308,7 @@ end () int result = 0; GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); - delayed_end_task = GNUNET_SCHEDULER_NO_TASK; + delayed_end_task = NULL; FPRINTF (stderr, "\n"); if (p1_switch_attempts > 0) { @@ -365,7 +365,7 @@ end () static void end_badly () { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); FPRINTF (stderr, "Peer 1 had %u addresses available, but did not try to switch\n", @@ -432,7 +432,7 @@ notify_ready (void *cls, size_t size, void *buf) { GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready for message\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL ); res = 1; @@ -534,7 +534,7 @@ measure (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { static int counter; - measure_task = GNUNET_SCHEDULER_NO_TASK; + measure_task = NULL; counter++; if ((DURATION.rel_value_us / 1000 / 1000LL) < counter) @@ -608,7 +608,7 @@ run (void *cls, char * const *args, const char *cfgfile, if ((p1 == NULL )|| (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; @@ -657,7 +657,7 @@ run (void *cls, char * const *args, const char *cfgfile, if ((p1_stat == NULL )|| (p2_stat == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not create statistics for peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index 4456c1dbf2..ce6db8ad15 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c @@ -58,9 +58,9 @@ static int s_connected; static int s_sending; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier send_task; +static struct GNUNET_SCHEDULER_Task * send_task; static struct PeerContext *p1; @@ -82,10 +82,10 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); if (th != NULL) @@ -99,12 +99,12 @@ end () static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Fail! Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); if (cc != NULL) @@ -197,7 +197,7 @@ notify_ready (void *cls, size_t size, void *buf) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); ok = 42; @@ -227,7 +227,7 @@ notify_ready (void *cls, size_t size, void *buf) static void sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -351,7 +351,7 @@ run (void *cls, char *const *args, const char *cfgfile, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; @@ -371,7 +371,7 @@ check () GNUNET_GETOPT_OPTION_END }; - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; ok = 1; GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, test_name, diff --git a/src/transport/test_transport_api_bidirectional_connect.c b/src/transport/test_transport_api_bidirectional_connect.c index 64f39a4d81..032bf2b6ed 100644 --- a/src/transport/test_transport_api_bidirectional_connect.c +++ b/src/transport/test_transport_api_bidirectional_connect.c @@ -49,9 +49,9 @@ static char *test_name; static int ok; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier send_task; +static struct GNUNET_SCHEDULER_Task * send_task; static struct PeerContext *p1; @@ -74,13 +74,13 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) { GNUNET_SCHEDULER_cancel (send_task); - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; } - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); if (NULL != th) @@ -97,12 +97,12 @@ end () static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) { GNUNET_SCHEDULER_cancel (send_task); - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; } if (NULL != cc2) @@ -177,7 +177,7 @@ notify_ready (void *cls, size_t size, void *buf) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); ok = 42; @@ -206,7 +206,7 @@ notify_ready (void *cls, size_t size, void *buf) static void sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -260,11 +260,11 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) GNUNET_i2s (peer)); GNUNET_free (ps); - if (GNUNET_SCHEDULER_NO_TASK != send_task) + if (NULL != send_task) { GNUNET_SCHEDULER_cancel(send_task); GNUNET_break (0); - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; } if (NULL != th) { @@ -350,7 +350,7 @@ run (void *cls, char *const *args, const char *cfgfile, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; @@ -373,7 +373,7 @@ check () #if WRITECONFIG setTransportOptions ("test_transport_api_data.conf"); #endif - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; ok = 1; GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, test_name, diff --git a/src/transport/test_transport_api_blacklisting.c b/src/transport/test_transport_api_blacklisting.c index 2c3ab125a0..09a12cef82 100644 --- a/src/transport/test_transport_api_blacklisting.c +++ b/src/transport/test_transport_api_blacklisting.c @@ -62,11 +62,11 @@ static struct GNUNET_TRANSPORT_Blacklist * blacklist_p1; static struct GNUNET_TRANSPORT_Blacklist * blacklist_p2; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier send_task; +static struct GNUNET_SCHEDULER_Task * send_task; -static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; +static struct GNUNET_SCHEDULER_Task * shutdown_task; #if VERBOSE #define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) @@ -80,13 +80,13 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (cc != NULL) @@ -139,16 +139,16 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) { GNUNET_SCHEDULER_cancel (send_task); - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; } - if (shutdown_task != GNUNET_SCHEDULER_NO_TASK) + if (shutdown_task != NULL) { GNUNET_SCHEDULER_cancel (shutdown_task); - shutdown_task = GNUNET_SCHEDULER_NO_TASK; + shutdown_task = NULL; } if (cc != NULL) @@ -225,10 +225,10 @@ notify_ready (void *cls, size_t size, void *buf) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); ok = 42; @@ -257,7 +257,7 @@ notify_ready (void *cls, size_t size, void *buf) static void sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -359,7 +359,7 @@ blacklist_cb (void *cls, res = GNUNET_SYSERR; } - if (((blacklist_request_p2 == GNUNET_YES) && (blacklist_request_p1 == GNUNET_YES)) && (shutdown_task == GNUNET_SCHEDULER_NO_TASK)) + if (((blacklist_request_p2 == GNUNET_YES) && (blacklist_request_p1 == GNUNET_YES)) && (shutdown_task == NULL)) { shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 3), &end, NULL); } diff --git a/src/transport/test_transport_api_disconnect.c b/src/transport/test_transport_api_disconnect.c index 3f8246142b..607b3480bd 100644 --- a/src/transport/test_transport_api_disconnect.c +++ b/src/transport/test_transport_api_disconnect.c @@ -47,9 +47,9 @@ static char *test_name; static int ok; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier send_task; +static struct GNUNET_SCHEDULER_Task * send_task; struct PeerContext *p1; @@ -79,16 +79,16 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) { GNUNET_SCHEDULER_cancel (send_task); - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; } - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (th != NULL) @@ -110,7 +110,7 @@ end () static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); @@ -120,10 +120,10 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) cc = NULL; } - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) { GNUNET_SCHEDULER_cancel (send_task); - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; } if (th != NULL) @@ -221,7 +221,7 @@ notify_ready (void *cls, size_t size, void *buf) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); ok = 42; @@ -250,7 +250,7 @@ notify_ready (void *cls, size_t size, void *buf) static void sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -347,7 +347,7 @@ run (void *cls, char *const *args, const char *cfgfile, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; @@ -367,7 +367,7 @@ check () GNUNET_GETOPT_OPTION_END }; - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; ok = 1; GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, test_name, diff --git a/src/transport/test_transport_api_limited_sockets.c b/src/transport/test_transport_api_limited_sockets.c index 617be38d4b..cc1953f777 100644 --- a/src/transport/test_transport_api_limited_sockets.c +++ b/src/transport/test_transport_api_limited_sockets.c @@ -55,9 +55,9 @@ static char *test_name; static int ok; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier send_task; +static struct GNUNET_SCHEDULER_Task * send_task; static struct PeerContext *p1; @@ -85,10 +85,10 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); if (th != NULL) @@ -104,11 +104,11 @@ end () static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); if (cc != NULL) @@ -197,7 +197,7 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) static void sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -259,7 +259,7 @@ run (void *cls, char *const *args, const char *cfgfile, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; @@ -282,7 +282,7 @@ check () #if WRITECONFIG setTransportOptions ("test_transport_api_data.conf"); #endif - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; ok = 1; GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, test_name, diff --git a/src/transport/test_transport_api_manipulation_cfg.c b/src/transport/test_transport_api_manipulation_cfg.c index 49e74ffafa..e7cccb8124 100644 --- a/src/transport/test_transport_api_manipulation_cfg.c +++ b/src/transport/test_transport_api_manipulation_cfg.c @@ -67,9 +67,9 @@ static int s_connected; static int s_sending; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier send_task; +static struct GNUNET_SCHEDULER_Task * send_task; static struct PeerContext *p1; @@ -93,10 +93,10 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); if (th != NULL) @@ -110,12 +110,12 @@ end () static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); if (cc != NULL) @@ -172,7 +172,7 @@ notify_request_ready (void *cls, size_t size, void *buf) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); ok = 42; @@ -201,7 +201,7 @@ notify_request_ready (void *cls, size_t size, void *buf) static void sendtask_request_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -232,7 +232,7 @@ notify_response_ready (void *cls, size_t size, void *buf) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Timeout occurred while waiting for transmit_ready\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); ok = 42; @@ -261,7 +261,7 @@ notify_response_ready (void *cls, size_t size, void *buf) static void sendtask_response_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -458,7 +458,7 @@ run (void *cls, char *const *args, const char *cfgfile, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; @@ -478,7 +478,7 @@ check () GNUNET_GETOPT_OPTION_END }; - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; ok = 1; GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, test_name, diff --git a/src/transport/test_transport_api_manipulation_recv_tcp.c b/src/transport/test_transport_api_manipulation_recv_tcp.c index 6b86e9ff16..76bd360ab8 100644 --- a/src/transport/test_transport_api_manipulation_recv_tcp.c +++ b/src/transport/test_transport_api_manipulation_recv_tcp.c @@ -59,9 +59,9 @@ static int s_connected; static int s_sending; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier send_task; +static struct GNUNET_SCHEDULER_Task * send_task; static struct PeerContext *p1; @@ -90,10 +90,10 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); if (th != NULL) @@ -107,12 +107,12 @@ end () static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); if (cc != NULL) @@ -252,7 +252,7 @@ notify_ready (void *cls, size_t size, void *buf) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); ok = 42; @@ -282,7 +282,7 @@ notify_ready (void *cls, size_t size, void *buf) static void sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -416,7 +416,7 @@ run (void *cls, char *const *args, const char *cfgfile, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; @@ -436,7 +436,7 @@ check () GNUNET_GETOPT_OPTION_END }; - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; ok = 1; GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, test_name, diff --git a/src/transport/test_transport_api_manipulation_send_tcp.c b/src/transport/test_transport_api_manipulation_send_tcp.c index 381d7d38a2..f1ead389c3 100644 --- a/src/transport/test_transport_api_manipulation_send_tcp.c +++ b/src/transport/test_transport_api_manipulation_send_tcp.c @@ -59,9 +59,9 @@ static int s_connected; static int s_sending; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier send_task; +static struct GNUNET_SCHEDULER_Task * send_task; static struct PeerContext *p1; @@ -90,10 +90,10 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); if (th != NULL) @@ -107,12 +107,12 @@ end () static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); if (cc != NULL) @@ -244,7 +244,7 @@ notify_ready (void *cls, size_t size, void *buf) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); ok = 42; @@ -275,7 +275,7 @@ static void sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_ATS_Information ats[1]; - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -424,7 +424,7 @@ run (void *cls, char *const *args, const char *cfgfile, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; @@ -444,7 +444,7 @@ check () GNUNET_GETOPT_OPTION_END }; - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; ok = 1; GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, test_name, diff --git a/src/transport/test_transport_api_monitor_peers.c b/src/transport/test_transport_api_monitor_peers.c index fd6abe53b5..ef425d444d 100644 --- a/src/transport/test_transport_api_monitor_peers.c +++ b/src/transport/test_transport_api_monitor_peers.c @@ -53,9 +53,9 @@ static int s_connected; static int s_sending; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier send_task; +static struct GNUNET_SCHEDULER_Task * send_task; static struct PeerContext *p1; @@ -90,13 +90,13 @@ end () GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (th != NULL) @@ -131,12 +131,12 @@ static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Fail! Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); if (cc != NULL) @@ -227,7 +227,7 @@ notify_ready (void *cls, size_t size, void *buf) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); ok = 42; @@ -257,7 +257,7 @@ notify_ready (void *cls, size_t size, void *buf) static void sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -460,7 +460,7 @@ run (void *cls, char *const *args, const char *cfgfile, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; @@ -480,7 +480,7 @@ check () GNUNET_GETOPT_OPTION_END }; - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; ok = 1; GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, test_name, diff --git a/src/transport/test_transport_api_monitor_validation.c b/src/transport/test_transport_api_monitor_validation.c index 11839b20c7..261f1a7d07 100644 --- a/src/transport/test_transport_api_monitor_validation.c +++ b/src/transport/test_transport_api_monitor_validation.c @@ -56,9 +56,9 @@ static int s_connected; static int s_sending; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier send_task; +static struct GNUNET_SCHEDULER_Task * send_task; static struct PeerContext *p1; @@ -92,10 +92,10 @@ end () GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); if (th != NULL) @@ -124,12 +124,12 @@ end () static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Fail! Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); if (cc != NULL) @@ -219,7 +219,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, if ((0 >= p1_c) || (0 >= p2_c)) { - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); } @@ -240,7 +240,7 @@ notify_ready (void *cls, size_t size, void *buf) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); ok = 42; @@ -270,7 +270,7 @@ notify_ready (void *cls, size_t size, void *buf) static void sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -454,7 +454,7 @@ run (void *cls, char *const *args, const char *cfgfile, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; @@ -474,7 +474,7 @@ check () GNUNET_GETOPT_OPTION_END }; - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; ok = 1; GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, test_name, diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 07213722e7..a727d3e6a2 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c @@ -107,7 +107,7 @@ char *cfg_file_p2; /** * Timeout task */ -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; /** * Transport transmit handle used @@ -190,7 +190,7 @@ end () "kb/s"); GNUNET_free (value_name); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); if (th != NULL) @@ -224,7 +224,7 @@ static void end_badly () { int i; - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); if (test_connected == GNUNET_YES) @@ -347,7 +347,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Expected message %u of size %u, got %u bytes of message %u\n", ntohl (hdr->num), s, ntohs (message->size), ntohl (hdr->num)); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); test_sending = GNUNET_YES; die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); @@ -360,7 +360,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Expected message %u with bits %u, but body did not match\n", ntohl (hdr->num), (unsigned char) n); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); test_sending = GNUNET_YES; die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); @@ -384,7 +384,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, if (0 == (n % (TOTAL_MSGS / 100))) { FPRINTF (stderr, "%s", "."); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); } @@ -412,7 +412,7 @@ notify_ready (void *cls, size_t size, void *buf) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready for msg %u of %u\n", msg_scheduled, TOTAL_MSGS); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); ok = 42; @@ -460,7 +460,7 @@ notify_ready (void *cls, size_t size, void *buf) { FPRINTF (stderr, "%s", "\n"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All messages scheduled to be sent\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); } @@ -554,7 +554,7 @@ run (void *cls, char *const *args, const char *cfgfile, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); //die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; diff --git a/src/transport/test_transport_api_restart_1peer.c b/src/transport/test_transport_api_restart_1peer.c index f0d5d56608..b77d8d0dff 100644 --- a/src/transport/test_transport_api_restart_1peer.c +++ b/src/transport/test_transport_api_restart_1peer.c @@ -45,11 +45,11 @@ static char *test_name; static int ok; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier send_task; +static struct GNUNET_SCHEDULER_Task * send_task; -static GNUNET_SCHEDULER_TaskIdentifier reconnect_task; +static struct GNUNET_SCHEDULER_Task * reconnect_task; static struct PeerContext *p1; @@ -77,17 +77,17 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; - if (reconnect_task != GNUNET_SCHEDULER_NO_TASK) + if (reconnect_task != NULL) GNUNET_SCHEDULER_cancel (reconnect_task); - reconnect_task = GNUNET_SCHEDULER_NO_TASK; + reconnect_task = NULL; - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; if (th != NULL) GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); @@ -102,7 +102,7 @@ end () static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); @@ -112,13 +112,13 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (restarted == GNUNET_NO) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peer was NOT restarted\n"); - if (reconnect_task != GNUNET_SCHEDULER_NO_TASK) + if (reconnect_task != NULL) GNUNET_SCHEDULER_cancel (reconnect_task); - reconnect_task = GNUNET_SCHEDULER_NO_TASK; + reconnect_task = NULL; - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if (cc != NULL) { @@ -144,7 +144,7 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct PeerContext *p = cls; - reconnect_task = GNUNET_SCHEDULER_NO_TASK; + reconnect_task = NULL; GNUNET_TRANSPORT_try_connect (p->th, &p2->id, NULL, NULL); /*FIXME TRY_CONNECT change */ reconnect_task = @@ -214,7 +214,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, { GNUNET_break (0); ok = 1; - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); } @@ -233,7 +233,7 @@ notify_ready (void *cls, size_t size, void *buf) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); ok = 42; @@ -262,7 +262,7 @@ notify_ready (void *cls, size_t size, void *buf) static void sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -340,9 +340,9 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) if (th != NULL) GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); th = NULL; - if (GNUNET_SCHEDULER_NO_TASK != send_task) + if (NULL != send_task) GNUNET_SCHEDULER_cancel (send_task); - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; } static void @@ -405,7 +405,7 @@ run (void *cls, char *const *args, const char *cfgfile, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; @@ -425,7 +425,7 @@ check () GNUNET_GETOPT_OPTION_END }; - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; ok = 1; GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, test_name, diff --git a/src/transport/test_transport_api_restart_2peers.c b/src/transport/test_transport_api_restart_2peers.c index 3b5d63bce4..25054b536d 100644 --- a/src/transport/test_transport_api_restart_2peers.c +++ b/src/transport/test_transport_api_restart_2peers.c @@ -45,11 +45,11 @@ static char *test_name; static int ok; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier send_task; +static struct GNUNET_SCHEDULER_Task * send_task; -static GNUNET_SCHEDULER_TaskIdentifier reconnect_task; +static struct GNUNET_SCHEDULER_Task * reconnect_task; static struct PeerContext *p1; @@ -72,17 +72,17 @@ static void end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; - if (reconnect_task != GNUNET_SCHEDULER_NO_TASK) + if (reconnect_task != NULL) GNUNET_SCHEDULER_cancel (reconnect_task); - reconnect_task = GNUNET_SCHEDULER_NO_TASK; + reconnect_task = NULL; - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; if (th != NULL) GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); @@ -96,7 +96,7 @@ end () static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; if (restarted == GNUNET_YES) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peer was restarted, but communication did not resume\n"); @@ -104,13 +104,13 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (restarted == GNUNET_NO) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peer was NOT (even) restarted\n"); - if (reconnect_task != GNUNET_SCHEDULER_NO_TASK) + if (reconnect_task != NULL) GNUNET_SCHEDULER_cancel (reconnect_task); - reconnect_task = GNUNET_SCHEDULER_NO_TASK; + reconnect_task = NULL; - if (send_task != GNUNET_SCHEDULER_NO_TASK) + if (send_task != NULL) GNUNET_SCHEDULER_cancel (send_task); - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if (cc != NULL) { @@ -137,7 +137,7 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct PeerContext *p = cls; - reconnect_task = GNUNET_SCHEDULER_NO_TASK; + reconnect_task = NULL; GNUNET_TRANSPORT_try_connect (p1->th, &p2->id, NULL, NULL); /*FIXME TRY_CONNECT change */ reconnect_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &reconnect, p); @@ -212,7 +212,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, { GNUNET_break (0); ok = 1; - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); } @@ -230,7 +230,7 @@ notify_ready (void *cls, size_t size, void *buf) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); ok = 42; @@ -259,7 +259,7 @@ notify_ready (void *cls, size_t size, void *buf) static void sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -321,9 +321,9 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) if (th != NULL) GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); th = NULL; - if (GNUNET_SCHEDULER_NO_TASK != send_task) + if (NULL != send_task) GNUNET_SCHEDULER_cancel (send_task); - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; } @@ -386,7 +386,7 @@ run (void *cls, char *const *args, const char *cfgfile, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; @@ -406,7 +406,7 @@ check () GNUNET_GETOPT_OPTION_END }; - send_task = GNUNET_SCHEDULER_NO_TASK; + send_task = NULL; ok = 1; GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, test_name, diff --git a/src/transport/test_transport_api_timeout.c b/src/transport/test_transport_api_timeout.c index 01af9f81b0..d243e8fbe4 100644 --- a/src/transport/test_transport_api_timeout.c +++ b/src/transport/test_transport_api_timeout.c @@ -48,9 +48,9 @@ static char *test_name; static int ok; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier timer_task; +static struct GNUNET_SCHEDULER_Task * timer_task; static struct GNUNET_TRANSPORT_TESTING_handle *tth; @@ -85,16 +85,16 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); - if (timer_task != GNUNET_SCHEDULER_NO_TASK) + if (timer_task != NULL) { GNUNET_SCHEDULER_cancel (timer_task); - timer_task = GNUNET_SCHEDULER_NO_TASK; + timer_task = NULL; } - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } if (th != NULL) @@ -123,14 +123,14 @@ end () static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); - if (timer_task != GNUNET_SCHEDULER_NO_TASK) + if (timer_task != NULL) { GNUNET_SCHEDULER_cancel (timer_task); - timer_task = GNUNET_SCHEDULER_NO_TASK; + timer_task = NULL; } if (cc != NULL) GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc); @@ -185,7 +185,7 @@ timer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { static int percentage; - timer_task = GNUNET_SCHEDULER_NO_TASK; + timer_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -228,7 +228,7 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) GNUNET_STRINGS_relative_time_to_string (WAIT, GNUNET_YES)); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_delayed (WAIT, &end_badly, NULL); @@ -279,7 +279,7 @@ run (void *cls, char *const *args, const char *cfgfile, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; @@ -298,7 +298,7 @@ check () GNUNET_GETOPT_OPTION_END }; - timer_task = GNUNET_SCHEDULER_NO_TASK; + timer_task = NULL; ok = 1; GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, diff --git a/src/transport/test_transport_api_unreliability_constant.c b/src/transport/test_transport_api_unreliability_constant.c index 2ff1e4b0c1..c859e802ef 100644 --- a/src/transport/test_transport_api_unreliability_constant.c +++ b/src/transport/test_transport_api_unreliability_constant.c @@ -49,7 +49,7 @@ static char *test_name; static int ok; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; struct PeerContext *p1; @@ -134,7 +134,7 @@ end () "kb/s"); GNUNET_free (value_name); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); if (th != NULL) @@ -160,7 +160,7 @@ end () static void end_badly () { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); if (test_failed == GNUNET_NO) @@ -223,7 +223,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Expected message no %u, got %u\n", msg_recv_expected, msg_recv); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); test_failed = GNUNET_YES; die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); @@ -236,7 +236,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Expected message %u of size %u, got %u bytes of message %u\n", ntohl (hdr->num), s, ntohs (message->size), ntohl (hdr->num)); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); test_failed = GNUNET_YES; die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); @@ -249,7 +249,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Expected message %u with bits %u, but body did not match\n", ntohl (hdr->num), (unsigned char) n); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); test_failed = GNUNET_YES; die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); @@ -266,7 +266,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, if (0 == (n % (TOTAL_MSGS / 100))) { FPRINTF (stderr, "%s", "."); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); test_failed = GNUNET_YES; die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); @@ -296,7 +296,7 @@ notify_ready (void *cls, size_t size, void *buf) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout occurred while waiting for transmit_ready\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); ok = 42; @@ -343,7 +343,7 @@ notify_ready (void *cls, size_t size, void *buf) FPRINTF (stderr, "%s", "\n"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All messages scheduled to be sent!!\n"); - if (GNUNET_SCHEDULER_NO_TASK != die_task) + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); } @@ -434,7 +434,7 @@ run (void *cls, char *const *args, const char *cfgfile, if ((p1 == NULL) || (p2 == NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK) + if (die_task != NULL) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); return; diff --git a/src/transport/test_transport_blacklisting.c b/src/transport/test_transport_blacklisting.c index fff27b69fd..a14944a14a 100644 --- a/src/transport/test_transport_blacklisting.c +++ b/src/transport/test_transport_blacklisting.c @@ -73,11 +73,11 @@ static int stage; static int ok; static int connected; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier timeout_task; +static struct GNUNET_SCHEDULER_Task * timeout_task; -static GNUNET_SCHEDULER_TaskIdentifier stage_task; +static struct GNUNET_SCHEDULER_Task * stage_task; #if VERBOSE #define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) @@ -93,22 +93,22 @@ end(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Stopping\n"); - if (die_task != GNUNET_SCHEDULER_NO_TASK ) + if (die_task != NULL ) { GNUNET_SCHEDULER_cancel (die_task); - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; } - if (timeout_task != GNUNET_SCHEDULER_NO_TASK ) + if (timeout_task != NULL ) { GNUNET_SCHEDULER_cancel (timeout_task); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; } - if (stage_task != GNUNET_SCHEDULER_NO_TASK ) + if (stage_task != NULL ) { GNUNET_SCHEDULER_cancel (stage_task); - stage_task = GNUNET_SCHEDULER_NO_TASK; + stage_task = NULL; } if (cc != NULL ) @@ -132,18 +132,18 @@ end(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void end_badly(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - die_task = GNUNET_SCHEDULER_NO_TASK; + die_task = NULL; - if (timeout_task != GNUNET_SCHEDULER_NO_TASK ) + if (timeout_task != NULL ) { GNUNET_SCHEDULER_cancel (timeout_task); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; } - if (stage_task != GNUNET_SCHEDULER_NO_TASK ) + if (stage_task != NULL ) { GNUNET_SCHEDULER_cancel (stage_task); - stage_task = GNUNET_SCHEDULER_NO_TASK; + stage_task = NULL; } if (cc != NULL ) @@ -176,7 +176,7 @@ static void connect_timeout(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Peers not connected, next stage\n"); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; stage_task = GNUNET_SCHEDULER_add_now (&run_stage, NULL ); } @@ -246,8 +246,8 @@ static int check_blacklist_config (char *cfg_file, static void run_stage(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - stage_task = GNUNET_SCHEDULER_NO_TASK; - if (GNUNET_SCHEDULER_NO_TASK != die_task) + stage_task = NULL; + if (NULL != die_task) GNUNET_SCHEDULER_cancel (die_task); die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL ); GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Running stage %u\n", stage); diff --git a/src/transport/test_transport_startonly.c b/src/transport/test_transport_startonly.c index 2deb3f58b2..78ed825ac8 100644 --- a/src/transport/test_transport_startonly.c +++ b/src/transport/test_transport_startonly.c @@ -37,7 +37,7 @@ #define ITERATIONS 10 -GNUNET_SCHEDULER_TaskIdentifier timeout_task; +struct GNUNET_SCHEDULER_Task * timeout_task; static struct PeerContext *p1; @@ -54,10 +54,10 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); - if (timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (timeout_task != NULL) { GNUNET_SCHEDULER_cancel (timeout_task); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; } GNUNET_TRANSPORT_TESTING_done (tth); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Exiting\n"); @@ -68,7 +68,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; diff --git a/src/transport/test_transport_testing.c b/src/transport/test_transport_testing.c index 747168b170..fb5bf60682 100644 --- a/src/transport/test_transport_testing.c +++ b/src/transport/test_transport_testing.c @@ -34,7 +34,7 @@ */ #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) -GNUNET_SCHEDULER_TaskIdentifier timeout_task; +struct GNUNET_SCHEDULER_Task * timeout_task; static struct PeerContext *p1; static struct PeerContext *p2; @@ -52,7 +52,7 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); - if (timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (timeout_task != NULL) GNUNET_SCHEDULER_cancel (timeout_task); GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); @@ -64,7 +64,7 @@ end () static void end_badly () { - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); if (NULL != cc) @@ -167,7 +167,7 @@ run (void *cls, char *const *args, const char *cfgfile, { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer1 was not started successfully\n"); - if (timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (timeout_task != NULL) GNUNET_SCHEDULER_cancel (timeout_task); timeout_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); } @@ -175,7 +175,7 @@ run (void *cls, char *const *args, const char *cfgfile, { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer2 was not started successfully\n"); - if (timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (timeout_task != NULL) GNUNET_SCHEDULER_cancel (timeout_task); timeout_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); } diff --git a/src/transport/test_transport_testing_restart.c b/src/transport/test_transport_testing_restart.c index 8ca18f9829..8a238cbd51 100644 --- a/src/transport/test_transport_testing_restart.c +++ b/src/transport/test_transport_testing_restart.c @@ -32,7 +32,7 @@ */ #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) -GNUNET_SCHEDULER_TaskIdentifier timeout_task; +struct GNUNET_SCHEDULER_Task * timeout_task; static struct PeerContext *p; @@ -45,7 +45,7 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); - if (timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (timeout_task != NULL) GNUNET_SCHEDULER_cancel (timeout_task); GNUNET_TRANSPORT_TESTING_stop_peer (tth, p); @@ -55,7 +55,7 @@ end () static void end_badly () { - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); if (NULL != p) @@ -119,7 +119,7 @@ run (void *cls, char *const *args, const char *cfgfile, if (NULL == p) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to start peer\n"); - if (timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (timeout_task != NULL) GNUNET_SCHEDULER_cancel (timeout_task); timeout_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); } diff --git a/src/transport/test_transport_testing_startstop.c b/src/transport/test_transport_testing_startstop.c index 22a4e5148d..736c635e15 100644 --- a/src/transport/test_transport_testing_startstop.c +++ b/src/transport/test_transport_testing_startstop.c @@ -32,7 +32,7 @@ */ #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) -GNUNET_SCHEDULER_TaskIdentifier timeout_task; +struct GNUNET_SCHEDULER_Task * timeout_task; static struct PeerContext *p; @@ -45,7 +45,7 @@ end () { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); - if (timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (timeout_task != NULL) GNUNET_SCHEDULER_cancel (timeout_task); GNUNET_TRANSPORT_TESTING_stop_peer (tth, p); @@ -55,7 +55,7 @@ end () static void end_badly () { - timeout_task = GNUNET_SCHEDULER_NO_TASK; + timeout_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); if (NULL != p) @@ -100,7 +100,7 @@ run (void *cls, char *const *args, const char *cfgfile, if (NULL == p) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to start peer\n"); - if (timeout_task != GNUNET_SCHEDULER_NO_TASK) + if (timeout_task != NULL) GNUNET_SCHEDULER_cancel (timeout_task); timeout_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); } diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c index d25d3f4b7b..517daf82ab 100644 --- a/src/transport/transport-testing.c +++ b/src/transport/transport-testing.c @@ -193,7 +193,7 @@ try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct PeerContext *p1 = cc->p1; struct PeerContext *p2 = cc->p2; - cc->tct = GNUNET_SCHEDULER_NO_TASK; + cc->tct = NULL; if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -534,9 +534,9 @@ GNUNET_TRANSPORT_TESTING_connect_peers_cancel (struct "Canceling connect request %p!\n", cc); - if (cc->tct != GNUNET_SCHEDULER_NO_TASK) + if (cc->tct != NULL) GNUNET_SCHEDULER_cancel (cc->tct); - cc->tct = GNUNET_SCHEDULER_NO_TASK; + cc->tct = NULL; GNUNET_CONTAINER_DLL_remove (tth->cc_head, tth->cc_tail, cc); GNUNET_free (cc); diff --git a/src/transport/transport-testing.h b/src/transport/transport-testing.h index 99225936a1..a010733e7d 100644 --- a/src/transport/transport-testing.h +++ b/src/transport/transport-testing.h @@ -153,7 +153,7 @@ struct ConnectingContext struct ConnectingContext *prev; struct PeerContext *p1; struct PeerContext *p2; - GNUNET_SCHEDULER_TaskIdentifier tct; + struct GNUNET_SCHEDULER_Task * tct; GNUNET_TRANSPORT_TESTING_connect_cb cb; void *cb_cls; struct GNUNET_TRANSPORT_Handle *th_p1; diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 7fa035c061..fd352a1e5a 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c @@ -84,7 +84,7 @@ struct GNUNET_TRANSPORT_TransmitHandle * Task to trigger request timeout if the request is stalled due to * congestion. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * How many bytes is our notify callback waiting for? @@ -171,7 +171,7 @@ struct GNUNET_TRANSPORT_GetHelloHandle /** * Task for calling the HelloUpdateCallback when we already have a HELLO */ - GNUNET_SCHEDULER_TaskIdentifier notify_task; + struct GNUNET_SCHEDULER_Task * notify_task; /** * Closure for @e rec. @@ -295,7 +295,7 @@ struct GNUNET_TRANSPORT_OfferHelloHandle /** * Function to call once we are done. */ - GNUNET_SCHEDULER_Task cont; + GNUNET_SCHEDULER_TaskCallback cont; /** * Closure for @e cont @@ -434,7 +434,7 @@ struct GNUNET_TRANSPORT_Handle /** * ID of the task trying to reconnect to the service. */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * ID of the task trying to trigger transmission for a peer while @@ -442,7 +442,7 @@ struct GNUNET_TRANSPORT_Handle * messages and the smallest entry in the 'ready_heap' has a time * stamp in the future. */ - GNUNET_SCHEDULER_TaskIdentifier quota_task; + struct GNUNET_SCHEDULER_Task * quota_task; /** * Delay until we try to reconnect. @@ -754,9 +754,9 @@ demultiplexer (void *cls, n->is_ready = GNUNET_YES; if ((NULL != n->th) && (NULL == n->hn)) { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != n->th->timeout_task); + GNUNET_assert (NULL != n->th->timeout_task); GNUNET_SCHEDULER_cancel (n->th->timeout_task); - n->th->timeout_task = GNUNET_SCHEDULER_NO_TASK; + n->th->timeout_task = NULL; /* we've been waiting for this (congestion, not quota, * caused delayed transmission) */ n->hn = GNUNET_CONTAINER_heap_insert (h->ready_heap, n, 0); @@ -835,7 +835,7 @@ timeout_request_due_to_congestion (void *cls, struct GNUNET_TRANSPORT_TransmitHandle *th = cls; struct Neighbour *n = th->neighbour; - n->th->timeout_task = GNUNET_SCHEDULER_NO_TASK; + n->th->timeout_task = NULL; GNUNET_assert (th == n->th); GNUNET_assert (NULL == n->hn); n->th = NULL; @@ -897,7 +897,7 @@ transport_notify_ready (void *cls, size_t size, void *buf) /* peer not ready, wait for notification! */ GNUNET_assert (n == GNUNET_CONTAINER_heap_remove_root (h->ready_heap)); n->hn = NULL; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == n->th->timeout_task); + GNUNET_assert (NULL == n->th->timeout_task); n->th->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining (n->th->timeout), @@ -963,7 +963,7 @@ schedule_transmission_task (void *cls, struct GNUNET_TRANSPORT_TransmitHandle *th; struct Neighbour *n; - h->quota_task = GNUNET_SCHEDULER_NO_TASK; + h->quota_task = NULL; GNUNET_assert (NULL != h->client); /* destroy all requests that have timed out */ while ((NULL != (n = GNUNET_CONTAINER_heap_peek (h->ready_heap))) && @@ -1018,10 +1018,10 @@ schedule_transmission (struct GNUNET_TRANSPORT_Handle *h) struct Neighbour *n; GNUNET_assert (NULL != h->client); - if (h->quota_task != GNUNET_SCHEDULER_NO_TASK) + if (h->quota_task != NULL) { GNUNET_SCHEDULER_cancel (h->quota_task); - h->quota_task = GNUNET_SCHEDULER_NO_TASK; + h->quota_task = NULL; } if (NULL != h->control_head) delay = GNUNET_TIME_UNIT_ZERO; @@ -1127,7 +1127,7 @@ reconnect (void *cls, { struct GNUNET_TRANSPORT_Handle *h = cls; - h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + h->reconnect_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { /* shutdown, just give up */ @@ -1158,7 +1158,7 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h) { struct GNUNET_TRANSPORT_TransmitHandle *th; - GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK); + GNUNET_assert (h->reconnect_task == NULL); if (NULL != h->cth) { GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth); @@ -1174,10 +1174,10 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h) /* Forget about all neighbours that we used to be connected to */ GNUNET_CONTAINER_multipeermap_iterate (h->neighbours, &neighbour_delete, h); - if (h->quota_task != GNUNET_SCHEDULER_NO_TASK) + if (h->quota_task != NULL) { GNUNET_SCHEDULER_cancel (h->quota_task); - h->quota_task = GNUNET_SCHEDULER_NO_TASK; + h->quota_task = NULL; } while ((NULL != (th = h->control_head))) { @@ -1577,7 +1577,7 @@ GNUNET_TRANSPORT_set_traffic_metric (struct GNUNET_TRANSPORT_Handle *handle, struct GNUNET_TRANSPORT_OfferHelloHandle * GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, const struct GNUNET_MessageHeader *hello, - GNUNET_SCHEDULER_Task cont, void *cls) + GNUNET_SCHEDULER_TaskCallback cont, void *cls) { struct GNUNET_TRANSPORT_OfferHelloHandle *ohh; struct GNUNET_MessageHeader *msg; @@ -1663,8 +1663,8 @@ call_hello_update_cb_async (void *cls, struct GNUNET_TRANSPORT_GetHelloHandle *ghh = cls; GNUNET_assert (NULL != ghh->handle->my_hello); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != ghh->notify_task); - ghh->notify_task = GNUNET_SCHEDULER_NO_TASK; + GNUNET_assert (NULL != ghh->notify_task); + ghh->notify_task = NULL; ghh->rec (ghh->rec_cls, (const struct GNUNET_MessageHeader *) ghh->handle->my_hello); } @@ -1711,7 +1711,7 @@ GNUNET_TRANSPORT_get_hello_cancel (struct GNUNET_TRANSPORT_GetHelloHandle *ghh) { struct GNUNET_TRANSPORT_Handle *handle = ghh->handle; - if (GNUNET_SCHEDULER_NO_TASK != ghh->notify_task) + if (NULL != ghh->notify_task) GNUNET_SCHEDULER_cancel (ghh->notify_task); GNUNET_CONTAINER_DLL_remove (handle->hwl_head, handle->hwl_tail, ghh); GNUNET_free (ghh); @@ -1810,20 +1810,20 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) LOG (GNUNET_ERROR_TYPE_DEBUG, "Transport disconnect called!\n"); /* this disconnects all neighbours... */ - if (handle->reconnect_task == GNUNET_SCHEDULER_NO_TASK) + if (handle->reconnect_task == NULL) disconnect_and_schedule_reconnect (handle); /* and now we stop trying to connect again... */ - if (handle->reconnect_task != GNUNET_SCHEDULER_NO_TASK) + if (handle->reconnect_task != NULL) { GNUNET_SCHEDULER_cancel (handle->reconnect_task); - handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + handle->reconnect_task = NULL; } GNUNET_CONTAINER_multipeermap_destroy (handle->neighbours); handle->neighbours = NULL; - if (handle->quota_task != GNUNET_SCHEDULER_NO_TASK) + if (handle->quota_task != NULL) { GNUNET_SCHEDULER_cancel (handle->quota_task); - handle->quota_task = GNUNET_SCHEDULER_NO_TASK; + handle->quota_task = NULL; } GNUNET_free_non_null (handle->my_hello); handle->my_hello = NULL; @@ -1926,9 +1926,9 @@ GNUNET_TRANSPORT_notify_transmit_ready_cancel (struct GNUNET_TRANSPORT_TransmitH } else { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != th->timeout_task); + GNUNET_assert (NULL != th->timeout_task); GNUNET_SCHEDULER_cancel (th->timeout_task); - th->timeout_task = GNUNET_SCHEDULER_NO_TASK; + th->timeout_task = NULL; } GNUNET_free (th); } diff --git a/src/transport/transport_api_monitor_peers.c b/src/transport/transport_api_monitor_peers.c index 611580f688..aaf1000f66 100644 --- a/src/transport/transport_api_monitor_peers.c +++ b/src/transport/transport_api_monitor_peers.c @@ -74,7 +74,7 @@ struct GNUNET_TRANSPORT_PeerMonitoringContext /** * Task ID for reconnect. */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Identity of the peer to monitor. @@ -212,7 +212,7 @@ do_peer_connect (void *cls, { struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx = cls; - pal_ctx->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + pal_ctx->reconnect_task = NULL; pal_ctx->client = GNUNET_CLIENT_connect ("transport", pal_ctx->cfg); GNUNET_assert (NULL != pal_ctx->client); send_peer_mon_request (pal_ctx); @@ -455,10 +455,10 @@ GNUNET_TRANSPORT_monitor_peers_cancel (struct GNUNET_TRANSPORT_PeerMonitoringCon GNUNET_CLIENT_disconnect (pic->client); pic->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != pic->reconnect_task) + if (NULL != pic->reconnect_task) { GNUNET_SCHEDULER_cancel (pic->reconnect_task); - pic->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + pic->reconnect_task = NULL; } GNUNET_free (pic); } diff --git a/src/transport/transport_api_monitor_plugins.c b/src/transport/transport_api_monitor_plugins.c index 0c6cb9214f..6ecee9c98b 100644 --- a/src/transport/transport_api_monitor_plugins.c +++ b/src/transport/transport_api_monitor_plugins.c @@ -72,7 +72,7 @@ struct GNUNET_TRANSPORT_PluginMonitor /** * Task ID for reconnect. */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; }; @@ -141,7 +141,7 @@ do_plugin_connect (void *cls, { struct GNUNET_TRANSPORT_PluginMonitor *pm = cls; - pm->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + pm->reconnect_task = NULL; pm->client = GNUNET_CLIENT_connect ("transport", pm->cfg); GNUNET_assert (NULL != pm->client); send_plugin_mon_request (pm); @@ -442,10 +442,10 @@ GNUNET_TRANSPORT_monitor_plugins_cancel (struct GNUNET_TRANSPORT_PluginMonitor * GNUNET_CLIENT_disconnect (pm->client); pm->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != pm->reconnect_task) + if (NULL != pm->reconnect_task) { GNUNET_SCHEDULER_cancel (pm->reconnect_task); - pm->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + pm->reconnect_task = NULL; } clear_map (pm); GNUNET_CONTAINER_multihashmap32_destroy (pm->sessions); diff --git a/src/transport/transport_api_monitor_validation.c b/src/transport/transport_api_monitor_validation.c index 621a6b00e9..a82e3c1569 100644 --- a/src/transport/transport_api_monitor_validation.c +++ b/src/transport/transport_api_monitor_validation.c @@ -72,7 +72,7 @@ struct GNUNET_TRANSPORT_ValidationMonitoringContext /** * Task ID for reconnect. */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Identity of the peer to monitor. @@ -162,7 +162,7 @@ do_val_connect (void *cls, { struct GNUNET_TRANSPORT_ValidationMonitoringContext *val_ctx = cls; - val_ctx->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + val_ctx->reconnect_task = NULL; val_ctx->client = GNUNET_CLIENT_connect ("transport", val_ctx->cfg); GNUNET_assert (NULL != val_ctx->client); send_val_mon_request (val_ctx); @@ -412,10 +412,10 @@ GNUNET_TRANSPORT_monitor_validation_entries_cancel (struct GNUNET_TRANSPORT_Vali GNUNET_CLIENT_disconnect (vic->client); vic->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != vic->reconnect_task) + if (NULL != vic->reconnect_task) { GNUNET_SCHEDULER_cancel (vic->reconnect_task); - vic->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + vic->reconnect_task = NULL; } GNUNET_free (vic); } diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 6b671ad2a2..a71dd76df5 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -123,7 +123,7 @@ libgnunetutil_la_LIBADD = \ libgnunetutil_la_LDFLAGS = \ $(GN_LIB_LDFLAGS) \ - -version-info 12:0:0 + -version-info 13:0:0 if HAVE_TESTING GNUNET_ECC = gnunet-ecc diff --git a/src/util/bandwidth.c b/src/util/bandwidth.c index 18b8468693..ceec09b52b 100644 --- a/src/util/bandwidth.c +++ b/src/util/bandwidth.c @@ -131,7 +131,7 @@ excess_trigger (void *cls, { struct GNUNET_BANDWIDTH_Tracker *av = cls; - av->excess_task = GNUNET_SCHEDULER_NO_TASK; + av->excess_task = NULL; if (NULL != av->excess_cb) av->excess_cb (av->excess_cb_cls); @@ -179,7 +179,7 @@ update_excess (struct GNUNET_BANDWIDTH_Tracker *av) delay = GNUNET_TIME_relative_divide (delay, av->available_bytes_per_s__); } - if (GNUNET_SCHEDULER_NO_TASK != av->excess_task) + if (NULL != av->excess_task) GNUNET_SCHEDULER_cancel (av->excess_task); av->excess_task = GNUNET_SCHEDULER_add_delayed (delay, &excess_trigger, @@ -273,9 +273,9 @@ GNUNET_BANDWIDTH_tracker_init (struct GNUNET_BANDWIDTH_Tracker *av, void GNUNET_BANDWIDTH_tracker_notification_stop (struct GNUNET_BANDWIDTH_Tracker *av) { - if (GNUNET_SCHEDULER_NO_TASK != av->excess_task) + if (NULL != av->excess_task) GNUNET_SCHEDULER_cancel (av->excess_task); - av->excess_task = GNUNET_SCHEDULER_NO_TASK; + av->excess_task = NULL; av->excess_cb = NULL; av->excess_cb_cls = NULL; av->update_cb = NULL; diff --git a/src/util/client.c b/src/util/client.c index c222a0ff7f..7128a2de43 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -70,7 +70,7 @@ struct GNUNET_CLIENT_TransmitHandle * If we are re-trying and are delaying to do so, * handle to the scheduled task managing the delay. */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Timeout for the operation overall. @@ -182,7 +182,7 @@ struct GNUNET_CLIENT_Connection * If we are re-trying and are delaying to do so, * handle to the scheduled task managing the delay. */ - GNUNET_SCHEDULER_TaskIdentifier receive_task; + struct GNUNET_SCHEDULER_Task * receive_task; /** * Buffer for received message. @@ -457,10 +457,10 @@ GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *client) GNUNET_CONNECTION_destroy (client->connection); client->connection = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != client->receive_task) + if (NULL != client->receive_task) { GNUNET_SCHEDULER_cancel (client->receive_task); - client->receive_task = GNUNET_SCHEDULER_NO_TASK; + client->receive_task = NULL; } if (NULL != client->tag) { @@ -581,7 +581,7 @@ receive_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) ntohs (cmsg->type), msize, client->service_name); - client->receive_task = GNUNET_SCHEDULER_NO_TASK; + client->receive_task = NULL; GNUNET_assert (GNUNET_YES == client->msg_complete); GNUNET_assert (client->received_pos >= msize); memcpy (msg, cmsg, msize); @@ -623,7 +623,7 @@ GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *client, client->receive_timeout = GNUNET_TIME_relative_to_absolute (timeout); if (GNUNET_YES == client->msg_complete) { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == client->receive_task); + GNUNET_assert (NULL == client->receive_task); client->receive_task = GNUNET_SCHEDULER_add_now (&receive_task, client); } else @@ -670,7 +670,7 @@ struct GNUNET_CLIENT_TestHandle /** * ID of task used for asynchronous operations. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * Final result to report back (once known). @@ -697,10 +697,10 @@ GNUNET_CLIENT_service_test_cancel (struct GNUNET_CLIENT_TestHandle *th) GNUNET_CLIENT_disconnect (th->client); th->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != th->task) + if (NULL != th->task) { GNUNET_SCHEDULER_cancel (th->task); - th->task = GNUNET_SCHEDULER_NO_TASK; + th->task = NULL; } GNUNET_free (th); } @@ -719,7 +719,7 @@ report_result (void *cls, { struct GNUNET_CLIENT_TestHandle *th = cls; - th->task = GNUNET_SCHEDULER_NO_TASK; + th->task = NULL; th->cb (th->cb_cls, th->result); GNUNET_CLIENT_service_test_cancel (th); } @@ -1053,7 +1053,7 @@ client_delayed_retry (void *cls, struct GNUNET_CLIENT_TransmitHandle *th = cls; struct GNUNET_TIME_Relative delay; - th->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + th->reconnect_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { /* give up, was shutdown */ @@ -1077,7 +1077,7 @@ client_delayed_retry (void *cls, "Transmission failed %u times, trying again in %s.\n", MAX_ATTEMPTS - th->attempts_left, GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == th->reconnect_task); + GNUNET_assert (NULL == th->reconnect_task); th->reconnect_task = GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th); return; @@ -1155,7 +1155,7 @@ client_notify (void *cls, size_t size, void *buf) MAX_ATTEMPTS - th->attempts_left, GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); client->th = th; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == th->reconnect_task); + GNUNET_assert (NULL == th->reconnect_task); th->reconnect_task = GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th); return 0; @@ -1224,7 +1224,7 @@ GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *client, client->th = th; if (NULL == client->connection) { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == th->reconnect_task); + GNUNET_assert (NULL == th->reconnect_task); th->reconnect_task = GNUNET_SCHEDULER_add_delayed (client->back_off, &client_delayed_retry, @@ -1256,11 +1256,11 @@ GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *client, void GNUNET_CLIENT_notify_transmit_ready_cancel (struct GNUNET_CLIENT_TransmitHandle *th) { - if (GNUNET_SCHEDULER_NO_TASK != th->reconnect_task) + if (NULL != th->reconnect_task) { GNUNET_assert (NULL == th->th); GNUNET_SCHEDULER_cancel (th->reconnect_task); - th->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + th->reconnect_task = NULL; } else { diff --git a/src/util/client_manager.c b/src/util/client_manager.c index f27c5e3928..6a462cad66 100644 --- a/src/util/client_manager.c +++ b/src/util/client_manager.c @@ -119,7 +119,7 @@ struct GNUNET_CLIENT_MANAGER_Connection /** * Task doing exponential back-off trying to reconnect. */ - GNUNET_SCHEDULER_TaskIdentifier reconnect_task; + struct GNUNET_SCHEDULER_Task * reconnect_task; /** * Time for next connect retry. @@ -304,7 +304,7 @@ static void schedule_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_CLIENT_MANAGER_Connection *mgr = cls; - mgr->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + mgr->reconnect_task = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to %s service.\n", mgr->service_name); @@ -382,10 +382,10 @@ GNUNET_CLIENT_MANAGER_disconnect (struct GNUNET_CLIENT_MANAGER_Connection *mgr, GNUNET_CLIENT_MANAGER_drop_queue (mgr); } } - if (mgr->reconnect_task != GNUNET_SCHEDULER_NO_TASK) + if (mgr->reconnect_task != NULL) { GNUNET_SCHEDULER_cancel (mgr->reconnect_task); - mgr->reconnect_task = GNUNET_SCHEDULER_NO_TASK; + mgr->reconnect_task = NULL; } if (NULL != mgr->client_tmit) { @@ -413,7 +413,7 @@ GNUNET_CLIENT_MANAGER_disconnect (struct GNUNET_CLIENT_MANAGER_Connection *mgr, void GNUNET_CLIENT_MANAGER_reconnect (struct GNUNET_CLIENT_MANAGER_Connection *mgr) { - if (GNUNET_SCHEDULER_NO_TASK != mgr->reconnect_task) + if (NULL != mgr->reconnect_task) return; if (NULL != mgr->client_tmit) diff --git a/src/util/connection.c b/src/util/connection.c index 79d1c2d4c3..f28beb34c4 100644 --- a/src/util/connection.c +++ b/src/util/connection.c @@ -70,7 +70,7 @@ struct GNUNET_CONNECTION_TransmitHandle /** * Task called on timeout. */ - GNUNET_SCHEDULER_TaskIdentifier timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * At what number of bytes available in the @@ -121,7 +121,7 @@ struct AddressProbe /** * Task waiting for the connection to finish connecting. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; }; @@ -204,12 +204,12 @@ struct GNUNET_CONNECTION_Handle /** * Read task that we may need to wait for. */ - GNUNET_SCHEDULER_TaskIdentifier read_task; + struct GNUNET_SCHEDULER_Task * read_task; /** * Write task that we may need to wait for. */ - GNUNET_SCHEDULER_TaskIdentifier write_task; + struct GNUNET_SCHEDULER_Task * write_task; /** * Handle to a pending DNS lookup request. @@ -522,13 +522,13 @@ signal_transmit_error (struct GNUNET_CONNECTION_Handle *connection, GNUNET_NETWORK_socket_shutdown (connection->sock, SHUT_RDWR); GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (connection->sock)); connection->sock = NULL; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->write_task); + GNUNET_assert (NULL == connection->write_task); } - if (GNUNET_SCHEDULER_NO_TASK != connection->read_task) + if (NULL != connection->read_task) { /* send errors trigger read errors... */ GNUNET_SCHEDULER_cancel (connection->read_task); - connection->read_task = GNUNET_SCHEDULER_NO_TASK; + connection->read_task = NULL; signal_receive_timeout (connection); return; } @@ -556,7 +556,7 @@ connect_fail_continuation (struct GNUNET_CONNECTION_Handle *connection) GNUNET_break (NULL == connection->ap_tail); GNUNET_break (GNUNET_NO == connection->dns_active); GNUNET_break (NULL == connection->sock); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->write_task); + GNUNET_assert (NULL == connection->write_task); /* signal errors for jobs that used to wait on the connection */ connection->destroy_later = 1; @@ -564,9 +564,9 @@ connect_fail_continuation (struct GNUNET_CONNECTION_Handle *connection) signal_receive_error (connection, ECONNREFUSED); if (NULL != connection->nth.notify_ready) { - GNUNET_assert (connection->nth.timeout_task != GNUNET_SCHEDULER_NO_TASK); + GNUNET_assert (connection->nth.timeout_task != NULL); GNUNET_SCHEDULER_cancel (connection->nth.timeout_task); - connection->nth.timeout_task = GNUNET_SCHEDULER_NO_TASK; + connection->nth.timeout_task = NULL; signal_transmit_error (connection, ECONNREFUSED); } if (-1 == connection->destroy_later) @@ -618,7 +618,7 @@ connect_success_continuation (struct GNUNET_CONNECTION_Handle *connection) LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection succeeded, starting with receiving data (%p)\n", connection); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->read_task); + GNUNET_assert (NULL == connection->read_task); connection->read_task = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_absolute_get_remaining (connection->receive_timeout), connection->sock, @@ -629,10 +629,10 @@ connect_success_continuation (struct GNUNET_CONNECTION_Handle *connection) LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection succeeded, starting with sending data (%p)\n", connection); - GNUNET_assert (connection->nth.timeout_task != GNUNET_SCHEDULER_NO_TASK); + GNUNET_assert (connection->nth.timeout_task != NULL); GNUNET_SCHEDULER_cancel (connection->nth.timeout_task); - connection->nth.timeout_task = GNUNET_SCHEDULER_NO_TASK; - GNUNET_assert (connection->write_task == GNUNET_SCHEDULER_NO_TASK); + connection->nth.timeout_task = NULL; + GNUNET_assert (connection->write_task == NULL); connection->write_task = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_absolute_get_remaining (connection->nth.transmit_timeout), connection->sock, @@ -982,21 +982,21 @@ GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *connection) LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down connection (%p)\n", connection); GNUNET_assert (NULL == connection->nth.notify_ready); GNUNET_assert (NULL == connection->receiver); - if (GNUNET_SCHEDULER_NO_TASK != connection->write_task) + if (NULL != connection->write_task) { GNUNET_SCHEDULER_cancel (connection->write_task); - connection->write_task = GNUNET_SCHEDULER_NO_TASK; + connection->write_task = NULL; connection->write_buffer_off = 0; } - if (GNUNET_SCHEDULER_NO_TASK != connection->read_task) + if (NULL != connection->read_task) { GNUNET_SCHEDULER_cancel (connection->read_task); - connection->read_task = GNUNET_SCHEDULER_NO_TASK; + connection->read_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != connection->nth.timeout_task) + if (NULL != connection->nth.timeout_task) { GNUNET_SCHEDULER_cancel (connection->nth.timeout_task); - connection->nth.timeout_task = GNUNET_SCHEDULER_NO_TASK; + connection->nth.timeout_task = NULL; } connection->nth.notify_ready = NULL; if (NULL != connection->dns_active) @@ -1051,7 +1051,7 @@ receive_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) ssize_t ret; GNUNET_CONNECTION_Receiver receiver; - connection->read_task = GNUNET_SCHEDULER_NO_TASK; + connection->read_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { /* ignore shutdown request, go again immediately */ @@ -1115,7 +1115,7 @@ GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *connection, size_t m GNUNET_CONNECTION_Receiver receiver, void *receiver_cls) { - GNUNET_assert ((GNUNET_SCHEDULER_NO_TASK == connection->read_task) && + GNUNET_assert ((NULL == connection->read_task) && (NULL == connection->receiver)); GNUNET_assert (NULL != receiver); connection->receiver = receiver; @@ -1150,10 +1150,10 @@ GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *connection, size_t m void * GNUNET_CONNECTION_receive_cancel (struct GNUNET_CONNECTION_Handle *connection) { - if (GNUNET_SCHEDULER_NO_TASK != connection->read_task) + if (NULL != connection->read_task) { GNUNET_assert (connection == GNUNET_SCHEDULER_cancel (connection->read_task)); - connection->read_task = GNUNET_SCHEDULER_NO_TASK; + connection->read_task = NULL; } connection->receiver = NULL; return connection->receiver_cls; @@ -1177,7 +1177,7 @@ process_notify (struct GNUNET_CONNECTION_Handle *connection) LOG (GNUNET_ERROR_TYPE_DEBUG, "process_notify is running\n"); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->write_task); + GNUNET_assert (NULL == connection->write_task); if (NULL == (notify = connection->nth.notify_ready)) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Noone to notify\n"); @@ -1229,7 +1229,7 @@ transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_CONNECTION_Handle *connection = cls; GNUNET_CONNECTION_TransmitReadyNotify notify; - connection->nth.timeout_task = GNUNET_SCHEDULER_NO_TASK; + connection->nth.timeout_task = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmit to `%s:%u/%s' fails, time out reached (%p).\n", connection->hostname, @@ -1259,7 +1259,7 @@ connect_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmission request of size %u fails (%s/%u), connection failed (%p).\n", connection->nth.notify_size, connection->hostname, connection->port, connection); - connection->write_task = GNUNET_SCHEDULER_NO_TASK; + connection->write_task = NULL; notify = connection->nth.notify_ready; connection->nth.notify_ready = NULL; notify (connection->nth.notify_ready_cls, 0, NULL); @@ -1281,9 +1281,9 @@ transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) size_t have; LOG (GNUNET_ERROR_TYPE_DEBUG, "transmit_ready running (%p).\n", connection); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != connection->write_task); - connection->write_task = GNUNET_SCHEDULER_NO_TASK; - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->nth.timeout_task); + GNUNET_assert (NULL != connection->write_task); + connection->write_task = NULL; + GNUNET_assert (NULL == connection->nth.timeout_task); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { if (NULL != connection->sock) @@ -1320,7 +1320,7 @@ transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } if (!GNUNET_NETWORK_fdset_isset (tc->write_ready, connection->sock)) { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->write_task); + GNUNET_assert (NULL == connection->write_task); /* special circumstances (in particular, shutdown): not yet ready * to write, but no "fatal" error either. Hence retry. */ goto SCHEDULE_WRITE; @@ -1352,10 +1352,10 @@ RETRY: { if (EINTR == errno) goto RETRY; - if (GNUNET_SCHEDULER_NO_TASK != connection->write_task) + if (NULL != connection->write_task) { GNUNET_SCHEDULER_cancel (connection->write_task); - connection->write_task = GNUNET_SCHEDULER_NO_TASK; + connection->write_task = NULL; } signal_transmit_error (connection, errno); return; @@ -1378,7 +1378,7 @@ SCHEDULE_WRITE: "Re-scheduling transmit_ready (more to do) (%p).\n", connection); have = connection->write_buffer_off - connection->write_buffer_pos; GNUNET_assert ((NULL != connection->nth.notify_ready) || (have > 0)); - if (GNUNET_SCHEDULER_NO_TASK == connection->write_task) + if (NULL == connection->write_task) connection->write_task = GNUNET_SCHEDULER_add_write_net ((connection->nth.notify_ready == NULL) ? GNUNET_TIME_UNIT_FOREVER_REL : @@ -1424,17 +1424,17 @@ GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_CONNECTION_Handle *connec connection->nth.connection = connection; connection->nth.notify_size = size; connection->nth.transmit_timeout = GNUNET_TIME_relative_to_absolute (timeout); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->nth.timeout_task); + GNUNET_assert (NULL == connection->nth.timeout_task); if ((NULL == connection->sock) && (NULL == connection->ap_head) && (NULL == connection->dns_active)) { - if (GNUNET_SCHEDULER_NO_TASK != connection->write_task) + if (NULL != connection->write_task) GNUNET_SCHEDULER_cancel (connection->write_task); connection->write_task = GNUNET_SCHEDULER_add_now (&connect_error, connection); return &connection->nth; } - if (GNUNET_SCHEDULER_NO_TASK != connection->write_task) + if (NULL != connection->write_task) return &connection->nth; /* previous transmission still in progress */ if (NULL != connection->sock) { @@ -1467,15 +1467,15 @@ GNUNET_CONNECTION_notify_transmit_ready_cancel (struct { GNUNET_assert (NULL != th->notify_ready); th->notify_ready = NULL; - if (GNUNET_SCHEDULER_NO_TASK != th->timeout_task) + if (NULL != th->timeout_task) { GNUNET_SCHEDULER_cancel (th->timeout_task); - th->timeout_task = GNUNET_SCHEDULER_NO_TASK; + th->timeout_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != th->connection->write_task) + if (NULL != th->connection->write_task) { GNUNET_SCHEDULER_cancel (th->connection->write_task); - th->connection->write_task = GNUNET_SCHEDULER_NO_TASK; + th->connection->write_task = NULL; } } diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c index ac64d68e1b..d68e890a71 100644 --- a/src/util/crypto_hash.c +++ b/src/util/crypto_hash.c @@ -98,7 +98,7 @@ struct GNUNET_CRYPTO_FileHashContext /** * Current task for hashing. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * Priority we use. @@ -143,7 +143,7 @@ file_hash_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_HashCode *res; size_t delta; - fhc->task = GNUNET_SCHEDULER_NO_TASK; + fhc->task = NULL; GNUNET_assert (fhc->offset <= fhc->fsize); delta = fhc->bsize; if (fhc->fsize - fhc->offset < delta) diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c index b6a9969da4..6e3fcd33ad 100644 --- a/src/util/gnunet-scrypt.c +++ b/src/util/gnunet-scrypt.c @@ -40,7 +40,7 @@ static struct GNUNET_CRYPTO_EddsaPublicKey pub; static uint64_t proof; -static GNUNET_SCHEDULER_TaskIdentifier proof_task; +static struct GNUNET_SCHEDULER_Task * proof_task; static const struct GNUNET_CONFIGURATION_Handle *cfg; @@ -128,7 +128,7 @@ find_proof (void *cls, return; } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got Proof of Work %llu\n", proof); - proof_task = GNUNET_SCHEDULER_NO_TASK; + proof_task = NULL; memcpy (&buf[sizeof (uint64_t)], &pub, sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); i = 0; diff --git a/src/util/gnunet-uri.c b/src/util/gnunet-uri.c index 545b78981a..8e4930da4c 100644 --- a/src/util/gnunet-uri.c +++ b/src/util/gnunet-uri.c @@ -77,7 +77,7 @@ run (void *cls, char *const *args, const char *cfgfile, const char *slash; char *subsystem; char *program; - GNUNET_SCHEDULER_TaskIdentifier rt; + struct GNUNET_SCHEDULER_Task * rt; if (NULL == (uri = args[0])) { diff --git a/src/util/helper.c b/src/util/helper.c index 105ccf0577..6dd417a91e 100644 --- a/src/util/helper.c +++ b/src/util/helper.c @@ -142,17 +142,17 @@ struct GNUNET_HELPER_Handle /** * Task to read from the helper. */ - GNUNET_SCHEDULER_TaskIdentifier read_task; + struct GNUNET_SCHEDULER_Task * read_task; /** * Task to read from the helper. */ - GNUNET_SCHEDULER_TaskIdentifier write_task; + struct GNUNET_SCHEDULER_Task * write_task; /** * Restart task. */ - GNUNET_SCHEDULER_TaskIdentifier restart_task; + struct GNUNET_SCHEDULER_Task * restart_task; /** * Does the helper support the use of a control pipe for signalling? @@ -187,15 +187,15 @@ GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, sh->cont (sh->cont_cls, GNUNET_NO); GNUNET_free (sh); } - if (GNUNET_SCHEDULER_NO_TASK != h->restart_task) + if (NULL != h->restart_task) { GNUNET_SCHEDULER_cancel (h->restart_task); - h->restart_task = GNUNET_SCHEDULER_NO_TASK; + h->restart_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->read_task) + if (NULL != h->read_task) { GNUNET_SCHEDULER_cancel (h->read_task); - h->read_task = GNUNET_SCHEDULER_NO_TASK; + h->read_task = NULL; } if (NULL == h->helper_proc) return GNUNET_SYSERR; @@ -235,15 +235,15 @@ GNUNET_HELPER_wait (struct GNUNET_HELPER_Handle *h) GNUNET_OS_process_destroy (h->helper_proc); h->helper_proc = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->read_task) + if (NULL != h->read_task) { GNUNET_SCHEDULER_cancel (h->read_task); - h->read_task = GNUNET_SCHEDULER_NO_TASK; + h->read_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != h->write_task) + if (NULL != h->write_task) { GNUNET_SCHEDULER_cancel (h->write_task); - h->write_task = GNUNET_SCHEDULER_NO_TASK; + h->write_task = NULL; } if (NULL != h->helper_in) { @@ -284,10 +284,10 @@ static void stop_helper (struct GNUNET_HELPER_Handle *h, int soft_kill) { - if (GNUNET_SCHEDULER_NO_TASK != h->restart_task) + if (NULL != h->restart_task) { GNUNET_SCHEDULER_cancel (h->restart_task); - h->restart_task = GNUNET_SCHEDULER_NO_TASK; + h->restart_task = NULL; } else { @@ -322,7 +322,7 @@ helper_read (void *cls, char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE] GNUNET_ALIGN; ssize_t t; - h->read_task = GNUNET_SCHEDULER_NO_TASK; + h->read_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { /* try again */ @@ -460,7 +460,7 @@ restart_task (void *cls, { struct GNUNET_HELPER_Handle*h = cls; - h->restart_task = GNUNET_SCHEDULER_NO_TASK; + h->restart_task = NULL; start_helper (h); } @@ -524,13 +524,13 @@ GNUNET_HELPER_destroy (struct GNUNET_HELPER_Handle *h) unsigned int c; struct GNUNET_HELPER_SendHandle *sh; - if (GNUNET_SCHEDULER_NO_TASK != h->write_task) + if (NULL != h->write_task) { GNUNET_SCHEDULER_cancel (h->write_task); - h->write_task = GNUNET_SCHEDULER_NO_TASK; + h->write_task = NULL; } - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->read_task); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->restart_task); + GNUNET_assert (NULL == h->read_task); + GNUNET_assert (NULL == h->restart_task); while (NULL != (sh = h->sh_head)) { GNUNET_CONTAINER_DLL_remove (h->sh_head, @@ -582,7 +582,7 @@ helper_write (void *cls, const char *buf; ssize_t t; - h->write_task = GNUNET_SCHEDULER_NO_TASK; + h->write_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { /* try again */ @@ -684,7 +684,7 @@ GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, GNUNET_CONTAINER_DLL_insert_tail (h->sh_head, h->sh_tail, sh); - if (GNUNET_SCHEDULER_NO_TASK == h->write_task) + if (NULL == h->write_task) h->write_task = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, h->fh_to_helper, &helper_write, @@ -714,7 +714,7 @@ GNUNET_HELPER_send_cancel (struct GNUNET_HELPER_SendHandle *sh) if (NULL == h->sh_head) { GNUNET_SCHEDULER_cancel (h->write_task); - h->write_task = GNUNET_SCHEDULER_NO_TASK; + h->write_task = NULL; } } } diff --git a/src/util/mq.c b/src/util/mq.c index d34850b8c8..254e5d33ed 100644 --- a/src/util/mq.c +++ b/src/util/mq.c @@ -133,7 +133,7 @@ struct GNUNET_MQ_Handle /** * Task scheduled during #GNUNET_MQ_impl_send_continue. */ - GNUNET_SCHEDULER_TaskIdentifier continue_task; + struct GNUNET_SCHEDULER_Task * continue_task; /** * Next id that should be used for the @e assoc_map, @@ -310,7 +310,7 @@ impl_send_continue (void *cls, if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; - mq->continue_task = GNUNET_SCHEDULER_NO_TASK; + mq->continue_task = NULL; /* call is only valid if we're actually currently sending * a message */ current_envelope = mq->current_envelope; @@ -345,7 +345,7 @@ impl_send_continue (void *cls, void GNUNET_MQ_impl_send_continue (struct GNUNET_MQ_Handle *mq) { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == mq->continue_task); + GNUNET_assert (NULL == mq->continue_task); mq->continue_task = GNUNET_SCHEDULER_add_now (&impl_send_continue, mq); } @@ -776,10 +776,10 @@ GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq) { mq->destroy_impl (mq, mq->impl_state); } - if (GNUNET_SCHEDULER_NO_TASK != mq->continue_task) + if (NULL != mq->continue_task) { GNUNET_SCHEDULER_cancel (mq->continue_task); - mq->continue_task = GNUNET_SCHEDULER_NO_TASK; + mq->continue_task = NULL; } while (NULL != mq->envelope_head) { diff --git a/src/util/os_priority.c b/src/util/os_priority.c index d3310abb17..a76a5cc4a8 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c @@ -1693,7 +1693,7 @@ struct GNUNET_OS_CommandHandle /** * Task reading from pipe. */ - GNUNET_SCHEDULER_TaskIdentifier rtask; + struct GNUNET_SCHEDULER_Task * rtask; /** * When to time out. @@ -1719,7 +1719,7 @@ GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd) { if (NULL != cmd->proc) { - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != cmd->rtask); + GNUNET_assert (NULL != cmd->rtask); GNUNET_SCHEDULER_cancel (cmd->rtask); } (void) GNUNET_OS_process_kill (cmd->eip, SIGKILL); @@ -1744,7 +1744,7 @@ cmd_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) char *end; ssize_t ret; - cmd->rtask = GNUNET_SCHEDULER_NO_TASK; + cmd->rtask = NULL; if (GNUNET_YES != GNUNET_NETWORK_fdset_handle_isset (tc->read_ready, cmd->r)) { /* timeout, shutdown, etc. */ diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index f3988c7c5e..8ddaafa0a8 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c @@ -78,13 +78,13 @@ static struct GNUNET_TIME_Relative backoff; /** * Task for reconnecting. */ -static GNUNET_SCHEDULER_TaskIdentifier r_task; +static struct GNUNET_SCHEDULER_Task * r_task; /** * Task ID of shutdown task; only present while we have a * connection to the resolver service. */ -static GNUNET_SCHEDULER_TaskIdentifier s_task; +static struct GNUNET_SCHEDULER_Task * s_task; /** @@ -131,7 +131,7 @@ struct GNUNET_RESOLVER_RequestHandle * Task handle for making reply callbacks in numeric lookups * asynchronous, and for timeout handling. */ - GNUNET_SCHEDULER_TaskIdentifier task; + struct GNUNET_SCHEDULER_Task * task; /** * Desired address family. @@ -256,15 +256,15 @@ GNUNET_RESOLVER_disconnect () GNUNET_CLIENT_disconnect (client); client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != r_task) + if (NULL != r_task) { GNUNET_SCHEDULER_cancel (r_task); - r_task = GNUNET_SCHEDULER_NO_TASK; + r_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != s_task) + if (NULL != s_task) { GNUNET_SCHEDULER_cancel (s_task); - s_task = GNUNET_SCHEDULER_NO_TASK; + s_task = NULL; } } @@ -381,7 +381,7 @@ handle_response (void *cls, rh->addr_callback (rh->cls, NULL, 0); } GNUNET_CONTAINER_DLL_remove (req_head, req_tail, rh); - if (GNUNET_SCHEDULER_NO_TASK != rh->task) + if (NULL != rh->task) GNUNET_SCHEDULER_cancel (rh->task); GNUNET_free (rh); GNUNET_CLIENT_disconnect (client); @@ -410,7 +410,7 @@ handle_response (void *cls, rh->addr_callback (rh->cls, NULL, 0); } GNUNET_CONTAINER_DLL_remove (req_head, req_tail, rh); - if (GNUNET_SCHEDULER_NO_TASK != rh->task) + if (NULL != rh->task) GNUNET_SCHEDULER_cancel (rh->task); GNUNET_free (rh); process_requests (); @@ -428,7 +428,7 @@ handle_response (void *cls, if (GNUNET_SYSERR != rh->was_transmitted) rh->name_callback (rh->cls, NULL); GNUNET_CONTAINER_DLL_remove (req_head, req_tail, rh); - if (GNUNET_SCHEDULER_NO_TASK != rh->task) + if (NULL != rh->task) GNUNET_SCHEDULER_cancel (rh->task); GNUNET_free (rh); GNUNET_CLIENT_disconnect (client); @@ -485,7 +485,7 @@ handle_response (void *cls, if (GNUNET_SYSERR != rh->was_transmitted) rh->addr_callback (rh->cls, NULL, 0); GNUNET_CONTAINER_DLL_remove (req_head, req_tail, rh); - if (GNUNET_SCHEDULER_NO_TASK != rh->task) + if (NULL != rh->task) GNUNET_SCHEDULER_cancel (rh->task); GNUNET_free (rh); GNUNET_CLIENT_disconnect (client); @@ -519,7 +519,7 @@ numeric_resolution (void *cls, struct sockaddr_in6 v6; const char *hostname; - rh->task = GNUNET_SCHEDULER_NO_TASK; + rh->task = NULL; memset (&v4, 0, sizeof (v4)); v4.sin_family = AF_INET; #if HAVE_SOCKADDR_IN_SIN_LEN @@ -582,7 +582,7 @@ loopback_resolution (void *cls, struct sockaddr_in v4; struct sockaddr_in6 v6; - rh->task = GNUNET_SCHEDULER_NO_TASK; + rh->task = NULL; memset (&v4, 0, sizeof (v4)); v4.sin_addr.s_addr = htonl (INADDR_LOOPBACK); v4.sin_family = AF_INET; @@ -625,7 +625,7 @@ static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - s_task = GNUNET_SCHEDULER_NO_TASK; + s_task = NULL; GNUNET_RESOLVER_disconnect (); backoff = GNUNET_TIME_UNIT_MILLISECONDS; } @@ -694,7 +694,7 @@ static void reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - r_task = GNUNET_SCHEDULER_NO_TASK; + r_task = NULL; if (NULL == req_head) return; /* no work pending */ if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) @@ -721,7 +721,7 @@ reconnect () { struct GNUNET_RESOLVER_RequestHandle *rh; - if (GNUNET_SCHEDULER_NO_TASK != r_task) + if (NULL != r_task) return; GNUNET_assert (NULL == client); if (NULL != (rh = req_head)) @@ -766,7 +766,7 @@ handle_lookup_timeout (void *cls, { struct GNUNET_RESOLVER_RequestHandle *rh = cls; - rh->task = GNUNET_SCHEDULER_NO_TASK; + rh->task = NULL; rh->addr_callback (rh->cls, NULL, 0); @@ -837,10 +837,10 @@ GNUNET_RESOLVER_ip_get (const char *hostname, int af, rh); GNUNET_CONTAINER_DLL_insert_tail (req_head, req_tail, rh); rh->was_queued = GNUNET_YES; - if (s_task != GNUNET_SCHEDULER_NO_TASK) + if (s_task != NULL) { GNUNET_SCHEDULER_cancel (s_task); - s_task = GNUNET_SCHEDULER_NO_TASK; + s_task = NULL; } process_requests (); return rh; @@ -863,7 +863,7 @@ numeric_reverse (void *cls, struct GNUNET_RESOLVER_RequestHandle *rh = cls; char *result; - rh->task = GNUNET_SCHEDULER_NO_TASK; + rh->task = NULL; result = no_resolve (rh->af, &rh[1], rh->data_len); @@ -937,10 +937,10 @@ GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa, req_tail, rh); rh->was_queued = GNUNET_YES; - if (s_task != GNUNET_SCHEDULER_NO_TASK) + if (s_task != NULL) { GNUNET_SCHEDULER_cancel (s_task); - s_task = GNUNET_SCHEDULER_NO_TASK; + s_task = NULL; } process_requests (); return rh; @@ -1024,10 +1024,10 @@ GNUNET_RESOLVER_hostname_resolve (int af, void GNUNET_RESOLVER_request_cancel (struct GNUNET_RESOLVER_RequestHandle *rh) { - if (rh->task != GNUNET_SCHEDULER_NO_TASK) + if (rh->task != NULL) { GNUNET_SCHEDULER_cancel (rh->task); - rh->task = GNUNET_SCHEDULER_NO_TASK; + rh->task = NULL; } if (GNUNET_NO == rh->was_transmitted) { diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 87a107dba7..ec45889ea8 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c @@ -71,19 +71,24 @@ /** - * Linked list of pending tasks. + * Entry in list of pending tasks. */ -struct Task +struct GNUNET_SCHEDULER_Task { /** * This is a linked list. */ - struct Task *next; + struct GNUNET_SCHEDULER_Task *next; + + /** + * This is a linked list. + */ + struct GNUNET_SCHEDULER_Task *prev; /** * Function to run when ready. */ - GNUNET_SCHEDULER_Task callback; + GNUNET_SCHEDULER_TaskCallback callback; /** * Closure for the @e callback. @@ -106,13 +111,8 @@ struct Task struct GNUNET_NETWORK_FDSet *write_set; /** - * Unique task identifier. - */ - GNUNET_SCHEDULER_TaskIdentifier id; - - /** * Absolute timeout value for the task, or - * GNUNET_TIME_UNIT_FOREVER_ABS for "no timeout". + * #GNUNET_TIME_UNIT_FOREVER_ABS for "no timeout". */ struct GNUNET_TIME_Absolute timeout; @@ -169,9 +169,14 @@ struct Task /** - * List of tasks waiting for an event. + * Head of list of tasks waiting for an event. + */ +static struct GNUNET_SCHEDULER_Task *pending_head; + +/** + * Tail of list of tasks waiting for an event. */ -static struct Task *pending; +static struct GNUNET_SCHEDULER_Task *pending_tail; /** * List of tasks waiting ONLY for a timeout event. @@ -180,31 +185,37 @@ static struct Task *pending; * building select sets (we just look at the head * to determine the respective timeout ONCE). */ -static struct Task *pending_timeout; +static struct GNUNET_SCHEDULER_Task *pending_timeout_head; + +/** + * List of tasks waiting ONLY for a timeout event. + * Sorted by timeout (earliest first). Used so that + * we do not traverse the list of these tasks when + * building select sets (we just look at the head + * to determine the respective timeout ONCE). + */ +static struct GNUNET_SCHEDULER_Task *pending_timeout_tail; /** * Last inserted task waiting ONLY for a timeout event. * Used to (heuristically) speed up insertion. */ -static struct Task *pending_timeout_last; +static struct GNUNET_SCHEDULER_Task *pending_timeout_last; /** * ID of the task that is running right now. */ -static struct Task *active_task; +static struct GNUNET_SCHEDULER_Task *active_task; /** - * List of tasks ready to run right now, - * grouped by importance. + * Head of list of tasks ready to run right now, grouped by importance. */ -static struct Task *ready[GNUNET_SCHEDULER_PRIORITY_COUNT]; +static struct GNUNET_SCHEDULER_Task *ready_head[GNUNET_SCHEDULER_PRIORITY_COUNT]; /** - * Identity of the last task queued. Incremented for each task to - * generate a unique task ID (it is virtually impossible to start - * more than 2^64 tasks during the lifetime of a process). + * Tail of list of tasks ready to run right now, grouped by importance. */ -static GNUNET_SCHEDULER_TaskIdentifier last_id; +static struct GNUNET_SCHEDULER_Task *ready_tail[GNUNET_SCHEDULER_PRIORITY_COUNT]; /** * Number of tasks on the ready list. @@ -240,10 +251,11 @@ static int current_lifeness; static GNUNET_SCHEDULER_select scheduler_select; /** - * Closure for 'scheduler_select'. + * Closure for #scheduler_select. */ static void *scheduler_select_cls; + /** * Sets the select function to use in the scheduler (scheduler_select). * @@ -284,25 +296,25 @@ check_priority (enum GNUNET_SCHEDULER_Priority p) * @param timeout next timeout (updated) */ static void -update_sets (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws, +update_sets (struct GNUNET_NETWORK_FDSet *rs, + struct GNUNET_NETWORK_FDSet *ws, struct GNUNET_TIME_Relative *timeout) { - struct Task *pos; + struct GNUNET_SCHEDULER_Task *pos; struct GNUNET_TIME_Absolute now; struct GNUNET_TIME_Relative to; now = GNUNET_TIME_absolute_get (); - pos = pending_timeout; + pos = pending_timeout_head; if (NULL != pos) { to = GNUNET_TIME_absolute_get_difference (now, pos->timeout); if (timeout->rel_value_us > to.rel_value_us) *timeout = to; - if (pos->reason != 0) + if (0 != pos->reason) *timeout = GNUNET_TIME_UNIT_ZERO; } - pos = pending; - while (NULL != pos) + for (pos = pending_head; NULL != pos; pos = pos->next) { if (pos->timeout.abs_value_us != GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) { @@ -320,7 +332,6 @@ update_sets (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws, GNUNET_NETWORK_fdset_add (ws, pos->write_set); if (0 != pos->reason) *timeout = GNUNET_TIME_UNIT_ZERO; - pos = pos->next; } } @@ -328,11 +339,11 @@ update_sets (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws, /** * Check if the ready set overlaps with the set we want to have ready. * If so, update the want set (set all FDs that are ready). If not, - * return GNUNET_NO. + * return #GNUNET_NO. * * @param ready set that is ready * @param want set that we want to be ready - * @return GNUNET_YES if there was some overlap + * @return #GNUNET_YES if there was some overlap */ static int set_overlaps (const struct GNUNET_NETWORK_FDSet *ready, @@ -362,7 +373,8 @@ set_overlaps (const struct GNUNET_NETWORK_FDSet *ready, * @return #GNUNET_YES if we can run it, #GNUNET_NO if not. */ static int -is_ready (struct Task *task, struct GNUNET_TIME_Absolute now, +is_ready (struct GNUNET_SCHEDULER_Task *task, + struct GNUNET_TIME_Absolute now, const struct GNUNET_NETWORK_FDSet *rs, const struct GNUNET_NETWORK_FDSet *ws) { @@ -395,14 +407,15 @@ is_ready (struct Task *task, struct GNUNET_TIME_Absolute now, * @param task task ready for execution */ static void -queue_ready_task (struct Task *task) +queue_ready_task (struct GNUNET_SCHEDULER_Task *task) { - enum GNUNET_SCHEDULER_Priority p = task->priority; + enum GNUNET_SCHEDULER_Priority p = check_priority (task->priority); if (0 != (task->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) p = GNUNET_SCHEDULER_PRIORITY_SHUTDOWN; - task->next = ready[check_priority (p)]; - ready[check_priority (p)] = task; + GNUNET_CONTAINER_DLL_insert (ready_head[p], + ready_tail[p], + task); ready_count++; } @@ -418,45 +431,35 @@ static void check_ready (const struct GNUNET_NETWORK_FDSet *rs, const struct GNUNET_NETWORK_FDSet *ws) { - struct Task *pos; - struct Task *prev; - struct Task *next; + struct GNUNET_SCHEDULER_Task *pos; + struct GNUNET_SCHEDULER_Task *next; struct GNUNET_TIME_Absolute now; now = GNUNET_TIME_absolute_get (); - prev = NULL; - pos = pending_timeout; - while (NULL != pos) + while (NULL != (pos = pending_timeout_head)) { - next = pos->next; if (now.abs_value_us >= pos->timeout.abs_value_us) pos->reason |= GNUNET_SCHEDULER_REASON_TIMEOUT; if (0 == pos->reason) break; - pending_timeout = next; + GNUNET_CONTAINER_DLL_remove (pending_timeout_head, + pending_timeout_tail, + pos); if (pending_timeout_last == pos) pending_timeout_last = NULL; queue_ready_task (pos); - pos = next; } - pos = pending; + pos = pending_head; while (NULL != pos) { - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Checking readiness of task: %llu / %p\n", - pos->id, pos->callback_cls); next = pos->next; if (GNUNET_YES == is_ready (pos, now, rs, ws)) { - if (NULL == prev) - pending = next; - else - prev->next = next; + GNUNET_CONTAINER_DLL_remove (pending_head, + pending_tail, + pos); queue_ready_task (pos); - pos = next; - continue; } - prev = pos; pos = next; } } @@ -468,43 +471,24 @@ check_ready (const struct GNUNET_NETWORK_FDSet *rs, * cause all tasks to run (as soon as possible, respecting * priorities and prerequisite tasks). Note that tasks * scheduled AFTER this call may still be delayed arbitrarily. + * + * Note that we don't move the tasks into the ready queue yet; + * check_ready() will do that later, possibly adding additional + * readiness-factors */ void GNUNET_SCHEDULER_shutdown () { - struct Task *pos; + struct GNUNET_SCHEDULER_Task *pos; int i; - pos = pending_timeout; - while (NULL != pos) - { + for (pos = pending_timeout_head; NULL != pos; pos = pos->next) pos->reason |= GNUNET_SCHEDULER_REASON_SHUTDOWN; - /* we don't move the task into the ready queue yet; check_ready - * will do that later, possibly adding additional - * readiness-factors */ - pos = pos->next; - } - pos = pending; - while (NULL != pos) - { + for (pos = pending_head; NULL != pos; pos = pos->next) pos->reason |= GNUNET_SCHEDULER_REASON_SHUTDOWN; - /* we don't move the task into the ready queue yet; check_ready - * will do that later, possibly adding additional - * readiness-factors */ - pos = pos->next; - } for (i = 0; i < GNUNET_SCHEDULER_PRIORITY_COUNT; i++) - { - pos = ready[i]; - while (NULL != pos) - { + for (pos = ready_head[i]; NULL != pos; pos = pos->next) pos->reason |= GNUNET_SCHEDULER_REASON_SHUTDOWN; - /* we don't move the task into the ready queue yet; check_ready - * will do that later, possibly adding additional - * readiness-factors */ - pos = pos->next; - } - } } @@ -514,7 +498,7 @@ GNUNET_SCHEDULER_shutdown () * @param t task to destroy */ static void -destroy_task (struct Task *t) +destroy_task (struct GNUNET_SCHEDULER_Task *t) { if (NULL != t->read_set) GNUNET_NETWORK_fdset_destroy (t->read_set); @@ -542,7 +526,7 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws) { enum GNUNET_SCHEDULER_Priority p; - struct Task *pos; + struct GNUNET_SCHEDULER_Task *pos; struct GNUNET_SCHEDULER_TaskContext tc; max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP; @@ -550,17 +534,19 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, { if (0 == ready_count) return; - GNUNET_assert (ready[GNUNET_SCHEDULER_PRIORITY_KEEP] == NULL); + GNUNET_assert (NULL == ready_head[GNUNET_SCHEDULER_PRIORITY_KEEP]); /* yes, p>0 is correct, 0 is "KEEP" which should * always be an empty queue (see assertion)! */ for (p = GNUNET_SCHEDULER_PRIORITY_COUNT - 1; p > 0; p--) { - pos = ready[p]; + pos = ready_head[p]; if (NULL != pos) break; } GNUNET_assert (NULL != pos); /* ready_count wrong? */ - ready[p] = pos->next; + GNUNET_CONTAINER_DLL_remove (ready_head[p], + ready_tail[p], + pos); ready_count--; current_priority = pos->priority; current_lifeness = pos->lifeness; @@ -570,35 +556,35 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, DELAY_THRESHOLD.rel_value_us) { LOG (GNUNET_ERROR_TYPE_DEBUG, - "Task %llu took %s to be scheduled\n", - (unsigned long long) pos->id, + "Task %p took %s to be scheduled\n", + pos, GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (pos->start_time), GNUNET_YES)); } #endif tc.reason = pos->reason; - tc.read_ready = (pos->read_set == NULL) ? rs : pos->read_set; - if ((pos->read_fd != -1) && + tc.read_ready = (NULL == pos->read_set) ? rs : pos->read_set; + if ((-1 != pos->read_fd) && (0 != (pos->reason & GNUNET_SCHEDULER_REASON_READ_READY))) GNUNET_NETWORK_fdset_set_native (rs, pos->read_fd); - tc.write_ready = (pos->write_set == NULL) ? ws : pos->write_set; - if ((pos->write_fd != -1) && + tc.write_ready = (NULL == pos->write_set) ? ws : pos->write_set; + if ((-1 != pos->write_fd) && (0 != (pos->reason & GNUNET_SCHEDULER_REASON_WRITE_READY))) GNUNET_NETWORK_fdset_set_native (ws, pos->write_fd); - if (((tc.reason & GNUNET_SCHEDULER_REASON_WRITE_READY) != 0) && - (pos->write_fd != -1) && + if ((0 != (tc.reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) && + (-1 != pos->write_fd) && (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd))) GNUNET_abort (); // added to ready in previous select loop! LOG (GNUNET_ERROR_TYPE_DEBUG, - "Running task: %llu / %p\n", pos->id, - pos->callback_cls); + "Running task: %p\n", + pos); pos->callback (pos->callback_cls, &tc); #if EXECINFO - int i; + unsigned int i; for (i = 0; i < pos->num_backtrace_strings; i++) LOG (GNUNET_ERROR_TYPE_ERROR, - "Task %llu trace %d: %s\n", + "Task %llu trace %u: %s\n", pos->id, i, pos->backtrace_strings[i]); @@ -607,9 +593,10 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, destroy_task (pos); tasks_run++; } - while ((NULL == pending) || (p >= max_priority_added)); + while ((NULL == pending_head) || (p >= max_priority_added)); } + /** * Pipe used to communicate shutdown via signal. */ @@ -680,17 +667,17 @@ sighandler_shutdown () static int check_lifeness () { - struct Task *t; + struct GNUNET_SCHEDULER_Task *t; if (ready_count > 0) return GNUNET_OK; - for (t = pending; NULL != t; t = t->next) + for (t = pending_head; NULL != t; t = t->next) if (t->lifeness == GNUNET_YES) return GNUNET_OK; - for (t = pending_timeout; NULL != t; t = t->next) + for (t = pending_timeout_head; NULL != t; t = t->next) if (t->lifeness == GNUNET_YES) return GNUNET_OK; - if ((NULL != pending) || (NULL != pending_timeout)) + if ((NULL != pending_head) || (NULL != pending_timeout_head)) { GNUNET_SCHEDULER_shutdown (); return GNUNET_OK; @@ -714,7 +701,8 @@ check_lifeness () * @param task_cls closure of @a task */ void -GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls) +GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task, + void *task_cls) { struct GNUNET_NETWORK_FDSet *rs; struct GNUNET_NETWORK_FDSet *ws; @@ -740,13 +728,17 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls) rs = GNUNET_NETWORK_fdset_create (); ws = GNUNET_NETWORK_fdset_create (); GNUNET_assert (NULL == shutdown_pipe_handle); - shutdown_pipe_handle = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO); + shutdown_pipe_handle = GNUNET_DISK_pipe (GNUNET_NO, + GNUNET_NO, + GNUNET_NO, + GNUNET_NO); GNUNET_assert (NULL != shutdown_pipe_handle); pr = GNUNET_DISK_pipe_handle (shutdown_pipe_handle, GNUNET_DISK_PIPE_END_READ); - GNUNET_assert (pr != NULL); + GNUNET_assert (NULL != pr); my_pid = getpid (); - LOG (GNUNET_ERROR_TYPE_DEBUG, "Registering signal handlers\n"); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Registering signal handlers\n"); shc_int = GNUNET_SIGNAL_handler_install (SIGINT, &sighandler_shutdown); shc_term = GNUNET_SIGNAL_handler_install (SIGTERM, &sighandler_shutdown); #if (SIGTERM != GNUNET_TERM_SIG) @@ -759,7 +751,8 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls) #endif current_priority = GNUNET_SCHEDULER_PRIORITY_DEFAULT; current_lifeness = GNUNET_YES; - GNUNET_SCHEDULER_add_continuation (task, task_cls, + GNUNET_SCHEDULER_add_continuation (task, + task_cls, GNUNET_SCHEDULER_REASON_STARTUP); active_task = (void *) (long) -1; /* force passing of sanity check */ GNUNET_SCHEDULER_add_now_with_lifeness (GNUNET_NO, @@ -860,7 +853,7 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls) enum GNUNET_SCHEDULER_Reason GNUNET_SCHEDULER_get_reason () { - GNUNET_assert (active_task != NULL); + GNUNET_assert (NULL != active_task); return active_task->reason; } @@ -877,21 +870,17 @@ GNUNET_SCHEDULER_get_reason () unsigned int GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p) { - struct Task *pos; + struct GNUNET_SCHEDULER_Task *pos; unsigned int ret; - GNUNET_assert (active_task != NULL); + GNUNET_assert (NULL != active_task); if (p == GNUNET_SCHEDULER_PRIORITY_COUNT) return ready_count; if (p == GNUNET_SCHEDULER_PRIORITY_KEEP) p = current_priority; ret = 0; - pos = ready[check_priority (p)]; - while (NULL != pos) - { - pos = pos->next; + for (pos = ready_head[check_priority (p)]; NULL != pos; pos = pos->next) ret++; - } return ret; } @@ -904,92 +893,45 @@ GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p) * @return original closure of the task */ void * -GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_TaskIdentifier task) +GNUNET_SCHEDULER_cancel (struct GNUNET_SCHEDULER_Task *task) { - struct Task *t; - struct Task *prev; enum GNUNET_SCHEDULER_Priority p; - int to; void *ret; GNUNET_assert (NULL != active_task); - to = 0; - prev = NULL; - t = pending; - while (NULL != t) - { - if (t->id == task) - break; - prev = t; - t = t->next; - } - if (NULL == t) - { - prev = NULL; - to = 1; - t = pending_timeout; - while (t != NULL) - { - if (t->id == task) - break; - prev = t; - t = t->next; - } - if (pending_timeout_last == t) - pending_timeout_last = NULL; - } - p = 0; - while (NULL == t) - { - p++; - if (p >= GNUNET_SCHEDULER_PRIORITY_COUNT) - { - LOG (GNUNET_ERROR_TYPE_ERROR, - _("Attempt to cancel dead task %llu!\n"), - (unsigned long long) task); - GNUNET_assert (0); - } - prev = NULL; - t = ready[p]; - while (NULL != t) - { - if (t->id == task) - { - ready_count--; - break; - } - prev = t; - t = t->next; - } - } - if (NULL == prev) + if (GNUNET_SCHEDULER_REASON_NONE == task->reason) { - if (0 == p) + if ( (-1 == task->read_fd) && + (-1 == task->write_fd) && + (NULL == task->read_set) && + (NULL == task->write_set) ) { - if (0 == to) - { - pending = t->next; - } - else - { - pending_timeout = t->next; - } + GNUNET_CONTAINER_DLL_remove (pending_timeout_head, + pending_timeout_tail, + task); + if (task == pending_timeout_last) + pending_timeout_last = NULL; } else { - ready[p] = t->next; + GNUNET_CONTAINER_DLL_remove (pending_head, + pending_tail, + task); } } else { - prev->next = t->next; + p = check_priority (task->priority); + GNUNET_CONTAINER_DLL_remove (ready_head[p], + ready_tail[p], + task); + ready_count--; } - ret = t->callback_cls; + ret = task->callback_cls; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Canceling task: %llu / %p\n", - task, - t->callback_cls); - destroy_task (t); + "Canceling task %p\n", + task); + destroy_task (task); return ret; } @@ -1005,11 +947,12 @@ GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_TaskIdentifier task) * @param priority priority to use for the task */ void -GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_Task task, void *task_cls, +GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_TaskCallback task, + void *task_cls, enum GNUNET_SCHEDULER_Reason reason, enum GNUNET_SCHEDULER_Priority priority) { - struct Task *t; + struct GNUNET_SCHEDULER_Task *t; #if EXECINFO void *backtrace_array[50]; @@ -1018,7 +961,7 @@ GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_Task task, voi GNUNET_assert (NULL != task); GNUNET_assert ((NULL != active_task) || (GNUNET_SCHEDULER_REASON_STARTUP == reason)); - t = GNUNET_new (struct Task); + t = GNUNET_new (struct GNUNET_SCHEDULER_Task); #if EXECINFO t->num_backtrace_strings = backtrace (backtrace_array, 50); t->backtrace_strings = @@ -1028,7 +971,6 @@ GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_Task task, voi t->write_fd = -1; t->callback = task; t->callback_cls = task_cls; - t->id = ++last_id; #if PROFILE_DELAYS t->start_time = GNUNET_TIME_absolute_get (); #endif @@ -1036,9 +978,8 @@ GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_Task task, voi t->priority = priority; t->lifeness = current_lifeness; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Adding continuation task: %llu / %p\n", - t->id, - t->callback_cls); + "Adding continuation task %p\n", + t); queue_ready_task (t); } @@ -1053,7 +994,7 @@ GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_Task task, voi * @param reason reason for task invocation */ void -GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_Task task, void *task_cls, +GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_TaskCallback task, void *task_cls, enum GNUNET_SCHEDULER_Reason reason) { GNUNET_SCHEDULER_add_continuation_with_priority (task, task_cls, @@ -1063,26 +1004,6 @@ GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_Task task, void *task_cls, /** - * Schedule a new task to be run with a specified priority. - * - * @param prio how important is the new task? - * @param task main function of the task - * @param task_cls closure of @a task - * @return unique task identifier for the job - * only valid until @a task is started! - */ -GNUNET_SCHEDULER_TaskIdentifier -GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, - GNUNET_SCHEDULER_Task task, void *task_cls) -{ - return GNUNET_SCHEDULER_add_select (prio, - GNUNET_TIME_UNIT_ZERO, NULL, NULL, task, - task_cls); -} - - - -/** * Schedule a new task to be run with a specified delay. The task * will be scheduled for execution once the delay has expired. * @@ -1094,14 +1015,15 @@ GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, - GNUNET_SCHEDULER_Task task, void *task_cls) + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls) { - struct Task *t; - struct Task *pos; - struct Task *prev; + struct GNUNET_SCHEDULER_Task *t; + struct GNUNET_SCHEDULER_Task *pos; + struct GNUNET_SCHEDULER_Task *prev; #if EXECINFO void *backtrace_array[MAX_TRACE_DEPTH]; @@ -1109,7 +1031,7 @@ GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, GNUNET_assert (NULL != active_task); GNUNET_assert (NULL != task); - t = GNUNET_new (struct Task); + t = GNUNET_new (struct GNUNET_SCHEDULER_Task); t->callback = task; t->callback_cls = task_cls; #if EXECINFO @@ -1119,7 +1041,6 @@ GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, #endif t->read_fd = -1; t->write_fd = -1; - t->id = ++last_id; #if PROFILE_DELAYS t->start_time = GNUNET_TIME_absolute_get (); #endif @@ -1128,44 +1049,74 @@ GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, t->lifeness = current_lifeness; /* try tail first (optimization in case we are * appending to a long list of tasks with timeouts) */ - prev = pending_timeout_last; - if (prev != NULL) + if (0 == delay.rel_value_us) { - if (prev->timeout.abs_value_us > t->timeout.abs_value_us) - prev = NULL; - else - pos = prev->next; /* heuristic success! */ - } - if (prev == NULL) - { - /* heuristic failed, do traversal of timeout list */ - pos = pending_timeout; + GNUNET_CONTAINER_DLL_insert (pending_timeout_head, + pending_timeout_tail, + t); } - while ((pos != NULL) && - ((pos->timeout.abs_value_us <= t->timeout.abs_value_us) || - (0 != pos->reason))) + else { - prev = pos; - pos = pos->next; + /* first move from heuristic start backwards to before start time */ + prev = pending_timeout_last; + while ( (NULL != prev) && + (prev->timeout.abs_value_us > t->timeout.abs_value_us) ) + prev = prev->prev; + /* now, move from heuristic start (or head of list) forward to insertion point */ + if (NULL == prev) + pos = pending_timeout_head; + else + pos = prev->next; + while ( (NULL != pos) && + ( (pos->timeout.abs_value_us <= t->timeout.abs_value_us) || + (0 != pos->reason) ) ) + { + prev = pos; + pos = pos->next; + } + GNUNET_CONTAINER_DLL_insert_after (pending_timeout_head, + pending_timeout_tail, + prev, + t); + /* finally, update heuristic insertion point to last insertion... */ + pending_timeout_last = t; } - if (prev == NULL) - pending_timeout = t; - else - prev->next = t; - t->next = pos; - /* hyper-optimization... */ - pending_timeout_last = t; - LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding task: %llu / %p\n", t->id, - t->callback_cls); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Adding task: %p\n", + t); #if EXECINFO - int i; + unsigned int i; for (i = 0; i < t->num_backtrace_strings; i++) - LOG (GNUNET_ERROR_TYPE_DEBUG, "Task %llu trace %d: %s\n", t->id, i, + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Task %p trace %d: %s\n", + t, + i, t->backtrace_strings[i]); #endif - return t->id; + return t; +} + + +/** + * Schedule a new task to be run with a specified priority. + * + * @param prio how important is the new task? + * @param task main function of the task + * @param task_cls closure of @a task + * @return unique task identifier for the job + * only valid until @a task is started! + */ +struct GNUNET_SCHEDULER_Task * +GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls) +{ + return GNUNET_SCHEDULER_add_delayed_with_priority (GNUNET_TIME_UNIT_ZERO, + prio, + task, + task_cls); } @@ -1181,9 +1132,9 @@ GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until "task" is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, - GNUNET_SCHEDULER_Task task, void *task_cls) + GNUNET_SCHEDULER_TaskCallback task, void *task_cls) { return GNUNET_SCHEDULER_add_delayed_with_priority (delay, GNUNET_SCHEDULER_PRIORITY_DEFAULT, @@ -1206,8 +1157,8 @@ GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until "task" is started! */ -GNUNET_SCHEDULER_TaskIdentifier -GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task task, void *task_cls) +struct GNUNET_SCHEDULER_Task * +GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_TaskCallback task, void *task_cls) { return GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_ZERO, task, task_cls); } @@ -1227,19 +1178,15 @@ GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task task, void *task_cls) * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, - GNUNET_SCHEDULER_Task task, + GNUNET_SCHEDULER_TaskCallback task, void *task_cls) { - GNUNET_SCHEDULER_TaskIdentifier ret; - - ret = - GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, - GNUNET_TIME_UNIT_ZERO, NULL, NULL, task, - task_cls); - GNUNET_assert (pending->id == ret); - pending->lifeness = lifeness; + struct GNUNET_SCHEDULER_Task *ret; + + ret = GNUNET_SCHEDULER_add_now (task, task_cls); + ret->lifeness = lifeness; return ret; } @@ -1269,16 +1216,18 @@ GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, * @param task main function of the task * @param task_cls closure of @a task * @return unique task identifier for the job - * only valid until "task" is started! + * only valid until @a task is started! */ #ifndef MINGW -static GNUNET_SCHEDULER_TaskIdentifier +static struct GNUNET_SCHEDULER_Task * add_without_sets (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, - int rfd, int wfd, - GNUNET_SCHEDULER_Task task, void *task_cls) + int rfd, + int wfd, + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls) { - struct Task *t; + struct GNUNET_SCHEDULER_Task *t; #if EXECINFO void *backtrace_array[MAX_TRACE_DEPTH]; @@ -1286,7 +1235,7 @@ add_without_sets (struct GNUNET_TIME_Relative delay, GNUNET_assert (NULL != active_task); GNUNET_assert (NULL != task); - t = GNUNET_new (struct Task); + t = GNUNET_new (struct GNUNET_SCHEDULER_Task); t->callback = task; t->callback_cls = task_cls; #if EXECINFO @@ -1339,36 +1288,35 @@ add_without_sets (struct GNUNET_TIME_Relative delay, t->read_fd = rfd; GNUNET_assert (wfd >= -1); t->write_fd = wfd; - t->id = ++last_id; #if PROFILE_DELAYS t->start_time = GNUNET_TIME_absolute_get (); #endif t->timeout = GNUNET_TIME_relative_to_absolute (delay); t->priority = check_priority ((priority == GNUNET_SCHEDULER_PRIORITY_KEEP) ? current_priority : priority); t->lifeness = current_lifeness; - t->next = pending; - pending = t; - max_priority_added = GNUNET_MAX (max_priority_added, t->priority); + GNUNET_CONTAINER_DLL_insert (pending_head, + pending_tail, + t); + max_priority_added = GNUNET_MAX (max_priority_added, + t->priority); LOG (GNUNET_ERROR_TYPE_DEBUG, - "Adding task: %llu / %p\n", - t->id, - t->callback_cls); + "Adding task %p\n", + t); #if EXECINFO - int i; + unsigned int i; for (i = 0; i < t->num_backtrace_strings; i++) LOG (GNUNET_ERROR_TYPE_DEBUG, - "Task %llu trace %d: %s\n", - t->id, + "Task %p trace %d: %s\n", + t, i, t->backtrace_strings[i]); #endif - return t->id; + return t; } #endif - /** * Schedule a new task to be run with a specified delay or when the * specified file descriptor is ready for reading. The delay can be @@ -1384,10 +1332,11 @@ add_without_sets (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, struct GNUNET_NETWORK_Handle *rfd, - GNUNET_SCHEDULER_Task task, void *task_cls) + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls) { return GNUNET_SCHEDULER_add_read_net_with_priority (delay, GNUNET_SCHEDULER_PRIORITY_DEFAULT, @@ -1412,16 +1361,18 @@ GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_read_net_with_priority (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, struct GNUNET_NETWORK_Handle *rfd, - GNUNET_SCHEDULER_Task task, void *task_cls) + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls) { - return GNUNET_SCHEDULER_add_net_with_priority ( - delay, priority, - rfd, GNUNET_YES, GNUNET_NO, - task, task_cls); + return GNUNET_SCHEDULER_add_net_with_priority (delay, priority, + rfd, + GNUNET_YES, + GNUNET_NO, + task, task_cls); } @@ -1441,15 +1392,17 @@ GNUNET_SCHEDULER_add_read_net_with_priority (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, struct GNUNET_NETWORK_Handle *wfd, - GNUNET_SCHEDULER_Task task, void *task_cls) + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls) { - return GNUNET_SCHEDULER_add_net_with_priority ( - delay, GNUNET_SCHEDULER_PRIORITY_DEFAULT, - wfd, GNUNET_NO, GNUNET_YES, - task, task_cls); + return GNUNET_SCHEDULER_add_net_with_priority (delay, + GNUNET_SCHEDULER_PRIORITY_DEFAULT, + wfd, + GNUNET_NO, GNUNET_YES, + task, task_cls); } /** @@ -1460,7 +1413,7 @@ GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, * socket operation is ready. * * @param delay when should this operation time out? Use - * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" + * #GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" * @param priority priority of the task * @param fd file-descriptor * @param on_read whether to poll the file-descriptor for readability @@ -1470,18 +1423,20 @@ GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until "task" is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_net_with_priority (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, struct GNUNET_NETWORK_Handle *fd, - int on_read, int on_write, - GNUNET_SCHEDULER_Task task, void *task_cls) + int on_read, + int on_write, + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls) { #if MINGW struct GNUNET_NETWORK_FDSet *s; - GNUNET_SCHEDULER_TaskIdentifier ret; + struct GNUNET_SCHEDULER_Task * ret; - GNUNET_assert (fd != NULL); + GNUNET_assert (NULL != fd); s = GNUNET_NETWORK_fdset_create (); GNUNET_NETWORK_fdset_set (s, fd); ret = GNUNET_SCHEDULER_add_select ( @@ -1493,11 +1448,10 @@ GNUNET_SCHEDULER_add_net_with_priority (struct GNUNET_TIME_Relative delay, return ret; #else GNUNET_assert (GNUNET_NETWORK_get_fd (fd) >= 0); - return add_without_sets ( - delay, priority, - on_read ? GNUNET_NETWORK_get_fd (fd) : -1, - on_write ? GNUNET_NETWORK_get_fd (fd) : -1, - task, task_cls); + return add_without_sets (delay, priority, + on_read ? GNUNET_NETWORK_get_fd (fd) : -1, + on_write ? GNUNET_NETWORK_get_fd (fd) : -1, + task, task_cls); #endif } @@ -1517,10 +1471,10 @@ GNUNET_SCHEDULER_add_net_with_priority (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, const struct GNUNET_DISK_FileHandle *rfd, - GNUNET_SCHEDULER_Task task, void *task_cls) + GNUNET_SCHEDULER_TaskCallback task, void *task_cls) { return GNUNET_SCHEDULER_add_file_with_priority ( delay, GNUNET_SCHEDULER_PRIORITY_DEFAULT, @@ -1544,10 +1498,10 @@ GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, const struct GNUNET_DISK_FileHandle *wfd, - GNUNET_SCHEDULER_Task task, void *task_cls) + GNUNET_SCHEDULER_TaskCallback task, void *task_cls) { return GNUNET_SCHEDULER_add_file_with_priority ( delay, GNUNET_SCHEDULER_PRIORITY_DEFAULT, @@ -1574,18 +1528,18 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_file_with_priority (struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, const struct GNUNET_DISK_FileHandle *fd, int on_read, int on_write, - GNUNET_SCHEDULER_Task task, void *task_cls) + GNUNET_SCHEDULER_TaskCallback task, void *task_cls) { #if MINGW struct GNUNET_NETWORK_FDSet *s; - GNUNET_SCHEDULER_TaskIdentifier ret; + struct GNUNET_SCHEDULER_Task * ret; - GNUNET_assert (fd != NULL); + GNUNET_assert (NULL != fd); s = GNUNET_NETWORK_fdset_create (); GNUNET_NETWORK_fdset_handle_set (s, fd); ret = GNUNET_SCHEDULER_add_select ( @@ -1636,21 +1590,28 @@ GNUNET_SCHEDULER_add_file_with_priority (struct GNUNET_TIME_Relative delay, * @return unique task identifier for the job * only valid until @a task is started! */ -GNUNET_SCHEDULER_TaskIdentifier +struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, struct GNUNET_TIME_Relative delay, const struct GNUNET_NETWORK_FDSet *rs, const struct GNUNET_NETWORK_FDSet *ws, - GNUNET_SCHEDULER_Task task, void *task_cls) + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls) { - struct Task *t; + struct GNUNET_SCHEDULER_Task *t; #if EXECINFO void *backtrace_array[MAX_TRACE_DEPTH]; #endif + if ( (NULL == rs) && + (NULL == ws) ) + return GNUNET_SCHEDULER_add_delayed_with_priority (delay, + prio, + task, + task_cls); GNUNET_assert (NULL != active_task); GNUNET_assert (NULL != task); - t = GNUNET_new (struct Task); + t = GNUNET_new (struct GNUNET_SCHEDULER_Task); t->callback = task; t->callback_cls = task_cls; #if EXECINFO @@ -1670,7 +1631,6 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, t->write_set = GNUNET_NETWORK_fdset_create (); GNUNET_NETWORK_fdset_copy (t->write_set, ws); } - t->id = ++last_id; #if PROFILE_DELAYS t->start_time = GNUNET_TIME_absolute_get (); #endif @@ -1680,23 +1640,24 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, GNUNET_SCHEDULER_PRIORITY_KEEP) ? current_priority : prio); t->lifeness = current_lifeness; - t->next = pending; - pending = t; + GNUNET_CONTAINER_DLL_insert (pending_head, + pending_tail, + t); max_priority_added = GNUNET_MAX (max_priority_added, t->priority); LOG (GNUNET_ERROR_TYPE_DEBUG, - "Adding task: %llu / %p\n", - t->id, - t->callback_cls); + "Adding task %p\n", + t); #if EXECINFO int i; for (i = 0; i < t->num_backtrace_strings; i++) LOG (GNUNET_ERROR_TYPE_DEBUG, - "Task %llu trace %d: %s\n", - t->id, i, + "Task p trace %d: %s\n", + t, + i, t->backtrace_strings[i]); #endif - return t->id; + return t; } /* end of scheduler.c */ diff --git a/src/util/server.c b/src/util/server.c index b2b590dbdb..52f00a08c8 100644 --- a/src/util/server.c +++ b/src/util/server.c @@ -144,7 +144,7 @@ struct GNUNET_SERVER_Handle /** * Task scheduled to do the listening. */ - GNUNET_SCHEDULER_TaskIdentifier listen_task; + struct GNUNET_SCHEDULER_Task * listen_task; /** * Alternative function to create a MST instance. @@ -246,12 +246,12 @@ struct GNUNET_SERVER_Client /** * ID of task used to restart processing. */ - GNUNET_SCHEDULER_TaskIdentifier restart_task; + struct GNUNET_SCHEDULER_Task * restart_task; /** * Task that warns about missing calls to #GNUNET_SERVER_receive_done. */ - GNUNET_SCHEDULER_TaskIdentifier warn_task; + struct GNUNET_SCHEDULER_Task * warn_task; /** * Time when the warn task was started. @@ -400,7 +400,7 @@ process_listen_socket (void *cls, struct GNUNET_SERVER_Client *client; unsigned int i; - server->listen_task = GNUNET_SCHEDULER_NO_TASK; + server->listen_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { /* ignore shutdown, someone else will take care of it! */ @@ -691,10 +691,10 @@ test_monitor_clients (struct GNUNET_SERVER_Handle *server) void GNUNET_SERVER_suspend (struct GNUNET_SERVER_Handle *server) { - if (GNUNET_SCHEDULER_NO_TASK != server->listen_task) + if (NULL != server->listen_task) { GNUNET_SCHEDULER_cancel (server->listen_task); - server->listen_task = GNUNET_SCHEDULER_NO_TASK; + server->listen_task = NULL; } } @@ -750,10 +750,10 @@ GNUNET_SERVER_stop_listening (struct GNUNET_SERVER_Handle *server) LOG (GNUNET_ERROR_TYPE_DEBUG, "Server in soft shutdown\n"); - if (GNUNET_SCHEDULER_NO_TASK != server->listen_task) + if (NULL != server->listen_task) { GNUNET_SCHEDULER_cancel (server->listen_task); - server->listen_task = GNUNET_SCHEDULER_NO_TASK; + server->listen_task = NULL; } if (NULL != server->listen_sockets) { @@ -784,10 +784,10 @@ GNUNET_SERVER_destroy (struct GNUNET_SERVER_Handle *server) LOG (GNUNET_ERROR_TYPE_DEBUG, "Server shutting down.\n"); - if (GNUNET_SCHEDULER_NO_TASK != server->listen_task) + if (NULL != server->listen_task) { GNUNET_SCHEDULER_cancel (server->listen_task); - server->listen_task = GNUNET_SCHEDULER_NO_TASK; + server->listen_task = NULL; } if (NULL != server->listen_sockets) { @@ -909,10 +909,10 @@ warn_no_receive_done (void *cls, void GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client *client) { - if (GNUNET_SCHEDULER_NO_TASK != client->warn_task) + if (NULL != client->warn_task) { GNUNET_SCHEDULER_cancel (client->warn_task); - client->warn_task = GNUNET_SCHEDULER_NO_TASK; + client->warn_task = NULL; } } @@ -975,7 +975,7 @@ GNUNET_SERVER_inject (struct GNUNET_SERVER_Handle *server, if (NULL != sender) { if ( (0 == sender->suspended) && - (GNUNET_SCHEDULER_NO_TASK == sender->warn_task) ) + (NULL == sender->warn_task) ) { GNUNET_break (0 != type); /* type should never be 0 here, as we don't use 0 */ sender->warn_start = GNUNET_TIME_absolute_get (); @@ -1169,7 +1169,7 @@ restart_processing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_SERVER_Client *client = cls; GNUNET_assert (GNUNET_YES != client->shutdown_now); - client->restart_task = GNUNET_SCHEDULER_NO_TASK; + client->restart_task = NULL; if (GNUNET_NO == client->receive_pending) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Server begins to read again from client.\n"); @@ -1479,15 +1479,15 @@ GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client) LOG (GNUNET_ERROR_TYPE_DEBUG, "Client is being disconnected from the server.\n"); - if (GNUNET_SCHEDULER_NO_TASK != client->restart_task) + if (NULL != client->restart_task) { GNUNET_SCHEDULER_cancel (client->restart_task); - client->restart_task = GNUNET_SCHEDULER_NO_TASK; + client->restart_task = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != client->warn_task) + if (NULL != client->warn_task) { GNUNET_SCHEDULER_cancel (client->warn_task); - client->warn_task = GNUNET_SCHEDULER_NO_TASK; + client->warn_task = NULL; } if (GNUNET_YES == client->receive_pending) { @@ -1532,10 +1532,10 @@ GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client) client->connection); /* need to cancel again, as it might have been re-added in the meantime (i.e. during callbacks) */ - if (GNUNET_SCHEDULER_NO_TASK != client->warn_task) + if (NULL != client->warn_task) { GNUNET_SCHEDULER_cancel (client->warn_task); - client->warn_task = GNUNET_SCHEDULER_NO_TASK; + client->warn_task = NULL; } if (GNUNET_YES == client->receive_pending) { @@ -1684,10 +1684,10 @@ GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, "GNUNET_SERVER_receive_done called, but more clients pending\n"); return; } - if (GNUNET_SCHEDULER_NO_TASK != client->warn_task) + if (NULL != client->warn_task) { GNUNET_SCHEDULER_cancel (client->warn_task); - client->warn_task = GNUNET_SCHEDULER_NO_TASK; + client->warn_task = NULL; } if (GNUNET_YES == client->in_process_client_buffer) { @@ -1702,7 +1702,7 @@ GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, } LOG (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_SERVER_receive_done causes restart in reading from the socket\n"); - GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == client->restart_task); + GNUNET_assert (NULL == client->restart_task); client->restart_task = GNUNET_SCHEDULER_add_now (&restart_processing, client); } diff --git a/src/util/service.c b/src/util/service.c index 5be6bc33f4..d49ad4f2af 100644 --- a/src/util/service.c +++ b/src/util/service.c @@ -187,7 +187,7 @@ struct GNUNET_SERVICE_Context /** * Task ID of the shutdown task. */ - GNUNET_SCHEDULER_TaskIdentifier shutdown_task; + struct GNUNET_SCHEDULER_Task * shutdown_task; /** * Idle timeout for server. @@ -1134,7 +1134,7 @@ shutdown_task (void *cls, struct GNUNET_SERVICE_Context *service = cls; struct GNUNET_SERVER_Handle *server = service->server; - service->shutdown_task = GNUNET_SCHEDULER_NO_TASK; + service->shutdown_task = NULL; if (0 != (service->options & GNUNET_SERVICE_OPTION_SOFT_SHUTDOWN)) GNUNET_SERVER_stop_listening (server); else @@ -1675,10 +1675,10 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Context *sctx) } } #endif - if (GNUNET_SCHEDULER_NO_TASK != sctx->shutdown_task) + if (NULL != sctx->shutdown_task) { GNUNET_SCHEDULER_cancel (sctx->shutdown_task); - sctx->shutdown_task = GNUNET_SCHEDULER_NO_TASK; + sctx->shutdown_task = NULL; } if (NULL != sctx->server) GNUNET_SERVER_destroy (sctx->server); diff --git a/src/util/speedup.c b/src/util/speedup.c index d71e7c158d..544958be97 100644 --- a/src/util/speedup.c +++ b/src/util/speedup.c @@ -34,7 +34,7 @@ static struct GNUNET_TIME_Relative interval; static struct GNUNET_TIME_Relative delta; -static GNUNET_SCHEDULER_TaskIdentifier speedup_task; +static struct GNUNET_SCHEDULER_Task * speedup_task; static void @@ -43,7 +43,7 @@ do_speedup (void *cls, { static long long current_offset; - speedup_task = GNUNET_SCHEDULER_NO_TASK; + speedup_task = NULL; if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; current_offset += delta.rel_value_us; @@ -97,10 +97,10 @@ GNUNET_SPEEDUP_start_ (const struct GNUNET_CONFIGURATION_Handle *cfg) void GNUNET_SPEEDUP_stop_ () { - if (GNUNET_SCHEDULER_NO_TASK != speedup_task) + if (NULL != speedup_task) { GNUNET_SCHEDULER_cancel (speedup_task); - speedup_task = GNUNET_SCHEDULER_NO_TASK; + speedup_task = NULL; } if ( (0 != interval.rel_value_us) && (0 != delta.rel_value_us) ) diff --git a/src/util/test_common_logging_runtime_loglevels.c b/src/util/test_common_logging_runtime_loglevels.c index 0fe8614d05..42371f33f5 100644 --- a/src/util/test_common_logging_runtime_loglevels.c +++ b/src/util/test_common_logging_runtime_loglevels.c @@ -49,9 +49,9 @@ static struct GNUNET_OS_Process *proc; /* Pipe to read from started processes stdout (on read end) */ static struct GNUNET_DISK_PipeHandle *pipe_stdout; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; -static GNUNET_SCHEDULER_TaskIdentifier read_task; +static struct GNUNET_SCHEDULER_Task * read_task; static void runone (void); @@ -72,10 +72,10 @@ end_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_OS_process_destroy (proc); proc = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != read_task) + if (NULL != read_task) { GNUNET_SCHEDULER_cancel (read_task); - read_task = GNUNET_SCHEDULER_NO_TASK; + read_task = NULL; } GNUNET_DISK_pipe_close (pipe_stdout); if (ok == 1) @@ -223,7 +223,7 @@ read_call (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) long delays[8]; int rd; - read_task = GNUNET_SCHEDULER_NO_TASK; + read_task = NULL; rd = GNUNET_DISK_file_read (stdout_read_handle, buf_ptr, sizeof (buf) - bytes); if (rd > 0) diff --git a/src/util/test_os_start_process.c b/src/util/test_os_start_process.c index e76ec5bcfb..e350c7ea75 100644 --- a/src/util/test_os_start_process.c +++ b/src/util/test_os_start_process.c @@ -46,7 +46,7 @@ static struct GNUNET_DISK_PipeHandle *hello_pipe_stdin; */ static struct GNUNET_DISK_PipeHandle *hello_pipe_stdout; -static GNUNET_SCHEDULER_TaskIdentifier die_task; +static struct GNUNET_SCHEDULER_Task * die_task; struct read_context { diff --git a/src/vpn/vpn_api.c b/src/vpn/vpn_api.c index 95ef8c46da..b0d2bccf08 100644 --- a/src/vpn/vpn_api.c +++ b/src/vpn/vpn_api.c @@ -61,7 +61,7 @@ struct GNUNET_VPN_Handle /** * Identifier of a reconnect task. */ - GNUNET_SCHEDULER_TaskIdentifier rt; + struct GNUNET_SCHEDULER_Task * rt; /** * How long do we wait until we try to reconnect? @@ -367,7 +367,7 @@ connect_task (void *cls, { struct GNUNET_VPN_Handle *vh = cls; - vh->rt = GNUNET_SCHEDULER_NO_TASK; + vh->rt = NULL; vh->client = GNUNET_CLIENT_connect ("vpn", vh->cfg); GNUNET_assert (NULL != vh->client); GNUNET_assert (NULL == vh->th); @@ -578,10 +578,10 @@ GNUNET_VPN_disconnect (struct GNUNET_VPN_Handle *vh) GNUNET_CLIENT_disconnect (vh->client); vh->client = NULL; } - if (GNUNET_SCHEDULER_NO_TASK != vh->rt) + if (NULL != vh->rt) { GNUNET_SCHEDULER_cancel (vh->rt); - vh->rt = GNUNET_SCHEDULER_NO_TASK; + vh->rt = NULL; } GNUNET_free (vh); } |