aboutsummaryrefslogtreecommitdiff
path: root/src/consensus
diff options
context:
space:
mode:
Diffstat (limited to 'src/consensus')
-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
3 files changed, 56 insertions, 7 deletions
diff --git a/src/consensus/consensus_protocol.h b/src/consensus/consensus_protocol.h
index 161c939cd..43b6a9632 100644
--- a/src/consensus/consensus_protocol.h
+++ b/src/consensus/consensus_protocol.h
@@ -89,6 +89,12 @@ struct GNUNET_CONSENSUS_RoundContextMessage
89}; 89};
90 90
91 91
92enum {
93 CONSENSUS_MARKER_CONTESTED,
94 CONSENSUS_MARKER_SIZE,
95};
96
97
92/** 98/**
93 * Consensus element, either marker or payload. 99 * Consensus element, either marker or payload.
94 */ 100 */
@@ -103,7 +109,7 @@ struct ConsensusElement
103 /** 109 /**
104 * Is this a marker element? 110 * Is this a marker element?
105 */ 111 */
106 uint8_t is_contested_marker; 112 uint8_t marker;
107 113
108 /* rest: element data */ 114 /* rest: element data */
109}; 115};
diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c
index 9d5d35c94..44b6dc21b 100644
--- a/src/consensus/gnunet-service-consensus.c
+++ b/src/consensus/gnunet-service-consensus.c
@@ -141,6 +141,7 @@ GNUNET_NETWORK_STRUCT_END
141enum PhaseKind 141enum PhaseKind
142{ 142{
143 PHASE_KIND_ALL_TO_ALL, 143 PHASE_KIND_ALL_TO_ALL,
144 PHASE_KIND_ALL_TO_ALL_2,
144 PHASE_KIND_GRADECAST_LEADER, 145 PHASE_KIND_GRADECAST_LEADER,
145 PHASE_KIND_GRADECAST_ECHO, 146 PHASE_KIND_GRADECAST_ECHO,
146 PHASE_KIND_GRADECAST_ECHO_GRADE, 147 PHASE_KIND_GRADECAST_ECHO_GRADE,
@@ -528,6 +529,7 @@ phasename (uint16_t phase)
528 switch (phase) 529 switch (phase)
529 { 530 {
530 case PHASE_KIND_ALL_TO_ALL: return "ALL_TO_ALL"; 531 case PHASE_KIND_ALL_TO_ALL: return "ALL_TO_ALL";
532 case PHASE_KIND_ALL_TO_ALL_2: return "ALL_TO_ALL_2";
531 case PHASE_KIND_FINISH: return "FINISH"; 533 case PHASE_KIND_FINISH: return "FINISH";
532 case PHASE_KIND_GRADECAST_LEADER: return "GRADECAST_LEADER"; 534 case PHASE_KIND_GRADECAST_LEADER: return "GRADECAST_LEADER";
533 case PHASE_KIND_GRADECAST_ECHO: return "GRADECAST_ECHO"; 535 case PHASE_KIND_GRADECAST_ECHO: return "GRADECAST_ECHO";
@@ -668,7 +670,7 @@ send_to_client_iter (void *cls,
668 GNUNET_assert (GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT == element->element_type); 670 GNUNET_assert (GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT == element->element_type);
669 ce = element->data; 671 ce = element->data;
670 672
671 GNUNET_assert (GNUNET_NO == ce->is_contested_marker); 673 GNUNET_assert (0 == ce->marker);
672 674
673 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 675 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
674 "P%d: sending element %s to client\n", 676 "P%d: sending element %s to client\n",
@@ -864,11 +866,13 @@ task_other_peer (struct TaskEntry *task)
864 * 866 *
865 * @param cls closure 867 * @param cls closure
866 * @param element a result element, only valid if status is GNUNET_SET_STATUS_OK 868 * @param element a result element, only valid if status is GNUNET_SET_STATUS_OK
869 * @param current_size current set size
867 * @param status see enum GNUNET_SET_Status 870 * @param status see enum GNUNET_SET_Status
868 */ 871 */
869static void 872static void
870set_result_cb (void *cls, 873set_result_cb (void *cls,
871 const struct GNUNET_SET_Element *element, 874 const struct GNUNET_SET_Element *element,
875 uint64_t current_size,
872 enum GNUNET_SET_Status status) 876 enum GNUNET_SET_Status status)
873{ 877{
874 struct TaskEntry *task = cls; 878 struct TaskEntry *task = cls;
@@ -940,7 +944,7 @@ set_result_cb (void *cls,
940 if ( (GNUNET_SET_STATUS_ADD_LOCAL == status) || (GNUNET_SET_STATUS_ADD_REMOTE == status) ) 944 if ( (GNUNET_SET_STATUS_ADD_LOCAL == status) || (GNUNET_SET_STATUS_ADD_REMOTE == status) )
941 { 945 {
942 if ( (GNUNET_YES == setop->transceive_contested) && 946 if ( (GNUNET_YES == setop->transceive_contested) &&
943 (GNUNET_YES == consensus_element->is_contested_marker) ) 947 (CONSENSUS_MARKER_CONTESTED == consensus_element->marker) )
944 { 948 {
945 GNUNET_assert (NULL != output_rfn); 949 GNUNET_assert (NULL != output_rfn);
946 rfn_contest (output_rfn, task_other_peer (task)); 950 rfn_contest (output_rfn, task_other_peer (task));
@@ -1001,7 +1005,7 @@ set_result_cb (void *cls,
1001 GNUNET_assert (NULL != consensus_element); 1005 GNUNET_assert (NULL != consensus_element);
1002 if (GNUNET_YES == setop->do_not_remove) 1006 if (GNUNET_YES == setop->do_not_remove)
1003 break; 1007 break;
1004 if (GNUNET_YES == consensus_element->is_contested_marker) 1008 if (CONSENSUS_MARKER_CONTESTED == consensus_element->marker)
1005 break; 1009 break;
1006 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1010 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1007 "Removing element in Task {%s}\n", 1011 "Removing element in Task {%s}\n",
@@ -1325,11 +1329,19 @@ commit_set (struct ConsensusSession *session,
1325 } 1329 }
1326 } 1330 }
1327#else 1331#else
1332
1333 if (PHASE_KIND_ALL_TO_ALL_2 == task->key.kind)
1334 {
1335 struct GNUNET_SET_Element element;
1336 struct ConsensusElement ce = { 0 };
1337 }
1338
1339
1328 if ( (GNUNET_YES == setop->transceive_contested) && (GNUNET_YES == set->is_contested) ) 1340 if ( (GNUNET_YES == setop->transceive_contested) && (GNUNET_YES == set->is_contested) )
1329 { 1341 {
1330 struct GNUNET_SET_Element element; 1342 struct GNUNET_SET_Element element;
1331 struct ConsensusElement ce = { 0 }; 1343 struct ConsensusElement ce = { 0 };
1332 ce.is_contested_marker = GNUNET_YES; 1344 ce.marker = CONSENSUS_MARKER_CONTESTED;
1333 element.data = &ce; 1345 element.data = &ce;
1334 element.size = sizeof (struct ConsensusElement); 1346 element.size = sizeof (struct ConsensusElement);
1335 element.element_type = GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT; 1347 element.element_type = GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT;
@@ -2847,11 +2859,42 @@ construct_task_graph (struct ConsensusSession *session)
2847 put_task (session->taskmap, &task); 2859 put_task (session->taskmap, &task);
2848 } 2860 }
2849 2861
2862 round += 1;
2850 prev_step = step; 2863 prev_step = step;
2851 step = NULL; 2864 step = create_step (session, round, GNUNET_NO);;
2865#ifdef GNUNET_EXTRA_LOGGING
2866 step->debug_name = GNUNET_strdup ("all to all 2");
2867#endif
2868 step_depend_on (step, prev_step);
2869
2870
2871 for (i = 0; i < n; i++)
2872 {
2873 uint16_t p1;
2874 uint16_t p2;
2875
2876 p1 = me;
2877 p2 = i;
2878 arrange_peers (&p1, &p2, n);
2879 task = ((struct TaskEntry) {
2880 .key = (struct TaskKey) { PHASE_KIND_ALL_TO_ALL_2, p1, p2, -1, -1 },
2881 .step = step,
2882 .start = task_start_reconcile,
2883 .cancel = task_cancel_reconcile,
2884 });
2885 task.cls.setop.input_set = (struct SetKey) { SET_KIND_CURRENT, 0 };
2886 task.cls.setop.output_set = task.cls.setop.input_set;
2887 task.cls.setop.do_not_remove = GNUNET_YES;
2888 put_task (session->taskmap, &task);
2889 }
2852 2890
2853 round += 1; 2891 round += 1;
2854 2892
2893 prev_step = step;
2894 step = NULL;
2895
2896
2897
2855 /* Byzantine union */ 2898 /* Byzantine union */
2856 2899
2857 /* sequential repetitions of the gradecasts */ 2900 /* sequential repetitions of the gradecasts */
diff --git a/src/consensus/plugin_block_consensus.c b/src/consensus/plugin_block_consensus.c
index 3ad335760..0cb64867e 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,
63 63
64 const struct ConsensusElement *ce = reply_block; 64 const struct ConsensusElement *ce = reply_block;
65 65
66 if ( (GNUNET_YES == ce->is_contested_marker) || 66 if ( (0 != ce->marker) ||
67 (0 == ce->payload_type ) ) 67 (0 == ce->payload_type ) )
68 return GNUNET_BLOCK_EVALUATION_OK_MORE; 68 return GNUNET_BLOCK_EVALUATION_OK_MORE;
69 69