aboutsummaryrefslogtreecommitdiff
path: root/src/wire-plugins/plugin_wire_taler-bank.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wire-plugins/plugin_wire_taler-bank.c')
-rw-r--r--src/wire-plugins/plugin_wire_taler-bank.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/wire-plugins/plugin_wire_taler-bank.c b/src/wire-plugins/plugin_wire_taler-bank.c
index 97b1e6c84..e1db643d3 100644
--- a/src/wire-plugins/plugin_wire_taler-bank.c
+++ b/src/wire-plugins/plugin_wire_taler-bank.c
@@ -765,7 +765,8 @@ struct TALER_WIRE_HistoryHandle
765{ 765{
766 766
767 /** 767 /**
768 * Function to call with results. 768 * Function to call with results, can become NULL if the
769 * application cancels the iteration.
769 */ 770 */
770 TALER_WIRE_HistoryResultCallback hres_cb; 771 TALER_WIRE_HistoryResultCallback hres_cb;
771 772
@@ -797,6 +798,7 @@ static void
797taler_bank_get_history_cancel (void *cls, 798taler_bank_get_history_cancel (void *cls,
798 struct TALER_WIRE_HistoryHandle *whh) 799 struct TALER_WIRE_HistoryHandle *whh)
799{ 800{
801 (void) cls;
800 if (NULL != whh->hh) 802 if (NULL != whh->hh)
801 { 803 {
802 TALER_BANK_history_cancel (whh->hh); 804 TALER_BANK_history_cancel (whh->hh);
@@ -893,7 +895,11 @@ bhist_cb (void *cls,
893 GNUNET_break (NULL != whh->hh); 895 GNUNET_break (NULL != whh->hh);
894 /* Once we get the sentinel element, the handle becomes invalid. */ 896 /* Once we get the sentinel element, the handle becomes invalid. */
895 if (TALER_BANK_DIRECTION_NONE == dir) 897 if (TALER_BANK_DIRECTION_NONE == dir)
898 {
896 whh->hh = NULL; 899 whh->hh = NULL;
900 taler_bank_get_history_cancel (NULL,
901 whh);
902 }
897 return; 903 return;
898 } 904 }
899 case MHD_HTTP_NO_CONTENT: 905 case MHD_HTTP_NO_CONTENT:
@@ -904,6 +910,9 @@ bhist_cb (void *cls,
904 NULL, 910 NULL,
905 0, 911 0,
906 NULL); 912 NULL);
913 whh->hh = NULL;
914 taler_bank_get_history_cancel (NULL,
915 whh);
907 break; 916 break;
908 default: 917 default:
909 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 918 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -917,6 +926,9 @@ bhist_cb (void *cls,
917 NULL, 926 NULL,
918 0, 927 0,
919 NULL); 928 NULL);
929 whh->hh = NULL;
930 taler_bank_get_history_cancel (NULL,
931 whh);
920 break; 932 break;
921 } 933 }
922 whh->hh = NULL; 934 whh->hh = NULL;
@@ -962,6 +974,7 @@ taler_bank_get_history (void *cls,
962 uint64_t start_row; 974 uint64_t start_row;
963 struct TALER_Account account; 975 struct TALER_Account account;
964 976
977 GNUNET_assert (NULL != hres_cb);
965 if (0 == num_results) 978 if (0 == num_results)
966 { 979 {
967 GNUNET_break (0); 980 GNUNET_break (0);
@@ -1019,13 +1032,12 @@ taler_bank_get_history (void *cls,
1019 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1032 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1020 "Could not parse the auth values from '%s'\n", 1033 "Could not parse the auth values from '%s'\n",
1021 account_section); 1034 account_section);
1035 TALER_WIRE_account_free (&account);
1022 GNUNET_free (whh); 1036 GNUNET_free (whh);
1023 return NULL; 1037 return NULL;
1024 } 1038 }
1025
1026 whh->hres_cb = hres_cb; 1039 whh->hres_cb = hres_cb;
1027 whh->hres_cb_cls = hres_cb_cls; 1040 whh->hres_cb_cls = hres_cb_cls;
1028
1029 whh->hh = TALER_BANK_history (tc->ctx, 1041 whh->hh = TALER_BANK_history (tc->ctx,
1030 account.details.x_taler_bank.bank_base_url, 1042 account.details.x_taler_bank.bank_base_url,
1031 &whh->auth, 1043 &whh->auth,
@@ -1040,16 +1052,16 @@ taler_bank_get_history (void *cls,
1040 if (NULL == whh->hh) 1052 if (NULL == whh->hh)
1041 { 1053 {
1042 GNUNET_break (0); 1054 GNUNET_break (0);
1043 taler_bank_get_history_cancel (NULL, 1055 taler_bank_get_history_cancel (tc,
1044 whh); 1056 whh);
1045 TALER_WIRE_account_free (&account); 1057 TALER_WIRE_account_free (&account);
1046 return NULL; 1058 return NULL;
1047 } 1059 }
1048 TALER_WIRE_account_free (&account); 1060 TALER_WIRE_account_free (&account);
1049 GNUNET_assert (NULL != whh);
1050 return whh; 1061 return whh;
1051} 1062}
1052 1063
1064
1053/** 1065/**
1054 * Context for a rejection operation. 1066 * Context for a rejection operation.
1055 */ 1067 */