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: retry instantly if


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated: retry instantly if /keys download fails during testcase startup
Date: Sun, 19 Aug 2018 13:27:23 +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 7663baf2 retry instantly if /keys download fails during testcase 
startup
7663baf2 is described below

commit 7663baf2e25d47fd1b796b17b2b95ccb8436b483
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Aug 19 13:27:13 2018 +0200

    retry instantly if /keys download fails during testcase startup
---
 .../.config/taler/account-2.json                   |  4 +-
 src/exchange-lib/testing_api_loop.c                | 46 ++++++++++++++++------
 2 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/src/benchmark/exchange_benchmark_home/.config/taler/account-2.json 
b/src/benchmark/exchange_benchmark_home/.config/taler/account-2.json
index 49114a10..222f5558 100644
--- a/src/benchmark/exchange_benchmark_home/.config/taler/account-2.json
+++ b/src/benchmark/exchange_benchmark_home/.config/taler/account-2.json
@@ -1,5 +1,5 @@
 {
   "url": "payto://x-taler-bank/localhost:8082/2",
-  "salt": 
"B9H7WG3A6881HNVK7C508EHMJ10Z0CEB21Z9047KXKMCZG67JK5M27EQNRW38KNPVXDYNYTX27PA34VSA8JN3NXJA0BX655WGJMM7B8",
-  "master_sig": 
"FCJAM149MFKTMD8XQ7S32TBD53VN97Y3BCXFXSGQ8DH94P18XXCPRA3Z9ZYBQ4JFFEPS4RE48ACS99MMM193QZ10M7MKGS2B685F030"
+  "salt": 
"MHJ6P3XF2WEC6WA097H8N1MPCT37T7TBHJ3FDTRBPGX0JNQYHJW6D52J0269WS68WG04FMCD5C0E49YEW7R21EXKC7P1TYTJMVKXNZR",
+  "master_sig": 
"ZGZVVR4S9PH9A494B15QSAYCX6NDVF735JN3426T7QQ77VK6QR971TQX71NXHR8N54RGC5GMC49YPK4RSFCJ2Z9GG1CWJ7MAEQSDC08"
 }
\ No newline at end of file
diff --git a/src/exchange-lib/testing_api_loop.c 
b/src/exchange-lib/testing_api_loop.c
index 27611b2d..8309d812 100644
--- a/src/exchange-lib/testing_api_loop.c
+++ b/src/exchange-lib/testing_api_loop.c
@@ -294,6 +294,7 @@ do_shutdown (void *cls)
   if (NULL != is->exchange)
   {
     TALER_EXCHANGE_disconnect (is->exchange);
+    is->exchange = NULL;
   }
   if (NULL != is->task)
   {
@@ -514,7 +515,7 @@ struct MainContext
   TALER_TESTING_Main main_cb;
 
   /**
-   * Closure for "run".
+   * Closure for @e main_cb.
    */
   void *main_cb_cls;
 
@@ -531,6 +532,11 @@ struct MainContext
    */
   const char *config_filename;
 
+  /**
+   * URL of the exchange.
+   */
+  char *exchange_url;
+
 };
 
 
@@ -566,11 +572,27 @@ cert_cb (void *cls,
         enum TALER_EXCHANGE_VersionCompatibility compat)
 {
   struct MainContext *main_ctx = cls;
+  struct TALER_TESTING_Interpreter *is = main_ctx->is;
 
   if (NULL == keys)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Got NULL response for /keys\n");
+    if (GNUNET_NO == is->working)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "Got NULL response for /keys during startup, retrying!\n");
+      TALER_EXCHANGE_disconnect (is->exchange);
+      GNUNET_assert (NULL !=
+                     (is->exchange = TALER_EXCHANGE_connect (is->ctx,
+                                                             
main_ctx->exchange_url,
+                                                             &cert_cb,
+                                                             main_ctx,
+                                                             
TALER_EXCHANGE_OPTION_END)));
+      return;
+    }
+    else
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Got NULL response for /keys during execution!\n");
+
   }
   else
   {
@@ -578,28 +600,28 @@ cert_cb (void *cls,
                 "Got %d DK from /keys\n",
                 keys->num_denom_keys);
   }
-  main_ctx->is->key_generation++;
-  main_ctx->is->keys = keys;
+  is->key_generation++;
+  is->keys = keys;
 
   /* /keys has been called for some reason and
    * the interpreter is already running. */
-  if (GNUNET_YES == main_ctx->is->working)
+  if (GNUNET_YES == is->working)
     return;
 
-  main_ctx->is->working = GNUNET_YES;
+  is->working = GNUNET_YES;
 
   /* Very first start of tests, call "run()" */
-  if (1 == main_ctx->is->key_generation)
+  if (1 == is->key_generation)
   {
     main_ctx->main_cb (main_ctx->main_cb_cls,
-                       main_ctx->is);
+                       is);
     return;
   }
 
   /* Tests already started, just trigger the
    * next command. */
   GNUNET_SCHEDULER_add_now (&interpreter_run,
-                            main_ctx->is);
+                            is);
 }
 
 
@@ -653,13 +675,13 @@ main_wrapper_exchange_connect (void *cls)
     GNUNET_CONFIGURATION_destroy (cfg);
     return;
   }
+  main_ctx->exchange_url = exchange_url;
   GNUNET_assert (NULL !=
                  (is->exchange = TALER_EXCHANGE_connect (is->ctx,
                                                          exchange_url,
                                                          &cert_cb,
                                                          main_ctx,
                                                          
TALER_EXCHANGE_OPTION_END)));
-  GNUNET_free (exchange_url);
   GNUNET_CONFIGURATION_destroy (cfg);
 }
 
@@ -726,7 +748,7 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb,
   else
      GNUNET_SCHEDULER_run (&main_wrapper_exchange_agnostic,
                            &main_ctx);
-
+  GNUNET_free_non_null (main_ctx.exchange_url);
   GNUNET_SIGNAL_handler_uninstall (shc_chld);
   GNUNET_DISK_pipe_close (sigpipe);
   sigpipe = NULL;

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



reply via email to

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