aboutsummaryrefslogtreecommitdiff
path: root/src/cadet
diff options
context:
space:
mode:
Diffstat (limited to 'src/cadet')
-rw-r--r--src/cadet/cadet_api.c16
-rw-r--r--src/cadet/cadet_path.c5
-rw-r--r--src/cadet/gnunet-cadet-profiler.c41
-rw-r--r--src/cadet/gnunet-cadet.c54
-rw-r--r--src/cadet/gnunet-service-cadet.c3
-rw-r--r--src/cadet/gnunet-service-cadet_channel.c11
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c40
-rw-r--r--src/cadet/gnunet-service-cadet_dht.c5
-rw-r--r--src/cadet/gnunet-service-cadet_peer.c9
-rw-r--r--src/cadet/gnunet-service-cadet_tunnel.c39
-rw-r--r--src/cadet/test_cadet.c28
-rw-r--r--src/cadet/test_cadet_local.c25
-rw-r--r--src/cadet/test_cadet_single.c11
13 files changed, 148 insertions, 139 deletions
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index a1fe90cc5..6894d2482 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -513,10 +513,9 @@ destroy_channel (struct GNUNET_CADET_Channel *ch, int call_cleaner)
513 * Notify client that the transmission has timed out 513 * Notify client that the transmission has timed out
514 * 514 *
515 * @param cls closure 515 * @param cls closure
516 * @param tc task context
517 */ 516 */
518static void 517static void
519timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 518timeout_transmission (void *cls)
520{ 519{
521 struct GNUNET_CADET_TransmitHandle *th = cls; 520 struct GNUNET_CADET_TransmitHandle *th = cls;
522 struct GNUNET_CADET_Handle *cadet = th->channel->cadet; 521 struct GNUNET_CADET_Handle *cadet = th->channel->cadet;
@@ -594,12 +593,12 @@ send_ack (struct GNUNET_CADET_Channel *ch)
594 593
595/** 594/**
596 * Reconnect callback: tries to reconnect again after a failer previous 595 * Reconnect callback: tries to reconnect again after a failer previous
597 * reconnecttion 596 * reconnection.
597 *
598 * @param cls closure (cadet handle) 598 * @param cls closure (cadet handle)
599 * @param tc task context
600 */ 599 */
601static void 600static void
602reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); 601reconnect_cbk (void *cls);
603 602
604 603
605/** 604/**
@@ -696,15 +695,17 @@ do_reconnect (struct GNUNET_CADET_Handle *h)
696/** 695/**
697 * Reconnect callback: tries to reconnect again after a failer previous 696 * Reconnect callback: tries to reconnect again after a failer previous
698 * reconnecttion 697 * reconnecttion
698 *
699 * @param cls closure (cadet handle) 699 * @param cls closure (cadet handle)
700 * @param tc task context
701 */ 700 */
702static void 701static void
703reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 702reconnect_cbk (void *cls)
704{ 703{
705 struct GNUNET_CADET_Handle *h = cls; 704 struct GNUNET_CADET_Handle *h = cls;
705 const struct GNUNET_SCHEDULER_TaskContext *tc;
706 706
707 h->reconnect_task = NULL; 707 h->reconnect_task = NULL;
708 tc = GNUNET_SCHEDULER_get_task_context ();
708 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 709 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
709 return; 710 return;
710 do_reconnect (h); 711 do_reconnect (h);
@@ -2171,4 +2172,3 @@ GNUNET_CADET_mq_create (struct GNUNET_CADET_Channel *channel)
2171 NULL); /* no handler cls */ 2172 NULL); /* no handler cls */
2172 return mq; 2173 return mq;
2173} 2174}
2174
diff --git a/src/cadet/cadet_path.c b/src/cadet/cadet_path.c
index 1ea2b185f..47241292b 100644
--- a/src/cadet/cadet_path.c
+++ b/src/cadet/cadet_path.c
@@ -39,18 +39,19 @@
39 * Removes the path from the peer (except for direct paths). 39 * Removes the path from the peer (except for direct paths).
40 * 40 *
41 * @param cls Closure (path to destroy). 41 * @param cls Closure (path to destroy).
42 * @param tc Task context.
43 */ 42 */
44static void 43static void
45path_destroy_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 44path_destroy_delayed (void *cls)
46{ 45{
47 struct CadetPeerPath *path = cls; 46 struct CadetPeerPath *path = cls;
48 struct CadetPeer *peer; 47 struct CadetPeer *peer;
48 const struct GNUNET_SCHEDULER_TaskContext *tc;
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 = NULL; 51 path->path_delete = NULL;
52 52
53 /* During shutdown, the peers peermap might not exist anymore. */ 53 /* During shutdown, the peers peermap might not exist anymore. */
54 tc = GNUNET_SCHEDULER_get_task_context ();
54 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) == 0) 55 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) == 0)
55 { 56 {
56 if (2 >= path->length) 57 if (2 >= path->length)
diff --git a/src/cadet/gnunet-cadet-profiler.c b/src/cadet/gnunet-cadet-profiler.c
index bda844b13..ffa993f8e 100644
--- a/src/cadet/gnunet-cadet-profiler.c
+++ b/src/cadet/gnunet-cadet-profiler.c
@@ -249,10 +249,9 @@ static int test_finished;
249 * on callback funtion ch. 249 * on callback funtion ch.
250 * 250 *
251 * @param cls Closure (unsued). 251 * @param cls Closure (unsued).
252 * @param tc Task Context.
253 */ 252 */
254static void 253static void
255start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); 254start_test (void *cls);
256 255
257 256
258/** 257/**
@@ -314,10 +313,9 @@ show_end_data (void)
314 * Shut down peergroup, clean up. 313 * Shut down peergroup, clean up.
315 * 314 *
316 * @param cls Closure (unused). 315 * @param cls Closure (unused).
317 * @param tc Task Context.
318 */ 316 */
319static void 317static void
320shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 318shutdown_task (void *cls)
321{ 319{
322 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Ending test.\n"); 320 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Ending test.\n");
323 shutdown_handle = NULL; 321 shutdown_handle = NULL;
@@ -328,10 +326,9 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
328 * Disconnect from cadet services af all peers, call shutdown. 326 * Disconnect from cadet services af all peers, call shutdown.
329 * 327 *
330 * @param cls Closure (unused). 328 * @param cls Closure (unused).
331 * @param tc Task Context.
332 */ 329 */
333static void 330static void
334disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 331disconnect_cadet_peers (void *cls)
335{ 332{
336 long line = (long) cls; 333 long line = (long) cls;
337 unsigned int i; 334 unsigned int i;
@@ -443,11 +440,13 @@ stats_iterator (void *cls, const struct GNUNET_TESTBED_Peer *peer,
443 * Task check that keepalives were sent and received. 440 * Task check that keepalives were sent and received.
444 * 441 *
445 * @param cls Closure (NULL). 442 * @param cls Closure (NULL).
446 * @param tc Task Context.
447 */ 443 */
448static void 444static void
449collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 445collect_stats (void *cls)
450{ 446{
447 const struct GNUNET_SCHEDULER_TaskContext *tc;
448
449 tc = GNUNET_SCHEDULER_get_task_context ();
451 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 450 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
452 return; 451 return;
453 452
@@ -462,11 +461,13 @@ collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
462 * @brief Finish profiler normally. Signal finish and start collecting stats. 461 * @brief Finish profiler normally. Signal finish and start collecting stats.
463 * 462 *
464 * @param cls Closure (unused). 463 * @param cls Closure (unused).
465 * @param tc Task context.
466 */ 464 */
467static void 465static void
468finish_profiler (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 466finish_profiler (void *cls)
469{ 467{
468 const struct GNUNET_SCHEDULER_TaskContext *tc;
469
470 tc = GNUNET_SCHEDULER_get_task_context ();
470 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 471 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
471 return; 472 return;
472 473
@@ -542,11 +543,13 @@ adjust_running_peers (unsigned int target)
542 * @brief Move to next round. 543 * @brief Move to next round.
543 * 544 *
544 * @param cls Closure (round #). 545 * @param cls Closure (round #).
545 * @param tc Task context.
546 */ 546 */
547static void 547static void
548next_rnd (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 548next_rnd (void *cls)
549{ 549{
550 const struct GNUNET_SCHEDULER_TaskContext *tc;
551
552 tc = GNUNET_SCHEDULER_get_task_context ();
550 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 553 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
551 return; 554 return;
552 555
@@ -608,15 +611,15 @@ tmt_rdy_pong (void *cls, size_t size, void *buf)
608 * @brief Send a ping to destination 611 * @brief Send a ping to destination
609 * 612 *
610 * @param cls Closure (peer). 613 * @param cls Closure (peer).
611 * @param tc Task context.
612 */ 614 */
613static void 615static void
614ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 616ping (void *cls)
615{ 617{
616 struct CadetPeer *peer = (struct CadetPeer *) cls; 618 struct CadetPeer *peer = cls;
619 const struct GNUNET_SCHEDULER_TaskContext *tc;
617 620
618 peer->ping_task = NULL; 621 peer->ping_task = NULL;
619 622 tc = GNUNET_SCHEDULER_get_task_context ();
620 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) 623 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)
621 || GNUNET_YES == test_finished) 624 || GNUNET_YES == test_finished)
622 return; 625 return;
@@ -865,15 +868,16 @@ select_random_peer (struct CadetPeer *peer)
865 * on callback funtion ch. 868 * on callback funtion ch.
866 * 869 *
867 * @param cls Closure (unsued). 870 * @param cls Closure (unsued).
868 * @param tc Task Context.
869 */ 871 */
870static void 872static void
871start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 873start_test (void *cls)
872{ 874{
873 enum GNUNET_CADET_ChannelOption flags; 875 enum GNUNET_CADET_ChannelOption flags;
874 unsigned long i; 876 unsigned long i;
877 const struct GNUNET_SCHEDULER_TaskContext *tc;
875 878
876 test_task = NULL; 879 test_task = NULL;
880 tc = GNUNET_SCHEDULER_get_task_context ();
877 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 881 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
878 return; 882 return;
879 883
@@ -1089,4 +1093,3 @@ main (int argc, char *argv[])
1089} 1093}
1090 1094
1091/* end of gnunet-cadet-profiler.c */ 1095/* end of gnunet-cadet-profiler.c */
1092
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c
index 5c5ec54b9..14b499aae 100644
--- a/src/cadet/gnunet-cadet.c
+++ b/src/cadet/gnunet-cadet.c
@@ -191,11 +191,9 @@ conn_2s (uint16_t status)
191 * Stops monitoring activity. 191 * Stops monitoring activity.
192 * 192 *
193 * @param cls Closure (unused). 193 * @param cls Closure (unused).
194 * @param tc scheduler context
195 */ 194 */
196static void 195static void
197shutdown_task (void *cls, 196shutdown_task (void *cls)
198 const struct GNUNET_SCHEDULER_TaskContext *tc)
199{ 197{
200 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n"); 198 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
201 if (NULL != th) 199 if (NULL != th)
@@ -268,14 +266,14 @@ data_ready (void *cls, size_t size, void *buf)
268 * Task run in stdio mode, after some data is available at stdin. 266 * Task run in stdio mode, after some data is available at stdin.
269 * 267 *
270 * @param cls Closure (unused). 268 * @param cls Closure (unused).
271 * @param tc scheduler context
272 */ 269 */
273static void 270static void
274read_stdio (void *cls, 271read_stdio (void *cls)
275 const struct GNUNET_SCHEDULER_TaskContext *tc)
276{ 272{
277 static char buf[60000]; 273 static char buf[60000];
274 const struct GNUNET_SCHEDULER_TaskContext *tc;
278 275
276 tc = GNUNET_SCHEDULER_get_task_context ();
279 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 277 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
280 { 278 {
281 return; 279 return;
@@ -406,11 +404,13 @@ channel_incoming (void *cls,
406 * @brief Send an echo request to the remote peer. 404 * @brief Send an echo request to the remote peer.
407 * 405 *
408 * @param cls Closure (NULL). 406 * @param cls Closure (NULL).
409 * @param tc Task context.
410 */ 407 */
411static void 408static void
412send_echo (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 409send_echo (void *cls)
413{ 410{
411 const struct GNUNET_SCHEDULER_TaskContext *tc;
412
413 tc = GNUNET_SCHEDULER_get_task_context ();
414 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) || NULL == ch) 414 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) || NULL == ch)
415 return; 415 return;
416 416
@@ -426,10 +426,9 @@ send_echo (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
426 * Call CADET's monitor API, request debug dump on the service. 426 * Call CADET's monitor API, request debug dump on the service.
427 * 427 *
428 * @param cls Closure (unused). 428 * @param cls Closure (unused).
429 * @param tc TaskContext
430 */ 429 */
431static void 430static void
432request_dump (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 431request_dump (void *cls)
433{ 432{
434 GNUNET_CADET_request_dump (mh); 433 GNUNET_CADET_request_dump (mh);
435 GNUNET_SCHEDULER_cancel (sd); 434 GNUNET_SCHEDULER_cancel (sd);
@@ -441,10 +440,9 @@ request_dump (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
441 * Call CADET's monitor API, get info of one connection. 440 * Call CADET's monitor API, get info of one connection.
442 * 441 *
443 * @param cls Closure (unused). 442 * @param cls Closure (unused).
444 * @param tc TaskContext
445 */ 443 */
446static void 444static void
447create_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 445create_channel (void *cls)
448{ 446{
449 struct GNUNET_PeerIdentity pid; 447 struct GNUNET_PeerIdentity pid;
450 enum GNUNET_CADET_ChannelOption opt; 448 enum GNUNET_CADET_ChannelOption opt;
@@ -703,11 +701,13 @@ tunnel_callback (void *cls,
703 * Call CADET's meta API, get all peers known to a peer. 701 * Call CADET's meta API, get all peers known to a peer.
704 * 702 *
705 * @param cls Closure (unused). 703 * @param cls Closure (unused).
706 * @param tc TaskContext
707 */ 704 */
708static void 705static void
709get_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 706get_peers (void *cls)
710{ 707{
708 const struct GNUNET_SCHEDULER_TaskContext *tc;
709
710 tc = GNUNET_SCHEDULER_get_task_context ();
711 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 711 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
712 { 712 {
713 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n"); 713 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
@@ -721,18 +721,17 @@ get_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
721 * Call CADET's monitor API, get info of one peer. 721 * Call CADET's monitor API, get info of one peer.
722 * 722 *
723 * @param cls Closure (unused). 723 * @param cls Closure (unused).
724 * @param tc TaskContext
725 */ 724 */
726static void 725static void
727show_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 726show_peer (void *cls)
728{ 727{
729 struct GNUNET_PeerIdentity pid; 728 struct GNUNET_PeerIdentity pid;
730 729
731 if (GNUNET_OK != 730 if (GNUNET_OK !=
732 GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id, 731 GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id,
733 strlen (peer_id), 732 strlen (peer_id),
734 &pid.public_key)) 733 &pid.public_key))
735 { 734 {
736 fprintf (stderr, 735 fprintf (stderr,
737 _("Invalid peer ID `%s'\n"), 736 _("Invalid peer ID `%s'\n"),
738 peer_id); 737 peer_id);
@@ -746,11 +745,13 @@ show_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
746 * Call CADET's meta API, get all tunnels known to a peer. 745 * Call CADET's meta API, get all tunnels known to a peer.
747 * 746 *
748 * @param cls Closure (unused). 747 * @param cls Closure (unused).
749 * @param tc TaskContext
750 */ 748 */
751static void 749static void
752get_tunnels (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 750get_tunnels (void *cls)
753{ 751{
752 const struct GNUNET_SCHEDULER_TaskContext *tc;
753
754 tc = GNUNET_SCHEDULER_get_task_context ();
754 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 755 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
755 { 756 {
756 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n"); 757 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
@@ -764,10 +765,9 @@ get_tunnels (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
764 * Call CADET's monitor API, get info of one tunnel. 765 * Call CADET's monitor API, get info of one tunnel.
765 * 766 *
766 * @param cls Closure (unused). 767 * @param cls Closure (unused).
767 * @param tc TaskContext
768 */ 768 */
769static void 769static void
770show_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 770show_tunnel (void *cls)
771{ 771{
772 struct GNUNET_PeerIdentity pid; 772 struct GNUNET_PeerIdentity pid;
773 773
@@ -790,10 +790,9 @@ show_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
790 * Call CADET's monitor API, get info of one channel. 790 * Call CADET's monitor API, get info of one channel.
791 * 791 *
792 * @param cls Closure (unused). 792 * @param cls Closure (unused).
793 * @param tc TaskContext
794 */ 793 */
795static void 794static void
796show_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 795show_channel (void *cls)
797{ 796{
798 797
799} 798}
@@ -803,10 +802,9 @@ show_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
803 * Call CADET's monitor API, get info of one connection. 802 * Call CADET's monitor API, get info of one connection.
804 * 803 *
805 * @param cls Closure (unused). 804 * @param cls Closure (unused).
806 * @param tc TaskContext
807 */ 805 */
808static void 806static void
809show_connection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 807show_connection (void *cls)
810{ 808{
811 809
812} 810}
diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c
index 86f1692e1..a2e00300b 100644
--- a/src/cadet/gnunet-service-cadet.c
+++ b/src/cadet/gnunet-service-cadet.c
@@ -98,10 +98,9 @@ static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key;
98 * Task run during shutdown. 98 * Task run during shutdown.
99 * 99 *
100 * @param cls unused 100 * @param cls unused
101 * @param tc unused
102 */ 101 */
103static void 102static void
104shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 103shutdown_task (void *cls)
105{ 104{
106 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutting down\n"); 105 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutting down\n");
107 106
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c
index a2e01d28f..debae7d77 100644
--- a/src/cadet/gnunet-service-cadet_channel.c
+++ b/src/cadet/gnunet-service-cadet_channel.c
@@ -721,19 +721,19 @@ send_client_nack (struct CadetChannel *ch)
721 * We haven't received an ACK after a certain time: restransmit the message. 721 * We haven't received an ACK after a certain time: restransmit the message.
722 * 722 *
723 * @param cls Closure (CadetChannelReliability with the message to restransmit) 723 * @param cls Closure (CadetChannelReliability with the message to restransmit)
724 * @param tc TaskContext.
725 */ 724 */
726static void 725static void
727channel_retransmit_message (void *cls, 726channel_retransmit_message (void *cls)
728 const struct GNUNET_SCHEDULER_TaskContext *tc)
729{ 727{
730 struct CadetChannelReliability *rel = cls; 728 struct CadetChannelReliability *rel = cls;
731 struct CadetReliableMessage *copy; 729 struct CadetReliableMessage *copy;
732 struct CadetChannel *ch; 730 struct CadetChannel *ch;
733 struct GNUNET_CADET_Data *payload; 731 struct GNUNET_CADET_Data *payload;
734 int fwd; 732 int fwd;
733 const struct GNUNET_SCHEDULER_TaskContext *tc;
735 734
736 rel->retry_task = NULL; 735 rel->retry_task = NULL;
736 tc = GNUNET_SCHEDULER_get_task_context ();
737 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 737 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
738 return; 738 return;
739 739
@@ -760,14 +760,15 @@ channel_retransmit_message (void *cls,
760 * We haven't received an Channel ACK after a certain time: resend the CREATE. 760 * We haven't received an Channel ACK after a certain time: resend the CREATE.
761 * 761 *
762 * @param cls Closure (CadetChannelReliability of the channel to recreate) 762 * @param cls Closure (CadetChannelReliability of the channel to recreate)
763 * @param tc TaskContext.
764 */ 763 */
765static void 764static void
766channel_recreate (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 765channel_recreate (void *cls)
767{ 766{
768 struct CadetChannelReliability *rel = cls; 767 struct CadetChannelReliability *rel = cls;
768 const struct GNUNET_SCHEDULER_TaskContext *tc;
769 769
770 rel->retry_task = NULL; 770 rel->retry_task = NULL;
771 tc = GNUNET_SCHEDULER_get_task_context ();
771 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 772 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
772 return; 773 return;
773 774
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index 186204f1e..d11368a79 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -1221,13 +1221,14 @@ connection_keepalive (struct CadetConnection *c, int fwd, int shutdown)
1221 * Keep the connection alive in the FWD direction. 1221 * Keep the connection alive in the FWD direction.
1222 * 1222 *
1223 * @param cls Closure (connection to keepalive). 1223 * @param cls Closure (connection to keepalive).
1224 * @param tc TaskContext.
1225 */ 1224 */
1226static void 1225static void
1227connection_fwd_keepalive (void *cls, 1226connection_fwd_keepalive (void *cls)
1228 const struct GNUNET_SCHEDULER_TaskContext *tc)
1229{ 1227{
1228 const struct GNUNET_SCHEDULER_TaskContext *tc;
1229
1230 GCC_check_connections (); 1230 GCC_check_connections ();
1231 tc = GNUNET_SCHEDULER_get_task_context ();
1231 connection_keepalive ((struct CadetConnection *) cls, 1232 connection_keepalive ((struct CadetConnection *) cls,
1232 GNUNET_YES, 1233 GNUNET_YES,
1233 tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN); 1234 tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN);
@@ -1239,13 +1240,14 @@ connection_fwd_keepalive (void *cls,
1239 * Keep the connection alive in the BCK direction. 1240 * Keep the connection alive in the BCK direction.
1240 * 1241 *
1241 * @param cls Closure (connection to keepalive). 1242 * @param cls Closure (connection to keepalive).
1242 * @param tc TaskContext.
1243 */ 1243 */
1244static void 1244static void
1245connection_bck_keepalive (void *cls, 1245connection_bck_keepalive (void *cls)
1246 const struct GNUNET_SCHEDULER_TaskContext *tc)
1247{ 1246{
1247 const struct GNUNET_SCHEDULER_TaskContext *tc;
1248
1248 GCC_check_connections (); 1249 GCC_check_connections ();
1250 tc = GNUNET_SCHEDULER_get_task_context ();
1249 connection_keepalive ((struct CadetConnection *) cls, 1251 connection_keepalive ((struct CadetConnection *) cls,
1250 GNUNET_NO, 1252 GNUNET_NO,
1251 tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN); 1253 tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN);
@@ -1400,11 +1402,9 @@ connection_cancel_queues (struct CadetConnection *c,
1400 * possibly due to a missed ACK. Poll the neighbor about its ACK status. 1402 * possibly due to a missed ACK. Poll the neighbor about its ACK status.
1401 * 1403 *
1402 * @param cls Closure (poll ctx). 1404 * @param cls Closure (poll ctx).
1403 * @param tc TaskContext.
1404 */ 1405 */
1405static void 1406static void
1406connection_poll (void *cls, 1407connection_poll (void *cls);
1407 const struct GNUNET_SCHEDULER_TaskContext *tc);
1408 1408
1409 1409
1410/** 1410/**
@@ -1453,18 +1453,19 @@ poll_sent (void *cls,
1453 * possibly due to a missed ACK. Poll the neighbor about its ACK status. 1453 * possibly due to a missed ACK. Poll the neighbor about its ACK status.
1454 * 1454 *
1455 * @param cls Closure (poll ctx). 1455 * @param cls Closure (poll ctx).
1456 * @param tc TaskContext.
1457 */ 1456 */
1458static void 1457static void
1459connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1458connection_poll (void *cls)
1460{ 1459{
1461 struct CadetFlowControl *fc = cls; 1460 struct CadetFlowControl *fc = cls;
1462 struct GNUNET_CADET_Poll msg; 1461 struct GNUNET_CADET_Poll msg;
1463 struct CadetConnection *c; 1462 struct CadetConnection *c;
1464 int fwd; 1463 int fwd;
1464 const struct GNUNET_SCHEDULER_TaskContext *tc;
1465 1465
1466 fc->poll_task = NULL; 1466 fc->poll_task = NULL;
1467 GCC_check_connections (); 1467 GCC_check_connections ();
1468 tc = GNUNET_SCHEDULER_get_task_context ();
1468 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1469 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1469 { 1470 {
1470 return; 1471 return;
@@ -1586,15 +1587,15 @@ connection_timeout (struct CadetConnection *c, int fwd)
1586 * Destroys connection if called. 1587 * Destroys connection if called.
1587 * 1588 *
1588 * @param cls Closure (connection to destroy). 1589 * @param cls Closure (connection to destroy).
1589 * @param tc TaskContext.
1590 */ 1590 */
1591static void 1591static void
1592connection_fwd_timeout (void *cls, 1592connection_fwd_timeout (void *cls)
1593 const struct GNUNET_SCHEDULER_TaskContext *tc)
1594{ 1593{
1595 struct CadetConnection *c = cls; 1594 struct CadetConnection *c = cls;
1595 const struct GNUNET_SCHEDULER_TaskContext *tc;
1596 1596
1597 c->fwd_maintenance_task = NULL; 1597 c->fwd_maintenance_task = NULL;
1598 tc = GNUNET_SCHEDULER_get_task_context ();
1598 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1599 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1599 return; 1600 return;
1600 GCC_check_connections (); 1601 GCC_check_connections ();
@@ -1608,15 +1609,15 @@ connection_fwd_timeout (void *cls,
1608 * Destroys connection if called. 1609 * Destroys connection if called.
1609 * 1610 *
1610 * @param cls Closure (connection to destroy). 1611 * @param cls Closure (connection to destroy).
1611 * @param tc TaskContext
1612 */ 1612 */
1613static void 1613static void
1614connection_bck_timeout (void *cls, 1614connection_bck_timeout (void *cls)
1615 const struct GNUNET_SCHEDULER_TaskContext *tc)
1616{ 1615{
1617 struct CadetConnection *c = cls; 1616 struct CadetConnection *c = cls;
1617 const struct GNUNET_SCHEDULER_TaskContext *tc;
1618 1618
1619 c->bck_maintenance_task = NULL; 1619 c->bck_maintenance_task = NULL;
1620 tc = GNUNET_SCHEDULER_get_task_context ();
1620 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1621 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1621 return; 1622 return;
1622 GCC_check_connections (); 1623 GCC_check_connections ();
@@ -1761,14 +1762,15 @@ does_connection_exist (struct CadetConnection *conn)
1761 * connection with the same path, and destroy one if so. 1762 * connection with the same path, and destroy one if so.
1762 * 1763 *
1763 * @param cls Closure (connection to check). 1764 * @param cls Closure (connection to check).
1764 * @param tc Task context.
1765 */ 1765 */
1766static void 1766static void
1767check_duplicates (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1767check_duplicates (void *cls)
1768{ 1768{
1769 struct CadetConnection *c = cls; 1769 struct CadetConnection *c = cls;
1770 const struct GNUNET_SCHEDULER_TaskContext *tc;
1770 1771
1771 c->check_duplicates_task = NULL; 1772 c->check_duplicates_task = NULL;
1773 tc = GNUNET_SCHEDULER_get_task_context ();
1772 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1774 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1773 return; 1775 return;
1774 1776
diff --git a/src/cadet/gnunet-service-cadet_dht.c b/src/cadet/gnunet-service-cadet_dht.c
index 2e8e53a9d..088d40eac 100644
--- a/src/cadet/gnunet-service-cadet_dht.c
+++ b/src/cadet/gnunet-service-cadet_dht.c
@@ -206,17 +206,18 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
206 * Periodically announce self id in the DHT 206 * Periodically announce self id in the DHT
207 * 207 *
208 * @param cls closure 208 * @param cls closure
209 * @param tc task context
210 */ 209 */
211static void 210static void
212announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 211announce_id (void *cls)
213{ 212{
214 struct GNUNET_HashCode phash; 213 struct GNUNET_HashCode phash;
215 const struct GNUNET_HELLO_Message *hello; 214 const struct GNUNET_HELLO_Message *hello;
216 size_t size; 215 size_t size;
217 struct GNUNET_TIME_Absolute expiration; 216 struct GNUNET_TIME_Absolute expiration;
218 struct GNUNET_TIME_Relative retry_time; 217 struct GNUNET_TIME_Relative retry_time;
218 const struct GNUNET_SCHEDULER_TaskContext *tc;
219 219
220 tc = GNUNET_SCHEDULER_get_task_context ();
220 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 221 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
221 { 222 {
222 announce_id_task = NULL; 223 announce_id_task = NULL;
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c
index 594c35701..51af04527 100644
--- a/src/cadet/gnunet-service-cadet_peer.c
+++ b/src/cadet/gnunet-service-cadet_peer.c
@@ -841,14 +841,15 @@ is_searching (const struct CadetPeer *peer)
841 * @brief Start a search for a peer. 841 * @brief Start a search for a peer.
842 * 842 *
843 * @param cls Closure (Peer to search for). 843 * @param cls Closure (Peer to search for).
844 * @param tc Task context.
845 */ 844 */
846static void 845static void
847delayed_search (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 846delayed_search (void *cls)
848{ 847{
849 struct CadetPeer *peer = cls; 848 struct CadetPeer *peer = cls;
849 const struct GNUNET_SCHEDULER_TaskContext *tc;
850 850
851 peer->search_delayed = NULL; 851 peer->search_delayed = NULL;
852 tc = GNUNET_SCHEDULER_get_task_context ();
852 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 853 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
853 return; 854 return;
854 GCC_check_connections (); 855 GCC_check_connections ();
@@ -1955,11 +1956,9 @@ GCP_get_short (const GNUNET_PEER_Id peer, int create)
1955 * Marks the operation as finished. 1956 * Marks the operation as finished.
1956 * 1957 *
1957 * @param cls Closure (our `struct CadetPeer`). 1958 * @param cls Closure (our `struct CadetPeer`).
1958 * @param tc TaskContext.
1959 */ 1959 */
1960static void 1960static void
1961hello_offer_done (void *cls, 1961hello_offer_done (void *cls)
1962 const struct GNUNET_SCHEDULER_TaskContext *tc)
1963{ 1962{
1964 struct CadetPeer *peer = cls; 1963 struct CadetPeer *peer = cls;
1965 1964
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c
index 67c2ad5fa..73bd28643 100644
--- a/src/cadet/gnunet-service-cadet_tunnel.c
+++ b/src/cadet/gnunet-service-cadet_tunnel.c
@@ -1730,15 +1730,15 @@ create_kx_ctx (struct CadetTunnel *t)
1730 * @brief Finish the Key eXchange and destroy the old keys. 1730 * @brief Finish the Key eXchange and destroy the old keys.
1731 * 1731 *
1732 * @param cls Closure (Tunnel for which to finish the KX). 1732 * @param cls Closure (Tunnel for which to finish the KX).
1733 * @param tc Task context.
1734 */ 1733 */
1735static void 1734static void
1736finish_kx (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1735finish_kx (void *cls)
1737{ 1736{
1738 struct CadetTunnel *t = cls; 1737 struct CadetTunnel *t = cls;
1738 const struct GNUNET_SCHEDULER_TaskContext *tc;
1739 1739
1740 LOG (GNUNET_ERROR_TYPE_INFO, "finish KX for %s\n", GCT_2s (t)); 1740 LOG (GNUNET_ERROR_TYPE_INFO, "finish KX for %s\n", GCT_2s (t));
1741 1741 tc = GNUNET_SCHEDULER_get_task_context ();
1742 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1742 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1743 { 1743 {
1744 LOG (GNUNET_ERROR_TYPE_INFO, " shutdown\n"); 1744 LOG (GNUNET_ERROR_TYPE_INFO, " shutdown\n");
@@ -2098,15 +2098,15 @@ send_queued_data (struct CadetTunnel *t)
2098 * @brief Resend the AX KX until we complete the handshake. 2098 * @brief Resend the AX KX until we complete the handshake.
2099 * 2099 *
2100 * @param cls Closure (tunnel). 2100 * @param cls Closure (tunnel).
2101 * @param tc Task context.
2102 */ 2101 */
2103static void 2102static void
2104ax_kx_resend (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 2103ax_kx_resend (void *cls)
2105{ 2104{
2106 struct CadetTunnel *t = cls; 2105 struct CadetTunnel *t = cls;
2106 const struct GNUNET_SCHEDULER_TaskContext *tc;
2107 2107
2108 t->rekey_task = NULL; 2108 t->rekey_task = NULL;
2109 2109 tc = GNUNET_SCHEDULER_get_task_context ();
2110 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 2110 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
2111 return; 2111 return;
2112 2112
@@ -2328,16 +2328,16 @@ send_pong (struct CadetTunnel *t, uint32_t challenge)
2328 * Initiate a rekey with the remote peer. 2328 * Initiate a rekey with the remote peer.
2329 * 2329 *
2330 * @param cls Closure (tunnel). 2330 * @param cls Closure (tunnel).
2331 * @param tc TaskContext.
2332 */ 2331 */
2333static void 2332static void
2334rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 2333rekey_tunnel (void *cls)
2335{ 2334{
2336 struct CadetTunnel *t = cls; 2335 struct CadetTunnel *t = cls;
2336 const struct GNUNET_SCHEDULER_TaskContext *tc;
2337 2337
2338 t->rekey_task = NULL; 2338 t->rekey_task = NULL;
2339
2340 LOG (GNUNET_ERROR_TYPE_INFO, "Re-key Tunnel %s\n", GCT_2s (t)); 2339 LOG (GNUNET_ERROR_TYPE_INFO, "Re-key Tunnel %s\n", GCT_2s (t));
2340 tc = GNUNET_SCHEDULER_get_task_context ();
2341 if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 2341 if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
2342 return; 2342 return;
2343 2343
@@ -2447,16 +2447,16 @@ rekey_iterator (void *cls,
2447 * Create a new ephemeral key and key message, schedule next rekeying. 2447 * Create a new ephemeral key and key message, schedule next rekeying.
2448 * 2448 *
2449 * @param cls Closure (unused). 2449 * @param cls Closure (unused).
2450 * @param tc TaskContext.
2451 */ 2450 */
2452static void 2451static void
2453global_otr_rekey (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 2452global_otr_rekey (void *cls)
2454{ 2453{
2455 struct GNUNET_TIME_Absolute time; 2454 struct GNUNET_TIME_Absolute time;
2456 long n; 2455 long n;
2456 const struct GNUNET_SCHEDULER_TaskContext *tc;
2457 2457
2458 rekey_task = NULL; 2458 rekey_task = NULL;
2459 2459 tc = GNUNET_SCHEDULER_get_task_context ();
2460 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 2460 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
2461 return; 2461 return;
2462 2462
@@ -2833,7 +2833,7 @@ handle_ephemeral (struct CadetTunnel *t,
2833 GNUNET_break (0); 2833 GNUNET_break (0);
2834 return; 2834 return;
2835 } 2835 }
2836 rekey_tunnel (t, NULL); 2836 rekey_tunnel (t);
2837 GNUNET_STATISTICS_update (stats, "# otr-downgrades", -1, GNUNET_NO); 2837 GNUNET_STATISTICS_update (stats, "# otr-downgrades", -1, GNUNET_NO);
2838 } 2838 }
2839 2839
@@ -2865,7 +2865,7 @@ handle_ephemeral (struct CadetTunnel *t,
2865 } 2865 }
2866 if (NULL != t->rekey_task) 2866 if (NULL != t->rekey_task)
2867 GNUNET_SCHEDULER_cancel (t->rekey_task); 2867 GNUNET_SCHEDULER_cancel (t->rekey_task);
2868 t->rekey_task = GNUNET_SCHEDULER_add_now (rekey_tunnel, t); 2868 t->rekey_task = GNUNET_SCHEDULER_add_now (&rekey_tunnel, t);
2869 } 2869 }
2870 if (CADET_TUNNEL_KEY_SENT == t->estate) 2870 if (CADET_TUNNEL_KEY_SENT == t->estate)
2871 { 2871 {
@@ -3467,15 +3467,15 @@ GCT_change_estate (struct CadetTunnel* t, enum CadetTunnelEState state)
3467 * of being created/processed. 3467 * of being created/processed.
3468 * 3468 *
3469 * @param cls Closure (Tunnel to check). 3469 * @param cls Closure (Tunnel to check).
3470 * @param tc Task context.
3471 */ 3470 */
3472static void 3471static void
3473trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 3472trim_connections (void *cls)
3474{ 3473{
3475 struct CadetTunnel *t = cls; 3474 struct CadetTunnel *t = cls;
3475 const struct GNUNET_SCHEDULER_TaskContext *tc;
3476 3476
3477 t->trim_connections_task = NULL; 3477 t->trim_connections_task = NULL;
3478 3478 tc = GNUNET_SCHEDULER_get_task_context ();
3479 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 3479 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
3480 return; 3480 return;
3481 3481
@@ -3695,15 +3695,16 @@ GCT_get_channel (struct CadetTunnel *t, CADET_ChannelNumber chid)
3695 * the tunnel. This way we avoid a new public key handshake. 3695 * the tunnel. This way we avoid a new public key handshake.
3696 * 3696 *
3697 * @param cls Closure (tunnel to destroy). 3697 * @param cls Closure (tunnel to destroy).
3698 * @param tc Task context.
3699 */ 3698 */
3700static void 3699static void
3701delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 3700delayed_destroy (void *cls)
3702{ 3701{
3703 struct CadetTunnel *t = cls; 3702 struct CadetTunnel *t = cls;
3704 struct CadetTConnection *iter; 3703 struct CadetTConnection *iter;
3704 const struct GNUNET_SCHEDULER_TaskContext *tc;
3705 3705
3706 LOG (GNUNET_ERROR_TYPE_DEBUG, "delayed destroying tunnel %p\n", t); 3706 LOG (GNUNET_ERROR_TYPE_DEBUG, "delayed destroying tunnel %p\n", t);
3707 tc = GNUNET_SCHEDULER_get_task_context ();
3707 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 3708 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
3708 { 3709 {
3709 LOG (GNUNET_ERROR_TYPE_WARNING, 3710 LOG (GNUNET_ERROR_TYPE_WARNING,
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c
index d1b1b8212..39bfc5fed 100644
--- a/src/cadet/test_cadet.c
+++ b/src/cadet/test_cadet.c
@@ -262,7 +262,7 @@ show_end_data (void)
262 * @param tc Task Context. 262 * @param tc Task Context.
263 */ 263 */
264static void 264static void
265shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 265shutdown_task (void *cls)
266{ 266{
267 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n"); 267 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n");
268 shutdown_handle = NULL; 268 shutdown_handle = NULL;
@@ -276,12 +276,13 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
276 * @param tc Task Context. 276 * @param tc Task Context.
277 */ 277 */
278static void 278static void
279disconnect_cadet_peers (void *cls, 279disconnect_cadet_peers (void *cls)
280 const struct GNUNET_SCHEDULER_TaskContext *tc)
281{ 280{
282 long line = (long) cls; 281 long line = (long) cls;
283 unsigned int i; 282 unsigned int i;
283 const struct GNUNET_SCHEDULER_TaskContext *tc;
284 284
285 tc = GNUNET_SCHEDULER_get_task_context ();
285 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 286 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
286 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 287 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
287 "disconnecting cadet peers due to SHUTDOWN! called from %ld\n", 288 "disconnecting cadet peers due to SHUTDOWN! called from %ld\n",
@@ -387,16 +388,16 @@ stats_iterator (void *cls, const struct GNUNET_TESTBED_Peer *peer,
387 * Task to gather all statistics. 388 * Task to gather all statistics.
388 * 389 *
389 * @param cls Closure (NULL). 390 * @param cls Closure (NULL).
390 * @param tc Task Context.
391 */ 391 */
392static void 392static void
393gather_stats_and_exit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 393gather_stats_and_exit (void *cls)
394{ 394{
395 disconnect_task = NULL;
396 long l = (long) cls; 395 long l = (long) cls;
396 const struct GNUNET_SCHEDULER_TaskContext *tc;
397 397
398 disconnect_task = NULL;
398 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "gathering statistics from line %d\n", l); 399 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "gathering statistics from line %d\n", l);
399 400 tc = GNUNET_SCHEDULER_get_task_context ();
400 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 401 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
401 { 402 {
402 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, 403 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
@@ -456,18 +457,17 @@ tmt_rdy (void *cls, size_t size, void *buf);
456 * Task to request a new data transmission. 457 * Task to request a new data transmission.
457 * 458 *
458 * @param cls Closure (peer #). 459 * @param cls Closure (peer #).
459 * @param tc Task Context.
460 */ 460 */
461static void 461static void
462data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 462data_task (void *cls)
463{ 463{
464 struct GNUNET_CADET_Channel *channel; 464 struct GNUNET_CADET_Channel *channel;
465 static struct GNUNET_CADET_TransmitHandle **pth; 465 static struct GNUNET_CADET_TransmitHandle **pth;
466 466 const struct GNUNET_SCHEDULER_TaskContext *tc;
467 long src; 467 long src;
468 468
469 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data task\n"); 469 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data task\n");
470 470 tc = GNUNET_SCHEDULER_get_task_context ();
471 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 471 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
472 return; 472 return;
473 473
@@ -837,13 +837,14 @@ channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel,
837 * on callback function ch. 837 * on callback function ch.
838 * 838 *
839 * @param cls Closure (unused). 839 * @param cls Closure (unused).
840 * @param tc Task Context.
841 */ 840 */
842static void 841static void
843do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 842do_test (void *cls)
844{ 843{
845 enum GNUNET_CADET_ChannelOption flags; 844 enum GNUNET_CADET_ChannelOption flags;
845 const struct GNUNET_SCHEDULER_TaskContext *tc;
846 846
847 tc = GNUNET_SCHEDULER_get_task_context ();
847 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 848 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
848 return; 849 return;
849 850
@@ -1084,4 +1085,3 @@ main (int argc, char *argv[])
1084} 1085}
1085 1086
1086/* end of test_cadet.c */ 1087/* end of test_cadet.c */
1087
diff --git a/src/cadet/test_cadet_local.c b/src/cadet/test_cadet_local.c
index ef6882961..42663b146 100644
--- a/src/cadet/test_cadet_local.c
+++ b/src/cadet/test_cadet_local.c
@@ -53,17 +53,16 @@ static struct GNUNET_CADET_TransmitHandle *mth;
53 * Connect to other client and send data 53 * Connect to other client and send data
54 * 54 *
55 * @param cls Closue (unused). 55 * @param cls Closue (unused).
56 * @param tc TaskContext.
57 */ 56 */
58static void 57static void
59do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); 58do_connect (void *cls);
60 59
61 60
62/** 61/**
63 * Shutdown nicely 62 * Shutdown nicely
64 */ 63 */
65static void 64static void
66do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 65do_shutdown (void *cls)
67{ 66{
68 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n"); 67 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n");
69 if (NULL != abort_task) 68 if (NULL != abort_task)
@@ -91,7 +90,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
91 * Something went wrong and timed out. Kill everything and set error flag 90 * Something went wrong and timed out. Kill everything and set error flag
92 */ 91 */
93static void 92static void
94do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 93do_abort (void *cls)
95{ 94{
96 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n"); 95 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n");
97 result = GNUNET_SYSERR; 96 result = GNUNET_SYSERR;
@@ -101,7 +100,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
101 GNUNET_SCHEDULER_cancel (shutdown_task); 100 GNUNET_SCHEDULER_cancel (shutdown_task);
102 shutdown_task = NULL; 101 shutdown_task = NULL;
103 } 102 }
104 do_shutdown (cls, tc); 103 do_shutdown (cls);
105} 104}
106 105
107 106
@@ -126,7 +125,8 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
126 if (NULL != shutdown_task) 125 if (NULL != shutdown_task)
127 GNUNET_SCHEDULER_cancel (shutdown_task); 126 GNUNET_SCHEDULER_cancel (shutdown_task);
128 shutdown_task = 127 shutdown_task =
129 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown, 128 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
129 &do_shutdown,
130 NULL); 130 NULL);
131 GNUNET_CADET_receive_done (channel); 131 GNUNET_CADET_receive_done (channel);
132 return GNUNET_OK; 132 return GNUNET_OK;
@@ -146,9 +146,11 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
146 * (can be NULL -- that's not an error) 146 * (can be NULL -- that's not an error)
147 */ 147 */
148static void * 148static void *
149inbound_channel (void *cls, struct GNUNET_CADET_Channel *channel, 149inbound_channel (void *cls,
150 const struct GNUNET_PeerIdentity *initiator, 150 struct GNUNET_CADET_Channel *channel,
151 uint32_t port, enum GNUNET_CADET_ChannelOption options) 151 const struct GNUNET_PeerIdentity *initiator,
152 uint32_t port,
153 enum GNUNET_CADET_ChannelOption options)
152{ 154{
153 long id = (long) cls; 155 long id = (long) cls;
154 156
@@ -247,13 +249,14 @@ do_send (void *cls, size_t size, void *buf)
247 * Connect to other client and send data 249 * Connect to other client and send data
248 * 250 *
249 * @param cls Closue (unused). 251 * @param cls Closue (unused).
250 * @param tc TaskContext.
251 */ 252 */
252static void 253static void
253do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 254do_connect (void *cls)
254{ 255{
255 struct GNUNET_PeerIdentity id; 256 struct GNUNET_PeerIdentity id;
257 const struct GNUNET_SCHEDULER_TaskContext *tc;
256 258
259 tc = GNUNET_SCHEDULER_get_task_context ();
257 if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 260 if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
258 return; 261 return;
259 262
diff --git a/src/cadet/test_cadet_single.c b/src/cadet/test_cadet_single.c
index d5c19ac01..93a50c02c 100644
--- a/src/cadet/test_cadet_single.c
+++ b/src/cadet/test_cadet_single.c
@@ -59,7 +59,7 @@ do_send (void *cls, size_t size, void *buf);
59 * Shutdown nicely 59 * Shutdown nicely
60 */ 60 */
61static void 61static void
62do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 62do_shutdown (void *cls)
63{ 63{
64 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n"); 64 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n");
65 if (NULL != abort_task) 65 if (NULL != abort_task)
@@ -88,7 +88,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
88 * Something went wrong and timed out. Kill everything and set error flag 88 * Something went wrong and timed out. Kill everything and set error flag
89 */ 89 */
90static void 90static void
91do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 91do_abort (void *cls)
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;
@@ -98,7 +98,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
98 GNUNET_SCHEDULER_cancel (shutdown_task); 98 GNUNET_SCHEDULER_cancel (shutdown_task);
99 shutdown_task = NULL; 99 shutdown_task = NULL;
100 } 100 }
101 do_shutdown (cls, tc); 101 do_shutdown (cls);
102} 102}
103 103
104 104
@@ -247,14 +247,15 @@ do_send (void *cls, size_t size, void *buf)
247 * Connect to other client and send data 247 * Connect to other client and send data
248 * 248 *
249 * @param cls Closue (unused). 249 * @param cls Closue (unused).
250 * @param tc TaskContext.
251 */ 250 */
252static void 251static void
253do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 252do_connect (void *cls)
254{ 253{
255 struct GNUNET_PeerIdentity id; 254 struct GNUNET_PeerIdentity id;
256 size_t size = sizeof (struct GNUNET_MessageHeader) + DATA_SIZE; 255 size_t size = sizeof (struct GNUNET_MessageHeader) + DATA_SIZE;
256 const struct GNUNET_SCHEDULER_TaskContext *tc;
257 257
258 tc = GNUNET_SCHEDULER_get_task_context ();
258 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 259 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
259 return; 260 return;
260 261