defect 1024

YKD algorithm doesn't always work when new_message_queue is full.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@885 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Steven Dake 2006-01-07 00:26:16 +00:00
parent b95a7a623d
commit a4538aee95
4 changed files with 43 additions and 12 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}
/*

View File

@ -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)