aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/dht_api.c30
-rw-r--r--src/dht/gnunet-dht-get.c3
-rw-r--r--src/dht/gnunet-dht-monitor.c3
-rw-r--r--src/dht/gnunet-dht-put.c9
-rw-r--r--src/dht/gnunet-service-dht.c8
-rw-r--r--src/dht/gnunet-service-dht_clients.c6
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c10
-rw-r--r--src/dht/gnunet-service-wdht.c5
-rw-r--r--src/dht/gnunet-service-wdht_clients.c6
-rw-r--r--src/dht/gnunet-service-wdht_neighbours.c8
-rw-r--r--src/dht/gnunet-service-xdht.c5
-rw-r--r--src/dht/gnunet-service-xdht_clients.c6
-rw-r--r--src/dht/gnunet-service-xdht_neighbours.c21
-rw-r--r--src/dht/gnunet_dht_profiler.c37
-rw-r--r--src/dht/test_dht_api.c6
-rw-r--r--src/dht/test_dht_monitor.c8
-rw-r--r--src/dht/test_dht_topo.c7
17 files changed, 76 insertions, 102 deletions
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c
index 35d9580e9..b5ae2f8ce 100644
--- a/src/dht/dht_api.c
+++ b/src/dht/dht_api.c
@@ -362,7 +362,7 @@ struct GNUNET_DHT_Handle
362 * Did we start our receive loop yet? 362 * Did we start our receive loop yet?
363 */ 363 */
364 int in_receive; 364 int in_receive;
365 365
366#if ENABLE_MALICIOUS 366#if ENABLE_MALICIOUS
367 /** 367 /**
368 * Handle of act malicious request. 368 * Handle of act malicious request.
@@ -496,11 +496,9 @@ process_pending_messages (struct GNUNET_DHT_Handle *handle);
496 * Try reconnecting to the dht service. 496 * Try reconnecting to the dht service.
497 * 497 *
498 * @param cls a `struct GNUNET_DHT_Handle` 498 * @param cls a `struct GNUNET_DHT_Handle`
499 * @param tc scheduler context
500 */ 499 */
501static void 500static void
502try_reconnect (void *cls, 501try_reconnect (void *cls)
503 const struct GNUNET_SCHEDULER_TaskContext *tc)
504{ 502{
505 struct GNUNET_DHT_Handle *handle = cls; 503 struct GNUNET_DHT_Handle *handle = cls;
506 504
@@ -650,7 +648,7 @@ transmit_pending (void *cls,
650 head->in_pending_queue = GNUNET_NO; 648 head->in_pending_queue = GNUNET_NO;
651 if (NULL != head->cont) 649 if (NULL != head->cont)
652 { 650 {
653 head->cont (head->cont_cls, NULL); 651 head->cont (head->cont_cls);
654 head->cont = NULL; 652 head->cont = NULL;
655 head->cont_cls = NULL; 653 head->cont_cls = NULL;
656 } 654 }
@@ -663,7 +661,7 @@ transmit_pending (void *cls,
663 { 661 {
664 LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting to process replies from DHT\n"); 662 LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting to process replies from DHT\n");
665 handle->in_receive = GNUNET_YES; 663 handle->in_receive = GNUNET_YES;
666 664
667 GNUNET_CLIENT_receive (handle->client, &service_message_handler, handle, 665 GNUNET_CLIENT_receive (handle->client, &service_message_handler, handle,
668 GNUNET_TIME_UNIT_FOREVER_REL); 666 GNUNET_TIME_UNIT_FOREVER_REL);
669 } 667 }
@@ -899,7 +897,7 @@ process_act_malicious_confirmation_message (struct GNUNET_DHT_Handle *handle,
899 struct GNUNET_DHT_ActMaliciousHandle *mh; 897 struct GNUNET_DHT_ActMaliciousHandle *mh;
900 GNUNET_DHT_PutContinuation cont; 898 GNUNET_DHT_PutContinuation cont;
901 void *cont_cls; 899 void *cont_cls;
902 900
903 mh = handle->mh; 901 mh = handle->mh;
904 if (NULL == mh) 902 if (NULL == mh)
905 return GNUNET_OK; 903 return GNUNET_OK;
@@ -907,7 +905,7 @@ process_act_malicious_confirmation_message (struct GNUNET_DHT_Handle *handle,
907 cont_cls = mh->cont_cls; 905 cont_cls = mh->cont_cls;
908 if (NULL != cont) 906 if (NULL != cont)
909 cont (cont_cls, GNUNET_OK); 907 cont (cont_cls, GNUNET_OK);
910 908
911 return GNUNET_OK; 909 return GNUNET_OK;
912} 910}
913#endif 911#endif
@@ -1110,7 +1108,7 @@ GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle)
1110 pm->in_pending_queue = GNUNET_NO; 1108 pm->in_pending_queue = GNUNET_NO;
1111 GNUNET_assert (GNUNET_YES == pm->free_on_send); 1109 GNUNET_assert (GNUNET_YES == pm->free_on_send);
1112 if (NULL != pm->cont) 1110 if (NULL != pm->cont)
1113 pm->cont (pm->cont_cls, NULL); 1111 pm->cont (pm->cont_cls);
1114 GNUNET_free (pm); 1112 GNUNET_free (pm);
1115 } 1113 }
1116 while (NULL != (ph = handle->put_head)) 1114 while (NULL != (ph = handle->put_head))
@@ -1137,11 +1135,9 @@ GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle)
1137 * Timeout for the transmission of a fire&forget-request. Clean it up. 1135 * Timeout for the transmission of a fire&forget-request. Clean it up.
1138 * 1136 *
1139 * @param cls the `struct GNUNET_DHT_PutHandle *` 1137 * @param cls the `struct GNUNET_DHT_PutHandle *`
1140 * @param tc scheduler context
1141 */ 1138 */
1142static void 1139static void
1143timeout_put_request (void *cls, 1140timeout_put_request (void *cls)
1144 const struct GNUNET_SCHEDULER_TaskContext *tc)
1145{ 1141{
1146 struct GNUNET_DHT_PutHandle *ph = cls; 1142 struct GNUNET_DHT_PutHandle *ph = cls;
1147 struct GNUNET_DHT_Handle *handle = ph->dht_handle; 1143 struct GNUNET_DHT_Handle *handle = ph->dht_handle;
@@ -1168,11 +1164,9 @@ timeout_put_request (void *cls,
1168 * the message pointer in the put handle to NULL. 1164 * the message pointer in the put handle to NULL.
1169 * 1165 *
1170 * @param cls the `struct GNUNET_DHT_PutHandle` 1166 * @param cls the `struct GNUNET_DHT_PutHandle`
1171 * @param tc unused
1172 */ 1167 */
1173static void 1168static void
1174mark_put_message_gone (void *cls, 1169mark_put_message_gone (void *cls)
1175 const struct GNUNET_SCHEDULER_TaskContext *tc)
1176{ 1170{
1177 struct GNUNET_DHT_PutHandle *ph = cls; 1171 struct GNUNET_DHT_PutHandle *ph = cls;
1178 1172
@@ -1570,10 +1564,10 @@ GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *handle)
1570 * @param handle the DHT handle 1564 * @param handle the DHT handle
1571 * @param action 1 to make the service malicious; 0 to make it benign 1565 * @param action 1 to make the service malicious; 0 to make it benign
1572 * @param cont continuation to call when done (transmitting request to service) 1566 * @param cont continuation to call when done (transmitting request to service)
1573 * @param cont_cls closure for @a cont 1567 * @param cont_cls closure for @a cont
1574 */ 1568 */
1575struct GNUNET_DHT_ActMaliciousHandle * 1569struct GNUNET_DHT_ActMaliciousHandle *
1576GNUNET_DHT_act_malicious (struct GNUNET_DHT_Handle *handle, 1570GNUNET_DHT_act_malicious (struct GNUNET_DHT_Handle *handle,
1577 unsigned int action, 1571 unsigned int action,
1578 GNUNET_DHT_PutContinuation cont, 1572 GNUNET_DHT_PutContinuation cont,
1579 void *cont_cls) 1573 void *cont_cls)
@@ -1582,7 +1576,7 @@ GNUNET_DHT_act_malicious (struct GNUNET_DHT_Handle *handle,
1582 struct GNUNET_DHT_ActMaliciousHandle *mh; 1576 struct GNUNET_DHT_ActMaliciousHandle *mh;
1583 struct PendingMessage *pending; 1577 struct PendingMessage *pending;
1584 size_t msize; 1578 size_t msize;
1585 1579
1586 msize = sizeof(struct GNUNET_DHT_ActMaliciousMessage); 1580 msize = sizeof(struct GNUNET_DHT_ActMaliciousMessage);
1587 if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 1581 if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
1588 { 1582 {
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c
index 7349d0c82..6846b3af7 100644
--- a/src/dht/gnunet-dht-get.c
+++ b/src/dht/gnunet-dht-get.c
@@ -87,10 +87,9 @@ static int ret;
87 * Task run to clean up on timeout. 87 * Task run to clean up on timeout.
88 * 88 *
89 * @param cls unused 89 * @param cls unused
90 * @param tc unused
91 */ 90 */
92static void 91static void
93cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 92cleanup_task (void *cls)
94{ 93{
95 if (NULL != get_handle) 94 if (NULL != get_handle)
96 { 95 {
diff --git a/src/dht/gnunet-dht-monitor.c b/src/dht/gnunet-dht-monitor.c
index 9047ba685..0502496d7 100644
--- a/src/dht/gnunet-dht-monitor.c
+++ b/src/dht/gnunet-dht-monitor.c
@@ -76,10 +76,9 @@ static int ret;
76 * Stop monitoring request and start shutdown 76 * Stop monitoring request and start shutdown
77 * 77 *
78 * @param cls closure (unused) 78 * @param cls closure (unused)
79 * @param tc Task Context
80 */ 79 */
81static void 80static void
82cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 81cleanup_task (void *cls)
83{ 82{
84 if (verbose) 83 if (verbose)
85 FPRINTF (stderr, "%s", "Cleaning up!\n"); 84 FPRINTF (stderr, "%s", "Cleaning up!\n");
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c
index c58311876..19e385be1 100644
--- a/src/dht/gnunet-dht-put.c
+++ b/src/dht/gnunet-dht-put.c
@@ -87,8 +87,9 @@ static int ret;
87 */ 87 */
88static char *data; 88static char *data;
89 89
90
90static void 91static void
91shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 92shutdown_task (void *cls)
92{ 93{
93 if (NULL != dht_handle) 94 if (NULL != dht_handle)
94 { 95 {
@@ -101,9 +102,9 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
101 * Signature of the main function of a task. 102 * Signature of the main function of a task.
102 * 103 *
103 * @param cls closure 104 * @param cls closure
104 * @param success GNUNET_OK if the PUT was transmitted, 105 * @param success #GNUNET_OK if the PUT was transmitted,
105 * GNUNET_NO on timeout, 106 * #GNUNET_NO on timeout,
106 * GNUNET_SYSERR on disconnect from service 107 * #GNUNET_SYSERR on disconnect from service
107 * after the PUT message was transmitted 108 * after the PUT message was transmitted
108 * (so we don't know if it was received or not) 109 * (so we don't know if it was received or not)
109 */ 110 */
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index 006364664..1aeca9b85 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -98,10 +98,9 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message)
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 if (NULL != ghh) 105 if (NULL != ghh)
107 { 106 {
@@ -159,10 +158,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
159 GDS_CLIENTS_init (server); 158 GDS_CLIENTS_init (server);
160 if (GNUNET_OK != GDS_NEIGHBOURS_init ()) 159 if (GNUNET_OK != GDS_NEIGHBOURS_init ())
161 { 160 {
162 shutdown_task (NULL, NULL); 161 shutdown_task (NULL);
163 return; 162 return;
164 } 163 }
165 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, 164 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
165 &shutdown_task,
166 NULL); 166 NULL);
167 GDS_transport_handle = 167 GDS_transport_handle =
168 GNUNET_TRANSPORT_connect (GDS_cfg, NULL, NULL, NULL, NULL, NULL); 168 GNUNET_TRANSPORT_connect (GDS_cfg, NULL, NULL, NULL, NULL, NULL);
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c
index 30eb6afa6..e42069fe0 100644
--- a/src/dht/gnunet-service-dht_clients.c
+++ b/src/dht/gnunet-service-dht_clients.c
@@ -450,16 +450,16 @@ transmit_request (struct ClientQueryRecord *cqr)
450 * itself (unless the heap is empty). 450 * itself (unless the heap is empty).
451 * 451 *
452 * @param cls unused 452 * @param cls unused
453 * @param tc scheduler context
454 */ 453 */
455static void 454static void
456transmit_next_request_task (void *cls, 455transmit_next_request_task (void *cls)
457 const struct GNUNET_SCHEDULER_TaskContext *tc)
458{ 456{
459 struct ClientQueryRecord *cqr; 457 struct ClientQueryRecord *cqr;
460 struct GNUNET_TIME_Relative delay; 458 struct GNUNET_TIME_Relative delay;
459 const struct GNUNET_SCHEDULER_TaskContext *tc;
461 460
462 retry_task = NULL; 461 retry_task = NULL;
462 tc = GNUNET_SCHEDULER_get_task_context ();
463 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 463 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
464 return; 464 return;
465 while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap))) 465 while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap)))
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index cedafbd6c..d82effb34 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -492,11 +492,9 @@ find_bucket (const struct GNUNET_HashCode *hc)
492 * Clean up the "oh" field in the @a cls 492 * Clean up the "oh" field in the @a cls
493 * 493 *
494 * @param cls a `struct ConnectInfo` 494 * @param cls a `struct ConnectInfo`
495 * @param tc unused
496 */ 495 */
497static void 496static void
498offer_hello_done (void *cls, 497offer_hello_done (void *cls)
499 const struct GNUNET_SCHEDULER_TaskContext *tc)
500{ 498{
501 struct ConnectInfo *ci = cls; 499 struct ConnectInfo *ci = cls;
502 500
@@ -707,17 +705,17 @@ add_known_to_bloom (void *cls,
707 * and attempt to connect to them. 705 * and attempt to connect to them.
708 * 706 *
709 * @param cls closure for this task 707 * @param cls closure for this task
710 * @param tc the context under which the task is running
711 */ 708 */
712static void 709static void
713send_find_peer_message (void *cls, 710send_find_peer_message (void *cls)
714 const struct GNUNET_SCHEDULER_TaskContext *tc)
715{ 711{
716 struct GNUNET_TIME_Relative next_send_time; 712 struct GNUNET_TIME_Relative next_send_time;
717 struct BloomConstructorContext bcc; 713 struct BloomConstructorContext bcc;
718 struct GNUNET_CONTAINER_BloomFilter *peer_bf; 714 struct GNUNET_CONTAINER_BloomFilter *peer_bf;
715 const struct GNUNET_SCHEDULER_TaskContext *tc;
719 716
720 find_peer_task = NULL; 717 find_peer_task = NULL;
718 tc = GNUNET_SCHEDULER_get_task_context ();
721 if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) 719 if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
722 return; 720 return;
723 if (newly_found_peers > bucket_size) 721 if (newly_found_peers > bucket_size)
diff --git a/src/dht/gnunet-service-wdht.c b/src/dht/gnunet-service-wdht.c
index 339b38aa4..0668c9078 100644
--- a/src/dht/gnunet-service-wdht.c
+++ b/src/dht/gnunet-service-wdht.c
@@ -60,10 +60,9 @@ const struct GNUNET_CONFIGURATION_Handle *GDS_cfg;
60 * Task run during shutdown. 60 * Task run during shutdown.
61 * 61 *
62 * @param cls unused 62 * @param cls unused
63 * @param tc unused
64 */ 63 */
65static void 64static void
66shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 65shutdown_task (void *cls)
67{ 66{
68 GDS_NEIGHBOURS_done (); 67 GDS_NEIGHBOURS_done ();
69 GDS_DATACACHE_done (); 68 GDS_DATACACHE_done ();
@@ -100,7 +99,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
100 GDS_CLIENTS_init (server); 99 GDS_CLIENTS_init (server);
101 if (GNUNET_OK != GDS_NEIGHBOURS_init ()) 100 if (GNUNET_OK != GDS_NEIGHBOURS_init ())
102 { 101 {
103 shutdown_task (NULL, NULL); 102 shutdown_task (NULL);
104 return; 103 return;
105 } 104 }
106 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 105 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
diff --git a/src/dht/gnunet-service-wdht_clients.c b/src/dht/gnunet-service-wdht_clients.c
index 0662472a8..c3aff03aa 100644
--- a/src/dht/gnunet-service-wdht_clients.c
+++ b/src/dht/gnunet-service-wdht_clients.c
@@ -874,16 +874,16 @@ transmit_request (struct ClientQueryRecord *cqr)
874 * itself (unless the heap is empty). 874 * itself (unless the heap is empty).
875 * 875 *
876 * @param cls unused 876 * @param cls unused
877 * @param tc scheduler context
878 */ 877 */
879static void 878static void
880transmit_next_request_task (void *cls, 879transmit_next_request_task (void *cls)
881 const struct GNUNET_SCHEDULER_TaskContext *tc)
882{ 880{
883 struct ClientQueryRecord *cqr; 881 struct ClientQueryRecord *cqr;
884 struct GNUNET_TIME_Relative delay; 882 struct GNUNET_TIME_Relative delay;
883 const struct GNUNET_SCHEDULER_TaskContext *tc;
885 884
886 retry_task = NULL; 885 retry_task = NULL;
886 tc = GNUNET_SCHEDULER_get_task_context ();
887 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 887 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
888 return; 888 return;
889 while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap))) 889 while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap)))
diff --git a/src/dht/gnunet-service-wdht_neighbours.c b/src/dht/gnunet-service-wdht_neighbours.c
index ef73c80a9..54c52507e 100644
--- a/src/dht/gnunet-service-wdht_neighbours.c
+++ b/src/dht/gnunet-service-wdht_neighbours.c
@@ -931,11 +931,9 @@ pick_random_friend ()
931 * possibly initiate cleanup. 931 * possibly initiate cleanup.
932 * 932 *
933 * @param cls NULL 933 * @param cls NULL
934 * @param tc unused
935 */ 934 */
936static void 935static void
937trail_timeout_callback (void *cls, 936trail_timeout_callback (void *cls)
938 const struct GNUNET_SCHEDULER_TaskContext *tc)
939{ 937{
940 struct Trail *trail; 938 struct Trail *trail;
941 struct GNUNET_TIME_Relative left; 939 struct GNUNET_TIME_Relative left;
@@ -974,11 +972,9 @@ get_desired_finger_array_size ()
974 * Initiate a random walk. 972 * Initiate a random walk.
975 * 973 *
976 * @param cls NULL 974 * @param cls NULL
977 * @param tc unused
978 */ 975 */
979static void 976static void
980do_random_walk (void *cls, 977do_random_walk (void *cls)
981 const struct GNUNET_SCHEDULER_TaskContext *tc)
982{ 978{
983 static unsigned int walk_layer; 979 static unsigned int walk_layer;
984 struct FriendInfo *friend; 980 struct FriendInfo *friend;
diff --git a/src/dht/gnunet-service-xdht.c b/src/dht/gnunet-service-xdht.c
index 3bab7e946..f6c7c5167 100644
--- a/src/dht/gnunet-service-xdht.c
+++ b/src/dht/gnunet-service-xdht.c
@@ -73,10 +73,9 @@ unsigned int malicious;
73 * Task run during shutdown. 73 * Task run during shutdown.
74 * 74 *
75 * @param cls unused 75 * @param cls unused
76 * @param tc unused
77 */ 76 */
78static void 77static void
79shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 78shutdown_task (void *cls)
80{ 79{
81 GDS_NEIGHBOURS_done (); 80 GDS_NEIGHBOURS_done ();
82 GDS_DATACACHE_done (); 81 GDS_DATACACHE_done ();
@@ -123,7 +122,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
123 } 122 }
124 if (GNUNET_OK != GDS_NEIGHBOURS_init ()) 123 if (GNUNET_OK != GDS_NEIGHBOURS_init ())
125 { 124 {
126 shutdown_task (NULL, NULL); 125 shutdown_task (NULL);
127 return; 126 return;
128 } 127 }
129 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 128 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
diff --git a/src/dht/gnunet-service-xdht_clients.c b/src/dht/gnunet-service-xdht_clients.c
index 1a1ee9e82..e08ccf792 100644
--- a/src/dht/gnunet-service-xdht_clients.c
+++ b/src/dht/gnunet-service-xdht_clients.c
@@ -871,16 +871,16 @@ transmit_request (struct ClientQueryRecord *cqr)
871 * itself (unless the heap is empty). 871 * itself (unless the heap is empty).
872 * 872 *
873 * @param cls unused 873 * @param cls unused
874 * @param tc scheduler context
875 */ 874 */
876static void 875static void
877transmit_next_request_task (void *cls, 876transmit_next_request_task (void *cls)
878 const struct GNUNET_SCHEDULER_TaskContext *tc)
879{ 877{
880 struct ClientQueryRecord *cqr; 878 struct ClientQueryRecord *cqr;
881 struct GNUNET_TIME_Relative delay; 879 struct GNUNET_TIME_Relative delay;
880 const struct GNUNET_SCHEDULER_TaskContext *tc;
882 881
883 retry_task = NULL; 882 retry_task = NULL;
883 tc = GNUNET_SCHEDULER_get_task_context ();
884 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 884 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
885 return; 885 return;
886 while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap))) 886 while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap)))
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c
index 96fdaa9d7..c6de94a5a 100644
--- a/src/dht/gnunet-service-xdht_neighbours.c
+++ b/src/dht/gnunet-service-xdht_neighbours.c
@@ -2674,11 +2674,9 @@ compute_finger_identity_value (unsigned int finger_index)
2674 * finger identity through this random friend. 2674 * finger identity through this random friend.
2675 * 2675 *
2676 * @param cls closure for this task 2676 * @param cls closure for this task
2677 * @param tc the context under which the task is running
2678 */ 2677 */
2679static void 2678static void
2680send_find_finger_trail_message (void *cls, 2679send_find_finger_trail_message (void *cls)
2681 const struct GNUNET_SCHEDULER_TaskContext *tc)
2682{ 2680{
2683 struct FriendInfo *target_friend; 2681 struct FriendInfo *target_friend;
2684 struct GNUNET_HashCode trail_id; 2682 struct GNUNET_HashCode trail_id;
@@ -3219,12 +3217,11 @@ add_new_finger (struct GNUNET_PeerIdentity finger_identity,
3219 * Periodic task to verify current successor. There can be multiple trails to reach 3217 * Periodic task to verify current successor. There can be multiple trails to reach
3220 * to successor, choose the shortest one and send verify successor message 3218 * to successor, choose the shortest one and send verify successor message
3221 * across that trail. 3219 * across that trail.
3220 *
3222 * @param cls closure for this task 3221 * @param cls closure for this task
3223 * @param tc the context under which the task is running
3224 */ 3222 */
3225static void 3223static void
3226send_verify_successor_message (void *cls, 3224send_verify_successor_message (void *cls)
3227 const struct GNUNET_SCHEDULER_TaskContext *tc)
3228{ 3225{
3229 struct FriendInfo *target_friend; 3226 struct FriendInfo *target_friend;
3230 struct GNUNET_HashCode trail_id; 3227 struct GNUNET_HashCode trail_id;
@@ -5077,10 +5074,10 @@ struct SendNotifyContext
5077 unsigned int num_retries_scheduled; 5074 unsigned int num_retries_scheduled;
5078}; 5075};
5079 5076
5077
5080void 5078void
5081send_notify_new_successor (void *cls, 5079send_notify_new_successor (void *cls);
5082 const struct GNUNET_SCHEDULER_TaskContext 5080
5083 * tc);
5084 5081
5085/** 5082/**
5086 * Check if the peer which sent us verify successor result message is still ours 5083 * Check if the peer which sent us verify successor result message is still ours
@@ -5250,11 +5247,9 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ,
5250 5247
5251 5248
5252void 5249void
5253send_notify_new_successor (void *cls, 5250send_notify_new_successor (void *cls)
5254 const struct GNUNET_SCHEDULER_TaskContext
5255 * tc)
5256{ 5251{
5257 struct SendNotifyContext *ctx = (struct SendNotifyContext *) cls; 5252 struct SendNotifyContext *ctx = cls;
5258 5253
5259 GDS_NEIGHBOURS_send_notify_new_successor (ctx->source_peer, 5254 GDS_NEIGHBOURS_send_notify_new_successor (ctx->source_peer,
5260 ctx->successor, 5255 ctx->successor,
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c
index 7d6ac685a..f0c4ec7be 100644
--- a/src/dht/gnunet_dht_profiler.c
+++ b/src/dht/gnunet_dht_profiler.c
@@ -406,28 +406,30 @@ static int in_shutdown = 0;
406 */ 406 */
407static unsigned int tries; 407static unsigned int tries;
408 408
409
409/** 410/**
410 * Task that collects successor statistics from all the peers. 411 * Task that collects successor statistics from all the peers.
412 *
411 * @param cls 413 * @param cls
412 * @param tc
413 */ 414 */
414static void 415static void
415collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); 416collect_stats (void *cls);
417
416 418
417/** 419/**
418 * Connect to DHT services of active peers 420 * Connect to DHT services of active peers
419 */ 421 */
420static void 422static void
421start_profiling(); 423start_profiling (void);
424
422 425
423/** 426/**
424 * Shutdown task. Cleanup all resources and operations. 427 * Shutdown task. Cleanup all resources and operations.
425 * 428 *
426 * @param cls NULL 429 * @param cls NULL
427 * @param tc scheduler task context
428 */ 430 */
429static void 431static void
430do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 432do_shutdown (void *cls)
431{ 433{
432 struct ActiveContext *ac; 434 struct ActiveContext *ac;
433 unsigned int cnt; 435 unsigned int cnt;
@@ -546,10 +548,9 @@ summarize ()
546 * Task to cancel DHT GET. 548 * Task to cancel DHT GET.
547 * 549 *
548 * @param cls NULL 550 * @param cls NULL
549 * @param tc scheduler task context
550 */ 551 */
551static void 552static void
552cancel_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 553cancel_get (void *cls)
553{ 554{
554 struct ActiveContext *ac = cls; 555 struct ActiveContext *ac = cls;
555 struct Context *ctx = ac->ctx; 556 struct Context *ctx = ac->ctx;
@@ -637,10 +638,9 @@ get_iter (void *cls,
637 * Task to do DHT GETs 638 * Task to do DHT GETs
638 * 639 *
639 * @param cls the active context 640 * @param cls the active context
640 * @param tc the scheduler task context
641 */ 641 */
642static void 642static void
643delayed_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 643delayed_get (void *cls)
644{ 644{
645 struct ActiveContext *ac = cls; 645 struct ActiveContext *ac = cls;
646 struct ActiveContext *get_ac; 646 struct ActiveContext *get_ac;
@@ -681,14 +681,15 @@ delayed_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
681 * clear the operation during shutdown. 681 * clear the operation during shutdown.
682 * 682 *
683 * @param cls the context 683 * @param cls the context
684 * @return tc scheduler task context.
685 */ 684 */
686static void 685static void
687teardown_dht_connection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 686teardown_dht_connection (void *cls)
688{ 687{
689 struct Context *ctx = cls; 688 struct Context *ctx = cls;
690 struct GNUNET_TESTBED_Operation *op; 689 struct GNUNET_TESTBED_Operation *op;
690 const struct GNUNET_SCHEDULER_TaskContext *tc;
691 691
692 tc = GNUNET_SCHEDULER_get_task_context ();
692 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 693 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
693 return; 694 return;
694 GNUNET_assert (NULL != ctx); 695 GNUNET_assert (NULL != ctx);
@@ -725,13 +726,12 @@ put_cont (void *cls, int success)
725 726
726 727
727/** 728/**
728 * Task to do DHT PUTS 729 * Task to do DHT PUTs
729 * 730 *
730 * @param cls the active context 731 * @param cls the active context
731 * @param tc the scheduler task context
732 */ 732 */
733static void 733static void
734delayed_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 734delayed_put (void *cls)
735{ 735{
736 struct ActiveContext *ac = cls; 736 struct ActiveContext *ac = cls;
737 737
@@ -1210,15 +1210,18 @@ successor_stats_iterator (void *cls,
1210 * Task that collects peer and its corresponding successors. 1210 * Task that collects peer and its corresponding successors.
1211 * 1211 *
1212 * @param cls Closure (NULL). 1212 * @param cls Closure (NULL).
1213 * @param tc Task Context.
1214 */ 1213 */
1215static void 1214static void
1216collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1215collect_stats (void *cls)
1217{ 1216{
1217 const struct GNUNET_SCHEDULER_TaskContext *tc;
1218
1219 tc = GNUNET_SCHEDULER_get_task_context ();
1218 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 1220 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
1219 return; 1221 return;
1220 1222
1221 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start collecting statistics...\n"); 1223 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1224 "Start collecting statistics...\n");
1222 GNUNET_assert(NULL != testbed_handles); 1225 GNUNET_assert(NULL != testbed_handles);
1223 1226
1224 if (0 != max_searches) 1227 if (0 != max_searches)
diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c
index b2d31d02f..2507ff080 100644
--- a/src/dht/test_dht_api.c
+++ b/src/dht/test_dht_api.c
@@ -82,7 +82,7 @@ static struct GNUNET_SCHEDULER_Task * die_task;
82 82
83 83
84static void 84static void
85end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 85end (void *cls)
86{ 86{
87 GNUNET_SCHEDULER_cancel (die_task); 87 GNUNET_SCHEDULER_cancel (die_task);
88 die_task = NULL; 88 die_task = NULL;
@@ -116,11 +116,9 @@ end_badly ()
116 * Signature of the main function of a task. 116 * Signature of the main function of a task.
117 * 117 *
118 * @param cls closure 118 * @param cls closure
119 * @param tc context information (why was this task triggered now)
120 */ 119 */
121static void 120static void
122test_get_stop (void *cls, 121test_get_stop (void *cls)
123 const struct GNUNET_SCHEDULER_TaskContext *tc)
124{ 122{
125 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 123 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
126 "Called test_get_stop!\n"); 124 "Called test_get_stop!\n");
diff --git a/src/dht/test_dht_monitor.c b/src/dht/test_dht_monitor.c
index fc4b45a45..6b639e341 100644
--- a/src/dht/test_dht_monitor.c
+++ b/src/dht/test_dht_monitor.c
@@ -108,11 +108,9 @@ static unsigned int monitor_counter;
108 * the testbed. 108 * the testbed.
109 * 109 *
110 * @param cls the 'struct GNUNET_DHT_TestContext' 110 * @param cls the 'struct GNUNET_DHT_TestContext'
111 * @param tc scheduler context
112 */ 111 */
113static void 112static void
114shutdown_task (void *cls, 113shutdown_task (void *cls)
115 const struct GNUNET_SCHEDULER_TaskContext *tc)
116{ 114{
117 struct GNUNET_DHT_TEST_Context *ctx = cls; 115 struct GNUNET_DHT_TEST_Context *ctx = cls;
118 unsigned int i; 116 unsigned int i;
@@ -197,11 +195,9 @@ dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp,
197 * Task to put the id of each peer into the DHT. 195 * Task to put the id of each peer into the DHT.
198 * 196 *
199 * @param cls array with NUM_PEERS DHT handles 197 * @param cls array with NUM_PEERS DHT handles
200 * @param tc Task context
201 */ 198 */
202static void 199static void
203do_puts (void *cls, 200do_puts (void *cls)
204 const struct GNUNET_SCHEDULER_TaskContext *tc)
205{ 201{
206 struct GNUNET_DHT_Handle **hs = cls; 202 struct GNUNET_DHT_Handle **hs = cls;
207 struct GNUNET_HashCode key; 203 struct GNUNET_HashCode key;
diff --git a/src/dht/test_dht_topo.c b/src/dht/test_dht_topo.c
index fe6007a21..23ed21717 100644
--- a/src/dht/test_dht_topo.c
+++ b/src/dht/test_dht_topo.c
@@ -220,11 +220,9 @@ handle_stats (void *cls,
220 * the testbed. 220 * the testbed.
221 * 221 *
222 * @param cls the 'struct GNUNET_DHT_TestContext' 222 * @param cls the 'struct GNUNET_DHT_TestContext'
223 * @param tc scheduler context
224 */ 223 */
225static void 224static void
226shutdown_task (void *cls, 225shutdown_task (void *cls)
227 const struct GNUNET_SCHEDULER_TaskContext *tc)
228{ 226{
229 struct GNUNET_DHT_TEST_Context *ctx = cls; 227 struct GNUNET_DHT_TEST_Context *ctx = cls;
230 struct GetOperation *get_op; 228 struct GetOperation *get_op;
@@ -323,8 +321,7 @@ dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp,
323 * @param tc Task context 321 * @param tc Task context
324 */ 322 */
325static void 323static void
326do_puts (void *cls, 324do_puts (void *cls)
327 const struct GNUNET_SCHEDULER_TaskContext *tc)
328{ 325{
329 struct GNUNET_DHT_Handle **hs = cls; 326 struct GNUNET_DHT_Handle **hs = cls;
330 struct GNUNET_HashCode key; 327 struct GNUNET_HashCode key;