aboutsummaryrefslogtreecommitdiff
path: root/src/consensus/test_consensus_api.c
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2013-01-03 00:43:57 +0000
committerFlorian Dold <florian.dold@gmail.com>2013-01-03 00:43:57 +0000
commit845316cb543af7e4c77709acce4df79f3e0dc162 (patch)
tree629739608b0bd0f645d82fd41d90ccb2cb617d09 /src/consensus/test_consensus_api.c
parent3def510831309a5a0a5f50a2250911d6b592a87e (diff)
downloadgnunet-845316cb543af7e4c77709acce4df79f3e0dc162.tar.gz
gnunet-845316cb543af7e4c77709acce4df79f3e0dc162.zip
implemented the modified consensus api, started implementing p2p protocol for consensus
Diffstat (limited to 'src/consensus/test_consensus_api.c')
-rw-r--r--src/consensus/test_consensus_api.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/src/consensus/test_consensus_api.c b/src/consensus/test_consensus_api.c
index 8a263171f..e752983c2 100644
--- a/src/consensus/test_consensus_api.c
+++ b/src/consensus/test_consensus_api.c
@@ -27,14 +27,9 @@
27#include "gnunet_testing_lib.h" 27#include "gnunet_testing_lib.h"
28 28
29 29
30static struct GNUNET_CONSENSUS_Handle *consensus1; 30static struct GNUNET_CONSENSUS_Handle *consensus;
31static struct GNUNET_CONSENSUS_Handle *consensus2;
32 31
33static int concluded1; 32static int insert;
34static int concluded2;
35
36static int insert1;
37static int insert2;
38 33
39static struct GNUNET_HashCode session_id; 34static struct GNUNET_HashCode session_id;
40 35
@@ -48,20 +43,12 @@ static void conclude_done (void *cls,
48 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "concluded\n"); 43 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "concluded\n");
49} 44}
50 45
51static void 46static int
52on_new_element (void *cls, 47on_new_element (void *cls,
53 struct GNUNET_CONSENSUS_Element *element) 48 struct GNUNET_CONSENSUS_Element *element)
54{ 49{
55 struct GNUNET_CONSENSUS_Handle *consensus; 50 GNUNET_assert (0);
56 51 return GNUNET_YES;
57 GNUNET_assert (NULL != element);
58
59 consensus = *(struct GNUNET_CONSENSUS_Handle **) cls;
60
61 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "received new element\n");
62
63 GNUNET_CONSENSUS_conclude (consensus, GNUNET_TIME_UNIT_FOREVER_REL, &conclude_done, consensus);
64
65} 52}
66 53
67static void 54static void
@@ -71,7 +58,6 @@ insert_done (void *cls, int success)
71} 58}
72 59
73 60
74
75static void 61static void
76run (void *cls, 62run (void *cls,
77 const struct GNUNET_CONFIGURATION_Handle *cfg, 63 const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -89,11 +75,9 @@ run (void *cls,
89 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "testing consensus api\n"); 75 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "testing consensus api\n");
90 76
91 GNUNET_CRYPTO_hash (str, strlen (str), &session_id); 77 GNUNET_CRYPTO_hash (str, strlen (str), &session_id);
92 consensus1 = GNUNET_CONSENSUS_create (cfg, 0, NULL, &session_id, on_new_element, &consensus1); 78 consensus = GNUNET_CONSENSUS_create (cfg, 0, NULL, &session_id, on_new_element, &consensus);
79 GNUNET_assert (consensus != NULL);
93 /* 80 /*
94 consensus2 = GNUNET_CONSENSUS_create (cfg, 0, NULL, &session_id, on_new_element, &consensus2);
95 GNUNET_assert (consensus1 != NULL);
96 GNUNET_assert (consensus2 != NULL);
97 GNUNET_CONSENSUS_insert (consensus1, &el1, &insert_done, &consensus1); 81 GNUNET_CONSENSUS_insert (consensus1, &el1, &insert_done, &consensus1);
98 GNUNET_CONSENSUS_insert (consensus2, &el2, &insert_done, &consensus2); 82 GNUNET_CONSENSUS_insert (consensus2, &el2, &insert_done, &consensus2);
99 */ 83 */