[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: fix long-polling on purses GET w
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: fix long-polling on purses GET with purse refund event |
Date: |
Mon, 08 Jan 2024 15:28:28 +0100 |
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 bc1e8787 fix long-polling on purses GET with purse refund event
bc1e8787 is described below
commit bc1e8787e5954ca2d433f495bee336e7b57c1654
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Jan 8 15:28:25 2024 +0100
fix long-polling on purses GET with purse refund event
---
configure.ac | 4 +-
contrib/gana | 2 +-
doc/prebuilt | 2 +-
src/exchange/taler-exchange-httpd_purses_get.c | 57 ++++++++++++--------------
src/exchangedb/exchange_do_expire_purse.sql | 3 ++
src/exchangedb/pg_insert_aml_decision.c | 2 +-
src/exchangedb/pg_insert_kyc_attributes.c | 2 +-
src/exchangedb/pg_reserves_in_insert.c | 2 +-
8 files changed, 36 insertions(+), 38 deletions(-)
diff --git a/configure.ac b/configure.ac
index 5f211c4b..8c7769a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -310,11 +310,11 @@ AS_CASE([$with_gnunet],
CPPFLAGS="-I$with_gnunet/include ${CPPFLAGS}"])
CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_CPPFLAGS}"
AC_CHECK_HEADERS([gnunet/gnunet_pq_lib.h],
- [AC_CHECK_LIB([gnunetpq], [GNUNET_PQ_result_spec_array_string],
libgnunetpq=1)])
+ [AC_CHECK_LIB([gnunetpq], [GNUNET_PQ_get_event_notify_channel],
libgnunetpq=1)])
AS_IF([test $libgnunetpq != 1],
[AC_MSG_ERROR([[
***
-*** You need libgnunetpq version >= 4.0.0 to build this program.
+*** You need libgnunetpq version >= 5:0:0 to build this program.
*** Make sure you have Postgres installed while
*** building GNUnet (and that your GNUnet version
*** is recent!)
diff --git a/contrib/gana b/contrib/gana
index 40f6cf10..9eddc2cf 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 40f6cf1015231663064eda98aa1e403cddd7b970
+Subproject commit 9eddc2cf7b65bb43d285c75ef22fd9bc9cc7020e
diff --git a/doc/prebuilt b/doc/prebuilt
index 5e47a72e..5e7026c5 160000
--- a/doc/prebuilt
+++ b/doc/prebuilt
@@ -1 +1 @@
-Subproject commit 5e47a72e8a2b5086dfdae4078f695155f5ed7af8
+Subproject commit 5e7026c5cef101c90b6dc58096e0a0946ef11b08
diff --git a/src/exchange/taler-exchange-httpd_purses_get.c
b/src/exchange/taler-exchange-httpd_purses_get.c
index cb0c5ca7..22328fe0 100644
--- a/src/exchange/taler-exchange-httpd_purses_get.c
+++ b/src/exchange/taler-exchange-httpd_purses_get.c
@@ -56,6 +56,12 @@ struct GetContext
*/
struct GNUNET_DB_EventHandler *eh;
+ /**
+ * Subscription for refund event we are
+ * waiting for.
+ */
+ struct GNUNET_DB_EventHandler *ehr;
+
/**
* Public key of our purse.
*/
@@ -153,6 +159,12 @@ gc_cleanup (struct TEH_RequestContext *rc)
gc->eh);
gc->eh = NULL;
}
+ if (NULL != gc->ehr)
+ {
+ TEH_plugin->event_listen_cancel (TEH_plugin->cls,
+ gc->ehr);
+ gc->ehr = NULL;
+ }
GNUNET_free (gc);
}
@@ -272,6 +284,20 @@ TEH_handler_purses_get (struct TEH_RequestContext *rc,
GNUNET_break (0);
gc->timeout = GNUNET_TIME_UNIT_ZERO_ABS;
}
+ else
+ {
+ struct GNUNET_DB_EventHeaderP repr = {
+ .size = htons (sizeof (repr)),
+ .type = htons (TALER_DBEVENT_EXCHANGE_PURSE_REFUNDED),
+ };
+
+ gc->ehr = TEH_plugin->event_listen (
+ TEH_plugin->cls,
+ GNUNET_TIME_absolute_get_remaining (gc->timeout),
+ &repr,
+ &db_event_cb,
+ rc);
+ }
}
} /* end first-time initialization */
@@ -311,37 +337,6 @@ TEH_handler_purses_get (struct TEH_RequestContext *rc,
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
break; /* handled below */
}
- if (GNUNET_TIME_absolute_cmp (gc->timeout,
- >,
- gc->purse_expiration.abs_time))
- {
- /* Timeout too high, need to replace event handler */
- struct TALER_PurseEventP rep = {
- .header.size = htons (sizeof (rep)),
- .header.type = htons (
- gc->wait_for_merge
- ? TALER_DBEVENT_EXCHANGE_PURSE_MERGED
- : TALER_DBEVENT_EXCHANGE_PURSE_DEPOSITED),
- .purse_pub = gc->purse_pub
- };
- struct GNUNET_DB_EventHandler *eh2;
-
- gc->timeout = gc->purse_expiration.abs_time;
- eh2 = TEH_plugin->event_listen (
- TEH_plugin->cls,
- GNUNET_TIME_absolute_get_remaining (gc->timeout),
- &rep.header,
- &db_event_cb,
- rc);
- if (NULL == eh2)
- {
- GNUNET_break (0);
- gc->timeout = GNUNET_TIME_UNIT_ZERO_ABS;
- }
- TEH_plugin->event_listen_cancel (TEH_plugin->cls,
- gc->eh);
- gc->eh = eh2;
- }
}
if (purse_refunded ||
purse_deleted)
diff --git a/src/exchangedb/exchange_do_expire_purse.sql
b/src/exchangedb/exchange_do_expire_purse.sql
index 1a17869a..ee9757f0 100644
--- a/src/exchangedb/exchange_do_expire_purse.sql
+++ b/src/exchangedb/exchange_do_expire_purse.sql
@@ -56,6 +56,9 @@ VALUES
,in_now
,TRUE);
+-- Code for 'TALER_DBEVENT_EXCHANGE_PURSE_REFUNDED'
+NOTIFY X8DJSPNYJMNZDAP7GN6YQ4EZVSQXMF3HRP4VAR347WP9SZYP1C200;
+
IF (my_in_reserve_quota)
THEN
UPDATE reserves
diff --git a/src/exchangedb/pg_insert_aml_decision.c
b/src/exchangedb/pg_insert_aml_decision.c
index a3653824..39419be5 100644
--- a/src/exchangedb/pg_insert_aml_decision.c
+++ b/src/exchangedb/pg_insert_aml_decision.c
@@ -49,7 +49,7 @@ TEH_PG_insert_aml_decision (
.header.type = htons (TALER_DBEVENT_EXCHANGE_KYC_COMPLETED),
.h_payto = *h_payto
};
- char *notify_s = GNUNET_PG_get_event_notify_channel (&rep.header);
+ char *notify_s = GNUNET_PQ_get_event_notify_channel (&rep.header);
char *kyc_s = (NULL != kyc_requirements)
? json_dumps (kyc_requirements, JSON_COMPACT)
: NULL;
diff --git a/src/exchangedb/pg_insert_kyc_attributes.c
b/src/exchangedb/pg_insert_kyc_attributes.c
index 8b3cf84c..3c94abb8 100644
--- a/src/exchangedb/pg_insert_kyc_attributes.c
+++ b/src/exchangedb/pg_insert_kyc_attributes.c
@@ -53,7 +53,7 @@ TEH_PG_insert_kyc_attributes (
.h_payto = *h_payto
};
char *kyc_completed_notify_s
- = GNUNET_PG_get_event_notify_channel (&rep.header);
+ = GNUNET_PQ_get_event_notify_channel (&rep.header);
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&process_row),
GNUNET_PQ_query_param_auto_from_type (h_payto),
diff --git a/src/exchangedb/pg_reserves_in_insert.c
b/src/exchangedb/pg_reserves_in_insert.c
index 17cb496b..21734942 100644
--- a/src/exchangedb/pg_reserves_in_insert.c
+++ b/src/exchangedb/pg_reserves_in_insert.c
@@ -51,7 +51,7 @@ compute_notify_on_reserve (const struct
TALER_ReservePublicKeyP *reserve_pub)
.reserve_pub = *reserve_pub
};
- return GNUNET_PG_get_event_notify_channel (&rep.header);
+ return GNUNET_PQ_get_event_notify_channel (&rep.header);
}
--
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: fix long-polling on purses GET with purse refund event,
gnunet <=