fixing #4479
This commit is contained in:
parent
d34c6401b4
commit
1c2be591d3
@ -171,9 +171,11 @@ context_task (void *cls);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the context task, the working set has changed.
|
* Run the context task, the working set has changed.
|
||||||
|
*
|
||||||
|
* @param cls NULL
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
trigger_context_task ()
|
trigger_context_task (void *cls)
|
||||||
{
|
{
|
||||||
GNUNET_SCHEDULER_cancel (ctx_task);
|
GNUNET_SCHEDULER_cancel (ctx_task);
|
||||||
ctx_task = GNUNET_SCHEDULER_add_now (&context_task,
|
ctx_task = GNUNET_SCHEDULER_add_now (&context_task,
|
||||||
@ -333,7 +335,6 @@ interpreter_run (void *cls)
|
|||||||
fail (is);
|
fail (is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trigger_context_task ();
|
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
@ -486,7 +487,8 @@ run (void *cls)
|
|||||||
is = GNUNET_new (struct InterpreterState);
|
is = GNUNET_new (struct InterpreterState);
|
||||||
is->commands = commands;
|
is->commands = commands;
|
||||||
|
|
||||||
ctx = GNUNET_CURL_init ();
|
ctx = GNUNET_CURL_init (&trigger_context_task,
|
||||||
|
NULL);
|
||||||
GNUNET_assert (NULL != ctx);
|
GNUNET_assert (NULL != ctx);
|
||||||
ctx_task = GNUNET_SCHEDULER_add_now (&context_task,
|
ctx_task = GNUNET_SCHEDULER_add_now (&context_task,
|
||||||
ctx);
|
ctx);
|
||||||
|
@ -48,9 +48,9 @@ static struct GNUNET_CURL_Context *ctx;
|
|||||||
static struct TALER_EXCHANGE_Handle *exchange;
|
static struct TALER_EXCHANGE_Handle *exchange;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Task run on shutdown.
|
* Task run on timeout.
|
||||||
*/
|
*/
|
||||||
static struct GNUNET_SCHEDULER_Task *shutdown_task;
|
static struct GNUNET_SCHEDULER_Task *timeout_task;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Task that runs the main event loop.
|
* Task that runs the main event loop.
|
||||||
@ -569,27 +569,6 @@ struct InterpreterState
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Task that runs the context's event loop with the GNUnet scheduler.
|
|
||||||
*
|
|
||||||
* @param cls unused
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
context_task (void *cls);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run the context task, the working set has changed.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
trigger_context_task ()
|
|
||||||
{
|
|
||||||
GNUNET_SCHEDULER_cancel (ctx_task);
|
|
||||||
ctx_task = GNUNET_SCHEDULER_add_now (&context_task,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The testcase failed, return with an error code.
|
* The testcase failed, return with an error code.
|
||||||
*
|
*
|
||||||
@ -1499,7 +1478,6 @@ interpreter_run (void *cls)
|
|||||||
fail (is);
|
fail (is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trigger_context_task ();
|
|
||||||
return;
|
return;
|
||||||
case OC_WITHDRAW_STATUS:
|
case OC_WITHDRAW_STATUS:
|
||||||
GNUNET_assert (NULL !=
|
GNUNET_assert (NULL !=
|
||||||
@ -1515,7 +1493,6 @@ interpreter_run (void *cls)
|
|||||||
&reserve_pub,
|
&reserve_pub,
|
||||||
&reserve_status_cb,
|
&reserve_status_cb,
|
||||||
is);
|
is);
|
||||||
trigger_context_task ();
|
|
||||||
return;
|
return;
|
||||||
case OC_WITHDRAW_SIGN:
|
case OC_WITHDRAW_SIGN:
|
||||||
GNUNET_assert (NULL !=
|
GNUNET_assert (NULL !=
|
||||||
@ -1575,7 +1552,6 @@ interpreter_run (void *cls)
|
|||||||
fail (is);
|
fail (is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trigger_context_task ();
|
|
||||||
return;
|
return;
|
||||||
case OC_DEPOSIT:
|
case OC_DEPOSIT:
|
||||||
{
|
{
|
||||||
@ -1728,7 +1704,6 @@ interpreter_run (void *cls)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
json_decref (wire);
|
json_decref (wire);
|
||||||
trigger_context_task ();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case OC_REFRESH_MELT:
|
case OC_REFRESH_MELT:
|
||||||
@ -1826,7 +1801,6 @@ interpreter_run (void *cls)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trigger_context_task ();
|
|
||||||
return;
|
return;
|
||||||
case OC_REFRESH_REVEAL:
|
case OC_REFRESH_REVEAL:
|
||||||
ref = find_command (is,
|
ref = find_command (is,
|
||||||
@ -1845,7 +1819,6 @@ interpreter_run (void *cls)
|
|||||||
fail (is);
|
fail (is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trigger_context_task ();
|
|
||||||
return;
|
return;
|
||||||
case OC_REFRESH_LINK:
|
case OC_REFRESH_LINK:
|
||||||
/* find reveal command */
|
/* find reveal command */
|
||||||
@ -1885,13 +1858,11 @@ interpreter_run (void *cls)
|
|||||||
fail (is);
|
fail (is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trigger_context_task ();
|
|
||||||
return;
|
return;
|
||||||
case OC_WIRE:
|
case OC_WIRE:
|
||||||
cmd->details.wire.wh = TALER_EXCHANGE_wire (exchange,
|
cmd->details.wire.wh = TALER_EXCHANGE_wire (exchange,
|
||||||
&wire_cb,
|
&wire_cb,
|
||||||
is);
|
is);
|
||||||
trigger_context_task ();
|
|
||||||
return;
|
return;
|
||||||
case OC_WIRE_DEPOSITS:
|
case OC_WIRE_DEPOSITS:
|
||||||
if (NULL != cmd->details.wire_deposits.wtid_ref)
|
if (NULL != cmd->details.wire_deposits.wtid_ref)
|
||||||
@ -1906,7 +1877,6 @@ interpreter_run (void *cls)
|
|||||||
&cmd->details.wire_deposits.wtid,
|
&cmd->details.wire_deposits.wtid,
|
||||||
&wire_deposits_cb,
|
&wire_deposits_cb,
|
||||||
is);
|
is);
|
||||||
trigger_context_task ();
|
|
||||||
return;
|
return;
|
||||||
case OC_DEPOSIT_WTID:
|
case OC_DEPOSIT_WTID:
|
||||||
{
|
{
|
||||||
@ -1969,7 +1939,6 @@ interpreter_run (void *cls)
|
|||||||
ref->details.deposit.transaction_id,
|
ref->details.deposit.transaction_id,
|
||||||
&deposit_wtid_cb,
|
&deposit_wtid_cb,
|
||||||
is);
|
is);
|
||||||
trigger_context_task ();
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
@ -1984,6 +1953,19 @@ interpreter_run (void *cls)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function run when the test terminates (good or bad) with timeout.
|
||||||
|
*
|
||||||
|
* @param cls NULL
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
do_timeout (void *cls)
|
||||||
|
{
|
||||||
|
timeout_task = NULL;
|
||||||
|
GNUNET_SCHEDULER_shutdown ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function run when the test terminates (good or bad).
|
* Function run when the test terminates (good or bad).
|
||||||
* Cleans up our state.
|
* Cleans up our state.
|
||||||
@ -1997,7 +1979,6 @@ do_shutdown (void *cls)
|
|||||||
struct Command *cmd;
|
struct Command *cmd;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
shutdown_task = NULL;
|
|
||||||
for (i=0;OC_END != (cmd = &is->commands[i])->oc;i++)
|
for (i=0;OC_END != (cmd = &is->commands[i])->oc;i++)
|
||||||
{
|
{
|
||||||
switch (cmd->oc)
|
switch (cmd->oc)
|
||||||
@ -2156,11 +2137,6 @@ do_shutdown (void *cls)
|
|||||||
is->task = NULL;
|
is->task = NULL;
|
||||||
}
|
}
|
||||||
GNUNET_free (is);
|
GNUNET_free (is);
|
||||||
if (NULL != ctx_task)
|
|
||||||
{
|
|
||||||
GNUNET_SCHEDULER_cancel (ctx_task);
|
|
||||||
ctx_task = NULL;
|
|
||||||
}
|
|
||||||
if (NULL != exchange)
|
if (NULL != exchange)
|
||||||
{
|
{
|
||||||
TALER_EXCHANGE_disconnect (exchange);
|
TALER_EXCHANGE_disconnect (exchange);
|
||||||
@ -2171,6 +2147,16 @@ do_shutdown (void *cls)
|
|||||||
GNUNET_CURL_fini (ctx);
|
GNUNET_CURL_fini (ctx);
|
||||||
ctx = NULL;
|
ctx = NULL;
|
||||||
}
|
}
|
||||||
|
if (NULL != ctx_task)
|
||||||
|
{
|
||||||
|
GNUNET_SCHEDULER_cancel (ctx_task);
|
||||||
|
ctx_task = NULL;
|
||||||
|
}
|
||||||
|
if (NULL != timeout_task)
|
||||||
|
{
|
||||||
|
GNUNET_SCHEDULER_cancel (timeout_task);
|
||||||
|
timeout_task = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2262,6 +2248,23 @@ context_task (void *cls)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the context task, the working set has changed.
|
||||||
|
*
|
||||||
|
* @param cls NULL
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
trigger_context_task (void *cls)
|
||||||
|
{
|
||||||
|
if (NULL == ctx)
|
||||||
|
return;
|
||||||
|
if (NULL != ctx_task)
|
||||||
|
GNUNET_SCHEDULER_cancel (ctx_task);
|
||||||
|
ctx_task = GNUNET_SCHEDULER_add_now (&context_task,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main function that will be run by the scheduler.
|
* Main function that will be run by the scheduler.
|
||||||
*
|
*
|
||||||
@ -2507,7 +2510,8 @@ run (void *cls)
|
|||||||
is = GNUNET_new (struct InterpreterState);
|
is = GNUNET_new (struct InterpreterState);
|
||||||
is->commands = commands;
|
is->commands = commands;
|
||||||
|
|
||||||
ctx = GNUNET_CURL_init ();
|
ctx = GNUNET_CURL_init (&trigger_context_task,
|
||||||
|
NULL);
|
||||||
GNUNET_assert (NULL != ctx);
|
GNUNET_assert (NULL != ctx);
|
||||||
ctx_task = GNUNET_SCHEDULER_add_now (&context_task,
|
ctx_task = GNUNET_SCHEDULER_add_now (&context_task,
|
||||||
ctx);
|
ctx);
|
||||||
@ -2516,10 +2520,11 @@ run (void *cls)
|
|||||||
&cert_cb, is,
|
&cert_cb, is,
|
||||||
TALER_EXCHANGE_OPTION_END);
|
TALER_EXCHANGE_OPTION_END);
|
||||||
GNUNET_assert (NULL != exchange);
|
GNUNET_assert (NULL != exchange);
|
||||||
shutdown_task
|
timeout_task
|
||||||
= GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
|
= GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
|
||||||
(GNUNET_TIME_UNIT_SECONDS, 150),
|
(GNUNET_TIME_UNIT_SECONDS, 150),
|
||||||
&do_shutdown, is);
|
&do_timeout, NULL);
|
||||||
|
GNUNET_SCHEDULER_add_shutdown (&do_shutdown, is);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,12 +30,17 @@ TESTRUN = YES
|
|||||||
[exchangedb-postgres]
|
[exchangedb-postgres]
|
||||||
DB_CONN_STR = "postgres:///talercheck"
|
DB_CONN_STR = "postgres:///talercheck"
|
||||||
|
|
||||||
[wire-incoming-test]
|
[exchange-wire-incoming-sepa]
|
||||||
|
# This is the response we give out for the /wire request. It provides
|
||||||
|
# wallets with the bank information for transfers to the exchange.
|
||||||
|
SEPA_RESPONSE_FILE = ${TALER_CONFIG_HOME}/sepa.json
|
||||||
|
|
||||||
|
[exchange-wire-incoming-test]
|
||||||
# This is the response we give out for the /wire request. It provides
|
# This is the response we give out for the /wire request. It provides
|
||||||
# wallets with the bank information for transfers to the exchange.
|
# wallets with the bank information for transfers to the exchange.
|
||||||
TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/test.json
|
TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/test.json
|
||||||
|
|
||||||
[wire-outgoing-test]
|
[exchange-wire-outgoing-test]
|
||||||
# What is the main website of the bank?
|
# What is the main website of the bank?
|
||||||
BANK_URI = "http://localhost:8082/"
|
BANK_URI = "http://localhost:8082/"
|
||||||
# Into which account at the 'bank' should (incoming) wire transfers be made?
|
# Into which account at the 'bank' should (incoming) wire transfers be made?
|
||||||
|
@ -304,11 +304,9 @@ maint_child_death (void *cls)
|
|||||||
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 ();
|
|
||||||
GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof (c)));
|
GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof (c)));
|
||||||
GNUNET_OS_process_wait (aggregator_proc);
|
GNUNET_OS_process_wait (aggregator_proc);
|
||||||
GNUNET_OS_process_destroy (aggregator_proc);
|
GNUNET_OS_process_destroy (aggregator_proc);
|
||||||
|
@ -191,11 +191,13 @@ context_task (void *cls)
|
|||||||
/**
|
/**
|
||||||
* Run the bank task now.
|
* Run the bank task now.
|
||||||
*
|
*
|
||||||
* @param tc context for which we should initiate running the task
|
* @param cls context for which we should initiate running the task
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
run_bt (struct TestClosure *tc)
|
run_bt (void *cls)
|
||||||
{
|
{
|
||||||
|
struct TestClosure *tc = cls;
|
||||||
|
|
||||||
if (NULL != tc->bt)
|
if (NULL != tc->bt)
|
||||||
GNUNET_SCHEDULER_cancel (tc->bt);
|
GNUNET_SCHEDULER_cancel (tc->bt);
|
||||||
tc->bt = GNUNET_SCHEDULER_add_now (&context_task,
|
tc->bt = GNUNET_SCHEDULER_add_now (&context_task,
|
||||||
@ -751,7 +753,6 @@ test_execute_wire_transfer (void *cls,
|
|||||||
GNUNET_free (eh);
|
GNUNET_free (eh);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
run_bt (tc);
|
|
||||||
return eh;
|
return eh;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -831,7 +832,8 @@ libtaler_plugin_wire_test_init (void *cls)
|
|||||||
GNUNET_free (tc);
|
GNUNET_free (tc);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
tc->ctx = GNUNET_CURL_init ();
|
tc->ctx = GNUNET_CURL_init (&run_bt,
|
||||||
|
tc);
|
||||||
if (NULL == tc->ctx)
|
if (NULL == tc->ctx)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
|
Loading…
Reference in New Issue
Block a user