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 /src/set | |
parent | 3112e64ef06f71b06e9f047f2c6dd1be0941a565 (diff) | |
download | gnunet-6da407ad72fdca282094ccdb5558ece9638e3bd3.tar.gz gnunet-6da407ad72fdca282094ccdb5558ece9638e3bd3.zip |
include set size in result callback, needed by consensus
Diffstat (limited to 'src/set')
-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 |
7 files changed, 16 insertions, 2 deletions
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) |