gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: fix output; fix revocation


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: fix output; fix revocation
Date: Thu, 09 Aug 2018 16:07:36 +0200

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

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 60548eb84 fix output; fix revocation
60548eb84 is described below

commit 60548eb84908c969034a9ab4f8d66b9a315c7d42
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Thu Aug 9 16:07:33 2018 +0200

    fix output; fix revocation
---
 src/reclaim/gnunet-reclaim.c         | 46 +++++++++++++++++++++++++++++-------
 src/reclaim/gnunet-service-reclaim.c |  2 +-
 2 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c
index f56425b17..02138cfff 100644
--- a/src/reclaim/gnunet-reclaim.c
+++ b/src/reclaim/gnunet-reclaim.c
@@ -139,6 +139,11 @@ static struct GNUNET_SCHEDULER_Task *timeout;
  */
 static struct GNUNET_SCHEDULER_Task *cleanup_task;
 
+/**
+ * Claim to store
+ */
+struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim;
+
 static void
 do_cleanup(void *cls)
 {
@@ -249,7 +254,6 @@ process_rvk (void *cls, int success, const char* msg)
 static void
 iter_finished (void *cls)
 {
-  struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim;
   char *data;
   size_t data_size;
   int type;
@@ -303,16 +307,25 @@ iter_finished (void *cls)
                                                                               
attr_value,
                                                                               
(void**)&data,
                                                                               
&data_size));
-    claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr_name,
-                                                 type,
-                                                 data,
-                                                 data_size);
+    if (NULL != claim)
+    {
+      claim->type = type;
+      claim->data = data;
+      claim->data_size = data_size;
+    } else {
+      claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr_name,
+                                                  type,
+                                                  data,
+                                                  data_size);
+    }
     reclaim_op = GNUNET_RECLAIM_attribute_store (reclaim_handle,
                                                  pkey,
                                                  claim,
                                                  &exp_interval,
                                                  &store_attr_cont,
                                                  NULL);
+    GNUNET_free (data);
+    GNUNET_free (claim);
     return;
   }
   cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
@@ -326,8 +339,19 @@ iter_cb (void *cls,
   struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
   char *attrs_tmp;
   char *attr_str;
+  const char *attr_type;
 
-  if (issue_attrs)
+  if ((NULL != attr_name) && (NULL != claim))
+  {
+    if (0 == strcasecmp (attr_name, attr->name))
+    {
+      claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name,
+                                                            attr->type,
+                                                            attr->data,
+                                                            attr->data_size);
+    }
+  }
+  else if (issue_attrs)
   {
     attrs_tmp = GNUNET_strdup (issue_attrs);
     attr_str = strtok (attrs_tmp, ",");
@@ -351,8 +375,9 @@ iter_cb (void *cls,
     attr_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
                                                          attr->data,
                                                          attr->data_size);
-    GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
-                "%s: %s\n", attr->name, attr_str);
+    attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
+    fprintf (stdout,
+             "%s\t%s\t%u\t%s\n", attr->name, attr_type, attr->version, 
attr_str);
   }
   GNUNET_RECLAIM_get_attributes_next (attr_iterator);
 }
@@ -383,9 +408,12 @@ start_get_attributes ()
                                    &ticket,
                                    sizeof (struct GNUNET_RECLAIM_Ticket));
 
+  if (list)
+    fprintf (stdout,
+             "Name\tType\tVersion\tValue\n");
 
   attr_list = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
-
+  claim = NULL;
   attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle,
                                                        pkey,
                                                        &iter_error,
diff --git a/src/reclaim/gnunet-service-reclaim.c 
b/src/reclaim/gnunet-service-reclaim.c
index bf8780a92..3321a79d8 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -1439,9 +1439,9 @@ check_attr_cb (void *cls,
 
   buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size 
(rh->attrs->list_head->claim);
   buf = GNUNET_malloc (buf_size);
+  rh->attrs->list_head->claim->version++;
   GNUNET_RECLAIM_ATTRIBUTE_serialize (rh->attrs->list_head->claim,
                                        buf);
-  rh->attrs->list_head->claim->version++;
   GNUNET_asprintf (&policy, "%s_%lu",
                    rh->attrs->list_head->claim->name,
                    rh->attrs->list_head->claim->version);

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



reply via email to

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