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 /src/testbed | |
parent | 53cd5b8eda2fa8db86b0907a62a39598981d008a (diff) |
making GNUNET_SCHEDULER_cancel() perform in O(1) instead of O(n) to help or even fully address #3247
Diffstat (limited to 'src/testbed')
35 files changed, 248 insertions, 248 deletions
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; |