gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 01/02: -mild refactoring of consensus, cleaning up the code a b


From: gnunet
Subject: [gnunet] 01/02: -mild refactoring of consensus, cleaning up the code a bit
Date: Sat, 29 Aug 2020 23:36:28 +0200

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

grothoff pushed a commit to branch master
in repository gnunet.

commit 394cacf9fdb640c59a41ee60a233b4e3cce44aad
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Aug 29 23:22:17 2020 +0200

    -mild refactoring of consensus, cleaning up the code a bit
---
 src/consensus/gnunet-service-consensus.c | 15 +++++----------
 src/consensus/plugin_block_consensus.c   | 13 ++++++-------
 2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/src/consensus/gnunet-service-consensus.c 
b/src/consensus/gnunet-service-consensus.c
index 3a8356635..24e285e77 100644
--- a/src/consensus/gnunet-service-consensus.c
+++ b/src/consensus/gnunet-service-consensus.c
@@ -848,7 +848,8 @@ diff_insert (struct DiffEntry *diff,
     di->element = GNUNET_SET_element_dup (element);
     GNUNET_assert (GNUNET_OK ==
                    GNUNET_CONTAINER_multihashmap_put (diff->changes,
-                                                      &hash, di,
+                                                      &hash,
+                                                      di,
                                                       
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
   }
 
@@ -1396,6 +1397,7 @@ commit_set (struct ConsensusSession *session,
   {
     struct GNUNET_SET_Element element;
     struct ConsensusElement ce = { 0 };
+
     ce.marker = CONSENSUS_MARKER_CONTESTED;
     element.data = &ce;
     element.size = sizeof(struct ConsensusElement);
@@ -3329,13 +3331,6 @@ handle_client_join (void *cls,
 }
 
 
-static void
-client_insert_done (void *cls)
-{
-  // FIXME: implement
-}
-
-
 /**
  * Called when a client performs an insert operation.
  *
@@ -3400,8 +3395,8 @@ handle_client_insert (void *cls,
 
     GNUNET_SET_add_element (initial_set,
                             &element,
-                            &client_insert_done,
-                            session);
+                            NULL,
+                            NULL);
 #ifdef GNUNET_EXTRA_LOGGING
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "P%u: element %s added\n",
diff --git a/src/consensus/plugin_block_consensus.c 
b/src/consensus/plugin_block_consensus.c
index fb6da5bcd..cdac12ed5 100644
--- a/src/consensus/plugin_block_consensus.c
+++ b/src/consensus/plugin_block_consensus.c
@@ -58,13 +58,12 @@ block_plugin_consensus_evaluate (void *cls,
                                  const void *reply_block,
                                  size_t reply_block_size)
 {
-  if (reply_block_size < sizeof(struct ConsensusElement))
-    return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
-
   const struct ConsensusElement *ce = reply_block;
 
-  if ((0 != ce->marker) ||
-      (0 == ce->payload_type))
+  if (reply_block_size < sizeof(struct ConsensusElement))
+    return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
+  if ( (0 != ce->marker) ||
+       (0 == ce->payload_type) )
     return GNUNET_BLOCK_EVALUATION_OK_MORE;
 
   return GNUNET_BLOCK_evaluate (ctx,
@@ -75,8 +74,8 @@ block_plugin_consensus_evaluate (void *cls,
                                 xquery,
                                 xquery_size,
                                 &ce[1],
-                                reply_block_size - sizeof(struct
-                                                          ConsensusElement));
+                                reply_block_size
+                                - sizeof(struct ConsensusElement));
 }
 
 

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