summaryrefslogtreecommitdiff
path: root/src/cadet
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-09 23:14:03 +0000
committerChristian Grothoff <christian@grothoff.org>2016-04-09 23:14:03 +0000
commit29e6158507a0758192075ac6ece7ba8e75ddc49a (patch)
treeb91ded48da322f8ba4c9bb0f5504228aa036c2d1 /src/cadet
parent5dfcb058ab5db9ae0c4b147d8a99c64ca0980028 (diff)
small API change: do no longer pass rarely needed GNUNET_SCHEDULER_TaskContext to all scheduler tasks; instead, allow the relatively few tasks that need it to obtain the context via GNUNET_SCHEDULER_get_task_context()
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)
* Notify client that the transmission has timed out
*
* @param cls closure
- * @param tc task context
*/
static void
-timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_transmission (void *cls)
{
struct GNUNET_CADET_TransmitHandle *th = cls;
struct GNUNET_CADET_Handle *cadet = th->channel->cadet;
@@ -594,12 +593,12 @@ send_ack (struct GNUNET_CADET_Channel *ch)
/**
* Reconnect callback: tries to reconnect again after a failer previous
- * reconnecttion
+ * reconnection.
+ *
* @param cls closure (cadet handle)
- * @param tc task context
*/
static void
-reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+reconnect_cbk (void *cls);
/**
@@ -696,15 +695,17 @@ do_reconnect (struct GNUNET_CADET_Handle *h)
/**
* Reconnect callback: tries to reconnect again after a failer previous
* reconnecttion
+ *
* @param cls closure (cadet handle)
- * @param tc task context
*/
static void
-reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_cbk (void *cls)
{
struct GNUNET_CADET_Handle *h = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
h->reconnect_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
do_reconnect (h);
@@ -2171,4 +2172,3 @@ GNUNET_CADET_mq_create (struct GNUNET_CADET_Channel *channel)
NULL); /* no handler cls */
return mq;
}
-
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 @@
* Removes the path from the peer (except for direct paths).
*
* @param cls Closure (path to destroy).
- * @param tc Task context.
*/
static void
-path_destroy_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+path_destroy_delayed (void *cls)
{
struct CadetPeerPath *path = cls;
struct CadetPeer *peer;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
LOG (GNUNET_ERROR_TYPE_INFO, "Destroy delayed %p (%u)\n", path, path->length);
path->path_delete = NULL;
/* During shutdown, the peers peermap might not exist anymore. */
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) == 0)
{
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;
* on callback funtion ch.
*
* @param cls Closure (unsued).
- * @param tc Task Context.
*/
static void
-start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+start_test (void *cls);
/**
@@ -314,10 +313,9 @@ show_end_data (void)
* Shut down peergroup, clean up.
*
* @param cls Closure (unused).
- * @param tc Task Context.
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Ending test.\n");
shutdown_handle = NULL;
@@ -328,10 +326,9 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* Disconnect from cadet services af all peers, call shutdown.
*
* @param cls Closure (unused).
- * @param tc Task Context.
*/
static void
-disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+disconnect_cadet_peers (void *cls)
{
long line = (long) cls;
unsigned int i;
@@ -443,11 +440,13 @@ stats_iterator (void *cls, const struct GNUNET_TESTBED_Peer *peer,
* Task check that keepalives were sent and received.
*
* @param cls Closure (NULL).
- * @param tc Task Context.
*/
static void
-collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+collect_stats (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
@@ -462,11 +461,13 @@ collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* @brief Finish profiler normally. Signal finish and start collecting stats.
*
* @param cls Closure (unused).
- * @param tc Task context.
*/
static void
-finish_profiler (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+finish_profiler (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
@@ -542,11 +543,13 @@ adjust_running_peers (unsigned int target)
* @brief Move to next round.
*
* @param cls Closure (round #).
- * @param tc Task context.
*/
static void
-next_rnd (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+next_rnd (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
@@ -608,15 +611,15 @@ tmt_rdy_pong (void *cls, size_t size, void *buf)
* @brief Send a ping to destination
*
* @param cls Closure (peer).
- * @param tc Task context.
*/
static void
-ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+ping (void *cls)
{
- struct CadetPeer *peer = (struct CadetPeer *) cls;
+ struct CadetPeer *peer = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
peer->ping_task = NULL;
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)
|| GNUNET_YES == test_finished)
return;
@@ -865,15 +868,16 @@ select_random_peer (struct CadetPeer *peer)
* on callback funtion ch.
*
* @param cls Closure (unsued).
- * @param tc Task Context.
*/
static void
-start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+start_test (void *cls)
{
enum GNUNET_CADET_ChannelOption flags;
unsigned long i;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
test_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
@@ -1089,4 +1093,3 @@ main (int argc, char *argv[])
}
/* end of gnunet-cadet-profiler.c */
-
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)
* Stops monitoring activity.
*
* @param cls Closure (unused).
- * @param tc scheduler context
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
if (NULL != th)
@@ -268,14 +266,14 @@ data_ready (void *cls, size_t size, void *buf)
* Task run in stdio mode, after some data is available at stdin.
*
* @param cls Closure (unused).
- * @param tc scheduler context
*/
static void
-read_stdio (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+read_stdio (void *cls)
{
static char buf[60000];
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
return;
@@ -406,11 +404,13 @@ channel_incoming (void *cls,
* @brief Send an echo request to the remote peer.
*
* @param cls Closure (NULL).
- * @param tc Task context.
*/
static void
-send_echo (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+send_echo (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) || NULL == ch)
return;
@@ -426,10 +426,9 @@ send_echo (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* Call CADET's monitor API, request debug dump on the service.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-request_dump (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+request_dump (void *cls)
{
GNUNET_CADET_request_dump (mh);
GNUNET_SCHEDULER_cancel (sd);
@@ -441,10 +440,9 @@ request_dump (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* Call CADET's monitor API, get info of one connection.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-create_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+create_channel (void *cls)
{
struct GNUNET_PeerIdentity pid;
enum GNUNET_CADET_ChannelOption opt;
@@ -703,11 +701,13 @@ tunnel_callback (void *cls,
* Call CADET's meta API, get all peers known to a peer.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-get_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+get_peers (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
@@ -721,18 +721,17 @@ get_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* Call CADET's monitor API, get info of one peer.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-show_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+show_peer (void *cls)
{
struct GNUNET_PeerIdentity pid;
if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id,
- strlen (peer_id),
- &pid.public_key))
- {
+ GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id,
+ strlen (peer_id),
+ &pid.public_key))
+ {
fprintf (stderr,
_("Invalid peer ID `%s'\n"),
peer_id);
@@ -746,11 +745,13 @@ show_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* Call CADET's meta API, get all tunnels known to a peer.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-get_tunnels (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+get_tunnels (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
@@ -764,10 +765,9 @@ get_tunnels (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* Call CADET's monitor API, get info of one tunnel.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-show_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+show_tunnel (void *cls)
{
struct GNUNET_PeerIdentity pid;
@@ -790,10 +790,9 @@ show_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* Call CADET's monitor API, get info of one channel.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-show_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+show_channel (void *cls)
{
}
@@ -803,10 +802,9 @@ show_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* Call CADET's monitor API, get info of one connection.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-show_connection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+show_connection (void *cls)
{
}
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;
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutting down\n");
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)
* We haven't received an ACK after a certain time: restransmit the message.
*
* @param cls Closure (CadetChannelReliability with the message to restransmit)
- * @param tc TaskContext.
*/
static void
-channel_retransmit_message (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+channel_retransmit_message (void *cls)
{
struct CadetChannelReliability *rel = cls;
struct CadetReliableMessage *copy;
struct CadetChannel *ch;
struct GNUNET_CADET_Data *payload;
int fwd;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
rel->retry_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
@@ -760,14 +760,15 @@ channel_retransmit_message (void *cls,
* We haven't received an Channel ACK after a certain time: resend the CREATE.
*
* @param cls Closure (CadetChannelReliability of the channel to recreate)
- * @param tc TaskContext.
*/
static void
-channel_recreate (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+channel_recreate (void *cls)
{
struct CadetChannelReliability *rel = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
rel->retry_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
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)
* Keep the connection alive in the FWD direction.
*
* @param cls Closure (connection to keepalive).
- * @param tc TaskContext.
*/
static void
-connection_fwd_keepalive (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+connection_fwd_keepalive (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
GCC_check_connections ();
+ tc = GNUNET_SCHEDULER_get_task_context ();
connection_keepalive ((struct CadetConnection *) cls,
GNUNET_YES,
tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN);
@@ -1239,13 +1240,14 @@ connection_fwd_keepalive (void *cls,
* Keep the connection alive in the BCK direction.
*
* @param cls Closure (connection to keepalive).
- * @param tc TaskContext.
*/
static void
-connection_bck_keepalive (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+connection_bck_keepalive (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
GCC_check_connections ();
+ tc = GNUNET_SCHEDULER_get_task_context ();
connection_keepalive ((struct CadetConnection *) cls,
GNUNET_NO,
tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN);
@@ -1400,11 +1402,9 @@ connection_cancel_queues (struct CadetConnection *c,
* possibly due to a missed ACK. Poll the neighbor about its ACK status.
*
* @param cls Closure (poll ctx).
- * @param tc TaskContext.
*/
static void
-connection_poll (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+connection_poll (void *cls);
/**
@@ -1453,18 +1453,19 @@ poll_sent (void *cls,
* possibly due to a missed ACK. Poll the neighbor about its ACK status.
*
* @param cls Closure (poll ctx).
- * @param tc TaskContext.
*/
static void
-connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+connection_poll (void *cls)
{
struct CadetFlowControl *fc = cls;
struct GNUNET_CADET_Poll msg;
struct CadetConnection *c;
int fwd;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
fc->poll_task = NULL;
GCC_check_connections ();
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
return;
@@ -1586,15 +1587,15 @@ connection_timeout (struct CadetConnection *c, int fwd)
* Destroys connection if called.
*
* @param cls Closure (connection to destroy).
- * @param tc TaskContext.
*/
static void
-connection_fwd_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+connection_fwd_timeout (void *cls)
{
struct CadetConnection *c = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
c->fwd_maintenance_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GCC_check_connections ();
@@ -1608,15 +1609,15 @@ connection_fwd_timeout (void *cls,
* Destroys connection if called.
*
* @param cls Closure (connection to destroy).
- * @param tc TaskContext
*/
static void
-connection_bck_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+connection_bck_timeout (void *cls)
{
struct CadetConnection *c = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
c->bck_maintenance_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GCC_check_connections ();
@@ -1761,14 +1762,15 @@ does_connection_exist (struct CadetConnection *conn)
* connection with the same path, and destroy one if so.
*
* @param cls Closure (connection to check).
- * @param tc Task context.
*/
static void
-check_duplicates (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+check_duplicates (void *cls)
{
struct CadetConnection *c = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
c->check_duplicates_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
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,
* Periodically announce self id in the DHT
*
* @param cls closure
- * @param tc task context
*/
static void
-announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+announce_id (void *cls)
{
struct GNUNET_HashCode phash;
const struct GNUNET_HELLO_Message *hello;
size_t size;
struct GNUNET_TIME_Absolute expiration;
struct GNUNET_TIME_Relative retry_time;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
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)
* @brief Start a search for a peer.
*
* @param cls Closure (Peer to search for).
- * @param tc Task context.
*/
static void
-delayed_search (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+delayed_search (void *cls)
{
struct CadetPeer *peer = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
peer->search_delayed = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
GCC_check_connections ();
@@ -1955,11 +1956,9 @@ GCP_get_short (const GNUNET_PEER_Id peer, int create)
* Marks the operation as finished.
*
* @param cls Closure (our `struct CadetPeer`).
- * @param tc TaskContext.
*/
static void
-hello_offer_done (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+hello_offer_done (void *cls)
{
struct CadetPeer *peer = cls;
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)
* @brief Finish the Key eXchange and destroy the old keys.
*
* @param cls Closure (Tunnel for which to finish the KX).
- * @param tc Task context.
*/
static void
-finish_kx (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+finish_kx (void *cls)
{
struct CadetTunnel *t = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
LOG (GNUNET_ERROR_TYPE_INFO, "finish KX for %s\n", GCT_2s (t));
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
LOG (GNUNET_ERROR_TYPE_INFO, " shutdown\n");
@@ -2098,15 +2098,15 @@ send_queued_data (struct CadetTunnel *t)
* @brief Resend the AX KX until we complete the handshake.
*
* @param cls Closure (tunnel).
- * @param tc Task context.
*/
static void
-ax_kx_resend (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+ax_kx_resend (void *cls)
{
struct CadetTunnel *t = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
t->rekey_task = NULL;
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
@@ -2328,16 +2328,16 @@ send_pong (struct CadetTunnel *t, uint32_t challenge)
* Initiate a rekey with the remote peer.
*
* @param cls Closure (tunnel).
- * @param tc TaskContext.
*/
static void
-rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+rekey_tunnel (void *cls)
{
struct CadetTunnel *t = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
t->rekey_task = NULL;
-
LOG (GNUNET_ERROR_TYPE_INFO, "Re-key Tunnel %s\n", GCT_2s (t));
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
@@ -2447,16 +2447,16 @@ rekey_iterator (void *cls,
* Create a new ephemeral key and key message, schedule next rekeying.
*
* @param cls Closure (unused).
- * @param tc TaskContext.
*/
static void
-global_otr_rekey (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+global_otr_rekey (void *cls)
{
struct GNUNET_TIME_Absolute time;
long n;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
rekey_task = NULL;
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
@@ -2833,7 +2833,7 @@ handle_ephemeral (struct CadetTunnel *t,
GNUNET_break (0);
return;
}
- rekey_tunnel (t, NULL);
+ rekey_tunnel (t);
GNUNET_STATISTICS_update (stats, "# otr-downgrades", -1, GNUNET_NO);
}
@@ -2865,7 +2865,7 @@ handle_ephemeral (struct CadetTunnel *t,
}
if (NULL != t->rekey_task)
GNUNET_SCHEDULER_cancel (t->rekey_task);
- t->rekey_task = GNUNET_SCHEDULER_add_now (rekey_tunnel, t);
+ t->rekey_task = GNUNET_SCHEDULER_add_now (&rekey_tunnel, t);
}
if (CADET_TUNNEL_KEY_SENT == t->estate)
{
@@ -3467,15 +3467,15 @@ GCT_change_estate (struct CadetTunnel* t, enum CadetTunnelEState state)
* of being created/processed.
*
* @param cls Closure (Tunnel to check).
- * @param tc Task context.
*/
static void
-trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+trim_connections (void *cls)
{
struct CadetTunnel *t = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
t->trim_connections_task = NULL;
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
@@ -3695,15 +3695,16 @@ GCT_get_channel (struct CadetTunnel *t, CADET_ChannelNumber chid)
* the tunnel. This way we avoid a new public key handshake.
*
* @param cls Closure (tunnel to destroy).
- * @param tc Task context.
*/
static void
-delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+delayed_destroy (void *cls)
{
struct CadetTunnel *t = cls;
struct CadetTConnection *iter;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
LOG (GNUNET_ERROR_TYPE_DEBUG, "delayed destroying tunnel %p\n", t);
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
{
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)
* @param tc Task Context.
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n");
shutdown_handle = NULL;
@@ -276,12 +276,13 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* @param tc Task Context.
*/
static void
-disconnect_cadet_peers (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+disconnect_cadet_peers (void *cls)
{
long line = (long) cls;
unsigned int i;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"disconnecting cadet peers due to SHUTDOWN! called from %ld\n",
@@ -387,16 +388,16 @@ stats_iterator (void *cls, const struct GNUNET_TESTBED_Peer *peer,
* Task to gather all statistics.
*
* @param cls Closure (NULL).
- * @param tc Task Context.
*/
static void
-gather_stats_and_exit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+gather_stats_and_exit (void *cls)
{
- disconnect_task = NULL;
long l = (long) cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ disconnect_task = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "gathering statistics from line %d\n", l);
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
{
disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
@@ -456,18 +457,17 @@ tmt_rdy (void *cls, size_t size, void *buf);
* Task to request a new data transmission.
*
* @param cls Closure (peer #).
- * @param tc Task Context.
*/
static void
-data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+data_task (void *cls)
{
struct GNUNET_CADET_Channel *channel;
static struct GNUNET_CADET_TransmitHandle **pth;
-
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
long src;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data task\n");
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
@@ -837,13 +837,14 @@ channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel,
* on callback function ch.
*
* @param cls Closure (unused).
- * @param tc Task Context.
*/
static void
-do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_test (void *cls)
{
enum GNUNET_CADET_ChannelOption flags;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
@@ -1084,4 +1085,3 @@ main (int argc, char *argv[])
}
/* end of test_cadet.c */
-
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;
* Connect to other client and send data
*
* @param cls Closue (unused).
- * @param tc TaskContext.
*/
static void
-do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+do_connect (void *cls);
/**
* Shutdown nicely
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n");
if (NULL != abort_task)
@@ -91,7 +90,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* Something went wrong and timed out. Kill everything and set error flag
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n");
result = GNUNET_SYSERR;
@@ -101,7 +100,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
GNUNET_SCHEDULER_cancel (shutdown_task);
shutdown_task = NULL;
}
- do_shutdown (cls, tc);
+ do_shutdown (cls);
}
@@ -126,7 +125,8 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
if (NULL != shutdown_task)
GNUNET_SCHEDULER_cancel (shutdown_task);
shutdown_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown,
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+ &do_shutdown,
NULL);
GNUNET_CADET_receive_done (channel);
return GNUNET_OK;
@@ -146,9 +146,11 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
* (can be NULL -- that's not an error)
*/
static void *
-inbound_channel (void *cls, struct GNUNET_CADET_Channel *channel,
- const struct GNUNET_PeerIdentity *initiator,
- uint32_t port, enum GNUNET_CADET_ChannelOption options)
+inbound_channel (void *cls,
+ struct GNUNET_CADET_Channel *channel,
+ const struct GNUNET_PeerIdentity *initiator,
+ uint32_t port,
+ enum GNUNET_CADET_ChannelOption options)
{
long id = (long) cls;
@@ -247,13 +249,14 @@ do_send (void *cls, size_t size, void *buf)
* Connect to other client and send data
*
* @param cls Closue (unused).
- * @param tc TaskContext.
*/
static void
-do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_connect (void *cls)
{
struct GNUNET_PeerIdentity id;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
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);
* Shutdown nicely
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n");
if (NULL != abort_task)
@@ -88,7 +88,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* Something went wrong and timed out. Kill everything and set error flag
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n");
result = GNUNET_SYSERR;
@@ -98,7 +98,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
GNUNET_SCHEDULER_cancel (shutdown_task);
shutdown_task = NULL;
}
- do_shutdown (cls, tc);
+ do_shutdown (cls);
}
@@ -247,14 +247,15 @@ do_send (void *cls, size_t size, void *buf)
* Connect to other client and send data
*
* @param cls Closue (unused).
- * @param tc TaskContext.
*/
static void
-do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_connect (void *cls)
{
struct GNUNET_PeerIdentity id;
size_t size = sizeof (struct GNUNET_MessageHeader) + DATA_SIZE;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;