gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] 03/07: worked on rec doc upload


From: gnunet
Subject: [taler-anastasis] 03/07: worked on rec doc upload
Date: Thu, 26 Nov 2020 12:54:10 +0100

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

dennis-neufeld pushed a commit to branch master
in repository anastasis.

commit eea4fd2172102eab84538174faaef067d03e0242
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Tue Nov 24 16:56:12 2020 +0100

    worked on rec doc upload
---
 src/include/anastasis.h              |  4 +++-
 src/lib/anastasis.c                  |  1 +
 src/lib/anastasis_api_backup_redux.c | 33 +++++++++++++++++++++++++++++++++
 src/lib/testing_cmd_secret_share.c   |  2 ++
 4 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/src/include/anastasis.h b/src/include/anastasis.h
index 395c4ea..bcb7e94 100644
--- a/src/include/anastasis.h
+++ b/src/include/anastasis.h
@@ -370,13 +370,15 @@ ANASTASIS_policy_destroy (struct ANASTASIS_Policy *p);
  *
  * @param cls closure
  * @param @param current_etag sends back the etag of the upload (used to 
prevent redundant uploads)
+ * @param server_url url of the server to pay for
  * @param ec status code of the request
  * @param http_status http status code
  */
 typedef void
 (*ANASTASIS_ShareResultCallback)(void *cls,
                                  const struct GNUNET_HashCode *current_etag,
-                                 const enum TALER_ErrorCode ecs,
+                                 const char *server_url,
+                                 const enum TALER_ErrorCode ec,
                                  unsigned int http_status);
 
 /**
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 9484d6f..b8f725a 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -1568,6 +1568,7 @@ policy_store_cb (void *cls,
     {
       pss->ss->src (pss->ss->src_cls,
                     &pss->curr_hash,
+                    pss->anastasis_url,
                     ec,
                     http_status);
       pss->ss->src = NULL;
diff --git a/src/lib/anastasis_api_backup_redux.c 
b/src/lib/anastasis_api_backup_redux.c
index 4225f7c..1197041 100644
--- a/src/lib/anastasis_api_backup_redux.c
+++ b/src/lib/anastasis_api_backup_redux.c
@@ -1275,12 +1275,14 @@ secret_share_payment_cb (void *cls,
  *
  * @param cls closure
  * @param @param current_etag sends back the etag of the upload (used to 
prevent redundant uploads)
+ * @param server_url url of the server to pay for
  * @param ec status code of the request
  * @param http_status http status code
  */
 static void
 secret_share_result_cb (void *cls,
                         const struct GNUNET_HashCode *current_etag,
+                        const char *server_url,
                         const enum TALER_ErrorCode ec,
                         unsigned int http_status)
 {
@@ -1420,10 +1422,41 @@ truth_upload_cb (void *cls,
   if (check_uploads (truth_uploads))
   {
     // try uploading recovery document
+    size_t t_index;
+    size_t rd_index;
+    json_t *truth;
+    json_t *truths = json_object_get (tus->state,
+                                      "truths");
+    json_t *rec_doc_uploads = json_array ();
+
+    GNUNET_assert (json_is_array (truths));
+    GNUNET_assert (json_is_array (rec_doc_uploads));
     GNUNET_assert (0 ==
                    json_object_set (tus->state,
                                     "recovery_document_uploads",
                                     json_array ()));
+    json_array_foreach (truths, t_index, truth)
+    {
+      json_t *upload;
+      json_t *backend_url = json_object_get (truth,
+                                             "backend_url"));
+
+      json_array_foreach (rec_doc_uploads, rd_index, upload)
+      {
+        if (1 == json_equal (backend_url, json_object_get (upload,
+                                                           "backend_url")))
+          break;
+
+        GNUNET_assert (0 ==
+                       json_object_set_new (upload,
+                                            "backend_url",
+                                            backend_url));
+        GNUNET_assert (0 ==
+                       json_object_set_new (upload,
+                                            "status",
+                                            json_integer ((json_int_t) 0)));
+      }
+    }
 
     upload_rec_documents (tus->state,
                           tus->ctx,
diff --git a/src/lib/testing_cmd_secret_share.c 
b/src/lib/testing_cmd_secret_share.c
index 8e1edb4..6669821 100644
--- a/src/lib/testing_cmd_secret_share.c
+++ b/src/lib/testing_cmd_secret_share.c
@@ -196,12 +196,14 @@ secret_share_payment_cb (void *cls,
  *
  * @param cls closure
  * @param @param current_etag sends back the etag of the upload (used to 
prevent redundant uploads)
+ * @param server_url url of the server to pay for
  * @param ec status code of the request
  * @param http_status http status code
  */
 static void
 secret_share_result_cb (void *cls,
                         const struct GNUNET_HashCode *current_etag,
+                        const char *server_url,
                         const enum TALER_ErrorCode ec,
                         unsigned int http_status)
 {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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