aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/consensus/consensus_protocol.h8
-rw-r--r--src/consensus/gnunet-service-consensus.c53
-rw-r--r--src/consensus/plugin_block_consensus.c2
-rw-r--r--src/dv/gnunet-service-dv.c2
-rw-r--r--src/include/gnunet_set_service.h2
-rw-r--r--src/revocation/gnunet-service-revocation.c2
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c2
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c2
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct_alice.c2
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct_bob.c2
-rw-r--r--src/set/gnunet-service-set_union.c6
-rw-r--r--src/set/gnunet-set-profiler.c1
-rw-r--r--src/set/set.h5
-rw-r--r--src/set/set_api.c3
-rw-r--r--src/set/test_set_api.c1
-rw-r--r--src/set/test_set_intersection_result_full.c1
-rw-r--r--src/set/test_set_union_result_symmetric.c1
17 files changed, 86 insertions, 9 deletions
diff --git a/src/consensus/consensus_protocol.h b/src/consensus/consensus_protocol.h
index 161c939cdd..43b6a96325 100644
--- a/src/consensus/consensus_protocol.h
+++ b/src/consensus/consensus_protocol.h
@@ -89,6 +89,12 @@ struct GNUNET_CONSENSUS_RoundContextMessage
};
+enum {
+ CONSENSUS_MARKER_CONTESTED,
+ CONSENSUS_MARKER_SIZE,
+};
+
+
/**
* Consensus element, either marker or payload.
*/
@@ -103,7 +109,7 @@ struct ConsensusElement
/**
* Is this a marker element?
*/
- uint8_t is_contested_marker;
+ uint8_t marker;
/* rest: element data */
};
diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c
index 9d5d35c944..44b6dc21b3 100644
--- a/src/consensus/gnunet-service-consensus.c
+++ b/src/consensus/gnunet-service-consensus.c
@@ -141,6 +141,7 @@ GNUNET_NETWORK_STRUCT_END
enum PhaseKind
{
PHASE_KIND_ALL_TO_ALL,
+ PHASE_KIND_ALL_TO_ALL_2,
PHASE_KIND_GRADECAST_LEADER,
PHASE_KIND_GRADECAST_ECHO,
PHASE_KIND_GRADECAST_ECHO_GRADE,
@@ -528,6 +529,7 @@ phasename (uint16_t phase)
switch (phase)
{
case PHASE_KIND_ALL_TO_ALL: return "ALL_TO_ALL";
+ case PHASE_KIND_ALL_TO_ALL_2: return "ALL_TO_ALL_2";
case PHASE_KIND_FINISH: return "FINISH";
case PHASE_KIND_GRADECAST_LEADER: return "GRADECAST_LEADER";
case PHASE_KIND_GRADECAST_ECHO: return "GRADECAST_ECHO";
@@ -668,7 +670,7 @@ send_to_client_iter (void *cls,
GNUNET_assert (GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT == element->element_type);
ce = element->data;
- GNUNET_assert (GNUNET_NO == ce->is_contested_marker);
+ GNUNET_assert (0 == ce->marker);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"P%d: sending element %s to client\n",
@@ -864,11 +866,13 @@ task_other_peer (struct TaskEntry *task)
*
* @param cls closure
* @param element a result element, only valid if status is GNUNET_SET_STATUS_OK
+ * @param current_size current set size
* @param status see enum GNUNET_SET_Status
*/
static void
set_result_cb (void *cls,
const struct GNUNET_SET_Element *element,
+ uint64_t current_size,
enum GNUNET_SET_Status status)
{
struct TaskEntry *task = cls;
@@ -940,7 +944,7 @@ set_result_cb (void *cls,
if ( (GNUNET_SET_STATUS_ADD_LOCAL == status) || (GNUNET_SET_STATUS_ADD_REMOTE == status) )
{
if ( (GNUNET_YES == setop->transceive_contested) &&
- (GNUNET_YES == consensus_element->is_contested_marker) )
+ (CONSENSUS_MARKER_CONTESTED == consensus_element->marker) )
{
GNUNET_assert (NULL != output_rfn);
rfn_contest (output_rfn, task_other_peer (task));
@@ -1001,7 +1005,7 @@ set_result_cb (void *cls,
GNUNET_assert (NULL != consensus_element);
if (GNUNET_YES == setop->do_not_remove)
break;
- if (GNUNET_YES == consensus_element->is_contested_marker)
+ if (CONSENSUS_MARKER_CONTESTED == consensus_element->marker)
break;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Removing element in Task {%s}\n",
@@ -1325,11 +1329,19 @@ commit_set (struct ConsensusSession *session,
}
}
#else
+
+ if (PHASE_KIND_ALL_TO_ALL_2 == task->key.kind)
+ {
+ struct GNUNET_SET_Element element;
+ struct ConsensusElement ce = { 0 };
+ }
+
+
if ( (GNUNET_YES == setop->transceive_contested) && (GNUNET_YES == set->is_contested) )
{
struct GNUNET_SET_Element element;
struct ConsensusElement ce = { 0 };
- ce.is_contested_marker = GNUNET_YES;
+ ce.marker = CONSENSUS_MARKER_CONTESTED;
element.data = &ce;
element.size = sizeof (struct ConsensusElement);
element.element_type = GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT;
@@ -2847,11 +2859,42 @@ construct_task_graph (struct ConsensusSession *session)
put_task (session->taskmap, &task);
}
+ round += 1;
prev_step = step;
- step = NULL;
+ step = create_step (session, round, GNUNET_NO);;
+#ifdef GNUNET_EXTRA_LOGGING
+ step->debug_name = GNUNET_strdup ("all to all 2");
+#endif
+ step_depend_on (step, prev_step);
+
+
+ for (i = 0; i < n; i++)
+ {
+ uint16_t p1;
+ uint16_t p2;
+
+ p1 = me;
+ p2 = i;
+ arrange_peers (&p1, &p2, n);
+ task = ((struct TaskEntry) {
+ .key = (struct TaskKey) { PHASE_KIND_ALL_TO_ALL_2, p1, p2, -1, -1 },
+ .step = step,
+ .start = task_start_reconcile,
+ .cancel = task_cancel_reconcile,
+ });
+ task.cls.setop.input_set = (struct SetKey) { SET_KIND_CURRENT, 0 };
+ task.cls.setop.output_set = task.cls.setop.input_set;
+ task.cls.setop.do_not_remove = GNUNET_YES;
+ put_task (session->taskmap, &task);
+ }
round += 1;
+ prev_step = step;
+ step = NULL;
+
+
+
/* Byzantine union */
/* sequential repetitions of the gradecasts */
diff --git a/src/consensus/plugin_block_consensus.c b/src/consensus/plugin_block_consensus.c
index 3ad3357604..0cb64867e1 100644
--- a/src/consensus/plugin_block_consensus.c
+++ b/src/consensus/plugin_block_consensus.c
@@ -63,7 +63,7 @@ block_plugin_consensus_evaluate (void *cls,
const struct ConsensusElement *ce = reply_block;
- if ( (GNUNET_YES == ce->is_contested_marker) ||
+ if ( (0 != ce->marker) ||
(0 == ce->payload_type ) )
return GNUNET_BLOCK_EVALUATION_OK_MORE;
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c
index e4b664f4b6..7d101c8ae4 100644
--- a/src/dv/gnunet-service-dv.c
+++ b/src/dv/gnunet-service-dv.c
@@ -1346,11 +1346,13 @@ check_target_added (void *cls,
*
* @param cls the `struct DirectNeighbor` we're building the consensus with
* @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK
+ * @param current_size current set size
* @param status see `enum GNUNET_SET_Status`
*/
static void
handle_set_union_result (void *cls,
const struct GNUNET_SET_Element *element,
+ uint64_t current_size,
enum GNUNET_SET_Status status)
{
struct DirectNeighbor *neighbor = cls;
diff --git a/src/include/gnunet_set_service.h b/src/include/gnunet_set_service.h
index f9b477f47e..ca46d87467 100644
--- a/src/include/gnunet_set_service.h
+++ b/src/include/gnunet_set_service.h
@@ -275,11 +275,13 @@ typedef void
*
* @param cls closure
* @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK
+ * @param current_size current set size
* @param status see `enum GNUNET_SET_Status`
*/
typedef void
(*GNUNET_SET_ResultIterator) (void *cls,
const struct GNUNET_SET_Element *element,
+ uint64_t current_size,
enum GNUNET_SET_Status status);
/**
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
index 0ac963f636..99bec1fc8a 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -432,11 +432,13 @@ handle_p2p_revoke (void *cls,
*
* @param cls closure
* @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK
+ * @param current_size current set size
* @param status see `enum GNUNET_SET_Status`
*/
static void
add_revocation (void *cls,
const struct GNUNET_SET_Element *element,
+ uint64_t current_size,
enum GNUNET_SET_Status status)
{
struct PeerEntry *peer_entry = cls;
diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
index b7b839b6f5..ca92fb9ead 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
@@ -687,11 +687,13 @@ send_alices_cryptodata_message (struct AliceServiceSession *s)
*
* @param cls closure with the `struct AliceServiceSession`
* @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK
+ * @param current_size current set size
* @param status what has happened with the set intersection?
*/
static void
cb_intersection_element_removed (void *cls,
const struct GNUNET_SET_Element *element,
+ uint64_t current_size,
enum GNUNET_SET_Status status)
{
struct AliceServiceSession *s = cls;
diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
index 8a5b3a5b24..3851ca7634 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
@@ -580,11 +580,13 @@ handle_alices_cryptodata_message (void *cls,
*
* @param cls closure with the `struct BobServiceSession`
* @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK
+ * @param current_size current set size
* @param status what has happened with the set intersection?
*/
static void
cb_intersection_element_removed (void *cls,
const struct GNUNET_SET_Element *element,
+ uint64_t current_size,
enum GNUNET_SET_Status status)
{
struct BobServiceSession *s = cls;
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_alice.c b/src/scalarproduct/gnunet-service-scalarproduct_alice.c
index 697baa9bd5..6d7a0a3b84 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct_alice.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct_alice.c
@@ -924,11 +924,13 @@ send_alices_cryptodata_message (struct AliceServiceSession *s)
*
* @param cls closure with the `struct AliceServiceSession`
* @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK
+ * @param current_size current set size
* @param status what has happened with the set intersection?
*/
static void
cb_intersection_element_removed (void *cls,
const struct GNUNET_SET_Element *element,
+ uint64_t current_size,
enum GNUNET_SET_Status status)
{
struct AliceServiceSession *s = cls;
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_bob.c b/src/scalarproduct/gnunet-service-scalarproduct_bob.c
index 5d2df017b3..f3b5327f1d 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct_bob.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct_bob.c
@@ -879,11 +879,13 @@ handle_alices_cryptodata_message (void *cls,
*
* @param cls closure with the `struct BobServiceSession`
* @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK
+ * @param current_size current set size
* @param status what has happened with the set intersection?
*/
static void
cb_intersection_element_removed (void *cls,
const struct GNUNET_SET_Element *element,
+ uint64_t current_size,
enum GNUNET_SET_Status status)
{
struct BobServiceSession *s = cls;
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index 5037b7bfd8..82c45453d0 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -1285,6 +1285,7 @@ send_client_element (struct Operation *op,
rm->result_status = htons (status);
rm->request_id = htonl (op->spec->client_request_id);
rm->element_type = element->element_type;
+ rm->current_size = GNUNET_htonll (GNUNET_CONTAINER_multihashmap32_size (op->state->key_to_element));
GNUNET_memcpy (&rm[1], element->data, element->size);
GNUNET_MQ_send (op->spec->set->client_mq, ev);
}
@@ -1307,6 +1308,7 @@ send_done_and_destroy (void *cls)
rm->request_id = htonl (op->spec->client_request_id);
rm->result_status = htons (GNUNET_SET_STATUS_DONE);
rm->element_type = htons (0);
+ rm->current_size = GNUNET_htonll (GNUNET_CONTAINER_multihashmap32_size (op->state->key_to_element));
GNUNET_MQ_send (op->spec->set->client_mq, ev);
/* Will also call the union-specific cancel function. */
_GSS_operation_destroy (op, GNUNET_YES);
@@ -1969,8 +1971,8 @@ union_evaluate (struct Operation *op,
LOG (GNUNET_ERROR_TYPE_DEBUG,
"sent op request without context message\n");
- op->state->initial_size = GNUNET_CONTAINER_multihashmap_size (op->spec->set->content->elements);
initialize_key_to_element (op);
+ op->state->initial_size = GNUNET_CONTAINER_multihashmap32_size (op->state->key_to_element);
}
@@ -2000,8 +2002,8 @@ union_accept (struct Operation *op)
op->state->se = strata_estimator_dup (op->spec->set->state->se);
op->state->demanded_hashes = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO);
op->state->salt_receive = op->state->salt_send = 42;
- op->state->initial_size = GNUNET_CONTAINER_multihashmap_size (op->spec->set->content->elements);
initialize_key_to_element (op);
+ op->state->initial_size = GNUNET_CONTAINER_multihashmap32_size (op->state->key_to_element);
/* kick off the operation */
send_strata_estimator (op);
}
diff --git a/src/set/gnunet-set-profiler.c b/src/set/gnunet-set-profiler.c
index cfbb5602a2..d83e034a68 100644
--- a/src/set/gnunet-set-profiler.c
+++ b/src/set/gnunet-set-profiler.c
@@ -162,6 +162,7 @@ check_all_done (void)
static void
set_result_cb (void *cls,
const struct GNUNET_SET_Element *element,
+ uint64_t current_size,
enum GNUNET_SET_Status status)
{
struct SetInfo *info = cls;
diff --git a/src/set/set.h b/src/set/set.h
index 207f098bc2..258e2bff9d 100644
--- a/src/set/set.h
+++ b/src/set/set.h
@@ -251,6 +251,11 @@ struct GNUNET_SET_ResultMessage
struct GNUNET_MessageHeader header;
/**
+ * Current set size.
+ */
+ uint64_t current_size;
+
+ /**
* id the result belongs to
*/
uint32_t request_id GNUNET_PACKED;
diff --git a/src/set/set_api.c b/src/set/set_api.c
index 2b09725e8c..0ae02e35ae 100644
--- a/src/set/set_api.c
+++ b/src/set/set_api.c
@@ -432,6 +432,7 @@ do_final:
{
oh->result_cb (oh->result_cls,
NULL,
+ GNUNET_ntohll (msg->current_size),
result_status);
}
else
@@ -453,6 +454,7 @@ do_element:
if (NULL != oh->result_cb)
oh->result_cb (oh->result_cls,
&e,
+ GNUNET_ntohll (msg->current_size),
result_status);
}
@@ -538,6 +540,7 @@ handle_client_set_error (void *cls,
if (NULL != set->ops_head->result_cb)
set->ops_head->result_cb (set->ops_head->result_cls,
NULL,
+ 0,
GNUNET_SET_STATUS_FAILURE);
set_operation_destroy (set->ops_head);
}
diff --git a/src/set/test_set_api.c b/src/set/test_set_api.c
index 4bc6bd1c3a..63c8810778 100644
--- a/src/set/test_set_api.c
+++ b/src/set/test_set_api.c
@@ -55,6 +55,7 @@ static struct GNUNET_SCHEDULER_Task *tt;
static void
result_cb_set1 (void *cls,
const struct GNUNET_SET_Element *element,
+ uint64_t size,
enum GNUNET_SET_Status status)
{
switch (status)
diff --git a/src/set/test_set_intersection_result_full.c b/src/set/test_set_intersection_result_full.c
index cbe1ce1492..be9d63646c 100644
--- a/src/set/test_set_intersection_result_full.c
+++ b/src/set/test_set_intersection_result_full.c
@@ -56,6 +56,7 @@ static struct GNUNET_SET_OperationHandle *oh2;
static void
result_cb_set1 (void *cls,
const struct GNUNET_SET_Element *element,
+ uint64_t current_size,
enum GNUNET_SET_Status status)
{
static int count;
diff --git a/src/set/test_set_union_result_symmetric.c b/src/set/test_set_union_result_symmetric.c
index 8dff40ec0e..88739fcaf9 100644
--- a/src/set/test_set_union_result_symmetric.c
+++ b/src/set/test_set_union_result_symmetric.c
@@ -77,6 +77,7 @@ static struct GNUNET_SCHEDULER_Task *timeout_task;
static void
result_cb_set1 (void *cls,
const struct GNUNET_SET_Element *element,
+ uint64_t current_size,
enum GNUNET_SET_Status status)
{
switch (status)