[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: -towards API atomization
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: -towards API atomization |
Date: |
Wed, 21 Jun 2023 08:02:41 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new a37a8d34 -towards API atomization
a37a8d34 is described below
commit a37a8d34d54cd91fba321a225ae626e8594c6a48
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Jun 21 08:02:36 2023 +0200
-towards API atomization
---
src/include/taler_auditor_service.h | 8 ++++---
src/lib/auditor_api_exchanges.c | 28 +++++++++----------------
src/testing/testing_api_cmd_auditor_exchanges.c | 23 ++++++++++++--------
3 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/src/include/taler_auditor_service.h
b/src/include/taler_auditor_service.h
index 9d721550..5ee41c3b 100644
--- a/src/include/taler_auditor_service.h
+++ b/src/include/taler_auditor_service.h
@@ -211,7 +211,7 @@ struct TALER_AUDITOR_Handle;
* interactions with the auditor will be checked to be signed
* (where appropriate) by the respective master key.
*
- * @param ctx the context
+ * @param ctx the context for CURL requests
* @param url HTTP base URL for the auditor
* @param version_cb function to call with the auditor's version information
* @param version_cb_cls closure for @a version_cb
@@ -412,14 +412,16 @@ typedef void
* auditor's response. If the auditor's reply is not
* well-formed, we return an HTTP status code of zero to @a cb.
*
- * @param auditor the auditor handle; the auditor must be ready to operate
+ * @param ctx the context for CURL requests
+ * @param url HTTP base URL for the auditor
* @param cb the callback to call when a reply for this request is available
* @param cb_cls closure for the above callback
* @return a handle for this request; NULL if the inputs are invalid (i.e.
* signatures fail to verify). In this case, the callback is not
called.
*/
struct TALER_AUDITOR_ListExchangesHandle *
-TALER_AUDITOR_list_exchanges (struct TALER_AUDITOR_Handle *auditor,
+TALER_AUDITOR_list_exchanges (struct GNUNET_CURL_Context *ctx,
+ const char *url,
TALER_AUDITOR_ListExchangesResultCallback cb,
void *cb_cls);
diff --git a/src/lib/auditor_api_exchanges.c b/src/lib/auditor_api_exchanges.c
index 9f35c707..8acf5946 100644
--- a/src/lib/auditor_api_exchanges.c
+++ b/src/lib/auditor_api_exchanges.c
@@ -44,11 +44,6 @@
struct TALER_AUDITOR_ListExchangesHandle
{
- /**
- * The connection to auditor this request handle will use
- */
- struct TALER_AUDITOR_Handle *auditor;
-
/**
* The url for this request.
*/
@@ -122,14 +117,15 @@ handle_exchanges_finished (void *cls,
}
{
struct TALER_AUDITOR_ExchangeInfo ei[GNUNET_NZL (ja_len)];
- bool ok;
+ bool ok = true;
- ok = true;
for (unsigned int i = 0; i<ja_len; i++)
{
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_fixed_auto ("master_pub", &ei[i].master_pub),
- GNUNET_JSON_spec_string ("exchange_url", &ei[i].exchange_url),
+ GNUNET_JSON_spec_fixed_auto ("master_pub",
+ &ei[i].master_pub),
+ GNUNET_JSON_spec_string ("exchange_url",
+ &ei[i].exchange_url),
GNUNET_JSON_spec_end ()
};
@@ -192,23 +188,20 @@ handle_exchanges_finished (void *cls,
struct TALER_AUDITOR_ListExchangesHandle *
-TALER_AUDITOR_list_exchanges (struct TALER_AUDITOR_Handle *auditor,
+TALER_AUDITOR_list_exchanges (struct GNUNET_CURL_Context *ctx,
+ const char *url,
TALER_AUDITOR_ListExchangesResultCallback cb,
void *cb_cls)
{
struct TALER_AUDITOR_ListExchangesHandle *leh;
- struct GNUNET_CURL_Context *ctx;
CURL *eh;
- GNUNET_assert (GNUNET_YES ==
- TALER_AUDITOR_handle_is_ready_ (auditor));
-
leh = GNUNET_new (struct TALER_AUDITOR_ListExchangesHandle);
- leh->auditor = auditor;
leh->cb = cb;
leh->cb_cls = cb_cls;
- leh->url = TALER_AUDITOR_path_to_url_ (auditor,
- "/exchanges");
+ leh->url = TALER_url_join (url,
+ "exchanges",
+ NULL);
if (NULL == leh->url)
{
GNUNET_free (leh);
@@ -225,7 +218,6 @@ TALER_AUDITOR_list_exchanges (struct TALER_AUDITOR_Handle
*auditor,
GNUNET_free (leh);
return NULL;
}
- ctx = TALER_AUDITOR_handle_to_context_ (auditor);
leh->job = GNUNET_CURL_job_add (ctx,
eh,
&handle_exchanges_finished,
diff --git a/src/testing/testing_api_cmd_auditor_exchanges.c
b/src/testing/testing_api_cmd_auditor_exchanges.c
index ea9ace3e..aa9a1bfb 100644
--- a/src/testing/testing_api_cmd_auditor_exchanges.c
+++ b/src/testing/testing_api_cmd_auditor_exchanges.c
@@ -208,7 +208,7 @@ exchanges_run (void *cls,
{
struct ExchangesState *es = cls;
const struct TALER_TESTING_Command *auditor_cmd;
- struct TALER_AUDITOR_Handle *auditor;
+ const char *auditor_url;
(void) cmd;
auditor_cmd = TALER_TESTING_interpreter_get_command (is,
@@ -219,15 +219,20 @@ exchanges_run (void *cls,
TALER_TESTING_interpreter_fail (is);
return;
}
- GNUNET_assert (GNUNET_OK ==
- TALER_TESTING_get_trait_auditor (auditor_cmd,
- &auditor));
-
+ if (GNUNET_OK !=
+ TALER_TESTING_get_trait_auditor_url (auditor_cmd,
+ &auditor_url))
+ {
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (is);
+ return;
+ }
es->is = is;
- es->leh = TALER_AUDITOR_list_exchanges (auditor,
- &exchanges_cb,
- es);
-
+ es->leh = TALER_AUDITOR_list_exchanges (
+ TALER_TESTING_interpreter_get_context (is),
+ auditor_url,
+ &exchanges_cb,
+ es);
if (NULL == es->leh)
{
GNUNET_break (0);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: -towards API atomization,
gnunet <=