};
+enum {
+ CONSENSUS_MARKER_CONTESTED,
+ CONSENSUS_MARKER_SIZE,
+};
+
+
/**
* Consensus element, either marker or payload.
*/
/**
* Is this a marker element?
*/
- uint8_t is_contested_marker;
+ uint8_t marker;
/* rest: element data */
};
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,
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";
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",
*
* @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;
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));
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",
}
}
#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;
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 */
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;
*
* @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;
*
* @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);
/**
*
* @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;
*
* @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;
*
* @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;
*
* @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;
*
* @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;
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);
}
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);
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);
}
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);
}
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;
*/
struct GNUNET_MessageHeader header;
+ /**
+ * Current set size.
+ */
+ uint64_t current_size;
+
/**
* id the result belongs to
*/
{
oh->result_cb (oh->result_cls,
NULL,
+ GNUNET_ntohll (msg->current_size),
result_status);
}
else
if (NULL != oh->result_cb)
oh->result_cb (oh->result_cls,
&e,
+ GNUNET_ntohll (msg->current_size),
result_status);
}
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);
}
static void
result_cb_set1 (void *cls,
const struct GNUNET_SET_Element *element,
+ uint64_t size,
enum GNUNET_SET_Status status)
{
switch (status)
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;
static void
result_cb_set1 (void *cls,
const struct GNUNET_SET_Element *element,
+ uint64_t current_size,
enum GNUNET_SET_Status status)
{
switch (status)