aboutsummaryrefslogtreecommitdiff
path: root/src/consensus/gnunet-service-consensus.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/consensus/gnunet-service-consensus.c')
-rw-r--r--src/consensus/gnunet-service-consensus.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c
index 4af7199aa..84b1cbe55 100644
--- a/src/consensus/gnunet-service-consensus.c
+++ b/src/consensus/gnunet-service-consensus.c
@@ -693,7 +693,7 @@ send_to_client_iter (void *cls,
693 GNUNET_assert (GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT == element->element_type); 693 GNUNET_assert (GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT == element->element_type);
694 ce = element->data; 694 ce = element->data;
695 695
696 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "marker is %u\n", (unsigned) ce->marker); 696 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "marker is %u\n", (unsigned) ce->marker);
697 697
698 if (0 != ce->marker) 698 if (0 != ce->marker)
699 return GNUNET_YES; 699 return GNUNET_YES;
@@ -988,7 +988,7 @@ set_result_cb (void *cls,
988 988
989 if ( (NULL != consensus_element) && (0 != consensus_element->marker) ) 989 if ( (NULL != consensus_element) && (0 != consensus_element->marker) )
990 { 990 {
991 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 991 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
992 "P%u: got some marker\n", 992 "P%u: got some marker\n",
993 session->local_peer_idx); 993 session->local_peer_idx);
994 if ( (GNUNET_YES == setop->transceive_contested) && 994 if ( (GNUNET_YES == setop->transceive_contested) &&
@@ -1002,7 +1002,7 @@ set_result_cb (void *cls,
1002 if (CONSENSUS_MARKER_SIZE == consensus_element->marker) 1002 if (CONSENSUS_MARKER_SIZE == consensus_element->marker)
1003 { 1003 {
1004 1004
1005 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1005 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1006 "P%u: got size marker\n", 1006 "P%u: got size marker\n",
1007 session->local_peer_idx); 1007 session->local_peer_idx);
1008 1008
@@ -1018,7 +1018,7 @@ set_result_cb (void *cls,
1018 uint64_t *copy = GNUNET_memdup (session->first_sizes_received, sizeof (uint64_t) * session->num_peers); 1018 uint64_t *copy = GNUNET_memdup (session->first_sizes_received, sizeof (uint64_t) * session->num_peers);
1019 qsort (copy, session->num_peers, sizeof (uint64_t), cmp_uint64_t); 1019 qsort (copy, session->num_peers, sizeof (uint64_t), cmp_uint64_t);
1020 session->lower_bound = copy[session->num_peers / 3 + 1]; 1020 session->lower_bound = copy[session->num_peers / 3 + 1];
1021 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1021 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1022 "P%u: lower bound %llu\n", 1022 "P%u: lower bound %llu\n",
1023 session->local_peer_idx, 1023 session->local_peer_idx,
1024 (long long) session->lower_bound); 1024 (long long) session->lower_bound);
@@ -1045,7 +1045,7 @@ set_result_cb (void *cls,
1045 NULL, 1045 NULL,
1046 NULL); 1046 NULL);
1047#ifdef GNUNET_EXTRA_LOGGING 1047#ifdef GNUNET_EXTRA_LOGGING
1048 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1048 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1049 "P%u: adding element %s into set {%s} of task {%s}\n", 1049 "P%u: adding element %s into set {%s} of task {%s}\n",
1050 session->local_peer_idx, 1050 session->local_peer_idx,
1051 debug_str_element (element), 1051 debug_str_element (element),
@@ -1057,7 +1057,7 @@ set_result_cb (void *cls,
1057 { 1057 {
1058 diff_insert (output_diff, 1, element); 1058 diff_insert (output_diff, 1, element);
1059#ifdef GNUNET_EXTRA_LOGGING 1059#ifdef GNUNET_EXTRA_LOGGING
1060 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1060 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1061 "P%u: adding element %s into diff {%s} of task {%s}\n", 1061 "P%u: adding element %s into diff {%s} of task {%s}\n",
1062 session->local_peer_idx, 1062 session->local_peer_idx,
1063 debug_str_element (element), 1063 debug_str_element (element),
@@ -1069,7 +1069,7 @@ set_result_cb (void *cls,
1069 { 1069 {
1070 rfn_vote (output_rfn, task_other_peer (task), VOTE_ADD, element); 1070 rfn_vote (output_rfn, task_other_peer (task), VOTE_ADD, element);
1071#ifdef GNUNET_EXTRA_LOGGING 1071#ifdef GNUNET_EXTRA_LOGGING
1072 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1072 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1073 "P%u: adding element %s into rfn {%s} of task {%s}\n", 1073 "P%u: adding element %s into rfn {%s} of task {%s}\n",
1074 session->local_peer_idx, 1074 session->local_peer_idx,
1075 debug_str_element (element), 1075 debug_str_element (element),
@@ -1096,7 +1096,7 @@ set_result_cb (void *cls,
1096 NULL, 1096 NULL,
1097 NULL); 1097 NULL);
1098#ifdef GNUNET_EXTRA_LOGGING 1098#ifdef GNUNET_EXTRA_LOGGING
1099 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1099 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1100 "P%u: removing element %s from set {%s} of task {%s}\n", 1100 "P%u: removing element %s from set {%s} of task {%s}\n",
1101 session->local_peer_idx, 1101 session->local_peer_idx,
1102 debug_str_element (element), 1102 debug_str_element (element),
@@ -1108,7 +1108,7 @@ set_result_cb (void *cls,
1108 { 1108 {
1109 diff_insert (output_diff, -1, element); 1109 diff_insert (output_diff, -1, element);
1110#ifdef GNUNET_EXTRA_LOGGING 1110#ifdef GNUNET_EXTRA_LOGGING
1111 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1111 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1112 "P%u: removing element %s from diff {%s} of task {%s}\n", 1112 "P%u: removing element %s from diff {%s} of task {%s}\n",
1113 session->local_peer_idx, 1113 session->local_peer_idx,
1114 debug_str_element (element), 1114 debug_str_element (element),
@@ -1120,7 +1120,7 @@ set_result_cb (void *cls,
1120 { 1120 {
1121 rfn_vote (output_rfn, task_other_peer (task), VOTE_REMOVE, element); 1121 rfn_vote (output_rfn, task_other_peer (task), VOTE_REMOVE, element);
1122#ifdef GNUNET_EXTRA_LOGGING 1122#ifdef GNUNET_EXTRA_LOGGING
1123 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1123 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1124 "P%u: removing element %s from rfn {%s} of task {%s}\n", 1124 "P%u: removing element %s from rfn {%s} of task {%s}\n",
1125 session->local_peer_idx, 1125 session->local_peer_idx,
1126 debug_str_element (element), 1126 debug_str_element (element),
@@ -1133,8 +1133,11 @@ set_result_cb (void *cls,
1133 // XXX: check first if any changes to the underlying 1133 // XXX: check first if any changes to the underlying
1134 // set are still pending 1134 // set are still pending
1135 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1135 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1136 "Finishing setop in Task {%s}\n", 1136 "P%u: Finishing setop in Task {%s} (%u/%u)\n",
1137 debug_str_task_key (&task->key)); 1137 session->local_peer_idx,
1138 debug_str_task_key (&task->key),
1139 (unsigned int) task->step->finished_tasks,
1140 (unsigned int) task->step->tasks_len);
1138 if (NULL != output_rfn) 1141 if (NULL != output_rfn)
1139 { 1142 {
1140 rfn_commit (output_rfn, task_other_peer (task)); 1143 rfn_commit (output_rfn, task_other_peer (task));
@@ -1345,7 +1348,7 @@ commit_set (struct ConsensusSession *session,
1345 .size = 0, 1348 .size = 0,
1346 .sender_index = 0 1349 .sender_index = 0
1347 }; 1350 };
1348 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "inserting size marker\n"); 1351 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "inserting size marker\n");
1349 cse.ce.marker = CONSENSUS_MARKER_SIZE; 1352 cse.ce.marker = CONSENSUS_MARKER_SIZE;
1350 cse.size = GNUNET_htonll (session->first_size); 1353 cse.size = GNUNET_htonll (session->first_size);
1351 cse.sender_index = session->local_peer_idx; 1354 cse.sender_index = session->local_peer_idx;
@@ -1421,7 +1424,7 @@ commit_set (struct ConsensusSession *session,
1421 } 1424 }
1422 GNUNET_SET_add_element (set->h, &element, NULL, NULL); 1425 GNUNET_SET_add_element (set->h, &element, NULL, NULL);
1423#ifdef GNUNET_EXTRA_LOGGING 1426#ifdef GNUNET_EXTRA_LOGGING
1424 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1427 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1425 "P%u: evil peer: cramming element %s into set {%s} of task {%s}\n", 1428 "P%u: evil peer: cramming element %s into set {%s} of task {%s}\n",
1426 session->local_peer_idx, 1429 session->local_peer_idx,
1427 debug_str_element (&element), 1430 debug_str_element (&element),
@@ -1436,7 +1439,7 @@ commit_set (struct ConsensusSession *session,
1436 GNUNET_SET_commit (setop->op, set->h); 1439 GNUNET_SET_commit (setop->op, set->h);
1437 break; 1440 break;
1438 case EVILNESS_SLACK: 1441 case EVILNESS_SLACK:
1439 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1442 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1440 "P%u: evil peer: slacking\n", 1443 "P%u: evil peer: slacking\n",
1441 (unsigned int) session->local_peer_idx); 1444 (unsigned int) session->local_peer_idx);
1442 /* Do nothing. */ 1445 /* Do nothing. */
@@ -1470,6 +1473,7 @@ commit_set (struct ConsensusSession *session,
1470 peers to wait. */ 1473 peers to wait. */
1471 GNUNET_SET_operation_cancel (setop->op); 1474 GNUNET_SET_operation_cancel (setop->op);
1472 setop->op = NULL; 1475 setop->op = NULL;
1476 finish_task (task);
1473 } 1477 }
1474#endif 1478#endif
1475} 1479}
@@ -1891,7 +1895,7 @@ task_start_apply_round (struct TaskEntry *task)
1891 ri->element, 1895 ri->element,
1892 &set_mutation_done, 1896 &set_mutation_done,
1893 progress_cls)); 1897 progress_cls));
1894 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1898 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1895 "P%u: apply round: adding element %s with %u-majority.\n", 1899 "P%u: apply round: adding element %s with %u-majority.\n",
1896 session->local_peer_idx, 1900 session->local_peer_idx,
1897 debug_str_element (ri->element), majority_num); 1901 debug_str_element (ri->element), majority_num);
@@ -1903,13 +1907,13 @@ task_start_apply_round (struct TaskEntry *task)
1903 ri->element, 1907 ri->element,
1904 &set_mutation_done, 1908 &set_mutation_done,
1905 progress_cls)); 1909 progress_cls));
1906 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1910 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1907 "P%u: apply round: deleting element %s with %u-majority.\n", 1911 "P%u: apply round: deleting element %s with %u-majority.\n",
1908 session->local_peer_idx, 1912 session->local_peer_idx,
1909 debug_str_element (ri->element), majority_num); 1913 debug_str_element (ri->element), majority_num);
1910 break; 1914 break;
1911 case VOTE_STAY: 1915 case VOTE_STAY:
1912 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1916 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1913 "P%u: apply round: keeping element %s with %u-majority.\n", 1917 "P%u: apply round: keeping element %s with %u-majority.\n",
1914 session->local_peer_idx, 1918 session->local_peer_idx,
1915 debug_str_element (ri->element), majority_num); 1919 debug_str_element (ri->element), majority_num);
@@ -2378,6 +2382,13 @@ finish_task (struct TaskEntry *task)
2378 2382
2379 task->step->finished_tasks++; 2383 task->step->finished_tasks++;
2380 2384
2385 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
2386 "P%u: Finishing Task {%s} (now %u/%u tasks finished in step)\n",
2387 task->step->session->local_peer_idx,
2388 debug_str_task_key (&task->key),
2389 (unsigned int) task->step->finished_tasks,
2390 (unsigned int) task->step->tasks_len);
2391
2381 if (task->step->finished_tasks == task->step->tasks_len) 2392 if (task->step->finished_tasks == task->step->tasks_len)
2382 finish_step (task->step); 2393 finish_step (task->step);
2383} 2394}