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: adding "order id" t


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated: adding "order id" trait
Date: Thu, 15 Feb 2018 16:36:34 +0100

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

marcello pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new d78f66d  adding "order id" trait
d78f66d is described below

commit d78f66d5e4753bf0546b3b2e8e2b7184064f92a8
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Feb 15 16:36:00 2018 +0100

    adding "order id" trait
---
 src/exchange-lib/testing_api_loop.c         | 17 ++++++++++++
 src/exchange-lib/testing_api_trait_string.c | 42 +++++++++++++++++++++++++++++
 src/include/taler_testing_lib.h             | 29 ++++++++++++++++++++
 3 files changed, 88 insertions(+)

diff --git a/src/exchange-lib/testing_api_loop.c 
b/src/exchange-lib/testing_api_loop.c
index c4b6031..2bbf46a 100644
--- a/src/exchange-lib/testing_api_loop.c
+++ b/src/exchange-lib/testing_api_loop.c
@@ -302,9 +302,14 @@ maint_child_death (void *cls)
   struct TALER_TESTING_Interpreter *is = cls;
   struct TALER_TESTING_Command *cmd = &is->commands[is->ip];
   const struct GNUNET_DISK_FileHandle *pr;
+
   struct GNUNET_OS_Process **processp;
   char c[16];
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Got SIGCHLD for `%s'.\n",
+              cmd->label);
+
   is->child_death_task = NULL;
   pr = GNUNET_DISK_pipe_handle (sigpipe,
                                 GNUNET_DISK_PIPE_END_READ);
@@ -321,17 +326,29 @@ maint_child_death (void *cls)
     TALER_TESTING_interpreter_fail (is);
     return;
   }
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Got the dead child process handle"
+              ", waiting for termination ...\n");
+
   GNUNET_OS_process_wait (*processp);
   GNUNET_OS_process_destroy (*processp);
   *processp = NULL;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "... definitively terminated\n");
+
   if (GNUNET_OK == is->reload_keys)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Triggering key state reload at exchange\n");
     GNUNET_break (0 == GNUNET_OS_process_kill
     (is->exchanged, SIGUSR1));
     sleep (5); /* make sure signal was received and processed */
   }
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Dead child, go on with next command.\n");
   TALER_TESTING_interpreter_next (is);
 }
 
diff --git a/src/exchange-lib/testing_api_trait_string.c 
b/src/exchange-lib/testing_api_trait_string.c
index 94560d3..cf68c28 100644
--- a/src/exchange-lib/testing_api_trait_string.c
+++ b/src/exchange-lib/testing_api_trait_string.c
@@ -35,6 +35,7 @@
 #define TALER_TESTING_TRAIT_TRANSFER_SUBJECT "transfer-subject"
 #define TALER_TESTING_TRAIT_AMOUNT "amount"
 #define TALER_TESTING_TRAIT_URL "url"
+#define TALER_TESTING_TRAIT_ORDER_ID "order-id"
 
 /**
  * Obtain contract terms from @a cmd.
@@ -250,6 +251,47 @@ TALER_TESTING_make_trait_url
 }
 
 
+/**
+ * Obtain a order id from @a cmd.
+ *
+ * @param cmd command to extract trait from
+ * @param index which order id is to be picked, in case
+ *        multiple are offered.
+ * @param order_id[out] where to write the order id.
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_TESTING_get_trait_order_id
+  (const struct TALER_TESTING_Command *cmd,
+   unsigned int index,
+   const char **order_id)
+{
+  return cmd->traits (cmd->cls,
+                      (void **) order_id,
+                      TALER_TESTING_TRAIT_ORDER_ID,
+                      index);
+}
+
+/**
+ * Offer order id in a trait.
+ *
+ * @param index which order id is to be picked, in case
+ *        multiple are offered.
+ * @param order_id the url to offer
+ * @return the trait, to be put in the traits array of the command
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_order_id
+  (unsigned int index,
+   const char *order_id)
+{
+  struct TALER_TESTING_Trait ret = {
+    .index = index,
+    .trait_name = TALER_TESTING_TRAIT_URL,
+    .ptr = (const void *) order_id 
+  };
+  return ret;
+}
 
 
 /* end of testing_api_trait_string.c */
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index a78f7f3..83fcd99 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -1280,4 +1280,33 @@ TALER_TESTING_get_trait_url
    unsigned int index,
    const char **url);
 
+
+/**
+ * Obtain a order id from @a cmd.
+ *
+ * @param cmd command to extract trait from
+ * @param index which order id is to be picked, in case
+ *        multiple are offered.
+ * @param order_id[out] where to write the order id.
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_TESTING_get_trait_order_id
+  (const struct TALER_TESTING_Command *cmd,
+   unsigned int index,
+   const char **order_id);
+
+/**
+ * Offer order id in a trait.
+ *
+ * @param index which order id is to be picked, in case
+ *        multiple are offered.
+ * @param order_id the url to offer
+ * @return the trait, to be put in the traits array of the command
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_url
+  (unsigned int index,
+   const char *order_id);
+
 #endif

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



reply via email to

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