summaryrefslogtreecommitdiff
path: root/src/psyc/test_psyc.c
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2014-07-27 13:17:03 +0000
committerGabor X Toth <*@tg-x.net>2014-07-27 13:17:03 +0000
commitb63820a52b63d264bead047d0d6f4b76a94c4030 (patch)
treea678202b91694d3582ae61c57a7badac483693d1 /src/psyc/test_psyc.c
parent2f0367bf715c7c0abd12b3e167f329311a35f6e2 (diff)
downloadgnunet-b63820a52b63d264bead047d0d6f4b76a94c4030.tar.gz
gnunet-b63820a52b63d264bead047d0d6f4b76a94c4030.zip
psyc: membership store
Diffstat (limited to 'src/psyc/test_psyc.c')
-rw-r--r--src/psyc/test_psyc.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/psyc/test_psyc.c b/src/psyc/test_psyc.c
index da69f40b1..5eadef62c 100644
--- a/src/psyc/test_psyc.c
+++ b/src/psyc/test_psyc.c
@@ -413,20 +413,8 @@ slave_join ();
413 413
414 414
415void 415void
416join_decision_cb (void *cls, 416slave_transmit ()
417 const struct GNUNET_PSYC_JoinDecisionMessage *dcsn,
418 int is_admitted,
419 const struct GNUNET_PSYC_Message *join_msg)
420{ 417{
421 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
422 "Slave got join decision: %d\n", is_admitted);
423
424 if (GNUNET_YES != is_admitted)
425 { /* First join request is refused, retry. */
426 GNUNET_assert (1 == join_req_count);
427 slave_join ();
428 return;
429 }
430 418
431 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Slave sending request to master.\n"); 419 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Slave sending request to master.\n");
432 420
@@ -450,6 +438,26 @@ join_decision_cb (void *cls,
450 438
451 439
452void 440void
441join_decision_cb (void *cls,
442 const struct GNUNET_PSYC_JoinDecisionMessage *dcsn,
443 int is_admitted,
444 const struct GNUNET_PSYC_Message *join_msg)
445{
446 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
447 "Slave got join decision: %d\n", is_admitted);
448
449 if (GNUNET_YES != is_admitted)
450 { /* First join request is refused, retry. */
451 GNUNET_assert (1 == join_req_count);
452 slave_join ();
453 return;
454 }
455
456 slave_transmit ();
457}
458
459
460void
453join_request_cb (void *cls, 461join_request_cb (void *cls,
454 const struct GNUNET_PSYC_JoinRequestMessage *req, 462 const struct GNUNET_PSYC_JoinRequestMessage *req,
455 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, 463 const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
@@ -465,6 +473,11 @@ join_request_cb (void *cls,
465 /* Reject first request */ 473 /* Reject first request */
466 int is_admitted = (0 < join_req_count++) ? GNUNET_YES : GNUNET_NO; 474 int is_admitted = (0 < join_req_count++) ? GNUNET_YES : GNUNET_NO;
467 GNUNET_PSYC_join_decision (jh, is_admitted, 0, NULL, NULL); 475 GNUNET_PSYC_join_decision (jh, is_admitted, 0, NULL, NULL);
476
477 /* Membership store */
478 struct GNUNET_PSYC_Channel *chn = GNUNET_PSYC_master_get_channel (mst);
479 GNUNET_PSYC_channel_slave_add (chn, slave_key, 2, 2);
480 GNUNET_PSYC_channel_slave_remove (chn, &slave_pub_key, 2);
468} 481}
469 482
470 483