aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-04-30 17:35:24 +0200
committerChristian Grothoff <christian@grothoff.org>2022-04-30 17:35:24 +0200
commitf99fb9ad4b2b2c046de9e1eccebfde8f60e4fa83 (patch)
tree83b57b3fa0d1af66c29b89b407ce6d9ebd364d42
parentfed8353c67136c6252aaf4316d25a880f768ec7b (diff)
-GET purse test passes
-rw-r--r--src/exchange/taler-exchange-httpd_purses_deposit.c29
-rw-r--r--src/exchange/taler-exchange-httpd_purses_get.c16
-rw-r--r--src/exchange/taler-exchange-httpd_purses_merge.c31
3 files changed, 45 insertions, 31 deletions
diff --git a/src/exchange/taler-exchange-httpd_purses_deposit.c b/src/exchange/taler-exchange-httpd_purses_deposit.c
index 95c5d52f6..07fcfb1a0 100644
--- a/src/exchange/taler-exchange-httpd_purses_deposit.c
+++ b/src/exchange/taler-exchange-httpd_purses_deposit.c
@@ -277,20 +277,6 @@ deposit_transaction (void *cls,
return GNUNET_DB_STATUS_HARD_ERROR;
}
}
- {
- struct TALER_PurseEventP rep = {
- .header.size = htons (sizeof (rep)),
- .header.type = htons (TALER_DBEVENT_EXCHANGE_PURSE_DEPOSITED),
- .purse_pub = *pcc->purse_pub
- };
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Notifying about purse deposit\n");
- TEH_plugin->event_notify (TEH_plugin->cls,
- &rep.header,
- NULL,
- 0);
- }
return qs;
}
@@ -656,6 +642,21 @@ TEH_handler_purses_deposit (
return mhd_ret;
}
}
+ {
+ struct TALER_PurseEventP rep = {
+ .header.size = htons (sizeof (rep)),
+ .header.type = htons (TALER_DBEVENT_EXCHANGE_PURSE_DEPOSITED),
+ .purse_pub = *pcc.purse_pub
+ };
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Notifying about purse deposit %s\n",
+ TALER_B2S (pcc.purse_pub));
+ TEH_plugin->event_notify (TEH_plugin->cls,
+ &rep.header,
+ NULL,
+ 0);
+ }
/* generate regular response */
{
diff --git a/src/exchange/taler-exchange-httpd_purses_get.c b/src/exchange/taler-exchange-httpd_purses_get.c
index b9cd9c43f..59cfa35fa 100644
--- a/src/exchange/taler-exchange-httpd_purses_get.c
+++ b/src/exchange/taler-exchange-httpd_purses_get.c
@@ -176,6 +176,11 @@ db_event_cb (void *cls,
(void) extra;
(void) extra_size;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Waking up on %p - %p - %s\n",
+ rc,
+ gc,
+ gc->suspended ? "suspended" : "active");
if (NULL == gc)
return; /* event triggered while main transaction
was still running */
@@ -280,13 +285,19 @@ TEH_handler_purses_get (struct TEH_RequestContext *rc,
};
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Starting DB event listening\n");
+ "Starting DB event listening on purse %s\n",
+ TALER_B2S (&gc->purse_pub));
gc->eh = TEH_plugin->event_listen (
TEH_plugin->cls,
GNUNET_TIME_absolute_get_remaining (gc->timeout),
&rep.header,
&db_event_cb,
rc);
+ if (NULL == gc->eh)
+ {
+ GNUNET_break (0);
+ gc->timeout = GNUNET_TIME_UNIT_ZERO_ABS;
+ }
}
} /* end first-time initialization */
@@ -332,6 +343,9 @@ TEH_handler_purses_get (struct TEH_RequestContext *rc,
gc->purse_expiration));
}
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Deposited amount is %s\n",
+ TALER_amount2s (&gc->deposited));
if (GNUNET_TIME_absolute_is_future (gc->timeout) &&
( ((gc->wait_for_merge) &&
GNUNET_TIME_absolute_is_never (gc->merge_timestamp.abs_time)) ||
diff --git a/src/exchange/taler-exchange-httpd_purses_merge.c b/src/exchange/taler-exchange-httpd_purses_merge.c
index 12a2008f5..a95f4ce44 100644
--- a/src/exchange/taler-exchange-httpd_purses_merge.c
+++ b/src/exchange/taler-exchange-httpd_purses_merge.c
@@ -308,22 +308,6 @@ merge_transaction (void *cls,
GNUNET_free (partner_url);
return GNUNET_DB_STATUS_HARD_ERROR;
}
-
- {
- struct TALER_PurseEventP rep = {
- .header.size = htons (sizeof (rep)),
- .header.type = htons (TALER_DBEVENT_EXCHANGE_PURSE_MERGED),
- .purse_pub = *pcc->purse_pub
- };
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Notifying about purse merge\n");
- TEH_plugin->event_notify (TEH_plugin->cls,
- &rep.header,
- NULL,
- 0);
- }
-
return qs;
}
@@ -550,6 +534,21 @@ TEH_handler_purses_merge (
}
}
+ {
+ struct TALER_PurseEventP rep = {
+ .header.size = htons (sizeof (rep)),
+ .header.type = htons (TALER_DBEVENT_EXCHANGE_PURSE_MERGED),
+ .purse_pub = *pcc.purse_pub
+ };
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Notifying about purse merge\n");
+ TEH_plugin->event_notify (TEH_plugin->cls,
+ &rep.header,
+ NULL,
+ 0);
+ }
+
GNUNET_free (pcc.provider_url);
/* generate regular response */
return reply_merge_success (connection,