diff options
393 files changed, 1699 insertions, 2271 deletions
diff --git a/doc/testbed_test.c b/doc/testbed_test.c index e48bb28d89..0ef0980af0 100644 --- a/doc/testbed_test.c +++ b/doc/testbed_test.c @@ -37,7 +37,7 @@ static int result; * Cleans up. */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { shutdown_tid = NULL; if (NULL != dht_op) diff --git a/src/Makefile.am b/src/Makefile.am index 38fa423561..f38dd19d36 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -13,14 +13,9 @@ endif if HAVE_EXPERIMENTAL EXP_DIR = \ dv \ - multicast \ - psycutil \ - psycstore \ - psyc \ rps \ - social \ $(CONSENSUS) \ - $(SECRETSHARING) + $(SECRETSHARING) endif if HAVE_REST @@ -105,6 +100,11 @@ SUBDIRS = \ exit \ pt \ integration-tests \ + multicast \ + psycutil \ + psycstore \ + psyc \ + social \ $(EXP_DIR) \ $(PROVIDER_DIR) diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index 69569511f1..c708f91507 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c @@ -205,10 +205,9 @@ trigger_next_request (struct GNUNET_ARM_Handle *h, int ignore_currently_down); * Task scheduled to try to re-connect to arm. * * @param cls the 'struct GNUNET_ARM_Handle' - * @param tc task context */ static void -reconnect_arm_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect_arm_task (void *cls) { struct GNUNET_ARM_Handle *h = cls; @@ -711,10 +710,9 @@ GNUNET_ARM_disconnect_and_free (struct GNUNET_ARM_Handle *h) * Message timed out. Remove it from the queue. * * @param cls the message (struct ARMControlMessage *) - * @param tc task context */ static void -control_message_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +control_message_timeout (void *cls) { struct ARMControlMessage *cm = cls; struct GNUNET_ARM_Message *arm_msg; diff --git a/src/arm/arm_monitor_api.c b/src/arm/arm_monitor_api.c index ea4caa8666..19a2f4eb93 100644 --- a/src/arm/arm_monitor_api.c +++ b/src/arm/arm_monitor_api.c @@ -85,25 +85,29 @@ struct GNUNET_ARM_MonitorHandle struct GNUNET_SCHEDULER_Task * init_timeout_task_id; }; + static void -monitor_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg); +monitor_notify_handler (void *cls, + const struct GNUNET_MessageHeader *msg); + static int reconnect_arm_monitor (struct GNUNET_ARM_MonitorHandle *h); + /** * Task scheduled to try to re-connect to arm. * * @param cls the 'struct GNUNET_ARM_MonitorHandle' - * @param tc task context */ static void -reconnect_arm_monitor_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect_arm_monitor_task (void *cls) { struct GNUNET_ARM_MonitorHandle *h = cls; h->reconnect_task = NULL; - LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to ARM service for monitoring after delay\n"); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Connecting to ARM service for monitoring after delay\n"); reconnect_arm_monitor (h); } @@ -147,15 +151,14 @@ reconnect_arm_monitor_later (struct GNUNET_ARM_MonitorHandle *h) * Init message timed out. Disconnect and try again. * * @param cls arm monitor handle - * @param tc task context */ static void -init_timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +init_timeout_task (void *cls) { struct GNUNET_ARM_MonitorHandle *h = cls; + LOG (GNUNET_ERROR_TYPE_DEBUG, "Init message timed out\n"); - h->init_timeout_task_id = NULL; reconnect_arm_monitor_later (h); } diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c index 726365edec..af85372d8c 100644 --- a/src/arm/gnunet-arm.c +++ b/src/arm/gnunet-arm.c @@ -179,10 +179,9 @@ delete_files () * jobs that we've been asked to do in order. * * @param cls closure, unused - * @param tc context, unused */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { if (NULL != h) { @@ -269,10 +268,9 @@ ret_string (enum GNUNET_ARM_Result result) * Main task that runs our various operations in order. * * @param cls closure - * @param tc scheudler context */ static void -action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +action_loop (void *cls); /** @@ -539,11 +537,13 @@ list_callback (void *cls, * do, in order. * * @param cls closure, unused - * @param tc context, unused */ static void -action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +action_loop (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Running requested actions\n"); diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index ea89b29894..28d448f756 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c @@ -630,16 +630,17 @@ find_service (const char *name) * create the service in order to relay the incoming connection to it * * @param cls callback data, `struct ServiceListeningInfo` describing a listen socket - * @param tc context */ static void -accept_connection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +accept_connection (void *cls) { struct ServiceListeningInfo *sli = cls; struct ServiceList *sl = sli->sl; + const struct GNUNET_SCHEDULER_TaskContext *tc; sli->accept_task = NULL; GNUNET_assert (GNUNET_NO == in_shutdown); + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; start_process (sl, NULL, 0); @@ -845,11 +846,9 @@ handle_start (void *cls, * Start a shutdown sequence. * * @param cls closure (refers to service) - * @param tc task context */ static void -trigger_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +trigger_shutdown (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Triggering shutdown\n"); @@ -1060,11 +1059,9 @@ list_count (struct ServiceList *running_head) * Task run for shutdown. * * @param cls closure, NULL if we need to self-restart - * @param tc context */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct ServiceList *pos; struct ServiceList *nxt; @@ -1129,17 +1126,18 @@ shutdown_task (void *cls, * Task run whenever it is time to restart a child that died. * * @param cls closure, always NULL - * @param tc context */ static void -delayed_restart_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +delayed_restart_task (void *cls) + { + const struct GNUNET_SCHEDULER_TaskContext *tc; struct ServiceList *sl; struct GNUNET_TIME_Relative lowestRestartDelay; struct ServiceListeningInfo *sli; child_restart_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_assert (GNUNET_NO == in_shutdown); @@ -1204,12 +1202,11 @@ delayed_restart_task (void *cls, * process died). * * @param cls closure, NULL if we need to self-restart - * @param tc context */ static void -maint_child_death (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +maint_child_death (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; struct ServiceList *pos; struct ServiceList *next; struct ServiceListeningInfo *sli; @@ -1223,6 +1220,7 @@ maint_child_death (void *cls, pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); child_death_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) { /* shutdown scheduled us, ignore! */ diff --git a/src/arm/test_arm_api.c b/src/arm/test_arm_api.c index 2bdc0e941a..149ec46c43 100644 --- a/src/arm/test_arm_api.c +++ b/src/arm/test_arm_api.c @@ -122,7 +122,7 @@ resolver_start_cb (void *cls, static void -trigger_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +trigger_disconnect (void *cls) { GNUNET_ARM_disconnect_and_free ((struct GNUNET_ARM_Handle *) cls); } diff --git a/src/arm/test_exponential_backoff.c b/src/arm/test_exponential_backoff.c index 44493c6de9..1032a90105 100644 --- a/src/arm/test_exponential_backoff.c +++ b/src/arm/test_exponential_backoff.c @@ -141,11 +141,9 @@ service_shutdown_handler (void *cls, const struct GNUNET_MessageHeader *msg) * Shutting down took too long, cancel receive and return error. * * @param cls closure - * @param tc context information (why was this task triggered now) */ static void -service_shutdown_cancel (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +service_shutdown_cancel (void *cls) { struct ShutdownContext *shutdown_ctx = cls; @@ -227,7 +225,7 @@ do_nothing_service_shutdown (struct GNUNET_CLIENT_Connection *sock, static void -kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc); +kill_task (void *cbData); static void @@ -246,7 +244,7 @@ shutdown_cont (void *cls, int reason) static void -kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) +kill_task (void *cbData) { static struct GNUNET_CLIENT_Connection *doNothingConnection = NULL; @@ -284,7 +282,7 @@ kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -trigger_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +trigger_disconnect (void *cls) { GNUNET_ARM_disconnect_and_free (arm); GNUNET_ARM_monitor_disconnect_and_free (mon); diff --git a/src/arm/test_gnunet_service_arm.c b/src/arm/test_gnunet_service_arm.c index 7003271fac..33662e5798 100644 --- a/src/arm/test_gnunet_service_arm.c +++ b/src/arm/test_gnunet_service_arm.c @@ -49,8 +49,7 @@ static struct GNUNET_ARM_Handle *arm; static void -trigger_disconnect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +trigger_disconnect (void *cls) { GNUNET_ARM_disconnect_and_free (arm); arm = NULL; diff --git a/src/ats-tests/ats-testing-experiment.c b/src/ats-tests/ats-testing-experiment.c index a4a925847a..b8da23df9e 100644 --- a/src/ats-tests/ats-testing-experiment.c +++ b/src/ats-tests/ats-testing-experiment.c @@ -415,8 +415,9 @@ load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg) return e_counter; } + static void -timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) +timeout_experiment (void *cls) { struct Experiment *e = cls; e->experiment_timeout_task = NULL; @@ -432,6 +433,7 @@ timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) GNUNET_SYSERR); } + static void enforce_start_send (struct GNUNET_ATS_TEST_Operation *op) { @@ -573,10 +575,12 @@ static void enforce_episode (struct Episode *ep) } } + static void -timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) +timeout_episode (void *cls) { struct Experiment *e = cls; + e->episode_timeout_task = NULL; if (NULL != e->ep_done_cb) e->ep_done_cb (e->cur); @@ -741,4 +745,3 @@ GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e) } /* end of file ats-testing-experiment.c*/ - diff --git a/src/ats-tests/ats-testing-log.c b/src/ats-tests/ats-testing-log.c index fff70052dc..650be29f39 100644 --- a/src/ats-tests/ats-testing-log.c +++ b/src/ats-tests/ats-testing-log.c @@ -799,21 +799,24 @@ GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l) } } + static void -collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +collect_log_task (void *cls) { struct LoggingHandle *l = cls; - l->log_task = NULL; + const struct GNUNET_SCHEDULER_TaskContext *tc; + l->log_task = NULL; GNUNET_ATS_TEST_logging_now (l); - + tc = GNUNET_SCHEDULER_get_task_context (); if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) return; - l->log_task = GNUNET_SCHEDULER_add_delayed (l->frequency, - &collect_log_task, l); + &collect_log_task, + l); } + /** * Stop logging * @@ -905,4 +908,3 @@ GNUNET_ATS_TEST_logging_start(struct GNUNET_TIME_Relative log_frequency, return l; } /* end of file ats-testing-log.c */ - diff --git a/src/ats-tests/ats-testing-preferences.c b/src/ats-tests/ats-testing-preferences.c index b8cf205ec1..856c8de4b4 100644 --- a/src/ats-tests/ats-testing-preferences.c +++ b/src/ats-tests/ats-testing-preferences.c @@ -91,8 +91,7 @@ get_preference (struct PreferenceGenerator *pg) static void -set_pref_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +set_pref_task (void *cls) { struct BenchmarkPartner *p = cls; double pref_value; diff --git a/src/ats-tests/ats-testing-traffic.c b/src/ats-tests/ats-testing-traffic.c index 4446be1717..5eb01bd559 100644 --- a/src/ats-tests/ats-testing-traffic.c +++ b/src/ats-tests/ats-testing-traffic.c @@ -166,8 +166,7 @@ send_ping_ready_cb (void *cls, size_t size, void *buf) static void -comm_schedule_send (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +comm_schedule_send (void *cls) { struct BenchmarkPartner *p = cls; @@ -431,4 +430,3 @@ GNUNET_ATS_TEST_generate_traffic_stop_all () } /* end of file ats-testing-traffic.c */ - diff --git a/src/ats-tests/ats-testing.c b/src/ats-tests/ats-testing.c index a3a6b96231..49aa5a052e 100644 --- a/src/ats-tests/ats-testing.c +++ b/src/ats-tests/ats-testing.c @@ -52,14 +52,14 @@ struct GNUNET_CONFIGURATION_Handle *cfg; struct GNUNET_ATS_TEST_Topology *top; + /** * Shutdown nicely * * @param cls NULL - * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { int c_m; int c_s; @@ -437,7 +437,7 @@ connect_completion_callback (void *cls, struct GNUNET_TESTBED_Operation *op, } static void -do_connect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_connect_peers (void *cls) { int c_m; int c_s; @@ -506,7 +506,7 @@ comm_connect_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op, } static void -do_comm_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_comm_connect (void *cls) { int c_s; int c_m; @@ -649,7 +649,7 @@ ats_connect_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op, static void -do_connect_ats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_connect_ats (void *cls) { int c_m; int c_s; diff --git a/src/ats-tests/gnunet-solver-eval.c b/src/ats-tests/gnunet-solver-eval.c index e0d85094c8..0d2460b7fc 100644 --- a/src/ats-tests/gnunet-solver-eval.c +++ b/src/ats-tests/gnunet-solver-eval.c @@ -418,8 +418,9 @@ load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg) return e_counter; } + static void -timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) +timeout_experiment (void *cls) { struct Experiment *e = cls; e->experiment_timeout_task = NULL; @@ -435,6 +436,7 @@ timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) GNUNET_SYSERR); } + static void enforce_start_send (struct GNUNET_ATS_TEST_Operation *op) { @@ -584,8 +586,9 @@ static void enforce_episode (struct Episode *ep) } } + static void -timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) +timeout_episode (void *cls) { struct Experiment *e = cls; e->episode_timeout_task = NULL; @@ -931,4 +934,3 @@ main (int argc, char *argv[]) return 0; } /* end of file ats-testing-experiment.c*/ - diff --git a/src/ats-tests/perf_ats.c b/src/ats-tests/perf_ats.c index c49d5f03df..4c22043e58 100644 --- a/src/ats-tests/perf_ats.c +++ b/src/ats-tests/perf_ats.c @@ -185,10 +185,9 @@ evaluate () * Shutdown nicely * * @param cls NULL - * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (GNUNET_YES == logging) @@ -223,8 +222,9 @@ print_progress () &print_progress, NULL ); } + static void -ats_pref_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +ats_pref_task (void *cls) { struct BenchmarkPeer *me = cls; diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c index d3c6ed9c53..1e4b154328 100644 --- a/src/ats-tests/perf_ats_logging.c +++ b/src/ats-tests/perf_ats_logging.c @@ -637,17 +637,19 @@ collect_log_now (void) } static void -collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +collect_log_task (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + log_task = NULL; collect_log_now(); - + tc = GNUNET_SCHEDULER_get_task_context (); if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) return; log_task = GNUNET_SCHEDULER_add_delayed (frequency, - &collect_log_task, NULL); + &collect_log_task, NULL); } @@ -655,7 +657,6 @@ void perf_logging_stop () { int c_m; - struct GNUNET_SCHEDULER_TaskContext tc; struct PeerLoggingTimestep *cur; if (GNUNET_YES!= running) @@ -664,8 +665,7 @@ perf_logging_stop () if (NULL != log_task) GNUNET_SCHEDULER_cancel (log_task); log_task = NULL; - tc.reason = GNUNET_SCHEDULER_REASON_SHUTDOWN; - collect_log_task (NULL, &tc); + collect_log_task (NULL); GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Stop logging\n")); @@ -685,6 +685,7 @@ perf_logging_stop () GNUNET_free (lp); } + void perf_logging_start (struct GNUNET_TIME_Relative log_frequency, char * testname, struct BenchmarkPeer *masters, int num_masters) @@ -710,4 +711,3 @@ perf_logging_start (struct GNUNET_TIME_Relative log_frequency, running = GNUNET_YES; } /* end of file perf_ats_logging.c */ - diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c index 458db04c8b..a2ef80cef8 100644 --- a/src/ats-tool/gnunet-ats.c +++ b/src/ats-tool/gnunet-ats.c @@ -265,11 +265,9 @@ free_addr_it (void *cls, * Task run on shutdown. * * @param cls NULL - * @param tc scheduler context */ static void -end (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { struct PendingResolutions * pr; struct PendingResolutions * next; diff --git a/src/ats/ats_api_connectivity.c b/src/ats/ats_api_connectivity.c index f1898af3f7..1897e2783e 100644 --- a/src/ats/ats_api_connectivity.c +++ b/src/ats/ats_api_connectivity.c @@ -106,11 +106,9 @@ reconnect (struct GNUNET_ATS_ConnectivityHandle *ch); * Re-establish the connection to the ATS service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -reconnect_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect_task (void *cls) { struct GNUNET_ATS_ConnectivityHandle *ch = cls; diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c index 490c74cfaf..48bb2ebf49 100644 --- a/src/ats/ats_api_performance.c +++ b/src/ats/ats_api_performance.c @@ -261,11 +261,9 @@ reconnect (struct GNUNET_ATS_PerformanceHandle *ph); * Re-establish the connection to the ATS service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -reconnect_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect_task (void *cls) { struct GNUNET_ATS_PerformanceHandle *ph = cls; diff --git a/src/ats/ats_api_scanner.c b/src/ats/ats_api_scanner.c index 3ed0924fec..d9002a0763 100644 --- a/src/ats/ats_api_scanner.c +++ b/src/ats/ats_api_scanner.c @@ -297,11 +297,9 @@ interface_proc (void *cls, * Periodically get list of network addresses from our interfaces. * * @param cls closure - * @param tc Task context */ static void -get_addresses (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +get_addresses (void *cls) { struct GNUNET_ATS_InterfaceScanner *is = cls; diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c index d268418786..0d0d102db4 100644 --- a/src/ats/ats_api_scheduling.c +++ b/src/ats/ats_api_scheduling.c @@ -166,11 +166,9 @@ reconnect (struct GNUNET_ATS_SchedulingHandle *sh); * Re-establish the connection to the ATS service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -reconnect_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect_task (void *cls) { struct GNUNET_ATS_SchedulingHandle *sh = cls; diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index 3cadb2ef71..613df52ad2 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c @@ -216,7 +216,7 @@ GNUNET_ATS_solver_logging_now (struct LoggingHandle *l) static void -logging_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +logging_task (void *cls) { struct LoggingHandle *l = cls; @@ -590,7 +590,7 @@ get_property (struct PropertyGenerator *pg) static void -set_prop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +set_prop_task (void *cls) { struct PropertyGenerator *pg = cls; struct TestPeer *p; @@ -858,9 +858,9 @@ get_preference (struct PreferenceGenerator *pg) return pref_value; } + static void -set_feedback_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +set_feedback_task (void *cls) { struct PreferenceGenerator *pg = cls; struct TestPeer *p; @@ -934,8 +934,7 @@ set_feedback_task (void *cls, static void -set_pref_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +set_pref_task (void *cls) { struct PreferenceGenerator *pg = cls; struct TestPeer *p; @@ -2124,10 +2123,12 @@ load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg) return e_counter; } + static void -timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) +timeout_experiment (void *cls) { struct Experiment *e = cls; + e->experiment_timeout_task = NULL; fprintf (stderr, "Experiment timeout!\n"); @@ -2487,10 +2488,12 @@ static void enforce_episode (struct Episode *ep) } } + static void -timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) +timeout_episode (void *cls) { struct Experiment *e = cls; + e->episode_timeout_task = NULL; if (NULL != e->ep_done_cb) e->ep_done_cb (e->cur); diff --git a/src/ats/gnunet-service-ats.c b/src/ats/gnunet-service-ats.c index 11db62e2d1..7b8dfe2220 100644 --- a/src/ats/gnunet-service-ats.c +++ b/src/ats/gnunet-service-ats.c @@ -124,11 +124,9 @@ client_disconnect_handler (void *cls, * Task run during shutdown. * * @param cls unused - * @param tc unused */ static void -cleanup_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_task (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS shutdown initiated\n"); diff --git a/src/ats/gnunet-service-ats_preferences.c b/src/ats/gnunet-service-ats_preferences.c index b56a8fd7f5..c835b026bd 100644 --- a/src/ats/gnunet-service-ats_preferences.c +++ b/src/ats/gnunet-service-ats_preferences.c @@ -388,11 +388,9 @@ age_values (void *cls, * Reduce absolute preferences since they got old. * * @param cls unused - * @param tc context */ static void -preference_aging (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +preference_aging (void *cls) { struct AgeContext ac; diff --git a/src/ats/plugin_ats_ril.c b/src/ats/plugin_ats_ril.c index 0f02fe34ad..766a9936d8 100644 --- a/src/ats/plugin_ats_ril.c +++ b/src/ats/plugin_ats_ril.c @@ -1513,10 +1513,9 @@ ril_step (struct GAS_RIL_Handle *solver); * no further step is scheduled. * * @param cls the solver handle - * @param tc the task context for the scheduler */ static void -ril_step_scheduler_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +ril_step_scheduler_task (void *cls) { struct GAS_RIL_Handle *solver = cls; diff --git a/src/ats/test_ats_lib.c b/src/ats/test_ats_lib.c index 6592cded11..b0c42ac3d8 100644 --- a/src/ats/test_ats_lib.c +++ b/src/ats/test_ats_lib.c @@ -279,11 +279,9 @@ find_address_information (const struct GNUNET_HELLO_Address *addr) * Task run to terminate the testcase. * * @param cls NULL - * @param tc unused */ static void -end (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { if (0 != ret) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -335,11 +333,9 @@ end (void *cls, * Main interpreter loop. Runs the steps of the test. * * @param cls NULL - * @param tc unused */ static void -interpreter (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +interpreter (void *cls); /** @@ -591,11 +587,9 @@ reservation_cb (void *cls, * Main interpreter loop. Runs the steps of the test. * * @param cls NULL - * @param tc unused */ static void -interpreter (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +interpreter (void *cls) { struct Command *cmd; diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index a1fe90cc5b..6894d24822 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 1ea2b185fe..47241292bc 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 bda844b136..ffa993f8e4 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 5c5ec54b97..14b499aaee 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 86f1692e1d..a2e00300b6 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 a2e01d28f4..debae7d778 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 186204f1e4..d11368a79c 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 2e8e53a9d1..088d40eaca 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 594c357019..51af045277 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 67c2ad5fa4..73bd28643b 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 d1b1b8212c..39bfc5fed4 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 ef68829616..42663b146a 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 d5c19ac015..93a50c02c5 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; diff --git a/src/consensus/gnunet-consensus-profiler.c b/src/consensus/gnunet-consensus-profiler.c index 355ae60a33..4af7740e79 100644 --- a/src/consensus/gnunet-consensus-profiler.c +++ b/src/consensus/gnunet-consensus-profiler.c @@ -120,8 +120,8 @@ statistics_done_db (void *cls, * @param subsystem name of subsystem that created the statistic * @param name the name of the datum * @param value the current value - * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not - * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration + * @param is_persistent #GNUNET_YES if the value is persistent, #GNUNET_NO if not + * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration */ static int statistics_cb (void *cls, @@ -140,7 +140,7 @@ statistics_cb (void *cls, static void -destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *ctx) +destroy (void *cls) { struct GNUNET_CONSENSUS_Handle *consensus = cls; @@ -521,4 +521,3 @@ main (int argc, char **argv) options, &run, NULL, GNUNET_YES); return 0; } - diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c index e8385a6bb9..82b05d136e 100644 --- a/src/consensus/gnunet-service-consensus.c +++ b/src/consensus/gnunet-service-consensus.c @@ -3169,11 +3169,9 @@ client_conclude (void *cls, * Called to clean up, after a shutdown has been requested. * * @param cls closure - * @param tc context information (why was this task triggered now) */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { while (NULL != sessions_head) destroy_session (sessions_head); diff --git a/src/consensus/test_consensus_api.c b/src/consensus/test_consensus_api.c index 18c5b3b31f..0073267f8a 100644 --- a/src/consensus/test_consensus_api.c +++ b/src/consensus/test_consensus_api.c @@ -67,11 +67,9 @@ insert_done (void *cls, int success) * Signature of the main function of a task. * * @param cls closure - * @param tc context information (why was this task triggered now) */ static void -on_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +on_shutdown (void *cls) { if (NULL != consensus) { @@ -121,4 +119,3 @@ main (int argc, char **argv) &run, NULL); return ret; } - diff --git a/src/conversation/gnunet-conversation-test.c b/src/conversation/gnunet-conversation-test.c index 1c8fe74e6e..fe6eae925f 100644 --- a/src/conversation/gnunet-conversation-test.c +++ b/src/conversation/gnunet-conversation-test.c @@ -96,11 +96,9 @@ static struct Recording *rec_tail; * Terminate test. * * @param cls NULL - * @param tc unused */ static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { struct Recording *rec; @@ -126,11 +124,9 @@ do_shutdown (void *cls, * Terminate recording process and switch to playback. * * @param cls NULL - * @param tc unused */ static void -switch_to_speaker (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +switch_to_speaker (void *cls) { struct Recording *rec; diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c index 3b50c8043b..9000bcf3f8 100644 --- a/src/conversation/gnunet-conversation.c +++ b/src/conversation/gnunet-conversation.c @@ -1020,11 +1020,9 @@ do_help (const char *args) * Task run during shutdown. * * @param cls NULL - * @param tc unused */ static void -do_stop_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_stop_task (void *cls) { #ifdef WINDOWS if (NULL != stdin_hlp) @@ -1132,11 +1130,9 @@ console_reader_chars (void *cls, * Task to handle commands from the terminal. * * @param cls NULL - * @param tc scheduler context */ static void -handle_command (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +handle_command (void *cls) { char message[MAX_MESSAGE_LENGTH + 1]; diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c index 8761ed5e1c..fdaa2999c2 100644 --- a/src/conversation/gnunet-service-conversation.c +++ b/src/conversation/gnunet-service-conversation.c @@ -1463,11 +1463,9 @@ handle_client_disconnect (void *cls, * Shutdown nicely * * @param cls closure, NULL - * @param tc the task context */ static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { struct Line *line; struct Channel *ch; diff --git a/src/conversation/test_conversation_api.c b/src/conversation/test_conversation_api.c index 317818c8e8..f8159115b2 100644 --- a/src/conversation/test_conversation_api.c +++ b/src/conversation/test_conversation_api.c @@ -73,8 +73,7 @@ static struct GNUNET_SCHEDULER_Task * call_task; static void -phone_send (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +phone_send (void *cls) { static unsigned int i; char buf[32]; @@ -88,8 +87,7 @@ phone_send (void *cls, static void -call_send (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +call_send (void *cls) { static unsigned int i; char buf[32]; @@ -272,10 +270,9 @@ static struct GNUNET_MICROPHONE_Handle phone_mic = { * Signature of the main function of a task. * * @param cls closure - * @param tc context information (why was this task triggered now) */ static void -end_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_test (void *cls) { GNUNET_SCHEDULER_shutdown (); if (NULL != op) diff --git a/src/conversation/test_conversation_api_reject.c b/src/conversation/test_conversation_api_reject.c index 13dfcd3d5d..5f1f836f70 100644 --- a/src/conversation/test_conversation_api_reject.c +++ b/src/conversation/test_conversation_api_reject.c @@ -130,10 +130,9 @@ static struct GNUNET_MICROPHONE_Handle call_mic = { * Signature of the main function of a task. * * @param cls closure - * @param tc context information (why was this task triggered now) */ static void -end_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_test (void *cls) { GNUNET_SCHEDULER_shutdown (); if (NULL != op) diff --git a/src/conversation/test_conversation_api_twocalls.c b/src/conversation/test_conversation_api_twocalls.c index 5d7e56d95e..17a12eb4f3 100644 --- a/src/conversation/test_conversation_api_twocalls.c +++ b/src/conversation/test_conversation_api_twocalls.c @@ -124,8 +124,7 @@ static struct MicContext call2_mic_ctx; static void -phone_send (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +phone_send (void *cls) { char buf[32]; @@ -138,8 +137,7 @@ phone_send (void *cls, static void -call_send (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +call_send (void *cls) { struct MicContext *mc = cls; char buf[32]; @@ -343,10 +341,9 @@ static struct GNUNET_MICROPHONE_Handle phone_mic = { * Signature of the main function of a task. * * @param cls closure - * @param tc context information (why was this task triggered now) */ static void -end_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_test (void *cls) { GNUNET_SCHEDULER_shutdown (); if (NULL != op) diff --git a/src/core/core_api.c b/src/core/core_api.c index 20f0acc092..7b423b6a0e 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c @@ -339,8 +339,7 @@ reconnect (struct GNUNET_CORE_Handle *h); * @param tc task context */ static void -reconnect_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect_task (void *cls) { struct GNUNET_CORE_Handle *h = cls; @@ -1214,11 +1213,9 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle) * Task that calls #request_next_transmission(). * * @param cls the `struct PeerRecord *` - * @param tc scheduler context */ static void -run_request_next_transmission (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +run_request_next_transmission (void *cls) { struct PeerRecord *pr = cls; diff --git a/src/core/gnunet-core.c b/src/core/gnunet-core.c index c70d49bb72..968072e228 100644 --- a/src/core/gnunet-core.c +++ b/src/core/gnunet-core.c @@ -44,11 +44,9 @@ static struct GNUNET_CORE_MonitorHandle *mh; * Stops monitoring activity. * * @param cls NULL - * @param tc scheduler context */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { if (NULL != mh) { diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index 83942d9ab8..1d9de86665 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c @@ -60,12 +60,12 @@ static struct GNUNET_SERVER_Handle *GSC_server; * the transport. * * @param cls NULL, unused - * @param tc scheduler context, unused */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core service shutting down.\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Core service shutting down.\n"); GSC_CLIENTS_done (); GSC_NEIGHBOURS_done (); GSC_SESSIONS_done (); diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index 988c5790ad..8250bcc6f2 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c @@ -659,11 +659,9 @@ send_key (struct GSC_KeyExchangeInfo *kx); * Task that will retry #send_key() if our previous attempt failed. * * @param cls our `struct GSC_KeyExchangeInfo` - * @param tc scheduler context */ static void -set_key_retry_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +set_key_retry_task (void *cls) { struct GSC_KeyExchangeInfo *kx = cls; @@ -1104,11 +1102,9 @@ GSC_KX_handle_ping (struct GSC_KeyExchangeInfo *kx, * (and we should prevent this by sending a PING). * * @param cls the `struct GSC_KeyExchangeInfo` - * @param tc scheduler context (not used) */ static void -send_keep_alive (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +send_keep_alive (void *cls) { struct GSC_KeyExchangeInfo *kx = cls; struct GNUNET_TIME_Relative retry; @@ -1698,11 +1694,9 @@ sign_ephemeral_key () * Task run to trigger rekeying. * * @param cls closure, NULL - * @param tc scheduler context */ static void -do_rekey (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_rekey (void *cls) { struct GSC_KeyExchangeInfo *pos; diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c index 78ab8027e3..890499394b 100644 --- a/src/core/gnunet-service-core_sessions.c +++ b/src/core/gnunet-service-core_sessions.c @@ -264,11 +264,9 @@ GSC_SESSIONS_end (const struct GNUNET_PeerIdentity *pid) * (Done periodically until the typemap is confirmed). * * @param cls the `struct Session *` - * @param tc unused */ static void -transmit_typemap_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +transmit_typemap_task (void *cls) { struct Session *session = cls; struct GNUNET_MessageHeader *hdr; @@ -589,11 +587,9 @@ solicit_messages (struct Session *session, * Send them now. * * @param cls `struct Session` with the messages to transmit now - * @param tc scheduler context (unused) */ static void -pop_cork_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +pop_cork_task (void *cls) { struct Session *session = cls; diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index 973b97bff4..92ee038da3 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c @@ -99,8 +99,7 @@ terminate_peer (struct PeerContext *p) static void -terminate_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +terminate_task (void *cls) { GNUNET_assert (ok == 6); terminate_peer (&p1); @@ -110,8 +109,7 @@ terminate_task (void *cls, static void -terminate_task_error (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +terminate_task_error (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ENDING ANGRILY %u\n", diff --git a/src/core/test_core_api_mq.c b/src/core/test_core_api_mq.c index 3b063afcaa..a82465e74c 100644 --- a/src/core/test_core_api_mq.c +++ b/src/core/test_core_api_mq.c @@ -96,8 +96,7 @@ handle_test (void *cls, 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"); GNUNET_MQ_destroy (mq); diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index 5951e6c844..49affdff3e 100644 --- a/src/core/test_core_api_reliability.c +++ b/src/core/test_core_api_reliability.c @@ -128,8 +128,7 @@ terminate_peer (struct PeerContext *p) static void -terminate_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +terminate_task (void *cls) { unsigned long long delta; @@ -146,8 +145,7 @@ terminate_task (void *cls, static void -terminate_task_error (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +terminate_task_error (void *cls) { GNUNET_break (0); terminate_peer (&p1); diff --git a/src/core/test_core_api_send_to_self.c b/src/core/test_core_api_send_to_self.c index 4b1a94ceaa..54dd29ca8e 100644 --- a/src/core/test_core_api_send_to_self.c +++ b/src/core/test_core_api_send_to_self.c @@ -55,7 +55,7 @@ struct GNUNET_CORE_Handle *core; * Function scheduled as very last function, cleans up after us */ static void -cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tskctx) +cleanup (void *cls) { die_task = NULL; diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c index 3cd7779369..42bf4e4526 100644 --- a/src/core/test_core_api_start_only.c +++ b/src/core/test_core_api_start_only.c @@ -92,7 +92,7 @@ static struct GNUNET_CORE_MessageHandler handlers[] = { static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { GNUNET_CORE_disconnect (p1.ch); p1.ch = NULL; @@ -144,7 +144,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) static void -timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_task (void *cls) { FPRINTF (stderr, "%s", "Timeout.\n"); if (p1.ch != NULL) diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index 02b9b3f3e4..ed895df423 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c @@ -152,8 +152,7 @@ terminate_peer (struct PeerContext *p) static void -terminate_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +terminate_task (void *cls) { err_task = NULL; terminate_peer (&p1); @@ -162,11 +161,12 @@ terminate_task (void *cls, static void -terminate_task_error (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +terminate_task_error (void *cls) { - err_task = NULL; + const struct GNUNET_SCHEDULER_TaskContext *tc; + err_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Testcase failed!\n"); @@ -214,8 +214,7 @@ print_stat (void *cls, static void -measurement_stop (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +measurement_stop (void *cls) { unsigned long long delta; unsigned long long throughput_out; diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index cca67f6bca..832829e248 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c @@ -278,11 +278,9 @@ GNUNET_DATASTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) * Task used by 'transmit_drop' to disconnect the datastore. * * @param cls the datastore handle - * @param tc scheduler context */ static void -disconnect_after_drop (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +disconnect_after_drop (void *cls) { struct GNUNET_DATASTORE_Handle *h = cls; @@ -383,10 +381,9 @@ GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, * A request has timed out (before being transmitted to the service). * * @param cls the `struct GNUNET_DATASTORE_QueueEntry` - * @param tc scheduler context */ static void -timeout_queue_entry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_queue_entry (void *cls) { struct GNUNET_DATASTORE_QueueEntry *qe = cls; struct GNUNET_DATASTORE_Handle *h = qe->h; @@ -520,10 +517,9 @@ process_queue (struct GNUNET_DATASTORE_Handle *h); * Try reconnecting to the datastore service. * * @param cls the `struct GNUNET_DATASTORE_Handle` - * @param tc scheduler context */ static void -try_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +try_reconnect (void *cls) { struct GNUNET_DATASTORE_Handle *h = cls; diff --git a/src/datastore/gnunet-datastore.c b/src/datastore/gnunet-datastore.c index 93c23c3fc0..186889e4cd 100644 --- a/src/datastore/gnunet-datastore.c +++ b/src/datastore/gnunet-datastore.c @@ -70,8 +70,7 @@ static struct GNUNET_DATASTORE_QueueEntry *qe; static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != qe) GNUNET_DATASTORE_cancel (qe); diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index 4979f44825..fdccd925ee 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c @@ -303,11 +303,9 @@ static struct GNUNET_SERVER_Handle *server; * content quickly. * * @param cls not used - * @param tc task context */ static void -delete_expired (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +delete_expired (void *cls); /** @@ -388,10 +386,9 @@ expired_processor (void *cls, * content quickly. * * @param cls not used - * @param tc task context */ static void -delete_expired (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +delete_expired (void *cls) { expired_kill_task = NULL; plugin->api->get_expiration (plugin->api->cls, &expired_processor, NULL); @@ -1579,8 +1576,7 @@ process_stat_done (void *cls, * Task run during shutdown. */ static void -cleaning_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cleaning_task (void *cls) { struct TransmitCallbackContext *tcc; diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c index e430bfe93e..41cac12838 100644 --- a/src/datastore/perf_datastore_api.c +++ b/src/datastore/perf_datastore_api.c @@ -186,11 +186,9 @@ struct CpsRunContext * depending on the current state. * * @param cls the `struct CpsRunContext` - * @param tc scheduler context (unused) */ static void -run_continuation (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +run_continuation (void *cls); /** @@ -344,18 +342,18 @@ delete_value (void *cls, * depending on the current state. * * @param cls the `struct CpsRunContext` - * @param tc scheduler context (unused) */ static void -run_continuation (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +run_continuation (void *cls) { struct CpsRunContext *crc = cls; size_t size; static struct GNUNET_HashCode key; static char data[65536]; char gstr[128]; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) crc->phase = RP_ERROR; ok = (int) crc->phase; diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c index 4365fbd258..0aeb426abf 100644 --- a/src/datastore/perf_plugin_datastore.c +++ b/src/datastore/perf_plugin_datastore.c @@ -99,8 +99,7 @@ disk_utilization_change_cb (void *cls, int delta) static void -test (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +test (void *cls); /** @@ -115,8 +114,8 @@ test (void *cls, static void put_continuation (void *cls, const struct GNUNET_HashCode *key, - uint32_t size, - int status, + uint32_t size, + int status, const char *msg) { struct CpsRunContext *crc = cls; @@ -376,7 +375,7 @@ unload_plugin (struct GNUNET_DATASTORE_PluginFunctions *api, * the transport and core. */ static void -cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +cleaning_task (void *cls) { struct CpsRunContext *crc = cls; @@ -386,10 +385,12 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +test (void *cls) { struct CpsRunContext *crc = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { GNUNET_break (0); diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c index 12f2ef762e..7d4565de6e 100644 --- a/src/datastore/test_datastore_api.c +++ b/src/datastore/test_datastore_api.c @@ -168,11 +168,9 @@ struct CpsRunContext * depending on the current state. * * @param cls the `struct CpsRunContext` - * @param tc scheduler context (unused) */ static void -run_continuation (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +run_continuation (void *cls); /** @@ -394,11 +392,9 @@ check_update (void *cls, * depending on the current state. * * @param cls the `struct CpsRunContext` - * @param tc scheduler context (unused) */ static void -run_continuation (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +run_continuation (void *cls) { struct CpsRunContext *crc = cls; diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c index 9ef83c55c2..c9fec79e35 100644 --- a/src/datastore/test_datastore_api_management.c +++ b/src/datastore/test_datastore_api_management.c @@ -119,7 +119,7 @@ get_expiration (int i) static void -run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +run_continuation (void *cls); static void @@ -182,7 +182,7 @@ check_nothing (void *cls, const struct GNUNET_HashCode * key, size_t size, static void -run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +run_continuation (void *cls) { struct CpsRunContext *crc = cls; diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c index 4efad74be1..d7dff1041e 100644 --- a/src/datastore/test_plugin_datastore.c +++ b/src/datastore/test_plugin_datastore.c @@ -84,8 +84,7 @@ disk_utilization_change_cb (void *cls, int delta) static void -test (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +test (void *cls); /** @@ -98,10 +97,10 @@ test (void *cls, * @param msg error message on error */ static void -put_continuation (void *cls, +put_continuation (void *cls, const struct GNUNET_HashCode *key, - uint32_t size, - int status, + uint32_t size, + int status, const char *msg) { struct CpsRunContext *crc = cls; @@ -241,7 +240,7 @@ unload_plugin (struct GNUNET_DATASTORE_PluginFunctions *api, * the transport and core. */ static void -cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +cleaning_task (void *cls) { struct CpsRunContext *crc = cls; @@ -251,7 +250,7 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -update_continuation (void *cls, +update_continuation (void *cls, int status, const char *msg) { @@ -264,11 +263,13 @@ update_continuation (void *cls, static void -test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +test (void *cls) { struct CpsRunContext *crc = cls; struct GNUNET_HashCode key; + 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_WARNING, "Test aborted.\n"); @@ -302,9 +303,9 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) case RP_UPDATE: crc->api->update (crc->api->cls, guid, - 1, + 1, GNUNET_TIME_UNIT_ZERO_ABS, - &update_continuation, + &update_continuation, crc); break; @@ -344,8 +345,8 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg) char *libname; if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, - "DATASTORE", + GNUNET_CONFIGURATION_get_value_string (cfg, + "DATASTORE", "DATABASE", &name)) { @@ -366,7 +367,7 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg) FPRINTF (stderr, "Failed to load plugin `%s'!\n", name); GNUNET_free (libname); GNUNET_free (name); - ok = 77; /* mark test as skipped */ + ok = 77; /* mark test as skipped */ return NULL; } GNUNET_free (libname); diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c index 35d9580e98..b5ae2f8ce6 100644 --- a/src/dht/dht_api.c +++ b/src/dht/dht_api.c @@ -362,7 +362,7 @@ struct GNUNET_DHT_Handle * Did we start our receive loop yet? */ int in_receive; - + #if ENABLE_MALICIOUS /** * Handle of act malicious request. @@ -496,11 +496,9 @@ process_pending_messages (struct GNUNET_DHT_Handle *handle); * Try reconnecting to the dht service. * * @param cls a `struct GNUNET_DHT_Handle` - * @param tc scheduler context */ static void -try_reconnect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +try_reconnect (void *cls) { struct GNUNET_DHT_Handle *handle = cls; @@ -650,7 +648,7 @@ transmit_pending (void *cls, head->in_pending_queue = GNUNET_NO; if (NULL != head->cont) { - head->cont (head->cont_cls, NULL); + head->cont (head->cont_cls); head->cont = NULL; head->cont_cls = NULL; } @@ -663,7 +661,7 @@ transmit_pending (void *cls, { LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting to process replies from DHT\n"); handle->in_receive = GNUNET_YES; - + GNUNET_CLIENT_receive (handle->client, &service_message_handler, handle, GNUNET_TIME_UNIT_FOREVER_REL); } @@ -899,7 +897,7 @@ process_act_malicious_confirmation_message (struct GNUNET_DHT_Handle *handle, struct GNUNET_DHT_ActMaliciousHandle *mh; GNUNET_DHT_PutContinuation cont; void *cont_cls; - + mh = handle->mh; if (NULL == mh) return GNUNET_OK; @@ -907,7 +905,7 @@ process_act_malicious_confirmation_message (struct GNUNET_DHT_Handle *handle, cont_cls = mh->cont_cls; if (NULL != cont) cont (cont_cls, GNUNET_OK); - + return GNUNET_OK; } #endif @@ -1110,7 +1108,7 @@ GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle) pm->in_pending_queue = GNUNET_NO; GNUNET_assert (GNUNET_YES == pm->free_on_send); if (NULL != pm->cont) - pm->cont (pm->cont_cls, NULL); + pm->cont (pm->cont_cls); GNUNET_free (pm); } while (NULL != (ph = handle->put_head)) @@ -1137,11 +1135,9 @@ GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle) * Timeout for the transmission of a fire&forget-request. Clean it up. * * @param cls the `struct GNUNET_DHT_PutHandle *` - * @param tc scheduler context */ static void -timeout_put_request (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_put_request (void *cls) { struct GNUNET_DHT_PutHandle *ph = cls; struct GNUNET_DHT_Handle *handle = ph->dht_handle; @@ -1168,11 +1164,9 @@ timeout_put_request (void *cls, * the message pointer in the put handle to NULL. * * @param cls the `struct GNUNET_DHT_PutHandle` - * @param tc unused */ static void -mark_put_message_gone (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +mark_put_message_gone (void *cls) { struct GNUNET_DHT_PutHandle *ph = cls; @@ -1570,10 +1564,10 @@ GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *handle) * @param handle the DHT handle * @param action 1 to make the service malicious; 0 to make it benign * @param cont continuation to call when done (transmitting request to service) - * @param cont_cls closure for @a cont + * @param cont_cls closure for @a cont */ struct GNUNET_DHT_ActMaliciousHandle * -GNUNET_DHT_act_malicious (struct GNUNET_DHT_Handle *handle, +GNUNET_DHT_act_malicious (struct GNUNET_DHT_Handle *handle, unsigned int action, GNUNET_DHT_PutContinuation cont, void *cont_cls) @@ -1582,7 +1576,7 @@ GNUNET_DHT_act_malicious (struct GNUNET_DHT_Handle *handle, struct GNUNET_DHT_ActMaliciousHandle *mh; struct PendingMessage *pending; size_t msize; - + msize = sizeof(struct GNUNET_DHT_ActMaliciousMessage); if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) { diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c index 7349d0c826..6846b3af76 100644 --- a/src/dht/gnunet-dht-get.c +++ b/src/dht/gnunet-dht-get.c @@ -87,10 +87,9 @@ static int ret; * Task run to clean up on timeout. * * @param cls unused - * @param tc unused */ static void -cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_task (void *cls) { if (NULL != get_handle) { diff --git a/src/dht/gnunet-dht-monitor.c b/src/dht/gnunet-dht-monitor.c index 9047ba6856..0502496d7b 100644 --- a/src/dht/gnunet-dht-monitor.c +++ b/src/dht/gnunet-dht-monitor.c @@ -76,10 +76,9 @@ static int ret; * Stop monitoring request and start shutdown * * @param cls closure (unused) - * @param tc Task Context */ static void -cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_task (void *cls) { if (verbose) FPRINTF (stderr, "%s", "Cleaning up!\n"); diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c index c58311876d..19e385be10 100644 --- a/src/dht/gnunet-dht-put.c +++ b/src/dht/gnunet-dht-put.c @@ -87,8 +87,9 @@ static int ret; */ static char *data; + static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { if (NULL != dht_handle) { @@ -101,9 +102,9 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Signature of the main function of a task. * * @param cls closure - * @param success GNUNET_OK if the PUT was transmitted, - * GNUNET_NO on timeout, - * GNUNET_SYSERR on disconnect from service + * @param success #GNUNET_OK if the PUT was transmitted, + * #GNUNET_NO on timeout, + * #GNUNET_SYSERR on disconnect from service * after the PUT message was transmitted * (so we don't know if it was received or not) */ diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index 006364664c..1aeca9b85c 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) * 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) { if (NULL != ghh) { @@ -159,10 +158,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, GDS_CLIENTS_init (server); if (GNUNET_OK != GDS_NEIGHBOURS_init ()) { - shutdown_task (NULL, NULL); + shutdown_task (NULL); return; } - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, + &shutdown_task, NULL); GDS_transport_handle = 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 30eb6afa63..e42069fe0a 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) * itself (unless the heap is empty). * * @param cls unused - * @param tc scheduler context */ static void -transmit_next_request_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +transmit_next_request_task (void *cls) { struct ClientQueryRecord *cqr; struct GNUNET_TIME_Relative delay; + const struct GNUNET_SCHEDULER_TaskContext *tc; retry_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; 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 cedafbd6cc..d82effb343 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) * Clean up the "oh" field in the @a cls * * @param cls a `struct ConnectInfo` - * @param tc unused */ static void -offer_hello_done (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +offer_hello_done (void *cls) { struct ConnectInfo *ci = cls; @@ -707,17 +705,17 @@ add_known_to_bloom (void *cls, * and attempt to connect to them. * * @param cls closure for this task - * @param tc the context under which the task is running */ static void -send_find_peer_message (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +send_find_peer_message (void *cls) { struct GNUNET_TIME_Relative next_send_time; struct BloomConstructorContext bcc; struct GNUNET_CONTAINER_BloomFilter *peer_bf; + const struct GNUNET_SCHEDULER_TaskContext *tc; find_peer_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; if (newly_found_peers > bucket_size) diff --git a/src/dht/gnunet-service-wdht.c b/src/dht/gnunet-service-wdht.c index 339b38aa4b..0668c9078f 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; * 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) { GDS_NEIGHBOURS_done (); GDS_DATACACHE_done (); @@ -100,7 +99,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, GDS_CLIENTS_init (server); if (GNUNET_OK != GDS_NEIGHBOURS_init ()) { - shutdown_task (NULL, NULL); + shutdown_task (NULL); return; } 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 0662472a8e..c3aff03aa3 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) * itself (unless the heap is empty). * * @param cls unused - * @param tc scheduler context */ static void -transmit_next_request_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +transmit_next_request_task (void *cls) { struct ClientQueryRecord *cqr; struct GNUNET_TIME_Relative delay; + const struct GNUNET_SCHEDULER_TaskContext *tc; retry_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; 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 ef73c80a91..54c52507e1 100644 --- a/src/dht/gnunet-service-wdht_neighbours.c +++ b/src/dht/gnunet-service-wdht_neighbours.c @@ -931,11 +931,9 @@ pick_random_friend () * possibly initiate cleanup. * * @param cls NULL - * @param tc unused */ static void -trail_timeout_callback (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +trail_timeout_callback (void *cls) { struct Trail *trail; struct GNUNET_TIME_Relative left; @@ -974,11 +972,9 @@ get_desired_finger_array_size () * Initiate a random walk. * * @param cls NULL - * @param tc unused */ static void -do_random_walk (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_random_walk (void *cls) { static unsigned int walk_layer; struct FriendInfo *friend; diff --git a/src/dht/gnunet-service-xdht.c b/src/dht/gnunet-service-xdht.c index 3bab7e946f..f6c7c51670 100644 --- a/src/dht/gnunet-service-xdht.c +++ b/src/dht/gnunet-service-xdht.c @@ -73,10 +73,9 @@ unsigned int malicious; * 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) { GDS_NEIGHBOURS_done (); GDS_DATACACHE_done (); @@ -123,7 +122,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, } if (GNUNET_OK != GDS_NEIGHBOURS_init ()) { - shutdown_task (NULL, NULL); + shutdown_task (NULL); return; } 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 1a1ee9e82c..e08ccf792b 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) * itself (unless the heap is empty). * * @param cls unused - * @param tc scheduler context */ static void -transmit_next_request_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +transmit_next_request_task (void *cls) { struct ClientQueryRecord *cqr; struct GNUNET_TIME_Relative delay; + const struct GNUNET_SCHEDULER_TaskContext *tc; retry_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; 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 96fdaa9d74..c6de94a5a4 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) * finger identity through this random friend. * * @param cls closure for this task - * @param tc the context under which the task is running */ static void -send_find_finger_trail_message (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +send_find_finger_trail_message (void *cls) { struct FriendInfo *target_friend; struct GNUNET_HashCode trail_id; @@ -3219,12 +3217,11 @@ add_new_finger (struct GNUNET_PeerIdentity finger_identity, * Periodic task to verify current successor. There can be multiple trails to reach * to successor, choose the shortest one and send verify successor message * across that trail. + * * @param cls closure for this task - * @param tc the context under which the task is running */ static void -send_verify_successor_message (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +send_verify_successor_message (void *cls) { struct FriendInfo *target_friend; struct GNUNET_HashCode trail_id; @@ -5077,10 +5074,10 @@ struct SendNotifyContext unsigned int num_retries_scheduled; }; + void -send_notify_new_successor (void *cls, - const struct GNUNET_SCHEDULER_TaskContext - * tc); +send_notify_new_successor (void *cls); + /** * 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, void -send_notify_new_successor (void *cls, - const struct GNUNET_SCHEDULER_TaskContext - * tc) +send_notify_new_successor (void *cls) { - struct SendNotifyContext *ctx = (struct SendNotifyContext *) cls; + struct SendNotifyContext *ctx = cls; GDS_NEIGHBOURS_send_notify_new_successor (ctx->source_peer, ctx->successor, diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c index 7d6ac685a0..f0c4ec7bec 100644 --- a/src/dht/gnunet_dht_profiler.c +++ b/src/dht/gnunet_dht_profiler.c @@ -406,28 +406,30 @@ static int in_shutdown = 0; */ static unsigned int tries; + /** * Task that collects successor statistics from all the peers. + * * @param cls - * @param tc */ static void -collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +collect_stats (void *cls); + /** * Connect to DHT services of active peers */ static void -start_profiling(); +start_profiling (void); + /** * Shutdown task. Cleanup all resources and operations. * * @param cls NULL - * @param tc scheduler task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { struct ActiveContext *ac; unsigned int cnt; @@ -546,10 +548,9 @@ summarize () * Task to cancel DHT GET. * * @param cls NULL - * @param tc scheduler task context */ static void -cancel_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +cancel_get (void *cls) { struct ActiveContext *ac = cls; struct Context *ctx = ac->ctx; @@ -637,10 +638,9 @@ get_iter (void *cls, * Task to do DHT GETs * * @param cls the active context - * @param tc the scheduler task context */ static void -delayed_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +delayed_get (void *cls) { struct ActiveContext *ac = cls; struct ActiveContext *get_ac; @@ -681,14 +681,15 @@ delayed_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * clear the operation during shutdown. * * @param cls the context - * @return tc scheduler task context. */ static void -teardown_dht_connection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +teardown_dht_connection (void *cls) { struct Context *ctx = cls; struct GNUNET_TESTBED_Operation *op; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; GNUNET_assert (NULL != ctx); @@ -725,13 +726,12 @@ put_cont (void *cls, int success) /** - * Task to do DHT PUTS + * Task to do DHT PUTs * * @param cls the active context - * @param tc the scheduler task context */ static void -delayed_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +delayed_put (void *cls) { struct ActiveContext *ac = cls; @@ -1210,15 +1210,18 @@ successor_stats_iterator (void *cls, * Task that collects peer and its corresponding successors. * * @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; - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start collecting statistics...\n"); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Start collecting statistics...\n"); GNUNET_assert(NULL != testbed_handles); if (0 != max_searches) diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c index b2d31d02f1..2507ff0807 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; static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { GNUNET_SCHEDULER_cancel (die_task); die_task = NULL; @@ -116,11 +116,9 @@ end_badly () * Signature of the main function of a task. * * @param cls closure - * @param tc context information (why was this task triggered now) */ static void -test_get_stop (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +test_get_stop (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_get_stop!\n"); diff --git a/src/dht/test_dht_monitor.c b/src/dht/test_dht_monitor.c index fc4b45a456..6b639e341f 100644 --- a/src/dht/test_dht_monitor.c +++ b/src/dht/test_dht_monitor.c @@ -108,11 +108,9 @@ static unsigned int monitor_counter; * the testbed. * * @param cls the 'struct GNUNET_DHT_TestContext' - * @param tc scheduler context */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct GNUNET_DHT_TEST_Context *ctx = cls; unsigned int i; @@ -197,11 +195,9 @@ dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp, * Task to put the id of each peer into the DHT. * * @param cls array with NUM_PEERS DHT handles - * @param tc Task context */ static void -do_puts (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_puts (void *cls) { struct GNUNET_DHT_Handle **hs = cls; struct GNUNET_HashCode key; diff --git a/src/dht/test_dht_topo.c b/src/dht/test_dht_topo.c index fe6007a213..23ed217174 100644 --- a/src/dht/test_dht_topo.c +++ b/src/dht/test_dht_topo.c @@ -220,11 +220,9 @@ handle_stats (void *cls, * the testbed. * * @param cls the 'struct GNUNET_DHT_TestContext' - * @param tc scheduler context */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct GNUNET_DHT_TEST_Context *ctx = cls; struct GetOperation *get_op; @@ -323,8 +321,7 @@ dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp, * @param tc Task context */ static void -do_puts (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_puts (void *cls) { struct GNUNET_DHT_Handle **hs = cls; struct GNUNET_HashCode key; diff --git a/src/dns/dns_api.c b/src/dns/dns_api.c index 984aa1a4cf..f96ac3142c 100644 --- a/src/dns/dns_api.c +++ b/src/dns/dns_api.c @@ -162,8 +162,7 @@ queue_reply (struct GNUNET_DNS_Handle *dh, * @param tc scheduler context (unused) */ static void -reconnect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect (void *cls) { struct GNUNET_DNS_Handle *dh = cls; struct ReplyQueueEntry *qe; @@ -440,7 +439,7 @@ GNUNET_DNS_request_drop (struct GNUNET_DNS_RequestHandle *rh) * @param reply reply data */ void -GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh, +GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh, uint16_t reply_length, const char *reply) { diff --git a/src/dns/dnsstub.c b/src/dns/dnsstub.c index 32049f66b5..957777cba2 100644 --- a/src/dns/dnsstub.c +++ b/src/dns/dnsstub.c @@ -185,11 +185,9 @@ open_socket (int af) * Read a DNS response from the (unhindered) UDP-Socket * * @param cls socket to read from - * @param tc scheduler context (must be shutdown or read ready) */ static void -read_response (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +read_response (void *cls); /** @@ -466,16 +464,16 @@ do_dns_read (struct GNUNET_DNSSTUB_RequestSocket *rs, * Read a DNS response from the (unhindered) UDP-Socket * * @param cls socket to read from - * @param tc scheduler context (must be shutdown or read ready) */ static void -read_response (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +read_response (void *cls) { struct GNUNET_DNSSTUB_RequestSocket *rs = cls; struct GNUNET_NETWORK_FDSet *rset; + const struct GNUNET_SCHEDULER_TaskContext *tc; rs->read_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) { /* timeout or shutdown */ diff --git a/src/dns/gnunet-dns-monitor.c b/src/dns/gnunet-dns-monitor.c index a7bc953ee6..c9d8403259 100644 --- a/src/dns/gnunet-dns-monitor.c +++ b/src/dns/gnunet-dns-monitor.c @@ -303,7 +303,7 @@ display_request (void *cls, * Shutdown. */ static void -do_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_disconnect (void *cls) { if (NULL != handle) { diff --git a/src/dns/gnunet-dns-redirector.c b/src/dns/gnunet-dns-redirector.c index daf74bf188..8ef69eb917 100644 --- a/src/dns/gnunet-dns-redirector.c +++ b/src/dns/gnunet-dns-redirector.c @@ -177,7 +177,7 @@ modify_request (void *cls, * Shutdown. */ static void -do_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_disconnect (void *cls) { if (NULL != handle) { diff --git a/src/dns/gnunet-service-dns.c b/src/dns/gnunet-service-dns.c index a8fd7b5e20..0f975e82fa 100644 --- a/src/dns/gnunet-service-dns.c +++ b/src/dns/gnunet-service-dns.c @@ -273,11 +273,9 @@ cleanup_rr (struct RequestRecord *rr) * Task run during shutdown. * * @param cls unused - * @param tc unused */ static void -cleanup_task (void *cls GNUNET_UNUSED, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_task (void *cls GNUNET_UNUSED) { unsigned int i; diff --git a/src/dv/gnunet-dv.c b/src/dv/gnunet-dv.c index 42234ad21e..d5d95acca4 100644 --- a/src/dv/gnunet-dv.c +++ b/src/dv/gnunet-dv.c @@ -119,11 +119,9 @@ message_cb (void *cls, * Task run on shutdown. * * @param cls NULL - * @param tc unused */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { GNUNET_DV_service_disconnect (sh); sh = NULL; diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index 2ddd991975..bd0057ab47 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c @@ -398,11 +398,9 @@ static int in_shutdown; * * @param cls the 'struct DirectNeighbor' of the peer we're building * a routing consensus with - * @param tc scheduler context */ static void -initiate_set_union (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +initiate_set_union (void *cls); /** @@ -1132,11 +1130,9 @@ refresh_routes (void *cls, * Task to run #refresh_routes() on all direct neighbours. * * @param cls NULL - * @param tc unused */ static void -refresh_routes_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +refresh_routes_task (void *cls) { rr_task = NULL; GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, @@ -1692,11 +1688,9 @@ listen_set_union (void *cls, * * @param cls the `struct DirectNeighbor *` of the peer we're building * a routing consensus with - * @param tc scheduler context */ static void -initiate_set_union (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +initiate_set_union (void *cls) { struct DirectNeighbor *neighbor = cls; @@ -2082,11 +2076,9 @@ free_direct_neighbors (void *cls, * 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) { unsigned int i; diff --git a/src/dv/test_transport_dv.c b/src/dv/test_transport_dv.c index 245914f072..1afa30fa9e 100644 --- a/src/dv/test_transport_dv.c +++ b/src/dv/test_transport_dv.c @@ -36,8 +36,7 @@ static struct GNUNET_SCHEDULER_Task * shutdown_task; static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { shutdown_task = NULL; if (NULL != topology_op) diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index c44fbbfbdb..8456018aba 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c @@ -3139,8 +3139,7 @@ free_iterate (void *cls, * @param tc scheduler context */ static void -dummy_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +dummy_task (void *cls) { /* just terminate */ } @@ -3153,8 +3152,7 @@ dummy_task (void *cls, * @param tc scheduler context */ static void -cleanup (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup (void *cls) { unsigned int i; @@ -3428,11 +3426,9 @@ read_service_conf (void *cls, * DHT. This task is run periodically to do the DHT PUT. * * @param cls closure - * @param tc scheduler context */ static void -do_dht_put (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +do_dht_put (void *cls); /** @@ -3458,11 +3454,9 @@ dht_put_cont (void *cls, * DHT. This task is run periodically to do the DHT PUT. * * @param cls closure - * @param tc scheduler context */ static void -do_dht_put (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_dht_put (void *cls) { struct GNUNET_TIME_Absolute expiration; diff --git a/src/fragmentation/defragmentation.c b/src/fragmentation/defragmentation.c index 5fcf1c4417..5433ffb5a2 100644 --- a/src/fragmentation/defragmentation.c +++ b/src/fragmentation/defragmentation.c @@ -258,11 +258,9 @@ GNUNET_DEFRAGMENT_context_destroy (struct GNUNET_DEFRAGMENT_Context *dc) * Send acknowledgement to the other peer now. * * @param cls the message context - * @param tc the scheduler context */ static void -send_ack (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +send_ack (void *cls) { struct MessageContext *mc = cls; struct GNUNET_DEFRAGMENT_Context *dc = mc->dc; diff --git a/src/fragmentation/fragmentation.c b/src/fragmentation/fragmentation.c index a702fd35d3..3a55502e71 100644 --- a/src/fragmentation/fragmentation.c +++ b/src/fragmentation/fragmentation.c @@ -167,11 +167,9 @@ GNUNET_FRAGMENT_print_ack (const struct GNUNET_MessageHeader *ack) * Transmit the next fragment to the other peer. * * @param cls the `struct GNUNET_FRAGMENT_Context` - * @param tc scheduler context */ static void -transmit_next (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +transmit_next (void *cls) { struct GNUNET_FRAGMENT_Context *fc = cls; char msg[fc->mtu]; diff --git a/src/fragmentation/test_fragmentation.c b/src/fragmentation/test_fragmentation.c index d3591f4a14..61ba73bb26 100644 --- a/src/fragmentation/test_fragmentation.c +++ b/src/fragmentation/test_fragmentation.c @@ -68,7 +68,7 @@ static struct GNUNET_TIME_Relative ack_delay; static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { ret = 0; shutdown_task = NULL; diff --git a/src/fragmentation/test_fragmentation_parallel.c b/src/fragmentation/test_fragmentation_parallel.c index 2ade88c056..23349e6f7c 100644 --- a/src/fragmentation/test_fragmentation_parallel.c +++ b/src/fragmentation/test_fragmentation_parallel.c @@ -60,10 +60,11 @@ static struct GNUNET_BANDWIDTH_Tracker trackers[NUM_MSGS]; static struct GNUNET_FRAGMENT_Context *frags[NUM_MSGS]; -static struct GNUNET_SCHEDULER_Task * shutdown_task; +static struct GNUNET_SCHEDULER_Task *shutdown_task; + static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { unsigned int i; diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c index f85b8e7396..2db475528d 100644 --- a/src/fs/fs_api.c +++ b/src/fs/fs_api.c @@ -108,11 +108,9 @@ stop_job (struct GNUNET_FS_QueueEntry *qe) * and stopping others. * * @param cls the `struct GNUNET_FS_Handle *` - * @param tc scheduler context */ static void -process_job_queue (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +process_job_queue (void *cls) { struct GNUNET_FS_Handle *h = cls; struct GNUNET_FS_QueueEntry *qe; diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h index e9f9ab2cbb..0e1476f5c9 100644 --- a/src/fs/fs_api.h +++ b/src/fs/fs_api.h @@ -757,11 +757,9 @@ GNUNET_FS_search_probe_progress_ (void *cls, * Main function that performs the upload. * * @param cls `struct GNUNET_FS_PublishContext` identifies the upload - * @param tc task context */ void -GNUNET_FS_publish_main_ (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +GNUNET_FS_publish_main_ (void *cls); /** @@ -828,11 +826,9 @@ GNUNET_FS_download_make_status_ (struct GNUNET_FS_ProgressInfo *pi, * request for the file. * * @param cls the 'struct GNUNET_FS_DownloadContext' - * @param tc scheduler context */ void -GNUNET_FS_download_start_task_ (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +GNUNET_FS_download_start_task_ (void *cls); diff --git a/src/fs/fs_dirmetascan.c b/src/fs/fs_dirmetascan.c index 72098957d4..2f79c7c05b 100644 --- a/src/fs/fs_dirmetascan.c +++ b/src/fs/fs_dirmetascan.c @@ -222,11 +222,9 @@ expand_tree (struct GNUNET_FS_ShareTreeItem *parent, * Task run last to shut everything down. * * @param cls the 'struct GNUNET_FS_DirScanner' - * @param tc unused */ static void -finish_scan (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +finish_scan (void *cls) { struct GNUNET_FS_DirScanner *ds = cls; diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index f435245533..e8b632a3fc 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c @@ -1372,10 +1372,9 @@ transmit_download_request (void *cls, size_t size, void *buf) * Reconnect to the FS service and transmit our queries NOW. * * @param cls our download context - * @param tc unused */ static void -do_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_reconnect (void *cls) { struct GNUNET_FS_DownloadContext *dc = cls; struct GNUNET_CLIENT_Connection *client; @@ -1625,10 +1624,9 @@ create_download_request (struct DownloadRequest *parent, * the current IBlock from the existing file. * * @param cls the 'struct ReconstructContext' - * @param tc scheduler context */ static void -reconstruct_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +reconstruct_cont (void *cls) { struct GNUNET_FS_DownloadContext *dc = cls; @@ -1655,10 +1653,9 @@ reconstruct_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Task requesting the next block from the tree encoder. * * @param cls the 'struct GNUJNET_FS_DownloadContext' we're processing - * @param tc task context */ static void -get_next_block (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +get_next_block (void *cls) { struct GNUNET_FS_DownloadContext *dc = cls; @@ -1855,11 +1852,9 @@ fh_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) * request for the file. * * @param cls the 'struct GNUNET_FS_DownloadContext' - * @param tc scheduler context */ void -GNUNET_FS_download_start_task_ (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +GNUNET_FS_download_start_task_ (void *cls) { struct GNUNET_FS_DownloadContext *dc = cls; struct GNUNET_FS_ProgressInfo pi; diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index 1e8e82c71a..80843006e3 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c @@ -413,11 +413,9 @@ block_reader (void *cls, * the final result. * * @param cls our publishing context - * @param tc scheduler's task context (not used) */ static void -encode_cont (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +encode_cont (void *cls) { struct GNUNET_FS_PublishContext *pc = cls; struct GNUNET_FS_FileInformation *p; @@ -960,11 +958,9 @@ create_loc_uri (struct GNUNET_FS_PublishContext *pc) * Main function that performs the upload. * * @param cls `struct GNUNET_FS_PublishContext *` identifies the upload - * @param tc task context */ void -GNUNET_FS_publish_main_ (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +GNUNET_FS_publish_main_ (void *cls) { struct GNUNET_FS_PublishContext *pc = cls; struct GNUNET_FS_ProgressInfo pi; diff --git a/src/fs/fs_publish_ksk.c b/src/fs/fs_publish_ksk.c index b3e9de7281..a7ad3e91f9 100644 --- a/src/fs/fs_publish_ksk.c +++ b/src/fs/fs_publish_ksk.c @@ -110,11 +110,9 @@ struct GNUNET_FS_PublishKskContext * of the keywords). * * @param cls closure of type `struct PublishKskContext *` - * @param tc unused */ static void -publish_ksk_cont (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +publish_ksk_cont (void *cls); /** @@ -148,11 +146,9 @@ kb_put_cont (void *cls, * publishing operation (iterating over all of the keywords). * * @param cls closure of type `struct GNUNET_FS_PublishKskContext *` - * @param tc unused */ static void -publish_ksk_cont (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +publish_ksk_cont (void *cls) { struct GNUNET_FS_PublishKskContext *pkc = cls; const char *keyword; diff --git a/src/fs/fs_publish_ublock.c b/src/fs/fs_publish_ublock.c index 7cdad396b2..9ea7bf41bd 100644 --- a/src/fs/fs_publish_ublock.c +++ b/src/fs/fs_publish_ublock.c @@ -147,11 +147,9 @@ ublock_put_cont (void *cls, * Run the continuation. * * @param cls the `struct GNUNET_FS_PublishUblockContext *` - * @param tc scheduler context */ static void -run_cont (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +run_cont (void *cls) { struct GNUNET_FS_PublishUblockContext *uc = cls; diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index 626d23a727..eaabac7462 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c @@ -215,11 +215,9 @@ signal_probe_result (struct GNUNET_FS_SearchResult *sr) * Handle the case where we have failed to receive a response for our probe. * * @param cls our `struct GNUNET_FS_SearchResult *` - * @param tc scheduler context */ static void -probe_failure_handler (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +probe_failure_handler (void *cls) { struct GNUNET_FS_SearchResult *sr = cls; @@ -241,11 +239,9 @@ probe_failure_handler (void *cls, * Handle the case where we have gotten a response for our probe. * * @param cls our `struct GNUNET_FS_SearchResult *` - * @param tc scheduler context */ static void -probe_success_handler (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +probe_success_handler (void *cls) { struct GNUNET_FS_SearchResult *sr = cls; @@ -364,11 +360,9 @@ GNUNET_FS_search_probe_progress_ (void *cls, * Task run periodically to remind clients that a probe is active. * * @param cls the `struct GNUNET_FS_SearchResult` that we are probing for - * @param tc scheduler context */ static void -probe_ping_task_cb (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +probe_ping_task_cb (void *cls) { struct GNUNET_FS_Handle *h = cls; struct GNUNET_FS_SearchResult *sr; @@ -1245,10 +1239,9 @@ schedule_transmit_search_request (struct GNUNET_FS_SearchContext *sc) * our queries NOW. * * @param cls our search context - * @param tc unused */ static void -do_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_reconnect (void *cls) { struct GNUNET_FS_SearchContext *sc = cls; struct GNUNET_CLIENT_Connection *client; @@ -1637,7 +1630,7 @@ GNUNET_FS_search_continue (struct GNUNET_FS_SearchContext *sc) GNUNET_assert (NULL == sc->client); GNUNET_assert (NULL == sc->task); - do_reconnect (sc, NULL); + do_reconnect (sc); GNUNET_FS_search_sync_ (sc); pi.status = GNUNET_FS_STATUS_SEARCH_CONTINUED; sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc->h, sc); diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c index 6bd156e8b1..d03888021f 100644 --- a/src/fs/fs_test_lib.c +++ b/src/fs/fs_test_lib.c @@ -183,8 +183,7 @@ struct TestDownloadOperation * @param tc scheduler context (unused) */ static void -report_uri (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +report_uri (void *cls) { struct TestPublishOperation *po = cls; @@ -208,10 +207,9 @@ report_uri (void *cls, * Task scheduled to run when publish operation times out. * * @param cls the publish operation context - * @param tc scheduler context (unused) */ static void -publish_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +publish_timeout (void *cls) { struct TestPublishOperation *po = cls; @@ -480,10 +478,9 @@ GNUNET_FS_TEST_publish (struct GNUNET_TESTBED_Peer *peer, * Task scheduled to run when download operation times out. * * @param cls the download operation context - * @param tc scheduler context (unused) */ static void -download_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +download_timeout (void *cls) { struct TestDownloadOperation *dop = cls; @@ -504,11 +501,9 @@ download_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Task scheduled to report on the completion of our download operation. * * @param cls the download operation context - * @param tc scheduler context (unused) */ static void -report_success (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +report_success (void *cls) { struct TestDownloadOperation *dop = cls; diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index 57c4c567f9..b3c6322031 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c @@ -352,7 +352,7 @@ GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te) te->uri->data.chk.chk = te->chk_tree[off]; te->uri->data.chk.file_length = GNUNET_htonll (te->size); te->in_next = GNUNET_NO; - te->cont (te->cls, NULL); + te->cont (te->cls); return; } if (0 == te->current_depth) @@ -363,7 +363,7 @@ GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te) te->reader (te->cls, te->publish_offset, pt_size, iob, &te->emsg)) { te->in_next = GNUNET_NO; - te->cont (te->cls, NULL); + te->cont (te->cls); return; } pt_block = iob; diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index 88d3dd0ea2..2e9c17217a 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c @@ -626,11 +626,9 @@ GNUNET_FS_unindex_do_remove_kblocks_ (struct GNUNET_FS_UnindexContext *uc) * processed all blocks. Clean up. * * @param cls our unindexing context - * @param tc not used */ static void -unindex_extract_keywords (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +unindex_extract_keywords (void *cls) { struct GNUNET_FS_UnindexContext *uc = cls; diff --git a/src/fs/gnunet-auto-share.c b/src/fs/gnunet-auto-share.c index 3e5c8777cb..aef66614ce 100644 --- a/src/fs/gnunet-auto-share.c +++ b/src/fs/gnunet-auto-share.c @@ -317,17 +317,15 @@ save_state () * Task run on shutdown. Serializes our current state to disk. * * @param cls closure, unused - * @param tc scheduler context, unused */ static void -do_stop_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_stop_task (void *cls) { kill_task = NULL; do_shutdown = GNUNET_YES; if (NULL != publish_proc) { - GNUNET_OS_process_kill (publish_proc, + GNUNET_OS_process_kill (publish_proc, SIGKILL); return; } @@ -351,11 +349,9 @@ schedule_next_task (void); * process died). * * @param cls the `struct WorkItem` we were working on - * @param tc context */ static void -maint_child_death (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +maint_child_death (void *cls) { struct WorkItem *wi = cls; struct GNUNET_HashCode key; @@ -364,10 +360,12 @@ maint_child_death (void *cls, int ret; char c; const struct GNUNET_DISK_FileHandle *pr; + const struct GNUNET_SCHEDULER_TaskContext *tc; run_task = NULL; pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); + tc = GNUNET_SCHEDULER_get_task_context (); if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) { /* shutdown scheduled us, someone else will kill child, @@ -389,7 +387,7 @@ maint_child_death (void *cls, { /* process still running? Then where did the SIGCHLD come from? Well, let's declare it spurious (kernel bug?) and keep rolling. - */ + */ GNUNET_break (0); run_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, @@ -398,7 +396,7 @@ maint_child_death (void *cls, return; } GNUNET_assert (GNUNET_OK == ret); - + GNUNET_OS_process_destroy (publish_proc); publish_proc = NULL; @@ -457,11 +455,9 @@ sighandler_child_death () * Function called to process work items. * * @param cls closure, NULL - * @param tc scheduler context (unused) */ static void -work (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +work (void *cls) { static char *argv[14]; static char anon_level[20]; @@ -521,7 +517,7 @@ work (void *cls, NULL); return; } - pr = GNUNET_DISK_pipe_handle (sigpipe, + pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); run_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, @@ -549,13 +545,13 @@ determine_id (void *cls, if (0 != STAT (filename, &sbuf)) { - GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, - "stat", + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, + "stat", filename); return GNUNET_OK; } - GNUNET_CRYPTO_hash (filename, - strlen (filename), + GNUNET_CRYPTO_hash (filename, + strlen (filename), &fx[0]); if (!S_ISDIR (sbuf.st_mode)) { @@ -564,8 +560,8 @@ determine_id (void *cls, fattr[0] = GNUNET_htonll (sbuf.st_size); fattr[0] = GNUNET_htonll (sbuf.st_mtime); - GNUNET_CRYPTO_hash (fattr, - sizeof (fattr), + GNUNET_CRYPTO_hash (fattr, + sizeof (fattr), &fx[1]); } else @@ -579,7 +575,7 @@ determine_id (void *cls, } /* use hash here to make hierarchical structure distinct from all files on the same level */ - GNUNET_CRYPTO_hash (fx, + GNUNET_CRYPTO_hash (fx, sizeof (fx), &ft); /* use XOR here so that order of the files in the directory @@ -653,11 +649,9 @@ add_file (void *cls, * Periodically run task to update our view of the directory to share. * * @param cls NULL - * @param tc scheduler context, unused */ static void -scan (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +scan (void *cls) { run_task = NULL; start_time = GNUNET_TIME_absolute_get (); @@ -695,7 +689,7 @@ schedule_next_task () } else { - run_task = GNUNET_SCHEDULER_add_now (&work, + run_task = GNUNET_SCHEDULER_add_now (&work, NULL); } } @@ -710,15 +704,15 @@ schedule_next_task () * @param c configuration */ static void -run (void *cls, - char *const *args, +run (void *cls, + char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) { /* check arguments */ - if ( (NULL == args[0]) || + if ( (NULL == args[0]) || (NULL != args[1]) || - (GNUNET_YES != + (GNUNET_YES != GNUNET_DISK_directory_test (args[0], GNUNET_YES)) ) { @@ -729,14 +723,14 @@ run (void *cls, cfg_filename = GNUNET_strdup (cfgfile); cfg = c; dir_name = args[0]; - work_finished = GNUNET_CONTAINER_multihashmap_create (1024, + work_finished = GNUNET_CONTAINER_multihashmap_create (1024, GNUNET_NO); load_state (); run_task = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, - &scan, + &scan, NULL); kill_task = - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_stop_task, NULL); } @@ -799,17 +793,17 @@ main (int argc, char *const *argv) int ok; struct GNUNET_SIGNAL_Context *shc_chld; - if (GNUNET_OK != + if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) return 2; - sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, + sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO); GNUNET_assert (NULL != sigpipe); shc_chld = GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); ok = (GNUNET_OK == - GNUNET_PROGRAM_run (argc, argv, + GNUNET_PROGRAM_run (argc, argv, "gnunet-auto-share [OPTIONS] FILENAME", gettext_noop ("Automatically publish files from a directory on GNUnet"), @@ -823,7 +817,7 @@ main (int argc, char *const *argv) } while (NULL != (wi = work_head)) { - GNUNET_CONTAINER_DLL_remove (work_head, + GNUNET_CONTAINER_DLL_remove (work_head, work_tail, wi); GNUNET_free (wi->filename); diff --git a/src/fs/gnunet-daemon-fsprofiler.c b/src/fs/gnunet-daemon-fsprofiler.c index 77a293a232..326178df90 100644 --- a/src/fs/gnunet-daemon-fsprofiler.c +++ b/src/fs/gnunet-daemon-fsprofiler.c @@ -267,10 +267,9 @@ make_file (uint64_t length, * 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) { struct Pattern *p; @@ -313,10 +312,9 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Task run when a publish operation should be stopped. * * @param cls the 'struct Pattern' of the publish operation to stop - * @param tc unused */ static void -publish_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +publish_stop_task (void *cls) { struct Pattern *p = cls; @@ -329,10 +327,9 @@ publish_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Task run when a download operation should be stopped. * * @param cls the 'struct Pattern' of the download operation to stop - * @param tc unused */ static void -download_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +download_stop_task (void *cls) { struct Pattern *p = cls; @@ -345,10 +342,9 @@ download_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Task run when a download operation should be stopped. * * @param cls the 'struct Pattern' of the download operation to stop - * @param tc unused */ static void -search_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +search_stop_task (void *cls) { struct Pattern *p = cls; @@ -498,16 +494,16 @@ progress_cb (void *cls, * Start publish operation. * * @param cls the 'struct Pattern' specifying the operation to perform - * @param tc scheduler context */ static void -start_publish (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +start_publish (void *cls) { struct Pattern *p = cls; struct GNUNET_FS_FileInformation *fi; + const struct GNUNET_SCHEDULER_TaskContext *tc; p->task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; fi = make_file (p->x, p->y, p); @@ -523,16 +519,16 @@ start_publish (void *cls, * Start download operation. * * @param cls the 'struct Pattern' specifying the operation to perform - * @param tc scheduler context */ static void -start_download (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +start_download (void *cls) { struct Pattern *p = cls; struct GNUNET_FS_Uri *keywords; + const struct GNUNET_SCHEDULER_TaskContext *tc; p->task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; keywords = make_keywords (p->x); diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c index 85afbe6069..a2b0aa5fc6 100644 --- a/src/fs/gnunet-download.c +++ b/src/fs/gnunet-download.c @@ -54,7 +54,7 @@ static int local_only; static void -cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_task (void *cls) { GNUNET_FS_stop (ctx); ctx = NULL; @@ -62,7 +62,7 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { if (NULL != dc) { diff --git a/src/fs/gnunet-fs-profiler.c b/src/fs/gnunet-fs-profiler.c index cd4f9d8517..69433346f9 100644 --- a/src/fs/gnunet-fs-profiler.c +++ b/src/fs/gnunet-fs-profiler.c @@ -109,11 +109,9 @@ process_stats (void *cls, * all statistics. * * @param cls NULL - * @param tc unused */ static void -terminate_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +terminate_task (void *cls) { terminate_taskid = NULL; GNUNET_TESTBED_get_statistics (0, NULL, diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index b5c8acc4c2..f058c10b2f 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c @@ -146,11 +146,9 @@ static struct GNUNET_IDENTITY_Handle *identity; * FS state. * * @param cls NULL - * @param tc scheduler context */ static void -do_stop_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_stop_task (void *cls) { struct GNUNET_FS_PublishContext *p; diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c index d9ce456a6c..a15d0d883a 100644 --- a/src/fs/gnunet-search.c +++ b/src/fs/gnunet-search.c @@ -96,7 +96,7 @@ item_printer (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type, static void -clean_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +clean_task (void *cls) { size_t dsize; void *ddata; @@ -210,7 +210,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { if (sc != NULL) { diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index aebbe58546..2ba96334c1 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -184,11 +184,9 @@ static struct GNUNET_PeerIdentity my_id; * Task that periodically ages our cover traffic statistics. * * @param cls unused closure - * @param tc task context */ static void -age_cover_counters (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +age_cover_counters (void *cls) { GSF_cover_content_count = (GSF_cover_content_count * 15) / 16; GSF_cover_query_count = (GSF_cover_query_count * 15) / 16; @@ -531,11 +529,9 @@ handle_loc_sign (void *cls, * 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) { GSF_cadet_stop_client (); GSF_cadet_stop_server (); @@ -821,7 +817,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, (GNUNET_OK != main_init (server, cfg))) { GNUNET_SCHEDULER_shutdown (); - shutdown_task (NULL, NULL); + shutdown_task (NULL); return; } } diff --git a/src/fs/gnunet-service-fs_cadet_client.c b/src/fs/gnunet-service-fs_cadet_client.c index 4174689701..3ea2efa679 100644 --- a/src/fs/gnunet-service-fs_cadet_client.c +++ b/src/fs/gnunet-service-fs_cadet_client.c @@ -246,11 +246,9 @@ reset_cadet (struct CadetHandle *mh) * Task called when it is time to destroy an inactive cadet channel. * * @param cls the `struct CadetHandle` to tear down - * @param tc scheduler context, unused */ static void -cadet_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cadet_timeout (void *cls) { struct CadetHandle *mh = cls; struct GNUNET_CADET_Channel *tun; @@ -270,11 +268,9 @@ cadet_timeout (void *cls, * Task called when it is time to reset an cadet. * * @param cls the `struct CadetHandle` to tear down - * @param tc scheduler context, unused */ static void -reset_cadet_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reset_cadet_task (void *cls) { struct CadetHandle *mh = cls; diff --git a/src/fs/gnunet-service-fs_cadet_server.c b/src/fs/gnunet-service-fs_cadet_server.c index 46086eec8f..ccf6b3c5cd 100644 --- a/src/fs/gnunet-service-fs_cadet_server.c +++ b/src/fs/gnunet-service-fs_cadet_server.c @@ -154,11 +154,9 @@ static unsigned long long sc_count_max; * Task run to asynchronously terminate the cadet due to timeout. * * @param cls the 'struct CadetClient' - * @param tc scheduler context */ static void -timeout_cadet_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_cadet_task (void *cls) { struct CadetClient *sc = cls; struct GNUNET_CADET_Channel *tun; @@ -324,7 +322,7 @@ continue_writing (struct CadetClient *sc) static void handle_datastore_reply (void *cls, const struct GNUNET_HashCode *key, - size_t size, + size_t size, const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index 3cabfeaaf4..e916a73a87 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c @@ -522,11 +522,9 @@ peer_transmit_ready_cb (void *cls, * (re)try to reserve bandwidth from the given peer. * * @param cls the `struct GSF_ConnectedPeer` to reserve from - * @param tc scheduler context */ static void -retry_reservation (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +retry_reservation (void *cls) { struct GSF_ConnectedPeer *cp = cls; struct GNUNET_PeerIdentity target; @@ -675,11 +673,9 @@ GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer, * peer. Check, and if so, restart migration. * * @param cls the `struct GSF_ConnectedPeer` - * @param tc scheduler context */ static void -revive_migration (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +revive_migration (void *cls) { struct GSF_ConnectedPeer *cp = cls; struct GNUNET_TIME_Relative bt; @@ -854,11 +850,9 @@ cancel_pending_request (void *cls, * Free the given request. * * @param cls the request to free - * @param tc task context */ static void -peer_request_destroy (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +peer_request_destroy (void *cls) { struct PeerRequest *peerreq = cls; struct GSF_PendingRequest *pr = peerreq->pr; @@ -876,19 +870,19 @@ peer_request_destroy (void *cls, * The artificial delay is over, transmit the message now. * * @param cls the `struct GSF_DelayedHandle` with the message - * @param tc scheduler context */ static void -transmit_delayed_now (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +transmit_delayed_now (void *cls) { struct GSF_DelayedHandle *dh = cls; struct GSF_ConnectedPeer *cp = dh->cp; + const struct GNUNET_SCHEDULER_TaskContext *tc; GNUNET_CONTAINER_DLL_remove (cp->delayed_head, cp->delayed_tail, dh); cp->delay_queue_size--; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) { GNUNET_free (dh->pm); @@ -1490,11 +1484,9 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, * a transmission request. * * @param cls the `struct GSF_PeerTransmitHandle` of the request - * @param tc scheduler context */ static void -peer_transmit_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +peer_transmit_timeout (void *cls) { struct GSF_PeerTransmitHandle *pth = cls; struct GSF_ConnectedPeer *cp; @@ -1981,18 +1973,17 @@ GSF_connected_peer_change_preference_ (struct GSF_ConnectedPeer *cp, * Call this method periodically to flush respect information to disk. * * @param cls closure, not used - * @param tc task context, not used */ static void -cron_flush_respect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cron_flush_respect (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + if (NULL == cp_map) return; GNUNET_CONTAINER_multipeermap_iterate (cp_map, &flush_respect, NULL); - if (NULL == tc) - return; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_SCHEDULER_add_delayed_with_priority (RESPECT_FLUSH_FREQ, @@ -2038,7 +2029,9 @@ clean_peer (void *cls, void GSF_connected_peer_done_ () { - cron_flush_respect (NULL, NULL); + GNUNET_CONTAINER_multipeermap_iterate (cp_map, + &flush_respect, + NULL); GNUNET_CONTAINER_multipeermap_iterate (cp_map, &clean_peer, NULL); GNUNET_CONTAINER_multipeermap_destroy (cp_map); diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c index f837ad3204..2706aea302 100644 --- a/src/fs/gnunet-service-fs_lc.c +++ b/src/fs/gnunet-service-fs_lc.c @@ -184,11 +184,9 @@ GSF_local_client_lookup_ (struct GNUNET_SERVER_Client *client) * Free the given client request. * * @param cls the client request to free - * @param tc task context */ static void -client_request_destroy (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +client_request_destroy (void *cls) { struct ClientRequest *cr = cls; struct GSF_LocalClient *lc; @@ -510,7 +508,7 @@ GSF_client_disconnect_handler_ (void *cls, { if (NULL != cr->kill_task) GNUNET_SCHEDULER_cancel (cr->kill_task); - client_request_destroy (cr, NULL); + client_request_destroy (cr); } while (NULL != (res = pos->res_head)) { diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c index 8e414e74a5..b338c1a131 100644 --- a/src/fs/gnunet-service-fs_pe.c +++ b/src/fs/gnunet-service-fs_pe.c @@ -244,11 +244,9 @@ get_rp_key (struct GSF_RequestPlan *rp) * Figure out when and how to transmit to the given peer. * * @param cls the `struct GSF_ConnectedPeer` for transmission - * @param tc scheduler context */ static void -schedule_peer_transmission (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +schedule_peer_transmission (void *cls); /** @@ -457,11 +455,9 @@ transmit_message_callback (void *cls, * Figure out when and how to transmit to the given peer. * * @param cls the `struct PeerPlan` - * @param tc scheduler context */ static void -schedule_peer_transmission (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +schedule_peer_transmission (void *cls) { struct PeerPlan *pp = cls; struct GSF_RequestPlan *rp; diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 8c97e08980..a7a62a7437 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c @@ -1300,11 +1300,9 @@ GSF_cadet_lookup_ (struct GSF_PendingRequest *pr) * Task that issues a warning if the datastore lookup takes too long. * * @param cls the `struct GSF_PendingRequest` - * @param tc task context */ static void -warn_delay_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +warn_delay_task (void *cls) { struct GSF_PendingRequest *pr = cls; @@ -1323,11 +1321,9 @@ warn_delay_task (void *cls, * Task that issues a warning if the datastore lookup takes too long. * * @param cls the `struct GSF_PendingRequest` - * @param tc task context */ static void -odc_warn_delay_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +odc_warn_delay_task (void *cls) { struct GSF_PendingRequest *pr = cls; diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c index a31a4f6264..a76a3827c3 100644 --- a/src/fs/gnunet-service-fs_push.c +++ b/src/fs/gnunet-service-fs_push.c @@ -432,11 +432,9 @@ find_content (struct MigrationReadyPeer *mrp) * migration * * @param cls unused - * @param tc scheduler context (also unused) */ static void -gather_migration_blocks (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +gather_migration_blocks (void *cls); /** @@ -569,11 +567,9 @@ process_migration_content (void *cls, * migration * * @param cls unused - * @param tc scheduler context (also unused) */ static void -gather_migration_blocks (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +gather_migration_blocks (void *cls) { mig_task = NULL; if (mig_size >= MAX_MIGRATION_QUEUE) diff --git a/src/fs/gnunet-service-fs_put.c b/src/fs/gnunet-service-fs_put.c index 3fb2d7abb7..fa5aa461d6 100644 --- a/src/fs/gnunet-service-fs_put.c +++ b/src/fs/gnunet-service-fs_put.c @@ -95,8 +95,7 @@ static struct PutOperator operators[] = { * @param tc scheduler context (unused) */ static void -gather_dht_put_blocks (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +gather_dht_put_blocks (void *cls); /** @@ -151,10 +150,9 @@ delay_dht_put_blocks (void *cls, int success) * Task that is run periodically to obtain blocks for DHT PUTs. * * @param cls type of blocks to gather - * @param tc scheduler context */ static void -delay_dht_put_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +delay_dht_put_task (void *cls) { struct PutOperator *po = cls; @@ -212,14 +210,15 @@ process_dht_put_content (void *cls, * Task that is run periodically to obtain blocks for DHT PUTs. * * @param cls type of blocks to gather - * @param tc scheduler context (unused) */ static void -gather_dht_put_blocks (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +gather_dht_put_blocks (void *cls) { struct PutOperator *po = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; po->dht_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; po->dht_qe = diff --git a/src/fs/gnunet-unindex.c b/src/fs/gnunet-unindex.c index 8a059478ca..cab963e0d5 100644 --- a/src/fs/gnunet-unindex.c +++ b/src/fs/gnunet-unindex.c @@ -40,7 +40,7 @@ static struct GNUNET_FS_UnindexContext *uc; static void -cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_task (void *cls) { GNUNET_FS_stop (ctx); ctx = NULL; @@ -48,7 +48,7 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct GNUNET_FS_UnindexContext *u; diff --git a/src/fs/perf_gnunet_service_fs_p2p.c b/src/fs/perf_gnunet_service_fs_p2p.c index 08bfe1b302..40b2b977b6 100644 --- a/src/fs/perf_gnunet_service_fs_p2p.c +++ b/src/fs/perf_gnunet_service_fs_p2p.c @@ -238,8 +238,7 @@ stat_run (void *cls, static void -do_report (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_report (void *cls) { char *fn = cls; struct GNUNET_TIME_Relative del; diff --git a/src/fs/perf_gnunet_service_fs_p2p_respect.c b/src/fs/perf_gnunet_service_fs_p2p_respect.c index d20d15afff..2527c89784 100644 --- a/src/fs/perf_gnunet_service_fs_p2p_respect.c +++ b/src/fs/perf_gnunet_service_fs_p2p_respect.c @@ -279,7 +279,7 @@ stat_run (void *cls, static void -do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_report (void *cls) { static int download_counter; const char *type = cls; diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c index e192e8f52d..936f001dfd 100644 --- a/src/fs/test_fs_download.c +++ b/src/fs/test_fs_download.c @@ -67,7 +67,7 @@ static int err; static void -timeout_kill_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_kill_task (void *cls) { if (NULL != download) { @@ -86,7 +86,7 @@ timeout_kill_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_publish_task (void *cls) { if (NULL != publish) { @@ -97,7 +97,7 @@ abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -stop_fs_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +stop_fs_task (void *cls) { GNUNET_FS_stop (fs); fs = NULL; @@ -105,7 +105,7 @@ stop_fs_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -abort_download_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_download_task (void *cls) { uint64_t size; diff --git a/src/fs/test_fs_download_persistence.c b/src/fs/test_fs_download_persistence.c index 6b78741e69..76a1ea9110 100644 --- a/src/fs/test_fs_download_persistence.c +++ b/src/fs/test_fs_download_persistence.c @@ -62,7 +62,7 @@ static int err; static void -timeout_kill_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_kill_task (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout downloading file\n"); if (download != NULL) @@ -81,7 +81,7 @@ timeout_kill_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_publish_task (void *cls) { if (publish != NULL) { @@ -92,7 +92,7 @@ abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -abort_download_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_download_task (void *cls) { uint64_t size; @@ -116,7 +116,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event); static void -restart_fs_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +restart_fs_task (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Restarting FS.\n"); GNUNET_FS_stop (fs); diff --git a/src/fs/test_fs_list_indexed.c b/src/fs/test_fs_list_indexed.c index b76e894a52..61e4df5123 100644 --- a/src/fs/test_fs_list_indexed.c +++ b/src/fs/test_fs_list_indexed.c @@ -62,7 +62,7 @@ static int err; static void -abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_publish_task (void *cls) { GNUNET_FS_publish_stop (publish); publish = NULL; @@ -76,8 +76,7 @@ abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -list_indexed_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +list_indexed_task (void *cls) { GNUNET_SCHEDULER_add_now (&abort_publish_task, NULL); } diff --git a/src/fs/test_fs_namespace.c b/src/fs/test_fs_namespace.c index 201acb8f5a..b8325d8d86 100644 --- a/src/fs/test_fs_namespace.c +++ b/src/fs/test_fs_namespace.c @@ -49,7 +49,7 @@ static int err; static void -abort_ksk_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_ksk_search_task (void *cls) { if (ksk_search != NULL) { @@ -66,7 +66,7 @@ abort_ksk_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -abort_sks_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_sks_search_task (void *cls) { if (sks_search == NULL) return; @@ -82,13 +82,13 @@ abort_sks_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -do_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_timeout (void *cls) { err = 1; FPRINTF (stderr, "%s", "Operation timed out\n"); kill_task = NULL; - abort_sks_search_task (NULL, tc); - abort_ksk_search_task (NULL, tc); + abort_sks_search_task (NULL); + abort_ksk_search_task (NULL); } diff --git a/src/fs/test_fs_publish.c b/src/fs/test_fs_publish.c index a391dbe0de..f4c56e0151 100644 --- a/src/fs/test_fs_publish.c +++ b/src/fs/test_fs_publish.c @@ -58,7 +58,7 @@ static int err; static void -abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_publish_task (void *cls) { GNUNET_FS_publish_stop (publish); publish = NULL; diff --git a/src/fs/test_fs_publish_persistence.c b/src/fs/test_fs_publish_persistence.c index 9807520a26..be9006d423 100644 --- a/src/fs/test_fs_publish_persistence.c +++ b/src/fs/test_fs_publish_persistence.c @@ -60,11 +60,11 @@ static char *fn2; static int err; -static struct GNUNET_SCHEDULER_Task * rtask; +static struct GNUNET_SCHEDULER_Task *rtask; static void -abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_publish_task (void *cls) { GNUNET_FS_publish_stop (publish); publish = NULL; @@ -89,7 +89,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event); static void -restart_fs_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +restart_fs_task (void *cls) { rtask = NULL; GNUNET_FS_stop (fs); diff --git a/src/fs/test_fs_search.c b/src/fs/test_fs_search.c index 29a98bbad6..0918b4b6b5 100644 --- a/src/fs/test_fs_search.c +++ b/src/fs/test_fs_search.c @@ -58,7 +58,7 @@ static int err; static void -abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_publish_task (void *cls) { if (NULL != publish) { @@ -74,7 +74,7 @@ abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_error (void *cls) { fprintf (stderr, "Timeout\n"); @@ -94,7 +94,7 @@ abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -abort_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_search_task (void *cls) { if (NULL != search) { diff --git a/src/fs/test_fs_search_persistence.c b/src/fs/test_fs_search_persistence.c index 756c72557f..db084446e4 100644 --- a/src/fs/test_fs_search_persistence.c +++ b/src/fs/test_fs_search_persistence.c @@ -60,7 +60,7 @@ static int err; static void -abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_error (void *cls) { timeout_task = NULL; fprintf (stderr, @@ -78,8 +78,9 @@ abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) err = 1; } + static void -abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_publish_task (void *cls) { if (NULL != publish) { @@ -95,7 +96,7 @@ abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -abort_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_search_task (void *cls) { if (NULL != search) { @@ -110,7 +111,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event); static void -restart_fs_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +restart_fs_task (void *cls) { GNUNET_FS_stop (fs); fs = GNUNET_FS_start (cfg, "test-fs-search-persistence", &progress_cb, NULL, diff --git a/src/fs/test_fs_search_probes.c b/src/fs/test_fs_search_probes.c index bcb914d791..eaf804a22d 100644 --- a/src/fs/test_fs_search_probes.c +++ b/src/fs/test_fs_search_probes.c @@ -59,7 +59,7 @@ static int err; static void -abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_error (void *cls) { timeout_task = NULL; fprintf (stderr, @@ -79,7 +79,7 @@ abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_publish_task (void *cls) { if (NULL != publish) { @@ -95,7 +95,7 @@ abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -abort_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_search_task (void *cls) { if (search != NULL) GNUNET_FS_search_stop (search); diff --git a/src/fs/test_fs_search_with_and.c b/src/fs/test_fs_search_with_and.c index e25d3786af..83edf2e6c1 100644 --- a/src/fs/test_fs_search_with_and.c +++ b/src/fs/test_fs_search_with_and.c @@ -66,7 +66,7 @@ static int processed_files; static void -abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_publish_task (void *cls) { if (NULL != publish) { @@ -82,7 +82,7 @@ abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_error (void *cls) { fprintf (stderr, "Timeout\n"); @@ -102,7 +102,7 @@ abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -abort_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_search_task (void *cls) { if (NULL != search) { diff --git a/src/fs/test_fs_test_lib.c b/src/fs/test_fs_test_lib.c index dda9908302..c3a03668c2 100644 --- a/src/fs/test_fs_test_lib.c +++ b/src/fs/test_fs_test_lib.c @@ -50,8 +50,7 @@ static int ret; static void -do_stop (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_stop (void *cls) { char *fn = cls; diff --git a/src/fs/test_fs_unindex.c b/src/fs/test_fs_unindex.c index 77a70cb208..bd36fcd187 100644 --- a/src/fs/test_fs_unindex.c +++ b/src/fs/test_fs_unindex.c @@ -57,7 +57,7 @@ static char *fn; static void -abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_publish_task (void *cls) { GNUNET_FS_publish_stop (publish); publish = NULL; @@ -65,7 +65,7 @@ abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -abort_unindex_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_unindex_task (void *cls) { GNUNET_FS_unindex_stop (unindex); unindex = NULL; diff --git a/src/fs/test_fs_unindex_persistence.c b/src/fs/test_fs_unindex_persistence.c index cfb08629b5..7c76ee2277 100644 --- a/src/fs/test_fs_unindex_persistence.c +++ b/src/fs/test_fs_unindex_persistence.c @@ -58,7 +58,7 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; static void -abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_publish_task (void *cls) { GNUNET_FS_publish_stop (publish); publish = NULL; @@ -66,7 +66,7 @@ abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -abort_unindex_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +abort_unindex_task (void *cls) { if (unindex != NULL) { @@ -87,7 +87,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event); static void -restart_fs_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +restart_fs_task (void *cls) { GNUNET_FS_stop (fs); fs = GNUNET_FS_start (cfg, "test-fs-unindex-persistence", &progress_cb, NULL, diff --git a/src/fs/test_gnunet_service_fs_migration.c b/src/fs/test_gnunet_service_fs_migration.c index b698506b4e..f00290b0d3 100644 --- a/src/fs/test_gnunet_service_fs_migration.c +++ b/src/fs/test_gnunet_service_fs_migration.c @@ -64,8 +64,7 @@ struct DownloadContext static void -do_stop (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_stop (void *cls) { struct GNUNET_TIME_Relative del; char *fancy; @@ -140,11 +139,12 @@ do_download (void *cls, static void -stop_source_peer (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +stop_source_peer (void *cls) { struct DownloadContext *dc = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); /* Do not interact with testbed when shutting down */ if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c index f2b3f7516c..3f6ec24972 100644 --- a/src/fs/test_gnunet_service_fs_p2p.c +++ b/src/fs/test_gnunet_service_fs_p2p.c @@ -54,7 +54,7 @@ static struct GNUNET_TIME_Absolute start_time; static void -do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_stop (void *cls) { char *fn = cls; struct GNUNET_TIME_Relative del; diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index da64b3a3ab..6696158c9c 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c @@ -203,10 +203,9 @@ reconnect (struct GNUNET_GNS_Handle *handle) * Reconnect to GNS * * @param cls the handle - * @param tc task context */ static void -reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect_task (void *cls) { struct GNUNET_GNS_Handle *handle = cls; diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c index 24014f204e..e7be8fd841 100644 --- a/src/gns/gnunet-bcd.c +++ b/src/gns/gnunet-bcd.c @@ -287,11 +287,13 @@ prepare_daemon (struct MHD_Daemon *daemon_handle); * and schedule the next run. */ static void -run_daemon (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +run_daemon (void *cls) { struct MHD_Daemon *daemon_handle = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; http_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_assert (MHD_YES == MHD_run (daemon_handle)); @@ -384,8 +386,7 @@ server_start () * Stop HTTP server. */ static void -server_stop (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +server_stop (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "HTTP server shutdown\n"); diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c index 7b5613234d..119bda91a7 100644 --- a/src/gns/gnunet-dns2gns.c +++ b/src/gns/gnunet-dns2gns.c @@ -170,11 +170,9 @@ static struct GNUNET_IDENTITY_Operation *id_op; * Task run on shutdown. Cleans up everything. * * @param cls unused - * @param tc scheduler context */ static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != t4) GNUNET_SCHEDULER_cancel (t4); @@ -252,12 +250,10 @@ send_response (struct Request *request) /** * Task run on timeout. Cleans up request. * - * @param cls 'struct Request' of the request to clean up - * @param tc scheduler context + * @param cls `struct Request *` of the request to clean up */ static void -do_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_timeout (void *cls) { struct Request *request = cls; @@ -507,21 +503,21 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock, * Task to read IPv4 DNS packets. * * @param cls the 'listen_socket4' - * @param tc scheduler context */ static void -read_dns4 (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +read_dns4 (void *cls) { struct sockaddr_in v4; socklen_t addrlen; ssize_t size; + const struct GNUNET_SCHEDULER_TaskContext *tc; GNUNET_assert (listen_socket4 == cls); t4 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, listen_socket4, &read_dns4, listen_socket4); + tc = GNUNET_SCHEDULER_get_task_context (); if (0 == (GNUNET_SCHEDULER_REASON_READ_READY & tc->reason)) return; /* shutdown? */ size = GNUNET_NETWORK_socket_recvfrom_amount (listen_socket4); @@ -550,21 +546,21 @@ read_dns4 (void *cls, * Task to read IPv6 DNS packets. * * @param cls the 'listen_socket6' - * @param tc scheduler context */ static void -read_dns6 (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +read_dns6 (void *cls) { struct sockaddr_in6 v6; socklen_t addrlen; ssize_t size; + const struct GNUNET_SCHEDULER_TaskContext *tc; GNUNET_assert (listen_socket6 == cls); t6 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, listen_socket6, &read_dns6, listen_socket6); + tc = GNUNET_SCHEDULER_get_task_context (); if (0 == (GNUNET_SCHEDULER_REASON_READ_READY & tc->reason)) return; /* shutdown? */ size = GNUNET_NETWORK_socket_recvfrom_amount (listen_socket6); diff --git a/src/gns/gnunet-gns-helper-service-w32.c b/src/gns/gnunet-gns-helper-service-w32.c index e4fc2f3049..112bcd258b 100644 --- a/src/gns/gnunet-gns-helper-service-w32.c +++ b/src/gns/gnunet-gns-helper-service-w32.c @@ -112,11 +112,9 @@ static int got_egos = 0; * Task run on shutdown. Cleans up everything. * * @param cls unused - * @param tc scheduler context */ static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { struct request *rq; if (NULL != id_op) diff --git a/src/gns/gnunet-gns-import.c b/src/gns/gnunet-gns-import.c index ad874cfeb2..5f94e77920 100644 --- a/src/gns/gnunet-gns-import.c +++ b/src/gns/gnunet-gns-import.c @@ -344,11 +344,9 @@ get_ego (void *cls, * Task run on shutdown. * * @param cls NULL - * @param tc unused */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { GNUNET_free_non_null (master_zone_pkey); master_zone_pkey = NULL; diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index 3b5adc8b11..9a34c83af4 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c @@ -1257,10 +1257,9 @@ curl_upload_cb (void *buf, size_t size, size_t nmemb, void *cls) * from curl * * @param cls closure - * @param tc task context */ static void -curl_task_download (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +curl_task_download (void *cls); /** @@ -1328,11 +1327,9 @@ curl_download_prepare () * Task that is run when we are ready to receive more data from curl. * * @param cls closure, NULL - * @param tc task context */ static void -curl_task_download (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +curl_task_download (void *cls) { int running; int msgnum; @@ -1821,11 +1818,9 @@ kill_httpd (struct MhdHttpList *hd) * Task run whenever HTTP server is idle for too long. Kill it. * * @param cls the `struct MhdHttpList *` - * @param tc sched context */ static void -kill_httpd_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +kill_httpd_task (void *cls) { struct MhdHttpList *hd = cls; @@ -1838,11 +1833,9 @@ kill_httpd_task (void *cls, * Task run whenever HTTP server operations are pending. * * @param cls the `struct MhdHttpList *` of the daemon that is being run - * @param tc sched context */ static void -do_httpd (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +do_httpd (void *cls); /** @@ -1920,11 +1913,9 @@ schedule_httpd (struct MhdHttpList *hd) * Task run whenever HTTP server operations are pending. * * @param cls the `struct MhdHttpList` of the daemon that is being run - * @param tc scheduler context */ static void -do_httpd (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_httpd (void *cls) { struct MhdHttpList *hd = cls; @@ -2171,11 +2162,9 @@ lookup_ssl_httpd (const char* domain) * the SOCKS5 handshake). Clean up. * * @param cls the `struct Socks5Request *` - * @param tc sched context */ static void -timeout_s5r_handshake (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_s5r_handshake (void *cls) { struct Socks5Request *s5r = cls; @@ -2245,11 +2234,9 @@ setup_data_transfer (struct Socks5Request *s5r) * Write data from buffer to socks5 client, then continue with state machine. * * @param cls the closure with the `struct Socks5Request` - * @param tc scheduler context */ static void -do_write (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_write (void *cls) { struct Socks5Request *s5r = cls; ssize_t len; @@ -2502,11 +2489,9 @@ clear_from_s5r_rbuf (struct Socks5Request *s5r, * Read data from incoming Socks5 connection * * @param cls the closure with the `struct Socks5Request` - * @param tc the scheduler context */ static void -do_s5r_read (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_s5r_read (void *cls) { struct Socks5Request *s5r = cls; const struct Socks5ClientHelloMessage *c_hello; @@ -2514,8 +2499,10 @@ do_s5r_read (void *cls, const struct Socks5ClientRequestMessage *c_req; ssize_t rlen; size_t alen; + const struct GNUNET_SCHEDULER_TaskContext *tc; s5r->rtask = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ( (NULL != tc->read_ready) && (GNUNET_NETWORK_fdset_isset (tc->read_ready, s5r->sock)) ) { @@ -2721,17 +2708,18 @@ do_s5r_read (void *cls, * @param tc the scheduler context */ static void -do_accept (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_accept (void *cls) { struct GNUNET_NETWORK_Handle *lsock = cls; struct GNUNET_NETWORK_Handle *s; struct Socks5Request *s5r; + const struct GNUNET_SCHEDULER_TaskContext *tc; if (lsock == lsock4) ltask4 = NULL; else ltask6 = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; if (lsock == lsock4) @@ -2769,11 +2757,9 @@ do_accept (void *cls, * Task run on shutdown * * @param cls closure - * @param tc task context */ static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down...\n"); diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index 5d083cdb6b..c8310db463 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c @@ -105,11 +105,9 @@ static struct GNUNET_IDENTITY_Operation *id_op; * Task run on shutdown. Cleans up everything. * * @param cls unused - * @param tc scheduler context */ static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != el) { diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index 076475d2c3..87b0fd04e2 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c @@ -260,8 +260,7 @@ static struct GNUNET_STATISTICS_Handle *statistics; * @param tc unused */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct ClientLookupHandle *clh; struct MonitorActivity *ma; @@ -349,11 +348,9 @@ shutdown_task (void *cls, * Method called periodically that triggers iteration over authoritative records * * @param cls closure - * @param tc task context */ static void -publish_zone_dht_next (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +publish_zone_dht_next (void *cls) { zone_publish_task = NULL; GNUNET_NAMESTORE_zone_iterator_next (namestore_iter); @@ -364,11 +361,9 @@ publish_zone_dht_next (void *cls, * Periodically iterate over our zone and store everything in dht * * @param cls NULL - * @param tc task context */ static void -publish_zone_dht_start (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +publish_zone_dht_start (void *cls); /** @@ -629,11 +624,9 @@ put_gns_record (void *cls, * Periodically iterate over all zones and store everything in DHT * * @param cls NULL - * @param tc task context */ static void -publish_zone_dht_start (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +publish_zone_dht_start (void *cls) { zone_publish_task = NULL; diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 9a54a80807..daae46ab7c 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -541,11 +541,9 @@ translate_dot_plus (struct GNS_ResolverHandle *rh, * Task scheduled to asynchronously fail a resolution. * * @param cls the 'struct GNS_ResolverHandle' of the resolution to fail - * @param tc task context */ static void -fail_resolution (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +fail_resolution (void *cls) { struct GNS_ResolverHandle *rh = cls; @@ -808,8 +806,7 @@ handle_dns_result (void *cls, * @param tc task context */ static void -recursive_resolution (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +recursive_resolution (void *cls); /** @@ -2229,11 +2226,9 @@ recursive_gns_resolution_revocation (struct GNS_ResolverHandle *rh) * Task scheduled to continue with the resolution process. * * @param cls the `struct GNS_ResolverHandle` of the resolution - * @param tc task context */ static void -recursive_resolution (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +recursive_resolution (void *cls) { struct GNS_ResolverHandle *rh = cls; diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c index 4878669e40..8a3f260418 100644 --- a/src/gns/plugin_rest_gns.c +++ b/src/gns/plugin_rest_gns.c @@ -211,11 +211,12 @@ cleanup_handle (struct LookupHandle *handle) * @param tc scheduler context */ static void -do_error (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_error (void *cls) { struct LookupHandle *handle = cls; - struct MHD_Response *resp = GNUNET_REST_create_json_response (NULL); + struct MHD_Response *resp; + + resp = GNUNET_REST_create_json_response (NULL); handle->proc (handle->proc_cls, resp, MHD_HTTP_BAD_REQUEST); cleanup_handle (handle); } @@ -550,7 +551,7 @@ get_gns_cont (struct RestConnectionDataHandle *conndata_handle, GNUNET_CONTAINER_multihashmap_contains (conndata_handle->url_param_map, &key) ) { - handle->type = GNUNET_GNSRECORD_typename_to_number + handle->type = GNUNET_GNSRECORD_typename_to_number (GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map, &key)); } diff --git a/src/gns/test_gns_proxy.c b/src/gns/test_gns_proxy.c index 72e8ff20ba..0afc3ea0b7 100644 --- a/src/gns/test_gns_proxy.c +++ b/src/gns/test_gns_proxy.c @@ -165,8 +165,7 @@ curl_main (void); static void -curl_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +curl_task (void *cls) { curl_task_id = NULL; curl_main (); @@ -247,7 +246,7 @@ curl_main () } static void -start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +start_curl (void *cls) { GNUNET_asprintf (&url, "http://%s:%d/hello_world", @@ -269,12 +268,14 @@ start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) curl_main (); } + static void -disco_ns (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +disco_ns (void* cls) { GNUNET_NAMESTORE_disconnect (namestore); } + /** * Callback invoked from the namestore service once record is * created. @@ -315,8 +316,7 @@ mhd_main (void); static void -mhd_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +mhd_task (void *cls) { mhd_task_id = NULL; MHD_run (mhd); diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index 42b5959f26..6a4689af1b 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c @@ -212,11 +212,9 @@ disconnect_handler (void *cls, * the other services. * * @param cls NULL - * @param tc scheduler context */ static void -cleaning_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cleaning_task (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Hostlist daemon is shutting down\n"); diff --git a/src/hostlist/gnunet-daemon-hostlist_client.c b/src/hostlist/gnunet-daemon-hostlist_client.c index e0a73f0f0a..dbf6eaedac 100644 --- a/src/hostlist/gnunet-daemon-hostlist_client.c +++ b/src/hostlist/gnunet-daemon-hostlist_client.c @@ -774,8 +774,7 @@ clean_up () * @param tc task context, unused */ static void -task_download (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +task_download (void *cls); /** @@ -841,17 +840,17 @@ download_prepare () * server. * * @param cls closure, unused - * @param tc task context, unused */ static void -task_download (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +task_download (void *cls) { int running; struct CURLMsg *msg; CURLMcode mret; + const struct GNUNET_SCHEDULER_TaskContext *tc; ti_download = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -1046,10 +1045,12 @@ download_hostlist () static void -task_download_dispatcher (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +task_download_dispatcher (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + ti_download_dispatcher_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download is initiated...\n"); @@ -1075,12 +1076,14 @@ task_download_dispatcher (void *cls, * this task again for a later time. */ static void -task_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task_check (void *cls) { static int once; struct GNUNET_TIME_Relative delay; + const struct GNUNET_SCHEDULER_TaskContext *tc; ti_check_download = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; if (stats == NULL) @@ -1125,13 +1128,14 @@ task_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * This tasks sets hostlist testing to allowed after intervall between to testings is reached * * @param cls closure - * @param tc TaskContext */ static void -task_testing_intervall_reset (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +task_testing_intervall_reset (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + ti_testing_intervall_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; stat_testing_allowed = GNUNET_OK; @@ -1144,12 +1148,14 @@ task_testing_intervall_reset (void *cls, * Task that writes hostlist entries to a file on a regular base * * @param cls closure - * @param tc TaskContext */ static void -task_hostlist_saving (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task_hostlist_saving (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + ti_saving_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; save_hostlist_file (GNUNET_NO); diff --git a/src/hostlist/gnunet-daemon-hostlist_server.c b/src/hostlist/gnunet-daemon-hostlist_server.c index 7c5b18605f..6e2cb7ee46 100644 --- a/src/hostlist/gnunet-daemon-hostlist_server.c +++ b/src/hostlist/gnunet-daemon-hostlist_server.c @@ -627,19 +627,18 @@ prepare_daemon (struct MHD_Daemon *daemon_handle); * and schedule the next run. * * @param cls the `struct MHD_Daemon` of the HTTP server to run - * @param tc scheduler context */ static void -run_daemon (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +run_daemon (void *cls) { struct MHD_Daemon *daemon_handle = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; if (daemon_handle == daemon_handle_v4) hostlist_task_v4 = NULL; else hostlist_task_v6 = NULL; - + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_assert (MHD_YES == MHD_run (daemon_handle)); diff --git a/src/hostlist/test_gnunet_daemon_hostlist.c b/src/hostlist/test_gnunet_daemon_hostlist.c index 05e05e24e6..2f99b887d0 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist.c +++ b/src/hostlist/test_gnunet_daemon_hostlist.c @@ -52,7 +52,7 @@ static struct PeerContext p2; static void -clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +clean_up (void *cls) { if (p1.th != NULL) { @@ -81,12 +81,12 @@ clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Timeout, give up. */ static void -timeout_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_error (void *cls) { timeout_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout trying to connect peers, test failed.\n"); - clean_up (NULL, tc); + clean_up (NULL); } @@ -150,7 +150,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) static void -waitpid_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +waitpid_task (void *cls) { struct PeerContext *p = cls; @@ -179,7 +179,7 @@ stop_arm (struct PeerContext *p) * Try again to connect to transport service. */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { stop_arm (&p1); stop_arm (&p2); diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index d04c5c57ff..a71b8ecaee 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c @@ -166,7 +166,7 @@ shutdown_testcase () * Timeout, give up. */ static void -timeout_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_error (void *cls) { timeout_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -184,8 +184,7 @@ process_downloads_done (void *cls, int success) static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { shutdown_testcase (); } @@ -265,11 +264,13 @@ process_adv_sent (void *cls, const char *subsystem, const char *name, * Check the server statistics regularly */ static void -check_statistics (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +check_statistics (void *cls) { char *stat; + const struct GNUNET_SCHEDULER_TaskContext *tc; check_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_asprintf (&stat, gettext_noop ("# advertised URI `%s' downloaded"), diff --git a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c index e7ac9b2bc3..0af16e0659 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c @@ -52,7 +52,7 @@ static struct PeerContext p2; static void -clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +clean_up (void *cls) { if (NULL != p1.ghh) { @@ -81,12 +81,12 @@ clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Timeout, give up. */ static void -timeout_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_error (void *cls) { timeout_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout trying to connect peers, test failed.\n"); - clean_up (NULL, tc); + clean_up (NULL); } @@ -150,7 +150,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) static void -waitpid_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +waitpid_task (void *cls) { struct PeerContext *p = cls; @@ -179,7 +179,7 @@ stop_arm (struct PeerContext *p) * Try again to connect to transport service. */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { stop_arm (&p1); stop_arm (&p2); diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index 3328035e6f..59e678b243 100644 --- a/src/identity-provider/gnunet-service-identity-provider.c +++ b/src/identity-provider/gnunet-service-identity-provider.c @@ -182,7 +182,7 @@ struct ExchangeHandle * LookupRequest */ struct GNUNET_GNS_LookupRequest *lookup_request; - + /** * Audience Key */ @@ -324,11 +324,9 @@ store_token_cont (void *cls, * removes deleted attributes and expiration times. * * @param cls the ego entry - * @param tc task context */ static void -handle_token_update (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +handle_token_update (void *cls) { char *token_metadata; char *write_ptr; @@ -428,13 +426,13 @@ handle_token_update (void *cls, attr->name, attr->val_head->value); } - else + else { GNUNET_CRYPTO_hash (attr->name, strlen (attr->name), &key_hash); //Check if attr still exists. omit of not - if (GNUNET_NO != + if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains (ego_entry->attr_map, &key_hash)) { @@ -497,8 +495,7 @@ handle_token_update (void *cls, } static void -update_identities(void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +update_identities(void *cls); /** * @@ -568,7 +565,7 @@ token_collect (void *cls, GNUNET_CONTAINER_multihashmap_clear (ego_entry->attr_map); update_task = GNUNET_SCHEDULER_add_now (&update_identities, ego_entry->next); - return; + return; } //There should be only a single record for a token under a label @@ -607,7 +604,7 @@ token_collect (void *cls, aud_key, &token); - label = GNUNET_strdup (lbl); + label = GNUNET_strdup (lbl); rd_exp = token_record->expiration_time; GNUNET_SCHEDULER_add_now (&handle_token_update, ego_entry); @@ -711,12 +708,9 @@ attribute_collect (void *cls, * dirty, first update the attributes. * * @param cls the ego to update - * param tc task context - * */ static void -update_identities(void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +update_identities(void *cls) { struct EgoEntry *next_ego = cls; const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; @@ -866,8 +860,7 @@ cleanup() * @param tc task context */ static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down...\n"); @@ -882,10 +875,10 @@ create_exchange_result_message (const char* token, { struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage *erm; uint16_t token_len = strlen (token) + 1; - erm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage) + erm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage) + token_len); erm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_EXCHANGE_RESULT); - erm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage) + erm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage) + token_len); erm->ticket_nonce = htonl (ticket_nonce); memcpy (&erm[1], token, token_len); @@ -901,12 +894,12 @@ create_issue_result_message (const char* label, struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage *irm; char *tmp_str; - irm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage) + irm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage) + strlen (label) + 1 + strlen (ticket) + 1 + strlen (token) + 1); irm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ISSUE_RESULT); - irm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage) + irm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage) + strlen (label) + 1 + strlen (ticket) + 1 + strlen (token) + 1); @@ -957,7 +950,7 @@ store_token_issue_cont (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", "Error serializing ticket\n"); cleanup_issue_handle (handle); - GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); + GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); return; } if (GNUNET_OK != token_to_string (handle->token, @@ -968,7 +961,7 @@ store_token_issue_cont (void *cls, "Error serializing token\n"); GNUNET_free (ticket_str); cleanup_issue_handle (handle); - GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); + GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); return; } irm = create_issue_result_message (handle->label, ticket_str, token_str); @@ -983,8 +976,12 @@ store_token_issue_cont (void *cls, GNUNET_free (token_str); } + /** * Build a GNUid token for identity + * + * FIXME: doxygen is very wrong here! + * * @param handle the handle * @param ego_entry the ego to build the token for * @param name name of the ego @@ -993,8 +990,7 @@ store_token_issue_cont (void *cls, * @return identifier string of token (label) */ static void -sign_and_return_token (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +sign_and_return_token (void *cls) { struct GNUNET_CRYPTO_EcdsaPublicKey pub_key; struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey; @@ -1008,7 +1004,7 @@ sign_and_return_token (void *cls, uint64_t exp_time; size_t token_metadata_len; - //Remote nonce + //Remote nonce nonce_str = NULL; GNUNET_asprintf (&nonce_str, "%lu", handle->nonce); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Request nonce: %s\n", nonce_str); @@ -1028,7 +1024,7 @@ sign_and_return_token (void *cls, token_add_attr_int (handle->token, "exp", exp_time); token_add_attr (handle->token, "nonce", nonce_str); - //Token in a serialized encrypted format + //Token in a serialized encrypted format GNUNET_assert (token_serialize (handle->token, &handle->iss_key, &ecdhe_privkey, @@ -1150,7 +1146,7 @@ attr_collect (void *cls, static void cleanup_exchange_handle (struct ExchangeHandle *handle) { - if (NULL != handle->ticket) + if (NULL != handle->ticket) ticket_destroy (handle->ticket); if (NULL != handle->token) token_destroy (handle->token); @@ -1177,7 +1173,7 @@ process_lookup_result (void *cls, uint32_t rd_count, return; } - record_str = + record_str = GNUNET_GNSRECORD_value_to_string (GNUNET_GNSRECORD_TYPE_ID_TOKEN, rd->data, rd->data_size); @@ -1307,7 +1303,7 @@ find_existing_token (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, ">>> No existing token found\n"); //Label - rnd_key = + rnd_key = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); GNUNET_STRINGS_base64_encode ((char*)&rnd_key, @@ -1318,7 +1314,7 @@ find_existing_token (void *cls, &handle->iss_key, &attr_collect, handle); - return; + return; } //There should be only a single record for a token under a label @@ -1340,7 +1336,7 @@ find_existing_token (void *cls, return; } ecdhe_privkey = *((struct GNUNET_CRYPTO_EcdhePrivateKey *)token_metadata_record->data); - aud_key = + aud_key = (struct GNUNET_CRYPTO_EcdsaPublicKey *)(token_metadata_record->data+sizeof(struct GNUNET_CRYPTO_EcdhePrivateKey)); tmp_scopes = GNUNET_strdup ((char*) aud_key+sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); @@ -1435,12 +1431,11 @@ handle_issue_message (void *cls, } im = (const struct GNUNET_IDENTITY_PROVIDER_IssueMessage *) message; scopes = (const char *) &im[1]; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Received ISSUE of `%s' from client\n", - scope); issue_handle = GNUNET_malloc (sizeof (struct IssueHandle)); issue_handle->attr_map = GNUNET_CONTAINER_multihashmap_create (5, GNUNET_NO); + /* FIXME: check that scopes is 0-termianted, Out-of-bounds access + possible here!!! */ scopes_tmp = GNUNET_strdup (scopes); scope = strtok(scopes_tmp, ","); for (; NULL != scope; scope = strtok (NULL, ",")) @@ -1484,7 +1479,7 @@ handle_issue_message (void *cls, * @param c configuration */ static void -run (void *cls, +run (void *cls, struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { @@ -1519,7 +1514,7 @@ run (void *cls, &list_ego, NULL); - if (GNUNET_OK == + if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (cfg, "identity-provider", "TOKEN_EXPIRATION_INTERVAL", diff --git a/src/identity-provider/identity_provider_api.c b/src/identity-provider/identity_provider_api.c index f702ba890c..f3280cb18a 100644 --- a/src/identity-provider/identity_provider_api.c +++ b/src/identity-provider/identity_provider_api.c @@ -138,11 +138,9 @@ struct GNUNET_IDENTITY_PROVIDER_Handle * Try again to connect to the service. * * @param cls handle to the service. - * @param tc scheduler context */ static void -reconnect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +reconnect (void *cls); /** @@ -233,7 +231,7 @@ message_handler (void *cls, str = NULL; } label_str = strtok (str, ","); - + if (NULL == label_str) { GNUNET_free (str); @@ -301,7 +299,7 @@ message_handler (void *cls, op->ex_cb (op->cls, &token, ticket_nonce); GNUNET_free (op); break; - + default: GNUNET_break (0); reschedule_connect (h); @@ -397,10 +395,9 @@ transmit_next (struct GNUNET_IDENTITY_PROVIDER_Handle *h) * Try again to connect to the service. * * @param cls handle to the identity provider service. - * @param tc scheduler context */ static void -reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect (void *cls) { struct GNUNET_IDENTITY_PROVIDER_Handle *h = cls; diff --git a/src/identity-provider/plugin_rest_identity_provider.c b/src/identity-provider/plugin_rest_identity_provider.c index 3a61516822..b104950bab 100644 --- a/src/identity-provider/plugin_rest_identity_provider.c +++ b/src/identity-provider/plugin_rest_identity_provider.c @@ -150,12 +150,12 @@ struct EgoEntry * DLL */ struct EgoEntry *next; - + /** * DLL */ struct EgoEntry *prev; - + /** * Ego Identifier */ @@ -165,7 +165,7 @@ struct EgoEntry * Public key string */ char *keystring; - + /** * The Ego */ @@ -189,7 +189,7 @@ struct RequestHandle * Selected ego */ struct EgoEntry *ego_entry; - + /** * Ptr to current ego private key */ @@ -199,7 +199,7 @@ struct RequestHandle * Handle to the rest connection */ struct RestConnectionDataHandle *conndata_handle; - + /** * The processing state */ @@ -248,8 +248,8 @@ struct RequestHandle /** * ID of a task associated with the resolution process. */ - struct GNUNET_SCHEDULER_Task * timeout_task; - + struct GNUNET_SCHEDULER_Task * timeout_task; + /** * The plugin result processor */ @@ -289,7 +289,7 @@ cleanup_handle (struct RequestHandle *handle) struct EgoEntry *ego_tmp; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n"); - if (NULL != handle->resp_object) + if (NULL != handle->resp_object) GNUNET_REST_jsonapi_object_delete (handle->resp_object); if (NULL != handle->timeout_task) GNUNET_SCHEDULER_cancel (handle->timeout_task); @@ -324,11 +324,9 @@ cleanup_handle (struct RequestHandle *handle) * Task run on shutdown. Cleans up everything. * * @param cls unused - * @param tc scheduler context */ static void -do_error (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_error (void *cls) { struct RequestHandle *handle = cls; struct MHD_Response *resp; @@ -347,11 +345,9 @@ do_error (void *cls, * Task run on shutdown. Cleans up everything. * * @param cls unused - * @param tc scheduler context */ static void -do_cleanup_handle_delayed (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_cleanup_handle_delayed (void *cls) { struct RequestHandle *handle = cls; cleanup_handle(handle); @@ -377,7 +373,7 @@ token_creat_cont (void *cls, char *ticket_str; char *token_str; char *result_str; - + if (NULL == ticket) { handle->emsg = GNUNET_strdup ("Error in token issue"); @@ -536,7 +532,7 @@ issue_token_cont (struct RestConnectionDataHandle *con, &aud_key, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); - //Remote nonce + //Remote nonce nonce_str = NULL; GNUNET_CRYPTO_hash (GNUNET_IDENTITY_TOKEN_REQUEST_NONCE, strlen (GNUNET_IDENTITY_TOKEN_REQUEST_NONCE), @@ -600,11 +596,9 @@ issue_token_cont (struct RestConnectionDataHandle *con, * Build a GNUid token for identity * * @param cls the request handle - * @param tc task context */ static void -return_token_list (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +return_token_list (void *cls) { char* result_str; struct RequestHandle *handle = cls; @@ -784,7 +778,7 @@ exchange_cont (void *cls, char* token_str; char* nonce_str; uint64_t expected_nonce; - + //Get nonce GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_IDENTITY_PROVIDER_EXPECTED_NONCE, strlen (GNUNET_REST_JSONAPI_IDENTITY_PROVIDER_EXPECTED_NONCE), @@ -823,7 +817,7 @@ exchange_cont (void *cls, GNUNET_free (result); handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); cleanup_handle (handle); - json_decref (root); + json_decref (root); } @@ -1010,7 +1004,7 @@ list_ego (void *cls, if (ID_REST_STATE_INIT == handle->state) { ego_entry = GNUNET_new (struct EgoEntry); GNUNET_IDENTITY_ego_get_public_key (ego, &pk); - ego_entry->keystring = + ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); ego_entry->ego = ego; GNUNET_asprintf (&ego_entry->identifier, "%s", identifier); diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c index 574586b40b..dc9174d21c 100644 --- a/src/identity/gnunet-identity.c +++ b/src/identity/gnunet-identity.c @@ -84,11 +84,9 @@ static struct GNUNET_IDENTITY_Operation *delete_op; * Task run on shutdown. * * @param cls NULL - * @param tc unused */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { if (NULL != set_op) { diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c index 8a26fb8c3b..d36319a99a 100644 --- a/src/identity/gnunet-service-identity.c +++ b/src/identity/gnunet-service-identity.c @@ -134,10 +134,9 @@ get_ego_filename (struct Ego *ego) * 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) { struct Ego *e; diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c index 6b7ca5c442..1406ddd411 100644 --- a/src/identity/identity_api.c +++ b/src/identity/identity_api.c @@ -195,11 +195,9 @@ GNUNET_IDENTITY_ego_get_anonymous () * Try again to connect to the identity service. * * @param cls handle to the identity service. - * @param tc scheduler context */ static void -reconnect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +reconnect (void *cls); /** @@ -533,10 +531,9 @@ transmit_next (struct GNUNET_IDENTITY_Handle *h) * Try again to connect to the identity service. * * @param cls handle to the identity service. - * @param tc scheduler context */ static void -reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect (void *cls) { struct GNUNET_IDENTITY_Handle *h = cls; struct GNUNET_IDENTITY_Operation *op; diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c index 9ab3a87726..22ade6a0e5 100644 --- a/src/identity/plugin_rest_identity.c +++ b/src/identity/plugin_rest_identity.c @@ -107,12 +107,12 @@ struct EgoEntry * DLL */ struct EgoEntry *next; - + /** * DLL */ struct EgoEntry *prev; - + /** * Ego Identifier */ @@ -122,7 +122,7 @@ struct EgoEntry * Public key string */ char *keystring; - + /** * The Ego */ @@ -146,7 +146,7 @@ struct RequestHandle * Handle to the rest connection */ struct RestConnectionDataHandle *conndata_handle; - + /** * The processing state */ @@ -170,7 +170,7 @@ struct RequestHandle /** * ID of a task associated with the resolution process. */ - struct GNUNET_SCHEDULER_Task * timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * The plugin result processor @@ -260,11 +260,9 @@ cleanup_handle (struct RequestHandle *handle) * Task run on shutdown. Cleans up everything. * * @param cls unused - * @param tc scheduler context */ static void -do_error (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_error (void *cls) { struct RequestHandle *handle = cls; struct MHD_Response *resp; @@ -528,7 +526,7 @@ ego_create_cont (struct RestConnectionDataHandle *con, egoname_json = GNUNET_REST_jsonapi_resource_read_attr (json_res, GNUNET_REST_JSONAPI_IDENTITY_NAME); if (!json_is_string (egoname_json)) { - GNUNET_REST_jsonapi_object_delete (json_obj); + GNUNET_REST_jsonapi_object_delete (json_obj); handle->emsg = GNUNET_strdup ("No name provided"); GNUNET_SCHEDULER_add_now (&do_error, handle); return; @@ -563,7 +561,7 @@ ego_create_cont (struct RestConnectionDataHandle *con, * @param url the url that is requested * @param cls the RequestHandle */ -static void +static void ego_edit_cont (struct RestConnectionDataHandle *con, const char *url, void *cls) @@ -633,7 +631,7 @@ ego_edit_cont (struct RestConnectionDataHandle *con, GNUNET_SCHEDULER_add_now (&do_error, handle); return; } - json_res = GNUNET_REST_jsonapi_object_get_resource (json_obj, 0); + json_res = GNUNET_REST_jsonapi_object_get_resource (json_obj, 0); if (GNUNET_NO == GNUNET_REST_jsonapi_resource_check_type (json_res, GNUNET_REST_JSONAPI_IDENTITY_EGO)) { @@ -692,7 +690,7 @@ ego_edit_cont (struct RestConnectionDataHandle *con, GNUNET_SCHEDULER_add_now (&do_error, handle); } -void +void ego_delete_cont (struct RestConnectionDataHandle *con_handle, const char* url, void *cls) @@ -836,7 +834,7 @@ list_ego (void *cls, if (ID_REST_STATE_INIT == handle->state) { ego_entry = GNUNET_new (struct EgoEntry); GNUNET_IDENTITY_ego_get_public_key (ego, &pk); - ego_entry->keystring = + ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); ego_entry->ego = ego; GNUNET_asprintf (&ego_entry->identifier, "%s", identifier); diff --git a/src/identity/test_identity.c b/src/identity/test_identity.c index 12d182c652..6eaa86e919 100644 --- a/src/identity/test_identity.c +++ b/src/identity/test_identity.c @@ -77,10 +77,9 @@ cleanup () * Termiante the testcase (failure). * * @param cls NULL - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { cleanup (); res = 1; @@ -91,10 +90,9 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Termiante the testcase (success). * * @param cls NULL - * @param tc scheduler context */ static void -end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_normally (void *cls) { cleanup (); res = 0; diff --git a/src/identity/test_identity_defaults.c b/src/identity/test_identity_defaults.c index 9610666271..207db321f6 100644 --- a/src/identity/test_identity_defaults.c +++ b/src/identity/test_identity_defaults.c @@ -77,10 +77,9 @@ cleanup () * Termiante the testcase (failure). * * @param cls NULL - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { cleanup (); res = 1; @@ -91,10 +90,9 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Termiante the testcase (success). * * @param cls NULL - * @param tc scheduler context */ static void -end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_normally (void *cls) { cleanup (); res = 0; diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h index 3fa2497d6b..1cb01d0384 100644 --- a/src/include/gnunet_os_lib.h +++ b/src/include/gnunet_os_lib.h @@ -572,12 +572,9 @@ GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc); * variable) and raise those signals. * * @param cls closure (unused) - * @param tc scheduler context (unused) */ void -GNUNET_OS_install_parent_control_handler (void *cls, - const struct - GNUNET_SCHEDULER_TaskContext *tc); +GNUNET_OS_install_parent_control_handler (void *cls); /** diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h index e93eab41fa..d9b63775a8 100644 --- a/src/include/gnunet_scheduler_lib.h +++ b/src/include/gnunet_scheduler_lib.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet - Copyright (C) 2009-2015 GNUnet e.V. + Copyright (C) 2009-2016 GNUnet e.V. GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -131,8 +131,7 @@ struct GNUNET_SCHEDULER_TaskContext * @param tc context information (why was this task triggered now) */ typedef void -(*GNUNET_SCHEDULER_TaskCallback) (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +(*GNUNET_SCHEDULER_TaskCallback) (void *cls); /** @@ -200,14 +199,13 @@ GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p); /** - * Obtain the reason code for why the current task was - * started. Will return the same value as - * the GNUNET_SCHEDULER_TaskContext's reason field. + * Obtain the reasoning why the current task was + * started. * - * @return reason(s) why the current task is run + * @return task context with information why the current task is run */ -enum GNUNET_SCHEDULER_Reason -GNUNET_SCHEDULER_get_reason (void); +const struct GNUNET_SCHEDULER_TaskContext * +GNUNET_SCHEDULER_get_task_context (void); /** diff --git a/src/include/gnunet_server_lib.h b/src/include/gnunet_server_lib.h index f70f281166..1ad2fc8b77 100644 --- a/src/include/gnunet_server_lib.h +++ b/src/include/gnunet_server_lib.h @@ -453,8 +453,9 @@ GNUNET_SERVER_client_get_address (struct GNUNET_SERVER_Client *client, * @param client identification of the client; NULL * for the last call when the server is destroyed */ -typedef void (*GNUNET_SERVER_DisconnectCallback) (void *cls, - struct GNUNET_SERVER_Client *client); +typedef void +(*GNUNET_SERVER_DisconnectCallback) (void *cls, + struct GNUNET_SERVER_Client *client); /** @@ -464,8 +465,9 @@ typedef void (*GNUNET_SERVER_DisconnectCallback) (void *cls, * @param cls closure * @param client identification of the client */ -typedef void (*GNUNET_SERVER_ConnectCallback) (void *cls, - struct GNUNET_SERVER_Client *client); +typedef void +(*GNUNET_SERVER_ConnectCallback) (void *cls, + struct GNUNET_SERVER_Client *client); /** @@ -799,8 +801,9 @@ GNUNET_SERVER_mst_destroy (struct GNUNET_SERVER_MessageStreamTokenizer *mst); * @param client handle to client the tokenzier will be used for * @return handle to custom tokenizer ('mst') */ -typedef void* (*GNUNET_SERVER_MstCreateCallback) (void *cls, - struct GNUNET_SERVER_Client *client); +typedef void* +(*GNUNET_SERVER_MstCreateCallback) (void *cls, + struct GNUNET_SERVER_Client *client); /** @@ -809,7 +812,9 @@ typedef void* (*GNUNET_SERVER_MstCreateCallback) (void *cls, * @param cls closure from #GNUNET_SERVER_set_callbacks * @param mst custom tokenizer handle */ -typedef void (*GNUNET_SERVER_MstDestroyCallback) (void *cls, void *mst); +typedef void +(*GNUNET_SERVER_MstDestroyCallback) (void *cls, + void *mst); /** @@ -828,10 +833,13 @@ typedef void (*GNUNET_SERVER_MstDestroyCallback) (void *cls, void *mst); * #GNUNET_NO if one_shot was set and we have another message ready * #GNUNET_SYSERR if the data stream is corrupt */ -typedef int (*GNUNET_SERVER_MstReceiveCallback) (void *cls, void *mst, - struct GNUNET_SERVER_Client *client, - const char *buf, size_t size, - int purge, int one_shot); +typedef int +(*GNUNET_SERVER_MstReceiveCallback) (void *cls, void *mst, + struct GNUNET_SERVER_Client *client, + const char *buf, + size_t size, + int purge, + int one_shot); /** diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c index 69a0d3fd77..8041119b07 100644 --- a/src/multicast/gnunet-service-multicast.c +++ b/src/multicast/gnunet-service-multicast.c @@ -327,10 +327,9 @@ struct ReplayRequestKey * 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) { if (NULL != core) { diff --git a/src/multicast/test_multicast.c b/src/multicast/test_multicast.c index a81c1f379f..9550b8894e 100644 --- a/src/multicast/test_multicast.c +++ b/src/multicast/test_multicast.c @@ -132,10 +132,9 @@ cleanup () * Terminate the test case (failure). * * @param cls NULL - * @param tc scheduler context */ static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { res = 1; cleanup (); @@ -147,10 +146,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Terminate the test case (success). * * @param cls NULL - * @param tc scheduler context */ static void -end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_normally (void *cls) { res = 0; cleanup (); @@ -176,8 +174,8 @@ end () } -void -tmit_resume (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +static void +tmit_resume (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmission resumed.\n"); struct TransmitClosure *tmit = cls; @@ -254,7 +252,7 @@ origin_stopped (void *cls) static void -schedule_origin_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +schedule_origin_stop (void *cls) { test = TEST_ORIGIN_STOP; GNUNET_log (GNUNET_ERROR_TYPE_WARNING, @@ -290,7 +288,7 @@ member_parted (void *cls) static void -schedule_member_part (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +schedule_member_part (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test #%u: schedule_member_part()\n", test); diff --git a/src/namecache/gnunet-namecache.c b/src/namecache/gnunet-namecache.c index eed40da222..6abcb7b921 100644 --- a/src/namecache/gnunet-namecache.c +++ b/src/namecache/gnunet-namecache.c @@ -68,11 +68,9 @@ static int ret; * Task run on shutdown. Cleans up everything. * * @param cls unused - * @param tc scheduler context */ static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != qe) { diff --git a/src/namecache/gnunet-service-namecache.c b/src/namecache/gnunet-service-namecache.c index 3eedb18a5e..81b1cce9bd 100644 --- a/src/namecache/gnunet-service-namecache.c +++ b/src/namecache/gnunet-service-namecache.c @@ -105,10 +105,9 @@ static struct GNUNET_SERVER_NotificationContext *monitor_nc; * Task run during shutdown. * * @param cls unused - * @param tc unused */ static void -cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_task (void *cls) { struct NamecacheClient *nc; @@ -426,4 +425,3 @@ main (int argc, char *const *argv) } /* end of gnunet-service-namecache.c */ - diff --git a/src/namecache/namecache_api.c b/src/namecache/namecache_api.c index 7f9baf1b40..15a7504489 100644 --- a/src/namecache/namecache_api.c +++ b/src/namecache/namecache_api.c @@ -495,11 +495,9 @@ reconnect (struct GNUNET_NAMECACHE_Handle *h) * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -reconnect_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect_task (void *cls) { struct GNUNET_NAMECACHE_Handle *h = cls; diff --git a/src/namecache/test_namecache_api_cache_block.c b/src/namecache/test_namecache_api_cache_block.c index ff4d93b4f1..5522b207d6 100644 --- a/src/namecache/test_namecache_api_cache_block.c +++ b/src/namecache/test_namecache_api_cache_block.c @@ -68,10 +68,9 @@ cleanup () * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { if (NULL != nsqe) { @@ -84,7 +83,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { cleanup (); res = 0; diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c index b00510ae77..82d73f6de2 100644 --- a/src/namestore/gnunet-namestore-fcfsd.c +++ b/src/namestore/gnunet-namestore-fcfsd.c @@ -226,11 +226,9 @@ static unsigned long long port; * Task run whenever HTTP server operations are pending. * * @param cls unused - * @param tc scheduler context */ static void -do_httpd (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +do_httpd (void *cls); /** @@ -840,11 +838,9 @@ run_httpd () * Task run whenever HTTP server operations are pending. * * @param cls unused - * @param tc scheduler context */ static void -do_httpd (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_httpd (void *cls) { httpd_task = NULL; MHD_run (httpd); @@ -856,11 +852,9 @@ do_httpd (void *cls, * Task run on shutdown. Cleans up everything. * * @param cls unused - * @param tc scheduler context */ static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != httpd_task) { diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index 378832a65a..0965d8cbee 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c @@ -199,11 +199,9 @@ static int monitor; * Task run on shutdown. Cleans up everything. * * @param cls unused - * @param tc scheduler context */ static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != get_default) { diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 4d60c8ea58..0bfd002f53 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -270,10 +270,9 @@ static struct GNUNET_SERVER_NotificationContext *monitor_nc; * Task run during shutdown. * * @param cls unused - * @param tc unused */ static void -cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_task (void *cls) { struct ZoneIteration *no; struct NamestoreClient *nc; @@ -1525,11 +1524,9 @@ monitor_sync (struct ZoneMonitor *zm) * Obtain the next datum during the zone monitor's zone intiial iteration. * * @param cls zone monitor that does its initial iteration - * @param tc scheduler context */ static void -monitor_next (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +monitor_next (void *cls); /** @@ -1606,11 +1603,9 @@ handle_monitor_start (void *cls, * Obtain the next datum during the zone monitor's zone intiial iteration. * * @param cls zone monitor that does its initial iteration - * @param tc scheduler context */ static void -monitor_next (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +monitor_next (void *cls) { struct ZoneMonitor *zm = cls; int ret; diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index 70695b85a9..f65c45e85b 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c @@ -866,11 +866,9 @@ reconnect (struct GNUNET_NAMESTORE_Handle *h) * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -reconnect_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect_task (void *cls) { struct GNUNET_NAMESTORE_Handle *h = cls; diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c index a3938cfd88..cfebd63a7b 100644 --- a/src/namestore/plugin_rest_namestore.c +++ b/src/namestore/plugin_rest_namestore.c @@ -82,12 +82,12 @@ struct RecordEntry * DLL */ struct RecordEntry *next; - + /** * DLL */ struct RecordEntry *prev; - + }; struct RequestHandle @@ -106,12 +106,12 @@ struct RequestHandle * JSON response object */ struct JsonApiObject *resp_object; - + /** * Rest connection */ struct RestConnectionDataHandle *conndata_handle; - + /** * Handle to GNS service. */ @@ -121,12 +121,12 @@ struct RequestHandle * Handle to NAMESTORE */ struct GNUNET_NAMESTORE_Handle *ns_handle; - + /** * Handle to NAMESTORE it */ struct GNUNET_NAMESTORE_ZoneIterator *list_it; - + /** * Private key for the zone */ @@ -205,7 +205,7 @@ struct RequestHandle /** * ID of a task associated with the resolution process. */ - struct GNUNET_SCHEDULER_Task * timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * The plugin result processor @@ -353,25 +353,25 @@ gnsrecord_to_json (const struct GNUNET_GNSRECORD_Data *rd) * Task run on shutdown. Cleans up everything. * * @param cls unused - * @param tc scheduler context */ static void -do_error (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_error (void *cls) { struct RequestHandle *handle = cls; struct MHD_Response *resp = GNUNET_REST_create_json_response (NULL); + handle->proc (handle->proc_cls, resp, MHD_HTTP_BAD_REQUEST); cleanup_handle (handle); } + static void -cleanup_handle_delayed (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_handle_delayed (void *cls) { cleanup_handle (cls); } + /** * Create a response with requested records * @@ -688,7 +688,7 @@ json_to_gnsrecord (const json_t *records_json, { (*rd)[i].expiration_time = etime_abs.abs_value_us; } - else + else { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Value `%s' invalid for record type `%s'\n"), value, typestring); @@ -760,7 +760,7 @@ namestore_create_cont (struct RestConnectionDataHandle *con, { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Name property is no string\n"); - GNUNET_REST_jsonapi_object_delete (json_obj); + GNUNET_REST_jsonapi_object_delete (json_obj); GNUNET_SCHEDULER_add_now (&do_error, handle); return; } @@ -844,7 +844,7 @@ namestore_zkey_cont (struct RestConnectionDataHandle *con, GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_NAMESTORE_ZKEY, strlen (GNUNET_REST_JSONAPI_NAMESTORE_ZKEY), &key); - if ( GNUNET_NO == + if ( GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->conndata_handle->url_param_map, &key) ) { @@ -1058,7 +1058,7 @@ testservice_id_task (void *cls, int result) GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_NAMESTORE_EGO, strlen (GNUNET_REST_JSONAPI_NAMESTORE_EGO), &key); - if ( GNUNET_YES == + if ( GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (handle->conndata_handle->url_param_map, &key) ) { @@ -1070,7 +1070,7 @@ testservice_id_task (void *cls, int result) GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_NAMESTORE_RECORD_TYPE, strlen (GNUNET_REST_JSONAPI_NAMESTORE_RECORD_TYPE), &key); - if ( GNUNET_YES == + if ( GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (handle->conndata_handle->url_param_map, &key) ) { diff --git a/src/namestore/test_namestore_api_lookup_nick.c b/src/namestore/test_namestore_api_lookup_nick.c index 804b6fc422..d6d3945b78 100644 --- a/src/namestore/test_namestore_api_lookup_nick.c +++ b/src/namestore/test_namestore_api_lookup_nick.c @@ -79,7 +79,7 @@ cleanup () * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { if (NULL != nsqe) { @@ -92,17 +92,19 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { cleanup (); res = 0; } -void lookup_it (void *cls, - const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, - const char *label, - unsigned int rd_count, - const struct GNUNET_GNSRECORD_Data *rd) + +static void +lookup_it (void *cls, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, + const char *label, + unsigned int rd_count, + const struct GNUNET_GNSRECORD_Data *rd) { nsqe = NULL; int c; diff --git a/src/namestore/test_namestore_api_lookup_private.c b/src/namestore/test_namestore_api_lookup_private.c index 6d99f738af..92b2cad6fd 100644 --- a/src/namestore/test_namestore_api_lookup_private.c +++ b/src/namestore/test_namestore_api_lookup_private.c @@ -74,7 +74,7 @@ cleanup () * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { if (NULL != nsqe) { @@ -87,17 +87,19 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { cleanup (); res = 0; } -void lookup_it (void *cls, - const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, - const char *label, - unsigned int rd_count, - const struct GNUNET_GNSRECORD_Data *rd) + +static void +lookup_it (void *cls, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, + const char *label, + unsigned int rd_count, + const struct GNUNET_GNSRECORD_Data *rd) { nsqe = NULL; diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c index ef63b94f1d..09d6b302d7 100644 --- a/src/namestore/test_namestore_api_lookup_public.c +++ b/src/namestore/test_namestore_api_lookup_public.c @@ -79,10 +79,9 @@ cleanup () * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { if (NULL != nsqe) { @@ -100,7 +99,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { cleanup (); res = 0; diff --git a/src/namestore/test_namestore_api_lookup_shadow.c b/src/namestore/test_namestore_api_lookup_shadow.c index b7f89c0ff5..7f9a907047 100644 --- a/src/namestore/test_namestore_api_lookup_shadow.c +++ b/src/namestore/test_namestore_api_lookup_shadow.c @@ -81,10 +81,9 @@ cleanup () * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { if (NULL != nsqe) { @@ -102,7 +101,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { cleanup (); res = 0; diff --git a/src/namestore/test_namestore_api_lookup_shadow_filter.c b/src/namestore/test_namestore_api_lookup_shadow_filter.c index fd3d573f66..a22baa17b4 100644 --- a/src/namestore/test_namestore_api_lookup_shadow_filter.c +++ b/src/namestore/test_namestore_api_lookup_shadow_filter.c @@ -94,10 +94,9 @@ cleanup () * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { if (NULL != delayed_lookup_task) { @@ -120,7 +119,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { cleanup (); res = 0; @@ -244,8 +243,9 @@ name_lookup_active_proc (void *cls, &pubkey, TEST_NAME, &rd_decrypt_cb, expected_rd)); } + static void -name_lookup_shadow (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +name_lookup_shadow (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Performing lookup for shadow record \n"); diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c index 85d1659b40..2ea271d50a 100644 --- a/src/namestore/test_namestore_api_monitoring.c +++ b/src/namestore/test_namestore_api_monitoring.c @@ -126,10 +126,9 @@ do_shutdown () * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { do_shutdown (); res = 1; @@ -137,7 +136,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { do_shutdown (); res = 0; diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c index cdf7fd80e2..eae10e2ae8 100644 --- a/src/namestore/test_namestore_api_monitoring_existing.c +++ b/src/namestore/test_namestore_api_monitoring_existing.c @@ -127,10 +127,9 @@ do_shutdown () * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { do_shutdown (); res = 1; @@ -138,7 +137,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { do_shutdown (); res = 0; @@ -152,8 +151,9 @@ zone_proc (void *cls, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) { - static int returned_records; - static int fail = GNUNET_NO; + static int returned_records; + static int fail = GNUNET_NO; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Comparing results name %s\n", name); diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index 35911e08fe..c6c439e866 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c @@ -71,10 +71,9 @@ cleanup () * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { if (NULL != nsqe) { @@ -87,7 +86,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { cleanup (); res = 0; diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c index ed7f7088ea..ef199cdf60 100644 --- a/src/namestore/test_namestore_api_remove_not_existing_record.c +++ b/src/namestore/test_namestore_api_remove_not_existing_record.c @@ -69,10 +69,9 @@ cleanup () * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { if (NULL != nsqe) { @@ -85,8 +84,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { cleanup (); res = 0; diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c index 7345e68da1..d806767701 100644 --- a/src/namestore/test_namestore_api_store.c +++ b/src/namestore/test_namestore_api_store.c @@ -69,10 +69,9 @@ cleanup () * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { if (NULL != nsqe) { @@ -85,7 +84,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { cleanup (); res = 0; diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c index 22508b1d35..ed5a399bd2 100644 --- a/src/namestore/test_namestore_api_store_update.c +++ b/src/namestore/test_namestore_api_store_update.c @@ -91,11 +91,9 @@ cleanup () * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -endbadly (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { if (NULL != nsqe) { @@ -113,8 +111,7 @@ endbadly (void *cls, static void -end (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { cleanup (); res = 0; diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c index 9f60fa43d2..070c068703 100644 --- a/src/namestore/test_namestore_api_zone_iteration.c +++ b/src/namestore/test_namestore_api_zone_iteration.c @@ -66,7 +66,7 @@ static char *directory; * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { if (NULL != zi) { @@ -110,7 +110,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { if (NULL != zi) { diff --git a/src/namestore/test_namestore_api_zone_iteration_nick.c b/src/namestore/test_namestore_api_zone_iteration_nick.c index 98d3b882c9..362533ef99 100644 --- a/src/namestore/test_namestore_api_zone_iteration_nick.c +++ b/src/namestore/test_namestore_api_zone_iteration_nick.c @@ -69,7 +69,7 @@ static char *directory; * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { if (NULL != zi) { @@ -113,7 +113,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { if (NULL != zi) { diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c index dc2129b88b..1a0279f502 100644 --- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c +++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c @@ -66,14 +66,13 @@ static char *directory; * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { - if (NULL != zi) - { - GNUNET_NAMESTORE_zone_iteration_stop (zi); - zi = NULL; - } - + if (NULL != zi) + { + GNUNET_NAMESTORE_zone_iteration_stop (zi); + zi = NULL; + } if (nsh != NULL) GNUNET_NAMESTORE_disconnect (nsh); nsh = NULL; @@ -110,13 +109,13 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { - if (NULL != zi) - { - GNUNET_NAMESTORE_zone_iteration_stop (zi); - zi = NULL; - } + if (NULL != zi) + { + GNUNET_NAMESTORE_zone_iteration_stop (zi); + zi = NULL; + } if (endbadly_task != NULL) { diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c index 8700c66981..52645b5eb9 100644 --- a/src/namestore/test_namestore_api_zone_iteration_stop.c +++ b/src/namestore/test_namestore_api_zone_iteration_stop.c @@ -63,16 +63,15 @@ static char *directory; * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { - if (NULL != zi) - { - GNUNET_NAMESTORE_zone_iteration_stop (zi); - zi = NULL; - } + if (NULL != zi) + { + GNUNET_NAMESTORE_zone_iteration_stop (zi); + zi = NULL; + } if (nsh != NULL) GNUNET_NAMESTORE_disconnect (nsh); @@ -110,13 +109,13 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { if (NULL != zi) - { - GNUNET_NAMESTORE_zone_iteration_stop (zi); - zi = NULL; - } + { + GNUNET_NAMESTORE_zone_iteration_stop (zi); + zi = NULL; + } if (endbadly_task != NULL) { diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c index 348b9178bc..12bc870b4c 100644 --- a/src/namestore/test_namestore_api_zone_to_name.c +++ b/src/namestore/test_namestore_api_zone_to_name.c @@ -63,10 +63,9 @@ static char *directory; * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { if (nsh != NULL) GNUNET_NAMESTORE_disconnect (nsh); @@ -79,7 +78,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { if (endbadly_task != NULL) { diff --git a/src/nat/gnunet-nat-server.c b/src/nat/gnunet-nat-server.c index 31a8f294bb..0069303ca9 100644 --- a/src/nat/gnunet-nat-server.c +++ b/src/nat/gnunet-nat-server.c @@ -92,13 +92,14 @@ struct TcpContext * (or once we failed to connect...). * * @param cls the 'struct TcpContext' - * @param tc scheduler context */ static void -tcp_send (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +tcp_send (void *cls) { struct TcpContext *ctx = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); if ((NULL != tc->write_ready) && (GNUNET_NETWORK_fdset_isset (tc->write_ready, ctx->s))) { @@ -228,10 +229,9 @@ test (void *cls, struct GNUNET_SERVER_Client *client, * Task run during shutdown. * * @param cls unused - * @param tc scheduler context */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { GNUNET_SERVER_destroy (server); server = NULL; diff --git a/src/nat/nat.c b/src/nat/nat.c index 57961ffafa..1c60e4e0d1 100644 --- a/src/nat/nat.c +++ b/src/nat/nat.c @@ -463,11 +463,9 @@ start_gnunet_nat_server (struct GNUNET_NAT_Handle *h); * Call task to process STUN * * @param cls handle to NAT - * @param tc TaskContext */ static void -process_stun (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +process_stun (void *cls); /** @@ -662,10 +660,9 @@ add_ip_to_address_list (struct GNUNET_NAT_Handle *h, * get DynDNS-IP addresses. * * @param cls the NAT handle - * @param tc scheduler context */ static void -resolve_dns (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +resolve_dns (void *cls); /** @@ -716,11 +713,9 @@ process_external_ip (void *cls, * Task to do a lookup on our hostname for IP addresses. * * @param cls the NAT handle - * @param tc scheduler context */ static void -resolve_hostname (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +resolve_hostname (void *cls); /** @@ -938,14 +933,15 @@ process_interfaces (void *cls, * after a certain delay. * * @param cls the `struct GNUNET_NAT_Handle` - * @param tc scheduler context */ static void -restart_nat_server (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +restart_nat_server (void *cls) { struct GNUNET_NAT_Handle *h = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; h->server_read_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; start_gnunet_nat_server (h); @@ -958,11 +954,9 @@ restart_nat_server (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * function to be called again once more is available. * * @param cls the NAT handle - * @param tc the scheduling context */ static void -nat_server_read (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +nat_server_read (void *cls) { struct GNUNET_NAT_Handle *h = cls; char mybuf[40]; @@ -971,8 +965,10 @@ nat_server_read (void *cls, int port; const char *port_start; struct sockaddr_in sin_addr; + const struct GNUNET_SCHEDULER_TaskContext *tc; h->server_read_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; memset (mybuf, 0, sizeof (mybuf)); @@ -1099,11 +1095,9 @@ start_gnunet_nat_server (struct GNUNET_NAT_Handle *h) * Task to scan the local network interfaces for IP addresses. * * @param cls the NAT handle - * @param tc scheduler context */ static void -list_interfaces (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +list_interfaces (void *cls) { struct GNUNET_NAT_Handle *h = cls; @@ -1209,11 +1203,9 @@ GNUNET_NAT_is_valid_stun_packet (void *cls, * Task to do a STUN request * * @param cls the NAT handle - * @param tc scheduler context */ static void -process_stun (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +process_stun (void *cls) { struct GNUNET_NAT_Handle *h = cls; struct StunServerList* elem = h->actual_stun_server; @@ -1264,11 +1256,9 @@ process_stun (void *cls, * Task to do a lookup on our hostname for IP addresses. * * @param cls the NAT handle - * @param tc scheduler context */ static void -resolve_hostname (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +resolve_hostname (void *cls) { struct GNUNET_NAT_Handle *h = cls; @@ -1285,11 +1275,9 @@ resolve_hostname (void *cls, * get DynDNS-IP addresses. * * @param cls the NAT handle - * @param tc scheduler context */ static void -resolve_dns (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +resolve_dns (void *cls) { struct GNUNET_NAT_Handle *h = cls; struct LocalAddressList *pos; diff --git a/src/nat/nat_auto.c b/src/nat/nat_auto.c index 9fab8bf675..82e067f733 100644 --- a/src/nat/nat_auto.c +++ b/src/nat/nat_auto.c @@ -258,18 +258,17 @@ stop_stun () * incoming connection. * * @param cls - * @param tc scheduler context */ static void -do_udp_read (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_udp_read (void *cls) { struct GNUNET_NAT_AutoHandle *ah = cls; unsigned char reply_buf[1024]; ssize_t rlen; struct sockaddr_in answer; + const struct GNUNET_SCHEDULER_TaskContext *tc; - + tc = GNUNET_SCHEDULER_get_task_context (); if ((0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) && (GNUNET_NETWORK_fdset_isset (tc->read_ready, lsock4))) @@ -402,11 +401,9 @@ result_callback (void *cls, * Main function for the connection reversal test. * * @param cls the `struct GNUNET_NAT_AutoHandle` - * @param tc scheduler context */ static void -reversal_test (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reversal_test (void *cls) { struct GNUNET_NAT_AutoHandle *ah = cls; diff --git a/src/nat/nat_mini.c b/src/nat/nat_mini.c index aa29ff07bc..d310b3e144 100644 --- a/src/nat/nat_mini.c +++ b/src/nat/nat_mini.c @@ -110,17 +110,17 @@ struct GNUNET_NAT_ExternalHandle * address and call our callback. * * @param cls the `struct GNUNET_NAT_ExternalHandle` - * @param tc scheduler context */ static void -read_external_ipv4 (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +read_external_ipv4 (void *cls) { struct GNUNET_NAT_ExternalHandle *eh = cls; ssize_t ret; struct in_addr addr; + const struct GNUNET_SCHEDULER_TaskContext *tc; eh->task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (GNUNET_YES == GNUNET_NETWORK_fdset_handle_isset (tc->read_ready, eh->r)) ret = GNUNET_DISK_file_read (eh->r, &eh->buf[eh->off], @@ -162,11 +162,9 @@ read_external_ipv4 (void *cls, * (Asynchronously) signal error invoking "external-ip" to client. * * @param cls the `struct GNUNET_NAT_ExternalHandle` (freed) - * @param tc scheduler context */ static void -signal_external_ip_error (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +signal_external_ip_error (void *cls) { struct GNUNET_NAT_ExternalHandle *eh = cls; @@ -329,10 +327,9 @@ struct GNUNET_NAT_MiniHandle * Run "upnpc -l" to find out if our mapping changed. * * @param cls the `struct GNUNET_NAT_MiniHandle` - * @param tc scheduler context */ static void -do_refresh (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +do_refresh (void *cls); /** @@ -478,10 +475,9 @@ process_refresh_output (void *cls, const char *line) * Run "upnpc -l" to find out if our mapping changed. * * @param cls the 'struct GNUNET_NAT_MiniHandle' - * @param tc scheduler context */ static void -do_refresh (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_refresh (void *cls) { struct GNUNET_NAT_MiniHandle *mini = cls; int ac; diff --git a/src/nat/nat_test.c b/src/nat/nat_test.c index 32cf6c42cd..33f81d8004 100644 --- a/src/nat/nat_test.c +++ b/src/nat/nat_test.c @@ -205,15 +205,15 @@ reversal_cb (void *cls, * incoming connection. * * @param cls the `struct GNUNET_NAT_Test` - * @param tc scheduler context */ static void -do_udp_read (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_udp_read (void *cls) { struct GNUNET_NAT_Test *tst = cls; uint16_t data; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); tst->ltask = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, tst->lsock, @@ -240,16 +240,16 @@ do_udp_read (void *cls, * incoming connection. * * @param cls the `struct NatActivity` - * @param tc scheduler context */ static void -do_read (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_read (void *cls) { struct NatActivity *na = cls; struct GNUNET_NAT_Test *tst; uint16_t data; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); na->rtask = NULL; tst = na->h; GNUNET_CONTAINER_DLL_remove (tst->na_head, tst->na_tail, na); @@ -277,17 +277,17 @@ do_read (void *cls, * incoming connection. * * @param cls the `struct GNUNET_NAT_Test` - * @param tc scheduler context */ static void -do_accept (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_accept (void *cls) { struct GNUNET_NAT_Test *tst = cls; struct GNUNET_NETWORK_Handle *s; struct NatActivity *wl; + const struct GNUNET_SCHEDULER_TaskContext *tc; tst->ltask = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; tst->ltask = @@ -378,11 +378,9 @@ addr_cb (void *cls, * Destroys the nat handle after the callback has been processed. * * @param cls handle to the timed out NAT test - * @param tc not used */ static void -do_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_timeout (void *cls) { struct GNUNET_NAT_Test *nh = cls; @@ -440,8 +438,8 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, nh->status = GNUNET_NAT_ERROR_SUCCESS; if (0 == bnd_port) { - nh->nat - = GNUNET_NAT_register (cfg, is_tcp, 0, 0, + nh->nat + = GNUNET_NAT_register (cfg, is_tcp, 0, 0, NULL, NULL, &addr_cb, &reversal_cb, nh, NULL); diff --git a/src/nat/test_nat.c b/src/nat/test_nat.c index de8ff8c13e..a840f3ef96 100644 --- a/src/nat/test_nat.c +++ b/src/nat/test_nat.c @@ -65,7 +65,7 @@ addr_callback (void *cls, int add_remove, const struct sockaddr *addr, * Function that terminates the test. */ static void -stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +stop (void *cls) { struct GNUNET_NAT_Handle *nat = cls; diff --git a/src/nat/test_nat_mini.c b/src/nat/test_nat_mini.c index 1819d5e91f..f5b63f6980 100644 --- a/src/nat/test_nat_mini.c +++ b/src/nat/test_nat_mini.c @@ -67,7 +67,7 @@ addr_callback (void *cls, int add_remove, * Function that terminates the test. */ static void -stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +stop (void *cls) { struct GNUNET_NAT_MiniHandle *mini = cls; diff --git a/src/nat/test_nat_test.c b/src/nat/test_nat_test.c index c0cce6e45b..402671bd2f 100644 --- a/src/nat/test_nat_test.c +++ b/src/nat/test_nat_test.c @@ -59,8 +59,7 @@ report_result (void *cls, static void -failed_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +failed_timeout (void *cls) { tsk = NULL; fprintf (stderr, @@ -86,7 +85,7 @@ run (void *cls, char *const *args, const char *cfgfile, 2), &failed_timeout, NULL); - + } @@ -127,7 +126,7 @@ main (int argc, char *const argv[]) "12345", NULL); GNUNET_assert (NULL != gns); GNUNET_PROGRAM_run (3, argv_prog, - "test-nat-test", "nohelp", + "test-nat-test", "nohelp", options, &run, NULL); GNUNET_break (0 == GNUNET_OS_process_kill (gns, GNUNET_TERM_SIG)); diff --git a/src/nat/test_stun.c b/src/nat/test_stun.c index a856fa9714..7fbba1cd6b 100644 --- a/src/nat/test_stun.c +++ b/src/nat/test_stun.c @@ -112,18 +112,18 @@ stop () * incoming connection. * * @param cls - * @param tc scheduler context */ static void -do_udp_read (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_udp_read (void *cls) { //struct GNUNET_NAT_Test *tst = cls; unsigned char reply_buf[1024]; ssize_t rlen; struct sockaddr_in answer; + const struct GNUNET_SCHEDULER_TaskContext *tc; ltask4 = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ( (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) || (! GNUNET_NETWORK_fdset_isset (tc->read_ready, lsock4)) ) diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c index 91ca97fbda..5b893ae474 100644 --- a/src/nse/gnunet-nse-profiler.c +++ b/src/nse/gnunet-nse-profiler.c @@ -265,10 +265,9 @@ close_monitor_connections () * Task run on shutdown; cleans up everything. * * @param cls unused - * @param tc unused */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { shutdown_task_id = NULL; if (GNUNET_YES == shutting_down) @@ -542,11 +541,9 @@ connect_nse_service () * Task that starts/stops peers to move to the next round. * * @param cls NULL, unused - * @param tc scheduler context (unused) */ static void -next_round (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +next_round (void *cls); /** @@ -555,12 +552,13 @@ next_round (void *cls, * the next round. * * @param cls unused, NULL - * @param tc unused */ static void -finish_round (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +finish_round (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; LOG (GNUNET_ERROR_TYPE_INFO, "Have %u connections\n", total_connections); @@ -670,12 +668,13 @@ adjust_running_peers () * peers; then get statistics from *all* peers. * * @param cls NULL, unused - * @param tc unused */ static void -next_round (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +next_round (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; LOG_DEBUG ("Disconnecting nse service of peers\n"); diff --git a/src/nse/gnunet-nse.c b/src/nse/gnunet-nse.c index 29f0003cb0..97c3da29b1 100644 --- a/src/nse/gnunet-nse.c +++ b/src/nse/gnunet-nse.c @@ -21,7 +21,7 @@ /** * @file nse/gnunet-nse.c * @brief Program to display network size estimates from the NSE service - * @author Sree Harsha Totakura <sreeharsha@totakura.in> + * @author Sree Harsha Totakura <sreeharsha@totakura.in> */ #include "platform.h" @@ -57,10 +57,9 @@ static int status; * Task to shutdown and clean up all state * * @param cls NULL - * @param tc the scheduler task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { shutdown_task = NULL; if (NULL != test) @@ -160,7 +159,7 @@ main (int argc, char *const *argv) static struct GNUNET_GETOPT_CommandLineOption options[] = { GNUNET_GETOPT_OPTION_END }; - + status = 1; if (GNUNET_OK != GNUNET_PROGRAM_run (argc, argv, "gnunet-nse", diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 12e4100d75..608274ae12 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c @@ -593,11 +593,9 @@ get_transmit_delay (int round_offset) * Task that triggers a NSE P2P transmission. * * @param cls the `struct NSEPeerEntry *` - * @param tc scheduler context */ static void -transmit_task_cb (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +transmit_task_cb (void *cls); /** @@ -673,11 +671,9 @@ transmit_ready (void *cls, * Task that triggers a NSE P2P transmission. * * @param cls the `struct NSEPeerEntry *` - * @param tc scheduler context */ static void -transmit_task_cb (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +transmit_task_cb (void *cls) { struct NSEPeerEntry *peer_entry = cls; @@ -797,16 +793,16 @@ schedule_current_round (void *cls, * Update our flood message to be sent (and our timestamps). * * @param cls unused - * @param tc context for this message */ static void -update_flood_message (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +update_flood_message (void *cls) { struct GNUNET_TIME_Relative offset; unsigned int i; + const struct GNUNET_SCHEDULER_TaskContext *tc; flood_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; offset = GNUNET_TIME_absolute_get_remaining (next_timestamp); @@ -918,11 +914,9 @@ write_proof () * Find our proof of work. * * @param cls closure (unused) - * @param tc task context */ static void -find_proof (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +find_proof (void *cls) { #define ROUND_SIZE 10 uint64_t counter; @@ -1343,11 +1337,9 @@ flush_comp_cb (void *cls, * 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) { if (NULL != flood_task) { diff --git a/src/nse/nse_api.c b/src/nse/nse_api.c index 2c12600472..a42dcb369d 100644 --- a/src/nse/nse_api.c +++ b/src/nse/nse_api.c @@ -81,10 +81,9 @@ struct GNUNET_NSE_Handle * Try again to connect to network size estimation service. * * @param cls the handle to the transport service - * @param tc scheduler context */ static void -reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +reconnect (void *cls); /** @@ -198,11 +197,9 @@ send_start (void *cls, size_t size, void *buf) * Try again to connect to network size estimation service. * * @param cls the `struct GNUNET_NSE_Handle *` - * @param tc scheduler context */ static void -reconnect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect (void *cls) { struct GNUNET_NSE_Handle *h = cls; diff --git a/src/nse/test_nse_api.c b/src/nse/test_nse_api.c index 9f3c85c5ce..22826b2981 100644 --- a/src/nse/test_nse_api.c +++ b/src/nse/test_nse_api.c @@ -36,10 +36,9 @@ static struct GNUNET_SCHEDULER_Task * die_task; * Signature of the main function of a task. * * @param cls closure - * @param tc context information (why was this task triggered now) */ static void -end_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_test (void *cls) { if (h != NULL) { diff --git a/src/nse/test_nse_multipeer.c b/src/nse/test_nse_multipeer.c index 549cbdf125..5e6c31e6c2 100644 --- a/src/nse/test_nse_multipeer.c +++ b/src/nse/test_nse_multipeer.c @@ -72,7 +72,7 @@ static int ok; * Task run on timeout to shut everything down. */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { unsigned int i; diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c index f2f1ad92a1..8cfb67a739 100644 --- a/src/peerinfo-tool/gnunet-peerinfo.c +++ b/src/peerinfo-tool/gnunet-peerinfo.c @@ -223,11 +223,9 @@ static struct GNUNET_HELLO_Message *my_hello; * runs the next requested function. * * @param cls unused - * @param tc unused */ static void -state_machine (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +state_machine (void *cls); /* ********************* 'get_info' ******************* */ @@ -620,11 +618,9 @@ parse_hello_uri (const char *put_uri) * runs the next requested function. * * @param cls unused - * @param tc scheduler context */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct PrintContext *pc; struct AddressRecord *ar; @@ -809,11 +805,9 @@ run (void *cls, * runs the next requested function. * * @param cls unused - * @param tc scheduler context */ static void -state_machine (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +state_machine (void *cls) { tt = NULL; diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index 456a3546b1..a0defb8ccd 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c @@ -651,15 +651,15 @@ hosts_directory_scan_callback (void *cls, * Call this method periodically to scan data/hosts for new hosts. * * @param cls unused - * @param tc scheduler context, aborted if reason is shutdown */ static void -cron_scan_directory_data_hosts (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cron_scan_directory_data_hosts (void *cls) { static unsigned int retries; struct DirScanContext dsc; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; if (GNUNET_SYSERR == GNUNET_DISK_directory_create (networkIdDirectory)) @@ -1041,14 +1041,14 @@ discard_hosts_helper (void *cls, * HELLOs to expire. * * @param cls unused - * @param tc scheduler context, aborted if reason is shutdown */ static void -cron_clean_data_hosts (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cron_clean_data_hosts (void *cls) { struct GNUNET_TIME_Absolute now; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; now = GNUNET_TIME_absolute_get (); @@ -1277,11 +1277,9 @@ free_host_entry (void *cls, * Clean up our state. Called during shutdown. * * @param cls unused - * @param tc scheduler task context, unused */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct NotificationContext *cur; struct NotificationContext *next; diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index c8b85e94c8..ad4576fc23 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c @@ -279,11 +279,9 @@ reconnect (struct GNUNET_PEERINFO_Handle *h); * Task scheduled to re-try connecting to the peerinfo service. * * @param cls the `struct GNUNET_PEERINFO_Handle *` - * @param tc scheduler context */ static void -reconnect_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect_task (void *cls) { struct GNUNET_PEERINFO_Handle *h = cls; @@ -698,11 +696,9 @@ iterator_start_receive (void *cls, * Peerinfo iteration request has timed out. * * @param cls the `struct GNUNET_PEERINFO_IteratorContext *` - * @param tc scheduler context */ static void -signal_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +signal_timeout (void *cls) { struct GNUNET_PEERINFO_IteratorContext *ic = cls; GNUNET_PEERINFO_Processor cb; diff --git a/src/peerinfo/peerinfo_api_notify.c b/src/peerinfo/peerinfo_api_notify.c index 1b0974631b..16331548d1 100644 --- a/src/peerinfo/peerinfo_api_notify.c +++ b/src/peerinfo/peerinfo_api_notify.c @@ -99,11 +99,10 @@ receive_notifications (struct GNUNET_PEERINFO_NotifyContext *nc); /** * Task to re-try connecting to peerinfo. * - * @param cls the 'struct GNUNET_PEERINFO_NotifyContext' - * @param tc scheduler context + * @param cls the `struct GNUNET_PEERINFO_NotifyContext *` */ static void -reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect (void *cls) { struct GNUNET_PEERINFO_NotifyContext *nc = cls; @@ -138,7 +137,7 @@ process_notification (void *cls, const struct GNUNET_MessageHeader *msg) if (msg == NULL) { GNUNET_CLIENT_disconnect (nc->client); - reconnect (nc, NULL); + reconnect (nc); return; } ms = ntohs (msg->size); diff --git a/src/peerinfo/test_peerinfo_api_notify_friend_only.c b/src/peerinfo/test_peerinfo_api_notify_friend_only.c index b3d5e4b6e7..d0322713c1 100644 --- a/src/peerinfo/test_peerinfo_api_notify_friend_only.c +++ b/src/peerinfo/test_peerinfo_api_notify_friend_only.c @@ -58,10 +58,10 @@ static int res_cb_wo_fo; struct GNUNET_PeerIdentity pid; -struct GNUNET_SCHEDULER_Task * timeout_task; +struct GNUNET_SCHEDULER_Task *timeout_task; static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { timeout_task = NULL; GNUNET_break(0); @@ -83,8 +83,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) global_ret = 255; } + static void -done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +done (void *cls) { if (NULL != pnc_w_fo) GNUNET_PEERINFO_notify_cancel (pnc_w_fo); diff --git a/src/peerstore/gnunet-peerstore.c b/src/peerstore/gnunet-peerstore.c index e274a1751c..68ae1746f2 100644 --- a/src/peerstore/gnunet-peerstore.c +++ b/src/peerstore/gnunet-peerstore.c @@ -32,16 +32,16 @@ static int ret; /* * Handle to PEERSTORE service */ -struct GNUNET_PEERSTORE_Handle *peerstore_handle; +static struct GNUNET_PEERSTORE_Handle *peerstore_handle; + /** * Run on shutdown * * @param cls unused - * @param tc scheduler context */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { if (NULL != peerstore_handle) { diff --git a/src/peerstore/gnunet-service-peerstore.c b/src/peerstore/gnunet-service-peerstore.c index f680c5d149..3a2d928e38 100644 --- a/src/peerstore/gnunet-service-peerstore.c +++ b/src/peerstore/gnunet-service-peerstore.c @@ -125,10 +125,9 @@ do_shutdown () * 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) { in_shutdown = GNUNET_YES; if (NULL == client_head) /* Only when no connected clients. */ @@ -145,11 +144,12 @@ expire_records_continuation (void *cls, int success); * Deletes any expired records from storage */ static void -cleanup_expired_records (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_expired_records (void *cls) { int ret; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_assert (NULL != db); diff --git a/src/peerstore/peerstore_api.c b/src/peerstore/peerstore_api.c index a792f37ffc..14117a333e 100644 --- a/src/peerstore/peerstore_api.c +++ b/src/peerstore/peerstore_api.c @@ -358,10 +358,9 @@ rewatch_it (void *cls, const struct GNUNET_HashCode *key, void *value) * Called when the iterate request is timedout * * @param cls a `struct GNUNET_PEERSTORE_IterateContext *` - * @param tc Scheduler task context (unused) */ static void -iterate_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +iterate_timeout (void *cls) { struct GNUNET_PEERSTORE_IterateContext *ic = cls; GNUNET_PEERSTORE_Processor callback; diff --git a/src/peerstore/test_peerstore_api_sync.c b/src/peerstore/test_peerstore_api_sync.c index ad113a7788..765ae91135 100644 --- a/src/peerstore/test_peerstore_api_sync.c +++ b/src/peerstore/test_peerstore_api_sync.c @@ -80,7 +80,7 @@ static const char *val = "test_peerstore_api_store_val"; * @return #GNUNET_YES (all good, continue) */ static int -iterate_cb (void *cls, +iterate_cb (void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg) { @@ -89,7 +89,7 @@ iterate_cb (void *cls, GNUNET_break (NULL == emsg); if (NULL == record) { - GNUNET_PEERSTORE_disconnect (h, + GNUNET_PEERSTORE_disconnect (h, GNUNET_NO); GNUNET_SCHEDULER_shutdown (); return GNUNET_YES; @@ -106,17 +106,15 @@ iterate_cb (void *cls, * data that should have been stored. * * @param cls NULL - * @param tc unused */ static void -test_cont (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +test_cont (void *cls) { h = GNUNET_PEERSTORE_connect (cfg); - GNUNET_PEERSTORE_iterate (h, - subsystem, + GNUNET_PEERSTORE_iterate (h, + subsystem, &pid, key, - GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_TIME_UNIT_FOREVER_REL, &iterate_cb, NULL); } @@ -128,15 +126,15 @@ static void test1 () { h = GNUNET_PEERSTORE_connect (cfg); - GNUNET_PEERSTORE_store (h, + GNUNET_PEERSTORE_store (h, subsystem, - &pid, - key, + &pid, + key, val, strlen (val) + 1, GNUNET_TIME_UNIT_FOREVER_ABS, - GNUNET_PEERSTORE_STOREOPTION_REPLACE, + GNUNET_PEERSTORE_STOREOPTION_REPLACE, NULL, NULL); - GNUNET_PEERSTORE_disconnect (h, + GNUNET_PEERSTORE_disconnect (h, GNUNET_YES); h = NULL; /* We need to wait a little bit to give the disconnect @@ -158,7 +156,7 @@ test1 () * @param peer handle to our peer (unused) */ static void -run (void *cls, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_TESTING_Peer *peer) { @@ -173,7 +171,7 @@ int main (int argc, char *argv[]) { if (0 != - GNUNET_TESTING_service_run ("test-gnunet-peerstore-sync", + GNUNET_TESTING_service_run ("test-gnunet-peerstore-sync", "peerstore", "test_peerstore_api_data.conf", &run, NULL)) diff --git a/src/pq/test_pq.c b/src/pq/test_pq.c index b8ffc6403f..49705103fb 100644 --- a/src/pq/test_pq.c +++ b/src/pq/test_pq.c @@ -102,8 +102,9 @@ run_queries (PGconn *conn) PGresult *result; int ret; struct GNUNET_CRYPTO_RsaPrivateKey *priv; - char msg[] = "Hello"; + const char msg[] = "hello"; void *msg2; + struct GNUNET_HashCode hmsg; size_t msg2_len; uint16_t u16; uint16_t u162; @@ -114,9 +115,9 @@ run_queries (PGconn *conn) priv = GNUNET_CRYPTO_rsa_private_key_create (1024); pub = GNUNET_CRYPTO_rsa_private_key_get_public (priv); - sig = GNUNET_CRYPTO_rsa_sign (priv, - msg, - sizeof (msg)); + memset (&hmsg, 42, sizeof (hmsg)); + sig = GNUNET_CRYPTO_rsa_sign_fdh (priv, + &hmsg); u16 = 16; u32 = 32; u64 = 64; diff --git a/src/psyc/gnunet-service-psyc.c b/src/psyc/gnunet-service-psyc.c index 38ec10e4d8..2b436aa214 100644 --- a/src/psyc/gnunet-service-psyc.c +++ b/src/psyc/gnunet-service-psyc.c @@ -428,10 +428,10 @@ message_queue_drop (struct Channel *chn); static void -schedule_transmit_message (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +schedule_transmit_message (void *cls) { struct Channel *chn = cls; + transmit_message (chn); } @@ -440,10 +440,9 @@ schedule_transmit_message (void *cls, * 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) { if (NULL != nc) { diff --git a/src/psyc/test_psyc.c b/src/psyc/test_psyc.c index 4aae5e122b..1169b49d5f 100644 --- a/src/psyc/test_psyc.c +++ b/src/psyc/test_psyc.c @@ -158,10 +158,9 @@ cleanup () * Terminate the test case (failure). * * @param cls NULL - * @param tc scheduler context */ -void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +static void +end_badly (void *cls) { res = 1; cleanup (); @@ -173,10 +172,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Terminate the test case (success). * * @param cls NULL - * @param tc scheduler context */ -void -end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +static void +end_normally (void *cls) { res = 0; cleanup (); @@ -545,8 +543,8 @@ master_history_replay_latest () } -void -transmit_resume (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +static void +transmit_resume (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmission resumed.\n"); struct TransmitClosure *tmit = cls; @@ -753,8 +751,8 @@ void first_slave_parted (void *cls) } -void -schedule_slave_part (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +static void +schedule_slave_part (void *cls) { GNUNET_PSYC_slave_part (slv, GNUNET_NO, first_slave_parted, NULL); } @@ -925,8 +923,9 @@ master_start () mst_chn = GNUNET_PSYC_master_get_channel (mst); } -void -schedule_master_start (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) + +static void +schedule_master_start (void *cls) { master_start (); } diff --git a/src/psycstore/gnunet-service-psycstore.c b/src/psycstore/gnunet-service-psycstore.c index ae108fc4d5..737cff4227 100644 --- a/src/psycstore/gnunet-service-psycstore.c +++ b/src/psycstore/gnunet-service-psycstore.c @@ -1,4 +1,4 @@ -/* +/** * This file is part of GNUnet * Copyright (C) 2013 GNUnet e.V. * @@ -68,10 +68,9 @@ static char *db_lib_name; * 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) { if (NULL != nc) { diff --git a/src/psycstore/psycstore_api.c b/src/psycstore/psycstore_api.c index b729d7440a..b8f00a41ce 100644 --- a/src/psycstore/psycstore_api.c +++ b/src/psycstore/psycstore_api.c @@ -186,10 +186,9 @@ find_op_by_id (struct GNUNET_PSYCSTORE_Handle *h, uint64_t op_id) * Try again to connect to the PSYCstore service. * * @param cls handle to the PSYCstore service. - * @param tc scheduler context */ static void -reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +reconnect (void *cls); /** @@ -531,10 +530,9 @@ transmit_next (struct GNUNET_PSYCSTORE_Handle *h) * Try again to connect to the PSYCstore service. * * @param cls Handle to the PSYCstore service. - * @param tc Scheduler context. */ static void -reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect (void *cls) { struct GNUNET_PSYCSTORE_Handle *h = cls; diff --git a/src/psycstore/test_psycstore.c b/src/psycstore/test_psycstore.c index b0ae3b924c..266ee5c1de 100644 --- a/src/psycstore/test_psycstore.c +++ b/src/psycstore/test_psycstore.c @@ -113,10 +113,9 @@ cleanup () * Terminate the testcase (failure). * * @param cls NULL - * @param tc scheduler context */ static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { res = 1; cleanup (); @@ -127,10 +126,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Terminate the testcase (success). * * @param cls NULL - * @param tc scheduler context */ static void -end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_normally (void *cls) { res = 0; cleanup (); diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c index c377c3f908..a86cbd3169 100644 --- a/src/pt/gnunet-daemon-pt.c +++ b/src/pt/gnunet-daemon-pt.c @@ -800,11 +800,9 @@ transmit_dns_request_to_cadet (void *cls, * Task run if the time to answer a DNS request via CADET is over. * * @param cls the `struct RequestContext` to abort - * @param tc scheduler context */ static void -timeout_request (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_request (void *cls) { struct RequestContext *rc = cls; struct CadetExit *exit = rc->exit; @@ -1023,11 +1021,9 @@ abort_all_requests (struct CadetExit *exit) * Function scheduled as very last function, cleans up after us * * @param cls closure, NULL - * @param tskctx scheduler context, unused */ static void -cleanup (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tskctx) +cleanup (void *cls) { struct CadetExit *exit; diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c index f1ddcddc23..c0d50d1771 100644 --- a/src/pt/test_gns_vpn.c +++ b/src/pt/test_gns_vpn.c @@ -140,8 +140,7 @@ mhd_ahc (void *cls, static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *c) +do_shutdown (void *cls) { if (mhd_task_id != NULL) { @@ -181,8 +180,7 @@ curl_main (void); static void -curl_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +curl_task (void *cls) { curl_task_id = NULL; curl_main (); @@ -264,7 +262,7 @@ curl_main () static void -start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +start_curl (void *cls) { GNUNET_asprintf (&url, "http://%s/hello_world", @@ -289,7 +287,7 @@ start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -disco_ns (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +disco_ns (void* cls) { GNUNET_NAMESTORE_disconnect (namestore); namestore = NULL; @@ -340,8 +338,7 @@ mhd_main (void); static void -mhd_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +mhd_task (void *cls) { mhd_task_id = NULL; MHD_run (mhd); diff --git a/src/pt/test_gnunet_vpn.c b/src/pt/test_gnunet_vpn.c index b5bc1395ba..85b28fbf85 100644 --- a/src/pt/test_gnunet_vpn.c +++ b/src/pt/test_gnunet_vpn.c @@ -171,8 +171,7 @@ do_shutdown () * Function to run the HTTP client. */ static void -curl_main (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +curl_main (void *cls) { fd_set rs; fd_set ws; @@ -304,7 +303,7 @@ mhd_main (void); static void -mhd_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +mhd_task (void *cls) { mhd_task_id = NULL; MHD_run (mhd); @@ -313,7 +312,7 @@ mhd_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -ctrl_c_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +ctrl_c_shutdown (void *cls) { ctrl_c_task_id = NULL; do_shutdown (); diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c index 2ff8ad0f24..1ff3b55e36 100644 --- a/src/regex/gnunet-daemon-regexprofiler.c +++ b/src/regex/gnunet-daemon-regexprofiler.c @@ -106,10 +106,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"); @@ -137,15 +136,16 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Announce a previously announced regex re-using cached data. * * @param cls Closure (regex to announce if needed). - * @param tc TaskContext. */ static void -reannounce_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +reannounce_regex (void *cls) { - struct GNUNET_TIME_Relative random_delay; char *regex = cls; + struct GNUNET_TIME_Relative random_delay; + const struct GNUNET_SCHEDULER_TaskContext *tc; reannounce_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { GNUNET_free (regex); diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c index 5fe6186cf3..5938c99b18 100644 --- a/src/regex/gnunet-regex-profiler.c +++ b/src/regex/gnunet-regex-profiler.c @@ -384,10 +384,9 @@ stats_connect_cb (void *cls, * Start announcing the next regex in the DHT. * * @param cls Index of the next peer in the peers array. - * @param tc TaskContext. */ static void -announce_next_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +announce_next_regex (void *cls); /******************************************************************************/ @@ -399,10 +398,9 @@ announce_next_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); * Shutdown nicely * * @param cls NULL - * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { struct RegexPeer *peer; unsigned int peer_cnt; @@ -471,10 +469,9 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * abort task to run on test timed out * * @param cls NULL - * @param tc the task context */ static void -do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_abort (void *cls) { unsigned long i = (unsigned long) cls; @@ -664,10 +661,9 @@ stats_connect_cb (void *cls, * profiler, when done. * * @param cls NULL - * @param tc the task context */ static void -do_collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_collect_stats (void *cls) { struct RegexPeer *peer = &peers[0]; @@ -694,10 +690,9 @@ do_collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Start searching for the next string in the DHT. * * @param cls Index of the next peer in the peers array. - * @param tc TaskContext. */ static void -find_string (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +find_string (void *cls); /** @@ -808,10 +803,9 @@ regex_found_handler (void *cls, * specified timeout 'search_timeout'. * * @param cls NULL - * @param tc the task context */ static void -search_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) +search_timed_out (void *cls) { unsigned int i; @@ -846,15 +840,15 @@ search_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) * but we should start another one. * * @param cls Index of the next peer in the peers array. - * @param tc TaskContext. */ static void -find_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +find_timed_out (void *cls) { struct RegexPeer *p = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; p->timeout = NULL; - + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; GNUNET_log (GNUNET_ERROR_TYPE_WARNING, @@ -870,13 +864,14 @@ find_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Start searching for a string in the DHT. * * @param cls Index of the next peer in the peers array. - * @param tc TaskContext. */ static void -find_string (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +find_string (void *cls) { unsigned int search_peer = (unsigned int) (long) cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) || search_peer >= num_peers || GNUNET_YES == in_shutdown) @@ -962,7 +957,7 @@ daemon_started (void *cls, struct GNUNET_TESTBED_Operation *op, * @param tc the task context */ static void -do_announce (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_announce (void *cls) { unsigned int i; @@ -982,13 +977,14 @@ do_announce (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Start announcing the next regex in the DHT. * * @param cls Closure (unused). - * @param tc TaskContext. */ static void -announce_next_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +announce_next_regex (void *cls) { struct RegexPeer *peer; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; if (next_search >= num_peers) diff --git a/src/regex/gnunet-regex-simulation-profiler.c b/src/regex/gnunet-regex-simulation-profiler.c index 04aa66b325..27dfa773d3 100644 --- a/src/regex/gnunet-regex-simulation-profiler.c +++ b/src/regex/gnunet-regex-simulation-profiler.c @@ -271,10 +271,9 @@ free_meter (struct ProgressMeter *meter) * Shutdown task. * * @param cls NULL - * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { shutdown_task = NULL; if (NULL != abort_task) @@ -292,10 +291,9 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * abort task to run on test timed out * * @param cls NULL - * @param tc the task context */ static void -do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_abort (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Aborting\n"); abort_task = NULL; @@ -564,10 +562,9 @@ policy_filename_cb (void *cls, const char *filename) * Iterate over files contained in policy_dir. * * @param cls NULL - * @param tc the task context */ static void -do_directory_scan (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_directory_scan (void *cls) { struct GNUNET_TIME_Absolute start_time; struct GNUNET_TIME_Relative duration; diff --git a/src/regex/gnunet-service-regex.c b/src/regex/gnunet-service-regex.c index 2150b09732..a708765343 100644 --- a/src/regex/gnunet-service-regex.c +++ b/src/regex/gnunet-service-regex.c @@ -152,11 +152,9 @@ handle_client_disconnect (void *cls, * Task run during shutdown. * * @param cls unused - * @param tc unused */ static void -cleanup_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_task (void *cls) { struct ClientEntry *ce; @@ -177,13 +175,11 @@ cleanup_task (void *cls, /** * Periodic task to refresh our announcement of the regex. * - * @param cls the 'struct ClientEntry' of the client that triggered the + * @param cls the `struct ClientEntry *` of the client that triggered the * announcement - * @param tc scheduler context */ static void -reannounce (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reannounce (void *cls) { struct ClientEntry *ce = cls; diff --git a/src/regex/test_regex_api.c b/src/regex/test_regex_api.c index ab387d7553..01f455854d 100644 --- a/src/regex/test_regex_api.c +++ b/src/regex/test_regex_api.c @@ -45,12 +45,11 @@ static struct GNUNET_REGEX_Search *s; static int ok = 1; -static struct GNUNET_SCHEDULER_Task * die_task; +static struct GNUNET_SCHEDULER_Task *die_task; static void -end (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { die_task = NULL; GNUNET_REGEX_announce_cancel (a); diff --git a/src/regex/test_regex_integration.c b/src/regex/test_regex_integration.c index 453500fa16..d98d800709 100644 --- a/src/regex/test_regex_integration.c +++ b/src/regex/test_regex_integration.c @@ -57,8 +57,7 @@ static struct GNUNET_SCHEDULER_Task *die_task; static void -end (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { die_task = NULL; GNUNET_REGEX_announce_cancel (a4); @@ -77,7 +76,7 @@ static void end_badly () { FPRINTF (stderr, "%s", "Testcase failed (timeout).\n"); - end (NULL, NULL); + end (NULL); ok = 1; } diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c index fdba7fcc4a..705fcbeb39 100644 --- a/src/rest/gnunet-rest-server.c +++ b/src/rest/gnunet-rest-server.c @@ -119,7 +119,7 @@ static char* allow_origin; static char* allow_headers; /** - * MHD Connection handle + * MHD Connection handle */ struct MhdConnectionHandle { @@ -143,11 +143,9 @@ struct MhdConnectionHandle * Task run whenever HTTP server operations are pending. * * @param cls NULL - * @param tc sched context */ static void -do_httpd (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +do_httpd (void *cls); /** @@ -179,7 +177,7 @@ plugin_callback (void *cls, struct MhdConnectionHandle *handle = cls; handle->status = status; handle->response = resp; - run_mhd_now(); + run_mhd_now(); } @@ -222,7 +220,7 @@ url_iterator (void *cls, struct RestConnectionDataHandle *handle = cls; struct GNUNET_HashCode hkey; char *val; - + GNUNET_CRYPTO_hash (key, strlen (key), &hkey); GNUNET_asprintf (&val, "%s", value); if (GNUNET_OK != @@ -394,7 +392,7 @@ kill_httpd () httpd = NULL; } if (NULL != httpd_task) - { + { GNUNET_SCHEDULER_cancel (httpd_task); httpd_task = NULL; } @@ -405,11 +403,9 @@ kill_httpd () * Task run whenever HTTP server is idle for too long. Kill it. * * @param cls NULL - * @param tc sched context */ static void -kill_httpd_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +kill_httpd_task (void *cls) { httpd_task = NULL; kill_httpd (); @@ -482,11 +478,9 @@ schedule_httpd () * Task run whenever HTTP server operations are pending. * * @param cls NULL - * @param tc scheduler context */ static void -do_httpd (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_httpd (void *cls) { httpd_task = NULL; MHD_run (httpd); @@ -501,10 +495,10 @@ do_httpd (void *cls, * @param tc the scheduler context */ static void -do_accept (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_accept (void *cls) { struct GNUNET_NETWORK_Handle *lsock = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; struct GNUNET_NETWORK_Handle *s; int fd; const struct sockaddr *addr; @@ -514,8 +508,9 @@ do_accept (void *cls, ltask4 = NULL; else ltask6 = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) - return; + return; if (lsock == lsock4) ltask4 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, lsock, @@ -550,11 +545,9 @@ do_accept (void *cls, * Task run on shutdown * * @param cls closure - * @param tc task context */ static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down...\n"); @@ -581,7 +574,7 @@ bind_v4 () sa4.sin_port = htons (port); #if HAVE_SOCKADDR_IN_SIN_LEN sa4.sin_len = sizeof (sa4); -#endif +#endif ls = GNUNET_NETWORK_socket_create (AF_INET, SOCK_STREAM, 0); @@ -617,7 +610,7 @@ bind_v6 () sa6.sin6_port = htons (port); #if HAVE_SOCKADDR_IN_SIN_LEN sa6.sin6_len = sizeof (sa6); -#endif +#endif ls = GNUNET_NETWORK_socket_create (AF_INET6, SOCK_STREAM, 0); @@ -685,8 +678,8 @@ load_plugin (void *cls, * @param c configuration */ static void -run (void *cls, - char *const *args, +run (void *cls, + char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) { @@ -756,7 +749,7 @@ run (void *cls, { GNUNET_SCHEDULER_shutdown (); return; - } + } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service listens on port %u\n", port); diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index 86e5c017da..f68c18aa4f 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c @@ -84,11 +84,9 @@ static unsigned long long matching_bits; * Function run if the user aborts with CTRL-C. * * @param cls closure - * @param tc scheduler context */ static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != el) { @@ -231,15 +229,15 @@ perform_revocation (const struct RevocationData *rd) * Perform the proof-of-work calculation. * * @param cls the `struct RevocationData` - * @param tc scheduler context */ static void -calculate_pow (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +calculate_pow (void *cls) { struct RevocationData *rd = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; /* store temporary results */ + tc = GNUNET_SCHEDULER_get_task_context (); if ( (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) || (0 == (rd->pow % 128) ) ) { diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index 9cf1bb8121..e41195d559 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c @@ -521,11 +521,9 @@ add_revocation (void *cls, * run the set operation on the revocation certificates. * * @param cls NULL - * @param tc scheduler context (unused) */ static void -transmit_task_cb (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +transmit_task_cb (void *cls) { struct PeerEntry *peer_entry = cls; @@ -662,11 +660,9 @@ free_entry (void *cls, * 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) { if (NULL != revocation_set) { diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c index e9836cc5a0..6d6db1b5c9 100644 --- a/src/revocation/test_revocation.c +++ b/src/revocation/test_revocation.c @@ -57,8 +57,7 @@ static int ok; static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { unsigned int c; @@ -94,8 +93,7 @@ do_shutdown (void *cls, static void -check_revocation (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +check_revocation (void *cls); static void @@ -128,8 +126,7 @@ revocation_remote_cb (void *cls, static void -check_revocation (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +check_revocation (void *cls) { GNUNET_REVOCATION_query (testpeers[0].cfg, &testpeers[1].pubkey, @@ -146,7 +143,7 @@ revocation_cb (void *cls, { fprintf (stderr, "Revocation successful\n"); - check_revocation (NULL, NULL); + check_revocation (NULL); } } diff --git a/src/rps/gnunet-rps.c b/src/rps/gnunet-rps.c index 23516b626c..01be2aeb3c 100644 --- a/src/rps/gnunet-rps.c +++ b/src/rps/gnunet-rps.c @@ -92,11 +92,9 @@ GNUNET_GETOPT_set_peerid (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, * Cancels pending request and disconnects. * * @param cls NULL - * @param tc scheduler context */ static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { shutdown_task = NULL; if (NULL != req_handle) diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index e3ddb4bff0..af06cf1bdf 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -1482,10 +1482,10 @@ send_push (const struct GNUNET_PeerIdentity *peer_id) static void -do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +do_round (void *cls); static void -do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +do_mal_round (void *cls); #ifdef ENABLE_MALICIOUS @@ -1624,7 +1624,7 @@ handle_client_act_malicious (void *cls, * This is executed regylary. */ static void -do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_mal_round (void *cls) { uint32_t num_pushes; uint32_t i; @@ -1756,7 +1756,7 @@ do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * This is executed regylary. */ static void -do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_round (void *cls) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Going to execute next round.\n"); @@ -2032,11 +2032,9 @@ process_peerinfo_peers (void *cls, * 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) { LOG (GNUNET_ERROR_TYPE_DEBUG, "RPS is going down\n"); diff --git a/src/rps/gnunet-service-rps_sampler.c b/src/rps/gnunet-service-rps_sampler.c index b65dd7c47f..e5f6595bbb 100644 --- a/src/rps/gnunet-service-rps_sampler.c +++ b/src/rps/gnunet-service-rps_sampler.c @@ -107,8 +107,7 @@ struct GetPeerCls * Sampler. */ typedef void -(*RPS_get_peers_type) (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +(*RPS_get_peers_type) (void *cls); /** * Get one random peer out of the sampled peers. @@ -118,8 +117,8 @@ typedef void * Only used internally */ static void -sampler_get_rand_peer (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +sampler_get_rand_peer (void *cls); + /** * Get one random peer out of the sampled peers. @@ -128,8 +127,7 @@ sampler_get_rand_peer (void *cls, * corrsponding peer to the client. */ static void -sampler_mod_get_rand_peer (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +sampler_mod_get_rand_peer (void *cls); /** @@ -530,14 +528,15 @@ RPS_sampler_reinitialise_by_value (struct RPS_Sampler *sampler, * Only used internally */ static void -sampler_get_rand_peer (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +sampler_get_rand_peer (void *cls) { struct GetPeerCls *gpc = cls; uint32_t r_index; struct RPS_Sampler *sampler; + const struct GNUNET_SCHEDULER_TaskContext *tc; gpc->get_peer_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; sampler = gpc->req_handle->sampler; @@ -583,15 +582,16 @@ sampler_get_rand_peer (void *cls, * corrsponding peer to the client. */ static void -sampler_mod_get_rand_peer (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +sampler_mod_get_rand_peer (void *cls) { struct GetPeerCls *gpc = cls; struct RPS_SamplerElement *s_elem; struct GNUNET_TIME_Relative last_request_diff; struct RPS_Sampler *sampler; + const struct GNUNET_SCHEDULER_TaskContext *tc; gpc->get_peer_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; sampler = gpc->req_handle->sampler; diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index 63eb8417a7..aca58d55e2 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c @@ -430,7 +430,7 @@ tofile_ (const char *file_name, char *line) /** - * Write the ids and their according index in the given array to a file + * Write the ids and their according index in the given array to a file * Unused */ /* static void @@ -493,7 +493,7 @@ make_oplist_entry () * Task run on timeout to shut everything down. */ static void -shutdown_op (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_op (void *cls) { unsigned int i; @@ -513,11 +513,11 @@ shutdown_op (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /** * Seed peers. */ - void -seed_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +static void +seed_peers (void *cls) { + struct RPSPeer *peer = cls; unsigned int amount; - struct RPSPeer *peer = (struct RPSPeer *) cls; unsigned int i; // TODO if malicious don't seed mal peers @@ -532,13 +532,14 @@ seed_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_RPS_seed_ids (peer->rps_handle, amount, rps_peer_ids); } + /** * Seed peers. */ - void -seed_peers_big (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +static void +seed_peers_big (void *cls) { - struct RPSPeer *peer = (struct RPSPeer *) cls; + struct RPSPeer *peer = cls; unsigned int seed_msg_size; uint32_t num_peers_max; unsigned int amount; @@ -740,7 +741,7 @@ default_reply_handle (void *cls, "[%s] got %" PRIu64 " peers:\n", GNUNET_i2s (rps_peer->peer_id), n); - + for (i = 0; i < n; i++) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -762,11 +763,10 @@ default_reply_handle (void *cls, * Request random peers. */ static void -request_peers (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +request_peers (void *cls) { + struct PendingRequest *pending_req = cls; struct RPSPeer *rps_peer; - struct PendingRequest *pending_req = (struct PendingRequest *) cls; struct PendingReply *pending_rep; if (GNUNET_YES == in_shutdown) @@ -827,11 +827,10 @@ cancel_request (struct PendingReply *pending_rep) * Cancel a request. */ static void -cancel_request_cb (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cancel_request_cb (void *cls) { + struct RPSPeer *rps_peer = cls; struct PendingReply *pending_rep; - struct RPSPeer *rps_peer = (struct RPSPeer *) cls; if (GNUNET_YES == in_shutdown) return; @@ -1137,8 +1136,9 @@ manage_service_wrapper (unsigned int i, unsigned int j, int delta, } } + static void -churn (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +churn (void *cls) { unsigned int i; unsigned int j; diff --git a/src/scalarproduct/gnunet-scalarproduct.c b/src/scalarproduct/gnunet-scalarproduct.c index 864e77a698..5811ee57b2 100644 --- a/src/scalarproduct/gnunet-scalarproduct.c +++ b/src/scalarproduct/gnunet-scalarproduct.c @@ -184,8 +184,7 @@ requester_callback (void *cls, * @param tc unused */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { if (NULL != computation) { diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c index f619f971b1..c22b4e09e4 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c +++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c @@ -1092,8 +1092,7 @@ GSS_handle_alice_client_message (void *cls, * @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, initiating cleanup.\n"); diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c index c17aea9999..41cf7d1a81 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c +++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c @@ -1137,11 +1137,9 @@ GSS_handle_bob_client_message (void *cls, * 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, initiating cleanup.\n"); diff --git a/src/scalarproduct/gnunet-service-scalarproduct_alice.c b/src/scalarproduct/gnunet-service-scalarproduct_alice.c index ab66b8b519..0b7ba00d57 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct_alice.c +++ b/src/scalarproduct/gnunet-service-scalarproduct_alice.c @@ -1313,11 +1313,9 @@ GSS_handle_alice_client_message (void *cls, * 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, initiating cleanup.\n"); diff --git a/src/scalarproduct/gnunet-service-scalarproduct_bob.c b/src/scalarproduct/gnunet-service-scalarproduct_bob.c index a75f0a6718..c9db1e9ae9 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct_bob.c +++ b/src/scalarproduct/gnunet-service-scalarproduct_bob.c @@ -1433,11 +1433,9 @@ GSS_handle_bob_client_message (void *cls, * 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, initiating cleanup.\n"); diff --git a/src/secretsharing/gnunet-secretsharing-profiler.c b/src/secretsharing/gnunet-secretsharing-profiler.c index 6d1eea198e..917431df46 100644 --- a/src/secretsharing/gnunet-secretsharing-profiler.c +++ b/src/secretsharing/gnunet-secretsharing-profiler.c @@ -480,11 +480,9 @@ peer_info_cb (void *cb_cls, * Signature of the main function of a task. * * @param cls closure - * @param tc context information (why was this task triggered now) */ static void -handle_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +handle_shutdown (void *cls) { in_shutdown = GNUNET_YES; @@ -633,4 +631,3 @@ main (int argc, char **argv) options, &run, NULL, GNUNET_YES); return 0; } - diff --git a/src/secretsharing/gnunet-service-secretsharing.c b/src/secretsharing/gnunet-service-secretsharing.c index 81714d279f..6babe209ac 100644 --- a/src/secretsharing/gnunet-service-secretsharing.c +++ b/src/secretsharing/gnunet-service-secretsharing.c @@ -703,7 +703,7 @@ keygen_session_destroy (struct KeygenSession *ks) * @param tc unused */ static void -cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_task (void *cls) { while (NULL != decrypt_sessions_head) decrypt_session_destroy (decrypt_sessions_head); @@ -2274,4 +2274,3 @@ main (int argc, char *const *argv) GNUNET_SERVICE_run (argc, argv, "secretsharing", GNUNET_SERVICE_OPTION_NONE, &run, NULL)) ? 0 : 1; } - diff --git a/src/secretsharing/test_secretsharing_api.c b/src/secretsharing/test_secretsharing_api.c index fbf7681a14..5057d5c335 100644 --- a/src/secretsharing/test_secretsharing_api.c +++ b/src/secretsharing/test_secretsharing_api.c @@ -47,9 +47,9 @@ static void secret_ready_cb (void *cls, GNUNET_SCHEDULER_shutdown (); } + static void -handle_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext * tc) +handle_shutdown (void *cls) { if (NULL != keygen) { @@ -58,12 +58,13 @@ handle_shutdown (void *cls, } } + static void run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { - struct GNUNET_HashCode session_id; + struct GNUNET_HashCode session_id; struct GNUNET_TIME_Absolute start; struct GNUNET_TIME_Absolute deadline; @@ -100,4 +101,3 @@ main (int argc, char **argv) return ret; return (GNUNET_YES == success) ? 0 : 1; } - diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c index 4b65fd7372..e9555928a2 100644 --- a/src/set/gnunet-service-set.c +++ b/src/set/gnunet-service-set.c @@ -1713,8 +1713,7 @@ handle_client_accept (void *cls, * @param tc context information (why was this task triggered now) */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { while (NULL != incoming_head) incoming_destroy (incoming_head); @@ -1747,13 +1746,14 @@ shutdown_task (void *cls, * @param tc context information (why was this task triggered now) */ static void -incoming_timeout_cb (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +incoming_timeout_cb (void *cls) { struct Operation *incoming = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; incoming->timeout_task = NULL; GNUNET_assert (GNUNET_YES == incoming->is_incoming); + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, diff --git a/src/set/gnunet-set-profiler.c b/src/set/gnunet-set-profiler.c index 0586b8b3d1..ff76b27ce3 100644 --- a/src/set/gnunet-set-profiler.c +++ b/src/set/gnunet-set-profiler.c @@ -247,8 +247,7 @@ set_insert_iterator (void *cls, static void -handle_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +handle_shutdown (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down set profiler\n"); @@ -393,4 +392,3 @@ main (int argc, char **argv) options, &pre_run, NULL, GNUNET_YES); return ret; } - diff --git a/src/set/set_api.c b/src/set/set_api.c index 503c0c9c28..7721402698 100644 --- a/src/set/set_api.c +++ b/src/set/set_api.c @@ -275,12 +275,12 @@ handle_copy_lazy (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, "Handling response to lazy copy\n"); - + GNUNET_CONTAINER_DLL_remove (set->copy_req_head, set->copy_req_tail, req); - + // We pass none as operation here, since it doesn't matter when // cloning. new_set = create_internal (set->cfg, GNUNET_SET_OPERATION_NONE, &msg->cookie); @@ -790,11 +790,9 @@ GNUNET_SET_prepare (const struct GNUNET_PeerIdentity *other_peer, * Connect to the set service in order to listen for requests. * * @param cls the `struct GNUNET_SET_ListenHandle *` to connect - * @param tc task context if invoked as a task, NULL otherwise */ static void -listen_connect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +listen_connect (void *cls); /** @@ -882,11 +880,9 @@ handle_client_listener_error (void *cls, * Connect to the set service in order to listen for requests. * * @param cls the `struct GNUNET_SET_ListenHandle *` to connect - * @param tc task context if invoked as a task, NULL otherwise */ static void -listen_connect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +listen_connect (void *cls) { static const struct GNUNET_MQ_MessageHandler mq_handlers[] = { { &handle_request, GNUNET_MESSAGE_TYPE_SET_REQUEST }, @@ -895,9 +891,10 @@ listen_connect (void *cls, struct GNUNET_SET_ListenHandle *lh = cls; struct GNUNET_MQ_Envelope *mqm; struct GNUNET_SET_ListenMessage *msg; + const struct GNUNET_SCHEDULER_TaskContext *tc; - if ( (NULL != tc) && - (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) ) + tc = GNUNET_SCHEDULER_get_task_context (); + if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Listener not reconnecting due to shutdown\n"); @@ -947,7 +944,7 @@ GNUNET_SET_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, lh->operation = operation; lh->app_id = *app_id; lh->reconnect_backoff = GNUNET_TIME_UNIT_MILLISECONDS; - listen_connect (lh, NULL); + listen_connect (lh); if (NULL == lh->client) { GNUNET_free (lh); diff --git a/src/set/test_set_api.c b/src/set/test_set_api.c index fbb3032576..b5c21f8a34 100644 --- a/src/set/test_set_api.c +++ b/src/set/test_set_api.c @@ -246,12 +246,13 @@ test_iter () * Signature of the main function of a task. * * @param cls closure - * @param tc context information (why was this task triggered now) */ static void -timeout_fail (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_fail (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_SCHEDULER_shutdown (); @@ -316,4 +317,3 @@ main (int argc, char **argv) } return ret; } - diff --git a/src/set/test_set_union_copy.c b/src/set/test_set_union_copy.c index 247d91498d..fdf6bf9df3 100644 --- a/src/set/test_set_union_copy.c +++ b/src/set/test_set_union_copy.c @@ -73,12 +73,13 @@ remove_element_str (struct GNUNET_SET_Handle *set, char *str) * Signature of the main function of a task. * * @param cls closure - * @param tc context information (why was this task triggered now) */ static void -timeout_fail (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_fail (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_SCHEDULER_shutdown (); diff --git a/src/set/test_set_union_result_symmetric.c b/src/set/test_set_union_result_symmetric.c index 9a49abaf01..b312bcb4c2 100644 --- a/src/set/test_set_union_result_symmetric.c +++ b/src/set/test_set_union_result_symmetric.c @@ -293,12 +293,13 @@ test_iter () * Signature of the main function of a task. * * @param cls closure - * @param tc context information (why was this task triggered now) */ static void -timeout_fail (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_fail (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_SCHEDULER_shutdown (); diff --git a/src/social/gnunet-service-social.c b/src/social/gnunet-service-social.c index 98b1d4b595..1746a82ca5 100644 --- a/src/social/gnunet-service-social.c +++ b/src/social/gnunet-service-social.c @@ -421,8 +421,10 @@ psyc_transmit_queue_message (struct Place *plc, struct MessageTransmitQueue *tmit_msg); -int -place_entry_cleanup (void *cls, const struct GNUNET_HashCode *key, void *value) +static int +place_entry_cleanup (void *cls, + const struct GNUNET_HashCode *key, + void *value) { cleanup_place (value); return GNUNET_YES; @@ -433,10 +435,9 @@ place_entry_cleanup (void *cls, const struct GNUNET_HashCode *key, void *value) * 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_CONTAINER_multihashmap_iterate (hosts, place_entry_cleanup, NULL); GNUNET_CONTAINER_multihashmap_iterate (guests, place_entry_cleanup, NULL); @@ -541,7 +542,7 @@ cleanup_place (struct Place *plc) static void -schedule_cleanup_place (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +schedule_cleanup_place (void *cls) { cleanup_place (cls); } diff --git a/src/social/test_social.c b/src/social/test_social.c index 1d2673a11f..5eeb20196f 100644 --- a/src/social/test_social.c +++ b/src/social/test_social.c @@ -149,7 +149,8 @@ enum static void -schedule_guest_leave (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +schedule_guest_leave (void *cls); + static void host_answer_door (void *cls, @@ -229,10 +230,9 @@ cleanup () * Terminate the test case (failure). * * @param cls NULL - * @param tc scheduler context */ static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { res = 1; cleanup (); @@ -244,10 +244,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Terminate the test case (success). * * @param cls NULL - * @param tc scheduler context */ static void -end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_normally (void *cls) { res = 0; cleanup (); @@ -274,7 +273,7 @@ end () static void -transmit_resume (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +transmit_resume (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmission resumed.\n"); struct TransmitClosure *tmit = cls; @@ -342,7 +341,7 @@ host_left () static void -schedule_host_leave (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +schedule_host_leave (void *cls) { test = TEST_HOST_LEAVE; GNUNET_SOCIAL_host_leave (hst, NULL, &host_left, NULL); @@ -478,7 +477,7 @@ app_recv_ego (void *cls, static void -schedule_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +schedule_reconnect (void *cls) { test = TEST_RECONNECT; @@ -577,7 +576,7 @@ guest_leave() static void -schedule_guest_leave (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +schedule_guest_leave (void *cls) { guest_leave (); } diff --git a/src/statistics/gnunet-service-statistics.c b/src/statistics/gnunet-service-statistics.c index 3aa3d58971..0126f149b4 100644 --- a/src/statistics/gnunet-service-statistics.c +++ b/src/statistics/gnunet-service-statistics.c @@ -967,11 +967,9 @@ do_shutdown () * 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) { in_shutdown = GNUNET_YES; if (0 != client_count) diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c index ff1ec39a0e..2bf5959e32 100644 --- a/src/statistics/gnunet-statistics.c +++ b/src/statistics/gnunet-statistics.c @@ -158,11 +158,9 @@ cleanup (void *cls, int success) * Function run on shutdown to clean up. * * @param cls the statistics handle - * @param tc scheduler context */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct GNUNET_STATISTICS_Handle *h = cls; @@ -185,8 +183,7 @@ shutdown_task (void *cls, * @param tc schedueler context */ static void -main_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +main_task (void *cls) { const struct GNUNET_CONFIGURATION_Handle *cfg = cls; struct GNUNET_STATISTICS_Handle *h; diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c index 1592483f86..2b491df72e 100644 --- a/src/statistics/statistics_api.c +++ b/src/statistics/statistics_api.c @@ -462,11 +462,9 @@ try_connect (struct GNUNET_STATISTICS_Handle *h) * We've waited long enough, reconnect now. * * @param cls the `struct GNUNET_STATISTICS_Handle` to reconnect - * @param tc scheduler context (unused) */ static void -reconnect_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect_task (void *cls) { struct GNUNET_STATISTICS_Handle *h = cls; @@ -479,11 +477,9 @@ reconnect_task (void *cls, * Task used by 'reconnect_later' to shutdown the handle * * @param cls the statistics handle - * @param tc scheduler context */ static void -do_destroy (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_destroy (void *cls) { struct GNUNET_STATISTICS_Handle *h = cls; @@ -627,11 +623,9 @@ process_watch_value (struct GNUNET_STATISTICS_Handle *h, * Task used to destroy the statistics handle. * * @param cls the `struct GNUNET_STATISTICS_Handle` - * @param tc the scheduler context */ static void -destroy_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +destroy_task (void *cls) { struct GNUNET_STATISTICS_Handle *h = cls; @@ -1159,11 +1153,9 @@ schedule_action (struct GNUNET_STATISTICS_Handle *h) * call the continuation. * * @param cls the `struct GNUNET_STATISTICS_GetHandle` - * @param tc scheduler context */ static void -run_get_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +run_get_timeout (void *cls) { struct GNUNET_STATISTICS_GetHandle *gh = cls; GNUNET_STATISTICS_Callback cont = gh->cont; diff --git a/src/statistics/test_statistics_api_watch.c b/src/statistics/test_statistics_api_watch.c index defa20a077..c7fe54b1fd 100644 --- a/src/statistics/test_statistics_api_watch.c +++ b/src/statistics/test_statistics_api_watch.c @@ -33,11 +33,11 @@ static struct GNUNET_STATISTICS_Handle *h; static struct GNUNET_STATISTICS_Handle *h2; -static struct GNUNET_SCHEDULER_Task * shutdown_task; +static struct GNUNET_SCHEDULER_Task *shutdown_task; static void -force_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +force_shutdown (void *cls) { fprintf (stderr, "Timeout, failed to receive notifications: %d\n", ok); GNUNET_STATISTICS_destroy (h, GNUNET_NO); @@ -47,7 +47,7 @@ force_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -normal_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +normal_shutdown (void *cls) { GNUNET_STATISTICS_destroy (h, GNUNET_NO); GNUNET_STATISTICS_destroy (h2, GNUNET_NO); diff --git a/src/statistics/test_statistics_api_watch_zero_value.c b/src/statistics/test_statistics_api_watch_zero_value.c index edfc9f85c5..8bf656ed05 100644 --- a/src/statistics/test_statistics_api_watch_zero_value.c +++ b/src/statistics/test_statistics_api_watch_zero_value.c @@ -33,11 +33,11 @@ static struct GNUNET_STATISTICS_Handle *h; static struct GNUNET_STATISTICS_Handle *h2; -static struct GNUNET_SCHEDULER_Task * shutdown_task; +static struct GNUNET_SCHEDULER_Task *shutdown_task; static void -force_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +force_shutdown (void *cls) { fprintf (stderr, "Timeout, failed to receive notifications: %d\n", ok); GNUNET_STATISTICS_destroy (h, GNUNET_NO); @@ -47,7 +47,7 @@ force_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -normal_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +normal_shutdown (void *cls) { GNUNET_STATISTICS_destroy (h, GNUNET_NO); GNUNET_STATISTICS_destroy (h2, GNUNET_NO); diff --git a/src/template/gnunet-service-template.c b/src/template/gnunet-service-template.c index 4125311fea..556d44bd8f 100644 --- a/src/template/gnunet-service-template.c +++ b/src/template/gnunet-service-template.c @@ -31,10 +31,9 @@ * Task run during shutdown. * * @param cls unused - * @param tc unused */ static void -cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_task (void *cls) { /* FIXME: do clean up here */ } diff --git a/src/testbed/gnunet-daemon-latency-logger.c b/src/testbed/gnunet-daemon-latency-logger.c index 84d8e223ad..9652721a10 100644 --- a/src/testbed/gnunet-daemon-latency-logger.c +++ b/src/testbed/gnunet-daemon-latency-logger.c @@ -131,11 +131,10 @@ free_iterator (void *cls, * Shutdown * * @param cls NULL - * @param tc task context from scheduler * @return */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { shutdown_task = NULL; GNUNET_ATS_performance_done (ats); diff --git a/src/testbed/gnunet-daemon-testbed-blacklist.c b/src/testbed/gnunet-daemon-testbed-blacklist.c index ed1c061a0b..0e0c7ebd50 100644 --- a/src/testbed/gnunet-daemon-testbed-blacklist.c +++ b/src/testbed/gnunet-daemon-testbed-blacklist.c @@ -121,10 +121,9 @@ cleanup_map () * Shutdown task to cleanup our resources and exit. * * @param cls NULL - * @param tc scheduler task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { cleanup_map (); if (NULL != bh) diff --git a/src/testbed/gnunet-daemon-testbed-underlay.c b/src/testbed/gnunet-daemon-testbed-underlay.c index c4dbc51785..ce0cc46d97 100644 --- a/src/testbed/gnunet-daemon-testbed-underlay.c +++ b/src/testbed/gnunet-daemon-testbed-underlay.c @@ -286,10 +286,9 @@ unload_keys () * Shutdown task to cleanup our resources and exit. * * @param cls NULL - * @param tc scheduler task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != transport) { diff --git a/src/testbed/gnunet-helper-testbed.c b/src/testbed/gnunet-helper-testbed.c index 4cde1b4d0a..b43f109830 100644 --- a/src/testbed/gnunet-helper-testbed.c +++ b/src/testbed/gnunet-helper-testbed.c @@ -156,10 +156,9 @@ static int status; * Task to shut down cleanly * * @param cls NULL - * @param tc the task context */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { LOG_DEBUG ("Shutting down\n"); shutdown_task_id = NULL; @@ -219,16 +218,17 @@ shutdown_now (void) * Task to write to the standard out * * @param cls the WriteContext - * @param tc the TaskContext */ static void -write_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +write_task (void *cls) { struct WriteContext *wc = cls; ssize_t bytes_wrote; + const struct GNUNET_SCHEDULER_TaskContext *tc; GNUNET_assert (NULL != wc); write_task_id = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) { GNUNET_free (wc->data); @@ -263,19 +263,20 @@ write_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * process died). * * @param cls closure, NULL if we need to self-restart - * @param tc context */ static void -child_death_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +child_death_task (void *cls) { const struct GNUNET_DISK_FileHandle *pr; char c[16]; enum GNUNET_OS_ProcessStatusType type; unsigned long code; int ret; + const struct GNUNET_SCHEDULER_TaskContext *tc; pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); child_death_task_id = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) { child_death_task_id = @@ -518,15 +519,16 @@ error: * Task to read from stdin * * @param cls NULL - * @param tc the task context */ static void -read_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +read_task (void *cls) { char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE]; ssize_t sread; + const struct GNUNET_SCHEDULER_TaskContext *tc; read_task_id = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; sread = GNUNET_DISK_file_read (stdin_fd, buf, sizeof (buf)); diff --git a/src/testbed/gnunet-service-test-barriers.c b/src/testbed/gnunet-service-test-barriers.c index 444cb4a6d5..281172cbfa 100644 --- a/src/testbed/gnunet-service-test-barriers.c +++ b/src/testbed/gnunet-service-test-barriers.c @@ -46,10 +46,9 @@ struct GNUNET_TESTBED_BarrierWaitHandle *wh; * Dummy task callback to keep us running forever * * @param cls NULL - * @param tc scheduler task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != wh) GNUNET_TESTBED_barrier_wait_cancel (wh); @@ -80,12 +79,14 @@ barrier_wait_cb (void *cls, const char *name, int status) * Task to wait for the barrier * * @param cls NULL - * @param tc scheduler task context * @return */ static void -do_wait (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_wait (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; wh = GNUNET_TESTBED_barrier_wait (TEST_BARRIER_NAME, &barrier_wait_cb, NULL); diff --git a/src/testbed/gnunet-service-testbed-logger.c b/src/testbed/gnunet-service-testbed-logger.c index bd52b8d52a..ab5b17460b 100644 --- a/src/testbed/gnunet-service-testbed-logger.c +++ b/src/testbed/gnunet-service-testbed-logger.c @@ -119,10 +119,9 @@ handle_log_msg (void *cls, struct GNUNET_SERVER_Client *client, * Task to clean up and shutdown nicely * * @param cls NULL - * @param tc the TaskContext from scheduler */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct MessageQueue *mq_entry; @@ -155,7 +154,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param client identification of the client; NULL * for the last call when the server is destroyed */ -static void +static void client_disconnected (void *cls, struct GNUNET_SERVER_Client *client) { if (NULL == client) diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c index 68878b69bc..e4fe87fcd0 100644 --- a/src/testbed/gnunet-service-testbed.c +++ b/src/testbed/gnunet-service-testbed.c @@ -405,11 +405,9 @@ GST_forwarded_operation_reply_relay (void *cls, * Task to free resources when forwarded operation has been timedout * * @param cls the ForwardedOperationContext - * @param tc the task context from scheduler */ void -GST_forwarded_operation_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +GST_forwarded_operation_timeout (void *cls) { struct ForwardedOperationContext *fopc = cls; @@ -776,10 +774,9 @@ GST_clear_fopcq () * Task to clean up and shutdown nicely * * @param cls NULL - * @param tc the TaskContext from scheduler */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct MessageQueue *mq_entry; uint32_t id; diff --git a/src/testbed/gnunet-service-testbed.h b/src/testbed/gnunet-service-testbed.h index 8250568806..b19d3c516d 100644 --- a/src/testbed/gnunet-service-testbed.h +++ b/src/testbed/gnunet-service-testbed.h @@ -590,8 +590,7 @@ GST_forwarded_operation_reply_relay (void *cls, * @param tc the task context from scheduler */ void -GST_forwarded_operation_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +GST_forwarded_operation_timeout (void *cls); /** diff --git a/src/testbed/gnunet-service-testbed_barriers.c b/src/testbed/gnunet-service-testbed_barriers.c index e1992cccb0..5b081ed12e 100644 --- a/src/testbed/gnunet-service-testbed_barriers.c +++ b/src/testbed/gnunet-service-testbed_barriers.c @@ -672,10 +672,9 @@ wbarrier_status_cb (void *cls, const char *name, * subcontrollers to barrier init message * * @param cls barrier - * @param tc scheduler task context */ static void -fwd_tout_barrier_init (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +fwd_tout_barrier_init (void *cls) { struct Barrier *barrier = cls; diff --git a/src/testbed/gnunet-service-testbed_connectionpool.c b/src/testbed/gnunet-service-testbed_connectionpool.c index e06538ac77..0fa2a64567 100644 --- a/src/testbed/gnunet-service-testbed_connectionpool.c +++ b/src/testbed/gnunet-service-testbed_connectionpool.c @@ -333,11 +333,9 @@ destroy_pooled_connection (struct PooledConnection *entry) * Expire a #PooledConnection object * * @param cls the #PooledConnection object - * @param tc scheduler task context */ static void -expire (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +expire (void *cls) { struct PooledConnection *entry = cls; @@ -429,10 +427,9 @@ search_waiting (const struct PooledConnection *entry, * further schedules itself if there are similar waiting objects which can be notified. * * @param cls the #PooledConnection object - * @param tc the task context from scheduler */ static void -connection_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +connection_ready (void *cls) { struct PooledConnection *entry = cls; struct GST_ConnectionPool_GetHandle *gh; diff --git a/src/testbed/gnunet-service-testbed_cpustatus.c b/src/testbed/gnunet-service-testbed_cpustatus.c index 066c680b33..cda669caaa 100644 --- a/src/testbed/gnunet-service-testbed_cpustatus.c +++ b/src/testbed/gnunet-service-testbed_cpustatus.c @@ -646,7 +646,7 @@ get_nproc () static void -sample_load_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +sample_load_task (void *cls) { struct GNUNET_TIME_Absolute now; char *str; @@ -655,8 +655,10 @@ sample_load_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) int ld_disk; unsigned int mem_usage; unsigned int nproc; + const struct GNUNET_SCHEDULER_TaskContext *tc; sample_load_task_id = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; ld_cpu = cpu_get_load (); diff --git a/src/testbed/gnunet-service-testbed_links.c b/src/testbed/gnunet-service-testbed_links.c index 9fbc3197ee..a2692e8a6f 100644 --- a/src/testbed/gnunet-service-testbed_links.c +++ b/src/testbed/gnunet-service-testbed_links.c @@ -585,10 +585,9 @@ send_controller_link_response (struct GNUNET_SERVER_Client *client, * The Link Controller forwarding task * * @param cls the LCFContext - * @param tc the Task context from scheduler */ static void -lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +lcf_proc_task (void *cls); /** @@ -634,21 +633,18 @@ registration_error: * The Link Controller forwarding task * * @param cls the LCFContext - * @param tc the Task context from scheduler */ static void -lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +lcf_proc_task (void *cls); /** * Task to free resources when forwarded link controllers has been timedout * * @param cls the LCFContext - * @param tc the task context from scheduler */ static void -lcf_forwarded_operation_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +lcf_forwarded_operation_timeout (void *cls) { struct LCFContext *lcf = cls; @@ -668,10 +664,9 @@ lcf_forwarded_operation_timeout (void *cls, * The Link Controller forwarding task * * @param cls the LCFContext - * @param tc the Task context from scheduler */ static void -lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +lcf_proc_task (void *cls) { struct LCFContext *lcf = cls; struct LCFContextQueue *lcfq; @@ -852,11 +847,9 @@ trigger_notifications (struct Neighbour *n); * neighbour * * @param cls the neighbour - * @param tc scheduler task context */ static void -neighbour_connect_notify_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +neighbour_connect_notify_task (void *cls) { struct Neighbour *n = cls; struct NeighbourConnectNotification *h; @@ -1118,11 +1111,9 @@ GST_free_nccq () * Task to be run upon timeout while attempting to connect to the neighbour * * @param cls the NeighbourConnectCtxt created in GST_handle_link_controllers() - * @param tc the scheduler task context */ static void -timeout_neighbour_connect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_neighbour_connect (void *cls) { struct NeighbourConnectCtxt *ncc = cls; diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c index 6bb4ec4fb7..34bf8e047e 100644 --- a/src/testbed/gnunet-service-testbed_oc.c +++ b/src/testbed/gnunet-service-testbed_oc.c @@ -362,12 +362,9 @@ GST_cleanup_focc (struct ForwardedOverlayConnectContext *focc) * Timeout task for cancelling a forwarded overlay connect connect * * @param cls the ForwardedOverlayConnectContext - * @param tc the task context from the scheduler */ static void -forwarded_overlay_connect_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext - *tc) +forwarded_overlay_connect_timeout (void *cls) { struct ForwardedOperationContext *fopc = cls; struct RegisteredHostContext *rhc; @@ -379,7 +376,7 @@ forwarded_overlay_connect_timeout (void *cls, LOG_DEBUG ("Overlay linking between peers %u and %u failed\n", focc->peer1, focc->peer2); GST_cleanup_focc (focc); - GST_forwarded_operation_timeout (fopc, tc); + GST_forwarded_operation_timeout (fopc); if (NULL != rhc->focc_dll_head) GST_process_next_focc (rhc); } @@ -573,11 +570,9 @@ cleanup_occ (struct OverlayConnectContext *occ) * Task for cleaing up overlay connect context structure * * @param cls the overlay connect context - * @param tc the task context */ static void -do_cleanup_occ (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_cleanup_occ (void *cls) { struct OverlayConnectContext *occ = cls; @@ -590,11 +585,9 @@ do_cleanup_occ (void *cls, * Task which will be run when overlay connect request has been timed out * * @param cls the OverlayConnectContext - * @param tc the TaskContext */ static void -timeout_overlay_connect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_overlay_connect (void *cls) { struct OverlayConnectContext *occ = cls; @@ -777,29 +770,27 @@ occ_cache_get_handle_ats_rocc_cb (void *cls, * peer 1. * * @param cls the OverlayConnectContext - * @param tc the TaskContext from scheduler */ static void -send_hello (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +send_hello (void *cls); /** - * Task that is run when hello has been sent + * Task that is run when hello has been sent If tc->reason = + * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if + * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded * * @param cls the overlay connect context - * @param tc the scheduler task context; if tc->reason = - * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if - * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded */ static void -occ_hello_sent_cb (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +occ_hello_sent_cb (void *cls) { struct OverlayConnectContext *occ = cls; struct LocalPeer2Context *lp2c; struct Peer *peer2; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); GNUNET_assert (OCC_TYPE_LOCAL == occ->type); GNUNET_assert (NULL != occ->timeout_task); lp2c = &occ->p2ctx.local; @@ -881,18 +872,18 @@ send_hello_thru_rocc (struct OverlayConnectContext *occ) * send_hello_thru_rocc() * * @param cls the OverlayConnectContext - * @param tc the TaskContext from scheduler */ static void -send_hello (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +send_hello (void *cls) { struct OverlayConnectContext *occ = cls; struct LocalPeer2Context *lp2c; char *other_peer_str; + const struct GNUNET_SCHEDULER_TaskContext *tc; occ->send_hello_task = NULL; GNUNET_assert (NULL != occ->timeout_task); + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; GNUNET_assert (NULL != occ->hello); @@ -1652,11 +1643,9 @@ cleanup_rocc (struct RemoteOverlayConnectCtx *rocc) * Task to timeout rocc and cleanit up * * @param cls the RemoteOverlayConnectCtx - * @param tc the TaskContext from scheduler */ static void -timeout_rocc_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_rocc_task (void *cls) { struct RemoteOverlayConnectCtx *rocc = cls; @@ -1698,26 +1687,23 @@ cache_transport_peer_connect_notify (void *cls, * whose identity is in RemoteOverlayConnectCtx * * @param cls the RemoteOverlayConnectCtx - * @param tc the TaskContext from scheduler */ static void -attempt_connect_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +attempt_connect_task (void *cls); /** - * Task that is run when hello has been sent + * Task that is run when hello has been sent If tc->reason = + * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if + * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded * * @param cls the overlay connect context - * @param tc the scheduler task context; if tc->reason = - * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if - * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded */ static void -rocc_hello_sent_cb (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +rocc_hello_sent_cb (void *cls) { struct RemoteOverlayConnectCtx *rocc = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; rocc->ohh = NULL; GNUNET_assert (NULL == rocc->attempt_connect_task_id); @@ -1725,6 +1711,7 @@ rocc_hello_sent_cb (void *cls, rocc->op_id, GNUNET_i2s (&rocc->a_id), rocc->peer->id); + tc = GNUNET_SCHEDULER_get_task_context (); if (GNUNET_SCHEDULER_REASON_TIMEOUT == tc->reason) { GNUNET_break (0); @@ -1754,11 +1741,9 @@ rocc_hello_sent_cb (void *cls, * whose identity is in RemoteOverlayConnectCtx * * @param cls the RemoteOverlayConnectCtx - * @param tc the TaskContext from scheduler */ static void -attempt_connect_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +attempt_connect_task (void *cls) { struct RemoteOverlayConnectCtx *rocc = cls; diff --git a/src/testbed/gnunet-service-testbed_peers.c b/src/testbed/gnunet-service-testbed_peers.c index a5f1abe4d8..ba20d6d6b4 100644 --- a/src/testbed/gnunet-service-testbed_peers.c +++ b/src/testbed/gnunet-service-testbed_peers.c @@ -211,16 +211,14 @@ peer_list_remove (struct Peer *peer) * timed out * * @param cls the FowardedOperationContext - * @param tc the TaskContext from the scheduler */ static void -peer_create_forward_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +peer_create_forward_timeout (void *cls) { struct ForwardedOperationContext *fopc = cls; GNUNET_free (fopc->cls); - GST_forwarded_operation_timeout (fopc, tc); + GST_forwarded_operation_timeout (fopc); } diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index 350b7379db..308ec03868 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c @@ -107,10 +107,9 @@ static int noninteractive; * Shutdown nicely * * @param cls NULL - * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { shutdown_task = NULL; if (NULL != abort_task) @@ -131,10 +130,9 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * abort task to run on test timed out * * @param cls NULL - * @param tc the task context */ static void -do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_abort (void *cls) { LOG (GNUNET_ERROR_TYPE_WARNING, "Aborting\n"); abort_task = NULL; diff --git a/src/testbed/gnunet_testbed_mpi_spawn.c b/src/testbed/gnunet_testbed_mpi_spawn.c index 3fb50cb8fc..191f658b75 100644 --- a/src/testbed/gnunet_testbed_mpi_spawn.c +++ b/src/testbed/gnunet_testbed_mpi_spawn.c @@ -74,7 +74,7 @@ static struct GNUNET_SCHEDULER_Task * child_death_task_id; * The shutdown task */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { shutdown_task_id = NULL; if (0 != child_exit_code) @@ -96,7 +96,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +terminate_task (void *cls) { static int hard_kill; @@ -131,16 +131,18 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * process died). * * @param cls closure, NULL if we need to self-restart - * @param tc context */ static void -child_death_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +child_death_task (void *cls) { const struct GNUNET_DISK_FileHandle *pr; char c[16]; + const struct GNUNET_SCHEDULER_TaskContext *tc; + pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); child_death_task_id = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) { child_death_task_id = @@ -179,10 +181,9 @@ destroy_hosts(struct GNUNET_TESTBED_Host **hosts, unsigned int nhosts) * The main scheduler run task * * @param cls NULL - * @param tc scheduler task context */ static void -run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +run (void *cls) { struct GNUNET_TESTBED_Host **hosts; const struct GNUNET_CONFIGURATION_Handle *null_cfg; diff --git a/src/testbed/test_gnunet_helper_testbed.c b/src/testbed/test_gnunet_helper_testbed.c index ebcfd5a374..7a2dce8a51 100644 --- a/src/testbed/test_gnunet_helper_testbed.c +++ b/src/testbed/test_gnunet_helper_testbed.c @@ -80,10 +80,9 @@ static int result; * Shutdown nicely * * @param cls NULL - * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); @@ -99,10 +98,9 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * abort task to run on test timed out * * @param cls NULL - * @param tc the task context */ static void -do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_abort (void *cls) { abort_task = NULL; LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); @@ -118,9 +116,9 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Continuation function. * * @param cls closure - * @param result GNUNET_OK on success, - * GNUNET_NO if helper process died - * GNUNET_SYSERR during GNUNET_HELPER_stop + * @param result #GNUNET_OK on success, + * #GNUNET_NO if helper process died + * #GNUNET_SYSERR during GNUNET_HELPER_stop() */ static void cont_cb (void *cls, int result) @@ -141,7 +139,7 @@ cont_cb (void *cls, int result) * @param client identification of the client * @param message the actual message * - * @return GNUNET_OK on success, GNUNET_SYSERR to stop further processing + * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing */ static int mst_cb (void *cls, void *client, const struct GNUNET_MessageHeader *message) diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c index 01207c0d4a..fdf9d80f9d 100644 --- a/src/testbed/test_testbed_api.c +++ b/src/testbed/test_testbed_api.c @@ -136,7 +136,7 @@ static enum Test sub_test; * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down...\n"); if (NULL != abort_task) @@ -178,11 +178,11 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param tc the task context */ static void -do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_abort (void *cls) { LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); abort_task = NULL; - do_shutdown (cls, tc); + do_shutdown (cls); } diff --git a/src/testbed/test_testbed_api_2peers_1controller.c b/src/testbed/test_testbed_api_2peers_1controller.c index 0bee03de9c..1e15d07aa8 100644 --- a/src/testbed/test_testbed_api_2peers_1controller.c +++ b/src/testbed/test_testbed_api_2peers_1controller.c @@ -186,10 +186,9 @@ static enum Stage result; * Shutdown nicely * * @param cls NULL - * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); @@ -210,14 +209,13 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * abort task to run on test timed out * * @param cls NULL - * @param tc the task context */ static void -do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_abort (void *cls) { LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); abort_task = NULL; - do_shutdown (cls, tc); + do_shutdown (cls); } @@ -237,10 +235,9 @@ op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg); * task for delaying a connect * * @param cls NULL - * @param tc the task context */ static void -do_delayed_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_delayed_connect (void *cls) { delayed_connect_task = NULL; FAIL_TEST (NULL == common_operation); diff --git a/src/testbed/test_testbed_api_3peers_3controllers.c b/src/testbed/test_testbed_api_3peers_3controllers.c index 5919cbefa6..a728048f33 100644 --- a/src/testbed/test_testbed_api_3peers_3controllers.c +++ b/src/testbed/test_testbed_api_3peers_3controllers.c @@ -254,10 +254,9 @@ static enum Stage result; * Shutdown nicely * * @param cls NULL - * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); @@ -288,10 +287,9 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * abort task to run on test timed out * * @param cls NULL - * @param tc the task context */ static void -do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_abort (void *cls) { LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); abort_task = NULL; @@ -300,7 +298,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_SCHEDULER_cancel (delayed_connect_task); delayed_connect_task = NULL; } - do_shutdown (cls, tc); + do_shutdown (cls); } static void @@ -328,10 +326,9 @@ op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg); * task for delaying a connect * * @param cls NULL - * @param tc the task context */ static void -do_delayed_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_delayed_connect (void *cls) { delayed_connect_task = NULL; if (NULL != common_operation) diff --git a/src/testbed/test_testbed_api_barriers.c b/src/testbed/test_testbed_api_barriers.c index 0a0f482d99..8ee9c41afa 100644 --- a/src/testbed/test_testbed_api_barriers.c +++ b/src/testbed/test_testbed_api_barriers.c @@ -62,10 +62,9 @@ static int result; * Shutdown this test case when it takes too long * * @param cls NULL - * @param tc scheduler task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { shutdown_task = NULL; if (NULL != barrier) diff --git a/src/testbed/test_testbed_api_controllerlink.c b/src/testbed/test_testbed_api_controllerlink.c index 78d4d3bc7f..fd876a07f2 100644 --- a/src/testbed/test_testbed_api_controllerlink.c +++ b/src/testbed/test_testbed_api_controllerlink.c @@ -300,7 +300,7 @@ static enum Stage result; if (NULL != abort_task) \ GNUNET_SCHEDULER_cancel (abort_task); \ abort_task = NULL; \ - GNUNET_SCHEDULER_add_now (do_shutdown, NULL); \ + GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); \ return; \ } \ } while (0) @@ -310,10 +310,9 @@ static enum Stage result; * Shutdown nicely * * @param cls NULL - * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); @@ -349,14 +348,13 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * abort task to run on test timed out * * @param cls NULL - * @param tc the task context */ static void -do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_abort (void *cls) { LOG (GNUNET_ERROR_TYPE_WARNING, "Aborting\n"); abort_task = NULL; - do_shutdown (cls, tc); + do_shutdown (cls); } @@ -392,7 +390,7 @@ registration_cont (void *cls, const char *emsg); * @return */ static void -delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +delay_task (void *cls) { delay_task_id = NULL; switch (result) @@ -644,8 +642,8 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) result = SUCCESS; GNUNET_TESTBED_operation_done (op); op = NULL; - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply - (GNUNET_TIME_UNIT_SECONDS, 1), &do_shutdown, + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, + &do_shutdown, NULL); break; default: diff --git a/src/testbed/test_testbed_api_hosts.c b/src/testbed/test_testbed_api_hosts.c index a355ddd0c9..2141dc46f3 100644 --- a/src/testbed/test_testbed_api_hosts.c +++ b/src/testbed/test_testbed_api_hosts.c @@ -67,10 +67,9 @@ struct GNUNET_SCHEDULER_Task * shutdown_id; * The shutdown task * * @param cls NULL - * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { GNUNET_TESTBED_host_destroy (host); while (0 != num_hosts) diff --git a/src/testbed/test_testbed_api_operations.c b/src/testbed/test_testbed_api_operations.c index b522262ba2..f2fc4e6e33 100644 --- a/src/testbed/test_testbed_api_operations.c +++ b/src/testbed/test_testbed_api_operations.c @@ -262,10 +262,9 @@ release_cb (void *cls); * Task to simulate artificial delay and change the test stage * * @param cls NULL - * @param tc the task context */ static void -step (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +step (void *cls) { GNUNET_assert (NULL != step_task); step_task = NULL; diff --git a/src/testbed/test_testbed_api_peer_reconfiguration.c b/src/testbed/test_testbed_api_peer_reconfiguration.c index 8b429e8fa1..315d8a3f3d 100644 --- a/src/testbed/test_testbed_api_peer_reconfiguration.c +++ b/src/testbed/test_testbed_api_peer_reconfiguration.c @@ -89,10 +89,9 @@ enum { * Abort task * * @param cls NULL - * @param tc scheduler task context */ static void -do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_abort (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting\n"); abort_task = NULL; diff --git a/src/testbed/test_testbed_api_peers_manage_services.c b/src/testbed/test_testbed_api_peers_manage_services.c index d478fd1ea9..170f4a067a 100644 --- a/src/testbed/test_testbed_api_peers_manage_services.c +++ b/src/testbed/test_testbed_api_peers_manage_services.c @@ -103,10 +103,9 @@ enum { * Abort task * * @param cls NULL - * @param tc scheduler task context */ static void -do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_abort (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting\n"); abort_task = NULL; diff --git a/src/testbed/test_testbed_api_statistics.c b/src/testbed/test_testbed_api_statistics.c index dc8e4c4beb..20598b565e 100644 --- a/src/testbed/test_testbed_api_statistics.c +++ b/src/testbed/test_testbed_api_statistics.c @@ -87,10 +87,9 @@ static unsigned int num_seen_peers; * Abort task * * @param cls NULL - * @param tc scheduler task context */ static void -do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_abort (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test timed out -- Aborting\n"); abort_task = NULL; diff --git a/src/testbed/test_testbed_api_test.c b/src/testbed/test_testbed_api_test.c index 80e92eb909..61d3f2aba1 100644 --- a/src/testbed/test_testbed_api_test.c +++ b/src/testbed/test_testbed_api_test.c @@ -70,10 +70,9 @@ static int result; * Shutdown nicely * * @param cls NULL - * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { shutdown_task = NULL; if (NULL != abort_task) @@ -93,7 +92,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_SCHEDULER_cancel (abort_task); \ abort_task = NULL; \ if (NULL == shutdown_task) \ - shutdown_task = GNUNET_SCHEDULER_add_now (do_shutdown, NULL); \ + shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); \ return; \ } \ } while (0) @@ -103,16 +102,15 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * abort task to run on test timed out * * @param cls NULL - * @param tc the task context */ static void -do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_abort (void *cls) { LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); abort_task = NULL; if (NULL != shutdown_task) GNUNET_SCHEDULER_cancel (shutdown_task); - do_shutdown (cls, tc); + do_shutdown (cls); } diff --git a/src/testbed/test_testbed_api_testbed_run.c b/src/testbed/test_testbed_api_testbed_run.c index db3bb0d47e..10beebc1f2 100644 --- a/src/testbed/test_testbed_api_testbed_run.c +++ b/src/testbed/test_testbed_api_testbed_run.c @@ -68,10 +68,9 @@ static int wait_forever; * Shutdown nicely * * @param cls NULL - * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); @@ -83,10 +82,9 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * abort task to run on test timed out * * @param cls NULL - * @param tc the task context */ static void -do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_abort (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); abort_task = NULL; diff --git a/src/testbed/test_testbed_api_topology.c b/src/testbed/test_testbed_api_topology.c index c6064af658..49b46b0dfd 100644 --- a/src/testbed/test_testbed_api_topology.c +++ b/src/testbed/test_testbed_api_topology.c @@ -63,10 +63,9 @@ static unsigned int overlay_connects; * Shutdown nicely * * @param cls NULL - * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { shutdown_task = NULL; if (NULL != op) diff --git a/src/testbed/test_testbed_api_topology_clique.c b/src/testbed/test_testbed_api_topology_clique.c index d1ccdc2c03..4ca6dbddae 100644 --- a/src/testbed/test_testbed_api_topology_clique.c +++ b/src/testbed/test_testbed_api_topology_clique.c @@ -63,10 +63,9 @@ static unsigned int overlay_connects; * Shutdown nicely * * @param cls NULL - * @param tc the task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { shutdown_task = NULL; if (NULL != op) diff --git a/src/testbed/test_testbed_logger_api.c b/src/testbed/test_testbed_logger_api.c index 2cc33ea5bf..bedb9d4daf 100644 --- a/src/testbed/test_testbed_logger_api.c +++ b/src/testbed/test_testbed_logger_api.c @@ -97,7 +97,7 @@ shutdown_now () static void -do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_abort (void *cls) { LOG (GNUNET_ERROR_TYPE_WARNING, "Aborting\n"); abort_task = NULL; @@ -173,7 +173,7 @@ flush_comp (void *cls, size_t size) static void -do_write (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_write (void *cls) { static int i; char buf[BSIZE]; diff --git a/src/testbed/test_testbed_underlay.c b/src/testbed/test_testbed_underlay.c index caea418813..098a2b3dbf 100644 --- a/src/testbed/test_testbed_underlay.c +++ b/src/testbed/test_testbed_underlay.c @@ -49,7 +49,7 @@ static struct GNUNET_TESTBED_Operation *op; * @param tc scheduler task context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != op) GNUNET_TESTBED_operation_done (op); diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index 7c85803195..d371108ec9 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c @@ -1259,10 +1259,9 @@ struct GNUNET_TESTBED_HostHabitableCheckHandle * Task for checking whether a host is habitable or not * * @param cls GNUNET_TESTBED_HostHabitableCheckHandle - * @param tc the scheduler task context */ static void -habitability_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +habitability_check (void *cls) { struct GNUNET_TESTBED_HostHabitableCheckHandle *h = cls; void *cb_cls; diff --git a/src/testbed/testbed_api_operations.c b/src/testbed/testbed_api_operations.c index e4da01fb7d..7f5aaa8736 100644 --- a/src/testbed/testbed_api_operations.c +++ b/src/testbed/testbed_api_operations.c @@ -549,10 +549,9 @@ rq_remove (struct GNUNET_TESTBED_Operation *op) * the ready queue. * * @param cls NULL - * @param tc scheduler task context. Not used. */ static void -process_rq_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +process_rq_task (void *cls) { struct GNUNET_TESTBED_Operation *op; struct OperationQueue *queue; diff --git a/src/testbed/testbed_api_statistics.c b/src/testbed/testbed_api_statistics.c index 0f24446fe6..a4778f84d5 100644 --- a/src/testbed/testbed_api_statistics.c +++ b/src/testbed/testbed_api_statistics.c @@ -150,10 +150,9 @@ static struct OperationQueue *no_wait_queue; * get_statistics operation. * * @param cls the GetStatsContext - * @param tc the scheduler task context */ static void -call_completion_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +call_completion_task (void *cls) { struct GetStatsContext *sc = cls; @@ -169,10 +168,9 @@ call_completion_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * as we cannot destroy the statistics handle in iteration_completion_cb() * * @param cls the PeerGetStatsContext - * @param tc the scheduler task context */ static void -op_done_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +op_done_task (void *cls) { struct PeerGetStatsContext *peer_sc = cls; struct GetStatsContext *sc; diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index 76403e427f..de99fb5a31 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c @@ -611,10 +611,9 @@ wait_op_completion (void *cls) * Task run upon interrupts (SIGINT, SIGTERM) and upon scheduler shutdown. * * @param cls the RunContext which has to be acted upon - * @param tc the scheduler task context */ static void -interrupt (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +interrupt (void *cls) { struct GNUNET_TESTBED_RunHandle *rc = cls; struct GNUNET_TESTBED_Controller *c = rc->c; @@ -661,10 +660,9 @@ prof_time (struct GNUNET_TESTBED_RunHandle *rc) * Task for starting peers * * @param cls the RunHandle - * @param tc the task context from scheduler */ static void -start_peers_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +start_peers_task (void *cls) { struct GNUNET_TESTBED_RunHandle *rc = cls; struct RunContextOperation *rcop; @@ -966,10 +964,9 @@ call_cc: * Task to register all hosts available in the global host list * * @param cls the RunContext - * @param tc the scheduler task context */ static void -register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +register_hosts (void *cls); /** @@ -999,10 +996,9 @@ host_registration_completion (void *cls, const char *emsg) * Task to register all hosts available in the global host list * * @param cls RunContext - * @param tc the scheduler task context */ static void -register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +register_hosts (void *cls) { struct GNUNET_TESTBED_RunHandle *rc = cls; struct RunContextOperation *rcop; @@ -1194,15 +1190,15 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, * Task run upon timeout while setting up the testbed * * @param cls the RunContext - * @param tc the task context */ static void -timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_task (void *cls) { struct GNUNET_TESTBED_RunHandle *rc = cls; rc->timeout_task = NULL; - LOG (GNUNET_ERROR_TYPE_ERROR, _("Shutting down testbed due to timeout while setup.\n")); + LOG (GNUNET_ERROR_TYPE_ERROR, + _("Shutting down testbed due to timeout while setup.\n")); GNUNET_SCHEDULER_shutdown (); if (NULL != rc->test_master) rc->test_master (rc->test_master_cls, rc, 0, NULL, 0, 0); diff --git a/src/testbed/testbed_logger_api.c b/src/testbed/testbed_logger_api.c index ca6bc354e4..aa182e21c6 100644 --- a/src/testbed/testbed_logger_api.c +++ b/src/testbed/testbed_logger_api.c @@ -170,10 +170,9 @@ cancel_timeout_flush (struct GNUNET_TESTBED_LOGGER_Handle *h) * Task to call the flush completion notification * * @param cls the logger handle - * @param tc the scheduler task context */ static void -call_flush_completion (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +call_flush_completion (void *cls) { struct GNUNET_TESTBED_LOGGER_Handle *h = cls; GNUNET_TESTBED_LOGGER_FlushCompletion cb; @@ -416,10 +415,9 @@ GNUNET_TESTBED_LOGGER_write (struct GNUNET_TESTBED_LOGGER_Handle *h, * be called with 0 as the amount of data sent. * * @param cls the logger handle - * @param tc scheduler task context */ static void -timeout_flush (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_flush (void *cls) { struct GNUNET_TESTBED_LOGGER_Handle *h = cls; GNUNET_TESTBED_LOGGER_FlushCompletion cb; diff --git a/src/testing/gnunet-testing.c b/src/testing/gnunet-testing.c index 1e640ec964..92dd17d981 100644 --- a/src/testing/gnunet-testing.c +++ b/src/testing/gnunet-testing.c @@ -197,10 +197,9 @@ create_hostkeys (const unsigned int no) * Removes the temporary file. * * @param cls unused - * @param tc scheduler context */ static void -cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup (void *cls) { if (NULL != tmpfilename) { @@ -224,14 +223,15 @@ cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Called whenever we can read stdin non-blocking * * @param cls unused - * @param tc scheduler context */ static void -stdin_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +stdin_cb (void *cls) { int c; + const struct GNUNET_SCHEDULER_TaskContext *tc; tid = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; GNUNET_assert (0 != (GNUNET_SCHEDULER_REASON_READ_READY & tc->reason)); diff --git a/src/testing/test_testing_peerstartup.c b/src/testing/test_testing_peerstartup.c index 9b0c536424..956788f6c3 100644 --- a/src/testing/test_testing_peerstartup.c +++ b/src/testing/test_testing_peerstartup.c @@ -63,10 +63,9 @@ struct TestingContext * Task for shutdown * * @param cls the testing context - * @param tc the tast context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { struct TestingContext *test_ctx = cls; diff --git a/src/testing/test_testing_peerstartup2.c b/src/testing/test_testing_peerstartup2.c index edbd24df04..fd46e5c3ef 100644 --- a/src/testing/test_testing_peerstartup2.c +++ b/src/testing/test_testing_peerstartup2.c @@ -83,7 +83,7 @@ struct TestingContext static void -do_shutdown2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown2 (void *cls) { struct TestingContext *test_ctx = cls; @@ -102,10 +102,9 @@ do_shutdown2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Task for shutdown * * @param cls the testing context - * @param tc the tast context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +do_shutdown (void *cls); static void @@ -133,10 +132,9 @@ peer_status_cb (void *cls, struct GNUNET_TESTING_Peer *peer, int success) * Task for shutdown * * @param cls the testing context - * @param tc the tast context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { struct TestingContext *test_ctx = cls; @@ -149,7 +147,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) test_ctx)); } else - do_shutdown2 (test_ctx, tc); + do_shutdown2 (test_ctx); } diff --git a/src/testing/test_testing_sharedservices.c b/src/testing/test_testing_sharedservices.c index 7d1a3905de..ee1ac85305 100644 --- a/src/testing/test_testing_sharedservices.c +++ b/src/testing/test_testing_sharedservices.c @@ -64,10 +64,9 @@ struct TestingContext * Task for shutdown * * @param cls the testing context - * @param tc the tast context */ static void -do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { struct TestingContext *test_ctx = cls; struct GNUNET_TESTING_Peer *peer; diff --git a/src/testing/testing.c b/src/testing/testing.c index 07129fd6f1..32cd09b84b 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c @@ -1654,11 +1654,9 @@ struct ServiceContext * Callback to be called when SCHEDULER has been started * * @param cls the ServiceContext - * @param tc the TaskContext */ static void -service_run_main (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +service_run_main (void *cls) { struct ServiceContext *sc = cls; diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index 632cfc4ecb..1a6c163eea 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c @@ -506,19 +506,19 @@ find_advertisable_hello (void *cls, * peer and ask for it. * * @param cls for which peer to schedule the HELLO - * @param tc task context */ static void -schedule_next_hello (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +schedule_next_hello (void *cls) { struct Peer *pl = cls; struct FindAdvHelloContext fah; size_t next_want; struct GNUNET_TIME_Relative delay; + const struct GNUNET_SCHEDULER_TaskContext *tc; pl->hello_delay_task = NULL; GNUNET_assert (GNUNET_YES == pl->is_connected); + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; /* we're out of here */ if (pl->hello_req != NULL) @@ -669,11 +669,9 @@ try_add_peers (void *cls, * Add peers and schedule connection attempt * * @param cls unused, NULL - * @param tc scheduler context */ static void -add_peer_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +add_peer_task (void *cls) { add_task = NULL; @@ -1133,11 +1131,9 @@ hello_advertising_ready (void *cls, * the transport and core. * * @param cls unused, NULL - * @param tc scheduler context */ static void -cleaning_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cleaning_task (void *cls) { if (NULL != peerinfo_notify) { diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index d5c0d4a86f..9fde3d83e6 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -250,11 +250,9 @@ process_payload (const struct GNUNET_HELLO_Address *address, * Task to asynchronously terminate a session. * * @param cls the `struct GNUNET_ATS_SessionKiller` with the information for the kill - * @param tc scheduler context */ static void -kill_session_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +kill_session_task (void *cls) { struct GNUNET_ATS_SessionKiller *sk = cls; @@ -756,11 +754,9 @@ ats_request_address_change (void *cls, * and cancels pending validations. * * @param cls closure, unused - * @param tc task context (unused) */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { GST_neighbours_stop (); GST_plugins_unload (); diff --git a/src/transport/gnunet-service-transport_ats.c b/src/transport/gnunet-service-transport_ats.c index 87d05b200a..a20c998b34 100644 --- a/src/transport/gnunet-service-transport_ats.c +++ b/src/transport/gnunet-service-transport_ats.c @@ -294,11 +294,9 @@ GST_ats_is_known_no_session (const struct GNUNET_HELLO_Address *address) * suggest it again. * * @param cls the `struct AddressInfo` of the address to unblock - * @param tc unused */ static void -unblock_address (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +unblock_address (void *cls) { struct AddressInfo *ai = cls; diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c index 14375fce4a..ea56443901 100644 --- a/src/transport/gnunet-service-transport_blacklist.c +++ b/src/transport/gnunet-service-transport_blacklist.c @@ -205,11 +205,9 @@ static struct GNUNET_CONTAINER_MultiPeerMap *blacklist; * Perform next action in the blacklist check. * * @param cls the `struct BlacklistCheck*` - * @param tc unused */ static void -do_blacklist_check (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +do_blacklist_check (void *cls); /** @@ -395,7 +393,7 @@ GST_blacklist_stop () * @return number of bytes copied to @a buf */ static size_t -transmit_blacklist_message (void *cls, +transmit_blacklist_message (void *cls, size_t size, void *buf) { @@ -416,7 +414,7 @@ transmit_blacklist_message (void *cls, } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending blacklist test for peer `%s' to client %p\n", - GNUNET_i2s (&bc->peer), + GNUNET_i2s (&bc->peer), bc->bl_pos->client); bl = bc->bl_pos; bm.header.size = htons (sizeof (struct BlacklistMessage)); @@ -424,7 +422,7 @@ transmit_blacklist_message (void *cls, bm.is_allowed = htonl (0); bm.peer = bc->peer; memcpy (buf, - &bm, + &bm, sizeof (bm)); if (GNUNET_YES == bl->call_receive_done) { @@ -442,11 +440,9 @@ transmit_blacklist_message (void *cls, * Perform next action in the blacklist check. * * @param cls the `struct GST_BlacklistCheck *` - * @param tc unused */ static void -do_blacklist_check (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_blacklist_check (void *cls) { struct GST_BlacklistCheck *bc = cls; struct Blacklisters *bl; @@ -459,7 +455,7 @@ do_blacklist_check (void *cls, "No other blacklist clients active, will allow neighbour `%s'\n", GNUNET_i2s (&bc->peer)); - bc->cont (bc->cont_cls, + bc->cont (bc->cont_cls, &bc->peer, bc->address, bc->session, @@ -475,7 +471,7 @@ do_blacklist_check (void *cls, GNUNET_SERVER_notify_transmit_ready (bl->client, sizeof (struct BlacklistMessage), GNUNET_TIME_UNIT_FOREVER_REL, - &transmit_blacklist_message, + &transmit_blacklist_message, bc); } @@ -501,7 +497,7 @@ confirm_or_drop_neighbour (void *cls, if (GNUNET_OK == allowed) return; /* we're done */ GNUNET_STATISTICS_update (GST_stats, - gettext_noop ("# disconnects due to blacklist"), + gettext_noop ("# disconnects due to blacklist"), 1, GNUNET_NO); GST_neighbours_force_disconnect (peer); @@ -666,7 +662,7 @@ GST_blacklist_handle_reply (void *cls, GNUNET_CONTAINER_DLL_remove (bc_head, bc_tail, bc); - bc->cont (bc->cont_cls, + bc->cont (bc->cont_cls, &bc->peer, bc->address, bc->session, @@ -687,7 +683,7 @@ GST_blacklist_handle_reply (void *cls, GNUNET_OK); bl->call_receive_done = GNUNET_NO; bc->bl_pos = bl->next; - bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, + bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, bc); } } @@ -695,7 +691,7 @@ GST_blacklist_handle_reply (void *cls, for (bc = bc_head; bc != NULL; bc = bc->next) if ((bc->bl_pos == bl) && (NULL == bc->task)) { - bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, + bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, bc); break; } @@ -749,7 +745,7 @@ GST_blacklist_abort_matching (const struct GNUNET_HELLO_Address *address, struct GST_BlacklistCheck *bc; struct GST_BlacklistCheck *n; - n = bc_head; + n = bc_head; while (NULL != (bc = n)) { n = bc->next; @@ -853,15 +849,15 @@ GST_blacklist_test_allowed (const struct GNUNET_PeerIdentity *peer, /* Disallowed by config, disapprove instantly */ GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# disconnects due to blacklist"), - 1, + 1, GNUNET_NO); GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Disallowing connection to peer `%s' on transport %s\n"), GNUNET_i2s (peer), (NULL != transport_name) ? transport_name : "unspecified"); if (NULL != cont) - cont (cont_cls, - peer, + cont (cont_cls, + peer, address, session, GNUNET_NO); @@ -886,7 +882,7 @@ GST_blacklist_test_allowed (const struct GNUNET_PeerIdentity *peer, /* need to query blacklist clients */ bc = GNUNET_new (struct GST_BlacklistCheck); - GNUNET_CONTAINER_DLL_insert (bc_head, + GNUNET_CONTAINER_DLL_insert (bc_head, bc_tail, bc); bc->peer = *peer; diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c index 77c382ed0e..1a3c2c32e9 100644 --- a/src/transport/gnunet-service-transport_hello.c +++ b/src/transport/gnunet-service-transport_hello.c @@ -172,11 +172,9 @@ address_generator (void *cls, * all of the transports. * * @param cls unused - * @param tc scheduler context */ static void -refresh_hello_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +refresh_hello_task (void *cls) { struct GeneratorContext gc; @@ -243,7 +241,7 @@ GST_hello_start (int friend_only, hello_cb = cb; hello_cb_cls = cb_cls; friend_option = friend_only; - refresh_hello_task (NULL, NULL); + refresh_hello_task (NULL); } diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c index 6eef8f300d..bd3fed6d70 100644 --- a/src/transport/gnunet-service-transport_manipulation.c +++ b/src/transport/gnunet-service-transport_manipulation.c @@ -224,11 +224,9 @@ GST_manipulation_set_metric (void *cls, * message. * * @param cls the `struct DelayQueueEntry` to transmit - * @param tc unused */ static void -send_delayed (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +send_delayed (void *cls) { struct DelayQueueEntry *dqe = cls; struct DelayQueueEntry *next; diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 0f1e86fe69..65428ef2a0 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -695,11 +695,9 @@ free_address (struct NeighbourAddress *na) * clean up after disconnect). * * @param cls the `struct NeighbourMapEntry` for which we are running - * @param tc scheduler context (unused) */ static void -master_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +master_task (void *cls); /** @@ -2814,11 +2812,9 @@ send_utilization_data (void *cls, * Task transmitting utilization in a regular interval * * @param cls the 'struct NeighbourMapEntry' for which we are running - * @param tc scheduler context (unused) */ static void -utilization_transmission (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +utilization_transmission (void *cls) { util_transmission_tk = NULL; GNUNET_CONTAINER_multipeermap_iterate (neighbours, @@ -2883,11 +2879,9 @@ GST_neighbours_notify_data_sent (const struct GNUNET_HELLO_Address *address, * clean up after disconnect). * * @param cls the 'struct NeighbourMapEntry' for which we are running - * @param tc scheduler context (unused) */ static void -master_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +master_task (void *cls) { struct NeighbourMapEntry *n = cls; struct GNUNET_TIME_Relative delay; @@ -3448,11 +3442,9 @@ GST_neighbours_test_connected (const struct GNUNET_PeerIdentity *target) * Task to asynchronously run #free_neighbour(). * * @param cls the `struct NeighbourMapEntry` to free - * @param tc unused */ static void -delayed_disconnect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext* tc) +delayed_disconnect (void *cls) { struct NeighbourMapEntry *n = cls; diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 9b8d750f03..836aa418c8 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c @@ -463,11 +463,9 @@ cleanup_validation_entry (void *cls, * longer valid and then possibly triggers its removal. * * @param cls the `struct ValidationEntry` - * @param tc scheduler context (unused) */ static void -timeout_hello_validation (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_hello_validation (void *cls) { struct ValidationEntry *ve = cls; struct GNUNET_TIME_Absolute max; @@ -652,11 +650,9 @@ transmit_ping_if_allowed (void *cls, * Do address validation again to keep address valid. * * @param cls the `struct ValidationEntry` - * @param tc scheduler context (unused) */ static void -revalidate_address (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +revalidate_address (void *cls) { struct ValidationEntry *ve = cls; struct GNUNET_TIME_Relative canonical_delay; diff --git a/src/transport/gnunet-transport-profiler.c b/src/transport/gnunet-transport-profiler.c index ed18bf418e..624d1a16cb 100644 --- a/src/transport/gnunet-transport-profiler.c +++ b/src/transport/gnunet-transport-profiler.c @@ -161,11 +161,9 @@ static int verbosity; * Stops monitoring activity. * * @param cls NULL - * @param tc scheduler context */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct Iteration *icur; struct Iteration *inext; diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index 03bece6b73..bed9bdc854 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c @@ -487,11 +487,9 @@ destroy_it (void *cls, * Stops monitoring activity. * * @param cls NULL - * @param tc scheduler context */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct GNUNET_TIME_Relative duration; struct ValidationResolutionContext *cur; @@ -598,8 +596,7 @@ shutdown_task (void *cls, * We are done, shut down. */ static void -operation_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +operation_timeout (void *cls) { struct PeerResolutionContext *cur; struct PeerResolutionContext *next; diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index cd47104178..2b0b8939e8 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c @@ -557,8 +557,7 @@ client_reschedule_session_timeout (struct GNUNET_ATS_Session *s) * @param tc gnunet scheduler task context */ static void -client_run (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +client_run (void *cls); /** @@ -997,11 +996,9 @@ client_lookup_session (struct HTTP_Client_Plugin *plugin, * is the delayed task that actually disconnects the PUT. * * @param cls the `struct GNUNET_ATS_Session *` with the put - * @param tc scheduler context */ static void -client_put_disconnect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +client_put_disconnect (void *cls) { struct GNUNET_ATS_Session *s = cls; @@ -1128,15 +1125,15 @@ client_send_cb (void *stream, * Wake up a curl handle which was suspended * * @param cls the session - * @param tc task context */ static void -client_wake_up (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +client_wake_up (void *cls) { struct GNUNET_ATS_Session *s = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; s->recv_wakeup_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -1293,11 +1290,9 @@ client_receive (void *stream, * Task performing curl operations * * @param cls plugin as closure - * @param tc scheduler task context */ static void -client_run (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +client_run (void *cls) { struct HTTP_Client_Plugin *plugin = cls; int running; @@ -1306,8 +1301,10 @@ client_run (void *cls, CURLMsg *msg; int put_request; /* GNUNET_YES if easy handle is put, GNUNET_NO for get */ int msgs_left; + const struct GNUNET_SCHEDULER_TaskContext *tc; plugin->client_perform_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -1963,11 +1960,9 @@ http_client_plugin_get_network_for_address (void *cls, * Session was idle, so disconnect it * * @param cls the `struct GNUNET_ATS_Session` of the idle session - * @param tc scheduler context */ static void -client_session_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +client_session_timeout (void *cls) { struct GNUNET_ATS_Session *s = cls; struct GNUNET_TIME_Relative left; diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index cc1548f200..dfd0294e57 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c @@ -491,14 +491,14 @@ notify_session_monitor (struct HTTP_Server_Plugin *plugin, * Wake up an MHD connection which was suspended * * @param cls the session - * @param tc task context */ static void -server_wake_up (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +server_wake_up (void *cls) { struct GNUNET_ATS_Session *s = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); s->recv_wakeup_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -641,11 +641,9 @@ http_server_plugin_disconnect_session (void *cls, * Session was idle, so disconnect it * * @param cls the session - * @param tc task context */ static void -server_session_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +server_session_timeout (void *cls) { struct GNUNET_ATS_Session *s = cls; struct GNUNET_TIME_Relative left; @@ -910,15 +908,15 @@ http_server_plugin_get_session (void *cls, * and schedule the next run. * * @param cls plugin as closure - * @param tc task context */ static void -server_v4_run (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +server_v4_run (void *cls) { struct HTTP_Server_Plugin *plugin = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; plugin->server_v4_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; plugin->server_v4_immediately = GNUNET_NO; @@ -932,15 +930,15 @@ server_v4_run (void *cls, * and schedule the next run. * * @param cls plugin as closure - * @param tc task context */ static void -server_v6_run (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +server_v6_run (void *cls) { struct HTTP_Server_Plugin *plugin = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; plugin->server_v6_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; plugin->server_v6_immediately = GNUNET_NO; @@ -2844,19 +2842,19 @@ server_check_ipv6_support (struct HTTP_Server_Plugin *plugin) * Notify server about our external hostname * * @param cls plugin - * @param tc task context (unused) */ static void -server_notify_external_hostname (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +server_notify_external_hostname (void *cls) { struct HTTP_Server_Plugin *plugin = cls; struct HttpAddress *ext_addr; size_t ext_addr_len; unsigned int urlen; char *url; + const struct GNUNET_SCHEDULER_TaskContext *tc; plugin->notify_ext_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 52ab4414fc..b1c68acdf4 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c @@ -957,11 +957,9 @@ tcp_plugin_query_keepalive_factor (void *cls) * Session was idle for too long, so disconnect it * * @param cls the `struct GNUNET_ATS_Session` of the idle session - * @param tc scheduler context */ static void -session_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +session_timeout (void *cls) { struct GNUNET_ATS_Session *s = cls; struct GNUNET_TIME_Relative left; @@ -1457,11 +1455,9 @@ session_lookup_it (void *cls, * Task cleaning up a NAT connection attempt after timeout * * @param cls the `struct GNUNET_ATS_Session` - * @param tc scheduler context (unused) */ static void -nat_connect_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +nat_connect_timeout (void *cls) { struct GNUNET_ATS_Session *session = cls; @@ -1500,11 +1496,9 @@ tcp_plugin_update_session_timeout (void *cls, * receiving from the TCP client now. * * @param cls the `struct GNUNET_ATS_Session *` - * @param tc task context (unused) */ static void -delayed_done (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +delayed_done (void *cls) { struct GNUNET_ATS_Session *session = cls; diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index ef470ffd18..89feb8f5ce 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c @@ -728,11 +728,9 @@ udp_plugin_get_network_for_address (void *cls, * Then reschedule this function to be called again once more is available. * * @param cls the plugin handle - * @param tc the scheduling context (for rescheduling this function again) */ static void -udp_plugin_select_v4 (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +udp_plugin_select_v4 (void *cls); /** @@ -741,11 +739,9 @@ udp_plugin_select_v4 (void *cls, * Then reschedule this function to be called again once more is available. * * @param cls the plugin handle - * @param tc the scheduling context (for rescheduling this function again) */ static void -udp_plugin_select_v6 (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +udp_plugin_select_v6 (void *cls); /** @@ -2566,11 +2562,9 @@ udp_disconnect (void *cls, * Session was idle, so disconnect it. * * @param cls the `struct GNUNET_ATS_Session` to time out - * @param tc scheduler context */ static void -session_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +session_timeout (void *cls) { struct GNUNET_ATS_Session *s = cls; struct Plugin *plugin = s->plugin; @@ -3516,14 +3510,14 @@ udp_select_send (struct Plugin *plugin, * Then reschedule this function to be called again once more is available. * * @param cls the plugin handle - * @param tc the scheduling context */ static void -udp_plugin_select_v4 (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +udp_plugin_select_v4 (void *cls) { struct Plugin *plugin = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); plugin->select_task_v4 = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -3546,14 +3540,14 @@ udp_plugin_select_v4 (void *cls, * Then reschedule this function to be called again once more is available. * * @param cls the plugin handle - * @param tc the scheduling context */ static void -udp_plugin_select_v6 (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +udp_plugin_select_v6 (void *cls) { struct Plugin *plugin = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); plugin->select_task_v6 = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c index b2c9e1515b..6c5efd5f11 100644 --- a/src/transport/plugin_transport_udp_broadcasting.c +++ b/src/transport/plugin_transport_udp_broadcasting.c @@ -232,8 +232,7 @@ prepare_beacon (struct Plugin *plugin, static void -udp_ipv4_broadcast_send (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +udp_ipv4_broadcast_send (void *cls) { struct BroadcastAddress *baddr = cls; struct Plugin *plugin = baddr->plugin; @@ -308,8 +307,7 @@ udp_ipv4_broadcast_send (void *cls, static void -udp_ipv6_broadcast_send (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +udp_ipv6_broadcast_send (void *cls) { struct BroadcastAddress *baddr = cls; struct Plugin *plugin = baddr->plugin; diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index 5ad5a04323..e320785d41 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c @@ -498,11 +498,9 @@ unix_plugin_session_disconnect (void *cls, * Session was idle for too long, so disconnect it * * @param cls the `struct GNUNET_ATS_Session *` to disconnect - * @param tc scheduler context */ static void -session_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +session_timeout (void *cls) { struct GNUNET_ATS_Session *session = cls; struct GNUNET_TIME_Relative left; @@ -1225,14 +1223,14 @@ unix_plugin_do_write (struct Plugin *plugin) * Then reschedule this function to be called again once more is available. * * @param cls the plugin handle - * @param tc the scheduling context */ static void -unix_plugin_select_read (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +unix_plugin_select_read (void *cls) { struct Plugin *plugin = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); plugin->read_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -1250,14 +1248,14 @@ unix_plugin_select_read (void *cls, * Then reschedule this function to be called again once more is available. * * @param cls the plugin handle - * @param tc the scheduling context */ static void -unix_plugin_select_write (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +unix_plugin_select_write (void *cls) { struct Plugin *plugin = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); plugin->write_task = NULL; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -1617,11 +1615,9 @@ unix_plugin_string_to_address (void *cls, * Notify transport service about address * * @param cls the plugin - * @param tc unused */ static void -address_notification (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +address_notification (void *cls) { struct Plugin *plugin = cls; struct GNUNET_HELLO_Address *address; diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 6e23299b96..9c9c1e8c24 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c @@ -828,11 +828,9 @@ wlan_plugin_query_keepalive_factor (void *cls) * A session is timing out. Clean up. * * @param cls pointer to the Session - * @param tc unused */ static void -session_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +session_timeout (void *cls) { struct GNUNET_ATS_Session *session = cls; struct GNUNET_TIME_Relative left; @@ -1072,11 +1070,9 @@ free_fragment_message (struct FragmentMessage *fm) * A FragmentMessage has timed out. Remove it. * * @param cls pointer to the 'struct FragmentMessage' - * @param tc unused */ static void -fragmentmessage_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +fragmentmessage_timeout (void *cls) { struct FragmentMessage *fm = cls; @@ -1200,11 +1196,9 @@ free_macendpoint (struct MacEndpoint *endpoint) * A MAC endpoint is timing out. Clean up. * * @param cls pointer to the `struct MacEndpoint *` - * @param tc pointer to the GNUNET_SCHEDULER_TaskContext */ static void -macendpoint_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +macendpoint_timeout (void *cls) { struct MacEndpoint *endpoint = cls; struct GNUNET_TIME_Relative timeout; @@ -1681,11 +1675,9 @@ process_data (void *cls, * Task to (periodically) send a HELLO beacon * * @param cls pointer to the plugin struct - * @param tc scheduler context */ static void -send_hello_beacon (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +send_hello_beacon (void *cls) { struct Plugin *plugin = cls; uint16_t size; diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index b906020bb0..e75cb7c7f8 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c @@ -184,7 +184,7 @@ end () static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { struct AddressWrapper *w; int c = 0; @@ -255,7 +255,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } static void -wait_end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +wait_end (void *cls) { timeout_wait = NULL; if (0 == addresses_reported) @@ -325,8 +325,7 @@ address_pretty_printer_cb (void *cls, const char *address, int res) static void -test_addr_string (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +test_addr_string (void *cls) { struct AddressWrapper *w = cls; void *s2a; diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index ad1ecbe7af..3889aa0ef7 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c @@ -354,7 +354,7 @@ sendtask () static void -measure (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +measure (void *cls) { static int counter; diff --git a/src/transport/test_transport_address_switch.c b/src/transport/test_transport_address_switch.c index 2780767ffc..6c86a160f4 100644 --- a/src/transport/test_transport_address_switch.c +++ b/src/transport/test_transport_address_switch.c @@ -564,8 +564,7 @@ sendtask () static void -progress_indicator (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +progress_indicator (void *cls) { static int counter; diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index 2ebd80a0c1..13333b3716 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c @@ -96,8 +96,9 @@ end () GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); } + static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { die_task = NULL; @@ -225,10 +226,12 @@ notify_ready (void *cls, size_t size, void *buf) static void -sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +sendtask (void *cls) { - send_task = NULL; + const struct GNUNET_SCHEDULER_TaskContext *tc; + send_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id)); diff --git a/src/transport/test_transport_api_bidirectional_connect.c b/src/transport/test_transport_api_bidirectional_connect.c index 30de6b7ba7..1e00e982d9 100644 --- a/src/transport/test_transport_api_bidirectional_connect.c +++ b/src/transport/test_transport_api_bidirectional_connect.c @@ -95,7 +95,7 @@ end () static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); @@ -208,10 +208,12 @@ notify_ready (void *cls, size_t size, void *buf) static void -sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +sendtask (void *cls) { - send_task = NULL; + const struct GNUNET_SCHEDULER_TaskContext *tc; + send_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id)); diff --git a/src/transport/test_transport_api_blacklisting.c b/src/transport/test_transport_api_blacklisting.c index 275567131f..f65fb74f95 100644 --- a/src/transport/test_transport_api_blacklisting.c +++ b/src/transport/test_transport_api_blacklisting.c @@ -76,7 +76,7 @@ static struct GNUNET_SCHEDULER_Task * shutdown_task; static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping\n"); @@ -136,8 +136,9 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } } + static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { if (send_task != NULL) { @@ -259,10 +260,12 @@ notify_ready (void *cls, size_t size, void *buf) static void -sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +sendtask (void *cls) { - send_task = NULL; + const struct GNUNET_SCHEDULER_TaskContext *tc; + send_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id)); diff --git a/src/transport/test_transport_api_disconnect.c b/src/transport/test_transport_api_disconnect.c index c6b247c1d8..36497ece55 100644 --- a/src/transport/test_transport_api_disconnect.c +++ b/src/transport/test_transport_api_disconnect.c @@ -107,8 +107,9 @@ end () ok = 0; } + static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { die_task = NULL; @@ -162,8 +163,11 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) static void -stop_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +stop_peer (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -248,10 +252,12 @@ notify_ready (void *cls, size_t size, void *buf) static void -sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +sendtask (void *cls) { - send_task = NULL; + const struct GNUNET_SCHEDULER_TaskContext *tc; + send_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id)); diff --git a/src/transport/test_transport_api_limited_sockets.c b/src/transport/test_transport_api_limited_sockets.c index 284f5b9ccf..8d875ed52e 100644 --- a/src/transport/test_transport_api_limited_sockets.c +++ b/src/transport/test_transport_api_limited_sockets.c @@ -102,7 +102,7 @@ end () } static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { die_task = NULL; @@ -194,11 +194,14 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) th = NULL; } + static void -sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +sendtask (void *cls) { - send_task = NULL; + const struct GNUNET_SCHEDULER_TaskContext *tc; + send_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -354,4 +357,3 @@ main (int argc, char *argv[]) #endif /* end of test_transport_api_limited_sockets.c */ - diff --git a/src/transport/test_transport_api_manipulation_cfg.c b/src/transport/test_transport_api_manipulation_cfg.c index 89d5fe4d9d..915b797193 100644 --- a/src/transport/test_transport_api_manipulation_cfg.c +++ b/src/transport/test_transport_api_manipulation_cfg.c @@ -109,7 +109,7 @@ end () static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { die_task = NULL; @@ -204,11 +204,12 @@ notify_request_ready (void *cls, size_t size, void *buf) static void -sendtask_request_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +sendtask_request_task (void *cls) { - send_task = NULL; + const struct GNUNET_SCHEDULER_TaskContext *tc; + send_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p2->id)); @@ -269,11 +270,12 @@ notify_response_ready (void *cls, size_t size, void *buf) static void -sendtask_response_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +sendtask_response_task (void *cls) { - send_task = NULL; + const struct GNUNET_SCHEDULER_TaskContext *tc; + send_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; { diff --git a/src/transport/test_transport_api_manipulation_recv_tcp.c b/src/transport/test_transport_api_manipulation_recv_tcp.c index f48abfc7c2..7b82236f9a 100644 --- a/src/transport/test_transport_api_manipulation_recv_tcp.c +++ b/src/transport/test_transport_api_manipulation_recv_tcp.c @@ -104,8 +104,9 @@ end () GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); } + static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { die_task = NULL; @@ -158,7 +159,8 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +sendtask (void *cls); + static void notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, @@ -288,11 +290,12 @@ notify_ready (void *cls, size_t size, void *buf) static void -sendtask (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +sendtask (void *cls) { - send_task = NULL; + const struct GNUNET_SCHEDULER_TaskContext *tc; + send_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id)); diff --git a/src/transport/test_transport_api_manipulation_send_tcp.c b/src/transport/test_transport_api_manipulation_send_tcp.c index c2eaf7a508..22b420c279 100644 --- a/src/transport/test_transport_api_manipulation_send_tcp.c +++ b/src/transport/test_transport_api_manipulation_send_tcp.c @@ -107,7 +107,7 @@ end () static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { die_task = NULL; @@ -160,7 +160,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +sendtask (void *cls); static void @@ -284,13 +284,14 @@ notify_ready (void *cls, size_t size, void *buf) static void -sendtask (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +sendtask (void *cls) { struct GNUNET_TIME_Relative delay; struct GNUNET_ATS_Properties prop; + const struct GNUNET_SCHEDULER_TaskContext *tc; send_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id)); diff --git a/src/transport/test_transport_api_monitor_peers.c b/src/transport/test_transport_api_monitor_peers.c index 152667a0be..79b39325c8 100644 --- a/src/transport/test_transport_api_monitor_peers.c +++ b/src/transport/test_transport_api_monitor_peers.c @@ -129,8 +129,7 @@ end () static void -end_badly (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { die_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Fail! Stopping peers\n"); @@ -261,10 +260,12 @@ notify_ready (void *cls, size_t size, void *buf) static void -sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +sendtask (void *cls) { - send_task = NULL; + const struct GNUNET_SCHEDULER_TaskContext *tc; + send_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id)); diff --git a/src/transport/test_transport_api_monitor_validation.c b/src/transport/test_transport_api_monitor_validation.c index 907b9275f0..37b8494f12 100644 --- a/src/transport/test_transport_api_monitor_validation.c +++ b/src/transport/test_transport_api_monitor_validation.c @@ -122,7 +122,7 @@ end () } static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { die_task = NULL; @@ -273,10 +273,12 @@ notify_ready (void *cls, static void -sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +sendtask (void *cls) { - send_task = NULL; + const struct GNUNET_SCHEDULER_TaskContext *tc; + send_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id)); diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 86f2942405..cc2115a48f 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c @@ -526,8 +526,7 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) static void -sendtask (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +sendtask (void *cls) { start_time = GNUNET_TIME_absolute_get (); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, diff --git a/src/transport/test_transport_api_restart_1peer.c b/src/transport/test_transport_api_restart_1peer.c index f51b70e928..adec15f4f5 100644 --- a/src/transport/test_transport_api_restart_1peer.c +++ b/src/transport/test_transport_api_restart_1peer.c @@ -112,8 +112,7 @@ end () static void -end_badly (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { die_task = NULL; @@ -259,10 +258,12 @@ notify_ready (void *cls, size_t size, void *buf) static void -sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +sendtask (void *cls) { - send_task = NULL; + const struct GNUNET_SCHEDULER_TaskContext *tc; + send_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id)); diff --git a/src/transport/test_transport_api_restart_2peers.c b/src/transport/test_transport_api_restart_2peers.c index 985148d549..2a669c9a02 100644 --- a/src/transport/test_transport_api_restart_2peers.c +++ b/src/transport/test_transport_api_restart_2peers.c @@ -105,8 +105,7 @@ end () static void -end_badly (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { die_task = NULL; @@ -265,11 +264,12 @@ notify_ready (void *cls, static void -sendtask (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +sendtask (void *cls) { - send_task = NULL; + const struct GNUNET_SCHEDULER_TaskContext *tc; + send_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; diff --git a/src/transport/test_transport_api_timeout.c b/src/transport/test_transport_api_timeout.c index 256ce46a87..aa9884a2eb 100644 --- a/src/transport/test_transport_api_timeout.c +++ b/src/transport/test_transport_api_timeout.c @@ -120,8 +120,9 @@ end () GNUNET_TRANSPORT_TESTING_done (tth); } + static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { die_task = NULL; @@ -181,12 +182,13 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) static void -timer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +timer (void *cls) { static int percentage; + const struct GNUNET_SCHEDULER_TaskContext *tc; timer_task = NULL; - + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; diff --git a/src/transport/test_transport_blacklisting.c b/src/transport/test_transport_blacklisting.c index 8ac198cfe6..6cb598f2f0 100644 --- a/src/transport/test_transport_blacklisting.c +++ b/src/transport/test_transport_blacklisting.c @@ -85,11 +85,13 @@ static struct GNUNET_SCHEDULER_Task * stage_task; #define OKPP do { ok++; } while (0) #endif + static void -run_stage(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +run_stage(void *cls); + static void -end(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Stopping\n"); @@ -129,8 +131,9 @@ end(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } } + static void -end_badly(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { die_task = NULL; @@ -172,17 +175,20 @@ testing_connect_cb(struct PeerContext *p1, struct PeerContext *p2, void *cls) stage_task = GNUNET_SCHEDULER_add_now (&run_stage, NULL ); } + static void -connect_timeout(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +connect_timeout(void *cls) { GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Peers not connected, next stage\n"); timeout_task = NULL; - stage_task = GNUNET_SCHEDULER_add_now (&run_stage, NULL ); + stage_task = GNUNET_SCHEDULER_add_now (&run_stage, NULL); } + static int started; -void + +static void start_cb(struct PeerContext *p, void *cls) { @@ -243,8 +249,9 @@ static int check_blacklist_config (char *cfg_file, return GNUNET_OK; } + static void -run_stage(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +run_stage (void *cls) { stage_task = NULL; if (NULL != die_task) diff --git a/src/transport/test_transport_startonly.c b/src/transport/test_transport_startonly.c index b23a516f5f..d49e3a8c02 100644 --- a/src/transport/test_transport_startonly.c +++ b/src/transport/test_transport_startonly.c @@ -63,9 +63,13 @@ end () GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Exiting\n"); } + static void -end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_badly (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + + tc = GNUNET_SCHEDULER_get_task_context (); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); timeout_task = NULL; diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c index 7538e2d6a3..652a4e08f6 100644 --- a/src/transport/transport-testing.c +++ b/src/transport/transport-testing.c @@ -195,11 +195,9 @@ get_hello (void *cb_cls, * Offer the current HELLO of P2 to P1. * * @param cls our `struct GNUNET_TRANSPORT_TESTING_ConnectRequest ` - * @param tc scheduler context */ static void -offer_hello (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +offer_hello (void *cls); /** @@ -207,8 +205,7 @@ offer_hello (void *cls, * transport service. */ static void -hello_offered (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +hello_offered (void *cls) { struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = cls; @@ -224,17 +221,17 @@ hello_offered (void *cls, * Offer the current HELLO of P2 to P1. * * @param cls our `struct GNUNET_TRANSPORT_TESTING_ConnectRequest ` - * @param tc scheduler context */ static void -offer_hello (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +offer_hello (void *cls) { struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = cls; struct PeerContext *p1 = cc->p1; struct PeerContext *p2 = cc->p2; + const struct GNUNET_SCHEDULER_TaskContext *tc; cc->tct = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; { diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index b5f9e0a6b5..6fc538f255 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c @@ -401,11 +401,9 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h); * A neighbour has not gotten a SEND_OK in a while. Print a warning. * * @param cls the `struct Neighbour` - * @param tc scheduler context */ static void -do_warn_unready (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_warn_unready (void *cls) { struct Neighbour *n = cls; struct GNUNET_TIME_Relative delay; @@ -830,11 +828,9 @@ demultiplexer (void *cls, * network congestion. Notify the initiator and clean up. * * @param cls the `struct GNUNET_TRANSPORT_TransmitHandle` - * @param tc scheduler context */ static void -timeout_request_due_to_congestion (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_request_due_to_congestion (void *cls) { struct GNUNET_TRANSPORT_TransmitHandle *th = cls; struct Neighbour *n = th->neighbour; @@ -1015,11 +1011,9 @@ transport_notify_ready (void *cls, * list or the peer message queues to the service. * * @param cls transport service to schedule a transmission for - * @param tc scheduler context */ static void -schedule_transmission_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +schedule_transmission_task (void *cls) { struct GNUNET_TRANSPORT_Handle *h = cls; size_t size; @@ -1197,15 +1191,15 @@ send_start (void *cls, * Try again to connect to transport service. * * @param cls the handle to the transport service - * @param tc scheduler context */ static void -reconnect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect (void *cls) { struct GNUNET_TRANSPORT_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)) { /* shutdown, just give up */ @@ -1315,19 +1309,14 @@ send_hello (void *cls, struct GNUNET_TRANSPORT_OfferHelloHandle *ohh = cls; struct GNUNET_MessageHeader *msg = ohh->msg; uint16_t ssize; - struct GNUNET_SCHEDULER_TaskContext tc; - tc.read_ready = NULL; - tc.write_ready = NULL; - tc.reason = GNUNET_SCHEDULER_REASON_TIMEOUT; if (NULL == buf) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Timeout while trying to transmit `%s' request.\n", "HELLO"); if (NULL != ohh->cont) - ohh->cont (ohh->cls, - &tc); + ohh->cont (ohh->cls); GNUNET_free (msg); GNUNET_CONTAINER_DLL_remove (ohh->th->oh_head, ohh->th->oh_tail, @@ -1344,10 +1333,8 @@ send_hello (void *cls, msg, ssize); GNUNET_free (msg); - tc.reason = GNUNET_SCHEDULER_REASON_READ_READY; if (NULL != ohh->cont) - ohh->cont (ohh->cls, - &tc); + ohh->cont (ohh->cls); GNUNET_CONTAINER_DLL_remove (ohh->th->oh_head, ohh->th->oh_tail, ohh); @@ -1529,11 +1516,9 @@ GNUNET_TRANSPORT_check_peer_connected (struct GNUNET_TRANSPORT_Handle *handle, * Task to call the HelloUpdateCallback of the GetHelloHandle * * @param cls the `struct GNUNET_TRANSPORT_GetHelloHandle` - * @param tc the scheduler task context */ static void -call_hello_update_cb_async (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +call_hello_update_cb_async (void *cls) { struct GNUNET_TRANSPORT_GetHelloHandle *ghh = cls; diff --git a/src/transport/transport_api_monitor_peers.c b/src/transport/transport_api_monitor_peers.c index 1094610909..5d19ad6d7a 100644 --- a/src/transport/transport_api_monitor_peers.c +++ b/src/transport/transport_api_monitor_peers.c @@ -204,11 +204,9 @@ send_peer_mon_request (struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx) * Task run to re-establish the connection. * * @param cls our `struct GNUNET_TRANSPORT_PeerMonitoringContext *` - * @param tc scheduler context, unused */ static void -do_peer_connect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_peer_connect (void *cls) { struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx = cls; diff --git a/src/transport/transport_api_monitor_plugins.c b/src/transport/transport_api_monitor_plugins.c index 9a7b3e44f1..eef4a08306 100644 --- a/src/transport/transport_api_monitor_plugins.c +++ b/src/transport/transport_api_monitor_plugins.c @@ -133,11 +133,9 @@ send_plugin_mon_request (struct GNUNET_TRANSPORT_PluginMonitor *pm) * Task run to re-establish the connection. * * @param cls our `struct GNUNET_TRANSPORT_PluginMonitor *` - * @param tc scheduler context, unused */ static void -do_plugin_connect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_plugin_connect (void *cls) { struct GNUNET_TRANSPORT_PluginMonitor *pm = cls; diff --git a/src/transport/transport_api_monitor_validation.c b/src/transport/transport_api_monitor_validation.c index 04463c86af..fa76645dd7 100644 --- a/src/transport/transport_api_monitor_validation.c +++ b/src/transport/transport_api_monitor_validation.c @@ -154,11 +154,9 @@ send_val_mon_request (struct GNUNET_TRANSPORT_ValidationMonitoringContext *val_c * Task run to re-establish the connection. * * @param cls our `struct GNUNET_TRANSPORT_ValidationMonitoringContext *` - * @param tc scheduler context, unused */ static void -do_val_connect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_val_connect (void *cls) { struct GNUNET_TRANSPORT_ValidationMonitoringContext *val_ctx = cls; @@ -293,7 +291,7 @@ val_response_processor (void *cls, } addr = (const char *) &vr_msg[1]; transport_name = &addr[alen]; - + if (transport_name[tlen - 1] != '\0') { /* Corrupt plugin name */ @@ -314,7 +312,7 @@ val_response_processor (void *cls, } return; } - + /* notify client */ address = GNUNET_HELLO_address_allocate (&vr_msg->peer, transport_name, diff --git a/src/util/bandwidth.c b/src/util/bandwidth.c index 5fbb608e71..2df2a9449f 100644 --- a/src/util/bandwidth.c +++ b/src/util/bandwidth.c @@ -142,11 +142,9 @@ GNUNET_BANDWIDTH_value_get_delay_for (struct GNUNET_BANDWIDTH_Value32NBO bps, * Task run whenever we hit the bandwidth limit for a tracker. * * @param cls the `struct GNUNET_BANDWIDTH_Tracker` - * @param tc scheduler context */ static void -excess_trigger (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +excess_trigger (void *cls) { struct GNUNET_BANDWIDTH_Tracker *av = cls; diff --git a/src/util/client.c b/src/util/client.c index d87be74f6d..f93fd1d109 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -579,11 +579,9 @@ receive_helper (void *cls, * Continuation to call the receive callback. * * @param cls our handle to the client connection - * @param tc scheduler context */ static void -receive_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +receive_task (void *cls) { struct GNUNET_CLIENT_Connection *client = cls; GNUNET_CLIENT_MessageHandler handler = client->receiver_handler; @@ -746,11 +744,9 @@ GNUNET_CLIENT_service_test_cancel (struct GNUNET_CLIENT_TestHandle *th) * and then cleans up. * * @param cls the `struct GNUNET_CLIENT_TestHandle` - * @param tc scheduler context */ static void -report_result (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +report_result (void *cls) { struct GNUNET_CLIENT_TestHandle *th = cls; @@ -1080,16 +1076,16 @@ client_notify (void *cls, size_t size, void *buf); * service after a while. * * @param cls our `struct GNUNET_CLIENT_TransmitHandle` of the request - * @param tc unused */ static void -client_delayed_retry (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +client_delayed_retry (void *cls) { struct GNUNET_CLIENT_TransmitHandle *th = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; struct GNUNET_TIME_Relative delay; th->reconnect_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { /* give up, was shutdown */ @@ -1153,11 +1149,14 @@ client_notify (void *cls, struct GNUNET_CLIENT_Connection *client = th->client; size_t ret; struct GNUNET_TIME_Relative delay; + const struct GNUNET_SCHEDULER_TaskContext *tc; + LOG (GNUNET_ERROR_TYPE_DEBUG, "client_notify is running\n"); th->th = NULL; client->th = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (NULL == buf) { delay = GNUNET_TIME_absolute_get_remaining (th->timeout); @@ -1165,7 +1164,7 @@ client_notify (void *cls, if ( (GNUNET_YES != th->auto_retry) || (0 == --th->attempts_left) || (delay.rel_value_us < 1)|| - (0 != (GNUNET_SCHEDULER_get_reason() & GNUNET_SCHEDULER_REASON_SHUTDOWN))) + (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmission failed %u times, giving up.\n", diff --git a/src/util/client_manager.c b/src/util/client_manager.c index 12c37b23fe..f334bb5b61 100644 --- a/src/util/client_manager.c +++ b/src/util/client_manager.c @@ -240,7 +240,7 @@ transmit_next (struct GNUNET_CLIENT_MANAGER_Connection *mgr); static void -schedule_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +schedule_disconnect (void *cls) { struct GNUNET_CLIENT_MANAGER_Connection *mgr = cls; GNUNET_CLIENT_MANAGER_disconnect (mgr, GNUNET_NO, @@ -341,11 +341,9 @@ transmit_next (struct GNUNET_CLIENT_MANAGER_Connection *mgr) * * @param cls * Channel handle. - * @param tc - * Scheduler context. */ static void -schedule_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +schedule_reconnect (void *cls) { struct GNUNET_CLIENT_MANAGER_Connection *mgr = cls; mgr->reconnect_task = NULL; diff --git a/src/util/connection.c b/src/util/connection.c index 5aa277546a..b3ea3b5af6 100644 --- a/src/util/connection.c +++ b/src/util/connection.c @@ -606,10 +606,9 @@ connect_fail_continuation (struct GNUNET_CONNECTION_Handle *connection) * We are ready to transmit (or got a timeout). * * @param cls our connection handle - * @param tc task context describing why we are here */ static void -transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +transmit_ready (void *cls); /** @@ -617,10 +616,9 @@ transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); * to read. * * @param cls connection to read from - * @param tc scheduler context */ static void -receive_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +receive_ready (void *cls); /** @@ -668,15 +666,14 @@ connect_success_continuation (struct GNUNET_CONNECTION_Handle *connection) * Scheduler let us know that we're either ready to write on the * socket OR connect timed out. Do the right thing. * - * @param cls the "struct AddressProbe*" with the address that we are probing - * @param tc success or failure info about the connect attempt. + * @param cls the `struct AddressProbe *` with the address that we are probing */ static void -connect_probe_continuation (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +connect_probe_continuation (void *cls) { struct AddressProbe *ap = cls; struct GNUNET_CONNECTION_Handle *connection = ap->connection; + const struct GNUNET_SCHEDULER_TaskContext *tc; struct AddressProbe *pos; int error; socklen_t len; @@ -686,6 +683,7 @@ connect_probe_continuation (void *cls, len = sizeof (error); errno = 0; error = 0; + tc = GNUNET_SCHEDULER_get_task_context (); if ((0 == (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) || (GNUNET_OK != GNUNET_NETWORK_socket_getsockopt (ap->sock, SOL_SOCKET, SO_ERROR, &error, @@ -1095,18 +1093,18 @@ GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *connection) * or have data ready to read. * * @param cls connection to read from - * @param tc scheduler context */ static void -receive_ready (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +receive_ready (void *cls) { struct GNUNET_CONNECTION_Handle *connection = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; char buffer[connection->max]; ssize_t ret; GNUNET_CONNECTION_Receiver receiver; connection->read_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { /* ignore shutdown request, go again immediately */ @@ -1296,11 +1294,9 @@ process_notify (struct GNUNET_CONNECTION_Handle *connection) * This task notifies the client about the timeout. * * @param cls the `struct GNUNET_CONNECTION_Handle` - * @param tc scheduler context */ static void -transmit_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +transmit_timeout (void *cls) { struct GNUNET_CONNECTION_Handle *connection = cls; GNUNET_CONNECTION_TransmitReadyNotify notify; @@ -1327,11 +1323,9 @@ transmit_timeout (void *cls, * This task notifies the client about the error. * * @param cls the `struct GNUNET_CONNECTION_Handle` - * @param tc scheduler context */ static void -connect_error (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +connect_error (void *cls) { struct GNUNET_CONNECTION_Handle *connection = cls; GNUNET_CONNECTION_TransmitReadyNotify notify; @@ -1353,14 +1347,13 @@ connect_error (void *cls, * We are ready to transmit (or got a timeout). * * @param cls our connection handle - * @param tc task context describing why we are here */ static void -transmit_ready (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +transmit_ready (void *cls) { struct GNUNET_CONNECTION_Handle *connection = cls; GNUNET_CONNECTION_TransmitReadyNotify notify; + const struct GNUNET_SCHEDULER_TaskContext *tc; ssize_t ret; size_t have; @@ -1370,6 +1363,7 @@ transmit_ready (void *cls, GNUNET_assert (NULL != connection->write_task); connection->write_task = NULL; GNUNET_assert (NULL == connection->nth.timeout_task); + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { if (NULL != connection->sock) diff --git a/src/util/crypto_hash_file.c b/src/util/crypto_hash_file.c index 8bb03561b9..f2d49d1643 100644 --- a/src/util/crypto_hash_file.c +++ b/src/util/crypto_hash_file.c @@ -117,10 +117,9 @@ file_hash_finish (struct GNUNET_CRYPTO_FileHashContext *fhc, * File hashing task. * * @param cls closure - * @param tc context */ static void -file_hash_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +file_hash_task (void *cls) { struct GNUNET_CRYPTO_FileHashContext *fhc = cls; struct GNUNET_HashCode *res; diff --git a/src/util/disk_iterator.c b/src/util/disk_iterator.c index 925d4c6fdc..2315f2861a 100644 --- a/src/util/disk_iterator.c +++ b/src/util/disk_iterator.c @@ -77,8 +77,7 @@ struct GNUNET_DISK_DirectoryIterator * Task used by the directory iterator. */ static void -directory_iterator_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +directory_iterator_task (void *cls) { struct GNUNET_DISK_DirectoryIterator *iter = cls; char *name; diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c index 434574ef06..7449d80424 100644 --- a/src/util/gnunet-scrypt.c +++ b/src/util/gnunet-scrypt.c @@ -110,8 +110,7 @@ count_leading_zeroes (const struct GNUNET_HashCode *hash) * @param tc task context */ static void -find_proof (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +find_proof (void *cls) { #define ROUND_SIZE 10 uint64_t counter; @@ -121,7 +120,9 @@ find_proof (void *cls, unsigned int i; struct GNUNET_TIME_Absolute timestamp; struct GNUNET_TIME_Relative elapsed; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) { write_proof (); diff --git a/src/util/gnunet-uri.c b/src/util/gnunet-uri.c index ada67e3109..75e70d2b75 100644 --- a/src/util/gnunet-uri.c +++ b/src/util/gnunet-uri.c @@ -47,10 +47,9 @@ static struct GNUNET_DISK_PipeHandle *sigpipe; * process died) or when user presses CTRL-C. * * @param cls closure, NULL - * @param tc scheduler context */ static void -maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +maint_child_death (void *cls) { enum GNUNET_OS_ProcessStatusType type; if ( (GNUNET_OK != diff --git a/src/util/helper.c b/src/util/helper.c index f0123460b9..3ed1c7276f 100644 --- a/src/util/helper.c +++ b/src/util/helper.c @@ -138,7 +138,7 @@ struct GNUNET_HELPER_Handle * NULL-terminated list of command-line arguments. */ char **binary_argv; - + /** * Task to read from the helper. */ @@ -305,28 +305,26 @@ stop_helper (struct GNUNET_HELPER_Handle *h, * Restart the helper process. * * @param cls handle to the helper process - * @param tc scheduler context */ static void -restart_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +restart_task (void *cls); /** * Read from the helper-process * * @param cls handle to the helper process - * @param tc scheduler context */ static void -helper_read (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +helper_read (void *cls) { struct GNUNET_HELPER_Handle *h = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE] GNUNET_ALIGN; ssize_t t; h->read_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { /* try again */ @@ -458,17 +456,15 @@ start_helper (struct GNUNET_HELPER_Handle *h) * Restart the helper process. * * @param cls handle to the helper process - * @param tc scheduler context */ static void -restart_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +restart_task (void *cls) { struct GNUNET_HELPER_Handle*h = cls; h->restart_task = NULL; h->retry_back_off++; - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Restarting helper with back-off %u\n", h->retry_back_off); start_helper (h); @@ -582,18 +578,18 @@ GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, * Write to the helper-process * * @param cls handle to the helper process - * @param tc scheduler context */ static void -helper_write (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +helper_write (void *cls) { struct GNUNET_HELPER_Handle *h = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; struct GNUNET_HELPER_SendHandle *sh; const char *buf; ssize_t t; h->write_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { /* try again */ diff --git a/src/util/mq.c b/src/util/mq.c index f5ebe33a5b..aff9f465c0 100644 --- a/src/util/mq.c +++ b/src/util/mq.c @@ -297,15 +297,15 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, * results in undefined behavior if not used carefully. * * @param cls message queue to send the next message with - * @param tc scheduler context */ static void -impl_send_continue (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +impl_send_continue (void *cls) { struct GNUNET_MQ_Handle *mq = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; struct GNUNET_MQ_Envelope *current_envelope; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 52e2f6d0e8..8dfec6c5e8 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c @@ -70,18 +70,19 @@ static struct GNUNET_OS_Process current_process; * This handler is called when there are control data to be read on the pipe * * @param cls the 'struct GNUNET_DISK_FileHandle' of the control pipe - * @param tc scheduler context */ static void -parent_control_handler (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +parent_control_handler (void *cls) { struct GNUNET_DISK_FileHandle *control_pipe = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; char sig; char *pipe_fd; ssize_t ret; - LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' invoked because of %d\n", __FUNCTION__, + tc = GNUNET_SCHEDULER_get_task_context (); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "`%s' invoked because of %d\n", __FUNCTION__, tc->reason); if (0 != (tc->reason & (GNUNET_SCHEDULER_REASON_SHUTDOWN | GNUNET_SCHEDULER_REASON_TIMEOUT))) @@ -118,12 +119,9 @@ parent_control_handler (void *cls, * variable) and raise those signals. * * @param cls closure (unused) - * @param tc scheduler context (unused) */ void -GNUNET_OS_install_parent_control_handler (void *cls, - const struct - GNUNET_SCHEDULER_TaskContext *tc) +GNUNET_OS_install_parent_control_handler (void *cls) { const char *env_buf; char *env_buf_end; @@ -1751,18 +1749,19 @@ GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd) /** * Read from the process and call the line processor. * - * @param cls the 'struct GNUNET_OS_CommandHandle' - * @param tc scheduler context + * @param cls the `struct GNUNET_OS_CommandHandle *` */ static void -cmd_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +cmd_read (void *cls) { struct GNUNET_OS_CommandHandle *cmd = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; GNUNET_OS_LineProcessor proc; char *end; ssize_t ret; cmd->rtask = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (GNUNET_YES != GNUNET_NETWORK_fdset_handle_isset (tc->read_ready, cmd->r)) { /* timeout, shutdown, etc. */ diff --git a/src/util/program.c b/src/util/program.c index 7023552f61..69dd455cdd 100644 --- a/src/util/program.c +++ b/src/util/program.c @@ -73,10 +73,12 @@ struct CommandContext * program. Runs the program-specific main task. */ static void -program_main (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +program_main (void *cls) { struct CommandContext *cc = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; GNUNET_SPEEDUP_start_(cc->cfg); diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index 81ec01af4b..e7a836f03d 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c @@ -532,11 +532,9 @@ handle_response (void *cls, * numeric addresses. * * @param cls `struct GNUNET_RESOLVER_RequestHandle` for the request - * @param tc unused scheduler context */ static void -numeric_resolution (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +numeric_resolution (void *cls) { struct GNUNET_RESOLVER_RequestHandle *rh = cls; struct sockaddr_in v4; @@ -600,11 +598,9 @@ numeric_resolution (void *cls, * respective loopback numeric addresses. * * @param cls `struct GNUNET_RESOLVER_RequestHandle` for the request - * @param tc unused scheduler context */ static void -loopback_resolution (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +loopback_resolution (void *cls) { struct GNUNET_RESOLVER_RequestHandle *rh = cls; struct sockaddr_in v4; @@ -658,8 +654,7 @@ loopback_resolution (void *cls, * Task executed on system shutdown. */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { s_task = NULL; GNUNET_RESOLVER_disconnect (); @@ -728,15 +723,16 @@ process_requests () * Now try to reconnect to the resolver service. * * @param cls NULL - * @param tc scheduler context */ static void -reconnect_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect_task (void *cls) { + const struct GNUNET_SCHEDULER_TaskContext *tc; + r_task = NULL; if (NULL == req_head) return; /* no work pending */ + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -802,11 +798,9 @@ reconnect () * A DNS resolution timed out. Notify the application. * * @param cls the `struct GNUNET_RESOLVER_RequestHandle *` - * @param tc scheduler context */ static void -handle_lookup_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +handle_lookup_timeout (void *cls) { struct GNUNET_RESOLVER_RequestHandle *rh = cls; @@ -902,11 +896,9 @@ GNUNET_RESOLVER_ip_get (const char *hostname, * conversion and invoke the callback. * * @param cls `struct GNUNET_RESOLVER_RequestHandle` for the request - * @param tc unused scheduler context */ static void -numeric_reverse (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +numeric_reverse (void *cls) { struct GNUNET_RESOLVER_RequestHandle *rh = cls; char *result; diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 6405ea3369..dcf5aeeaa4 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c @@ -256,6 +256,11 @@ static int current_lifeness; static GNUNET_SCHEDULER_select scheduler_select; /** + * Task context of the current task. + */ +static struct GNUNET_SCHEDULER_TaskContext tc; + +/** * Closure for #scheduler_select. */ static void *scheduler_select_cls; @@ -533,7 +538,6 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, { enum GNUNET_SCHEDULER_Priority p; struct GNUNET_SCHEDULER_Task *pos; - struct GNUNET_SCHEDULER_TaskContext tc; max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP; do @@ -584,7 +588,7 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, LOG (GNUNET_ERROR_TYPE_DEBUG, "Running task: %p\n", pos); - pos->callback (pos->callback_cls, &tc); + pos->callback (pos->callback_cls); #if EXECINFO unsigned int i; @@ -902,17 +906,16 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task, /** - * Obtain the reason code for why the current task was - * started. Will return the same value as - * the `struct GNUNET_SCHEDULER_TaskContext`'s reason field. + * Obtain the task context, giving the reason why the current task was + * started. * - * @return reason(s) why the current task is run + * @return current tasks' scheduler context */ -enum GNUNET_SCHEDULER_Reason -GNUNET_SCHEDULER_get_reason () +const struct GNUNET_SCHEDULER_TaskContext * +GNUNET_SCHEDULER_get_task_context () { GNUNET_assert (NULL != active_task); - return active_task->reason; + return &tc; } diff --git a/src/util/server.c b/src/util/server.c index 0433feb580..8dedd28fd9 100644 --- a/src/util/server.c +++ b/src/util/server.c @@ -389,17 +389,17 @@ GNUNET_SERVER_client_set_user_context_ (struct GNUNET_SERVER_Client *client, * * @param cls handle to our server for which we are processing the listen * socket - * @param tc reason why we are running right now */ static void -process_listen_socket (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +process_listen_socket (void *cls) { struct GNUNET_SERVER_Handle *server = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; struct GNUNET_CONNECTION_Handle *sock; unsigned int i; server->listen_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { /* ignore shutdown, someone else will take care of it! */ @@ -655,12 +655,10 @@ GNUNET_SERVER_client_mark_monitor (struct GNUNET_SERVER_Client *client) * Helper function for #test_monitor_clients() to trigger * #GNUNET_SERVER_destroy() after the stack has unwound. * - * @param cls the 'struct GNUNET_SERVER_Handle' to destroy - * @param tc unused + * @param cls the `struct GNUNET_SERVER_Handle *` to destroy */ static void -do_destroy (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_destroy (void *cls) { struct GNUNET_SERVER_Handle *server = cls; @@ -887,18 +885,18 @@ GNUNET_SERVER_set_callbacks (struct GNUNET_SERVER_Handle *server, * Task run to warn about missing calls to #GNUNET_SERVER_receive_done. * * @param cls our `struct GNUNET_SERVER_Client *` to process more requests from - * @param tc scheduler context (unused) */ static void -warn_no_receive_done (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +warn_no_receive_done (void *cls) { struct GNUNET_SERVER_Client *client = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; GNUNET_break (0 != client->warn_type); /* type should never be 0 here, as we don't use 0 */ client->warn_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &warn_no_receive_done, client); + tc = GNUNET_SCHEDULER_get_task_context (); if (0 == (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) LOG (GNUNET_ERROR_TYPE_WARNING, _("Processing code for message of type %u did not call `GNUNET_SERVER_receive_done' after %s\n"), @@ -1199,11 +1197,9 @@ process_incoming (void *cls, * and process requests. * * @param cls our `struct GNUNET_SERVER_Client *` to process more requests from - * @param tc scheduler context (unused) */ static void -restart_processing (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +restart_processing (void *cls) { struct GNUNET_SERVER_Client *client = cls; @@ -1497,11 +1493,9 @@ GNUNET_SERVER_connect_notify_cancel (struct GNUNET_SERVER_Handle *server, * 'connection.c' is not allowed (see #2329). * * @param cls connection to destroy - * @param tc scheduler context (unused) */ static void -destroy_connection (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +destroy_connection (void *cls) { struct GNUNET_CONNECTION_Handle *connection = cls; diff --git a/src/util/service.c b/src/util/service.c index be3b4442a3..76e540302d 100644 --- a/src/util/service.c +++ b/src/util/service.c @@ -1126,11 +1126,9 @@ write_pid_file (struct GNUNET_SERVICE_Context *sctx, pid_t pid) * Task run during shutdown. Stops the server/service. * * @param cls the `struct GNUNET_SERVICE_Context` - * @param tc unused */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct GNUNET_SERVICE_Context *service = cls; struct GNUNET_SERVER_Handle *server = service->server; @@ -1147,14 +1145,15 @@ shutdown_task (void *cls, * Initial task for the service. * * @param cls service context - * @param tc unused */ static void -service_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +service_task (void *cls) { struct GNUNET_SERVICE_Context *sctx = cls; unsigned int i; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; (void) GNUNET_SPEEDUP_start_ (sctx->cfg); diff --git a/src/util/socks.c b/src/util/socks.c index 3fa18cca9c..cc59858dd3 100644 --- a/src/util/socks.c +++ b/src/util/socks.c @@ -105,7 +105,7 @@ unsigned char * SOCK5_proto_string(unsigned char * b, const char * s) /** * State of the SOCKS5 handshake. */ -struct GNUNET_SOCKS_Handshake +struct GNUNET_SOCKS_Handshake { /** @@ -124,7 +124,7 @@ struct GNUNET_SOCKS_Handshake struct GNUNET_CONNECTION_TransmitHandle *th; /** - * Our stage in the SOCKS5 handshake + * Our stage in the SOCKS5 handshake */ int step; @@ -199,7 +199,7 @@ SOCKS5_handshake_step (struct GNUNET_SOCKS_Handshake *ih) GNUNET_assert (SOCKS5_step_done > ih->step && ih->step >= 0); switch (ih->step) { case SOCKS5_step_greet: /* SOCKS5 server's greeting */ - if (b[0] != 5) + if (b[0] != 5) { LOG (GNUNET_ERROR_TYPE_ERROR, "Not a SOCKS5 server\n"); @@ -234,7 +234,7 @@ SOCKS5_handshake_step (struct GNUNET_SOCKS_Handshake *ih) b += 2; break; case SOCKS5_step_cmd: /* SOCKS5 server's responce to command */ - if (b[0] != 5) + if (b[0] != 5) { LOG (GNUNET_ERROR_TYPE_ERROR, "SOCKS5 protocol error\n"); @@ -271,11 +271,11 @@ SOCKS5_handshake_step (struct GNUNET_SOCKS_Handshake *ih) ih->instart = b; SOCKS5_handshake_done (ih); return; - case SOCKS5_step_done: + case SOCKS5_step_done: GNUNET_assert (0); } ih->instart = b; - /* Do not reschedule the sender unless we're done reading. + /* Do not reschedule the sender unless we're done reading. * I imagine this lets us avoid ever cancelling the transmit handle. */ register_sender (ih); } @@ -289,7 +289,7 @@ SOCKS5_handshake_step (struct GNUNET_SOCKS_Handshake *ih) * @param handler_cls closure for @a handler */ void -reciever (void *cls, +reciever (void *cls, const void *buf, size_t available, const struct sockaddr * addr, socklen_t addrlen, int errCode) @@ -330,7 +330,7 @@ register_reciever (struct GNUNET_SOCKS_Handshake *ih, int want) */ size_t -transmit_ready (void *cls, +transmit_ready (void *cls, size_t size, void *buf) { @@ -345,23 +345,28 @@ transmit_ready (void *cls, * GNUNET_CONNECTION_notify_transmit_ready() can schedule : * transmit_timeout() - DNS still working * connect_error() - DNS done but no socket? - * transmit_ready() - scheduler shutdown or timeout, or signal_transmit_error() + * transmit_ready() - scheduler shutdown or timeout, or signal_transmit_error() * We'd need to dig into the scheduler to guess at the reason, as * connection.c tells us nothing itself, but mostly its timouts. * Initially, we'll simply ignore this and leave massive timeouts, but * maybe that should change for error handling pruposes. It appears that * successful operations, including DNS resolution, do not use this. */ - if (NULL==buf) + if (NULL == buf) { - enum GNUNET_SCHEDULER_Reason reason = GNUNET_SCHEDULER_get_reason (); - if (0 != (reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) + const struct GNUNET_SCHEDULER_TaskContext *tc; + + tc = GNUNET_SCHEDULER_get_task_context (); + if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return 0; - if (0 != (reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) { - if (0==ih->step) { + if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) { + if (0==ih->step) + { LOG (GNUNET_ERROR_TYPE_WARNING, "Timeout contacting SOCKS server, retrying indefinitely, but probably hopeless.\n"); register_sender (ih); - } else { + } + else + { LOG (GNUNET_ERROR_TYPE_ERROR, "Timeout during mid SOCKS handshake (step %u), probably not a SOCKS server.\n", ih->step); @@ -418,7 +423,7 @@ register_sender (struct GNUNET_SOCKS_Handshake *ih) /** * Initialize a SOCKS5 handshake for authentication via username and * password. Tor uses SOCKS username and password authentication to assign - * programs unique circuits. + * programs unique circuits. * * @param user username for the proxy * @param pass password for the proxy @@ -435,7 +440,7 @@ GNUNET_SOCKS_init_handshake (const char *user, const char *pass) unsigned char * n = b++; *n = 1; /* Number of authentication methods */ /* We support no authentication even when requesting authentication, - * but this appears harmless, given the way that Tor uses authentication. + * but this appears harmless, given the way that Tor uses authentication. * And some SOCKS5 servers might require this. */ *(b++) = SOCKS5_AUTH_NOAUTH; if (NULL != user) { @@ -445,7 +450,7 @@ GNUNET_SOCKS_init_handshake (const char *user, const char *pass) /* There is no apperent reason to support authentication methods beyond * username and password since afaik Tor does not support them. */ - /* We authenticate with an empty username and password if the server demands + /* We authenticate with an empty username and password if the server demands * them but we do not have any. */ if (user == NULL) user = ""; @@ -466,7 +471,7 @@ GNUNET_SOCKS_init_handshake (const char *user, const char *pass) /** - * Initialize a SOCKS5 handshake without authentication, thereby possibly + * Initialize a SOCKS5 handshake without authentication, thereby possibly * sharing a Tor circuit with another process. * * @return Valid SOCKS5 hanbdshake handle @@ -480,11 +485,11 @@ GNUNET_SOCKS_init_handshake_noauth () /** * Build request that the SOCKS5 proxy open a TCP/IP stream to the given host - * and port. + * and port. * * @param ih SOCKS5 handshake - * @param hostname - * @param port + * @param hostname + * @param port */ void GNUNET_SOCKS_set_handshake_destination (struct GNUNET_SOCKS_Handshake *ih, @@ -529,7 +534,7 @@ GNUNET_SOCKS_set_handshake_destination (struct GNUNET_SOCKS_Handshake *ih, * @param c open unused connection, consumed here. * @return Connection handle that becomes usable when the SOCKS5 handshake completes. */ -struct GNUNET_CONNECTION_Handle * +struct GNUNET_CONNECTION_Handle * GNUNET_SOCKS_run_handshake(struct GNUNET_SOCKS_Handshake *ih, struct GNUNET_CONNECTION_Handle *c) { @@ -580,7 +585,7 @@ GNUNET_SOCKS_do_connect (const char *service_name, if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "SOCKSPORT", &port0)) port0 = 9050; - /* A typical Tor client should usually try port 9150 for the TBB too, but + /* A typical Tor client should usually try port 9150 for the TBB too, but * GUNNet can probably assume a system Tor instalation. */ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSHOST", &host0)) diff --git a/src/util/speedup.c b/src/util/speedup.c index a42ed7faf1..6dce6a4901 100644 --- a/src/util/speedup.c +++ b/src/util/speedup.c @@ -34,16 +34,17 @@ static struct GNUNET_TIME_Relative interval; static struct GNUNET_TIME_Relative delta; -static struct GNUNET_SCHEDULER_Task * speedup_task; +static struct GNUNET_SCHEDULER_Task *speedup_task; static void -do_speedup (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_speedup (void *cls) { static long long current_offset; + const struct GNUNET_SCHEDULER_TaskContext *tc; speedup_task = NULL; + tc = GNUNET_SCHEDULER_get_task_context (); if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; current_offset += delta.rel_value_us; diff --git a/src/util/test_client.c b/src/util/test_client.c index d8bf67ac61..dab985e5f1 100644 --- a/src/util/test_client.c +++ b/src/util/test_client.c @@ -125,7 +125,7 @@ make_msg (void *cls, size_t size, void *buf) static void -task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task (void *cls) { struct sockaddr_in sa; struct sockaddr *sap[2]; diff --git a/src/util/test_common_logging_runtime_loglevels.c b/src/util/test_common_logging_runtime_loglevels.c index 6c33c2da17..21eb3c6c62 100644 --- a/src/util/test_common_logging_runtime_loglevels.c +++ b/src/util/test_common_logging_runtime_loglevels.c @@ -58,7 +58,7 @@ runone (void); static void -end_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_task (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending phase %d, ok is %d\n", phase, ok); @@ -215,7 +215,7 @@ static int bytes; static void -read_call (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +read_call (void *cls) { const struct GNUNET_DISK_FileHandle *stdout_read_handle = cls; char level[8]; @@ -425,7 +425,7 @@ runone () static void -task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task (void *cls) { phase = 0; runone (); diff --git a/src/util/test_connection.c b/src/util/test_connection.c index c4987d27de..eaca75c2e6 100644 --- a/src/util/test_connection.c +++ b/src/util/test_connection.c @@ -98,7 +98,7 @@ receive_check (void *cls, const void *buf, size_t available, static void -run_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +run_accept (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test accepts connection\n"); asock = GNUNET_CONNECTION_create_from_accept (NULL, NULL, ls); @@ -128,7 +128,7 @@ make_hello (void *cls, size_t size, void *buf) static void -task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task (void *cls) { ls = open_listen_socket (); lsock = GNUNET_CONNECTION_create_from_existing (ls); diff --git a/src/util/test_connection_addressing.c b/src/util/test_connection_addressing.c index 5d2766f5ff..a6345b10a7 100644 --- a/src/util/test_connection_addressing.c +++ b/src/util/test_connection_addressing.c @@ -102,7 +102,7 @@ receive_check (void *cls, const void *buf, size_t available, static void -run_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +run_accept (void *cls) { void *addr; size_t alen; @@ -142,7 +142,7 @@ make_hello (void *cls, size_t size, void *buf) static void -task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task (void *cls) { struct sockaddr_in v4; diff --git a/src/util/test_connection_receive_cancel.c b/src/util/test_connection_receive_cancel.c index 73a041bdf3..9ec96d8a69 100644 --- a/src/util/test_connection_receive_cancel.c +++ b/src/util/test_connection_receive_cancel.c @@ -79,7 +79,7 @@ dead_receive (void *cls, const void *buf, size_t available, static void -run_accept_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +run_accept_cancel (void *cls) { asock = GNUNET_CONNECTION_create_from_accept (NULL, NULL, ls); GNUNET_assert (asock != NULL); @@ -92,7 +92,7 @@ run_accept_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -receive_cancel_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +receive_cancel_task (void *cls) { int *ok = cls; @@ -105,7 +105,7 @@ receive_cancel_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -task_receive_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task_receive_cancel (void *cls) { ls = open_listen_socket (); lsock = GNUNET_CONNECTION_create_from_existing (ls); diff --git a/src/util/test_connection_timeout.c b/src/util/test_connection_timeout.c index 5a649f5b06..e78cec6695 100644 --- a/src/util/test_connection_timeout.c +++ b/src/util/test_connection_timeout.c @@ -93,7 +93,7 @@ send_kilo (void *cls, size_t size, void *buf) static void -task_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task_timeout (void *cls) { ls = open_listen_socket (); diff --git a/src/util/test_connection_timeout_no_connect.c b/src/util/test_connection_timeout_no_connect.c index 1e3230d2f9..ebcd4b71e3 100644 --- a/src/util/test_connection_timeout_no_connect.c +++ b/src/util/test_connection_timeout_no_connect.c @@ -44,7 +44,7 @@ handle_timeout (void *cls, size_t size, void *buf) static void -task_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task_timeout (void *cls) { csock = GNUNET_CONNECTION_create_from_connect (cfg, "localhost", PORT); GNUNET_assert (csock != NULL); diff --git a/src/util/test_connection_transmit_cancel.c b/src/util/test_connection_transmit_cancel.c index 8d016068cd..9ef0720edc 100644 --- a/src/util/test_connection_transmit_cancel.c +++ b/src/util/test_connection_transmit_cancel.c @@ -38,7 +38,7 @@ not_run (void *cls, size_t size, void *buf) static void -task_transmit_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task_transmit_cancel (void *cls) { int *ok = cls; struct GNUNET_CONNECTION_TransmitHandle *th; diff --git a/src/util/test_crypto_hash.c b/src/util/test_crypto_hash.c index fa00132644..731205841c 100644 --- a/src/util/test_crypto_hash.c +++ b/src/util/test_crypto_hash.c @@ -114,7 +114,7 @@ finished_task (void *cls, const struct GNUNET_HashCode * res) static void -file_hasher (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +file_hasher (void *cls) { GNUNET_assert (NULL != GNUNET_CRYPTO_hash_file (GNUNET_SCHEDULER_PRIORITY_DEFAULT, diff --git a/src/util/test_disk.c b/src/util/test_disk.c index 560b6710ee..86b96e16cd 100644 --- a/src/util/test_disk.c +++ b/src/util/test_disk.c @@ -141,12 +141,13 @@ iter_callback (void *cls, struct GNUNET_DISK_DirectoryIterator *di, } static void -iter_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +iter_task (void *cls) { GNUNET_DISK_directory_iterator_start (GNUNET_SCHEDULER_PRIORITY_DEFAULT, "test", &iter_callback, cls); } + static int testDirIter () { diff --git a/src/util/test_mq_client.c b/src/util/test_mq_client.c index 0d2f3befe4..f894c39124 100644 --- a/src/util/test_mq_client.c +++ b/src/util/test_mq_client.c @@ -62,7 +62,7 @@ recv_cb (void *cls, struct GNUNET_SERVER_Client *argclient, static void -clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +clean_up (void *cls) { GNUNET_SERVER_destroy (server); server = NULL; @@ -134,7 +134,7 @@ test_mq (struct GNUNET_CLIENT_Connection *client) static void -task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task (void *cls) { struct sockaddr_in sa; struct sockaddr *sap[2]; @@ -181,4 +181,3 @@ main (int argc, char *argv[]) GNUNET_assert (GNUNET_YES == notify); return ok; } - diff --git a/src/util/test_os_start_process.c b/src/util/test_os_start_process.c index 3823beb3de..c617917ccf 100644 --- a/src/util/test_os_start_process.c +++ b/src/util/test_os_start_process.c @@ -58,7 +58,7 @@ struct read_context struct read_context rc; static void -end_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_task (void *cls) { if (0 != GNUNET_OS_process_kill (proc, GNUNET_TERM_SIG)) { @@ -73,7 +73,7 @@ end_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -read_call (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +read_call (void *cls) { int bytes; @@ -110,7 +110,7 @@ read_call (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -run_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +run_task (void *cls) { char *fn; const struct GNUNET_DISK_FileHandle *stdout_read_handle; diff --git a/src/util/test_scheduler.c b/src/util/test_scheduler.c index 01d93febd6..a246d75c59 100644 --- a/src/util/test_scheduler.c +++ b/src/util/test_scheduler.c @@ -31,7 +31,7 @@ static const struct GNUNET_DISK_FileHandle *fds[2]; static void -task2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task2 (void *cls) { int *ok = cls; @@ -44,7 +44,7 @@ task2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -task3 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task3 (void *cls) { int *ok = cls; @@ -54,11 +54,13 @@ task3 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -taskWrt (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +taskWrt (void *cls) { static char c; int *ok = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); GNUNET_assert (6 == *ok); GNUNET_assert (GNUNET_NETWORK_fdset_handle_isset (tc->write_ready, fds[1])); (*ok) = 7; @@ -67,14 +69,14 @@ taskWrt (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -taskNeverRun (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +taskNeverRun (void *cls) { GNUNET_assert (0); } static void -taskLast (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +taskLast (void *cls) { int *ok = cls; @@ -85,11 +87,13 @@ taskLast (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -taskRd (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +taskRd (void *cls) { static char c; int *ok = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; + tc = GNUNET_SCHEDULER_get_task_context (); GNUNET_assert (7 == *ok); GNUNET_assert (GNUNET_NETWORK_fdset_handle_isset (tc->read_ready, fds[0])); GNUNET_assert (1 == GNUNET_DISK_file_read (fds[0], &c, 1)); @@ -101,7 +105,7 @@ taskRd (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -task4 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task4 (void *cls) { int *ok = cls; @@ -119,7 +123,7 @@ task4 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -task1 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task1 (void *cls) { int *ok = cls; @@ -148,7 +152,7 @@ check () static void -taskShutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +taskShutdown (void *cls) { int *ok = cls; @@ -176,7 +180,7 @@ checkShutdown () #ifndef MINGW static void -taskSig (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +taskSig (void *cls) { int *ok = cls; @@ -204,7 +208,7 @@ checkSignal () static void -taskCancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +taskCancel (void *cls) { int *ok = cls; diff --git a/src/util/test_scheduler_delay.c b/src/util/test_scheduler_delay.c index c3821a1735..c55f28e9b0 100644 --- a/src/util/test_scheduler_delay.c +++ b/src/util/test_scheduler_delay.c @@ -41,11 +41,9 @@ static unsigned long long cumDelta; * Signature of the main function of a task. * * @param cls closure - * @param tc context */ static void -test_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +test_task (void *cls) { struct GNUNET_TIME_Absolute now; diff --git a/src/util/test_server.c b/src/util/test_server.c index fdf2981281..189c13e18e 100644 --- a/src/util/test_server.c +++ b/src/util/test_server.c @@ -74,11 +74,9 @@ static int ok; * Final task invoked to clean up. * * @param cls NULL - * @param tc scheduler context */ static void -finish_up (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +finish_up (void *cls) { GNUNET_assert (7 == ok); ok = 0; @@ -262,11 +260,9 @@ static struct GNUNET_SERVER_MessageHandler handlers[] = { * server. * * @param cls NULL - * @param tc scheduler context */ static void -task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +task (void *cls) { struct sockaddr_in sa; struct sockaddr *sap[2]; diff --git a/src/util/test_server_disconnect.c b/src/util/test_server_disconnect.c index 4a6970fc3e..21abf92bb9 100644 --- a/src/util/test_server_disconnect.c +++ b/src/util/test_server_disconnect.c @@ -41,7 +41,7 @@ static int ok; static void -finish_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +finish_up (void *cls) { GNUNET_assert (ok == 5); ok = 0; @@ -52,9 +52,10 @@ finish_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -notify_disconnect (void *cls, struct GNUNET_SERVER_Client *clientarg) +notify_disconnect (void *cls, + struct GNUNET_SERVER_Client *clientarg) { - if (clientarg == NULL) + if (NULL == clientarg) return; GNUNET_assert (ok == 4); ok = 5; @@ -63,7 +64,7 @@ notify_disconnect (void *cls, struct GNUNET_SERVER_Client *clientarg) static void -server_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +server_disconnect (void *cls) { struct GNUNET_SERVER_Client *argclient = cls; @@ -110,7 +111,7 @@ transmit_initial_message (void *cls, size_t size, void *buf) static void -task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task (void *cls) { struct sockaddr_in sa; struct sockaddr *sap[2]; diff --git a/src/util/test_server_with_client.c b/src/util/test_server_with_client.c index 07bc88783a..8a8f65474f 100644 --- a/src/util/test_server_with_client.c +++ b/src/util/test_server_with_client.c @@ -40,7 +40,7 @@ static struct GNUNET_CONFIGURATION_Handle *cfg; static int ok; static void -send_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +send_done (void *cls) { struct GNUNET_SERVER_Client *argclient = cls; @@ -94,7 +94,7 @@ recv_cb (void *cls, struct GNUNET_SERVER_Client *argclient, static void -clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +clean_up (void *cls) { GNUNET_SERVER_destroy (server); server = NULL; @@ -146,7 +146,7 @@ static struct GNUNET_SERVER_MessageHandler handlers[] = { static void -task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task (void *cls) { struct sockaddr_in sa; struct sockaddr *sap[2]; diff --git a/src/util/test_server_with_client_unix.c b/src/util/test_server_with_client_unix.c index 1d6f5dbed9..ec84b08f8a 100644 --- a/src/util/test_server_with_client_unix.c +++ b/src/util/test_server_with_client_unix.c @@ -39,7 +39,7 @@ static int ok; static void -send_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +send_done (void *cls) { struct GNUNET_SERVER_Client *argclient = cls; @@ -74,7 +74,7 @@ recv_cb (void *cls, struct GNUNET_SERVER_Client *argclient, static void -clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +clean_up (void *cls) { GNUNET_SERVER_destroy (server); server = NULL; @@ -126,7 +126,7 @@ static struct GNUNET_SERVER_MessageHandler handlers[] = { static void -task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task (void *cls) { struct sockaddr_un un; const char *unixpath = "/tmp/testsock"; diff --git a/src/util/test_service.c b/src/util/test_service.c index 88f99f95ac..efc765438c 100644 --- a/src/util/test_service.c +++ b/src/util/test_service.c @@ -41,7 +41,7 @@ static struct GNUNET_CLIENT_Connection *client; static void -do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_stop (void *cls) { if (NULL != client) { diff --git a/src/util/test_socks.c b/src/util/test_socks.c index bb7d0031a3..7f1140720e 100644 --- a/src/util/test_socks.c +++ b/src/util/test_socks.c @@ -126,7 +126,7 @@ make_msg (void *cls, size_t size, void *buf) static void -task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +task (void *cls) { struct sockaddr_in sa; struct sockaddr *sap[2]; diff --git a/src/util/test_speedup.c b/src/util/test_speedup.c index 3c4a9bfdce..5d46e3127a 100644 --- a/src/util/test_speedup.c +++ b/src/util/test_speedup.c @@ -47,7 +47,7 @@ static unsigned int cycles; * @param tc scheduler context, unused */ static void -run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +run (void *cls) { cycles++; fprintf (stderr, "..%u", cycles); diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index 8b202d7d42..58eda367f2 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c @@ -2866,11 +2866,9 @@ cleanup_channel (void *cls, * Function scheduled as very last function, cleans up after us * * @param cls unused - * @param tc unused */ static void -cleanup (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup (void *cls) { unsigned int i; diff --git a/src/vpn/gnunet-vpn.c b/src/vpn/gnunet-vpn.c index d6eb39bcb6..d4acee49ef 100644 --- a/src/vpn/gnunet-vpn.c +++ b/src/vpn/gnunet-vpn.c @@ -95,7 +95,7 @@ static struct GNUNET_TIME_Relative duration = { 5 * 60 * 1000} ; * Shutdown. */ static void -do_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +do_disconnect (void *cls) { if (NULL != request) { diff --git a/src/vpn/vpn_api.c b/src/vpn/vpn_api.c index 208e560078..f3068f7c2a 100644 --- a/src/vpn/vpn_api.c +++ b/src/vpn/vpn_api.c @@ -358,12 +358,10 @@ queue_request (struct GNUNET_VPN_RedirectionRequest *rr) /** * Connect to the VPN service and start again to transmit our requests. * - * @param cls the 'struct GNUNET_VPN_Handle *' - * @param tc scheduler context + * @param cls the `struct GNUNET_VPN_Handle *` */ static void -connect_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +connect_task (void *cls) { struct GNUNET_VPN_Handle *vh = cls; |