diff options
author | lurchi <lurchi@strangeplace.net> | 2017-11-18 11:10:27 +0100 |
---|---|---|
committer | lurchi <lurchi@strangeplace.net> | 2017-11-18 11:10:27 +0100 |
commit | 08d1fb4ad8581fca79dcc35e18c5d086fd11821f (patch) | |
tree | 16faaecb50fbdaf8bc618edbe7f5cc5e1611b95d /src/psyc/gnunet-service-psyc.c | |
parent | 51a27f583432d57949e3f9ea4c5f3813e9589e42 (diff) | |
download | gnunet-08d1fb4ad8581fca79dcc35e18c5d086fd11821f.tar.gz gnunet-08d1fb4ad8581fca79dcc35e18c5d086fd11821f.zip |
Introduce PART/PART_ACK messages (tests will fail until multicast module is adapted, too)
Diffstat (limited to 'src/psyc/gnunet-service-psyc.c')
-rw-r--r-- | src/psyc/gnunet-service-psyc.c | 72 |
1 files changed, 57 insertions, 15 deletions
diff --git a/src/psyc/gnunet-service-psyc.c b/src/psyc/gnunet-service-psyc.c index 73a3ae4ee..8af3264fd 100644 --- a/src/psyc/gnunet-service-psyc.c +++ b/src/psyc/gnunet-service-psyc.c | |||
@@ -508,8 +508,8 @@ cleanup_master (struct Master *mst) | |||
508 | { | 508 | { |
509 | struct Channel *chn = &mst->channel; | 509 | struct Channel *chn = &mst->channel; |
510 | 510 | ||
511 | if (NULL != mst->origin) | 511 | //if (NULL != mst->origin) |
512 | GNUNET_MULTICAST_origin_stop (mst->origin, NULL, NULL); // FIXME | 512 | // GNUNET_MULTICAST_origin_stop (mst->origin, cleanup_cb, cleanup_cls); |
513 | GNUNET_CONTAINER_multihashmap_destroy (mst->join_reqs); | 513 | GNUNET_CONTAINER_multihashmap_destroy (mst->join_reqs); |
514 | GNUNET_CONTAINER_multihashmap_remove (masters, &chn->pub_key_hash, mst); | 514 | GNUNET_CONTAINER_multihashmap_remove (masters, &chn->pub_key_hash, mst); |
515 | } | 515 | } |
@@ -546,11 +546,11 @@ cleanup_slave (struct Slave *slv) | |||
546 | GNUNET_free (slv->relays); | 546 | GNUNET_free (slv->relays); |
547 | slv->relays = NULL; | 547 | slv->relays = NULL; |
548 | } | 548 | } |
549 | if (NULL != slv->member) | 549 | //if (NULL != slv->member) |
550 | { | 550 | //{ |
551 | GNUNET_MULTICAST_member_part (slv->member, NULL, NULL); // FIXME | 551 | // GNUNET_MULTICAST_member_part (slv->member, cleanup_cb, cleanup_cls); |
552 | slv->member = NULL; | 552 | // slv->member = NULL; |
553 | } | 553 | //} |
554 | GNUNET_CONTAINER_multihashmap_remove (slaves, &chn->pub_key_hash, slv); | 554 | GNUNET_CONTAINER_multihashmap_remove (slaves, &chn->pub_key_hash, slv); |
555 | } | 555 | } |
556 | 556 | ||
@@ -646,14 +646,15 @@ client_notify_disconnect (void *cls, | |||
646 | (GNUNET_YES == chn->is_master) ? "master" : "slave", | 646 | (GNUNET_YES == chn->is_master) ? "master" : "slave", |
647 | GNUNET_h2s (&chn->pub_key_hash)); | 647 | GNUNET_h2s (&chn->pub_key_hash)); |
648 | chn->is_disconnected = GNUNET_YES; | 648 | chn->is_disconnected = GNUNET_YES; |
649 | if (NULL != chn->tmit_head) | 649 | cleanup_channel (chn); |
650 | { /* Send pending messages to multicast before cleanup. */ | 650 | //if (NULL != chn->tmit_head) |
651 | transmit_message (chn); | 651 | //{ /* Send pending messages to multicast before cleanup. */ |
652 | } | 652 | // transmit_message (chn); |
653 | else | 653 | //} |
654 | { | 654 | //else |
655 | cleanup_channel (chn); | 655 | //{ |
656 | } | 656 | // cleanup_channel (chn); |
657 | //} | ||
657 | } | 658 | } |
658 | } | 659 | } |
659 | 660 | ||
@@ -2037,6 +2038,43 @@ handle_client_join_decision (void *cls, | |||
2037 | } | 2038 | } |
2038 | 2039 | ||
2039 | 2040 | ||
2041 | static void | ||
2042 | channel_part_cb (void *cls) | ||
2043 | { | ||
2044 | struct GNUNET_SERVICE_Client *client = cls; | ||
2045 | struct GNUNET_MQ_Envelope *env; | ||
2046 | |||
2047 | env = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_PSYC_PART_ACK); | ||
2048 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), | ||
2049 | env); | ||
2050 | } | ||
2051 | |||
2052 | |||
2053 | static void | ||
2054 | handle_client_part_request (void *cls, | ||
2055 | const struct GNUNET_MessageHeader *msg) | ||
2056 | { | ||
2057 | struct Client *c = cls; | ||
2058 | |||
2059 | if (GNUNET_YES == c->channel->is_master) | ||
2060 | { | ||
2061 | struct Master *mst = (struct Master *) c->channel; | ||
2062 | |||
2063 | GNUNET_assert (NULL != mst->origin); | ||
2064 | GNUNET_MULTICAST_origin_stop (mst->origin, channel_part_cb, c->client); | ||
2065 | mst->origin = NULL; | ||
2066 | } | ||
2067 | else | ||
2068 | { | ||
2069 | struct Slave *slv = (struct Slave *) c->channel; | ||
2070 | |||
2071 | GNUNET_assert (NULL != slv->member); | ||
2072 | GNUNET_MULTICAST_member_part (slv->member, channel_part_cb, c->client); | ||
2073 | slv->member = NULL; | ||
2074 | } | ||
2075 | } | ||
2076 | |||
2077 | |||
2040 | /** | 2078 | /** |
2041 | * Send acknowledgement to a client. | 2079 | * Send acknowledgement to a client. |
2042 | * | 2080 | * |
@@ -2805,6 +2843,10 @@ GNUNET_SERVICE_MAIN | |||
2805 | GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION, | 2843 | GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION, |
2806 | struct GNUNET_PSYC_JoinDecisionMessage, | 2844 | struct GNUNET_PSYC_JoinDecisionMessage, |
2807 | NULL), | 2845 | NULL), |
2846 | GNUNET_MQ_hd_fixed_size (client_part_request, | ||
2847 | GNUNET_MESSAGE_TYPE_PSYC_PART_REQUEST, | ||
2848 | struct GNUNET_MessageHeader, | ||
2849 | NULL), | ||
2808 | GNUNET_MQ_hd_var_size (client_psyc_message, | 2850 | GNUNET_MQ_hd_var_size (client_psyc_message, |
2809 | GNUNET_MESSAGE_TYPE_PSYC_MESSAGE, | 2851 | GNUNET_MESSAGE_TYPE_PSYC_MESSAGE, |
2810 | struct GNUNET_MessageHeader, | 2852 | struct GNUNET_MessageHeader, |