diff options
Diffstat (limited to 'src/multicast/multicast_api.c')
-rw-r--r-- | src/multicast/multicast_api.c | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/src/multicast/multicast_api.c b/src/multicast/multicast_api.c index a8b1dee40..3c911f48a 100644 --- a/src/multicast/multicast_api.c +++ b/src/multicast/multicast_api.c | |||
@@ -542,31 +542,12 @@ group_cleanup (struct GNUNET_MULTICAST_Group *grp) | |||
542 | 542 | ||
543 | 543 | ||
544 | static void | 544 | static void |
545 | group_disconnect (struct GNUNET_MULTICAST_Group *grp, | 545 | handle_group_part_ack (void *cls, |
546 | GNUNET_ContinuationCallback cb, | 546 | const struct GNUNET_MessageHeader *msg) |
547 | void *cls) | ||
548 | { | 547 | { |
549 | grp->is_disconnecting = GNUNET_YES; | 548 | struct GNUNET_MULTICAST_Group *grp = cls; |
550 | grp->disconnect_cb = cb; | ||
551 | grp->disconnect_cls = cls; | ||
552 | 549 | ||
553 | if (NULL != grp->mq) | 550 | group_cleanup (grp); |
554 | { | ||
555 | struct GNUNET_MQ_Envelope *last = GNUNET_MQ_get_last_envelope (grp->mq); | ||
556 | if (NULL != last) | ||
557 | { | ||
558 | GNUNET_MQ_notify_sent (last, | ||
559 | (GNUNET_SCHEDULER_TaskCallback) group_cleanup, grp); | ||
560 | } | ||
561 | else | ||
562 | { | ||
563 | group_cleanup (grp); | ||
564 | } | ||
565 | } | ||
566 | else | ||
567 | { | ||
568 | group_cleanup (grp); | ||
569 | } | ||
570 | } | 551 | } |
571 | 552 | ||
572 | 553 | ||
@@ -779,6 +760,10 @@ origin_connect (struct GNUNET_MULTICAST_Origin *orig) | |||
779 | GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST, | 760 | GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST, |
780 | struct MulticastJoinRequestMessage, | 761 | struct MulticastJoinRequestMessage, |
781 | grp), | 762 | grp), |
763 | GNUNET_MQ_hd_fixed_size (group_part_ack, | ||
764 | GNUNET_MESSAGE_TYPE_MULTICAST_PART_ACK, | ||
765 | struct GNUNET_MessageHeader, | ||
766 | grp), | ||
782 | GNUNET_MQ_hd_fixed_size (group_replay_request, | 767 | GNUNET_MQ_hd_fixed_size (group_replay_request, |
783 | GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST, | 768 | GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST, |
784 | struct MulticastReplayRequestMessage, | 769 | struct MulticastReplayRequestMessage, |
@@ -879,8 +864,13 @@ GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *orig, | |||
879 | void *stop_cls) | 864 | void *stop_cls) |
880 | { | 865 | { |
881 | struct GNUNET_MULTICAST_Group *grp = &orig->grp; | 866 | struct GNUNET_MULTICAST_Group *grp = &orig->grp; |
867 | struct GNUNET_MQ_Envelope *env; | ||
882 | 868 | ||
883 | group_disconnect (grp, stop_cb, stop_cls); | 869 | grp->is_disconnecting = GNUNET_YES; |
870 | grp->disconnect_cb = stop_cb; | ||
871 | grp->disconnect_cls = stop_cls; | ||
872 | env = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_MULTICAST_PART_REQUEST); | ||
873 | GNUNET_MQ_send (grp->mq, env); | ||
884 | } | 874 | } |
885 | 875 | ||
886 | 876 | ||
@@ -1065,6 +1055,10 @@ member_connect (struct GNUNET_MULTICAST_Member *mem) | |||
1065 | GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_DECISION, | 1055 | GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_DECISION, |
1066 | struct MulticastJoinDecisionMessageHeader, | 1056 | struct MulticastJoinDecisionMessageHeader, |
1067 | mem), | 1057 | mem), |
1058 | GNUNET_MQ_hd_fixed_size (group_part_ack, | ||
1059 | GNUNET_MESSAGE_TYPE_MULTICAST_PART_ACK, | ||
1060 | struct GNUNET_MessageHeader, | ||
1061 | grp), | ||
1068 | GNUNET_MQ_hd_fixed_size (group_replay_request, | 1062 | GNUNET_MQ_hd_fixed_size (group_replay_request, |
1069 | GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST, | 1063 | GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST, |
1070 | struct MulticastReplayRequestMessage, | 1064 | struct MulticastReplayRequestMessage, |
@@ -1198,16 +1192,19 @@ GNUNET_MULTICAST_member_part (struct GNUNET_MULTICAST_Member *mem, | |||
1198 | GNUNET_ContinuationCallback part_cb, | 1192 | GNUNET_ContinuationCallback part_cb, |
1199 | void *part_cls) | 1193 | void *part_cls) |
1200 | { | 1194 | { |
1201 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%p Member parting.\n", mem); | ||
1202 | struct GNUNET_MULTICAST_Group *grp = &mem->grp; | 1195 | struct GNUNET_MULTICAST_Group *grp = &mem->grp; |
1196 | struct GNUNET_MQ_Envelope *env; | ||
1203 | 1197 | ||
1204 | mem->join_dcsn_cb = NULL; | 1198 | mem->join_dcsn_cb = NULL; |
1205 | grp->join_req_cb = NULL; | 1199 | grp->join_req_cb = NULL; |
1206 | grp->message_cb = NULL; | 1200 | grp->message_cb = NULL; |
1207 | grp->replay_msg_cb = NULL; | 1201 | grp->replay_msg_cb = NULL; |
1208 | grp->replay_frag_cb = NULL; | 1202 | grp->replay_frag_cb = NULL; |
1209 | 1203 | grp->is_disconnecting = GNUNET_YES; | |
1210 | group_disconnect (grp, part_cb, part_cls); | 1204 | grp->disconnect_cb = part_cb; |
1205 | grp->disconnect_cls = part_cls; | ||
1206 | env = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_MULTICAST_PART_REQUEST); | ||
1207 | GNUNET_MQ_send (grp->mq, env); | ||
1211 | } | 1208 | } |
1212 | 1209 | ||
1213 | 1210 | ||