command to wait for completion of async command More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_ng_lib.h"
#include "gnunet_testing_plugin.h"
#include "gnunet_testing_barrier.h"
#include "gnunet_testing_netjail_lib.h"
Go to the source code of this file.
Data Structures | |
struct | FinishState |
Struct to use for command-specific context information closure of a command waiting for another command. More... | |
Functions | |
static void | done_finish (void *cls) |
Function called when the command we are waiting on is finished. More... | |
static void | timeout_finish (void *cls) |
Function triggered if the command we are waiting for did not complete on time. More... | |
static void | run_finish (void *cls, struct GNUNET_TESTING_Interpreter *is) |
Run method of the command created by the interpreter to wait for another command to finish. More... | |
static void | cleanup_finish (void *cls) |
Cleanup state of a finish command. More... | |
const struct GNUNET_TESTING_Command | GNUNET_TESTING_cmd_finish (const char *finish_label, const char *cmd_ref, struct GNUNET_TIME_Relative timeout) |
Create (synchronous) command that waits for another command to finish. More... | |
struct GNUNET_TESTING_Command | GNUNET_TESTING_cmd_make_unblocking (struct GNUNET_TESTING_Command cmd) |
Turn asynchronous command into non blocking command by setting asynchronous_finish to true. More... | |
command to wait for completion of async command
Definition in file testing_api_cmd_finish.c.
|
static |
Function called when the command we are waiting on is finished.
Hence we are finished, too.
cls | a struct FinishState being notified |
Definition at line 74 of file testing_api_cmd_finish.c.
References FinishState::ac, FinishState::cls, FinishState::finish_task, GNUNET_SCHEDULER_cancel(), and GNUNET_TESTING_async_finish().
Referenced by run_finish().
|
static |
Function triggered if the command we are waiting for did not complete on time.
cls | our struct FinishState |
Definition at line 91 of file testing_api_cmd_finish.c.
References FinishState::ac, FinishState::async_label, FinishState::cls, FinishState::finish_task, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, and GNUNET_TESTING_async_fail().
Referenced by run_finish().
|
static |
Run method of the command created by the interpreter to wait for another command to finish.
Definition at line 109 of file testing_api_cmd_finish.c.
References GNUNET_TESTING_Command::ac, FinishState::ac, FinishState::async_label, GNUNET_TESTING_Command::asynchronous_finish, FinishState::cls, GNUNET_TESTING_AsyncContext::cont, GNUNET_TESTING_AsyncContext::cont_cls, done_finish(), FinishState::finish_task, GNUNET_TESTING_AsyncContext::finished, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_add_delayed(), GNUNET_TESTING_async_finish(), GNUNET_TESTING_interpreter_fail(), GNUNET_TESTING_interpreter_lookup_command(), is, FinishState::timeout, and timeout_finish().
|
static |
Cleanup state of a finish command.
cls | a struct FinishState to clean up |
Definition at line 157 of file testing_api_cmd_finish.c.
References FinishState::cls, FinishState::finish_task, GNUNET_free, and GNUNET_SCHEDULER_cancel().
const struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_finish | ( | const char * | finish_label, |
const char * | cmd_ref, | ||
struct GNUNET_TIME_Relative | timeout | ||
) |
Create (synchronous) command that waits for another command to finish.
If cmd_ref did not finish after timeout, this command will fail the test case.
finish_label | label for this command |
cmd_ref | reference to a previous command which we should wait for (call finish() on) |
timeout | how long to wait at most for cmd_ref to finish |
Definition at line 157 of file testing_api_cmd_finish.c.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_make_unblocking | ( | struct GNUNET_TESTING_Command | cmd | ) |
Turn asynchronous command into non blocking command by setting asynchronous_finish to true.
Modifies (and then returns) cmd simply setting the bit. By default, most commands are blocking, and by wrapping the command construction in this function a blocking command can be turned into an asynchronous command where the interpreter continues after initiating the asynchronous action. Does nothing if the command is fundamentally synchronous.
cmd | command to make synchronous. |
Definition at line 157 of file testing_api_cmd_finish.c.