gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] branch master updated: Iterating interpret


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: Iterating interpreter commands, according to -n option passed in CLI.
Date: Wed, 22 Mar 2017 15:31:02 +0100

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

marcello pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 3a8a5ca  Iterating interpreter commands, according to -n option passed 
in CLI.
3a8a5ca is described below

commit 3a8a5ca77755048f105212d0a0c9453b3d0e1037
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Mar 22 15:30:27 2017 +0100

    Iterating interpreter commands, according to -n option
    passed in CLI.
---
 src/samples/generate_payments.c | 38 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/src/samples/generate_payments.c b/src/samples/generate_payments.c
index 4119dab..515953f 100644
--- a/src/samples/generate_payments.c
+++ b/src/samples/generate_payments.c
@@ -26,7 +26,15 @@
 #include <gnunet/gnunet_curl_lib.h>
 #include <microhttpd.h>
 
-#define CURRENCY "EUR"
+/**
+ * How many times the command list should be rerun.
+ */
+static unsigned int times = 1;
+
+/**
+ * Current iteration of commands
+ */
+static unsigned int j = 0;
 
 /**
  * Exchange URI to withdraw from and deposit to.
@@ -726,7 +734,7 @@ find_pk (const struct TALER_EXCHANGE_Keys *keys,
  *
  * @param cls contains the `struct InterpreterState`
  */
-void
+static void
 interpreter_run (void *cls)
 {
   const struct GNUNET_SCHEDULER_TaskContext *tc;
@@ -759,8 +767,28 @@ interpreter_run (void *cls)
   switch (cmd->oc)
   {
     case OC_END:
+
+      j++;
+
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "j=%d, times=%d\n",
+                  j,
+                  times);
+
+      if (j < times)
+      {
+        is->ip = 0;
+        
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    "Rewinding the interpreter.\n");
+    
+        GNUNET_SCHEDULER_add_now (&interpreter_run,
+                                  is);
+        return;
+      }
       result = GNUNET_OK;
       GNUNET_SCHEDULER_shutdown ();
+
       return;
 
     case OC_PAY:
@@ -1150,6 +1178,7 @@ do_shutdown (void *cls)
   struct InterpreterState *is = cls;
   struct Command *cmd;
   unsigned int i;
+  
 
   if (NULL != timeout_task)
   {
@@ -1483,6 +1512,11 @@ main (int argc,
 
   struct GNUNET_GETOPT_CommandLineOption options[] = {
     GNUNET_GETOPT_OPTION_CFG_FILE (&config_file),
+    GNUNET_GETOPT_OPTION_SET_UINT ('n',
+                                   "times",
+                                   "TIMES",
+                                   "How many times the commands should be 
run.",
+                                   &times),
     GNUNET_GETOPT_OPTION_END
   };
 

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



reply via email to

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