aboutsummaryrefslogtreecommitdiff
path: root/src/cadet
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-12-24 01:10:47 +0000
committerChristian Grothoff <christian@grothoff.org>2014-12-24 01:10:47 +0000
commitf1f603c7d0b3f03dca46a4f313472288eb080eb1 (patch)
tree3a29966b02dfb83e0a8a8d5c42b3116380209fb0 /src/cadet
parent53cd5b8eda2fa8db86b0907a62a39598981d008a (diff)
downloadgnunet-f1f603c7d0b3f03dca46a4f313472288eb080eb1.tar.gz
gnunet-f1f603c7d0b3f03dca46a4f313472288eb080eb1.zip
making GNUNET_SCHEDULER_cancel() perform in O(1) instead of O(n) to help or even fully address #3247
Diffstat (limited to 'src/cadet')
-rw-r--r--src/cadet/cadet_api.c22
-rw-r--r--src/cadet/cadet_path.c8
-rw-r--r--src/cadet/cadet_path.h2
-rw-r--r--src/cadet/gnunet-cadet-profiler.c30
-rw-r--r--src/cadet/gnunet-cadet.c4
-rw-r--r--src/cadet/gnunet-service-cadet_channel.c26
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c52
-rw-r--r--src/cadet/gnunet-service-cadet_dht.c8
-rw-r--r--src/cadet/gnunet-service-cadet_tunnel.c70
-rw-r--r--src/cadet/test_cadet.c28
-rw-r--r--src/cadet/test_cadet_local.c14
-rw-r--r--src/cadet/test_cadet_single.c14
12 files changed, 139 insertions, 139 deletions
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index ddd1755cc..43fe3535f 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -78,7 +78,7 @@ struct GNUNET_CADET_TransmitHandle
78 /** 78 /**
79 * Task triggering a timeout, can be NO_TASK if the timeout is FOREVER. 79 * Task triggering a timeout, can be NO_TASK if the timeout is FOREVER.
80 */ 80 */
81 GNUNET_SCHEDULER_TaskIdentifier timeout_task; 81 struct GNUNET_SCHEDULER_Task * timeout_task;
82 82
83 /** 83 /**
84 * Size of 'data' -- or the desired size of 'notify' if 'data' is NULL. 84 * Size of 'data' -- or the desired size of 'notify' if 'data' is NULL.
@@ -210,7 +210,7 @@ struct GNUNET_CADET_Handle
210 /** 210 /**
211 * Task for trying to reconnect. 211 * Task for trying to reconnect.
212 */ 212 */
213 GNUNET_SCHEDULER_TaskIdentifier reconnect_task; 213 struct GNUNET_SCHEDULER_Task * reconnect_task;
214 214
215 /** 215 /**
216 * Callback for an info task (only one active at a time). 216 * 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)
496 GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th); 496 GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th);
497 497
498 /* clean up request */ 498 /* clean up request */
499 if (GNUNET_SCHEDULER_NO_TASK != th->timeout_task) 499 if (NULL != th->timeout_task)
500 GNUNET_SCHEDULER_cancel (th->timeout_task); 500 GNUNET_SCHEDULER_cancel (th->timeout_task);
501 GNUNET_free (th); 501 GNUNET_free (th);
502 } 502 }
@@ -528,7 +528,7 @@ timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
528 struct GNUNET_CADET_TransmitHandle *th = cls; 528 struct GNUNET_CADET_TransmitHandle *th = cls;
529 struct GNUNET_CADET_Handle *cadet = th->channel->cadet; 529 struct GNUNET_CADET_Handle *cadet = th->channel->cadet;
530 530
531 th->timeout_task = GNUNET_SCHEDULER_NO_TASK; 531 th->timeout_task = NULL;
532 th->channel->packet_size = 0; 532 th->channel->packet_size = 0;
533 GNUNET_CONTAINER_DLL_remove (cadet->th_head, cadet->th_tail, th); 533 GNUNET_CONTAINER_DLL_remove (cadet->th_head, cadet->th_tail, th);
534 if (GNUNET_YES == th_is_payload (th)) 534 if (GNUNET_YES == th_is_payload (th))
@@ -711,7 +711,7 @@ reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
711{ 711{
712 struct GNUNET_CADET_Handle *h = cls; 712 struct GNUNET_CADET_Handle *h = cls;
713 713
714 h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 714 h->reconnect_task = NULL;
715 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 715 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
716 return; 716 return;
717 do_reconnect (h); 717 do_reconnect (h);
@@ -740,7 +740,7 @@ reconnect (struct GNUNET_CADET_Handle *h)
740 next = ch->next; 740 next = ch->next;
741 destroy_channel (ch, GNUNET_YES); 741 destroy_channel (ch, GNUNET_YES);
742 } 742 }
743 if (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task) 743 if (NULL == h->reconnect_task)
744 h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_time, 744 h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_time,
745 &reconnect_cbk, h); 745 &reconnect_cbk, h);
746} 746}
@@ -1382,7 +1382,7 @@ send_callback (void *cls, size_t size, void *buf)
1382 psize = th->size; 1382 psize = th->size;
1383 } 1383 }
1384 GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= psize); 1384 GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= psize);
1385 if (th->timeout_task != GNUNET_SCHEDULER_NO_TASK) 1385 if (th->timeout_task != NULL)
1386 GNUNET_SCHEDULER_cancel (th->timeout_task); 1386 GNUNET_SCHEDULER_cancel (th->timeout_task);
1387 GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th); 1387 GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th);
1388 GNUNET_free (th); 1388 GNUNET_free (th);
@@ -1487,7 +1487,7 @@ GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls,
1487 h->ports = ports; 1487 h->ports = ports;
1488 h->next_chid = GNUNET_CADET_LOCAL_CHANNEL_ID_CLI; 1488 h->next_chid = GNUNET_CADET_LOCAL_CHANNEL_ID_CLI;
1489 h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS; 1489 h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS;
1490 h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 1490 h->reconnect_task = NULL;
1491 1491
1492 if (NULL != ports && ports[0] != 0 && NULL == new_channel) 1492 if (NULL != ports && ports[0] != 0 && NULL == new_channel)
1493 { 1493 {
@@ -1576,10 +1576,10 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle)
1576 GNUNET_CLIENT_disconnect (handle->client); 1576 GNUNET_CLIENT_disconnect (handle->client);
1577 handle->client = NULL; 1577 handle->client = NULL;
1578 } 1578 }
1579 if (GNUNET_SCHEDULER_NO_TASK != handle->reconnect_task) 1579 if (NULL != handle->reconnect_task)
1580 { 1580 {
1581 GNUNET_SCHEDULER_cancel(handle->reconnect_task); 1581 GNUNET_SCHEDULER_cancel(handle->reconnect_task);
1582 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 1582 handle->reconnect_task = NULL;
1583 } 1583 }
1584 GNUNET_free (handle); 1584 GNUNET_free (handle);
1585} 1585}
@@ -1761,7 +1761,7 @@ GNUNET_CADET_notify_transmit_ready_cancel (struct GNUNET_CADET_TransmitHandle *t
1761 1761
1762 th->channel->packet_size = 0; 1762 th->channel->packet_size = 0;
1763 cadet = th->channel->cadet; 1763 cadet = th->channel->cadet;
1764 if (th->timeout_task != GNUNET_SCHEDULER_NO_TASK) 1764 if (th->timeout_task != NULL)
1765 GNUNET_SCHEDULER_cancel (th->timeout_task); 1765 GNUNET_SCHEDULER_cancel (th->timeout_task);
1766 GNUNET_CONTAINER_DLL_remove (cadet->th_head, cadet->th_tail, th); 1766 GNUNET_CONTAINER_DLL_remove (cadet->th_head, cadet->th_tail, th);
1767 GNUNET_free (th); 1767 GNUNET_free (th);
diff --git a/src/cadet/cadet_path.c b/src/cadet/cadet_path.c
index d1aa9dcf2..c00e417b1 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)
48 struct CadetPeer *peer; 48 struct CadetPeer *peer;
49 49
50 LOG (GNUNET_ERROR_TYPE_INFO, "Destroy delayed %p (%u)\n", path, path->length); 50 LOG (GNUNET_ERROR_TYPE_INFO, "Destroy delayed %p (%u)\n", path, path->length);
51 path->path_delete = GNUNET_SCHEDULER_NO_TASK; 51 path->path_delete = NULL;
52 peer = GCP_get_short (path->peers[path->length - 1]); 52 peer = GCP_get_short (path->peers[path->length - 1]);
53 if (2 < path->length) 53 if (2 < path->length)
54 GCP_remove_path (peer, path); 54 GCP_remove_path (peer, path);
@@ -150,7 +150,7 @@ path_get_length (struct CadetPeerPath *path)
150void 150void
151path_invalidate (struct CadetPeerPath *p) 151path_invalidate (struct CadetPeerPath *p)
152{ 152{
153 if (GNUNET_SCHEDULER_NO_TASK != p->path_delete) 153 if (NULL != p->path_delete)
154 return; 154 return;
155 155
156 LOG (GNUNET_ERROR_TYPE_INFO, "Invalidating path %p (%u)\n", p, p->length); 156 LOG (GNUNET_ERROR_TYPE_INFO, "Invalidating path %p (%u)\n", p, p->length);
@@ -267,7 +267,7 @@ path_equivalent (const struct CadetPeerPath *p1,
267int 267int
268path_is_valid (const struct CadetPeerPath *path) 268path_is_valid (const struct CadetPeerPath *path)
269{ 269{
270 return (GNUNET_SCHEDULER_NO_TASK == path->path_delete); 270 return (NULL == path->path_delete);
271} 271}
272 272
273 273
@@ -287,7 +287,7 @@ path_destroy (struct CadetPeerPath *p)
287 LOG (GNUNET_ERROR_TYPE_INFO, "destroying path %p (%u)\n", p, p->length); 287 LOG (GNUNET_ERROR_TYPE_INFO, "destroying path %p (%u)\n", p, p->length);
288 GNUNET_PEER_decrement_rcs (p->peers, p->length); 288 GNUNET_PEER_decrement_rcs (p->peers, p->length);
289 GNUNET_free_non_null (p->peers); 289 GNUNET_free_non_null (p->peers);
290 if (GNUNET_SCHEDULER_NO_TASK != p->path_delete) 290 if (NULL != p->path_delete)
291 GNUNET_SCHEDULER_cancel (p->path_delete); 291 GNUNET_SCHEDULER_cancel (p->path_delete);
292 GNUNET_free (p); 292 GNUNET_free (p);
293 return GNUNET_OK; 293 return GNUNET_OK;
diff --git a/src/cadet/cadet_path.h b/src/cadet/cadet_path.h
index 761e51156..326626f9d 100644
--- a/src/cadet/cadet_path.h
+++ b/src/cadet/cadet_path.h
@@ -78,7 +78,7 @@ struct CadetPeerPath
78 * Task to delete the path. 78 * Task to delete the path.
79 * We tried it, it didn't work, don't try again in a while. 79 * We tried it, it didn't work, don't try again in a while.
80 */ 80 */
81 GNUNET_SCHEDULER_TaskIdentifier path_delete; 81 struct GNUNET_SCHEDULER_Task * path_delete;
82 82
83}; 83};
84 84
diff --git a/src/cadet/gnunet-cadet-profiler.c b/src/cadet/gnunet-cadet-profiler.c
index c944caa75..2cfbfdaa4 100644
--- a/src/cadet/gnunet-cadet-profiler.c
+++ b/src/cadet/gnunet-cadet-profiler.c
@@ -147,7 +147,7 @@ struct CadetPeer
147 /** 147 /**
148 * Task to do the next ping. 148 * Task to do the next ping.
149 */ 149 */
150 GNUNET_SCHEDULER_TaskIdentifier ping_task; 150 struct GNUNET_SCHEDULER_Task * ping_task;
151 151
152 float mean[number_rounds]; 152 float mean[number_rounds];
153 float var[number_rounds]; 153 float var[number_rounds];
@@ -209,17 +209,17 @@ static struct GNUNET_CADET_TEST_Context *test_ctx;
209/** 209/**
210 * Task called to shutdown test. 210 * Task called to shutdown test.
211 */ 211 */
212static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle; 212static struct GNUNET_SCHEDULER_Task * shutdown_handle;
213 213
214/** 214/**
215 * Task called to disconnect peers, before shutdown. 215 * Task called to disconnect peers, before shutdown.
216 */ 216 */
217static GNUNET_SCHEDULER_TaskIdentifier disconnect_task; 217static struct GNUNET_SCHEDULER_Task * disconnect_task;
218 218
219/** 219/**
220 * Task to perform tests 220 * Task to perform tests
221 */ 221 */
222static GNUNET_SCHEDULER_TaskIdentifier test_task; 222static struct GNUNET_SCHEDULER_Task * test_task;
223 223
224/** 224/**
225 * Round number. 225 * Round number.
@@ -320,7 +320,7 @@ static void
320shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 320shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
321{ 321{
322 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Ending test.\n"); 322 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Ending test.\n");
323 shutdown_handle = GNUNET_SCHEDULER_NO_TASK; 323 shutdown_handle = NULL;
324} 324}
325 325
326 326
@@ -338,7 +338,7 @@ disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc
338 338
339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
340 "disconnecting cadet service, called from line %ld\n", line); 340 "disconnecting cadet service, called from line %ld\n", line);
341 disconnect_task = GNUNET_SCHEDULER_NO_TASK; 341 disconnect_task = NULL;
342 for (i = 0; i < peers_total; i++) 342 for (i = 0; i < peers_total; i++)
343 { 343 {
344 if (NULL != peers[i].op) 344 if (NULL != peers[i].op)
@@ -366,7 +366,7 @@ disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc
366 } 366 }
367 } 367 }
368 GNUNET_CADET_TEST_cleanup (test_ctx); 368 GNUNET_CADET_TEST_cleanup (test_ctx);
369 if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle) 369 if (NULL != shutdown_handle)
370 { 370 {
371 GNUNET_SCHEDULER_cancel (shutdown_handle); 371 GNUNET_SCHEDULER_cancel (shutdown_handle);
372 } 372 }
@@ -382,7 +382,7 @@ disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc
382static void 382static void
383abort_test (long line) 383abort_test (long line)
384{ 384{
385 if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) 385 if (disconnect_task != NULL)
386 { 386 {
387 GNUNET_SCHEDULER_cancel (disconnect_task); 387 GNUNET_SCHEDULER_cancel (disconnect_task);
388 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, 388 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)
405 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "... collecting statistics done.\n"); 405 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "... collecting statistics done.\n");
406 GNUNET_TESTBED_operation_done (stats_op); 406 GNUNET_TESTBED_operation_done (stats_op);
407 407
408 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) 408 if (NULL != disconnect_task)
409 GNUNET_SCHEDULER_cancel (disconnect_task); 409 GNUNET_SCHEDULER_cancel (disconnect_task);
410 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, 410 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
411 (void *) __LINE__); 411 (void *) __LINE__);
@@ -513,9 +513,9 @@ adjust_running_peers (unsigned int target)
513 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "St%s peer %u: %s\n", 513 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "St%s peer %u: %s\n",
514 run ? "arting" : "opping", r, GNUNET_i2s (&peers[r].id)); 514 run ? "arting" : "opping", r, GNUNET_i2s (&peers[r].id));
515 515
516 if (GNUNET_SCHEDULER_NO_TASK != peers[r].ping_task) 516 if (NULL != peers[r].ping_task)
517 GNUNET_SCHEDULER_cancel (peers[r].ping_task); 517 GNUNET_SCHEDULER_cancel (peers[r].ping_task);
518 peers[r].ping_task = GNUNET_SCHEDULER_NO_TASK; 518 peers[r].ping_task = NULL;
519 519
520 peers[r].up = run; 520 peers[r].up = run;
521 521
@@ -615,7 +615,7 @@ ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
615{ 615{
616 struct CadetPeer *peer = (struct CadetPeer *) cls; 616 struct CadetPeer *peer = (struct CadetPeer *) cls;
617 617
618 peer->ping_task = GNUNET_SCHEDULER_NO_TASK; 618 peer->ping_task = NULL;
619 619
620 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0 620 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0
621 || GNUNET_YES == test_finished) 621 || GNUNET_YES == test_finished)
@@ -797,7 +797,7 @@ incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel,
797 peers_warmup++; 797 peers_warmup++;
798 if (peers_warmup < peers_total) 798 if (peers_warmup < peers_total)
799 return NULL; 799 return NULL;
800 if (GNUNET_SCHEDULER_NO_TASK != test_task) 800 if (NULL != test_task)
801 { 801 {
802 GNUNET_SCHEDULER_cancel (test_task); 802 GNUNET_SCHEDULER_cancel (test_task);
803 test_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 803 test_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
@@ -873,7 +873,7 @@ start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
873 enum GNUNET_CADET_ChannelOption flags; 873 enum GNUNET_CADET_ChannelOption flags;
874 unsigned long i; 874 unsigned long i;
875 875
876 test_task = GNUNET_SCHEDULER_NO_TASK; 876 test_task = NULL;
877 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 877 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
878 return; 878 return;
879 879
@@ -898,7 +898,7 @@ start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
898 &ping, &peers[i]); 898 &ping, &peers[i]);
899 } 899 }
900 peers_running = peers_total; 900 peers_running = peers_total;
901 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) 901 if (NULL != disconnect_task)
902 GNUNET_SCHEDULER_cancel (disconnect_task); 902 GNUNET_SCHEDULER_cancel (disconnect_task);
903 disconnect_task = 903 disconnect_task =
904 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(round_time, 904 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 d6ae66331..2b28685c9 100644
--- a/src/cadet/gnunet-cadet.c
+++ b/src/cadet/gnunet-cadet.c
@@ -87,7 +87,7 @@ struct GNUNET_TIME_Absolute echo_time;
87/** 87/**
88 * Task for next echo request. 88 * Task for next echo request.
89 */ 89 */
90GNUNET_SCHEDULER_TaskIdentifier echo_task; 90struct GNUNET_SCHEDULER_Task * echo_task;
91 91
92/** 92/**
93 * Peer to connect to. 93 * Peer to connect to.
@@ -118,7 +118,7 @@ static struct GNUNET_CADET_Channel *ch;
118/** 118/**
119 * Shutdown task handle. 119 * Shutdown task handle.
120 */ 120 */
121GNUNET_SCHEDULER_TaskIdentifier sd; 121struct GNUNET_SCHEDULER_Task * sd;
122 122
123 123
124 124
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c
index cc9cc699a..bb9fa6060 100644
--- a/src/cadet/gnunet-service-cadet_channel.c
+++ b/src/cadet/gnunet-service-cadet_channel.c
@@ -183,7 +183,7 @@ struct CadetChannelReliability
183 /** 183 /**
184 * Task to resend/poll in case no ACK is received. 184 * Task to resend/poll in case no ACK is received.
185 */ 185 */
186 GNUNET_SCHEDULER_TaskIdentifier retry_task; 186 struct GNUNET_SCHEDULER_Task * retry_task;
187 187
188 /** 188 /**
189 * Counter for exponential backoff. 189 * Counter for exponential backoff.
@@ -729,7 +729,7 @@ channel_retransmit_message (void *cls,
729 struct GNUNET_CADET_Data *payload; 729 struct GNUNET_CADET_Data *payload;
730 int fwd; 730 int fwd;
731 731
732 rel->retry_task = GNUNET_SCHEDULER_NO_TASK; 732 rel->retry_task = NULL;
733 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 733 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
734 return; 734 return;
735 735
@@ -763,7 +763,7 @@ channel_recreate (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
763{ 763{
764 struct CadetChannelReliability *rel = cls; 764 struct CadetChannelReliability *rel = cls;
765 765
766 rel->retry_task = GNUNET_SCHEDULER_NO_TASK; 766 rel->retry_task = NULL;
767 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 767 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
768 return; 768 return;
769 769
@@ -815,7 +815,7 @@ ch_message_sent (void *cls,
815 GNUNET_assert (chq == copy->chq); 815 GNUNET_assert (chq == copy->chq);
816 copy->timestamp = GNUNET_TIME_absolute_get (); 816 copy->timestamp = GNUNET_TIME_absolute_get ();
817 rel = copy->rel; 817 rel = copy->rel;
818 if (GNUNET_SCHEDULER_NO_TASK == rel->retry_task) 818 if (NULL == rel->retry_task)
819 { 819 {
820 LOG (GNUNET_ERROR_TYPE_DEBUG, "!! scheduling retry in 4 * %s\n", 820 LOG (GNUNET_ERROR_TYPE_DEBUG, "!! scheduling retry in 4 * %s\n",
821 GNUNET_STRINGS_relative_time_to_string (rel->expected_delay, 821 GNUNET_STRINGS_relative_time_to_string (rel->expected_delay,
@@ -859,7 +859,7 @@ ch_message_sent (void *cls,
859 && GNUNET_MESSAGE_TYPE_CADET_DATA_ACK != type 859 && GNUNET_MESSAGE_TYPE_CADET_DATA_ACK != type
860 && GNUNET_NO == rel->ch->destroy) 860 && GNUNET_NO == rel->ch->destroy)
861 { 861 {
862 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == rel->retry_task); 862 GNUNET_assert (NULL == rel->retry_task);
863 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! STD BACKOFF %s\n", 863 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! STD BACKOFF %s\n",
864 GNUNET_STRINGS_relative_time_to_string (rel->retry_timer, 864 GNUNET_STRINGS_relative_time_to_string (rel->retry_timer,
865 GNUNET_NO)); 865 GNUNET_NO));
@@ -1006,10 +1006,10 @@ channel_rel_free_all (struct CadetChannelReliability *rel)
1006 GCT_cancel (rel->uniq->tq); 1006 GCT_cancel (rel->uniq->tq);
1007 /* ch_message_sent is called freeing uniq */ 1007 /* ch_message_sent is called freeing uniq */
1008 } 1008 }
1009 if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task) 1009 if (NULL != rel->retry_task)
1010 { 1010 {
1011 GNUNET_SCHEDULER_cancel (rel->retry_task); 1011 GNUNET_SCHEDULER_cancel (rel->retry_task);
1012 rel->retry_task = GNUNET_SCHEDULER_NO_TASK; 1012 rel->retry_task = NULL;
1013 } 1013 }
1014 GNUNET_free (rel); 1014 GNUNET_free (rel);
1015} 1015}
@@ -1174,10 +1174,10 @@ channel_confirm (struct CadetChannel *ch, int fwd)
1174 if (GCT_get_connections_buffer (ch->t) > 0 || GCT_is_loopback (ch->t)) 1174 if (GCT_get_connections_buffer (ch->t) > 0 || GCT_is_loopback (ch->t))
1175 send_client_ack (ch, fwd); 1175 send_client_ack (ch, fwd);
1176 1176
1177 if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task) 1177 if (NULL != rel->retry_task)
1178 { 1178 {
1179 GNUNET_SCHEDULER_cancel (rel->retry_task); 1179 GNUNET_SCHEDULER_cancel (rel->retry_task);
1180 rel->retry_task = GNUNET_SCHEDULER_NO_TASK; 1180 rel->retry_task = NULL;
1181 } 1181 }
1182 else if (NULL != rel->uniq) 1182 else if (NULL != rel->uniq)
1183 { 1183 {
@@ -2079,10 +2079,10 @@ GCCH_handle_data_ack (struct CadetChannel *ch,
2079 /* If some message was free'd, update the retransmission delay */ 2079 /* If some message was free'd, update the retransmission delay */
2080 if (GNUNET_YES == work) 2080 if (GNUNET_YES == work)
2081 { 2081 {
2082 if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task) 2082 if (NULL != rel->retry_task)
2083 { 2083 {
2084 GNUNET_SCHEDULER_cancel (rel->retry_task); 2084 GNUNET_SCHEDULER_cancel (rel->retry_task);
2085 rel->retry_task = GNUNET_SCHEDULER_NO_TASK; 2085 rel->retry_task = NULL;
2086 if (NULL != rel->head_sent && NULL == rel->head_sent->chq) 2086 if (NULL != rel->head_sent && NULL == rel->head_sent->chq)
2087 { 2087 {
2088 struct GNUNET_TIME_Absolute new_target; 2088 struct GNUNET_TIME_Absolute new_target;
@@ -2179,12 +2179,12 @@ GCCH_handle_create (struct CadetTunnel *t,
2179 else 2179 else
2180 { 2180 {
2181 LOG (GNUNET_ERROR_TYPE_DEBUG, " duplicate create channel\n"); 2181 LOG (GNUNET_ERROR_TYPE_DEBUG, " duplicate create channel\n");
2182 if (GNUNET_SCHEDULER_NO_TASK != ch->dest_rel->retry_task) 2182 if (NULL != ch->dest_rel->retry_task)
2183 { 2183 {
2184 LOG (GNUNET_ERROR_TYPE_DEBUG, " clearing retry task\n"); 2184 LOG (GNUNET_ERROR_TYPE_DEBUG, " clearing retry task\n");
2185 /* we were waiting to re-send our 'SYNACK', wait no more! */ 2185 /* we were waiting to re-send our 'SYNACK', wait no more! */
2186 GNUNET_SCHEDULER_cancel (ch->dest_rel->retry_task); 2186 GNUNET_SCHEDULER_cancel (ch->dest_rel->retry_task);
2187 ch->dest_rel->retry_task = GNUNET_SCHEDULER_NO_TASK; 2187 ch->dest_rel->retry_task = NULL;
2188 } 2188 }
2189 else if (NULL != ch->dest_rel->uniq) 2189 else if (NULL != ch->dest_rel->uniq)
2190 { 2190 {
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index 50768d413..548eeb9b3 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -95,7 +95,7 @@ struct CadetFlowControl
95 /** 95 /**
96 * Task to poll the peer in case of a lost ACK causes stall. 96 * Task to poll the peer in case of a lost ACK causes stall.
97 */ 97 */
98 GNUNET_SCHEDULER_TaskIdentifier poll_task; 98 struct GNUNET_SCHEDULER_Task * poll_task;
99 99
100 /** 100 /**
101 * How frequently to poll for ACKs. 101 * How frequently to poll for ACKs.
@@ -190,13 +190,13 @@ struct CadetConnection
190 * Task to keep the used paths alive at the owner, 190 * Task to keep the used paths alive at the owner,
191 * time tunnel out on all the other peers. 191 * time tunnel out on all the other peers.
192 */ 192 */
193 GNUNET_SCHEDULER_TaskIdentifier fwd_maintenance_task; 193 struct GNUNET_SCHEDULER_Task * fwd_maintenance_task;
194 194
195 /** 195 /**
196 * Task to keep the used paths alive at the destination, 196 * Task to keep the used paths alive at the destination,
197 * time tunnel out on all the other peers. 197 * time tunnel out on all the other peers.
198 */ 198 */
199 GNUNET_SCHEDULER_TaskIdentifier bck_maintenance_task; 199 struct GNUNET_SCHEDULER_Task * bck_maintenance_task;
200 200
201 /** 201 /**
202 * Queue handle for maintainance traffic. One handle for FWD and BCK since 202 * Queue handle for maintainance traffic. One handle for FWD and BCK since
@@ -400,7 +400,7 @@ fc_init (struct CadetFlowControl *fc)
400 fc->last_pid_recv = (uint32_t) -1; 400 fc->last_pid_recv = (uint32_t) -1;
401 fc->last_ack_sent = (uint32_t) 0; 401 fc->last_ack_sent = (uint32_t) 0;
402 fc->last_ack_recv = (uint32_t) 0; 402 fc->last_ack_recv = (uint32_t) 0;
403 fc->poll_task = GNUNET_SCHEDULER_NO_TASK; 403 fc->poll_task = NULL;
404 fc->poll_time = GNUNET_TIME_UNIT_SECONDS; 404 fc->poll_time = GNUNET_TIME_UNIT_SECONDS;
405 fc->queue_n = 0; 405 fc->queue_n = 0;
406 fc->queue_max = (max_msgs_queue / max_connections) + 1; 406 fc->queue_max = (max_msgs_queue / max_connections) + 1;
@@ -1008,9 +1008,9 @@ connection_keepalive (struct CadetConnection *c, int fwd, int shutdown)
1008 GC_f2s (fwd), GCC_2s (c)); 1008 GC_f2s (fwd), GCC_2s (c));
1009 1009
1010 if (fwd) 1010 if (fwd)
1011 c->fwd_maintenance_task = GNUNET_SCHEDULER_NO_TASK; 1011 c->fwd_maintenance_task = NULL;
1012 else 1012 else
1013 c->bck_maintenance_task = GNUNET_SCHEDULER_NO_TASK; 1013 c->bck_maintenance_task = NULL;
1014 1014
1015 if (GNUNET_NO != shutdown) 1015 if (GNUNET_NO != shutdown)
1016 return; 1016 return;
@@ -1066,8 +1066,8 @@ static void
1066schedule_next_keepalive (struct CadetConnection *c, int fwd) 1066schedule_next_keepalive (struct CadetConnection *c, int fwd)
1067{ 1067{
1068 struct GNUNET_TIME_Relative delay; 1068 struct GNUNET_TIME_Relative delay;
1069 GNUNET_SCHEDULER_TaskIdentifier *task_id; 1069 struct GNUNET_SCHEDULER_Task * *task_id;
1070 GNUNET_SCHEDULER_Task keepalive_task; 1070 GNUNET_SCHEDULER_TaskCallback keepalive_task;
1071 1071
1072 if (GNUNET_NO == GCC_is_origin (c, fwd)) 1072 if (GNUNET_NO == GCC_is_origin (c, fwd))
1073 return; 1073 return;
@@ -1100,7 +1100,7 @@ schedule_next_keepalive (struct CadetConnection *c, int fwd)
1100 } 1100 }
1101 1101
1102 /* Check that no one scheduled it before us */ 1102 /* Check that no one scheduled it before us */
1103 if (GNUNET_SCHEDULER_NO_TASK != *task_id) 1103 if (NULL != *task_id)
1104 { 1104 {
1105 /* No need for a _break. It can happen for instance when sending a SYNACK 1105 /* No need for a _break. It can happen for instance when sending a SYNACK
1106 * for a duplicate SYN: the first SYNACK scheduled the task. */ 1106 * for a duplicate SYN: the first SYNACK scheduled the task. */
@@ -1168,10 +1168,10 @@ connection_cancel_queues (struct CadetConnection *c, int fwd)
1168 } 1168 }
1169 1169
1170 fc = fwd ? &c->fwd_fc : &c->bck_fc; 1170 fc = fwd ? &c->fwd_fc : &c->bck_fc;
1171 if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task) 1171 if (NULL != fc->poll_task)
1172 { 1172 {
1173 GNUNET_SCHEDULER_cancel (fc->poll_task); 1173 GNUNET_SCHEDULER_cancel (fc->poll_task);
1174 fc->poll_task = GNUNET_SCHEDULER_NO_TASK; 1174 fc->poll_task = NULL;
1175 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Cancel POLL in ccq for fc %p\n", fc); 1175 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Cancel POLL in ccq for fc %p\n", fc);
1176 } 1176 }
1177 peer = get_hop (c, fwd); 1177 peer = get_hop (c, fwd);
@@ -1236,7 +1236,7 @@ connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1236 struct GNUNET_CADET_Poll msg; 1236 struct GNUNET_CADET_Poll msg;
1237 struct CadetConnection *c; 1237 struct CadetConnection *c;
1238 1238
1239 fc->poll_task = GNUNET_SCHEDULER_NO_TASK; 1239 fc->poll_task = NULL;
1240 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1240 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1241 { 1241 {
1242 return; 1242 return;
@@ -1316,7 +1316,7 @@ connection_fwd_timeout (void *cls,
1316{ 1316{
1317 struct CadetConnection *c = cls; 1317 struct CadetConnection *c = cls;
1318 1318
1319 c->fwd_maintenance_task = GNUNET_SCHEDULER_NO_TASK; 1319 c->fwd_maintenance_task = NULL;
1320 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1320 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1321 return; 1321 return;
1322 1322
@@ -1358,7 +1358,7 @@ connection_bck_timeout (void *cls,
1358{ 1358{
1359 struct CadetConnection *c = cls; 1359 struct CadetConnection *c = cls;
1360 1360
1361 c->bck_maintenance_task = GNUNET_SCHEDULER_NO_TASK; 1361 c->bck_maintenance_task = NULL;
1362 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1362 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1363 return; 1363 return;
1364 1364
@@ -1410,12 +1410,12 @@ connection_reset_timeout (struct CadetConnection *c, int fwd)
1410 else /* Relay, endpoint. */ 1410 else /* Relay, endpoint. */
1411 { 1411 {
1412 struct GNUNET_TIME_Relative delay; 1412 struct GNUNET_TIME_Relative delay;
1413 GNUNET_SCHEDULER_TaskIdentifier *ti; 1413 struct GNUNET_SCHEDULER_Task * *ti;
1414 GNUNET_SCHEDULER_Task f; 1414 GNUNET_SCHEDULER_TaskCallback f;
1415 1415
1416 ti = fwd ? &c->fwd_maintenance_task : &c->bck_maintenance_task; 1416 ti = fwd ? &c->fwd_maintenance_task : &c->bck_maintenance_task;
1417 1417
1418 if (GNUNET_SCHEDULER_NO_TASK != *ti) 1418 if (NULL != *ti)
1419 GNUNET_SCHEDULER_cancel (*ti); 1419 GNUNET_SCHEDULER_cancel (*ti);
1420 delay = GNUNET_TIME_relative_multiply (refresh_connection_time, 4); 1420 delay = GNUNET_TIME_relative_multiply (refresh_connection_time, 4);
1421 LOG (GNUNET_ERROR_TYPE_DEBUG, " timing out in %s\n", 1421 LOG (GNUNET_ERROR_TYPE_DEBUG, " timing out in %s\n",
@@ -2376,12 +2376,12 @@ GCC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
2376 fc->last_ack_recv = ack; 2376 fc->last_ack_recv = ack;
2377 2377
2378 /* Cancel polling if the ACK is big enough. */ 2378 /* Cancel polling if the ACK is big enough. */
2379 if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task && 2379 if (NULL != fc->poll_task &&
2380 GC_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent)) 2380 GC_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent))
2381 { 2381 {
2382 LOG (GNUNET_ERROR_TYPE_DEBUG, " Cancel poll\n"); 2382 LOG (GNUNET_ERROR_TYPE_DEBUG, " Cancel poll\n");
2383 GNUNET_SCHEDULER_cancel (fc->poll_task); 2383 GNUNET_SCHEDULER_cancel (fc->poll_task);
2384 fc->poll_task = GNUNET_SCHEDULER_NO_TASK; 2384 fc->poll_task = NULL;
2385 fc->poll_time = GNUNET_TIME_UNIT_SECONDS; 2385 fc->poll_time = GNUNET_TIME_UNIT_SECONDS;
2386 } 2386 }
2387 2387
@@ -2690,16 +2690,16 @@ GCC_destroy (struct CadetConnection *c)
2690 2690
2691 if (GNUNET_NO == GCC_is_origin (c, GNUNET_YES) && NULL != c->path) 2691 if (GNUNET_NO == GCC_is_origin (c, GNUNET_YES) && NULL != c->path)
2692 path_destroy (c->path); 2692 path_destroy (c->path);
2693 if (GNUNET_SCHEDULER_NO_TASK != c->fwd_maintenance_task) 2693 if (NULL != c->fwd_maintenance_task)
2694 GNUNET_SCHEDULER_cancel (c->fwd_maintenance_task); 2694 GNUNET_SCHEDULER_cancel (c->fwd_maintenance_task);
2695 if (GNUNET_SCHEDULER_NO_TASK != c->bck_maintenance_task) 2695 if (NULL != c->bck_maintenance_task)
2696 GNUNET_SCHEDULER_cancel (c->bck_maintenance_task); 2696 GNUNET_SCHEDULER_cancel (c->bck_maintenance_task);
2697 if (GNUNET_SCHEDULER_NO_TASK != c->fwd_fc.poll_task) 2697 if (NULL != c->fwd_fc.poll_task)
2698 { 2698 {
2699 GNUNET_SCHEDULER_cancel (c->fwd_fc.poll_task); 2699 GNUNET_SCHEDULER_cancel (c->fwd_fc.poll_task);
2700 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL FWD canceled\n"); 2700 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL FWD canceled\n");
2701 } 2701 }
2702 if (GNUNET_SCHEDULER_NO_TASK != c->bck_fc.poll_task) 2702 if (NULL != c->bck_fc.poll_task)
2703 { 2703 {
2704 GNUNET_SCHEDULER_cancel (c->bck_fc.poll_task); 2704 GNUNET_SCHEDULER_cancel (c->bck_fc.poll_task);
2705 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL BCK canceled\n"); 2705 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL BCK canceled\n");
@@ -3268,7 +3268,7 @@ GCC_start_poll (struct CadetConnection *c, int fwd)
3268 fc = fwd ? &c->fwd_fc : &c->bck_fc; 3268 fc = fwd ? &c->fwd_fc : &c->bck_fc;
3269 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL %s requested\n", 3269 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL %s requested\n",
3270 GC_f2s (fwd)); 3270 GC_f2s (fwd));
3271 if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task || NULL != fc->poll_msg) 3271 if (NULL != fc->poll_task || NULL != fc->poll_msg)
3272 { 3272 {
3273 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** not needed (%u, %p)\n", 3273 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** not needed (%u, %p)\n",
3274 fc->poll_task, fc->poll_msg); 3274 fc->poll_task, fc->poll_msg);
@@ -3295,10 +3295,10 @@ GCC_stop_poll (struct CadetConnection *c, int fwd)
3295 struct CadetFlowControl *fc; 3295 struct CadetFlowControl *fc;
3296 3296
3297 fc = fwd ? &c->fwd_fc : &c->bck_fc; 3297 fc = fwd ? &c->fwd_fc : &c->bck_fc;
3298 if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task) 3298 if (NULL != fc->poll_task)
3299 { 3299 {
3300 GNUNET_SCHEDULER_cancel (fc->poll_task); 3300 GNUNET_SCHEDULER_cancel (fc->poll_task);
3301 fc->poll_task = GNUNET_SCHEDULER_NO_TASK; 3301 fc->poll_task = NULL;
3302 } 3302 }
3303} 3303}
3304 3304
diff --git a/src/cadet/gnunet-service-cadet_dht.c b/src/cadet/gnunet-service-cadet_dht.c
index a44938484..7307ba001 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;
93/** 93/**
94 * Task to periodically announce itself in the network. 94 * Task to periodically announce itself in the network.
95 */ 95 */
96static GNUNET_SCHEDULER_TaskIdentifier announce_id_task; 96static struct GNUNET_SCHEDULER_Task * announce_id_task;
97 97
98/** 98/**
99 * GET requests to stop on shutdown. 99 * GET requests to stop on shutdown.
@@ -214,7 +214,7 @@ announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
214 214
215 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 215 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
216 { 216 {
217 announce_id_task = GNUNET_SCHEDULER_NO_TASK; 217 announce_id_task = NULL;
218 return; 218 return;
219 } 219 }
220 LOG (GNUNET_ERROR_TYPE_DEBUG, "Announce ID\n"); 220 LOG (GNUNET_ERROR_TYPE_DEBUG, "Announce ID\n");
@@ -332,10 +332,10 @@ GCD_shutdown (void)
332 GNUNET_DHT_disconnect (dht_handle); 332 GNUNET_DHT_disconnect (dht_handle);
333 dht_handle = NULL; 333 dht_handle = NULL;
334 } 334 }
335 if (GNUNET_SCHEDULER_NO_TASK != announce_id_task) 335 if (NULL != announce_id_task)
336 { 336 {
337 GNUNET_SCHEDULER_cancel (announce_id_task); 337 GNUNET_SCHEDULER_cancel (announce_id_task);
338 announce_id_task = GNUNET_SCHEDULER_NO_TASK; 338 announce_id_task = NULL;
339 } 339 }
340} 340}
341 341
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c
index e19a60961..9740e41d9 100644
--- a/src/cadet/gnunet-service-cadet_tunnel.c
+++ b/src/cadet/gnunet-service-cadet_tunnel.c
@@ -117,7 +117,7 @@ struct CadetTunnelKXCtx
117 * Task for delayed destruction of the Key eXchange context, to allow delayed 117 * Task for delayed destruction of the Key eXchange context, to allow delayed
118 * messages with the old key to be decrypted successfully. 118 * messages with the old key to be decrypted successfully.
119 */ 119 */
120 GNUNET_SCHEDULER_TaskIdentifier finish_task; 120 struct GNUNET_SCHEDULER_Task * finish_task;
121}; 121};
122 122
123/** 123/**
@@ -164,7 +164,7 @@ struct CadetTunnel
164 /** 164 /**
165 * Task to start the rekey process. 165 * Task to start the rekey process.
166 */ 166 */
167 GNUNET_SCHEDULER_TaskIdentifier rekey_task; 167 struct GNUNET_SCHEDULER_Task * rekey_task;
168 168
169 /** 169 /**
170 * Paths that are actively used to reach the destination peer. 170 * Paths that are actively used to reach the destination peer.
@@ -191,7 +191,7 @@ struct CadetTunnel
191 /** 191 /**
192 * Destroy flag: if true, destroy on last message. 192 * Destroy flag: if true, destroy on last message.
193 */ 193 */
194 GNUNET_SCHEDULER_TaskIdentifier destroy_task; 194 struct GNUNET_SCHEDULER_Task * destroy_task;
195 195
196 /** 196 /**
197 * Queued messages, to transmit once tunnel gets connected. 197 * Queued messages, to transmit once tunnel gets connected.
@@ -202,7 +202,7 @@ struct CadetTunnel
202 /** 202 /**
203 * Task to trim connections if too many are present. 203 * Task to trim connections if too many are present.
204 */ 204 */
205 GNUNET_SCHEDULER_TaskIdentifier trim_connections_task; 205 struct GNUNET_SCHEDULER_Task * trim_connections_task;
206 206
207 /** 207 /**
208 * Ephemeral message in the queue (to avoid queueing more than one). 208 * Ephemeral message in the queue (to avoid queueing more than one).
@@ -326,7 +326,7 @@ static struct GNUNET_CADET_KX_Ephemeral kx_msg;
326/** 326/**
327 * Task to generate a new ephemeral key. 327 * Task to generate a new ephemeral key.
328 */ 328 */
329static GNUNET_SCHEDULER_TaskIdentifier rekey_task; 329static struct GNUNET_SCHEDULER_Task * rekey_task;
330 330
331/** 331/**
332 * Rekey period. 332 * Rekey period.
@@ -604,7 +604,7 @@ select_key (const struct CadetTunnel *t)
604 const struct GNUNET_CRYPTO_SymmetricSessionKey *key; 604 const struct GNUNET_CRYPTO_SymmetricSessionKey *key;
605 605
606 if (NULL != t->kx_ctx 606 if (NULL != t->kx_ctx
607 && GNUNET_SCHEDULER_NO_TASK == t->kx_ctx->finish_task) 607 && NULL == t->kx_ctx->finish_task)
608 { 608 {
609 struct GNUNET_TIME_Relative age; 609 struct GNUNET_TIME_Relative age;
610 610
@@ -912,11 +912,11 @@ create_kx_ctx (struct CadetTunnel *t)
912 912
913 if (NULL != t->kx_ctx) 913 if (NULL != t->kx_ctx)
914 { 914 {
915 if (GNUNET_SCHEDULER_NO_TASK != t->kx_ctx->finish_task) 915 if (NULL != t->kx_ctx->finish_task)
916 { 916 {
917 LOG (GNUNET_ERROR_TYPE_INFO, " resetting exisiting finish task\n"); 917 LOG (GNUNET_ERROR_TYPE_INFO, " resetting exisiting finish task\n");
918 GNUNET_SCHEDULER_cancel (t->kx_ctx->finish_task); 918 GNUNET_SCHEDULER_cancel (t->kx_ctx->finish_task);
919 t->kx_ctx->finish_task = GNUNET_SCHEDULER_NO_TASK; 919 t->kx_ctx->finish_task = NULL;
920 } 920 }
921 } 921 }
922 else 922 else
@@ -975,7 +975,7 @@ destroy_kx_ctx (struct CadetTunnel *t)
975{ 975{
976 struct GNUNET_TIME_Relative delay; 976 struct GNUNET_TIME_Relative delay;
977 977
978 if (NULL == t->kx_ctx || GNUNET_SCHEDULER_NO_TASK != t->kx_ctx->finish_task) 978 if (NULL == t->kx_ctx || NULL != t->kx_ctx->finish_task)
979 return; 979 return;
980 980
981 if (is_key_null (&t->kx_ctx->e_key_old)) 981 if (is_key_null (&t->kx_ctx->e_key_old))
@@ -1182,7 +1182,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message,
1182 if (NULL == c) 1182 if (NULL == c)
1183 { 1183 {
1184 /* Why is tunnel 'ready'? Should have been queued! */ 1184 /* Why is tunnel 'ready'? Should have been queued! */
1185 if (GNUNET_SCHEDULER_NO_TASK != t->destroy_task) 1185 if (NULL != t->destroy_task)
1186 { 1186 {
1187 GNUNET_break (0); 1187 GNUNET_break (0);
1188 GCT_debug (t, GNUNET_ERROR_TYPE_WARNING); 1188 GCT_debug (t, GNUNET_ERROR_TYPE_WARNING);
@@ -1387,7 +1387,7 @@ send_kx (struct CadetTunnel *t,
1387 c = tunnel_get_connection (t); 1387 c = tunnel_get_connection (t);
1388 if (NULL == c) 1388 if (NULL == c)
1389 { 1389 {
1390 if (GNUNET_SCHEDULER_NO_TASK == t->destroy_task 1390 if (NULL == t->destroy_task
1391 && CADET_TUNNEL_READY == t->cstate) 1391 && CADET_TUNNEL_READY == t->cstate)
1392 { 1392 {
1393 GNUNET_break (0); 1393 GNUNET_break (0);
@@ -1488,7 +1488,7 @@ rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1488{ 1488{
1489 struct CadetTunnel *t = cls; 1489 struct CadetTunnel *t = cls;
1490 1490
1491 t->rekey_task = GNUNET_SCHEDULER_NO_TASK; 1491 t->rekey_task = NULL;
1492 1492
1493 LOG (GNUNET_ERROR_TYPE_INFO, "Re-key Tunnel %s\n", GCT_2s (t)); 1493 LOG (GNUNET_ERROR_TYPE_INFO, "Re-key Tunnel %s\n", GCT_2s (t));
1494 if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 1494 if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
@@ -1571,7 +1571,7 @@ rekey_iterator (void *cls,
1571 long n = (long) cls; 1571 long n = (long) cls;
1572 uint32_t r; 1572 uint32_t r;
1573 1573
1574 if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) 1574 if (NULL != t->rekey_task)
1575 return GNUNET_YES; 1575 return GNUNET_YES;
1576 1576
1577 if (GNUNET_YES == GCT_is_loopback (t)) 1577 if (GNUNET_YES == GCT_is_loopback (t))
@@ -1599,7 +1599,7 @@ rekey (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1599 struct GNUNET_TIME_Absolute time; 1599 struct GNUNET_TIME_Absolute time;
1600 long n; 1600 long n;
1601 1601
1602 rekey_task = GNUNET_SCHEDULER_NO_TASK; 1602 rekey_task = NULL;
1603 1603
1604 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 1604 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
1605 return; 1605 return;
@@ -1949,7 +1949,7 @@ handle_ephemeral (struct CadetTunnel *t,
1949 { 1949 {
1950 GCT_change_estate (t, CADET_TUNNEL_KEY_REKEY); 1950 GCT_change_estate (t, CADET_TUNNEL_KEY_REKEY);
1951 } 1951 }
1952 if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) 1952 if (NULL != t->rekey_task)
1953 GNUNET_SCHEDULER_cancel (t->rekey_task); 1953 GNUNET_SCHEDULER_cancel (t->rekey_task);
1954 t->rekey_task = GNUNET_SCHEDULER_add_now (rekey_tunnel, t); 1954 t->rekey_task = GNUNET_SCHEDULER_add_now (rekey_tunnel, t);
1955 } 1955 }
@@ -1987,7 +1987,7 @@ handle_pong (struct CadetTunnel *t,
1987 uint32_t challenge; 1987 uint32_t challenge;
1988 1988
1989 LOG (GNUNET_ERROR_TYPE_INFO, "<=== PONG for %s\n", GCT_2s (t)); 1989 LOG (GNUNET_ERROR_TYPE_INFO, "<=== PONG for %s\n", GCT_2s (t));
1990 if (GNUNET_SCHEDULER_NO_TASK == t->rekey_task) 1990 if (NULL == t->rekey_task)
1991 { 1991 {
1992 GNUNET_STATISTICS_update (stats, "# duplicate PONG messages", 1, GNUNET_NO); 1992 GNUNET_STATISTICS_update (stats, "# duplicate PONG messages", 1, GNUNET_NO);
1993 return; 1993 return;
@@ -2008,7 +2008,7 @@ handle_pong (struct CadetTunnel *t,
2008 return; 2008 return;
2009 } 2009 }
2010 GNUNET_SCHEDULER_cancel (t->rekey_task); 2010 GNUNET_SCHEDULER_cancel (t->rekey_task);
2011 t->rekey_task = GNUNET_SCHEDULER_NO_TASK; 2011 t->rekey_task = NULL;
2012 2012
2013 /* Don't free the old keys right away, but after a delay. 2013 /* Don't free the old keys right away, but after a delay.
2014 * Rationale: the KX could have happened over a very fast connection, 2014 * Rationale: the KX could have happened over a very fast connection,
@@ -2223,10 +2223,10 @@ GCT_init (const struct GNUNET_CONFIGURATION_Handle *c,
2223void 2223void
2224GCT_shutdown (void) 2224GCT_shutdown (void)
2225{ 2225{
2226 if (GNUNET_SCHEDULER_NO_TASK != rekey_task) 2226 if (NULL != rekey_task)
2227 { 2227 {
2228 GNUNET_SCHEDULER_cancel (rekey_task); 2228 GNUNET_SCHEDULER_cancel (rekey_task);
2229 rekey_task = GNUNET_SCHEDULER_NO_TASK; 2229 rekey_task = NULL;
2230 } 2230 }
2231 GNUNET_CONTAINER_multipeermap_iterate (tunnels, &destroy_iterator, NULL); 2231 GNUNET_CONTAINER_multipeermap_iterate (tunnels, &destroy_iterator, NULL);
2232 GNUNET_CONTAINER_multipeermap_destroy (tunnels); 2232 GNUNET_CONTAINER_multipeermap_destroy (tunnels);
@@ -2285,7 +2285,7 @@ GCT_change_cstate (struct CadetTunnel* t, enum CadetTunnelCState cstate)
2285 else if (CADET_TUNNEL_KEY_UNINITIALIZED == t->estate) 2285 else if (CADET_TUNNEL_KEY_UNINITIALIZED == t->estate)
2286 { 2286 {
2287 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered rekey\n"); 2287 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered rekey\n");
2288 if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) 2288 if (NULL != t->rekey_task)
2289 GNUNET_SCHEDULER_cancel (t->rekey_task); 2289 GNUNET_SCHEDULER_cancel (t->rekey_task);
2290 create_kx_ctx (t); 2290 create_kx_ctx (t);
2291 rekey_tunnel (t, NULL); 2291 rekey_tunnel (t, NULL);
@@ -2347,7 +2347,7 @@ trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2347{ 2347{
2348 struct CadetTunnel *t = cls; 2348 struct CadetTunnel *t = cls;
2349 2349
2350 t->trim_connections_task = GNUNET_SCHEDULER_NO_TASK; 2350 t->trim_connections_task = NULL;
2351 2351
2352 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 2352 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
2353 return; 2353 return;
@@ -2409,7 +2409,7 @@ GCT_add_connection (struct CadetTunnel *t, struct CadetConnection *c)
2409 if (CADET_TUNNEL_SEARCHING == t->cstate) 2409 if (CADET_TUNNEL_SEARCHING == t->cstate)
2410 GCT_change_estate (t, CADET_TUNNEL_WAITING); 2410 GCT_change_estate (t, CADET_TUNNEL_WAITING);
2411 2411
2412 if (GNUNET_SCHEDULER_NO_TASK != t->trim_connections_task) 2412 if (NULL != t->trim_connections_task)
2413 t->trim_connections_task = GNUNET_SCHEDULER_add_now (&trim_connections, t); 2413 t->trim_connections_task = GNUNET_SCHEDULER_add_now (&trim_connections, t);
2414} 2414}
2415 2415
@@ -2442,7 +2442,7 @@ GCT_remove_connection (struct CadetTunnel *t,
2442 2442
2443 conns = GCT_count_connections (t); 2443 conns = GCT_count_connections (t);
2444 if (0 == conns 2444 if (0 == conns
2445 && GNUNET_SCHEDULER_NO_TASK == t->destroy_task 2445 && NULL == t->destroy_task
2446 && CADET_TUNNEL_SHUTDOWN != t->cstate 2446 && CADET_TUNNEL_SHUTDOWN != t->cstate
2447 && GNUNET_NO == shutting_down) 2447 && GNUNET_NO == shutting_down)
2448 { 2448 {
@@ -2454,7 +2454,7 @@ GCT_remove_connection (struct CadetTunnel *t,
2454 2454
2455 /* Start new connections if needed */ 2455 /* Start new connections if needed */
2456 if (CONNECTIONS_PER_TUNNEL > conns 2456 if (CONNECTIONS_PER_TUNNEL > conns
2457 && GNUNET_SCHEDULER_NO_TASK == t->destroy_task 2457 && NULL == t->destroy_task
2458 && CADET_TUNNEL_SHUTDOWN != t->cstate 2458 && CADET_TUNNEL_SHUTDOWN != t->cstate
2459 && GNUNET_NO == shutting_down) 2459 && GNUNET_NO == shutting_down)
2460 { 2460 {
@@ -2501,10 +2501,10 @@ GCT_add_channel (struct CadetTunnel *t, struct CadetChannel *ch)
2501 LOG (GNUNET_ERROR_TYPE_DEBUG, " adding %p to %p\n", aux, t->channel_head); 2501 LOG (GNUNET_ERROR_TYPE_DEBUG, " adding %p to %p\n", aux, t->channel_head);
2502 GNUNET_CONTAINER_DLL_insert_tail (t->channel_head, t->channel_tail, aux); 2502 GNUNET_CONTAINER_DLL_insert_tail (t->channel_head, t->channel_tail, aux);
2503 2503
2504 if (GNUNET_SCHEDULER_NO_TASK != t->destroy_task) 2504 if (NULL != t->destroy_task)
2505 { 2505 {
2506 GNUNET_SCHEDULER_cancel (t->destroy_task); 2506 GNUNET_SCHEDULER_cancel (t->destroy_task);
2507 t->destroy_task = GNUNET_SCHEDULER_NO_TASK; 2507 t->destroy_task = NULL;
2508 LOG (GNUNET_ERROR_TYPE_DEBUG, " undo destroy!\n"); 2508 LOG (GNUNET_ERROR_TYPE_DEBUG, " undo destroy!\n");
2509 } 2509 }
2510} 2510}
@@ -2585,7 +2585,7 @@ delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2585 "Tunnel at %p should have been freed by GCT_shutdown\n", t); 2585 "Tunnel at %p should have been freed by GCT_shutdown\n", t);
2586 return; 2586 return;
2587 } 2587 }
2588 t->destroy_task = GNUNET_SCHEDULER_NO_TASK; 2588 t->destroy_task = NULL;
2589 t->cstate = CADET_TUNNEL_SHUTDOWN; 2589 t->cstate = CADET_TUNNEL_SHUTDOWN;
2590 2590
2591 for (iter = t->connection_head; NULL != iter; iter = iter->next) 2591 for (iter = t->connection_head; NULL != iter; iter = iter->next)
@@ -2609,7 +2609,7 @@ GCT_destroy_empty (struct CadetTunnel *t)
2609 if (GNUNET_YES == shutting_down) 2609 if (GNUNET_YES == shutting_down)
2610 return; /* Will be destroyed immediately anyway */ 2610 return; /* Will be destroyed immediately anyway */
2611 2611
2612 if (GNUNET_SCHEDULER_NO_TASK != t->destroy_task) 2612 if (NULL != t->destroy_task)
2613 { 2613 {
2614 LOG (GNUNET_ERROR_TYPE_WARNING, 2614 LOG (GNUNET_ERROR_TYPE_WARNING,
2615 "Tunnel %s is already scheduled for destruction. Tunnel debug dump:\n", 2615 "Tunnel %s is already scheduled for destruction. Tunnel debug dump:\n",
@@ -2690,32 +2690,32 @@ GCT_destroy (struct CadetTunnel *t)
2690 /* Should only happen on shutdown, but it's ok. */ 2690 /* Should only happen on shutdown, but it's ok. */
2691 } 2691 }
2692 2692
2693 if (GNUNET_SCHEDULER_NO_TASK != t->destroy_task) 2693 if (NULL != t->destroy_task)
2694 { 2694 {
2695 LOG (GNUNET_ERROR_TYPE_DEBUG, "cancelling dest: %llX\n", t->destroy_task); 2695 LOG (GNUNET_ERROR_TYPE_DEBUG, "cancelling dest: %llX\n", t->destroy_task);
2696 GNUNET_SCHEDULER_cancel (t->destroy_task); 2696 GNUNET_SCHEDULER_cancel (t->destroy_task);
2697 t->destroy_task = GNUNET_SCHEDULER_NO_TASK; 2697 t->destroy_task = NULL;
2698 } 2698 }
2699 2699
2700 if (GNUNET_SCHEDULER_NO_TASK != t->trim_connections_task) 2700 if (NULL != t->trim_connections_task)
2701 { 2701 {
2702 LOG (GNUNET_ERROR_TYPE_DEBUG, "cancelling trim: %llX\n", 2702 LOG (GNUNET_ERROR_TYPE_DEBUG, "cancelling trim: %llX\n",
2703 t->trim_connections_task); 2703 t->trim_connections_task);
2704 GNUNET_SCHEDULER_cancel (t->trim_connections_task); 2704 GNUNET_SCHEDULER_cancel (t->trim_connections_task);
2705 t->trim_connections_task = GNUNET_SCHEDULER_NO_TASK; 2705 t->trim_connections_task = NULL;
2706 } 2706 }
2707 2707
2708 GNUNET_STATISTICS_update (stats, "# tunnels", -1, GNUNET_NO); 2708 GNUNET_STATISTICS_update (stats, "# tunnels", -1, GNUNET_NO);
2709 GCP_set_tunnel (t->peer, NULL); 2709 GCP_set_tunnel (t->peer, NULL);
2710 2710
2711 if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) 2711 if (NULL != t->rekey_task)
2712 { 2712 {
2713 GNUNET_SCHEDULER_cancel (t->rekey_task); 2713 GNUNET_SCHEDULER_cancel (t->rekey_task);
2714 t->rekey_task = GNUNET_SCHEDULER_NO_TASK; 2714 t->rekey_task = NULL;
2715 } 2715 }
2716 if (NULL != t->kx_ctx) 2716 if (NULL != t->kx_ctx)
2717 { 2717 {
2718 if (GNUNET_SCHEDULER_NO_TASK != t->kx_ctx->finish_task) 2718 if (NULL != t->kx_ctx->finish_task)
2719 GNUNET_SCHEDULER_cancel (t->kx_ctx->finish_task); 2719 GNUNET_SCHEDULER_cancel (t->kx_ctx->finish_task);
2720 GNUNET_free (t->kx_ctx); 2720 GNUNET_free (t->kx_ctx);
2721 } 2721 }
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c
index b9661a9b7..df605d0a9 100644
--- a/src/cadet/test_cadet.c
+++ b/src/cadet/test_cadet.c
@@ -144,17 +144,17 @@ struct GNUNET_CADET_TEST_Context *test_ctx;
144/** 144/**
145 * Task called to disconnect peers. 145 * Task called to disconnect peers.
146 */ 146 */
147static GNUNET_SCHEDULER_TaskIdentifier disconnect_task; 147static struct GNUNET_SCHEDULER_Task * disconnect_task;
148 148
149/** 149/**
150 * Task To perform tests 150 * Task To perform tests
151 */ 151 */
152static GNUNET_SCHEDULER_TaskIdentifier test_task; 152static struct GNUNET_SCHEDULER_Task * test_task;
153 153
154/** 154/**
155 * Task called to shutdown test. 155 * Task called to shutdown test.
156 */ 156 */
157static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle; 157static struct GNUNET_SCHEDULER_Task * shutdown_handle;
158 158
159/** 159/**
160 * Cadet handle for the root peer 160 * Cadet handle for the root peer
@@ -254,7 +254,7 @@ static void
254shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 254shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
255{ 255{
256 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n"); 256 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n");
257 shutdown_handle = GNUNET_SCHEDULER_NO_TASK; 257 shutdown_handle = NULL;
258} 258}
259 259
260 260
@@ -278,7 +278,7 @@ disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc
278 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 278 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
279 "disconnecting cadet service of peers, called from line %ld\n", 279 "disconnecting cadet service of peers, called from line %ld\n",
280 line); 280 line);
281 disconnect_task = GNUNET_SCHEDULER_NO_TASK; 281 disconnect_task = NULL;
282 for (i = 0; i < 2; i++) 282 for (i = 0; i < 2; i++)
283 { 283 {
284 GNUNET_TESTBED_operation_done (t_op[i]); 284 GNUNET_TESTBED_operation_done (t_op[i]);
@@ -294,7 +294,7 @@ disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc
294 incoming_ch = NULL; 294 incoming_ch = NULL;
295 } 295 }
296 GNUNET_CADET_TEST_cleanup (test_ctx); 296 GNUNET_CADET_TEST_cleanup (test_ctx);
297 if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle) 297 if (NULL != shutdown_handle)
298 { 298 {
299 GNUNET_SCHEDULER_cancel (shutdown_handle); 299 GNUNET_SCHEDULER_cancel (shutdown_handle);
300 } 300 }
@@ -310,7 +310,7 @@ disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc
310static void 310static void
311abort_test (long line) 311abort_test (long line)
312{ 312{
313 if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) 313 if (disconnect_task != NULL)
314 { 314 {
315 GNUNET_SCHEDULER_cancel (disconnect_task); 315 GNUNET_SCHEDULER_cancel (disconnect_task);
316 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, 316 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
@@ -474,7 +474,7 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
474 474
475 if ((ok % 20) == 0) 475 if ((ok % 20) == 0)
476 { 476 {
477 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) 477 if (NULL != disconnect_task)
478 { 478 {
479 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " reschedule timeout\n"); 479 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " reschedule timeout\n");
480 GNUNET_SCHEDULER_cancel (disconnect_task); 480 GNUNET_SCHEDULER_cancel (disconnect_task);
@@ -573,7 +573,7 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
573 } 573 }
574 } 574 }
575 575
576 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) 576 if (NULL != disconnect_task)
577 { 577 {
578 GNUNET_SCHEDULER_cancel (disconnect_task); 578 GNUNET_SCHEDULER_cancel (disconnect_task);
579 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, 579 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
@@ -604,7 +604,7 @@ stats_cont (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
604 ok--; 604 ok--;
605 GNUNET_TESTBED_operation_done (stats_op); 605 GNUNET_TESTBED_operation_done (stats_op);
606 606
607 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) 607 if (NULL != disconnect_task)
608 GNUNET_SCHEDULER_cancel (disconnect_task); 608 GNUNET_SCHEDULER_cancel (disconnect_task);
609 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, 609 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
610 (void *) __LINE__); 610 (void *) __LINE__);
@@ -657,7 +657,7 @@ check_keepalives (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
657 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 657 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
658 return; 658 return;
659 659
660 disconnect_task = GNUNET_SCHEDULER_NO_TASK; 660 disconnect_task = NULL;
661 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "check keepalives\n"); 661 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "check keepalives\n");
662 GNUNET_CADET_channel_destroy (ch); 662 GNUNET_CADET_channel_destroy (ch);
663 stats_op = GNUNET_TESTBED_get_statistics (peers_running, testbed_peers, 663 stats_op = GNUNET_TESTBED_get_statistics (peers_running, testbed_peers,
@@ -705,7 +705,7 @@ incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel,
705 "Incoming channel for unknown client %lu\n", (long) cls); 705 "Incoming channel for unknown client %lu\n", (long) cls);
706 GNUNET_break(0); 706 GNUNET_break(0);
707 } 707 }
708 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) 708 if (NULL != disconnect_task)
709 { 709 {
710 GNUNET_SCHEDULER_cancel (disconnect_task); 710 GNUNET_SCHEDULER_cancel (disconnect_task);
711 if (KEEPALIVE == test) 711 if (KEEPALIVE == test)
@@ -761,7 +761,7 @@ channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel,
761 "Unknown peer! %d\n", i); 761 "Unknown peer! %d\n", i);
762 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok); 762 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok);
763 763
764 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) 764 if (NULL != disconnect_task)
765 { 765 {
766 GNUNET_SCHEDULER_cancel (disconnect_task); 766 GNUNET_SCHEDULER_cancel (disconnect_task);
767 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, 767 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
@@ -791,7 +791,7 @@ do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
791 791
792 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test_task\n"); 792 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test_task\n");
793 793
794 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) 794 if (NULL != disconnect_task)
795 { 795 {
796 GNUNET_SCHEDULER_cancel (disconnect_task); 796 GNUNET_SCHEDULER_cancel (disconnect_task);
797 } 797 }
diff --git a/src/cadet/test_cadet_local.c b/src/cadet/test_cadet_local.c
index 0796aaf12..d66f0a3d4 100644
--- a/src/cadet/test_cadet_local.c
+++ b/src/cadet/test_cadet_local.c
@@ -42,9 +42,9 @@ static int result = GNUNET_OK;
42 42
43static int got_data = GNUNET_NO; 43static int got_data = GNUNET_NO;
44 44
45static GNUNET_SCHEDULER_TaskIdentifier abort_task; 45static struct GNUNET_SCHEDULER_Task * abort_task;
46 46
47static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; 47static struct GNUNET_SCHEDULER_Task * shutdown_task;
48 48
49static struct GNUNET_CADET_TransmitHandle *mth; 49static struct GNUNET_CADET_TransmitHandle *mth;
50 50
@@ -66,7 +66,7 @@ static void
66do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 66do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
67{ 67{
68 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n"); 68 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n");
69 if (GNUNET_SCHEDULER_NO_TASK != abort_task) 69 if (NULL != abort_task)
70 { 70 {
71 GNUNET_SCHEDULER_cancel (abort_task); 71 GNUNET_SCHEDULER_cancel (abort_task);
72 } 72 }
@@ -95,11 +95,11 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
95{ 95{
96 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n"); 96 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n");
97 result = GNUNET_SYSERR; 97 result = GNUNET_SYSERR;
98 abort_task = GNUNET_SCHEDULER_NO_TASK; 98 abort_task = NULL;
99 if (GNUNET_SCHEDULER_NO_TASK != shutdown_task) 99 if (NULL != shutdown_task)
100 { 100 {
101 GNUNET_SCHEDULER_cancel (shutdown_task); 101 GNUNET_SCHEDULER_cancel (shutdown_task);
102 shutdown_task = GNUNET_SCHEDULER_NO_TASK; 102 shutdown_task = NULL;
103 } 103 }
104 do_shutdown (cls, tc); 104 do_shutdown (cls, tc);
105} 105}
@@ -123,7 +123,7 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
123{ 123{
124 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data callback! Shutting down.\n"); 124 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data callback! Shutting down.\n");
125 got_data = GNUNET_YES; 125 got_data = GNUNET_YES;
126 if (GNUNET_SCHEDULER_NO_TASK != shutdown_task) 126 if (NULL != shutdown_task)
127 GNUNET_SCHEDULER_cancel (shutdown_task); 127 GNUNET_SCHEDULER_cancel (shutdown_task);
128 shutdown_task = 128 shutdown_task =
129 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown, 129 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 3780c745c..29f2bf76f 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;
43 43
44static int result; 44static int result;
45 45
46static GNUNET_SCHEDULER_TaskIdentifier abort_task; 46static struct GNUNET_SCHEDULER_Task * abort_task;
47 47
48static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; 48static struct GNUNET_SCHEDULER_Task * shutdown_task;
49 49
50static unsigned int repetition; 50static unsigned int repetition;
51 51
@@ -62,7 +62,7 @@ static void
62do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 62do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
63{ 63{
64 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n"); 64 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n");
65 if (GNUNET_SCHEDULER_NO_TASK != abort_task) 65 if (NULL != abort_task)
66 { 66 {
67 GNUNET_SCHEDULER_cancel (abort_task); 67 GNUNET_SCHEDULER_cancel (abort_task);
68 } 68 }
@@ -92,11 +92,11 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
92{ 92{
93 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n"); 93 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n");
94 result = GNUNET_SYSERR; 94 result = GNUNET_SYSERR;
95 abort_task = GNUNET_SCHEDULER_NO_TASK; 95 abort_task = NULL;
96 if (GNUNET_SCHEDULER_NO_TASK != shutdown_task) 96 if (NULL != shutdown_task)
97 { 97 {
98 GNUNET_SCHEDULER_cancel (shutdown_task); 98 GNUNET_SCHEDULER_cancel (shutdown_task);
99 shutdown_task = GNUNET_SCHEDULER_NO_TASK; 99 shutdown_task = NULL;
100 } 100 }
101 do_shutdown (cls, tc); 101 do_shutdown (cls, tc);
102} 102}
@@ -105,7 +105,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
105static void 105static void
106finish (void) 106finish (void)
107{ 107{
108 if (GNUNET_SCHEDULER_NO_TASK != shutdown_task) 108 if (NULL != shutdown_task)
109 GNUNET_SCHEDULER_cancel (shutdown_task); 109 GNUNET_SCHEDULER_cancel (shutdown_task);
110 shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 110 shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
111 &do_shutdown, NULL); 111 &do_shutdown, NULL);