diff options
-rw-r--r-- | configure.ac | 4 | ||||
m--------- | contrib/gana | 0 | ||||
m--------- | doc/prebuilt | 0 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_purses_get.c | 57 | ||||
-rw-r--r-- | src/exchangedb/exchange_do_expire_purse.sql | 3 | ||||
-rw-r--r-- | src/exchangedb/pg_insert_aml_decision.c | 2 | ||||
-rw-r--r-- | src/exchangedb/pg_insert_kyc_attributes.c | 2 | ||||
-rw-r--r-- | src/exchangedb/pg_reserves_in_insert.c | 2 |
8 files changed, 34 insertions, 36 deletions
diff --git a/configure.ac b/configure.ac index 5f211c4b2..8c7769a83 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 -Subproject 40f6cf1015231663064eda98aa1e403cddd7b97 +Subproject 9eddc2cf7b65bb43d285c75ef22fd9bc9cc7020 diff --git a/doc/prebuilt b/doc/prebuilt -Subproject 5e47a72e8a2b5086dfdae4078f695155f5ed7af +Subproject 5e7026c5cef101c90b6dc58096e0a0946ef11b0 diff --git a/src/exchange/taler-exchange-httpd_purses_get.c b/src/exchange/taler-exchange-httpd_purses_get.c index cb0c5ca77..22328fe09 100644 --- a/src/exchange/taler-exchange-httpd_purses_get.c +++ b/src/exchange/taler-exchange-httpd_purses_get.c @@ -57,6 +57,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. */ struct TALER_PurseContractPublicKeyP purse_pub; @@ -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 1a17869ad..ee9757f03 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 a3653824c..39419be59 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 8b3cf84c6..3c94abb85 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 17cb496bf..21734942a 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); } |