diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-02-27 01:18:54 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-02-27 01:19:18 +0100 |
commit | 6da407ad72fdca282094ccdb5558ece9638e3bd3 (patch) | |
tree | 9b93ef7431143588be591e97f2bb0409ff4493ef | |
parent | 3112e64ef06f71b06e9f047f2c6dd1be0941a565 (diff) | |
download | gnunet-6da407ad72fdca282094ccdb5558ece9638e3bd3.tar.gz gnunet-6da407ad72fdca282094ccdb5558ece9638e3bd3.zip |
include set size in result callback, needed by consensus
-rw-r--r-- | src/consensus/consensus_protocol.h | 8 | ||||
-rw-r--r-- | src/consensus/gnunet-service-consensus.c | 53 | ||||
-rw-r--r-- | src/consensus/plugin_block_consensus.c | 2 | ||||
-rw-r--r-- | src/dv/gnunet-service-dv.c | 2 | ||||
-rw-r--r-- | src/include/gnunet_set_service.h | 2 | ||||
-rw-r--r-- | src/revocation/gnunet-service-revocation.c | 2 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c | 2 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c | 2 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct_alice.c | 2 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct_bob.c | 2 | ||||
-rw-r--r-- | src/set/gnunet-service-set_union.c | 6 | ||||
-rw-r--r-- | src/set/gnunet-set-profiler.c | 1 | ||||
-rw-r--r-- | src/set/set.h | 5 | ||||
-rw-r--r-- | src/set/set_api.c | 3 | ||||
-rw-r--r-- | src/set/test_set_api.c | 1 | ||||
-rw-r--r-- | src/set/test_set_intersection_result_full.c | 1 | ||||
-rw-r--r-- | src/set/test_set_union_result_symmetric.c | 1 |
17 files changed, 86 insertions, 9 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 | ||
92 | enum { | ||
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 | |||
141 | enum PhaseKind | 141 | enum 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 | */ |
869 | static void | 872 | static void |
870 | set_result_cb (void *cls, | 873 | set_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 | ||
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index e4b664f4b..7d101c8ae 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c | |||
@@ -1346,11 +1346,13 @@ check_target_added (void *cls, | |||
1346 | * | 1346 | * |
1347 | * @param cls the `struct DirectNeighbor` we're building the consensus with | 1347 | * @param cls the `struct DirectNeighbor` we're building the consensus with |
1348 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK | 1348 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK |
1349 | * @param current_size current set size | ||
1349 | * @param status see `enum GNUNET_SET_Status` | 1350 | * @param status see `enum GNUNET_SET_Status` |
1350 | */ | 1351 | */ |
1351 | static void | 1352 | static void |
1352 | handle_set_union_result (void *cls, | 1353 | handle_set_union_result (void *cls, |
1353 | const struct GNUNET_SET_Element *element, | 1354 | const struct GNUNET_SET_Element *element, |
1355 | uint64_t current_size, | ||
1354 | enum GNUNET_SET_Status status) | 1356 | enum GNUNET_SET_Status status) |
1355 | { | 1357 | { |
1356 | struct DirectNeighbor *neighbor = cls; | 1358 | struct DirectNeighbor *neighbor = cls; |
diff --git a/src/include/gnunet_set_service.h b/src/include/gnunet_set_service.h index f9b477f47..ca46d8746 100644 --- a/src/include/gnunet_set_service.h +++ b/src/include/gnunet_set_service.h | |||
@@ -275,11 +275,13 @@ typedef void | |||
275 | * | 275 | * |
276 | * @param cls closure | 276 | * @param cls closure |
277 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK | 277 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK |
278 | * @param current_size current set size | ||
278 | * @param status see `enum GNUNET_SET_Status` | 279 | * @param status see `enum GNUNET_SET_Status` |
279 | */ | 280 | */ |
280 | typedef void | 281 | typedef void |
281 | (*GNUNET_SET_ResultIterator) (void *cls, | 282 | (*GNUNET_SET_ResultIterator) (void *cls, |
282 | const struct GNUNET_SET_Element *element, | 283 | const struct GNUNET_SET_Element *element, |
284 | uint64_t current_size, | ||
283 | enum GNUNET_SET_Status status); | 285 | enum GNUNET_SET_Status status); |
284 | 286 | ||
285 | /** | 287 | /** |
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index 0ac963f63..99bec1fc8 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c | |||
@@ -432,11 +432,13 @@ handle_p2p_revoke (void *cls, | |||
432 | * | 432 | * |
433 | * @param cls closure | 433 | * @param cls closure |
434 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK | 434 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK |
435 | * @param current_size current set size | ||
435 | * @param status see `enum GNUNET_SET_Status` | 436 | * @param status see `enum GNUNET_SET_Status` |
436 | */ | 437 | */ |
437 | static void | 438 | static void |
438 | add_revocation (void *cls, | 439 | add_revocation (void *cls, |
439 | const struct GNUNET_SET_Element *element, | 440 | const struct GNUNET_SET_Element *element, |
441 | uint64_t current_size, | ||
440 | enum GNUNET_SET_Status status) | 442 | enum GNUNET_SET_Status status) |
441 | { | 443 | { |
442 | struct PeerEntry *peer_entry = cls; | 444 | 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 b7b839b6f..ca92fb9ea 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) | |||
687 | * | 687 | * |
688 | * @param cls closure with the `struct AliceServiceSession` | 688 | * @param cls closure with the `struct AliceServiceSession` |
689 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK | 689 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK |
690 | * @param current_size current set size | ||
690 | * @param status what has happened with the set intersection? | 691 | * @param status what has happened with the set intersection? |
691 | */ | 692 | */ |
692 | static void | 693 | static void |
693 | cb_intersection_element_removed (void *cls, | 694 | cb_intersection_element_removed (void *cls, |
694 | const struct GNUNET_SET_Element *element, | 695 | const struct GNUNET_SET_Element *element, |
696 | uint64_t current_size, | ||
695 | enum GNUNET_SET_Status status) | 697 | enum GNUNET_SET_Status status) |
696 | { | 698 | { |
697 | struct AliceServiceSession *s = cls; | 699 | 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 8a5b3a5b2..3851ca763 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, | |||
580 | * | 580 | * |
581 | * @param cls closure with the `struct BobServiceSession` | 581 | * @param cls closure with the `struct BobServiceSession` |
582 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK | 582 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK |
583 | * @param current_size current set size | ||
583 | * @param status what has happened with the set intersection? | 584 | * @param status what has happened with the set intersection? |
584 | */ | 585 | */ |
585 | static void | 586 | static void |
586 | cb_intersection_element_removed (void *cls, | 587 | cb_intersection_element_removed (void *cls, |
587 | const struct GNUNET_SET_Element *element, | 588 | const struct GNUNET_SET_Element *element, |
589 | uint64_t current_size, | ||
588 | enum GNUNET_SET_Status status) | 590 | enum GNUNET_SET_Status status) |
589 | { | 591 | { |
590 | struct BobServiceSession *s = cls; | 592 | struct BobServiceSession *s = cls; |
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_alice.c b/src/scalarproduct/gnunet-service-scalarproduct_alice.c index 697baa9bd..6d7a0a3b8 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) | |||
924 | * | 924 | * |
925 | * @param cls closure with the `struct AliceServiceSession` | 925 | * @param cls closure with the `struct AliceServiceSession` |
926 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK | 926 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK |
927 | * @param current_size current set size | ||
927 | * @param status what has happened with the set intersection? | 928 | * @param status what has happened with the set intersection? |
928 | */ | 929 | */ |
929 | static void | 930 | static void |
930 | cb_intersection_element_removed (void *cls, | 931 | cb_intersection_element_removed (void *cls, |
931 | const struct GNUNET_SET_Element *element, | 932 | const struct GNUNET_SET_Element *element, |
933 | uint64_t current_size, | ||
932 | enum GNUNET_SET_Status status) | 934 | enum GNUNET_SET_Status status) |
933 | { | 935 | { |
934 | struct AliceServiceSession *s = cls; | 936 | struct AliceServiceSession *s = cls; |
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_bob.c b/src/scalarproduct/gnunet-service-scalarproduct_bob.c index 5d2df017b..f3b5327f1 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, | |||
879 | * | 879 | * |
880 | * @param cls closure with the `struct BobServiceSession` | 880 | * @param cls closure with the `struct BobServiceSession` |
881 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK | 881 | * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK |
882 | * @param current_size current set size | ||
882 | * @param status what has happened with the set intersection? | 883 | * @param status what has happened with the set intersection? |
883 | */ | 884 | */ |
884 | static void | 885 | static void |
885 | cb_intersection_element_removed (void *cls, | 886 | cb_intersection_element_removed (void *cls, |
886 | const struct GNUNET_SET_Element *element, | 887 | const struct GNUNET_SET_Element *element, |
888 | uint64_t current_size, | ||
887 | enum GNUNET_SET_Status status) | 889 | enum GNUNET_SET_Status status) |
888 | { | 890 | { |
889 | struct BobServiceSession *s = cls; | 891 | struct BobServiceSession *s = cls; |
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c index 5037b7bfd..82c45453d 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, | |||
1285 | rm->result_status = htons (status); | 1285 | rm->result_status = htons (status); |
1286 | rm->request_id = htonl (op->spec->client_request_id); | 1286 | rm->request_id = htonl (op->spec->client_request_id); |
1287 | rm->element_type = element->element_type; | 1287 | rm->element_type = element->element_type; |
1288 | rm->current_size = GNUNET_htonll (GNUNET_CONTAINER_multihashmap32_size (op->state->key_to_element)); | ||
1288 | GNUNET_memcpy (&rm[1], element->data, element->size); | 1289 | GNUNET_memcpy (&rm[1], element->data, element->size); |
1289 | GNUNET_MQ_send (op->spec->set->client_mq, ev); | 1290 | GNUNET_MQ_send (op->spec->set->client_mq, ev); |
1290 | } | 1291 | } |
@@ -1307,6 +1308,7 @@ send_done_and_destroy (void *cls) | |||
1307 | rm->request_id = htonl (op->spec->client_request_id); | 1308 | rm->request_id = htonl (op->spec->client_request_id); |
1308 | rm->result_status = htons (GNUNET_SET_STATUS_DONE); | 1309 | rm->result_status = htons (GNUNET_SET_STATUS_DONE); |
1309 | rm->element_type = htons (0); | 1310 | rm->element_type = htons (0); |
1311 | rm->current_size = GNUNET_htonll (GNUNET_CONTAINER_multihashmap32_size (op->state->key_to_element)); | ||
1310 | GNUNET_MQ_send (op->spec->set->client_mq, ev); | 1312 | GNUNET_MQ_send (op->spec->set->client_mq, ev); |
1311 | /* Will also call the union-specific cancel function. */ | 1313 | /* Will also call the union-specific cancel function. */ |
1312 | _GSS_operation_destroy (op, GNUNET_YES); | 1314 | _GSS_operation_destroy (op, GNUNET_YES); |
@@ -1969,8 +1971,8 @@ union_evaluate (struct Operation *op, | |||
1969 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1971 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1970 | "sent op request without context message\n"); | 1972 | "sent op request without context message\n"); |
1971 | 1973 | ||
1972 | op->state->initial_size = GNUNET_CONTAINER_multihashmap_size (op->spec->set->content->elements); | ||
1973 | initialize_key_to_element (op); | 1974 | initialize_key_to_element (op); |
1975 | op->state->initial_size = GNUNET_CONTAINER_multihashmap32_size (op->state->key_to_element); | ||
1974 | } | 1976 | } |
1975 | 1977 | ||
1976 | 1978 | ||
@@ -2000,8 +2002,8 @@ union_accept (struct Operation *op) | |||
2000 | op->state->se = strata_estimator_dup (op->spec->set->state->se); | 2002 | op->state->se = strata_estimator_dup (op->spec->set->state->se); |
2001 | op->state->demanded_hashes = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO); | 2003 | op->state->demanded_hashes = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO); |
2002 | op->state->salt_receive = op->state->salt_send = 42; | 2004 | op->state->salt_receive = op->state->salt_send = 42; |
2003 | op->state->initial_size = GNUNET_CONTAINER_multihashmap_size (op->spec->set->content->elements); | ||
2004 | initialize_key_to_element (op); | 2005 | initialize_key_to_element (op); |
2006 | op->state->initial_size = GNUNET_CONTAINER_multihashmap32_size (op->state->key_to_element); | ||
2005 | /* kick off the operation */ | 2007 | /* kick off the operation */ |
2006 | send_strata_estimator (op); | 2008 | send_strata_estimator (op); |
2007 | } | 2009 | } |
diff --git a/src/set/gnunet-set-profiler.c b/src/set/gnunet-set-profiler.c index cfbb5602a..d83e034a6 100644 --- a/src/set/gnunet-set-profiler.c +++ b/src/set/gnunet-set-profiler.c | |||
@@ -162,6 +162,7 @@ check_all_done (void) | |||
162 | static void | 162 | static void |
163 | set_result_cb (void *cls, | 163 | set_result_cb (void *cls, |
164 | const struct GNUNET_SET_Element *element, | 164 | const struct GNUNET_SET_Element *element, |
165 | uint64_t current_size, | ||
165 | enum GNUNET_SET_Status status) | 166 | enum GNUNET_SET_Status status) |
166 | { | 167 | { |
167 | struct SetInfo *info = cls; | 168 | struct SetInfo *info = cls; |
diff --git a/src/set/set.h b/src/set/set.h index 207f098bc..258e2bff9 100644 --- a/src/set/set.h +++ b/src/set/set.h | |||
@@ -251,6 +251,11 @@ struct GNUNET_SET_ResultMessage | |||
251 | struct GNUNET_MessageHeader header; | 251 | struct GNUNET_MessageHeader header; |
252 | 252 | ||
253 | /** | 253 | /** |
254 | * Current set size. | ||
255 | */ | ||
256 | uint64_t current_size; | ||
257 | |||
258 | /** | ||
254 | * id the result belongs to | 259 | * id the result belongs to |
255 | */ | 260 | */ |
256 | uint32_t request_id GNUNET_PACKED; | 261 | uint32_t request_id GNUNET_PACKED; |
diff --git a/src/set/set_api.c b/src/set/set_api.c index 2b09725e8..0ae02e35a 100644 --- a/src/set/set_api.c +++ b/src/set/set_api.c | |||
@@ -432,6 +432,7 @@ do_final: | |||
432 | { | 432 | { |
433 | oh->result_cb (oh->result_cls, | 433 | oh->result_cb (oh->result_cls, |
434 | NULL, | 434 | NULL, |
435 | GNUNET_ntohll (msg->current_size), | ||
435 | result_status); | 436 | result_status); |
436 | } | 437 | } |
437 | else | 438 | else |
@@ -453,6 +454,7 @@ do_element: | |||
453 | if (NULL != oh->result_cb) | 454 | if (NULL != oh->result_cb) |
454 | oh->result_cb (oh->result_cls, | 455 | oh->result_cb (oh->result_cls, |
455 | &e, | 456 | &e, |
457 | GNUNET_ntohll (msg->current_size), | ||
456 | result_status); | 458 | result_status); |
457 | } | 459 | } |
458 | 460 | ||
@@ -538,6 +540,7 @@ handle_client_set_error (void *cls, | |||
538 | if (NULL != set->ops_head->result_cb) | 540 | if (NULL != set->ops_head->result_cb) |
539 | set->ops_head->result_cb (set->ops_head->result_cls, | 541 | set->ops_head->result_cb (set->ops_head->result_cls, |
540 | NULL, | 542 | NULL, |
543 | 0, | ||
541 | GNUNET_SET_STATUS_FAILURE); | 544 | GNUNET_SET_STATUS_FAILURE); |
542 | set_operation_destroy (set->ops_head); | 545 | set_operation_destroy (set->ops_head); |
543 | } | 546 | } |
diff --git a/src/set/test_set_api.c b/src/set/test_set_api.c index 4bc6bd1c3..63c881077 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; | |||
55 | static void | 55 | static void |
56 | result_cb_set1 (void *cls, | 56 | result_cb_set1 (void *cls, |
57 | const struct GNUNET_SET_Element *element, | 57 | const struct GNUNET_SET_Element *element, |
58 | uint64_t size, | ||
58 | enum GNUNET_SET_Status status) | 59 | enum GNUNET_SET_Status status) |
59 | { | 60 | { |
60 | switch (status) | 61 | switch (status) |
diff --git a/src/set/test_set_intersection_result_full.c b/src/set/test_set_intersection_result_full.c index cbe1ce149..be9d63646 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; | |||
56 | static void | 56 | static void |
57 | result_cb_set1 (void *cls, | 57 | result_cb_set1 (void *cls, |
58 | const struct GNUNET_SET_Element *element, | 58 | const struct GNUNET_SET_Element *element, |
59 | uint64_t current_size, | ||
59 | enum GNUNET_SET_Status status) | 60 | enum GNUNET_SET_Status status) |
60 | { | 61 | { |
61 | static int count; | 62 | static int count; |
diff --git a/src/set/test_set_union_result_symmetric.c b/src/set/test_set_union_result_symmetric.c index 8dff40ec0..88739fcaf 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; | |||
77 | static void | 77 | static void |
78 | result_cb_set1 (void *cls, | 78 | result_cb_set1 (void *cls, |
79 | const struct GNUNET_SET_Element *element, | 79 | const struct GNUNET_SET_Element *element, |
80 | uint64_t current_size, | ||
80 | enum GNUNET_SET_Status status) | 81 | enum GNUNET_SET_Status status) |
81 | { | 82 | { |
82 | switch (status) | 83 | switch (status) |