gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated: generate auditor si


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated: generate auditor signatures in exchange-lib testcase, and handle problem with bogus revocation keys during startup more gracefully by terminating instead of looping
Date: Thu, 11 May 2017 10:56:17 +0200

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 beee1fb  generate auditor signatures in exchange-lib testcase, and 
handle problem with bogus revocation keys during startup more gracefully by 
terminating instead of looping
beee1fb is described below

commit beee1fb689ab5d0945d4aa99d7942c144e2bdd5a
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu May 11 10:56:15 2017 +0200

    generate auditor signatures in exchange-lib testcase, and handle problem 
with bogus revocation keys during startup more gracefully by terminating 
instead of looping
---
 src/exchange-lib/test_exchange_api.c         | 22 ++++++++
 src/exchange-lib/test_exchange_api.conf      |  4 ++
 src/exchange/taler-exchange-httpd_keystate.c | 81 ++++++++++++++++------------
 3 files changed, 72 insertions(+), 35 deletions(-)

diff --git a/src/exchange-lib/test_exchange_api.c 
b/src/exchange-lib/test_exchange_api.c
index fb0c93e..4c10ea8 100644
--- a/src/exchange-lib/test_exchange_api.c
+++ b/src/exchange-lib/test_exchange_api.c
@@ -3648,6 +3648,7 @@ main (int argc,
                                   "taler-exchange-keyup",
                                   "taler-exchange-keyup",
                                   "-c", "test_exchange_api.conf",
+                                  "-o", "auditor.in",
                                   NULL);
   if (NULL == proc)
   {
@@ -3657,6 +3658,27 @@ main (int argc,
   }
   GNUNET_OS_process_wait (proc);
   GNUNET_OS_process_destroy (proc);
+
+  proc = GNUNET_OS_start_process (GNUNET_NO,
+                                  GNUNET_OS_INHERIT_STD_ALL,
+                                  NULL, NULL, NULL,
+                                  "taler-auditor-sign",
+                                  "taler-auditor-sign",
+                                  "-c", "test_exchange_api.conf",
+                                  "-u", "http://auditor/";,
+                                  "-m", 
"98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG",
+                                  "-r", "auditor.in",
+                                  "-o", 
"test_exchange_api_home/.local/share/taler/auditors/auditor.out",
+                                  NULL);
+  if (NULL == proc)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+               "Failed to run `taler-exchange-keyup`, is your PATH 
correct?\n");
+    return 77;
+  }
+  GNUNET_OS_process_wait (proc);
+  GNUNET_OS_process_destroy (proc);
+
   proc = GNUNET_OS_start_process (GNUNET_NO,
                                   GNUNET_OS_INHERIT_STD_ALL,
                                   NULL, NULL, NULL,
diff --git a/src/exchange-lib/test_exchange_api.conf 
b/src/exchange-lib/test_exchange_api.conf
index 89d1479..a8543bc 100644
--- a/src/exchange-lib/test_exchange_api.conf
+++ b/src/exchange-lib/test_exchange_api.conf
@@ -58,6 +58,10 @@ CLOSING-FEE-2024 = EUR:0.01
 CLOSING-FEE-2025 = EUR:0.01
 CLOSING-FEE-2026 = EUR:0.01
 
+[exchange_keys]
+# Keep it short so the test runs fast.
+LOOKAHEAD_SIGN = 12 h
+
 [exchange-wire-test]
 # Enable 'test' for testing of the actual coin operations.
 ENABLE = YES
diff --git a/src/exchange/taler-exchange-httpd_keystate.c 
b/src/exchange/taler-exchange-httpd_keystate.c
index 057f89c..0de85ee 100644
--- a/src/exchange/taler-exchange-httpd_keystate.c
+++ b/src/exchange/taler-exchange-httpd_keystate.c
@@ -266,6 +266,34 @@ store_in_map (struct GNUNET_CONTAINER_MultiHashMap *map,
 
 
 /**
+ * Handle a signal, writing relevant signal numbers to the pipe.
+ *
+ * @param signal_number the signal number
+ */
+static void
+handle_signal (int signal_number)
+{
+  ssize_t res;
+  char c = signal_number;
+
+  res = write (reload_pipe[1],
+               &c,
+               1);
+  if ( (res < 0) &&
+       (EINTR != errno) )
+  {
+    GNUNET_break (0);
+    return;
+  }
+  if (0 == res)
+  {
+    GNUNET_break (0);
+    return;
+  }
+}
+
+
+/**
  * Iterator for (re)loading/initializing denomination keys.
  *
  * @param cls closure
@@ -284,6 +312,7 @@ reload_keys_denom_iter (void *cls,
 {
   struct TEH_KS_StateHandle *ctx = cls;
   struct GNUNET_TIME_Absolute now;
+  struct GNUNET_TIME_Absolute start;
   struct GNUNET_TIME_Absolute horizon;
   struct GNUNET_TIME_Absolute expire_deposit;
   struct GNUNET_HashCode denom_key_hash;
@@ -318,6 +347,8 @@ reload_keys_denom_iter (void *cls,
 
   if (NULL != revocation_master_sig)
   {
+    unsigned int thresh = 0;
+
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                 "Adding denomination key `%s' to revokation set\n",
                 alias);
@@ -326,12 +357,19 @@ reload_keys_denom_iter (void *cls,
     if (GNUNET_NO == res)
       return GNUNET_OK;
     /* Try to insert DKI into DB until we succeed; note that if the DB
-       failure is persistent, this code may loop forever (as there is no
-       sane alternative, we cannot continue without the DKI being in the
-       DB). */
+       failure is persistent, we need to die, as we cannot continue
+       without the DKI being in the DB). */
     res = GNUNET_SYSERR;
     while (GNUNET_OK != res)
     {
+      thresh++;
+      if (thresh > 16)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    "Giving up, this is fatal. Committing suicide via 
SIGTERM.\n");
+        handle_signal (SIGTERM);
+        return GNUNET_SYSERR;
+      }
       res = TEH_plugin->start (TEH_plugin->cls,
                                session);
       if (GNUNET_OK != res)
@@ -366,12 +404,13 @@ reload_keys_denom_iter (void *cls,
     return GNUNET_OK;
   }
   horizon = GNUNET_TIME_relative_to_absolute 
(TALER_EXCHANGE_conf_duration_provide ());
-  if (GNUNET_TIME_absolute_ntoh (dki->issue.properties.start).abs_value_us >
-      horizon.abs_value_us)
+  start = GNUNET_TIME_absolute_ntoh (dki->issue.properties.start);
+  if (start.abs_value_us > horizon.abs_value_us)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Skipping future denomination key `%s'\n",
-                alias);
+                "Skipping future denomination key `%s' (starts at %s)\n",
+                alias,
+                GNUNET_STRINGS_absolute_time_to_string (start));
     return GNUNET_OK;
   }
 
@@ -957,34 +996,6 @@ TEH_KS_denomination_key_lookup (const struct 
TEH_KS_StateHandle *key_state,
 
 
 /**
- * Handle a signal, writing relevant signal numbers to the pipe.
- *
- * @param signal_number the signal number
- */
-static void
-handle_signal (int signal_number)
-{
-  ssize_t res;
-  char c = signal_number;
-
-  res = write (reload_pipe[1],
-               &c,
-               1);
-  if ( (res < 0) &&
-       (EINTR != errno) )
-  {
-    GNUNET_break (0);
-    return;
-  }
-  if (0 == res)
-  {
-    GNUNET_break (0);
-    return;
-  }
-}
-
-
-/**
  * Call #handle_signal() to pass the received signal via
  * the control pipe.
  */

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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