aboutsummaryrefslogtreecommitdiff
path: root/src/psycstore
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2014-07-27 11:35:43 +0000
committerGabor X Toth <*@tg-x.net>2014-07-27 11:35:43 +0000
commit1ac8baae5380d8f83efb31390568b717e871823a (patch)
treedc363148002cba0f94d9e2c9a6f3b2576bb39793 /src/psycstore
parent0ea6bab62cd1d29e32c5d442d865e1b6bf82bef1 (diff)
downloadgnunet-1ac8baae5380d8f83efb31390568b717e871823a.tar.gz
gnunet-1ac8baae5380d8f83efb31390568b717e871823a.zip
psycstore: add option to perform membership test when retrieving fragment or message
Diffstat (limited to 'src/psycstore')
-rw-r--r--src/psycstore/gnunet-service-psycstore.c96
-rw-r--r--src/psycstore/psycstore.h45
-rw-r--r--src/psycstore/psycstore_api.c87
-rw-r--r--src/psycstore/test_psycstore.c32
4 files changed, 219 insertions, 41 deletions
diff --git a/src/psycstore/gnunet-service-psycstore.c b/src/psycstore/gnunet-service-psycstore.c
index 8a70bb22f..87ace92be 100644
--- a/src/psycstore/gnunet-service-psycstore.c
+++ b/src/psycstore/gnunet-service-psycstore.c
@@ -122,11 +122,43 @@ send_result_code (struct GNUNET_SERVER_Client *client, uint32_t result_code,
122 GNUNET_free (res); 122 GNUNET_free (res);
123} 123}
124 124
125enum
126{
127 MEMBERSHIP_TEST_NOT_NEEDED = 0,
128 MEMBERSHIP_TEST_NEEDED = 1,
129 MEMBERSHIP_TEST_DONE = 2,
130} MessageMembershipTest;
125 131
126struct SendClosure 132struct SendClosure
127{ 133{
128 struct GNUNET_SERVER_Client *client; 134 struct GNUNET_SERVER_Client *client;
135
136 /**
137 * Channel's public key.
138 */
139 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
140
141 /**
142 * Slave's public key.
143 */
144 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
145
146 /**
147 * Operation ID.
148 */
129 uint64_t op_id; 149 uint64_t op_id;
150
151 /**
152 * Membership test result.
153 */
154 int membership_test_result;
155
156 /**
157 * Do membership test with @a slave_key before returning fragment?
158 * @see enum MessageMembershipTest
159 */
160 uint8_t membership_test;
161
130}; 162};
131 163
132 164
@@ -136,6 +168,24 @@ send_fragment (void *cls, struct GNUNET_MULTICAST_MessageHeader *msg,
136{ 168{
137 struct SendClosure *sc = cls; 169 struct SendClosure *sc = cls;
138 struct FragmentResult *res; 170 struct FragmentResult *res;
171
172 if (MEMBERSHIP_TEST_NEEDED == sc->membership_test)
173 {
174 sc->membership_test = MEMBERSHIP_TEST_DONE;
175 sc->membership_test_result
176 = db->membership_test (db->cls, &sc->channel_key, &sc->slave_key,
177 GNUNET_ntohll (msg->message_id));
178 switch (sc->membership_test_result)
179 {
180 case GNUNET_YES:
181 break;
182
183 case GNUNET_NO:
184 case GNUNET_SYSERR:
185 return GNUNET_NO;
186 }
187 }
188
139 size_t msg_size = ntohs (msg->header.size); 189 size_t msg_size = ntohs (msg->header.size);
140 190
141 res = GNUNET_malloc (sizeof (struct FragmentResult) + msg_size); 191 res = GNUNET_malloc (sizeof (struct FragmentResult) + msg_size);
@@ -152,7 +202,7 @@ send_fragment (void *cls, struct GNUNET_MULTICAST_MessageHeader *msg,
152 GNUNET_SERVER_notification_context_unicast (nc, sc->client, &res->header, 202 GNUNET_SERVER_notification_context_unicast (nc, sc->client, &res->header,
153 GNUNET_NO); 203 GNUNET_NO);
154 GNUNET_free (res); 204 GNUNET_free (res);
155 return GNUNET_OK; 205 return GNUNET_YES;
156} 206}
157 207
158 208
@@ -255,9 +305,12 @@ handle_fragment_get (void *cls,
255 struct GNUNET_SERVER_Client *client, 305 struct GNUNET_SERVER_Client *client,
256 const struct GNUNET_MessageHeader *msg) 306 const struct GNUNET_MessageHeader *msg)
257{ 307{
258 const struct FragmentGetRequest *req 308 const struct FragmentGetRequest *
259 = (const struct FragmentGetRequest *) msg; 309 req = (const struct FragmentGetRequest *) msg;
260 struct SendClosure sc = { .op_id = req->op_id, .client = client }; 310 struct SendClosure
311 sc = { .op_id = req->op_id, .client = client,
312 .channel_key = req->channel_key, .slave_key = req->slave_key,
313 .membership_test = req->do_membership_test };
261 314
262 int ret = db->fragment_get (db->cls, &req->channel_key, 315 int ret = db->fragment_get (db->cls, &req->channel_key,
263 GNUNET_ntohll (req->fragment_id), 316 GNUNET_ntohll (req->fragment_id),
@@ -266,6 +319,22 @@ handle_fragment_get (void *cls,
266 { 319 {
267 case GNUNET_YES: 320 case GNUNET_YES:
268 case GNUNET_NO: 321 case GNUNET_NO:
322 if (MEMBERSHIP_TEST_DONE == sc.membership_test)
323 {
324 switch (sc.membership_test_result)
325 {
326 case GNUNET_YES:
327 break;
328
329 case GNUNET_NO:
330 ret = GNUNET_PSYCSTORE_MEMBERSHIP_TEST_FAILED;
331 break;
332
333 case GNUNET_SYSERR:
334 ret = GNUNET_SYSERR;
335 break;
336 }
337 }
269 break; 338 break;
270 default: 339 default:
271 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 340 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -282,8 +351,13 @@ handle_message_get (void *cls,
282 struct GNUNET_SERVER_Client *client, 351 struct GNUNET_SERVER_Client *client,
283 const struct GNUNET_MessageHeader *msg) 352 const struct GNUNET_MessageHeader *msg)
284{ 353{
285 const struct MessageGetRequest *req = (const struct MessageGetRequest *) msg; 354 const struct MessageGetRequest *
286 struct SendClosure sc = { .op_id = req->op_id, .client = client }; 355 req = (const struct MessageGetRequest *) msg;
356 struct SendClosure
357 sc = { .op_id = req->op_id, .client = client,
358 .channel_key = req->channel_key, .slave_key = req->slave_key,
359 .membership_test = req->do_membership_test };
360
287 uint64_t ret_frags = 0; 361 uint64_t ret_frags = 0;
288 int64_t ret = db->message_get (db->cls, &req->channel_key, 362 int64_t ret = db->message_get (db->cls, &req->channel_key,
289 GNUNET_ntohll (req->message_id), 363 GNUNET_ntohll (req->message_id),
@@ -309,10 +383,12 @@ handle_message_get_fragment (void *cls,
309 struct GNUNET_SERVER_Client *client, 383 struct GNUNET_SERVER_Client *client,
310 const struct GNUNET_MessageHeader *msg) 384 const struct GNUNET_MessageHeader *msg)
311{ 385{
312 const struct MessageGetFragmentRequest *req = 386 const struct MessageGetFragmentRequest *
313 (const struct MessageGetFragmentRequest *) msg; 387 req = (const struct MessageGetFragmentRequest *) msg;
314 388 struct SendClosure
315 struct SendClosure sc = { .op_id = req->op_id, .client = client }; 389 sc = { .op_id = req->op_id, .client = client,
390 .channel_key = req->channel_key, .slave_key = req->slave_key,
391 .membership_test = req->do_membership_test };
316 392
317 int ret = db->message_get_fragment (db->cls, &req->channel_key, 393 int ret = db->message_get_fragment (db->cls, &req->channel_key,
318 GNUNET_ntohll (req->message_id), 394 GNUNET_ntohll (req->message_id),
diff --git a/src/psycstore/psycstore.h b/src/psycstore/psycstore.h
index 1d586990f..65d32d9fa 100644
--- a/src/psycstore/psycstore.h
+++ b/src/psycstore/psycstore.h
@@ -264,7 +264,21 @@ struct FragmentGetRequest
264 */ 264 */
265 struct GNUNET_CRYPTO_EddsaPublicKey channel_key; 265 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
266 266
267 /**
268 * Slave's public key.
269 */
270 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
271
272 /**
273 * Fragment ID to request.
274 */
267 uint64_t fragment_id GNUNET_PACKED; 275 uint64_t fragment_id GNUNET_PACKED;
276
277 /**
278 * Do membership test with @a slave_key before returning fragment?
279 * #GNUNET_YES or #GNUNET_NO
280 */
281 uint8_t do_membership_test;
268}; 282};
269 283
270 284
@@ -288,7 +302,21 @@ struct MessageGetRequest
288 */ 302 */
289 struct GNUNET_CRYPTO_EddsaPublicKey channel_key; 303 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
290 304
305 /**
306 * Slave's public key.
307 */
308 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
309
310 /**
311 * Message ID to request.
312 */
291 uint64_t message_id GNUNET_PACKED; 313 uint64_t message_id GNUNET_PACKED;
314
315 /**
316 * Do membership test with @a slave_key before returning fragment?
317 * #GNUNET_YES or #GNUNET_NO
318 */
319 uint8_t do_membership_test;
292}; 320};
293 321
294 322
@@ -312,9 +340,26 @@ struct MessageGetFragmentRequest
312 */ 340 */
313 struct GNUNET_CRYPTO_EddsaPublicKey channel_key; 341 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
314 342
343 /**
344 * Slave's public key.
345 */
346 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
347
348 /**
349 * Requested message ID.
350 */
315 uint64_t message_id GNUNET_PACKED; 351 uint64_t message_id GNUNET_PACKED;
316 352
353 /**
354 * Requested fragment offset.
355 */
317 uint64_t fragment_offset GNUNET_PACKED; 356 uint64_t fragment_offset GNUNET_PACKED;
357
358 /**
359 * Do membership test with @a slave_key before returning fragment?
360 * #GNUNET_YES or #GNUNET_NO
361 */
362 uint8_t do_membership_test;
318}; 363};
319 364
320 365
diff --git a/src/psycstore/psycstore_api.c b/src/psycstore/psycstore_api.c
index 38580b013..f034ff475 100644
--- a/src/psycstore/psycstore_api.c
+++ b/src/psycstore/psycstore_api.c
@@ -804,18 +804,29 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
804/** 804/**
805 * Retrieve a message fragment by fragment ID. 805 * Retrieve a message fragment by fragment ID.
806 * 806 *
807 * @param h Handle for the PSYCstore. 807 * @param h
808 * @param channel_key The channel we are interested in. 808 * Handle for the PSYCstore.
809 * @param fragment_id Fragment ID to check. Use 0 to get the latest message fragment. 809 * @param channel_key
810 * @param fcb Callback to call with the retrieved fragments. 810 * The channel we are interested in.
811 * @param rcb Callback to call with the result of the operation. 811 * @param slave_key
812 * @param cls Closure for the callbacks. 812 * The slave requesting the fragment. If not NULL, a membership test is
813 * performed first and the fragment is only returned if the slave has
814 * access to it.
815 * @param fragment_id
816 * Fragment ID to retrieve. Use 0 to get the latest message fragment.
817 * @param fcb
818 * Callback to call with the retrieved fragments.
819 * @param rcb
820 * Callback to call with the result of the operation.
821 * @param cls
822 * Closure for the callbacks.
813 * 823 *
814 * @return Handle that can be used to cancel the operation. 824 * @return Handle that can be used to cancel the operation.
815 */ 825 */
816struct GNUNET_PSYCSTORE_OperationHandle * 826struct GNUNET_PSYCSTORE_OperationHandle *
817GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, 827GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h,
818 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, 828 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
829 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
819 uint64_t fragment_id, 830 uint64_t fragment_id,
820 GNUNET_PSYCSTORE_FragmentCallback fcb, 831 GNUNET_PSYCSTORE_FragmentCallback fcb,
821 GNUNET_PSYCSTORE_ResultCallback rcb, 832 GNUNET_PSYCSTORE_ResultCallback rcb,
@@ -835,6 +846,11 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h,
835 req->header.size = htons (sizeof (*req)); 846 req->header.size = htons (sizeof (*req));
836 req->channel_key = *channel_key; 847 req->channel_key = *channel_key;
837 req->fragment_id = GNUNET_htonll (fragment_id); 848 req->fragment_id = GNUNET_htonll (fragment_id);
849 if (NULL != slave_key)
850 {
851 req->slave_key = *slave_key;
852 req->do_membership_test = GNUNET_YES;
853 }
838 854
839 op->op_id = get_next_op_id (h); 855 op->op_id = get_next_op_id (h);
840 req->op_id = htonl (op->op_id); 856 req->op_id = htonl (op->op_id);
@@ -849,18 +865,29 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h,
849/** 865/**
850 * Retrieve all fragments of a message. 866 * Retrieve all fragments of a message.
851 * 867 *
852 * @param h Handle for the PSYCstore. 868 * @param h
853 * @param channel_key The channel we are interested in. 869 * Handle for the PSYCstore.
854 * @param message_id Message ID to check. Use 0 to get the latest message. 870 * @param channel_key
855 * @param fcb Callback to call with the retrieved fragments. 871 * The channel we are interested in.
856 * @param rcb Callback to call with the result of the operation. 872 * @param slave_key
857 * @param cls Closure for the callbacks. 873 * The slave requesting the message. If not NULL, a membership test is
874 * performed first and the message is only returned if the slave has
875 * access to it.
876 * @param message_id
877 * Message ID to retrieve. Use 0 to get the latest message.
878 * @param fcb
879 * Callback to call with the retrieved fragments.
880 * @param rcb
881 * Callback to call with the result of the operation.
882 * @param cls
883 * Closure for the callbacks.
858 * 884 *
859 * @return Handle that can be used to cancel the operation. 885 * @return Handle that can be used to cancel the operation.
860 */ 886 */
861struct GNUNET_PSYCSTORE_OperationHandle * 887struct GNUNET_PSYCSTORE_OperationHandle *
862GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, 888GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
863 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, 889 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
890 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
864 uint64_t message_id, 891 uint64_t message_id,
865 GNUNET_PSYCSTORE_FragmentCallback fcb, 892 GNUNET_PSYCSTORE_FragmentCallback fcb,
866 GNUNET_PSYCSTORE_ResultCallback rcb, 893 GNUNET_PSYCSTORE_ResultCallback rcb,
@@ -880,6 +907,11 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
880 req->header.size = htons (sizeof (*req)); 907 req->header.size = htons (sizeof (*req));
881 req->channel_key = *channel_key; 908 req->channel_key = *channel_key;
882 req->message_id = GNUNET_htonll (message_id); 909 req->message_id = GNUNET_htonll (message_id);
910 if (NULL != slave_key)
911 {
912 req->slave_key = *slave_key;
913 req->do_membership_test = GNUNET_YES;
914 }
883 915
884 op->op_id = get_next_op_id (h); 916 op->op_id = get_next_op_id (h);
885 req->op_id = htonl (op->op_id); 917 req->op_id = htonl (op->op_id);
@@ -895,19 +927,31 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
895 * Retrieve a fragment of message specified by its message ID and fragment 927 * Retrieve a fragment of message specified by its message ID and fragment
896 * offset. 928 * offset.
897 * 929 *
898 * @param h Handle for the PSYCstore. 930 * @param h
899 * @param channel_key The channel we are interested in. 931 * Handle for the PSYCstore.
900 * @param message_id Message ID to check. Use 0 to get the latest message. 932 * @param channel_key
901 * @param fragment_offset Offset of the fragment to retrieve. 933 * The channel we are interested in.
902 * @param fcb Callback to call with the retrieved fragments. 934 * @param slave_key
903 * @param rcb Callback to call with the result of the operation. 935 * The slave requesting the message fragment. If not NULL, a membership
904 * @param cls Closure for the callbacks. 936 * test is performed first and the message fragment is only returned
937 * if the slave has access to it.
938 * @param message_id
939 * Message ID to retrieve. Use 0 to get the latest message.
940 * @param fragment_offset
941 * Offset of the fragment to retrieve.
942 * @param fcb
943 * Callback to call with the retrieved fragments.
944 * @param rcb
945 * Callback to call with the result of the operation.
946 * @param cls
947 * Closure for the callbacks.
905 * 948 *
906 * @return Handle that can be used to cancel the operation. 949 * @return Handle that can be used to cancel the operation.
907 */ 950 */
908struct GNUNET_PSYCSTORE_OperationHandle * 951struct GNUNET_PSYCSTORE_OperationHandle *
909GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h, 952GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h,
910 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, 953 const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
954 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
911 uint64_t message_id, 955 uint64_t message_id,
912 uint64_t fragment_offset, 956 uint64_t fragment_offset,
913 GNUNET_PSYCSTORE_FragmentCallback fcb, 957 GNUNET_PSYCSTORE_FragmentCallback fcb,
@@ -929,6 +973,11 @@ GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h,
929 req->channel_key = *channel_key; 973 req->channel_key = *channel_key;
930 req->message_id = GNUNET_htonll (message_id); 974 req->message_id = GNUNET_htonll (message_id);
931 req->fragment_offset = GNUNET_htonll (fragment_offset); 975 req->fragment_offset = GNUNET_htonll (fragment_offset);
976 if (NULL != slave_key)
977 {
978 req->slave_key = *slave_key;
979 req->do_membership_test = GNUNET_YES;
980 }
932 981
933 op->op_id = get_next_op_id (h); 982 op->op_id = get_next_op_id (h);
934 req->op_id = htonl (op->op_id); 983 req->op_id = htonl (op->op_id);
diff --git a/src/psycstore/test_psycstore.c b/src/psycstore/test_psycstore.c
index 8ecc7a96f..3ef2439e3 100644
--- a/src/psycstore/test_psycstore.c
+++ b/src/psycstore/test_psycstore.c
@@ -331,7 +331,6 @@ message_get_result (void *cls, int64_t result, const char *err_msg)
331 GNUNET_assert (result > 0 && fcls->n && fcls->n_expected); 331 GNUNET_assert (result > 0 && fcls->n && fcls->n_expected);
332 332
333 333
334
335 modifiers[0] = (struct GNUNET_ENV_Modifier) { 334 modifiers[0] = (struct GNUNET_ENV_Modifier) {
336 .oper = '=', 335 .oper = '=',
337 .name = "_sync_foo", 336 .name = "_sync_foo",
@@ -361,7 +360,7 @@ message_get_fragment_result (void *cls, int64_t result, const char *err_msg)
361 360
362 fcls->n = 0; 361 fcls->n = 0;
363 fcls->n_expected = 3; 362 fcls->n_expected = 3;
364 op = GNUNET_PSYCSTORE_message_get (h, &channel_pub_key, 363 op = GNUNET_PSYCSTORE_message_get (h, &channel_pub_key, &slave_pub_key,
365 GNUNET_ntohll (fcls->msg[0]->message_id), 364 GNUNET_ntohll (fcls->msg[0]->message_id),
366 &fragment_result, 365 &fragment_result,
367 &message_get_result, fcls); 366 &message_get_result, fcls);
@@ -378,7 +377,7 @@ fragment_get_result (void *cls, int64_t result, const char *err_msg)
378 377
379 fcls->n = 1; 378 fcls->n = 1;
380 fcls->n_expected = 2; 379 fcls->n_expected = 2;
381 op = GNUNET_PSYCSTORE_message_get_fragment (h, &channel_pub_key, 380 op = GNUNET_PSYCSTORE_message_get_fragment (h, &channel_pub_key, &slave_pub_key,
382 GNUNET_ntohll (fcls->msg[1]->message_id), 381 GNUNET_ntohll (fcls->msg[1]->message_id),
383 GNUNET_ntohll (fcls->msg[1]->fragment_offset), 382 GNUNET_ntohll (fcls->msg[1]->fragment_offset),
384 &fragment_result, 383 &fragment_result,
@@ -396,10 +395,10 @@ fragment_store_result (void *cls, int64_t result, const char *err_msg)
396 GNUNET_assert (GNUNET_OK == result); 395 GNUNET_assert (GNUNET_OK == result);
397 396
398 if ((intptr_t) cls == GNUNET_YES) 397 if ((intptr_t) cls == GNUNET_YES)
399 { 398 { /* last fragment */
400 fcls.n = 0; 399 fcls.n = 0;
401 fcls.n_expected = 1; 400 fcls.n_expected = 1;
402 op = GNUNET_PSYCSTORE_fragment_get (h, &channel_pub_key, 401 op = GNUNET_PSYCSTORE_fragment_get (h, &channel_pub_key, &slave_pub_key,
403 GNUNET_ntohll (fcls.msg[0]->fragment_id), 402 GNUNET_ntohll (fcls.msg[0]->fragment_id),
404 &fragment_result, 403 &fragment_result,
405 &fragment_get_result, &fcls); 404 &fragment_get_result, &fcls);
@@ -408,12 +407,8 @@ fragment_store_result (void *cls, int64_t result, const char *err_msg)
408 407
409 408
410void 409void
411membership_test_result (void *cls, int64_t result, const char *err_msg) 410fragment_store ()
412{ 411{
413 op = NULL;
414 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "membership_test:\t%d\n", result);
415 GNUNET_assert (GNUNET_OK == result);
416
417 struct GNUNET_MULTICAST_MessageHeader *msg; 412 struct GNUNET_MULTICAST_MessageHeader *msg;
418 fcls.flags[0] = GNUNET_PSYCSTORE_MESSAGE_STATE; 413 fcls.flags[0] = GNUNET_PSYCSTORE_MESSAGE_STATE;
419 fcls.msg[0] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key)); 414 fcls.msg[0] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key));
@@ -461,6 +456,18 @@ membership_test_result (void *cls, int64_t result, const char *err_msg)
461 &fragment_store_result, (void *) GNUNET_YES); 456 &fragment_store_result, (void *) GNUNET_YES);
462} 457}
463 458
459
460void
461membership_test_result (void *cls, int64_t result, const char *err_msg)
462{
463 op = NULL;
464 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "membership_test:\t%d\n", result);
465 GNUNET_assert (GNUNET_OK == result);
466
467 fragment_store ();
468}
469
470
464void 471void
465membership_store_result (void *cls, int64_t result, const char *err_msg) 472membership_store_result (void *cls, int64_t result, const char *err_msg)
466{ 473{
@@ -469,7 +476,7 @@ membership_store_result (void *cls, int64_t result, const char *err_msg)
469 GNUNET_assert (GNUNET_OK == result); 476 GNUNET_assert (GNUNET_OK == result);
470 477
471 op = GNUNET_PSYCSTORE_membership_test (h, &channel_pub_key, &slave_pub_key, 478 op = GNUNET_PSYCSTORE_membership_test (h, &channel_pub_key, &slave_pub_key,
472 4, 1, 479 INT64_MAX - 10, 2,
473 &membership_test_result, NULL); 480 &membership_test_result, NULL);
474} 481}
475 482
@@ -502,7 +509,8 @@ run (void *cls,
502 GNUNET_CRYPTO_ecdsa_key_get_public (slave_key, &slave_pub_key); 509 GNUNET_CRYPTO_ecdsa_key_get_public (slave_key, &slave_pub_key);
503 510
504 op = GNUNET_PSYCSTORE_membership_store (h, &channel_pub_key, &slave_pub_key, 511 op = GNUNET_PSYCSTORE_membership_store (h, &channel_pub_key, &slave_pub_key,
505 GNUNET_YES, 4, 2, 1, 512 GNUNET_YES, INT64_MAX - 5,
513 INT64_MAX - 10, 2,
506 &membership_store_result, NULL); 514 &membership_store_result, NULL);
507} 515}
508 516