gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated: modify merchant to use increment


From: gnunet
Subject: [taler-merchant] branch master updated: modify merchant to use incremental /keys fetching
Date: Wed, 28 Dec 2022 15:04:57 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 99db83bc modify merchant to use incremental /keys fetching
99db83bc is described below

commit 99db83bca3b5dbe1399a642eb4192546bbfd24df
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Dec 28 15:04:54 2022 +0100

    modify merchant to use incremental /keys fetching
---
 src/backend/taler-merchant-httpd_exchanges.c | 35 +++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_exchanges.c 
b/src/backend/taler-merchant-httpd_exchanges.c
index b74ae211..7f6336c1 100644
--- a/src/backend/taler-merchant-httpd_exchanges.c
+++ b/src/backend/taler-merchant-httpd_exchanges.c
@@ -296,7 +296,6 @@ keys_mgmt_cb (void *cls,
  * the closure.
  *
  * @param cls the exchange
- *
  */
 static void
 retry_exchange (void *cls)
@@ -308,16 +307,27 @@ retry_exchange (void *cls)
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Connecting to exchange %s in retry_exchange()\n",
               exchange->url);
-  if (NULL != exchange->conn)
+  if (NULL == exchange->conn)
   {
-    TALER_EXCHANGE_disconnect (exchange->conn);
-    exchange->conn = NULL;
+    exchange->conn = TALER_EXCHANGE_connect (merchant_curl_ctx,
+                                             exchange->url,
+                                             &keys_mgmt_cb,
+                                             exchange,
+                                             TALER_EXCHANGE_OPTION_END);
+  }
+  else
+  {
+    struct GNUNET_TIME_Timestamp next;
+
+    next = TALER_EXCHANGE_check_keys_current (exchange->conn,
+                                              TALER_EXCHANGE_CKF_NONE);
+    if (! GNUNET_TIME_absolute_is_zero (next.abs_time))
+    {
+      exchange->retry_task = GNUNET_SCHEDULER_add_at (next.abs_time,
+                                                      &retry_exchange,
+                                                      exchange);
+    }
   }
-  exchange->conn = TALER_EXCHANGE_connect (merchant_curl_ctx,
-                                           exchange->url,
-                                           &keys_mgmt_cb,
-                                           exchange,
-                                           TALER_EXCHANGE_OPTION_END);
   /* Note: while the API spec says 'returns NULL on error', the implementation
      actually never returns NULL. */
   GNUNET_break (NULL != exchange->conn);
@@ -999,9 +1009,16 @@ keys_mgmt_cb (void *cls,
   expire = TALER_EXCHANGE_check_keys_current (exchange->conn,
                                               TALER_EXCHANGE_CKF_NONE);
   if (0 == GNUNET_TIME_absolute_is_zero (expire.abs_time))
+  {
     delay = RELOAD_DELAY;
+  }
   else
+  {
     delay = GNUNET_TIME_absolute_get_remaining (expire.abs_time);
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "/keys response from expires at %s! Retrying at that time!\n",
+                GNUNET_TIME_absolute2s (expire.abs_time));
+  }
   if (GNUNET_TIME_relative_is_zero (delay))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]