update code to match new API

This commit is contained in:
Christian Grothoff 2016-04-17 20:03:57 +02:00
parent 7496a03978
commit a881e44944
2 changed files with 20 additions and 17 deletions

View File

@ -39,6 +39,7 @@ libtaler_plugin_wire_test_la_LDFLAGS = \
$(TALER_PLUGIN_LDFLAGS) \ $(TALER_PLUGIN_LDFLAGS) \
$(top_builddir)/src/bank-lib/libtalerbank.la \ $(top_builddir)/src/bank-lib/libtalerbank.la \
$(top_builddir)/src/util/libtalerutil.la \ $(top_builddir)/src/util/libtalerutil.la \
-lgnunetcurl \
-lgnunetutil $(XLIB) -lgnunetutil $(XLIB)

View File

@ -23,6 +23,7 @@
#include "taler_wire_plugin.h" #include "taler_wire_plugin.h"
#include "taler_bank_service.h" #include "taler_bank_service.h"
#include "taler_signatures.h" #include "taler_signatures.h"
#include <gnunet/gnunet_curl_lib.h>
/* only for HTTP status codes */ /* only for HTTP status codes */
#include <microhttpd.h> #include <microhttpd.h>
@ -45,9 +46,9 @@ struct TestClosure
char *bank_uri; char *bank_uri;
/** /**
* Handle to the bank for sending funds to the bank. * Handle to the context for sending funds to the bank.
*/ */
struct TALER_BANK_Context *bank; struct GNUNET_CURL_Context *ctx;
/** /**
* Handle to the bank task, or NULL. * Handle to the bank task, or NULL.
@ -151,18 +152,18 @@ context_task (void *cls)
struct GNUNET_TIME_Relative delay; struct GNUNET_TIME_Relative delay;
tc->bt = NULL; tc->bt = NULL;
TALER_BANK_perform (tc->bank); GNUNET_CURL_perform (tc->ctx);
max_fd = -1; max_fd = -1;
timeout = -1; timeout = -1;
FD_ZERO (&read_fd_set); FD_ZERO (&read_fd_set);
FD_ZERO (&write_fd_set); FD_ZERO (&write_fd_set);
FD_ZERO (&except_fd_set); FD_ZERO (&except_fd_set);
TALER_BANK_get_select_info (tc->bank, GNUNET_CURL_get_select_info (tc->ctx,
&read_fd_set, &read_fd_set,
&write_fd_set, &write_fd_set,
&except_fd_set, &except_fd_set,
&max_fd, &max_fd,
&timeout); &timeout);
if (timeout >= 0) if (timeout >= 0)
delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
timeout); timeout);
@ -579,7 +580,7 @@ test_prepare_wire_transfer_cancel (void *cls,
static void static void
execute_cb (void *cls, execute_cb (void *cls,
unsigned int http_status, unsigned int http_status,
json_t *json) const json_t *json)
{ {
struct TALER_WIRE_ExecuteHandle *eh = cls; struct TALER_WIRE_ExecuteHandle *eh = cls;
json_t *reason; json_t *reason;
@ -692,7 +693,7 @@ test_execute_wire_transfer (void *cls,
json_int_t account_no; json_int_t account_no;
struct BufFormatP bf; struct BufFormatP bf;
if (NULL == tc->bank) if (NULL == tc->ctx)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Bank not initialized, cannot do transfers!\n"); "Bank not initialized, cannot do transfers!\n");
@ -735,7 +736,8 @@ test_execute_wire_transfer (void *cls,
eh = GNUNET_new (struct TALER_WIRE_ExecuteHandle); eh = GNUNET_new (struct TALER_WIRE_ExecuteHandle);
eh->cc = cc; eh->cc = cc;
eh->cc_cls = cc_cls; eh->cc_cls = cc_cls;
eh->aaih = TALER_BANK_admin_add_incoming (tc->bank, eh->aaih = TALER_BANK_admin_add_incoming (tc->ctx,
tc->bank_uri,
&bf.wtid, &bf.wtid,
&amount, &amount,
(uint64_t) tc->exchange_account_outgoing_no, (uint64_t) tc->exchange_account_outgoing_no,
@ -829,8 +831,8 @@ libtaler_plugin_wire_test_init (void *cls)
GNUNET_free (tc); GNUNET_free (tc);
return NULL; return NULL;
} }
tc->bank = TALER_BANK_init (tc->bank_uri); tc->ctx = GNUNET_CURL_init ();
if (NULL == tc->bank) if (NULL == tc->ctx)
{ {
GNUNET_break (0); GNUNET_break (0);
GNUNET_free (tc->currency); GNUNET_free (tc->currency);
@ -870,10 +872,10 @@ libtaler_plugin_wire_test_done (void *cls)
GNUNET_SCHEDULER_cancel (tc->bt); GNUNET_SCHEDULER_cancel (tc->bt);
tc->bt = NULL; tc->bt = NULL;
} }
if (NULL != tc->bank) if (NULL != tc->ctx)
{ {
TALER_BANK_fini (tc->bank); GNUNET_CURL_fini (tc->ctx);
tc->bank = NULL; tc->ctx = NULL;
} }
GNUNET_free_non_null (tc->currency); GNUNET_free_non_null (tc->currency);
GNUNET_free_non_null (tc->bank_uri); GNUNET_free_non_null (tc->bank_uri);