changing code to meet latest change in GNUNET_SCHEDULER API

This commit is contained in:
Christian Grothoff 2016-04-10 00:57:20 +02:00
parent df893df505
commit 0dee91e014
6 changed files with 38 additions and 85 deletions

View File

@ -163,11 +163,9 @@ struct InterpreterState
* Task that runs the context's event loop with the GNUnet scheduler. * Task that runs the context's event loop with the GNUnet scheduler.
* *
* @param cls unused * @param cls unused
* @param tc scheduler context (unused)
*/ */
static void static void
context_task (void *cls, context_task (void *cls);
const struct GNUNET_SCHEDULER_TaskContext *tc);
/** /**
@ -233,11 +231,9 @@ find_command (const struct InterpreterState *is,
* Run the main interpreter loop that performs bank operations. * Run the main interpreter loop that performs bank operations.
* *
* @param cls contains the `struct InterpreterState` * @param cls contains the `struct InterpreterState`
* @param tc scheduler context
*/ */
static void static void
interpreter_run (void *cls, interpreter_run (void *cls);
const struct GNUNET_SCHEDULER_TaskContext *tc);
/** /**
@ -281,17 +277,17 @@ add_incoming_cb (void *cls,
* Run the main interpreter loop that performs bank operations. * Run the main interpreter loop that performs bank operations.
* *
* @param cls contains the `struct InterpreterState` * @param cls contains the `struct InterpreterState`
* @param tc scheduler context
*/ */
static void static void
interpreter_run (void *cls, interpreter_run (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
struct InterpreterState *is = cls; struct InterpreterState *is = cls;
struct Command *cmd = &is->commands[is->ip]; struct Command *cmd = &is->commands[is->ip];
struct TALER_Amount amount; struct TALER_Amount amount;
const struct GNUNET_SCHEDULER_TaskContext *tc;
is->task = NULL; is->task = NULL;
tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{ {
fprintf (stderr, fprintf (stderr,
@ -354,11 +350,9 @@ interpreter_run (void *cls,
* Cleans up our state. * Cleans up our state.
* *
* @param cls the interpreter state. * @param cls the interpreter state.
* @param tc unused
*/ */
static void static void
do_shutdown (void *cls, do_shutdown (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
struct InterpreterState *is = cls; struct InterpreterState *is = cls;
struct Command *cmd; struct Command *cmd;
@ -415,11 +409,9 @@ do_shutdown (void *cls,
* Task that runs the context's event loop with the GNUnet scheduler. * Task that runs the context's event loop with the GNUnet scheduler.
* *
* @param cls unused * @param cls unused
* @param tc scheduler context (unused)
*/ */
static void static void
context_task (void *cls, context_task (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
long timeout; long timeout;
int max_fd; int max_fd;
@ -471,13 +463,9 @@ context_task (void *cls,
* Main function that will be run by the scheduler. * Main function that will be run by the scheduler.
* *
* @param cls closure * @param cls closure
* @param args remaining command-line arguments
* @param cfgfile name of the configuration file used (for saving, can be NULL!)
* @param config configuration
*/ */
static void static void
run (void *cls, run (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
struct InterpreterState *is; struct InterpreterState *is;
static struct Command commands[] = static struct Command commands[] =

View File

@ -573,11 +573,9 @@ struct InterpreterState
* Task that runs the context's event loop with the GNUnet scheduler. * Task that runs the context's event loop with the GNUnet scheduler.
* *
* @param cls unused * @param cls unused
* @param tc scheduler context (unused)
*/ */
static void static void
context_task (void *cls, context_task (void *cls);
const struct GNUNET_SCHEDULER_TaskContext *tc);
/** /**
@ -641,11 +639,9 @@ find_command (const struct InterpreterState *is,
* Run the main interpreter loop that performs exchange operations. * Run the main interpreter loop that performs exchange operations.
* *
* @param cls contains the `struct InterpreterState` * @param cls contains the `struct InterpreterState`
* @param tc scheduler context
*/ */
static void static void
interpreter_run (void *cls, interpreter_run (void *cls);
const struct GNUNET_SCHEDULER_TaskContext *tc);
/** /**
@ -1414,11 +1410,9 @@ deposit_wtid_cb (void *cls,
* Run the main interpreter loop that performs exchange operations. * Run the main interpreter loop that performs exchange operations.
* *
* @param cls contains the `struct InterpreterState` * @param cls contains the `struct InterpreterState`
* @param tc scheduler context
*/ */
static void static void
interpreter_run (void *cls, interpreter_run (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
struct InterpreterState *is = cls; struct InterpreterState *is = cls;
struct Command *cmd = &is->commands[is->ip]; struct Command *cmd = &is->commands[is->ip];
@ -1428,8 +1422,10 @@ interpreter_run (void *cls,
struct TALER_Amount amount; struct TALER_Amount amount;
struct GNUNET_TIME_Absolute execution_date; struct GNUNET_TIME_Absolute execution_date;
json_t *wire; json_t *wire;
const struct GNUNET_SCHEDULER_TaskContext *tc;
is->task = NULL; is->task = NULL;
tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{ {
fprintf (stderr, fprintf (stderr,
@ -1993,11 +1989,9 @@ interpreter_run (void *cls,
* Cleans up our state. * Cleans up our state.
* *
* @param cls the interpreter state. * @param cls the interpreter state.
* @param tc unused
*/ */
static void static void
do_shutdown (void *cls, do_shutdown (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
struct InterpreterState *is = cls; struct InterpreterState *is = cls;
struct Command *cmd; struct Command *cmd;
@ -2218,11 +2212,9 @@ cert_cb (void *cls,
* Task that runs the context's event loop with the GNUnet scheduler. * Task that runs the context's event loop with the GNUnet scheduler.
* *
* @param cls unused * @param cls unused
* @param tc scheduler context (unused)
*/ */
static void static void
context_task (void *cls, context_task (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
long timeout; long timeout;
int max_fd; int max_fd;
@ -2274,13 +2266,9 @@ context_task (void *cls,
* Main function that will be run by the scheduler. * Main function that will be run by the scheduler.
* *
* @param cls closure * @param cls closure
* @param args remaining command-line arguments
* @param cfgfile name of the configuration file used (for saving, can be NULL!)
* @param config configuration
*/ */
static void static void
run (void *cls, run (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
struct InterpreterState *is; struct InterpreterState *is;
static struct MeltDetails melt_coins_1[] = { static struct MeltDetails melt_coins_1[] = {

View File

@ -198,11 +198,9 @@ static unsigned int aggregation_limit = TALER_EXCHANGEDB_MATCHING_DEPOSITS_LIMIT
* We're being aborted with CTRL-C (or SIGTERM). Shut down. * We're being aborted with CTRL-C (or SIGTERM). Shut down.
* *
* @param cls closure * @param cls closure
* @param tc scheduler context
*/ */
static void static void
shutdown_task (void *cls, shutdown_task (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
if (NULL != task) if (NULL != task)
{ {
@ -517,17 +515,17 @@ prepare_cb (void *cls,
* into larger wire transfers. * into larger wire transfers.
* *
* @param cls NULL * @param cls NULL
* @param tc scheduler context
*/ */
static void static void
run_aggregation (void *cls, run_aggregation (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
struct TALER_EXCHANGEDB_Session *session; struct TALER_EXCHANGEDB_Session *session;
unsigned int i; unsigned int i;
int ret; int ret;
const struct GNUNET_SCHEDULER_TaskContext *tc;
task = NULL; task = NULL;
tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return; return;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@ -713,11 +711,9 @@ run_aggregation (void *cls,
* do. * do.
* *
* @param cls pointer to an `int` which we will return from main() * @param cls pointer to an `int` which we will return from main()
* @param tc scheduler context
*/ */
static void static void
run_transfers (void *cls, run_transfers (void *cls);
const struct GNUNET_SCHEDULER_TaskContext *tc);
/** /**
@ -895,15 +891,16 @@ wire_prepare_cb (void *cls,
* @param tc scheduler context * @param tc scheduler context
*/ */
static void static void
run_transfers (void *cls, run_transfers (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
int ret; int ret;
struct TALER_EXCHANGEDB_Session *session; struct TALER_EXCHANGEDB_Session *session;
const struct GNUNET_SCHEDULER_TaskContext *tc;
task = NULL; task = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Checking for pending wire transfers\n"); "Checking for pending wire transfers\n");
tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return; return;
if (NULL == (session = db_plugin->get_session (db_plugin->cls, if (NULL == (session = db_plugin->get_session (db_plugin->cls,
@ -961,11 +958,9 @@ run_transfers (void *cls,
* First task. * First task.
* *
* @param cls closure, NULL * @param cls closure, NULL
* @param tc scheduler context
*/ */
static void static void
run (void *cls, run (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
task = GNUNET_SCHEDULER_add_now (&run_transfers, task = GNUNET_SCHEDULER_add_now (&run_transfers,
NULL); NULL);

View File

@ -305,22 +305,18 @@ static struct GNUNET_CRYPTO_RsaPublicKey *coin_pub;
* Interprets the commands from the test program. * Interprets the commands from the test program.
* *
* @param cls the `struct State` of the interpreter * @param cls the `struct State` of the interpreter
* @param tc scheduler context
*/ */
static void static void
interpreter (void *cls, interpreter (void *cls);
const struct GNUNET_SCHEDULER_TaskContext *tc);
/** /**
* Task triggered whenever we are to shutdown. * Task triggered whenever we are to shutdown.
* *
* @param cls closure, NULL if we need to self-restart * @param cls closure, NULL if we need to self-restart
* @param tc context
*/ */
static void static void
shutdown_action (void *cls, shutdown_action (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
shutdown_task = NULL; shutdown_task = NULL;
if (NULL != mhd_task) if (NULL != mhd_task)
@ -355,18 +351,18 @@ shutdown_action (void *cls,
* process died). * process died).
* *
* @param cls closure, NULL if we need to self-restart * @param cls closure, NULL if we need to self-restart
* @param tc context
*/ */
static void static void
maint_child_death (void *cls, maint_child_death (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
const struct GNUNET_DISK_FileHandle *pr; const struct GNUNET_DISK_FileHandle *pr;
char c[16]; char c[16];
struct State *state; struct State *state;
const struct GNUNET_SCHEDULER_TaskContext *tc;
child_death_task = NULL; child_death_task = NULL;
pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); 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)) if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY))
{ {
/* shutdown scheduled us, ignore! */ /* shutdown scheduled us, ignore! */
@ -384,7 +380,7 @@ maint_child_death (void *cls,
aggregator_state->ioff++; aggregator_state->ioff++;
state = aggregator_state; state = aggregator_state;
aggregator_state = NULL; aggregator_state = NULL;
interpreter (state, NULL); interpreter (state);
if (NULL == shutdown_task) if (NULL == shutdown_task)
return; return;
child_death_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, child_death_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
@ -527,11 +523,9 @@ fail (struct Command *cmd)
* Interprets the commands from the test program. * Interprets the commands from the test program.
* *
* @param cls the `struct State` of the interpreter * @param cls the `struct State` of the interpreter
* @param tc scheduler context
*/ */
static void static void
interpreter (void *cls, interpreter (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
struct State *state = cls; struct State *state = cls;
@ -864,11 +858,9 @@ handle_mhd_request (void *cls,
* Task run whenever HTTP server operations are pending. * Task run whenever HTTP server operations are pending.
* *
* @param cls NULL * @param cls NULL
* @param tc scheduler context
*/ */
static void static void
run_mhd (void *cls, run_mhd (void *cls);
const struct GNUNET_SCHEDULER_TaskContext *tc);
/** /**
@ -934,11 +926,9 @@ schedule_httpd ()
* Task run whenever HTTP server operations are pending. * Task run whenever HTTP server operations are pending.
* *
* @param cls NULL * @param cls NULL
* @param tc scheduler context
*/ */
static void static void
run_mhd (void *cls, run_mhd (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
mhd_task = NULL; mhd_task = NULL;
MHD_run (mhd_bank); MHD_run (mhd_bank);
@ -950,11 +940,9 @@ run_mhd (void *cls,
* Main function that will be run by the scheduler. * Main function that will be run by the scheduler.
* *
* @param cls closure with configuration * @param cls closure with configuration
* @param tc unused
*/ */
static void static void
run (void *cls, run (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
struct GNUNET_CONFIGURATION_Handle *cfg = cls; struct GNUNET_CONFIGURATION_Handle *cfg = cls;
struct TALER_EXCHANGEDB_DenominationKeyInformationP issue; struct TALER_EXCHANGEDB_DenominationKeyInformationP issue;

View File

@ -615,11 +615,9 @@ deposit_cb (void *cls,
* Main function that will be run by the scheduler. * Main function that will be run by the scheduler.
* *
* @param cls closure with config * @param cls closure with config
* @param tc unused
*/ */
static void static void
run (void *cls, run (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *tc)
{ {
struct GNUNET_CONFIGURATION_Handle *cfg = cls; struct GNUNET_CONFIGURATION_Handle *cfg = cls;
struct TALER_EXCHANGEDB_Session *session; struct TALER_EXCHANGEDB_Session *session;

View File

@ -131,11 +131,9 @@ struct TALER_WIRE_ExecuteHandle
* scheduler. * scheduler.
* *
* @param cls our `struct TestClosure` * @param cls our `struct TestClosure`
* @param tc scheduler context (unused)
*/ */
static void static void
context_task (void *cls, context_task (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *sct)
{ {
struct TestClosure *tc = cls; struct TestClosure *tc = cls;
long timeout; long timeout;
@ -388,11 +386,9 @@ GNUNET_NETWORK_STRUCT_END
* callback with the serialized state. * callback with the serialized state.
* *
* @param cls the `struct TALER_WIRE_PrepareHandle` * @param cls the `struct TALER_WIRE_PrepareHandle`
* @param sct unused
*/ */
static void static void
do_prepare (void *cls, do_prepare (void *cls)
const struct GNUNET_SCHEDULER_TaskContext *sct)
{ {
struct TALER_WIRE_PrepareHandle *pth = cls; struct TALER_WIRE_PrepareHandle *pth = cls;
char *wire_enc; char *wire_enc;