diff --git a/exec/totempg.c b/exec/totempg.c index 505e3b12..e9ad7162 100644 --- a/exec/totempg.c +++ b/exec/totempg.c @@ -948,10 +948,8 @@ int totempg_groups_mcast_joined ( iovec_mcast[i + instance->groups_cnt + 1].iov_base = iovec[i].iov_base; } - mcast_msg (iovec_mcast, iov_len + instance->groups_cnt + 1, guarantee); - + error = mcast_msg (iovec_mcast, iov_len + instance->groups_cnt + 1, guarantee); saHandleInstancePut (&totempg_groups_instance_database, handle); - return (0); error_exit: return (error); @@ -1026,10 +1024,9 @@ int totempg_groups_mcast_groups ( iovec_mcast[i + groups_cnt + 1].iov_base = iovec[i].iov_base; } - mcast_msg (iovec_mcast, iov_len + groups_cnt + 1, guarantee); + error = mcast_msg (iovec_mcast, iov_len + groups_cnt + 1, guarantee); saHandleInstancePut (&totempg_groups_instance_database, handle); - return (0); error_exit: return (error); diff --git a/exec/totemrrp.c b/exec/totemrrp.c index e7151435..8a9da318 100644 --- a/exec/totemrrp.c +++ b/exec/totemrrp.c @@ -811,6 +811,7 @@ int totemrrp_mcast_flush_send ( goto error_exit; } +// TODO this needs to return the result instance->rrp_algo->mcast_flush_send (instance, msg, msg_len); saHandleInstancePut (&totemrrp_instance_database, handle); @@ -840,6 +841,8 @@ int totemrrp_mcast_noflush_send ( * an encryption/hmac and decryption/hmac */ if (instance->processor_count > 1) { + +// TODO this needs to return the result instance->rrp_algo->mcast_noflush_send (instance, iovec, iov_len); } diff --git a/exec/totemsrp.c b/exec/totemsrp.c index e9eb3a51..60df2266 100644 --- a/exec/totemsrp.c +++ b/exec/totemsrp.c @@ -1709,6 +1709,7 @@ int totemsrp_mcast ( } if (queue_is_full (&instance->new_message_queue)) { +printf ("queue full\n"); return (-1); } for (j = 0, i = 0; i < iov_len; i++) { @@ -1761,17 +1762,15 @@ int totemsrp_mcast ( return (0); error_iovec: - saHandleInstancePut (&totemsrp_instance_database, handle); for (j = 0; j < i; j++) { free (message_item.iovec[j].iov_base); } - return (-1); error_mcast: saHandleInstancePut (&totemsrp_instance_database, handle); error_exit: - return (0); + return (-1); } /* diff --git a/exec/ykd.c b/exec/ykd.c index 7d795eba..e87b44bb 100644 --- a/exec/ykd.c +++ b/exec/ykd.c @@ -132,6 +132,10 @@ static int primary_designated = 0; static struct memb_ring_id ykd_ring_id; +static void *ykd_attempt_send_callback_token_handle = 0; + +static void *ykd_state_send_callback_token_handle = 0; + static void (*ykd_primary_callback_fn) ( struct totem_ip_address *view_list, int view_list_entries, @@ -147,10 +151,11 @@ void ykd_state_init (void) ykd_state.last_primary.member_list_entries = 0; } -void ykd_state_send (void) +int ykd_state_send_msg (enum totem_callback_token_type type, void *context) { struct iovec iovec[2]; struct ykd_header header; + int res; header.id = YKD_HEADER_SENDSTATE; @@ -159,20 +164,47 @@ void ykd_state_send (void) iovec[1].iov_base = &ykd_state; iovec[1].iov_len = sizeof (struct ykd_state); - totempg_groups_mcast_joined (ykd_group_handle, iovec, 2, TOTEMPG_AGREED); + res = totempg_groups_mcast_joined (ykd_group_handle, iovec, 2, + TOTEMPG_AGREED); + + return (res); } -void ykd_attempt_send (void) +void ykd_state_send (void) +{ + totempg_callback_token_create ( + &ykd_state_send_callback_token_handle, + TOTEM_CALLBACK_TOKEN_SENT, + 1, /* delete after callback */ + ykd_state_send_msg, + NULL); +} + +int ykd_attempt_send_msg (enum totem_callback_token_type type, void *context) { struct iovec iovec; struct ykd_header header; + int res; header.id = YKD_HEADER_SENDSTATE; iovec.iov_base = &header; iovec.iov_len = sizeof (struct ykd_header); - totempg_groups_mcast_joined (ykd_group_handle, &iovec, 1, TOTEMPG_AGREED); + res = totempg_groups_mcast_joined (ykd_group_handle, &iovec, 1, + TOTEMPG_AGREED); + + return (res); +} + +void ykd_attempt_send (void) +{ + totempg_callback_token_create ( + &ykd_attempt_send_callback_token_handle, + TOTEM_CALLBACK_TOKEN_SENT, + 1, /* delete after callback */ + ykd_attempt_send_msg, + NULL); } void compute (void)