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 (123d5077 -> 2025e11


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated (123d5077 -> 2025e116)
Date: Thu, 11 Apr 2019 00:25:42 +0200

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

marcello pushed a change to branch master
in repository exchange.

    from 123d5077 fix build trouble
     new 0d375880 Better calculation of # DKs
     new 12aa5160 Fix history CMD loop, + make fakebank demonize.
     new 2025e116 Address compilation warnings.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/bank-lib/fakebank.c                            |  4 +-
 src/bank-lib/taler-bank-transfer.c                 |  4 +-
 src/bank-lib/test_bank_api_new.c                   | 38 +++++++--------
 src/bank-lib/test_bank_api_with_fakebank_twisted.c |  4 +-
 src/bank-lib/testing_api_cmd_history.c             | 43 ++++++++++++-----
 src/exchange-tools/taler-exchange-keyup.c          |  9 ----
 src/exchangedb/exchangedb_denomkeys.c              |  2 +-
 .../test_exchange_api_keys_cherry_picking_new.c    | 55 +++++++++++++---------
 8 files changed, 93 insertions(+), 66 deletions(-)

diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index 1220fa05..a72d978f 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -980,7 +980,9 @@ TALER_FAKEBANK_start (uint16_t port)
   h = GNUNET_new (struct TALER_FAKEBANK_Handle);
   h->mhd_bank = MHD_start_daemon (MHD_USE_DEBUG
 #if EPOLL_SUPPORT
-                                 | MHD_USE_EPOLL
+                                 | MHD_USE_EPOLL_INTERNAL_THREAD
+#else
+                                  | MHD_USE_INTERNAL_POLLING_THREAD
 #endif
                                  | MHD_USE_DUAL_STACK,
                                   port,
diff --git a/src/bank-lib/taler-bank-transfer.c 
b/src/bank-lib/taler-bank-transfer.c
index d354dafd..8b503a41 100644
--- a/src/bank-lib/taler-bank-transfer.c
+++ b/src/bank-lib/taler-bank-transfer.c
@@ -115,13 +115,15 @@ do_shutdown (void *cls)
  *                    0 if the bank's reply is bogus (fails to follow the 
protocol)
  * @param ec detailed error code
  * @param serial_id unique ID of the wire transfer in the bank's records; 
UINT64_MAX on error
+ * @param timestamp timestamp when the transaction got settled at the bank.
  * @param json detailed response from the HTTPD, or NULL if reply was not in 
JSON
  */
 static void
 res_cb (void *cls,
         unsigned int http_status,
         enum TALER_ErrorCode ec,
-        uint64_t serial_id,
+        long long unsigned serial_id,
+        struct GNUNET_TIME_Absolute timestamp,
         const json_t *json)
 {
   op = NULL;
diff --git a/src/bank-lib/test_bank_api_new.c b/src/bank-lib/test_bank_api_new.c
index 5031a308..ab0358c3 100644
--- a/src/bank-lib/test_bank_api_new.c
+++ b/src/bank-lib/test_bank_api_new.c
@@ -40,26 +40,27 @@
 #define CONFIG_FILE "bank.conf"
 
 /**
- * Adds to the current time.
+ * Add seconds.
  *
- * @param relative number of _seconds_ to add to the current time.
+ * @param base absolute time to add seconds to.
+ * @param relative number of seconds to add.
  * @return a new absolute time, modified according to @e relative.
  */
-#define NOWPLUSSECS(secs) \
+#define ADDSECS(base, secs) \
   GNUNET_TIME_absolute_add \
-    (now, \
+    (base, \
      GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \
                                     secs))
-
 /**
- * Subtracts from the current time.
+ * Subtract seconds.
  *
- * @param relative number of _seconds_ to add to the current time.
+ * @param base absolute time to subtract seconds to.
+ * @param secs relative number of _seconds_ to subtract.
  * @return a new absolute time, modified according to @e relative.
  */
-#define NOWMINUSSECS(secs) \
+#define SUBSECS(base, secs) \
   GNUNET_TIME_absolute_subtract \
-    (now, \
+    (base, \
      GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \
                                     secs))
 /**
@@ -84,12 +85,8 @@ run (void *cls,
 {
   
   extern struct TALER_BANK_AuthenticationData AUTHS[];
-  struct GNUNET_TIME_Absolute now;
+  struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
 
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Bank serves at `%s'\n",
-              bank_url);
-  now = GNUNET_TIME_absolute_get ();
   struct TALER_TESTING_Command commands[] = {
 
     TALER_TESTING_cmd_bank_history ("history-0",
@@ -106,9 +103,10 @@ run (void *cls,
        EXCHANGE_ACCOUNT_NUMBER,
        TALER_BANK_DIRECTION_BOTH,
        GNUNET_NO,
-       NOWMINUSSECS (5),
-       NOWPLUSSECS (5)),
-
+       SUBSECS (now,
+                5),
+       ADDSECS (now,
+                5)),
     TALER_TESTING_cmd_fakebank_transfer_with_subject
       ("deposit-1",
        "KUDOS:5.01",
@@ -173,8 +171,10 @@ run (void *cls,
        EXCHANGE_ACCOUNT_NUMBER,
        TALER_BANK_DIRECTION_BOTH,
        GNUNET_NO,
-       NOWMINUSSECS (5),
-       NOWPLUSSECS (5)),
+       SUBSECS (now,
+                50),
+       ADDSECS (now,
+                5)),
 
     TALER_TESTING_cmd_bank_reject ("reject-1",
                                    bank_url,
diff --git a/src/bank-lib/test_bank_api_with_fakebank_twisted.c 
b/src/bank-lib/test_bank_api_with_fakebank_twisted.c
index 4cf500fb..2b4a5493 100644
--- a/src/bank-lib/test_bank_api_with_fakebank_twisted.c
+++ b/src/bank-lib/test_bank_api_with_fakebank_twisted.c
@@ -82,8 +82,8 @@ run (void *cls,
      * Can't use the "wait service" CMD here because the
      * fakebank runs inside the same process of the test.
      */
-    TALER_TESTING_cmd_sleep ("wait interface",
-                             2),
+    TALER_TESTING_cmd_wait_service ("wait-service",
+                                    TWISTED_BANK_URL),
 
     TALER_TESTING_cmd_bank_history ("history-0",
                                     TWISTED_BANK_URL,
diff --git a/src/bank-lib/testing_api_cmd_history.c 
b/src/bank-lib/testing_api_cmd_history.c
index a50fd9ba..efaa6a99 100644
--- a/src/bank-lib/testing_api_cmd_history.c
+++ b/src/bank-lib/testing_api_cmd_history.c
@@ -1,4 +1,4 @@
-    /*
+/*
   This file is part of TALER
   Copyright (C) 2018 Taler Systems SA
 
@@ -354,12 +354,13 @@ build_history (struct TALER_TESTING_Interpreter *is,
       (add_incoming_cmd, 0, &row_id_start));
   }
 
-  GNUNET_assert ((0 != hs->num_results) ||
-    (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
+  GNUNET_assert ((0 != hs->num_results) || /* "/history" */
+    (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us != /* "/history-range" */
       hs->start_date.abs_value_us));
 
   if (0 == is->ip)
   {
+    TALER_LOG_DEBUG ("Checking history at first CMD..\n");
     *rh = NULL;
     return 0;
   }
@@ -416,14 +417,19 @@ build_history (struct TALER_TESTING_Interpreter *is,
     }
 
     /* Seek "/history-range" starting row, _if_ that's the case */
-    if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
-        hs->start_date.abs_value_us)
+    if ((GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
+        hs->start_date.abs_value_us) && (GNUNET_YES != ok))
     {
       const struct GNUNET_TIME_Absolute *timestamp;
 
       TALER_TESTING_get_trait_absolute_time (pos,
                                              0,
                                              &timestamp);
+      TALER_LOG_DEBUG
+        ("Seeking first row, start vs timestamp: %llu vs %llu\n",
+         hs->start_date.abs_value_us,
+         timestamp->abs_value_us);
+
       if (hs->start_date.abs_value_us <= timestamp->abs_value_us)
       {
         total = 0;
@@ -436,10 +442,15 @@ build_history (struct TALER_TESTING_Interpreter *is,
     if (GNUNET_NO == ok)
       continue; /* skip until we find the marker */
 
+    TALER_LOG_DEBUG ("Found first row\n");
+
     if (build_history_hit_limit (total,
                                  hs,
                                  pos))
+    {
+      TALER_LOG_DEBUG ("Hit history limit\n");
       break;
+    }
 
     cancelled = test_cancelled (is, off);
 
@@ -478,11 +489,11 @@ build_history (struct TALER_TESTING_Interpreter *is,
     }
   }
 
-
   GNUNET_assert (GNUNET_YES == ok);
 
   if (0 == total)
   {
+    TALER_LOG_DEBUG ("Checking history at first CMD.. (2)\n");
     *rh = NULL;
     return 0;
   }
@@ -517,8 +528,10 @@ build_history (struct TALER_TESTING_Interpreter *is,
 
       if (*row_id_start == *row_id)
       {
-        /* Warning: this zeroing is superfluous, as total doesn't
-         * get incremented if 'start' was given and couldn't be found.
+        /**
+         * Warning: this zeroing is superfluous, as
+         * total doesn't get incremented if 'start'
+         * was given and couldn't be found. 
          */
         total = 0;
         ok = GNUNET_YES;
@@ -527,14 +540,19 @@ build_history (struct TALER_TESTING_Interpreter *is,
     }
 
     /* Seek "/history-range" starting row, _if_ that's the case */
-    if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
-        hs->start_date.abs_value_us)
+    if ((GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
+        hs->start_date.abs_value_us) && (GNUNET_YES != ok))
     {
       const struct GNUNET_TIME_Absolute *timestamp;
 
       TALER_TESTING_get_trait_absolute_time (pos,
                                              0,
                                              &timestamp);
+      TALER_LOG_DEBUG
+        ("Seeking first row, start vs timestamp (2): %llu vs %llu\n",
+         hs->start_date.abs_value_us,
+         timestamp->abs_value_us);
+
       if (hs->start_date.abs_value_us <= timestamp->abs_value_us)
       {
         total = 0;
@@ -543,6 +561,8 @@ build_history (struct TALER_TESTING_Interpreter *is,
       }
     }
 
+    TALER_LOG_INFO ("Found first row (2)\n");
+
     if (GNUNET_NO == ok)
     {
       TALER_LOG_INFO ("Skip on `%s'\n",
@@ -554,7 +574,7 @@ build_history (struct TALER_TESTING_Interpreter *is,
                                  hs,
                                  pos))
     {
-      TALER_LOG_INFO ("hit limit specified by command\n");
+      TALER_LOG_INFO ("Hit history limit (2)\n");
       break;
     }
 
@@ -1149,6 +1169,7 @@ TALER_TESTING_cmd_bank_history_range_with_dates
   hs->account_no = account_no;
   hs->direction = direction;
   hs->ascending = ascending;
+  hs->start_row_reference = NULL;
   hs->start_date = start_date;
   hs->end_date = end_date;
 
diff --git a/src/exchange-tools/taler-exchange-keyup.c 
b/src/exchange-tools/taler-exchange-keyup.c
index 8b6d32ac..28e2ea1d 100644
--- a/src/exchange-tools/taler-exchange-keyup.c
+++ b/src/exchange-tools/taler-exchange-keyup.c
@@ -439,21 +439,12 @@ get_anchor (const char *dir,
   }
   else if (anchor->abs_value_us != now.abs_value_us)
   {
-
-    /**
-     * XXX-ANCHOR question: why adding the duration only in this
-     * case, and not _all the times we found a anchor_ ?  Like for
-     * instance, below out of this block?  
-     *
-     */
     *anchor = GNUNET_TIME_absolute_add (*anchor,
                                         duration);
     *anchor = GNUNET_TIME_absolute_subtract (*anchor,
                                              overlap);
   }
 
-  /* ==>Missing to add the duration to the anchor here?<== */ 
-
   /* anchor is now the stamp where we need to create a new key */
 }
 
diff --git a/src/exchangedb/exchangedb_denomkeys.c 
b/src/exchangedb/exchangedb_denomkeys.c
index 32955dcc..d9e604eb 100644
--- a/src/exchangedb/exchangedb_denomkeys.c
+++ b/src/exchangedb/exchangedb_denomkeys.c
@@ -200,7 +200,7 @@ TALER_EXCHANGEDB_denomination_key_write (const char 
*filename,
   if (NULL == (fh = GNUNET_DISK_file_open
                (filename,
                 GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE | 
GNUNET_DISK_OPEN_TRUNCATE,
-                GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE)))
+                GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE | 
GNUNET_DISK_OPEN_FAILIFEXISTS)))
     goto cleanup;
   wsize = sizeof (struct TALER_EXCHANGEDB_DenominationKeyInformationP);
   if (GNUNET_SYSERR == (wrote = GNUNET_DISK_file_write (fh,
diff --git a/src/lib/test_exchange_api_keys_cherry_picking_new.c 
b/src/lib/test_exchange_api_keys_cherry_picking_new.c
index 0be980a3..490961f8 100644
--- a/src/lib/test_exchange_api_keys_cherry_picking_new.c
+++ b/src/lib/test_exchange_api_keys_cherry_picking_new.c
@@ -55,19 +55,28 @@
   "test_exchange_api_keys_cherry_picking_extended_2.conf"
 
 /**
- * Current time.
+ * Add seconds.
+ *
+ * @param base absolute time to add seconds to.
+ * @param relative number of seconds to add.
+ * @return a new absolute time, modified according to @e relative.
  */
-struct GNUNET_TIME_Absolute now;
+#define ADDSECS(base, secs) \
+  GNUNET_TIME_absolute_add \
+    (base, \
+     GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \
+                                    secs))
 
 /**
- * Adds to the current time.
+ * Subtract seconds.
  *
- * @param relative number of _seconds_ to add to the current time.
+ * @param base absolute time to subtract seconds to.
+ * @param secs relative number of _seconds_ to subtract.
  * @return a new absolute time, modified according to @e relative.
  */
-#define NOWPLUSSECS(secs) \
-  GNUNET_TIME_absolute_add \
-    (now, \
+#define SUBSECS(base, secs) \
+  GNUNET_TIME_absolute_subtract \
+    (base, \
      GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \
                                     secs))
 #define JAN1971 "1971-01-01"
@@ -169,7 +178,6 @@ run (void *cls,
 
   };
 
-  now = GNUNET_TIME_absolute_get ();
   struct TALER_TESTING_Command ordinary_cherry_pick[] = {
 
     /**
@@ -201,26 +209,29 @@ run (void *cls,
        2,
        TTH_parse_time (JAN2030)),
 
-    /**
-     * We now load a very high lookahead_sign value of 3500 s,
-     * with now == JAN2030.
-     */
     TALER_TESTING_cmd_exec_keyup_with_now
       ("keyup-3",
        CONFIG_FILE_EXTENDED_2,
-       TTH_parse_time (JAN2030)),
+       /* Taking care of not using a 'now' that equals the
+        * last DK timestamp, otherwise it would get silently
+        * overridden.  */
+       ADDSECS (TTH_parse_time (JAN2030),
+                10)),
 
     /**
-     * For each DK with a withdraw duration of 80 s
-     * (- 1 s of overlap), and for the latest 3500 s
-     * lookahead_sign value, we should have ((3500 - _79_) / 79)
-     * keys we just downloaded + 2 old DK keys stored in memory
-     * (total 46).  The _79_ seconds we subtract are from the one
-     * key generated at "keyup-1".
+     * Expected number of DK:
      *
-     * This currently fails: look for XXX-ANCHOR at
-     * taler-exchange-keyup.c to get some insight about the reason
-     * behind.
+     * 3500 (the lookaeahd_sign time frame, in seconds)
+     * - 69 (how many seconds are covered by the latest DK)
+     * ----
+     * 3431
+     * / 79 (how many seconds each DK will cover)
+     * ----
+     *   44 (rounded up)
+     *  + 2 (old DKs already stored locally: 1 from the
+     *       very initial setup, and 1 from the 'keyup-1' CMD)
+     * ----
+     *   46
      */
     TALER_TESTING_cmd_check_keys_with_now
       ("check-keys-3",

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



reply via email to

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