diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-08-29 23:22:17 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-08-29 23:22:17 +0200 |
commit | 394cacf9fdb640c59a41ee60a233b4e3cce44aad (patch) | |
tree | 581800a26a80cd505d6a88489c259ffd1122f49a /src/consensus | |
parent | 94fa99870bce6f8bf87b37b15b538a9164dff50f (diff) |
-mild refactoring of consensus, cleaning up the code a bit
Diffstat (limited to 'src/consensus')
-rw-r--r-- | src/consensus/gnunet-service-consensus.c | 15 | ||||
-rw-r--r-- | 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)); } |