diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2022-03-20 15:42:16 +0100 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2022-03-20 15:42:16 +0100 |
commit | 65808106c7d7ddad9420338f3fde139ec0c9295e (patch) | |
tree | b00f9a3ee193d2100fb5901a9303189f21cda1ad /src/testing/testing_api_cmd_reserve_get.c | |
parent | 532fabf20a3f9377f1f9526d38e068069a81a922 (diff) | |
download | exchange-65808106c7d7ddad9420338f3fde139ec0c9295e.tar.gz exchange-65808106c7d7ddad9420338f3fde139ec0c9295e.tar.bz2 exchange-65808106c7d7ddad9420338f3fde139ec0c9295e.zip |
add test for reserve GET long polling
Diffstat (limited to 'src/testing/testing_api_cmd_reserve_get.c')
-rw-r--r-- | src/testing/testing_api_cmd_reserve_get.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/testing/testing_api_cmd_reserve_get.c b/src/testing/testing_api_cmd_reserve_get.c index 3e590f4bc..b4375ee20 100644 --- a/src/testing/testing_api_cmd_reserve_get.c +++ b/src/testing/testing_api_cmd_reserve_get.c @@ -34,6 +34,11 @@ struct PollState { /** + * How long do we give the exchange to respond? + */ + struct GNUNET_TIME_Relative timeout; + + /** * Label to the command which created the reserve to check, * needed to resort the reserve key. */ @@ -331,7 +336,7 @@ finish_run (void *cls, } GNUNET_assert (NULL == ss->ps); ss->ps = ps; - ps->tt = GNUNET_SCHEDULER_add_delayed (ss->timeout, + ps->tt = GNUNET_SCHEDULER_add_delayed (ps->timeout, &finish_timeout, ps); } @@ -347,29 +352,31 @@ static void finish_cleanup (void *cls, const struct TALER_TESTING_Command *cmd) { - struct PollState *ss = cls; + struct PollState *ps = cls; - if (NULL != ss->tt) + if (NULL != ps->tt) { - GNUNET_SCHEDULER_cancel (ss->tt); - ss->tt = NULL; + GNUNET_SCHEDULER_cancel (ps->tt); + ps->tt = NULL; } - GNUNET_free (ss); + GNUNET_free (ps); } struct TALER_TESTING_Command TALER_TESTING_cmd_reserve_poll_finish (const char *label, + struct GNUNET_TIME_Relative timeout, const char *poll_reference) { - struct PollState *ss; + struct PollState *ps; GNUNET_assert (NULL != poll_reference); - ss = GNUNET_new (struct PollState); - ss->poll_reference = poll_reference; + ps = GNUNET_new (struct PollState); + ps->timeout = timeout; + ps->poll_reference = poll_reference; { struct TALER_TESTING_Command cmd = { - .cls = ss, + .cls = ps, .label = label, .run = &finish_run, .cleanup = &finish_cleanup |