gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] 08/12: work on secret share


From: gnunet
Subject: [taler-anastasis] 08/12: work on secret share
Date: Mon, 07 Dec 2020 20:28:42 +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 2cb6e2e01878e33502631b26e521f48fbf0a012c
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Fri Dec 4 12:21:37 2020 +0100

    work on secret share
---
 src/lib/anastasis.c | 95 +++++------------------------------------------------
 1 file changed, 9 insertions(+), 86 deletions(-)

diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 3483ea7..9db9e61 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -24,12 +24,6 @@
 #include <taler/taler_json_lib.h>
 #include <gnunet/gnunet_util_lib.h>
 
-/**
- * How long do we wait at most for a /policy reply from an Anastasis provider.
- * 60s is very generous, given the tiny bandwidth required, even for the most
- * remote locations.
- */
-#define POLICY_STORE_GENERIC_TIMEOUT GNUNET_TIME_UNIT_MINUTES
 
 /**
  * stores provider URLs, identity key material, decrypted recovery document 
(internally!)
@@ -1479,10 +1473,6 @@ struct ANASTASIS_SecretShare;
  */
 struct PolicyStoreState
 {
-  struct PolicyStoreState *next;
-
-  struct PolicyStoreState *prev;
-
   /**
    * User identifier used as entropy source for the account public key
    */
@@ -1577,8 +1567,6 @@ struct PolicyStoreState
    * reference to SecretShare
    */
   struct ANASTASIS_SecretShare *ss;
-
-  struct GNUNET_SCHEDULER_Task *tt;
 };
 
 /**
@@ -1586,10 +1574,6 @@ struct PolicyStoreState
 */
 struct ANASTASIS_SecretShare
 {
-  struct PolicyStoreState *pss_head;
-
-  struct PolicyStoreState *pss_tail;
-
   /**
    * Callback which gives back the payment details
    */
@@ -1653,37 +1637,6 @@ policy_store_cleanup (void *cls)
 }
 
 
-/**
- * Function which collects all configurations from the different
- * servers and calls the #ANASTASIS_ActionCallback.
- *
- * @param sch a handle to a country selection action
- */
-static void
-conclude_policy_store (struct ANASTASIS_SecretShare *ss)
-{
-  struct PolicyStoreState *pss;
-
-  /* Are we waiting for more /policy requests to complete? */
-  for (pss = ss->pss_head; NULL != pss; pss = pss->next)
-    if (NULL != pss->pso)
-      return;
-
-  while (NULL != (pss = ss->pss_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (ss->pss_head,
-                                 ss->pss_tail,
-                                 pss);
-    if ( (MHD_HTTP_NO_CONTENT != pss->http_status) &&
-         (MHD_HTTP_PAYMENT_REQUIRED != pss->http_status))
-    {
-      policy_store_cleanup (pss);
-      continue;
-    }
-  }
-}
-
-
 static void
 policy_store_cb (void *cls,
                  enum ANASTASIS_ErrorCode ec,
@@ -1715,7 +1668,7 @@ policy_store_cb (void *cls,
                     ec,
                     http_status);
       pss->ss->src = NULL;
-      conclude_policy_store (pss->ss);
+      ANASTASIS_secret_share_cancel (pss->ss);
     }
     return;
   }
@@ -1782,7 +1735,6 @@ policy_store_cb (void *cls,
                         pss->anastasis_url,
                         ec);
           pss->ss->spc = NULL;
-          conclude_policy_store (pss->ss);
         }
       }
       return;
@@ -1810,7 +1762,6 @@ policy_store_cb (void *cls,
                     http_status);
       pss->ss->src = NULL;
     }
-    conclude_policy_store (pss->ss);
     return;
   }
   GNUNET_break (0);
@@ -1905,23 +1856,6 @@ ANASTASIS_get_num_urls (const struct ANASTASIS_Policy 
*policies[],
 }
 
 
-/**
- * Retries a "policy store" after timeout.
- *
- * @param cls closure for a "policy store" request
- */
-static void
-policy_store_timeout (void *cls)
-{
-  struct PolicyStoreState *pss = cls;
-
-  pss->tt = NULL;
-  ANASTASIS_policy_store_cancel (pss->pso);
-  pss->pso = NULL;
-  conclude_policy_store (pss->ss);
-}
-
-
 struct ANASTASIS_SecretShare *
 ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
                         const json_t *id_data,
@@ -2202,9 +2136,6 @@ ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
                 TALER_B2S (&ss->pss[l]->curr_hash),
                 (unsigned long long) sizeof (struct GNUNET_HashCode));
 
-    GNUNET_CONTAINER_DLL_insert (ss->pss_head,
-                                 ss->pss_tail,
-                                 ss->pss[l]);
     ss->pss[l]->pso = ANASTASIS_policy_store (ss->ctx,
                                               ss->pss[l]->anastasis_url,
                                               &ss->pss[l]->anastasis_priv,
@@ -2227,15 +2158,7 @@ ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
       GNUNET_break (0);
       return NULL;
     }
-    else
-    {
-      ss->pss[l]->tt = GNUNET_SCHEDULER_add_delayed (
-        POLICY_STORE_GENERIC_TIMEOUT,
-        &policy_store_timeout,
-        ss->pss[l]);
-    }
   }
-  conclude_policy_store (ss);
   return ss;
 }
 
@@ -2249,16 +2172,16 @@ ANASTASIS_secret_share_cancel (struct 
ANASTASIS_SecretShare *ss)
 {
   if (NULL != ss)
   {
-    struct PolicyStoreState *pss;
-
-    while (NULL != (pss = ss->pss_head))
+    if (NULL != ss->pss)
     {
-      GNUNET_CONTAINER_DLL_remove (ss->pss_head,
-                                   ss->pss_tail,
-                                   pss);
-      policy_store_cleanup (pss);
+      for (unsigned int i = 0; i< ss->pss_length; i++)
+      {
+        if (NULL != ss->pss[i])
+        {
+          GNUNET_free (ss->pss[i]);
+        }
+      }
     }
-
     GNUNET_free (ss);
   }
 }

-- 
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]