aboutsummaryrefslogtreecommitdiff
path: root/src/set/test_set_api.c
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2013-06-03 10:53:49 +0000
committerFlorian Dold <florian.dold@gmail.com>2013-06-03 10:53:49 +0000
commit68403fa780bf94ace2ebc13c2c09463cbbc0b57c (patch)
tree3442e4f25de90eab67c4f9813cb6e433c50b7482 /src/set/test_set_api.c
parentfae7f583f2e11cac15fefcbefef64287ab6915d3 (diff)
downloadgnunet-68403fa780bf94ace2ebc13c2c09463cbbc0b57c.tar.gz
gnunet-68403fa780bf94ace2ebc13c2c09463cbbc0b57c.zip
- conclude for SET
- consensus with SET
Diffstat (limited to 'src/set/test_set_api.c')
-rw-r--r--src/set/test_set_api.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/set/test_set_api.c b/src/set/test_set_api.c
index bf0d65697..f773cebdf 100644
--- a/src/set/test_set_api.c
+++ b/src/set/test_set_api.c
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file set/test_set_api.c 22 * @file set/test_set_api.c
23 * @brief testcase for consensus_api.c 23 * @brief testcase for set_api.c
24 */ 24 */
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
@@ -89,11 +89,13 @@ listen_cb (void *cls,
89 const struct GNUNET_MessageHeader *context_msg, 89 const struct GNUNET_MessageHeader *context_msg,
90 struct GNUNET_SET_Request *request) 90 struct GNUNET_SET_Request *request)
91{ 91{
92 struct GNUNET_SET_OperationHandle *oh;
93
92 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "listen cb called\n"); 94 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "listen cb called\n");
93 GNUNET_SET_listen_cancel (listen_handle); 95 GNUNET_SET_listen_cancel (listen_handle);
94 96
95 GNUNET_SET_accept (request, set2, 97 oh = GNUNET_SET_accept (request, GNUNET_SET_RESULT_ADDED, result_cb_set2, NULL);
96 GNUNET_SET_RESULT_ADDED, result_cb_set2, NULL); 98 GNUNET_SET_conclude (oh, set2);
97} 99}
98 100
99 101
@@ -105,11 +107,14 @@ listen_cb (void *cls,
105static void 107static void
106start (void *cls) 108start (void *cls)
107{ 109{
110 struct GNUNET_SET_OperationHandle *oh;
111
108 listen_handle = GNUNET_SET_listen (config, GNUNET_SET_OPERATION_UNION, 112 listen_handle = GNUNET_SET_listen (config, GNUNET_SET_OPERATION_UNION,
109 &app_id, listen_cb, NULL); 113 &app_id, listen_cb, NULL);
110 GNUNET_SET_evaluate (set1, &local_id, &app_id, NULL, 42, 114 oh = GNUNET_SET_evaluate (&local_id, &app_id, NULL, 42,
111 GNUNET_SET_RESULT_ADDED, 115 GNUNET_SET_RESULT_ADDED,
112 result_cb_set1, NULL); 116 result_cb_set1, NULL);
117 GNUNET_SET_conclude (oh, set1);
113} 118}
114 119
115 120
@@ -168,12 +173,14 @@ run (void *cls,
168 struct GNUNET_TESTING_Peer *peer) 173 struct GNUNET_TESTING_Peer *peer)
169{ 174{
170 175
171 static const char* app_str = "gnunet-set";
172
173 config = cfg; 176 config = cfg;
177 GNUNET_CRYPTO_get_host_identity (cfg, &local_id);
178 printf ("my id (from CRYPTO): %s\n", GNUNET_h2s (&local_id.hashPubKey));
174 GNUNET_TESTING_peer_get_identity (peer, &local_id); 179 GNUNET_TESTING_peer_get_identity (peer, &local_id);
180 printf ("my id (from TESTING): %s\n", GNUNET_h2s (&local_id.hashPubKey));
175 set1 = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_UNION); 181 set1 = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_UNION);
176 set2 = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_UNION); 182 set2 = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_UNION);
183 GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &app_id);
177 init_set1 (); 184 init_set1 ();
178} 185}
179 186