diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-08-29 23:30:01 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-08-29 23:30:01 +0200 |
commit | fb6e2fdd289b77acb7b9f9726f9a1e1c79a22103 (patch) | |
tree | e54762c82b90992e8bef8ff32054bc398b568b46 /src/consensus | |
parent | 394cacf9fdb640c59a41ee60a233b4e3cce44aad (diff) | |
download | gnunet-fb6e2fdd289b77acb7b9f9726f9a1e1c79a22103.tar.gz gnunet-fb6e2fdd289b77acb7b9f9726f9a1e1c79a22103.zip |
-mild refactoring of consensus, cleaning up the code a bit
Diffstat (limited to 'src/consensus')
-rw-r--r-- | src/consensus/gnunet-service-consensus.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c index 24e285e77..587e3685f 100644 --- a/src/consensus/gnunet-service-consensus.c +++ b/src/consensus/gnunet-service-consensus.c | |||
@@ -17,13 +17,11 @@ | |||
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | |||
21 | /** | 20 | /** |
22 | * @file consensus/gnunet-service-consensus.c | 21 | * @file consensus/gnunet-service-consensus.c |
23 | * @brief multi-peer set reconciliation | 22 | * @brief multi-peer set reconciliation |
24 | * @author Florian Dold <flo@dold.me> | 23 | * @author Florian Dold <flo@dold.me> |
25 | */ | 24 | */ |
26 | |||
27 | #include "platform.h" | 25 | #include "platform.h" |
28 | #include "gnunet_util_lib.h" | 26 | #include "gnunet_util_lib.h" |
29 | #include "gnunet_block_lib.h" | 27 | #include "gnunet_block_lib.h" |
@@ -1012,7 +1010,8 @@ set_result_cb (void *cls, | |||
1012 | 1010 | ||
1013 | if (SET_KIND_NONE != setop->output_set.set_kind) | 1011 | if (SET_KIND_NONE != setop->output_set.set_kind) |
1014 | { | 1012 | { |
1015 | output_set = lookup_set (session, &setop->output_set); | 1013 | output_set = lookup_set (session, |
1014 | &setop->output_set); | ||
1016 | GNUNET_assert (NULL != output_set); | 1015 | GNUNET_assert (NULL != output_set); |
1017 | } | 1016 | } |
1018 | 1017 | ||
@@ -2194,7 +2193,9 @@ task_start_reconcile (struct TaskEntry *task) | |||
2194 | we clone the input set. */ | 2193 | we clone the input set. */ |
2195 | if (NULL == lookup_set (session, &setop->output_set)) | 2194 | if (NULL == lookup_set (session, &setop->output_set)) |
2196 | { | 2195 | { |
2197 | create_set_copy_for_task (task, &setop->input_set, &setop->output_set); | 2196 | create_set_copy_for_task (task, |
2197 | &setop->input_set, | ||
2198 | &setop->output_set); | ||
2198 | return; | 2199 | return; |
2199 | } | 2200 | } |
2200 | } | 2201 | } |
@@ -2318,7 +2319,9 @@ task_start_eval_echo (struct TaskEntry *task) | |||
2318 | output_set = lookup_set (session, &sk_out); | 2319 | output_set = lookup_set (session, &sk_out); |
2319 | if (NULL == output_set) | 2320 | if (NULL == output_set) |
2320 | { | 2321 | { |
2321 | create_set_copy_for_task (task, &sk_in, &sk_out); | 2322 | create_set_copy_for_task (task, |
2323 | &sk_in, | ||
2324 | &sk_out); | ||
2322 | return; | 2325 | return; |
2323 | } | 2326 | } |
2324 | 2327 | ||
@@ -2326,6 +2329,7 @@ task_start_eval_echo (struct TaskEntry *task) | |||
2326 | // FIXME: should be marked as a shallow copy, so | 2329 | // FIXME: should be marked as a shallow copy, so |
2327 | // we can destroy everything correctly | 2330 | // we can destroy everything correctly |
2328 | struct SetEntry *last_set = GNUNET_new (struct SetEntry); | 2331 | struct SetEntry *last_set = GNUNET_new (struct SetEntry); |
2332 | |||
2329 | last_set->h = output_set->h; | 2333 | last_set->h = output_set->h; |
2330 | last_set->key = (struct SetKey) { SET_KIND_LAST_GRADECAST }; | 2334 | last_set->key = (struct SetKey) { SET_KIND_LAST_GRADECAST }; |
2331 | put_set (session, last_set); | 2335 | put_set (session, last_set); |
@@ -2719,7 +2723,7 @@ set_listen_cb (void *cls, | |||
2719 | task->cls.setop.op = GNUNET_SET_accept (request, | 2723 | task->cls.setop.op = GNUNET_SET_accept (request, |
2720 | GNUNET_SET_RESULT_SYMMETRIC, | 2724 | GNUNET_SET_RESULT_SYMMETRIC, |
2721 | opts, | 2725 | opts, |
2722 | set_result_cb, | 2726 | &set_result_cb, |
2723 | task); | 2727 | task); |
2724 | 2728 | ||
2725 | /* If the task hasn't been started yet, | 2729 | /* If the task hasn't been started yet, |